RKH
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rkhitl.h
Go to the documentation of this file.
1 /*
2  * --------------------------------------------------------------------------
3  *
4  * Framework RKH
5  * -------------
6  *
7  * State-machine framework for reactive embedded systems
8  *
9  * Copyright (C) 2010 Leandro Francucci.
10  * All rights reserved. Protected by international copyright laws.
11  *
12  *
13  * RKH is free software: you can redistribute it and/or modify it under the
14  * terms of the GNU General Public License as published by the Free Software
15  * Foundation, either version 3 of the License, or (at your option) any
16  * later version.
17  *
18  * RKH is distributed in the hope that it will be useful, but WITHOUT ANY
19  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21  * more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with RKH, see copying.txt file.
25  *
26  * Contact information:
27  * RKH web site: http://sourceforge.net/projects/rkh-reactivesys/
28  * e-mail: francuccilea@gmail.com
29  * ---------------------------------------------------------------------------
30  */
31 
38 /* -------------------------- Development history -------------------------- */
39 /*
40  * 2015.10.24 LeFr v2.4.05 Initial version
41  */
42 
43 /* -------------------------------- Authors -------------------------------- */
44 /*
45  * LeFr Leandro Francucci francuccilea@gmail.com
46  */
47 
48 /* --------------------------------- Notes --------------------------------- */
49 /* --------------------------------- Module -------------------------------- */
50 #ifndef __RKHITL_H__
51 #define __RKHITL_H__
52 
53 /* ----------------------------- Include files ----------------------------- */
58 #include "rkhdef.h"
59 
64 #include "rkhcfg.h"
65 
70 #include "rkhplat.h"
71 #include "rkhtype.h"
72 
77 #include "rkhtrc.h"
78 
83 #include "rkhevt.h"
84 
85 /* ---------------------- External C language linkage ---------------------- */
86 #ifdef __cplusplus
87 extern "C" {
88 #endif
89 
90 /* --------------------------------- Macros -------------------------------- */
102 #define RKH_VERSION_CODE 0x2406u
103 
109 #define RKH_RELEASE rkh_version
110 
133 #define RKH_VERSION(a, b, c) \
134  (((((a) << 12) & 0xF000) | \
135  (((b) << 8) & 0x0F00) | \
136  (((c) & 0xFF) & 0x00FF)) & 0xFFFF)
137 
142 #define RKH_ANY ((RKH_SIG_T)(-1))
143 
153 #define RKH_COMPLETION_EVENT (RKH_ANY - 1)
154 
164 #define RKH_LOWEST_PRIO (RKH_CFG_FWK_MAX_SMA - 1)
165 
166 /*
167  * Verifies port file from rkhport.h included in rkhplat.h.
168  */
169 
170 #ifndef RKHROM
171 #error "rkhport.h, Missing RKHROM: Qualifier for ROM data storage. \
172  See Porting chapter in readme file for more information"
173 #endif
174 
175 #define FOREVER for (;; )
176 
177 /*
178  * Macros for casting
179  */
180 #define CB(p) ((RKH_BASE_T *)(p))
181 #define CST(p) ((RKH_ST_T *)(p))
182 #define CCMP(p) ((RKH_SCMP_T *)(p))
183 #define CBSC(p) ((RKH_SBSC_T *)(p))
184 #define CCD(p) ((RKH_SCOND_T *)(p))
185 #define CCH(p) ((RKH_SCHOICE_T *)(p))
186 #define CH(p) ((RKH_SHIST_T *)(p))
187 #define CSBM(p) ((RKH_SSBM_T *)(p))
188 #define CRSM(p) ((RKH_RSM_T *)(p))
189 #define CM(p) ((RKHROM RKH_SM_T *)(p))
190 #define CT(p) ((RKHROM RKH_TR_T *)(p))
191 #define CPT(p) ((RKHROM RKH_SCMP_T *)(p))
192 #define CPP(p) ((RKH_PPRO_T)(p))
193 #define CG(p) ((RKH_GUARD_T)(p))
194 #define CA(p) ((RKH_TRN_ACT_T)(p))
195 #define CENP(p) ((RKH_SENP_T *)(p))
196 #define CEXP(p) ((RKH_SEXP_T *)(p))
197 #define CENPCN(p) ((RKH_ENPCN_T *)(p))
198 #define CEXPCN(p) ((RKH_EXPCN_T *)(p))
199 #define CE(p) ((RKH_EVT_T *)(p))
200 #define CCE(p) ((const RKH_EVT_T *)(p))
201 #define CV(p) ((void *)(p))
202 #define CSMA(p) ((const RKH_SMA_T *)(p))
203 #define CQ(p) ((RKH_RQ_T *)(p))
204 #define CIA(s) ((RKH_INIT_ACT_T)(RKH_SMA_ACCESS_CONST(sma, iaction)))
205 #define CTA(ta) ((RKH_TRN_ACT_T)(ta))
206 
213 #define RKH_SMA_ACCESS_STATE(me_) \
214  ((RKH_SM_T *)me_)->state
215 
216 #if RKH_CFG_SMA_SM_CONST_EN == RKH_ENABLED
217 
224  #define RKH_SMA_ACCESS_CONST(me_, member_) \
225  ((RKH_SM_T *)me_)->romrkh->member_
226 #else
227 
234  #define RKH_SMA_ACCESS_CONST(me_, member_) \
235  ((RKH_SM_T *)me_)->member_
236 #endif
237 
249 #define RKH_DCLR_PTR_TYPE(type_, me_) \
250  extern type_ * const me_
251 
252 /* ------------------------- Configuration errors -------------------------- */
253 
254 /*
255  * LOOK FOR MISSING #define CONSTANTS
256  *
257  * This section is used to generate ERROR messages at compile time if
258  * certain #define constants are MISSING in rkhcfg.h. This allows you to
259  * quickly determine the source of the error.
260  *
261  * You SHOULD NOT change this section UNLESS you would like to add more
262  * comments as to the source of the compile time error.
263  */
264 
265 /* MEMORY POOL --------------------------------------------------------- */
266 
267 #ifndef RKH_CFG_MP_EN
268  #error "RKH_CFG_MP_EN not #define'd in 'rkhcfg.h'"
269  #error " [MUST be RKH_ENABLED ] "
270  #error " [ || RKH_DISABLED] "
271 
272 #elif ((RKH_CFG_MP_EN != RKH_ENABLED) && \
273  (RKH_CFG_MP_EN != RKH_DISABLED))
274  #error "RKH_CFG_MP_EN illegally #define'd in 'rkhcfg.h'"
275  #error " [MUST be RKH_ENABLED ] "
276  #error " [ || RKH_DISABLED] "
277 
278 #elif (RKH_CFG_MP_EN == RKH_ENABLED)
279 
280  #ifndef RKH_CFG_MP_REDUCED_EN
281  #error "RKH_CFG_MP_REDUCED_EN not #define'd in 'rkhcfg.h'"
282  #error " [MUST be RKH_ENABLED ] "
283  #error " [ || RKH_DISABLED] "
284 
285  #elif ((RKH_CFG_MP_REDUCED_EN != RKH_ENABLED) && \
286  (RKH_CFG_MP_REDUCED_EN != RKH_DISABLED))
287  #error "RKH_CFG_MP_REDUCED_EN illegally #define'd in 'rkhcfg.h'"
288  #error " [MUST be RKH_ENABLED ] "
289  #error " [ || RKH_DISABLED] "
290  #endif
291 
292  #ifndef RKH_CFG_MP_SIZEOF_BSIZE
293  #error "RKH_CFG_MP_SIZEOF_BSIZE not #define'd in 'rkhcfg.h'"
294  #error " [MUST be 8 ( 8-bit size)] "
295  #error " [ || 16 (16-bit size)] "
296  #error " [ || 32 (32-bit size)] "
297 
298  #elif ((RKH_CFG_MP_SIZEOF_BSIZE != 8) && \
299  (RKH_CFG_MP_SIZEOF_BSIZE != 16) && \
300  (RKH_CFG_MP_SIZEOF_BSIZE != 32))
301  #error "RKH_CFG_MP_SIZEOF_BSIZE illegally #define'd in 'rkhcfg.h'"
302  #error " [MUST be 8 ( 8-bit size)] "
303  #error " [ || 16 (16-bit size)] "
304  #error " [ || 32 (32-bit size)] "
305  #endif
306 
307  #ifndef RKH_CFG_MP_SIZEOF_NBLOCK
308  #error "RKH_CFG_MP_SIZEOF_NBLOCK not #define'd in 'rkhcfg.h'"
309  #error " [MUST be 8 ( 8-bit size)] "
310  #error " [ || 16 (16-bit size)] "
311  #error " [ || 32 (32-bit size)] "
312 
313  #elif ((RKH_CFG_MP_SIZEOF_NBLOCK != 8) && \
314  (RKH_CFG_MP_SIZEOF_NBLOCK != 16) && \
315  (RKH_CFG_MP_SIZEOF_NBLOCK != 32))
316  #error "RKH_CFG_MP_SIZEOF_NBLOCK illegally #define'd in 'rkhcfg.h'"
317  #error " [MUST be 8 ( 8-bit size)] "
318  #error " [ || 16 (16-bit size)] "
319  #error " [ || 32 (32-bit size)] "
320  #endif
321 
322  #ifndef RKH_CFG_MP_GET_BSIZE_EN
323  #error "RKH_CFG_MP_GET_BSIZE_EN not #define'd in 'rkhcfg.h'"
324  #error " [MUST be RKH_ENABLED ] "
325  #error " [ || RKH_DISABLED] "
326 
327  #elif ((RKH_CFG_MP_GET_BSIZE_EN != RKH_ENABLED) && \
328  (RKH_CFG_MP_GET_BSIZE_EN != RKH_DISABLED))
329  #error "RKH_CFG_MP_GET_BSIZE_EN illegally #define'd in 'rkhcfg.h'"
330  #error " [MUST be RKH_ENABLED ] "
331  #error " [ || RKH_DISABLED] "
332  #endif
333 
334  #ifndef RKH_CFG_MP_GET_NFREE_EN
335  #error "RKH_CFG_MP_GET_NFREE_EN not #define'd in 'rkhcfg.h'"
336  #error " [MUST be RKH_ENABLED ] "
337  #error " [ || RKH_DISABLED] "
338 
339  #elif ((RKH_CFG_MP_GET_NFREE_EN != RKH_ENABLED) && \
340  (RKH_CFG_MP_GET_NFREE_EN != RKH_DISABLED))
341  #error "RKH_CFG_MP_GET_NFREE_EN illegally #define'd in 'rkhcfg.h'"
342  #error " [MUST be RKH_ENABLED ] "
343  #error " [ || RKH_DISABLED] "
344  #endif
345 
346  #ifndef RKH_CFG_MP_GET_LWM_EN
347  #error "RKH_CFG_MP_GET_LWM_EN not #define'd in 'rkhcfg.h'"
348  #error " [MUST be RKH_ENABLED ] "
349  #error " [ || RKH_DISABLED] "
350 
351  #elif ((RKH_CFG_MP_GET_LWM_EN != RKH_ENABLED) && \
352  (RKH_CFG_MP_GET_LWM_EN != RKH_DISABLED))
353  #error "RKH_CFG_MP_GET_LWM_EN illegally #define'd in 'rkhcfg.h'"
354  #error " [MUST be RKH_ENABLED ] "
355  #error " [ || RKH_DISABLED] "
356  #endif
357 
358  #ifndef RKH_CFG_MP_GET_INFO_EN
359  #error "RKH_CFG_MP_GET_INFO_EN not #define'd in 'rkhcfg.h'"
360  #error " [MUST be RKH_ENABLED ] "
361  #error " [ || RKH_DISABLED] "
362 
363  #elif ((RKH_CFG_MP_GET_INFO_EN != RKH_ENABLED) && \
364  (RKH_CFG_MP_GET_INFO_EN != RKH_DISABLED))
365  #error "RKH_CFG_MP_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
366  #error " [MUST be RKH_ENABLED ] "
367  #error " [ || RKH_DISABLED] "
368  #endif
369 
370 #endif
371 
372 /* QUEUE --------------------------------------------------------- */
373 
374 #ifndef RKH_CFG_RQ_EN
375  #error "RKH_CFG_RQ_EN not #define'd in 'rkhcfg.h'"
376  #error " [MUST be RKH_ENABLED ] "
377  #error " [ || RKH_DISABLED] "
378 
379 #elif ((RKH_CFG_RQ_EN != RKH_ENABLED) && \
380  (RKH_CFG_RQ_EN != RKH_DISABLED))
381  #error "RKH_CFG_RQ_EN illegally #define'd in 'rkhcfg.h'"
382  #error " [MUST be RKH_ENABLED ] "
383  #error " [ || RKH_DISABLED] "
384 
385 #endif
386 
387 #ifndef RKH_CFG_RQ_SIZEOF_NELEM
388  #error "RKH_CFG_RQ_SIZEOF_NELEM not #define'd in 'rkhcfg.h'"
389  #error " [MUST be 8 ( 8-bit size)] "
390  #error " [ || 16 (16-bit size)] "
391  #error " [ || 32 (32-bit size)] "
392 
393 #elif ((RKH_CFG_RQ_SIZEOF_NELEM != 8) && \
394  (RKH_CFG_RQ_SIZEOF_NELEM != 16) && \
395  (RKH_CFG_RQ_SIZEOF_NELEM != 32))
396  #error "RKH_CFG_RQ_SIZEOF_NELEM illegally #define'd in 'rkhcfg.h'"
397  #error " [MUST be 8 ( 8-bit size)] "
398  #error " [ || 16 (16-bit size)] "
399  #error " [ || 32 (32-bit size)] "
400 
401 #endif
402 
403 #ifndef RKH_CFG_RQ_GET_LWMARK_EN
404  #error "RKH_CFG_RQ_GET_LWMARK_EN not #define'd in 'rkhcfg.h'"
405  #error " [MUST be RKH_ENABLED ] "
406  #error " [ || RKH_DISABLED] "
407 
408 #elif ((RKH_CFG_RQ_GET_LWMARK_EN != RKH_ENABLED) && \
409  (RKH_CFG_RQ_GET_LWMARK_EN != RKH_DISABLED))
410  #error "RKH_CFG_RQ_GET_LWMARK_EN illegally #define'd in 'rkhcfg.h'"
411  #error " [MUST be RKH_ENABLED ] "
412  #error " [ || RKH_DISABLED] "
413 
414 #endif
415 
416 #ifndef RKH_CFG_RQ_READ_EN
417  #error "RKH_CFG_RQ_READ_EN not #define'd in 'rkhcfg.h'"
418  #error " [MUST be RKH_ENABLED ] "
419  #error " [ || RKH_DISABLED] "
420 
421 #elif ((RKH_CFG_RQ_READ_EN != RKH_ENABLED) && \
422  (RKH_CFG_RQ_READ_EN != RKH_DISABLED))
423  #error "RKH_CFG_RQ_READ_EN illegally #define'd in 'rkhcfg.h'"
424  #error " [MUST be RKH_ENABLED ] "
425  #error " [ || RKH_DISABLED] "
426 
427 #endif
428 
429 #ifndef RKH_CFG_RQ_DEPLETE_EN
430  #error "RKH_CFG_RQ_DEPLETE_EN not #define'd in 'rkhcfg.h'"
431  #error " [MUST be RKH_ENABLED ] "
432  #error " [ || RKH_DISABLED] "
433 
434 #elif ((RKH_CFG_RQ_DEPLETE_EN != RKH_ENABLED) && \
435  (RKH_CFG_RQ_DEPLETE_EN != RKH_DISABLED))
436  #error "RKH_CFG_RQ_DEPLETE_EN illegally #define'd in 'rkhcfg.h'"
437  #error " [MUST be RKH_ENABLED ] "
438  #error " [ || RKH_DISABLED] "
439 
440 #endif
441 
442 #ifndef RKH_CFG_RQ_IS_FULL_EN
443  #error "RKH_CFG_RQ_IS_FULL_EN not #define'd in 'rkhcfg.h'"
444  #error " [MUST be RKH_ENABLED ] "
445  #error " [ || RKH_DISABLED] "
446 
447 #elif ((RKH_CFG_RQ_IS_FULL_EN != RKH_ENABLED) && \
448  (RKH_CFG_RQ_IS_FULL_EN != RKH_DISABLED))
449  #error "RKH_CFG_RQ_IS_FULL_EN illegally #define'd in 'rkhcfg.h'"
450  #error " [MUST be RKH_ENABLED ] "
451  #error " [ || RKH_DISABLED] "
452 
453 #endif
454 
455 #ifndef RKH_CFG_RQ_GET_NELEMS_EN
456  #error "RKH_CFG_RQ_GET_NELEMS_EN not #define'd in 'rkhcfg.h'"
457  #error " [MUST be RKH_ENABLED ] "
458  #error " [ || RKH_DISABLED] "
459 
460 #elif ((RKH_CFG_RQ_GET_NELEMS_EN != RKH_ENABLED) && \
461  (RKH_CFG_RQ_GET_NELEMS_EN != RKH_DISABLED))
462  #error "RKH_CFG_RQ_GET_NELEMS_EN illegally #define'd in 'rkhcfg.h'"
463  #error " [MUST be RKH_ENABLED ] "
464  #error " [ || RKH_DISABLED] "
465 
466 #endif
467 
468 #ifndef RKH_CFG_RQ_PUT_LIFO_EN
469  #error "RKH_CFG_RQ_PUT_LIFO_EN not #define'd in 'rkhcfg.h'"
470  #error " [MUST be RKH_ENABLED ] "
471  #error " [ || RKH_DISABLED] "
472 
473 #elif ((RKH_CFG_RQ_PUT_LIFO_EN != RKH_ENABLED) && \
474  (RKH_CFG_RQ_PUT_LIFO_EN != RKH_DISABLED))
475  #error "RKH_CFG_RQ_PUT_LIFO_EN illegally #define'd in 'rkhcfg.h'"
476  #error " [MUST be RKH_ENABLED ] "
477  #error " [ || RKH_DISABLED] "
478 
479 #endif
480 
481 #ifndef RKH_CFG_RQ_GET_INFO_EN
482  #error "RKH_CFG_RQ_GET_INFO_EN not #define'd in 'rkhcfg.h'"
483  #error " [MUST be RKH_ENABLED ] "
484  #error " [ || RKH_DISABLED] "
485 
486 #elif ((RKH_CFG_RQ_GET_INFO_EN != RKH_ENABLED) && \
487  (RKH_CFG_RQ_GET_INFO_EN != RKH_DISABLED))
488  #error "RKH_CFG_RQ_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
489  #error " [MUST be RKH_ENABLED ] "
490  #error " [ || RKH_DISABLED] "
491 
492 #endif
493 
494 /* TIMER --------------------------------------------------------- */
495 
496 #ifndef RKH_CFG_TMR_EN
497  #error "RKH_CFG_TMR_EN not #define'd in 'rkhcfg.h'"
498  #error " [MUST be RKH_ENABLED ] "
499  #error " [ || RKH_DISABLED] "
500 
501 #elif ((RKH_CFG_TMR_EN != RKH_ENABLED) && \
502  (RKH_CFG_TMR_EN != RKH_DISABLED))
503  #error "RKH_CFG_TMR_EN illegally #define'd in 'rkhcfg.h'"
504  #error " [MUST be RKH_ENABLED ] "
505  #error " [ || RKH_DISABLED] "
506 
507 #elif (RKH_CFG_TMR_EN == RKH_ENABLED)
508  #ifndef RKH_CFG_FWK_TICK_RATE_HZ
509  #error "RKH_CFG_FWK_TICK_RATE_HZ not #define'd in 'rkhcfg.h'"
510  #error " [MUST be RKH_ENABLED ] "
511  #error " [ || RKH_DISABLED] "
512  #elif (RKH_CFG_FWK_TICK_RATE_HZ <= 0u)
513  #error "RKH_CFG_FWK_TICK_RATE_HZ illegally #define'd in 'rkhcfg.h'"
514  #error " [MUST be > 0] "
515  #endif
516 
517  #ifndef RKH_CFG_TMR_SIZEOF_NTIMER
518  #error "RKH_CFG_TMR_SIZEOF_NTIMER not #define'd in 'rkhcfg.h'"
519  #error " [MUST be 8 ( 8-bit size)] "
520  #error " [ || 16 (16-bit size)] "
521  #error " [ || 32 (32-bit size)] "
522 
523  #elif ((RKH_CFG_TMR_SIZEOF_NTIMER != 8) && \
524  (RKH_CFG_TMR_SIZEOF_NTIMER != 16) && \
525  (RKH_CFG_TMR_SIZEOF_NTIMER != 32))
526  #error "RKH_CFG_TMR_SIZEOF_NTIMER illegally #define'd in 'rkhcfg.h'"
527  #error " [MUST be 8 ( 8-bit size)] "
528  #error " [ || 16 (16-bit size)] "
529  #error " [ || 32 (32-bit size)] "
530  #endif
531 
532  #ifndef RKH_CFG_TMR_HOOK_EN
533  #error "RKH_CFG_TMR_HOOK_EN not #define'd in 'rkhcfg.h'"
534  #error " [MUST be RKH_ENABLED ] "
535  #error " [ || RKH_DISABLED] "
536 
537  #elif ((RKH_CFG_TMR_HOOK_EN != RKH_ENABLED) && \
538  (RKH_CFG_TMR_HOOK_EN != RKH_DISABLED))
539  #error "RKH_CFG_TMR_HOOK_EN illegally #define'd in 'rkhcfg.h'"
540  #error " [MUST be RKH_ENABLED ] "
541  #error " [ || RKH_DISABLED] "
542  #endif
543 
544  #ifndef RKH_CFG_TMR_GET_INFO_EN
545  #error "RKH_CFG_TMR_GET_INFO_EN not #define'd in 'rkhcfg.h'"
546  #error " [MUST be RKH_ENABLED ] "
547  #error " [ || RKH_DISABLED] "
548 
549  #elif ((RKH_CFG_TMR_GET_INFO_EN != RKH_ENABLED) && \
550  (RKH_CFG_TMR_GET_INFO_EN != RKH_DISABLED))
551  #error "RKH_CFG_TMR_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
552  #error " [MUST be RKH_ENABLED ] "
553  #error " [ || RKH_DISABLED] "
554  #endif
555 
556 #endif
557 
558 /* STATE MACHINE APPLICATIONS -------------------------------------------- */
559 
560 #ifndef RKH_CFG_SMA_GET_INFO_EN
561  #error "RKH_CFG_SMA_GET_INFO_EN not #define'd in 'rkhcfg.h'"
562  #error " [MUST be RKH_ENABLED ] "
563  #error " [ || RKH_DISABLED] "
564 
565 #elif ((RKH_CFG_SMA_GET_INFO_EN != RKH_ENABLED) && \
566  (RKH_CFG_SMA_GET_INFO_EN != RKH_DISABLED))
567  #error "RKH_CFG_SMA_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
568  #error " [MUST be RKH_ENABLED ] "
569  #error " [ || RKH_DISABLED] "
570 
571 #endif
572 
573 #ifndef RKH_CFG_SMA_PPRO_EN
574  #error "RKH_CFG_SMA_PPRO_EN not #define'd in 'rkhcfg.h'"
575  #error " [MUST be RKH_ENABLED ] "
576  #error " [ || RKH_DISABLED] "
577 
578 #elif ((RKH_CFG_SMA_PPRO_EN != RKH_ENABLED) && \
579  (RKH_CFG_SMA_PPRO_EN != RKH_DISABLED))
580  #error "RKH_CFG_SMA_PPRO_EN illegally #define'd in 'rkhcfg.h'"
581  #error " [MUST be RKH_ENABLED ] "
582  #error " [ || RKH_DISABLED] "
583 
584 #endif
585 
586 #ifndef RKH_CFG_SMA_HCAL_EN
587  #error "RKH_CFG_SMA_HCAL_EN not #define'd in 'rkhcfg.h'"
588  #error " [MUST be RKH_ENABLED ] "
589  #error " [ || RKH_DISABLED] "
590 
591 #elif ((RKH_CFG_SMA_HCAL_EN != RKH_ENABLED) && \
592  (RKH_CFG_SMA_HCAL_EN != RKH_DISABLED))
593  #error "RKH_CFG_SMA_HCAL_EN illegally #define'd in 'rkhcfg.h'"
594  #error " [MUST be RKH_ENABLED ] "
595  #error " [ || RKH_DISABLED] "
596 
597 #endif
598 
599 #ifndef RKH_CFG_SMA_MAX_HCAL_DEPTH
600  #error "RKH_CFG_SMA_MAX_HCAL_DEPTH not #define'd in 'rkhcfg.h'"
601  #error " [MUST be > 0] "
602  #error " [ && <= 8] "
603 
604 #elif ((RKH_CFG_SMA_MAX_HCAL_DEPTH == 0) || \
605  (RKH_CFG_SMA_MAX_HCAL_DEPTH > 8))
606  #error "RKH_CFG_SMA_MAX_HCAL_DEPTH illegally #define'd in 'rkhcfg.h'"
607  #error " [MUST be >= 0] "
608  #error " [ && <= 8] "
609 
610 #endif
611 
612 #ifndef RKH_CFG_SMA_MAX_TRC_SEGS
613  #error "RKH_CFG_SMA_MAX_TRC_SEGS not #define'd in 'rkhcfg.h'"
614  #error " [MUST be > 0] "
615  #error " [ && <= 8] "
616 
617 #elif ((RKH_CFG_SMA_MAX_TRC_SEGS == 0) || \
618  (RKH_CFG_SMA_MAX_TRC_SEGS > 8))
619  #error "RKH_CFG_SMA_MAX_TRC_SEGS illegally #define'd in 'rkhcfg.h'"
620  #error " [MUST be >= 0] "
621  #error " [ && <= 8] "
622 
623 #endif
624 
625 #ifndef RKH_CFG_SMA_PSEUDOSTATE_EN
626  #error "RKH_CFG_SMA_PSEUDOSTATE_EN not #define'd in 'rkhcfg.h'"
627  #error " [MUST be RKH_ENABLED ] "
628  #error " [ || RKH_DISABLED] "
629 
630 #elif ((RKH_CFG_SMA_PSEUDOSTATE_EN != RKH_ENABLED) && \
631  (RKH_CFG_SMA_PSEUDOSTATE_EN != RKH_DISABLED))
632  #error "RKH_CFG_SMA_PSEUDOSTATE_EN illegally #define'd in 'rkhcfg.h'"
633  #error " [MUST be RKH_ENABLED ] "
634  #error " [ || RKH_DISABLED] "
635 
636 #endif
637 
638 #ifndef RKH_CFG_SMA_DEEP_HIST_EN
639  #error "RKH_CFG_SMA_DEEP_HIST_EN not #define'd in 'rkhcfg.h'"
640  #error " [MUST be RKH_ENABLED ] "
641  #error " [ || RKH_DISABLED] "
642 
643 #elif ((RKH_CFG_SMA_DEEP_HIST_EN != RKH_ENABLED) && \
644  (RKH_CFG_SMA_DEEP_HIST_EN != RKH_DISABLED))
645  #error "RKH_CFG_SMA_DEEP_HIST_EN illegally #define'd in 'rkhcfg.h'"
646  #error " [MUST be RKH_ENABLED ] "
647  #error " [ || RKH_DISABLED] "
648 
649 #endif
650 
651 #ifndef RKH_CFG_SMA_SHALLOW_HIST_EN
652  #error "RKH_CFG_SMA_SHALLOW_HIST_EN not #define'd in 'rkhcfg.h'"
653  #error " [MUST be RKH_ENABLED ] "
654  #error " [ || RKH_DISABLED] "
655 
656 #elif ((RKH_CFG_SMA_SHALLOW_HIST_EN != RKH_ENABLED) && \
657  (RKH_CFG_SMA_SHALLOW_HIST_EN != RKH_DISABLED))
658  #error "RKH_CFG_SMA_SHALLOW_HIST_EN illegally #define'd in 'rkhcfg.h'"
659  #error " [MUST be RKH_ENABLED ] "
660  #error " [ || RKH_DISABLED] "
661 
662 #endif
663 
664 #ifndef RKH_CFG_SMA_CHOICE_EN
665  #error "RKH_CFG_SMA_CHOICE_EN not #define'd in 'rkhcfg.h'"
666  #error " [MUST be RKH_ENABLED ] "
667  #error " [ || RKH_DISABLED] "
668 
669 #elif ((RKH_CFG_SMA_CHOICE_EN != RKH_ENABLED) && \
670  (RKH_CFG_SMA_CHOICE_EN != RKH_DISABLED))
671  #error "RKH_CFG_SMA_CHOICE_EN illegally #define'd in 'rkhcfg.h'"
672  #error " [MUST be RKH_ENABLED ] "
673  #error " [ || RKH_DISABLED] "
674 
675 #endif
676 
677 #ifndef RKH_CFG_SMA_CONDITIONAL_EN
678  #error "RKH_CFG_SMA_CONDITIONAL_EN not #define'd in 'rkhcfg.h'"
679  #error " [MUST be RKH_ENABLED ] "
680  #error " [ || RKH_DISABLED] "
681 
682 #elif ((RKH_CFG_SMA_CONDITIONAL_EN != RKH_ENABLED) && \
683  (RKH_CFG_SMA_CONDITIONAL_EN != RKH_DISABLED))
684  #error "RKH_CFG_SMA_CONDITIONAL_EN illegally #define'd in 'rkhcfg.h'"
685  #error " [MUST be RKH_ENABLED ] "
686  #error " [ || RKH_DISABLED] "
687 
688 #endif
689 
690 #ifndef RKH_CFG_SMA_SUBMACHINE_EN
691  #error "RKH_CFG_SMA_SUBMACHINE_EN not #define'd in 'rkhcfg.h'"
692  #error " [MUST be RKH_ENABLED ] "
693  #error " [ || RKH_DISABLED] "
694 
695 #elif ((RKH_CFG_SMA_SUBMACHINE_EN != RKH_ENABLED) && \
696  (RKH_CFG_SMA_SUBMACHINE_EN != RKH_DISABLED))
697  #error "RKH_CFG_SMA_SUBMACHINE_EN illegally #define'd in 'rkhcfg.h'"
698  #error " [MUST be RKH_ENABLED ] "
699  #error " [ || RKH_DISABLED] "
700 
701 #endif
702 
703 #ifndef RKH_CFG_SMA_TRC_SNDR_EN
704  #error "RKH_CFG_SMA_TRC_SNDR_EN not #define'd in 'rkhcfg.h'"
705  #error " [MUST be RKH_ENABLED ] "
706  #error " [ || RKH_DISABLED] "
707 
708 #elif ((RKH_CFG_SMA_TRC_SNDR_EN != RKH_ENABLED) && \
709  (RKH_CFG_SMA_TRC_SNDR_EN != RKH_DISABLED))
710  #error "RKH_CFG_SMA_TRC_SNDR_EN illegally #define'd in 'rkhcfg.h'"
711  #error " [MUST be RKH_ENABLED ] "
712  #error " [ || RKH_DISABLED] "
713 
714 #endif
715 
716 #ifndef RKH_CFG_SMA_INIT_ARG_SMA_EN
717  #error "RKH_CFG_SMA_INIT_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
718  #error " [MUST be RKH_ENABLED ] "
719  #error " [ || RKH_DISABLED] "
720 
721 #elif ((RKH_CFG_SMA_INIT_ARG_SMA_EN != RKH_ENABLED) && \
722  (RKH_CFG_SMA_INIT_ARG_SMA_EN != RKH_DISABLED))
723  #error "RKH_CFG_SMA_INIT_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
724  #error " [MUST be RKH_ENABLED ] "
725  #error " [ || RKH_DISABLED] "
726 
727 #endif
728 
729 #ifndef RKH_CFG_SMA_ENT_ARG_SMA_EN
730  #error "RKH_CFG_SMA_ENT_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
731  #error " [MUST be RKH_ENABLED ] "
732  #error " [ || RKH_DISABLED] "
733 
734 #elif ((RKH_CFG_SMA_ENT_ARG_SMA_EN != RKH_ENABLED) && \
735  (RKH_CFG_SMA_ENT_ARG_SMA_EN != RKH_DISABLED))
736  #error "RKH_CFG_SMA_ENT_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
737  #error " [MUST be RKH_ENABLED ] "
738  #error " [ || RKH_DISABLED] "
739 
740 #endif
741 
742 #ifndef RKH_CFG_SMA_ENT_ARG_STATE_EN
743  #error "RKH_CFG_SMA_ENT_ARG_STATE_EN not #define'd in 'rkhcfg.h'"
744  #error " [MUST be RKH_ENABLED ] "
745  #error " [ || RKH_DISABLED] "
746 
747 #elif ((RKH_CFG_SMA_ENT_ARG_STATE_EN != RKH_ENABLED) && \
748  (RKH_CFG_SMA_ENT_ARG_STATE_EN != RKH_DISABLED))
749  #error "RKH_CFG_SMA_ENT_ARG_STATE_EN illegally #define'd in 'rkhcfg.h'"
750  #error " [MUST be RKH_ENABLED ] "
751  #error " [ || RKH_DISABLED] "
752 
753 #endif
754 
755 #ifndef RKH_CFG_SMA_EXT_ARG_SMA_EN
756  #error "RKH_CFG_SMA_EXT_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
757  #error " [MUST be RKH_ENABLED ] "
758  #error " [ || RKH_DISABLED] "
759 
760 #elif ((RKH_CFG_SMA_EXT_ARG_SMA_EN != RKH_ENABLED) && \
761  (RKH_CFG_SMA_EXT_ARG_SMA_EN != RKH_DISABLED))
762  #error "RKH_CFG_SMA_EXT_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
763  #error " [MUST be RKH_ENABLED ] "
764  #error " [ || RKH_DISABLED] "
765 
766 #endif
767 
768 #ifndef RKH_CFG_SMA_EXT_ARG_STATE_EN
769  #error "RKH_CFG_SMA_EXT_ARG_STATE_EN not #define'd in 'rkhcfg.h'"
770  #error " [MUST be RKH_ENABLED ] "
771  #error " [ || RKH_DISABLED] "
772 
773 #elif ((RKH_CFG_SMA_EXT_ARG_STATE_EN != RKH_ENABLED) && \
774  (RKH_CFG_SMA_EXT_ARG_STATE_EN != RKH_DISABLED))
775  #error "RKH_CFG_SMA_EXT_ARG_STATE_EN illegally #define'd in 'rkhcfg.h'"
776  #error " [MUST be RKH_ENABLED ] "
777  #error " [ || RKH_DISABLED] "
778 
779 #endif
780 
781 #ifndef RKH_CFG_SMA_ACT_ARG_SMA_EN
782  #error "RKH_CFG_SMA_ACT_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
783  #error " [MUST be RKH_ENABLED ] "
784  #error " [ || RKH_DISABLED] "
785 
786 #elif ((RKH_CFG_SMA_ACT_ARG_SMA_EN != RKH_ENABLED) && \
787  (RKH_CFG_SMA_ACT_ARG_SMA_EN != RKH_DISABLED))
788  #error "RKH_CFG_SMA_ACT_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
789  #error " [MUST be RKH_ENABLED ] "
790  #error " [ || RKH_DISABLED] "
791 
792 #endif
793 
794 #ifndef RKH_CFG_SMA_ACT_ARG_EVT_EN
795  #error "RKH_CFG_SMA_ACT_ARG_EVT_EN not #define'd in 'rkhcfg.h'"
796  #error " [MUST be RKH_ENABLED ] "
797  #error " [ || RKH_DISABLED] "
798 
799 #elif ((RKH_CFG_SMA_ACT_ARG_EVT_EN != RKH_ENABLED) && \
800  (RKH_CFG_SMA_ACT_ARG_EVT_EN != RKH_DISABLED))
801  #error "RKH_CFG_SMA_ACT_ARG_EVT_EN illegally #define'd in 'rkhcfg.h'"
802  #error " [MUST be RKH_ENABLED ] "
803  #error " [ || RKH_DISABLED] "
804 
805 #endif
806 
807 #ifndef RKH_CFG_SMA_GRD_ARG_EVT_EN
808  #error "RKH_CFG_SMA_GRD_ARG_EVT_EN not #define'd in 'rkhcfg.h'"
809  #error " [MUST be RKH_ENABLED ] "
810  #error " [ || RKH_DISABLED] "
811 
812 #elif ((RKH_CFG_SMA_GRD_ARG_EVT_EN != RKH_ENABLED) && \
813  (RKH_CFG_SMA_GRD_ARG_EVT_EN != RKH_DISABLED))
814  #error "RKH_CFG_SMA_GRD_ARG_EVT_EN illegally #define'd in 'rkhcfg.h'"
815  #error " [MUST be RKH_ENABLED ] "
816  #error " [ || RKH_DISABLED] "
817 
818 #endif
819 
820 #ifndef RKH_CFG_SMA_GRD_ARG_SMA_EN
821  #error "RKH_CFG_SMA_GRD_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
822  #error " [MUST be RKH_ENABLED ] "
823  #error " [ || RKH_DISABLED] "
824 
825 #elif ((RKH_CFG_SMA_GRD_ARG_SMA_EN != RKH_ENABLED) && \
826  (RKH_CFG_SMA_GRD_ARG_SMA_EN != RKH_DISABLED))
827  #error "RKH_CFG_SMA_GRD_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
828  #error " [MUST be RKH_ENABLED ] "
829  #error " [ || RKH_DISABLED] "
830 
831 #endif
832 
833 #ifndef RKH_CFG_SMA_PPRO_ARG_SMA_EN
834  #error "RKH_CFG_SMA_PPRO_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
835  #error " [MUST be RKH_ENABLED ] "
836  #error " [ || RKH_DISABLED] "
837 
838 #elif ((RKH_CFG_SMA_PPRO_ARG_SMA_EN != RKH_ENABLED) && \
839  (RKH_CFG_SMA_PPRO_ARG_SMA_EN != RKH_DISABLED))
840  #error "RKH_CFG_SMA_PPRO_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
841  #error " [MUST be RKH_ENABLED ] "
842  #error " [ || RKH_DISABLED] "
843 
844 #endif
845 
846 #ifndef RKH_CFG_SMA_SM_CONST_EN
847  #error "RKH_CFG_SMA_SM_CONST_EN not #define'd in 'rkhcfg.h'"
848  #error " [MUST be RKH_ENABLED ] "
849  #error " [ || RKH_DISABLED] "
850 
851 #elif ((RKH_CFG_SMA_SM_CONST_EN != RKH_ENABLED) && \
852  (RKH_CFG_SMA_SM_CONST_EN != RKH_DISABLED))
853  #error "RKH_CFG_SMA_SM_CONST_EN illegally #define'd in 'rkhcfg.h'"
854  #error " [MUST be RKH_ENABLED ] "
855  #error " [ || RKH_DISABLED] "
856 
857 #endif
858 
859 #ifndef RKH_CFG_SMA_RT_CTOR_EN
860  #error "RKH_CFG_SMA_RT_CTOR_EN not #define'd in 'rkhcfg.h'"
861  #error " [MUST be RKH_ENABLED ] "
862  #error " [ || RKH_DISABLED] "
863 
864 #elif ((RKH_CFG_SMA_RT_CTOR_EN != RKH_ENABLED) && \
865  (RKH_CFG_SMA_RT_CTOR_EN != RKH_DISABLED))
866  #error "RKH_CFG_SMA_RT_CTOR_EN illegally #define'd in 'rkhcfg.h'"
867  #error " [MUST be RKH_ENABLED ] "
868  #error " [ || RKH_DISABLED] "
869 
870 #endif
871 
872 #ifndef RKH_CFG_SMA_VFUNCT_EN
873  #error "RKH_CFG_SMA_VFUNCT_EN not #define'd in 'rkhcfg.h'"
874  #error " [MUST be RKH_ENABLED ] "
875  #error " [ || RKH_DISABLED] "
876 
877 #elif ((RKH_CFG_SMA_VFUNCT_EN != RKH_ENABLED) && \
878  (RKH_CFG_SMA_VFUNCT_EN != RKH_DISABLED))
879  #error "RKH_CFG_SMA_VFUNCT_EN illegally #define'd in 'rkhcfg.h'"
880  #error " [MUST be RKH_ENABLED ] "
881  #error " [ || RKH_DISABLED] "
882 
883 #endif
884 
885 /* TRACE --------------------------------------------------------- */
886 
887 #ifndef RKH_CFG_TRC_EN
888  #error "RKH_CFG_TRC_EN not #define'd in 'rkhcfg.h'"
889  #error " [MUST be RKH_ENABLED ] "
890  #error " [ || RKH_DISABLED] "
891 
892 #elif ((RKH_CFG_TRC_EN != RKH_ENABLED) && \
893  (RKH_CFG_TRC_EN != RKH_DISABLED))
894  #error "RKH_CFG_TRC_EN illegally #define'd in 'rkhcfg.h'"
895  #error " [MUST be RKH_ENABLED ] "
896  #error " [ || RKH_DISABLED] "
897 
898 #elif (RKH_CFG_TRC_EN == RKH_ENABLED)
899 
900  #ifndef RKH_CFG_TRC_RTFIL_EN
901  #error "RKH_CFG_TRC_RTFIL_EN not #define'd in 'rkhcfg.h'"
902  #error " [MUST be RKH_ENABLED ] "
903  #error " [ || RKH_DISABLED] "
904 
905  #elif ((RKH_CFG_TRC_RTFIL_EN != RKH_ENABLED) && \
906  (RKH_CFG_TRC_RTFIL_EN != RKH_DISABLED))
907  #error "RKH_CFG_TRC_RTFIL_EN illegally #define'd in 'rkhcfg.h'"
908  #error " [MUST be RKH_ENABLED ] "
909  #error " [ || RKH_DISABLED] "
910  #endif
911 
912  #ifndef RKH_CFG_TRC_RTFIL_SMA_EN
913  #error "RKH_CFG_TRC_RTFIL_SMA_EN not #define'd in 'rkhcfg.h'"
914  #error " [MUST be RKH_ENABLED ] "
915  #error " [ || RKH_DISABLED] "
916 
917  #elif ((RKH_CFG_TRC_RTFIL_SMA_EN != RKH_ENABLED) && \
918  (RKH_CFG_TRC_RTFIL_SMA_EN != RKH_DISABLED))
919  #error "RKH_CFG_TRC_RTFIL_SMA_EN illegally #define'd in 'rkhcfg.h'"
920  #error " [MUST be RKH_ENABLED ] "
921  #error " [ || RKH_DISABLED] "
922  #endif
923 
924  #ifndef RKH_CFG_TRC_RTFIL_SIGNAL_EN
925  #error "RKH_CFG_TRC_RTFIL_SIGNAL_EN not #define'd in 'rkhcfg.h'"
926  #error " [MUST be RKH_ENABLED ] "
927  #error " [ || RKH_DISABLED] "
928 
929  #elif ((RKH_CFG_TRC_RTFIL_SIGNAL_EN != RKH_ENABLED) && \
930  (RKH_CFG_TRC_RTFIL_SIGNAL_EN != RKH_DISABLED))
931  #error "RKH_CFG_TRC_RTFIL_SIGNAL_EN illegally #define'd in 'rkhcfg.h'"
932  #error " [MUST be RKH_ENABLED ] "
933  #error " [ || RKH_DISABLED] "
934  #endif
935 
936  #ifndef RKH_CFG_TRC_USER_TRACE_EN
937  #error "RKH_CFG_TRC_USER_TRACE_EN not #define'd in 'rkhcfg.h'"
938  #error " [MUST be RKH_ENABLED ] "
939  #error " [ || RKH_DISABLED] "
940 
941  #elif ((RKH_CFG_TRC_USER_TRACE_EN != RKH_ENABLED) && \
942  (RKH_CFG_TRC_USER_TRACE_EN != RKH_DISABLED))
943  #error "RKH_CFG_TRC_USER_TRACE_EN illegally #define'd in 'rkhcfg.h'"
944  #error " [MUST be RKH_ENABLED ] "
945  #error " [ || RKH_DISABLED] "
946  #endif
947 
948  #ifndef RKH_CFG_TRC_ALL_EN
949  #error "RKH_CFG_TRC_ALL_EN not #define'd in 'rkhcfg.h'"
950  #error " [MUST be RKH_ENABLED ] "
951  #error " [ || RKH_DISABLED] "
952 
953  #elif ((RKH_CFG_TRC_ALL_EN != RKH_ENABLED) && \
954  (RKH_CFG_TRC_ALL_EN != RKH_DISABLED))
955  #error "RKH_CFG_TRC_ALL_EN illegally #define'd in 'rkhcfg.h'"
956  #error " [MUST be RKH_ENABLED ] "
957  #error " [ || RKH_DISABLED] "
958  #endif
959 
960  #ifndef RKH_CFG_TRC_MP_EN
961  #error "RKH_CFG_TRC_MP_EN not #define'd in 'rkhcfg.h'"
962  #error " [MUST be RKH_ENABLED ] "
963  #error " [ || RKH_DISABLED] "
964 
965  #elif ((RKH_CFG_TRC_MP_EN != RKH_ENABLED) && \
966  (RKH_CFG_TRC_MP_EN != RKH_DISABLED))
967  #error "RKH_CFG_TRC_MP_EN illegally #define'd in 'rkhcfg.h'"
968  #error " [MUST be RKH_ENABLED ] "
969  #error " [ || RKH_DISABLED] "
970  #endif
971 
972  #ifndef RKH_CFG_TRC_RQ_EN
973  #error "RKH_CFG_TRC_RQ_EN not #define'd in 'rkhcfg.h'"
974  #error " [MUST be RKH_ENABLED ] "
975  #error " [ || RKH_DISABLED] "
976 
977  #elif ((RKH_CFG_TRC_RQ_EN != RKH_ENABLED) && \
978  (RKH_CFG_TRC_RQ_EN != RKH_DISABLED))
979  #error "RKH_CFG_TRC_RQ_EN illegally #define'd in 'rkhcfg.h'"
980  #error " [MUST be RKH_ENABLED ] "
981  #error " [ || RKH_DISABLED] "
982  #endif
983 
984  #ifndef RKH_CFG_TRC_SMA_EN
985  #error "RKH_CFG_TRC_SMA_EN not #define'd in 'rkhcfg.h'"
986  #error " [MUST be RKH_ENABLED ] "
987  #error " [ || RKH_DISABLED] "
988 
989  #elif ((RKH_CFG_TRC_SMA_EN != RKH_ENABLED) && \
990  (RKH_CFG_TRC_SMA_EN != RKH_DISABLED))
991  #error "RKH_CFG_TRC_SMA_EN illegally #define'd in 'rkhcfg.h'"
992  #error " [MUST be RKH_ENABLED ] "
993  #error " [ || RKH_DISABLED] "
994  #endif
995 
996  #ifndef RKH_CFG_TRC_TMR_EN
997  #error "RKH_CFG_TRC_TMR_EN not #define'd in 'rkhcfg.h'"
998  #error " [MUST be RKH_ENABLED ] "
999  #error " [ || RKH_DISABLED] "
1000 
1001  #elif ((RKH_CFG_TRC_TMR_EN != RKH_ENABLED) && \
1002  (RKH_CFG_TRC_TMR_EN != RKH_DISABLED))
1003  #error "RKH_CFG_TRC_TMR_EN illegally #define'd in 'rkhcfg.h'"
1004  #error " [MUST be RKH_ENABLED ] "
1005  #error " [ || RKH_DISABLED] "
1006  #endif
1007 
1008  #ifndef RKH_CFG_TRC_SM_EN
1009  #error "RKH_CFG_TRC_SM_EN not #define'd in 'rkhcfg.h'"
1010  #error " [MUST be RKH_ENABLED ] "
1011  #error " [ || RKH_DISABLED] "
1012 
1013  #elif ((RKH_CFG_TRC_SM_EN != RKH_ENABLED) && \
1014  (RKH_CFG_TRC_SM_EN != RKH_DISABLED))
1015  #error "RKH_CFG_TRC_SM_EN illegally #define'd in 'rkhcfg.h'"
1016  #error " [MUST be RKH_ENABLED ] "
1017  #error " [ || RKH_DISABLED] "
1018  #endif
1019 
1020  #ifndef RKH_CFG_TRC_FWK_EN
1021  #error "RKH_CFG_TRC_FWK_EN not #define'd in 'rkhcfg.h'"
1022  #error " [MUST be RKH_ENABLED ] "
1023  #error " [ || RKH_DISABLED] "
1024 
1025  #elif ((RKH_CFG_TRC_FWK_EN != RKH_ENABLED) && \
1026  (RKH_CFG_TRC_FWK_EN != RKH_DISABLED))
1027  #error "RKH_CFG_TRC_FWK_EN illegally #define'd in 'rkhcfg.h'"
1028  #error " [MUST be RKH_ENABLED ] "
1029  #error " [ || RKH_DISABLED] "
1030  #endif
1031 
1032  #ifndef RKH_CFG_TRC_ASSERT_EN
1033  #error "RKH_CFG_TRC_ASSERT_EN not #define'd in 'rkhcfg.h'"
1034  #error " [MUST be RKH_ENABLED ] "
1035  #error " [ || RKH_DISABLED] "
1036 
1037  #elif ((RKH_CFG_TRC_ASSERT_EN != RKH_ENABLED) && \
1038  (RKH_CFG_TRC_ASSERT_EN != RKH_DISABLED))
1039  #error "RKH_CFG_TRC_ASSERT_EN illegally #define'd in 'rkhcfg.h'"
1040  #error " [MUST be RKH_ENABLED ] "
1041  #error " [ || RKH_DISABLED] "
1042  #endif
1043 
1044  #ifndef RKH_CFG_TRC_SM_INIT_EN
1045  #error "RKH_CFG_TRC_SM_INIT_EN not #define'd in 'rkhcfg.h'"
1046  #error " [MUST be RKH_ENABLED ] "
1047  #error " [ || RKH_DISABLED] "
1048 
1049  #elif ((RKH_CFG_TRC_SM_INIT_EN != RKH_ENABLED) && \
1050  (RKH_CFG_TRC_SM_INIT_EN != RKH_DISABLED))
1051  #error "RKH_CFG_TRC_SM_INIT_EN illegally #define'd in 'rkhcfg.h'"
1052  #error " [MUST be RKH_ENABLED ] "
1053  #error " [ || RKH_DISABLED] "
1054  #endif
1055 
1056  #ifndef RKH_CFG_TRC_SMA_DCH_EN
1057  #error "RKH_CFG_TRC_SMA_DCH_EN not #define'd in 'rkhcfg.h'"
1058  #error " [MUST be RKH_ENABLED ] "
1059  #error " [ || RKH_DISABLED] "
1060 
1061  #elif ((RKH_CFG_TRC_SMA_DCH_EN != RKH_ENABLED) && \
1062  (RKH_CFG_TRC_SMA_DCH_EN != RKH_DISABLED))
1063  #error "RKH_CFG_TRC_SMA_DCH_EN illegally #define'd in 'rkhcfg.h'"
1064  #error " [MUST be RKH_ENABLED ] "
1065  #error " [ || RKH_DISABLED] "
1066  #endif
1067 
1068  #ifndef RKH_CFG_TRC_SM_CLRH_EN
1069  #error "RKH_CFG_TRC_SM_CLRH_EN not #define'd in 'rkhcfg.h'"
1070  #error " [MUST be RKH_ENABLED ] "
1071  #error " [ || RKH_DISABLED] "
1072 
1073  #elif ((RKH_CFG_TRC_SM_CLRH_EN != RKH_ENABLED) && \
1074  (RKH_CFG_TRC_SM_CLRH_EN != RKH_DISABLED))
1075  #error "RKH_CFG_TRC_SM_CLRH_EN illegally #define'd in 'rkhcfg.h'"
1076  #error " [MUST be RKH_ENABLED ] "
1077  #error " [ || RKH_DISABLED] "
1078  #endif
1079 
1080  #ifndef RKH_CFG_TRC_SM_TRN_EN
1081  #error "RKH_CFG_TRC_SM_TRN_EN not #define'd in 'rkhcfg.h'"
1082  #error " [MUST be RKH_ENABLED ] "
1083  #error " [ || RKH_DISABLED] "
1084 
1085  #elif ((RKH_CFG_TRC_SM_TRN_EN != RKH_ENABLED) && \
1086  (RKH_CFG_TRC_SM_TRN_EN != RKH_DISABLED))
1087  #error "RKH_CFG_TRC_SM_TRN_EN illegally #define'd in 'rkhcfg.h'"
1088  #error " [MUST be RKH_ENABLED ] "
1089  #error " [ || RKH_DISABLED] "
1090  #endif
1091 
1092  #ifndef RKH_CFG_TRC_SM_STATE_EN
1093  #error "RKH_CFG_TRC_SM_STATE_EN not #define'd in 'rkhcfg.h'"
1094  #error " [MUST be RKH_ENABLED ] "
1095  #error " [ || RKH_DISABLED] "
1096 
1097  #elif ((RKH_CFG_TRC_SM_STATE_EN != RKH_ENABLED) && \
1098  (RKH_CFG_TRC_SM_STATE_EN != RKH_DISABLED))
1099  #error "RKH_CFG_TRC_SM_STATE_EN illegally #define'd in 'rkhcfg.h'"
1100  #error " [MUST be RKH_ENABLED ] "
1101  #error " [ || RKH_DISABLED] "
1102  #endif
1103 
1104  #ifndef RKH_CFG_TRC_SM_ENSTATE_EN
1105  #error "RKH_CFG_TRC_SM_ENSTATE_EN not #define'd in 'rkhcfg.h'"
1106  #error " [MUST be RKH_ENABLED ] "
1107  #error " [ || RKH_DISABLED] "
1108 
1109  #elif ((RKH_CFG_TRC_SM_ENSTATE_EN != RKH_ENABLED) && \
1110  (RKH_CFG_TRC_SM_ENSTATE_EN != RKH_DISABLED))
1111  #error "RKH_CFG_TRC_SM_ENSTATE_EN illegally #define'd in 'rkhcfg.h'"
1112  #error " [MUST be RKH_ENABLED ] "
1113  #error " [ || RKH_DISABLED] "
1114  #endif
1115 
1116  #ifndef RKH_CFG_TRC_SM_EXSTATE_EN
1117  #error "RKH_CFG_TRC_SM_EXSTATE_EN not #define'd in 'rkhcfg.h'"
1118  #error " [MUST be RKH_ENABLED ] "
1119  #error " [ || RKH_DISABLED] "
1120 
1121  #elif ((RKH_CFG_TRC_SM_EXSTATE_EN != RKH_ENABLED) && \
1122  (RKH_CFG_TRC_SM_EXSTATE_EN != RKH_DISABLED))
1123  #error "RKH_CFG_TRC_SM_EXSTATE_EN illegally #define'd in 'rkhcfg.h'"
1124  #error " [MUST be RKH_ENABLED ] "
1125  #error " [ || RKH_DISABLED] "
1126  #endif
1127 
1128  #ifndef RKH_CFG_TRC_SM_NENEX_EN
1129  #error "RKH_CFG_TRC_SM_NENEX_EN not #define'd in 'rkhcfg.h'"
1130  #error " [MUST be RKH_ENABLED ] "
1131  #error " [ || RKH_DISABLED] "
1132 
1133  #elif ((RKH_CFG_TRC_SM_NENEX_EN != RKH_ENABLED) && \
1134  (RKH_CFG_TRC_SM_NENEX_EN != RKH_DISABLED))
1135  #error "RKH_CFG_TRC_SM_NENEX_EN illegally #define'd in 'rkhcfg.h'"
1136  #error " [MUST be RKH_ENABLED ] "
1137  #error " [ || RKH_DISABLED] "
1138  #endif
1139 
1140  #ifndef RKH_CFG_TRC_SM_NTRNACT_EN
1141  #error "RKH_CFG_TRC_SM_NTRNACT_EN not #define'd in 'rkhcfg.h'"
1142  #error " [MUST be RKH_ENABLED ] "
1143  #error " [ || RKH_DISABLED] "
1144 
1145  #elif ((RKH_CFG_TRC_SM_NTRNACT_EN != RKH_ENABLED) && \
1146  (RKH_CFG_TRC_SM_NTRNACT_EN != RKH_DISABLED))
1147  #error "RKH_CFG_TRC_SM_NTRNACT_EN illegally #define'd in 'rkhcfg.h'"
1148  #error " [MUST be RKH_ENABLED ] "
1149  #error " [ || RKH_DISABLED] "
1150  #endif
1151 
1152  #ifndef RKH_CFG_TRC_SM_TS_STATE_EN
1153  #error "RKH_CFG_TRC_SM_TS_STATE_EN not #define'd in 'rkhcfg.h'"
1154  #error " [MUST be RKH_ENABLED ] "
1155  #error " [ || RKH_DISABLED] "
1156 
1157  #elif ((RKH_CFG_TRC_SM_TS_STATE_EN != RKH_ENABLED) && \
1158  (RKH_CFG_TRC_SM_TS_STATE_EN != RKH_DISABLED))
1159  #error "RKH_CFG_TRC_SM_TS_STATE_EN illegally #define'd in 'rkhcfg.h'"
1160  #error " [MUST be RKH_ENABLED ] "
1161  #error " [ || RKH_DISABLED] "
1162  #endif
1163 
1164  #ifndef RKH_CFG_TRC_SM_PROCESS_EN
1165  #error "RKH_CFG_TRC_SM_PROCESS_EN not #define'd in 'rkhcfg.h'"
1166  #error " [MUST be RKH_ENABLED ] "
1167  #error " [ || RKH_DISABLED] "
1168 
1169  #elif ((RKH_CFG_TRC_SM_PROCESS_EN != RKH_ENABLED) && \
1170  (RKH_CFG_TRC_SM_PROCESS_EN != RKH_DISABLED))
1171  #error "RKH_CFG_TRC_SM_PROCESS_EN illegally #define'd in 'rkhcfg.h'"
1172  #error " [MUST be RKH_ENABLED ] "
1173  #error " [ || RKH_DISABLED] "
1174  #endif
1175 
1176  #ifndef RKH_CFG_TRC_SM_EXE_ACT_EN
1177  #error "RKH_CFG_TRC_SM_EXE_ACT_EN not #define'd in 'rkhcfg.h'"
1178  #error " [MUST be RKH_ENABLED ] "
1179  #error " [ || RKH_DISABLED] "
1180 
1181  #elif ((RKH_CFG_TRC_SM_EXE_ACT_EN != RKH_ENABLED) && \
1182  (RKH_CFG_TRC_SM_EXE_ACT_EN != RKH_DISABLED))
1183  #error "RKH_CFG_TRC_SM_EXE_ACT_EN illegally #define'd in 'rkhcfg.h'"
1184  #error " [MUST be RKH_ENABLED ] "
1185  #error " [ || RKH_DISABLED] "
1186  #endif
1187 
1188  #ifndef RKH_CFG_TRC_NSEQ_EN
1189  #error "RKH_CFG_TRC_NSEQ_EN not #define'd in 'rkhcfg.h'"
1190  #error " [MUST be RKH_ENABLED ] "
1191  #error " [ || RKH_DISABLED] "
1192 
1193  #elif ((RKH_CFG_TRC_NSEQ_EN != RKH_ENABLED) && \
1194  (RKH_CFG_TRC_NSEQ_EN != RKH_DISABLED))
1195  #error "RKH_CFG_TRC_NSEQ_EN illegally #define'd in 'rkhcfg.h'"
1196  #error " [MUST be RKH_ENABLED ] "
1197  #error " [ || RKH_DISABLED] "
1198  #endif
1199 
1200  #ifndef RKH_CFG_TRC_CHK_EN
1201  #error "RKH_CFG_TRC_CHK_EN not #define'd in 'rkhcfg.h'"
1202  #error " [MUST be RKH_ENABLED ] "
1203  #error " [ || RKH_DISABLED] "
1204 
1205  #elif ((RKH_CFG_TRC_CHK_EN != RKH_ENABLED) && \
1206  (RKH_CFG_TRC_CHK_EN != RKH_DISABLED))
1207  #error "RKH_CFG_TRC_CHK_EN illegally #define'd in 'rkhcfg.h'"
1208  #error " MUST be RKH_ENABLED ] "
1209  #error " || RKH_DISABLED] "
1210  #endif
1211 
1212  #ifndef RKH_CFG_TRC_TSTAMP_EN
1213  #error "RKH_CFG_TRC_TSTAMP_EN not #define'd in 'rkhcfg.h'"
1214  #error " MUST be RKH_ENABLED ] "
1215  #error " [ || RKH_DISABLED] "
1216 
1217  #elif ((RKH_CFG_TRC_TSTAMP_EN != RKH_ENABLED) && \
1218  (RKH_CFG_TRC_TSTAMP_EN != RKH_DISABLED))
1219  #error "RKH_CFG_TRC_TSTAMP_EN illegally #define'd in 'rkhcfg.h'"
1220  #error " [MUST be RKH_ENABLED ] "
1221  #error " [ || RKH_DISABLED] "
1222  #endif
1223 
1224  #ifndef RKH_CFGPORT_TRC_SIZEOF_TSTAMP
1225  #error "RKH_CFGPORT_TRC_SIZEOF_TSTAMP not #define'd in 'rkhcfg.h'"
1226  #error " [MUST be 8 ( 8-bit size)] "
1227  #error " [ || 16 (16-bit size)] "
1228  #error " [ || 32 (32-bit size)] "
1229 
1230  #elif ((RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 8) && \
1231  (RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 16) && \
1232  (RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 32))
1233  #error "RKH_CFGPORT_TRC_SIZEOF_TSTAMP illegally #define'd in 'rkhcfg.h'"
1234  #error " [MUST be 8 ( 8-bit size)] "
1235  #error " [ || 16 (16-bit size)] "
1236  #error " [ || 32 (32-bit size)] "
1237  #endif
1238 
1239  #ifndef RKH_CFGPORT_SMA_QSTO_EN
1240  #error "RKH_CFGPORT_SMA_QSTO_EN not #define'd in 'rkhcfg.h'"
1241  #error " [MUST be RKH_ENABLED ] "
1242  #error " [ || RKH_DISABLED] "
1243 
1244  #elif ((RKH_CFGPORT_SMA_QSTO_EN != RKH_ENABLED) && \
1245  (RKH_CFGPORT_SMA_QSTO_EN != RKH_DISABLED))
1246  #error "RKH_CFGPORT_SMA_QSTO_EN illegally #define'd in 'rkhcfg.h'"
1247  #error " [MUST be RKH_ENABLED ] "
1248  #error " [ || RKH_DISABLED] "
1249  #endif
1250 
1251  #ifndef RKH_CFGPORT_SMA_STK_EN
1252  #error "RKH_CFGPORT_SMA_STK_EN not #define'd in 'rkhcfg.h'"
1253  #error " [MUST be RKH_ENABLED ] "
1254  #error " [ || RKH_DISABLED] "
1255 
1256  #elif ((RKH_CFGPORT_SMA_STK_EN != RKH_ENABLED) && \
1257  (RKH_CFGPORT_SMA_STK_EN != RKH_DISABLED))
1258  #error "RKH_CFGPORT_SMA_STK_EN illegally #define'd in 'rkhcfg.h'"
1259  #error " [MUST be RKH_ENABLED ] "
1260  #error " [ || RKH_DISABLED] "
1261  #endif
1262 
1263  #ifndef RKH_CFG_TRC_SIZEOF_STREAM
1264  #error "RKH_CFG_TRC_SIZEOF_STREAM not #define'd in 'rkhcfg.h'"
1265  #error " [MUST be > 0] "
1266  #error " [ && <= 2048] "
1267 
1268  #elif ((RKH_CFG_TRC_SIZEOF_STREAM == 0) || \
1269  (RKH_CFG_TRC_SIZEOF_STREAM > 2048))
1270  #error "RKH_CFG_TRC_SIZEOF_STREAM illegally #define'd in 'rkhcfg.h'"
1271  #error " [MUST be > 0] "
1272  #error " [ && <= 2048] "
1273  #endif
1274 
1275 #endif
1276 
1277 /* FRAMEWORK --------------------------------------------------------- */
1278 
1279 #ifndef RKH_CFG_FWK_MAX_SMA
1280  #error "RKH_CFG_FWK_MAX_SMA not #define'd in 'rkhcfg.h'"
1281  #error " [MUST be >= 1] "
1282  #error " [ && <= 64] "
1283 
1284 #elif ((RKH_CFG_FWK_MAX_SMA == 0) || (RKH_CFG_FWK_MAX_SMA > 64))
1285  #error "RKH_CFG_FWK_MAX_SMA illegally #define'd in 'rkhcfg.h'"
1286  #error " [MUST be >= 1] "
1287  #error " [ && <= 64] "
1288 
1289 #endif
1290 
1291 #ifndef RKH_CFG_FWK_DYN_EVT_EN
1292  #error "RKH_CFG_FWK_DYN_EVT_EN not #define'd in 'rkhcfg.h'"
1293  #error " [MUST be RKH_ENABLED ] "
1294  #error " [ || RKH_DISABLED] "
1295 
1296 #elif (RKH_CFG_FWK_DYN_EVT_EN == RKH_DISABLED)
1297 
1298  /*
1299  * If the dynamic event support is disabled, RKH not allows to use
1300  * events with parameters, defer/recall mechanism, allocating and
1301  * recycling dynamic events, among other features.
1302  */
1303  #undef RKH_CFGPORT_NATIVE_DYN_EVT_EN
1304  #define RKH_CFGPORT_NATIVE_DYN_EVT_EN RKH_DISABLED
1305 
1306 #endif
1307 
1308 #ifndef RKH_CFG_FWK_MAX_EVT_POOL
1309  #error "RKH_CFG_FWK_MAX_EVT_POOL not #define'd in 'rkhcfg.h'"
1310  #error " [MUST be > 0] "
1311  #error " [ && < 256] "
1312 
1313 #elif (RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED)
1314  #if ((RKH_CFG_FWK_MAX_EVT_POOL == 0) || (RKH_CFG_FWK_MAX_EVT_POOL > 255))
1315  #error "RKH_CFG_FWK_MAX_EVT_POOL illegally #define'd in 'rkhcfg.h'"
1316  #error " [MUST be > 0] "
1317  #error " [ && < 256] "
1318  #endif
1319 
1320 #endif
1321 
1322 #ifndef RKH_CFG_FWK_SIZEOF_EVT
1323  #error "RKH_CFG_FWK_SIZEOF_EVT not #define'd in 'rkhcfg.h'"
1324  #error " [MUST be 8 ( 8-bit size)] "
1325  #error " [ || 16 (16-bit size)] "
1326  #error " [ || 32 (32-bit size)] "
1327 
1328 #elif ((RKH_CFG_FWK_SIZEOF_EVT != 8) && \
1329  (RKH_CFG_FWK_SIZEOF_EVT != 16) && \
1330  (RKH_CFG_FWK_SIZEOF_EVT != 32))
1331  #error "RKH_CFG_FWK_SIZEOF_EVT illegally #define'd in 'rkhcfg.h'"
1332  #error " [MUST be 8 ( 8-bit size)] "
1333  #error " [ || 16 (16-bit size)] "
1334  #error " [ || 32 (32-bit size)] "
1335 
1336 #endif
1337 
1338 #ifndef RKH_CFG_FWK_MAX_SIGNALS
1339  #error "RKH_CFG_FWK_MAX_SIGNALS not #define'd in 'rkhcfg.h'"
1340  #error " [MUST be > 0] "
1341  #error " [MUST be < 2^RKH_CFG_FWK_SIZEOF_EVT "
1342 
1343 #elif ((RKH_CFG_FWK_MAX_SIGNALS == 0u) || \
1344  (RKH_CFG_FWK_MAX_SIGNALS >= RKH_BIT(RKH_CFG_FWK_SIZEOF_EVT)))
1345  #error "RKH_CFG_FWK_MAX_SIGNALS illegally #define'd in 'rkhcfg.h'"
1346  #error " [MUST be > 0] "
1347  #error " [MUST be < 2^RKH_CFG_FWK_SIZEOF_EVT "
1348 
1349 #endif
1350 
1351 #ifndef RKH_CFG_FWK_SIZEOF_EVT_SIZE
1352  #error "RKH_CFG_FWK_SIZEOF_EVT_SIZE not #define'd in 'rkhcfg.h'"
1353  #error " [MUST be 8 ( 8-bit size)] "
1354  #error " [ || 16 (16-bit size)] "
1355  #error " [ || 32 (32-bit size)] "
1356 
1357 #elif ((RKH_CFG_FWK_SIZEOF_EVT_SIZE != 8) && \
1358  (RKH_CFG_FWK_SIZEOF_EVT_SIZE != 16) && \
1359  (RKH_CFG_FWK_SIZEOF_EVT_SIZE != 32))
1360  #error "RKH_CFG_FWK_SIZEOF_EVT_SIZE illegally #define'd in 'rkhcfg.h'"
1361  #error " [MUST be 8 ( 8-bit size)] "
1362  #error " [ || 16 (16-bit size)] "
1363  #error " [ || 32 (32-bit size)] "
1364 
1365 #endif
1366 
1367 #ifndef RKH_CFG_FWK_DEFER_EVT_EN
1368  #error "RKH_CFG_FWK_DEFER_EVT_EN not #define'd in 'rkhcfg.h'"
1369  #error " [MUST be RKH_ENABLED ] "
1370  #error " [ || RKH_DISABLED] "
1371 
1372 #elif ((RKH_CFG_FWK_DEFER_EVT_EN == RKH_ENABLED) && \
1373  (RKH_CFG_RQ_EN == RKH_DISABLED))
1374  #error "RKH_CFG_RQ_EN illegally #define'd in 'rkhcfg.h'"
1375  #error " [MUST be RKH_ENABLED ] "
1376 
1377 #endif
1378 
1379 #ifndef RKH_CFG_FWK_ASSERT_EN
1380  #error "RKH_CFG_FWK_ASSERT_EN not #define'd in 'rkhport.h'"
1381  #error " [MUST be RKH_ENABLED ] "
1382  #error " [ || RKH_DISABLED] "
1383 
1384 #elif ((RKH_CFG_FWK_ASSERT_EN != RKH_ENABLED) && \
1385  (RKH_CFG_FWK_ASSERT_EN != RKH_DISABLED))
1386  #error "RKH_CFG_FWK_ASSERT_EN illegally #define'd in 'rkhport.h'"
1387  #error " [MUST be RKH_ENABLED ] "
1388  #error " [ || RKH_DISABLED] "
1389 
1390 #endif
1391 
1392 #ifndef RKH_CFG_HOOK_DISPATCH_EN
1393  #error "RKH_CFG_HOOK_DISPATCH_EN not #define'd in 'rkhcfg.h'"
1394  #error " [MUST be RKH_ENABLED ] "
1395  #error " [ || RKH_DISABLED] "
1396 
1397 #elif ((RKH_CFG_HOOK_DISPATCH_EN != RKH_ENABLED) && \
1398  (RKH_CFG_HOOK_DISPATCH_EN != RKH_DISABLED))
1399  #error "RKH_CFG_HOOK_DISPATCH_EN illegally #define'd in 'rkhcfg.h'"
1400  #error " [MUST be RKH_ENABLED ] "
1401  #error " [ || RKH_DISABLED] "
1402 
1403 #endif
1404 
1405 #ifndef RKH_CFG_HOOK_SIGNAL_EN
1406  #error "RKH_CFG_HOOK_SIGNAL_EN not #define'd in 'rkhcfg.h'"
1407  #error " [MUST be RKH_ENABLED ] "
1408  #error " [ || RKH_DISABLED] "
1409 
1410 #elif ((RKH_CFG_HOOK_SIGNAL_EN != RKH_ENABLED) && \
1411  (RKH_CFG_HOOK_SIGNAL_EN != RKH_DISABLED))
1412  #error "RKH_CFG_HOOK_SIGNAL_EN illegally #define'd in 'rkhcfg.h'"
1413  #error " [MUST be RKH_ENABLED ] "
1414  #error " [ || RKH_DISABLED] "
1415 
1416 #endif
1417 
1418 #ifndef RKH_CFG_HOOK_TIMEOUT_EN
1419  #error "RKH_CFG_HOOK_TIMEOUT_EN not #define'd in 'rkhcfg.h'"
1420  #error " [MUST be RKH_ENABLED ] "
1421  #error " [ || RKH_DISABLED] "
1422 
1423 #elif ((RKH_CFG_HOOK_TIMEOUT_EN != RKH_ENABLED) && \
1424  (RKH_CFG_HOOK_TIMEOUT_EN != RKH_DISABLED))
1425  #error "RKH_CFG_HOOK_TIMEOUT_EN illegally #define'd in 'rkhcfg.h'"
1426  #error " [MUST be RKH_ENABLED ] "
1427  #error " [ || RKH_DISABLED] "
1428 
1429 #endif
1430 
1431 #ifndef RKH_CFG_HOOK_START_EN
1432  #error "RKH_CFG_HOOK_START_EN not #define'd in 'rkhcfg.h'"
1433  #error " [MUST be RKH_ENABLED ] "
1434  #error " [ || RKH_DISABLED] "
1435 
1436 #elif ((RKH_CFG_HOOK_START_EN != RKH_ENABLED) && \
1437  (RKH_CFG_HOOK_START_EN != RKH_DISABLED))
1438  #error "RKH_CFG_HOOK_START_EN illegally #define'd in 'rkhcfg.h'"
1439  #error " [MUST be RKH_ENABLED ] "
1440  #error " [ || RKH_DISABLED] "
1441 
1442 #endif
1443 
1444 #ifndef RKH_CFG_HOOK_EXIT_EN
1445  #error "RKH_CFG_HOOK_EXIT_EN not #define'd in 'rkhcfg.h'"
1446  #error " [MUST be RKH_ENABLED ] "
1447  #error " [ || RKH_DISABLED] "
1448 
1449 #elif ((RKH_CFG_HOOK_EXIT_EN != RKH_ENABLED) && \
1450  (RKH_CFG_HOOK_EXIT_EN != RKH_DISABLED))
1451  #error "RKH_CFG_HOOK_EXIT_EN illegally #define'd in 'rkhcfg.h'"
1452  #error " [MUST be RKH_ENABLED ] "
1453  #error " [ || RKH_DISABLED] "
1454 
1455 #endif
1456 
1457 #ifndef RKH_CFG_HOOK_TIMETICK_EN
1458  #error "RKH_CFG_HOOK_TIMETICK_EN not #define'd in 'rkhcfg.h'"
1459  #error " [MUST be RKH_ENABLED ] "
1460  #error " [ || RKH_DISABLED] "
1461 
1462 #elif ((RKH_CFG_HOOK_TIMETICK_EN != RKH_ENABLED) && \
1463  (RKH_CFG_HOOK_TIMETICK_EN != RKH_DISABLED))
1464  #error "RKH_CFG_HOOK_TIMETICK_EN illegally #define'd in 'rkhcfg.h'"
1465  #error " [MUST be RKH_ENABLED ] "
1466  #error " [ || RKH_DISABLED] "
1467 
1468 #endif
1469 
1470 #ifndef RKH_CFG_HOOK_PUT_TRCEVT_EN
1471  #error "RKH_CFG_HOOK_PUT_TRCEVT_EN not #define'd in 'rkhcfg.h'"
1472  #error " [MUST be RKH_ENABLED ] "
1473  #error " [ || RKH_DISABLED] "
1474 
1475 #elif ((RKH_CFG_HOOK_PUT_TRCEVT_EN != RKH_ENABLED) && \
1476  (RKH_CFG_HOOK_PUT_TRCEVT_EN != RKH_DISABLED))
1477  #error "RKH_CFG_HOOK_PUT_TRCEVT_EN illegally #define'd in 'rkhcfg.h'"
1478  #error " [MUST be RKH_ENABLED ] "
1479  #error " [ || RKH_DISABLED] "
1480 
1481 #endif
1482 
1483 #ifndef RKH_CFG_SMA_INIT_EVT_EN
1484  #error "RKH_CFG_SMA_INIT_EVT_EN not #define'd in 'rkhcfg.h'"
1485  #error " [MUST be RKH_ENABLED ] "
1486  #error " [ || RKH_DISABLED] "
1487 
1488 #elif ((RKH_CFG_SMA_INIT_EVT_EN != RKH_ENABLED) && \
1489  (RKH_CFG_SMA_INIT_EVT_EN != RKH_DISABLED))
1490  #error "RKH_CFG_SMA_INIT_EVT_EN illegally #define'd in 'rkhcfg.h'"
1491  #error " [MUST be RKH_ENABLED ] "
1492  #error " [ || RKH_DISABLED] "
1493 
1494 #endif
1495 
1496 /* PORT --------------------------------------------------------- */
1497 
1498 #ifndef RKH_CFGPORT_SMA_THREAD_EN
1499  #error "RKH_CFGPORT_SMA_THREAD_EN not #define'd in 'rkhport.h'"
1500  #error " [MUST be RKH_ENABLED ] "
1501  #error " [ || RKH_DISABLED] "
1502 
1503 #elif ((RKH_CFGPORT_SMA_THREAD_EN != RKH_ENABLED) && \
1504  (RKH_CFGPORT_SMA_THREAD_EN != RKH_DISABLED))
1505  #error "RKH_CFGPORT_SMA_THREAD_EN illegally #define'd in 'rkhport.h'"
1506  #error " [MUST be RKH_ENABLED ] "
1507  #error " [ || RKH_DISABLED] "
1508 
1509 #endif
1510 
1511 #ifndef RKH_CFGPORT_SMA_THREAD_DATA_EN
1512  #error "RKH_CFGPORT_SMA_THREAD_DATA_EN not #define'd in 'rkhport.h'"
1513  #error " [MUST be RKH_ENABLED ] "
1514  #error " [ || RKH_DISABLED] "
1515 
1516 #elif ((RKH_CFGPORT_SMA_THREAD_DATA_EN != RKH_ENABLED) && \
1517  (RKH_CFGPORT_SMA_THREAD_DATA_EN != RKH_DISABLED))
1518  #error "RKH_CFGPORT_SMA_THREAD_DATA_EN illegally #define'd in 'rkhport.h'"
1519  #error " [MUST be RKH_ENABLED ] "
1520  #error " [ || RKH_DISABLED] "
1521 
1522 #endif
1523 
1524 #ifndef RKH_CFGPORT_NATIVE_SCHEDULER_EN
1525  #error "RKH_CFGPORT_NATIVE_SCHEDULER_EN not #define'd in 'rkhport.h'"
1526  #error " [MUST be RKH_ENABLED ] "
1527  #error " [ || RKH_DISABLED] "
1528 
1529 #elif ((RKH_CFGPORT_NATIVE_SCHEDULER_EN != RKH_ENABLED) && \
1530  (RKH_CFGPORT_NATIVE_SCHEDULER_EN != RKH_DISABLED))
1531  #error "RKH_CFGPORT_NATIVE_SCHEDULER_EN illegally #define'd in 'rkhport.h'"
1532  #error " [MUST be RKH_ENABLED ] "
1533  #error " [ || RKH_DISABLED] "
1534 
1535 #endif
1536 
1537 #ifndef RKH_CFGPORT_NATIVE_EQUEUE_EN
1538  #error "RKH_CFGPORT_NATIVE_EQUEUE_EN not #define'd in 'rkhport.h'"
1539  #error " [MUST be RKH_ENABLED ] "
1540  #error " [ || RKH_DISABLED] "
1541 
1542 #elif ((RKH_CFGPORT_NATIVE_EQUEUE_EN != RKH_ENABLED) && \
1543  (RKH_CFGPORT_NATIVE_EQUEUE_EN != RKH_DISABLED))
1544  #error "RKH_CFGPORT_NATIVE_EQUEUE_EN illegally #define'd in 'rkhport.h'"
1545  #error " [MUST be RKH_ENABLED ] "
1546  #error " [ || RKH_DISABLED] "
1547 
1548 #elif ((RKH_CFGPORT_NATIVE_EQUEUE_EN == RKH_ENABLED) && \
1549  (RKH_CFG_RQ_EN != RKH_ENABLED))
1550  #error "RKH_CFG_RQ_EN illegally #define'd in 'rkhcfg.h'"
1551  #error " [MUST be RKH_ENABLED ] "
1552  #error " [ || RKH_DISABLED] "
1553 
1554 #endif
1555 
1556 #ifndef RKH_CFGPORT_NATIVE_DYN_EVT_EN
1557  #error "RKH_CFGPORT_NATIVE_DYN_EVT_EN not #define'd in 'rkhport.h'"
1558  #error " [MUST be RKH_ENABLED ] "
1559  #error " [ || RKH_DISABLED] "
1560 
1561 #elif ((RKH_CFGPORT_NATIVE_DYN_EVT_EN != RKH_ENABLED) && \
1562  (RKH_CFGPORT_NATIVE_DYN_EVT_EN != RKH_DISABLED))
1563  #error "RKH_CFGPORT_NATIVE_DYN_EVT_EN illegally #define'd in 'rkhport.h'"
1564  #error " [MUST be RKH_ENABLED ] "
1565  #error " [ || RKH_DISABLED] "
1566 
1567 #elif (RKH_CFGPORT_NATIVE_DYN_EVT_EN == RKH_ENABLED)
1568  #if ((RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED) && \
1569  (RKH_CFG_MP_EN == RKH_DISABLED))
1570  #error "RKH_CFG_FWK_DYN_EVT_EN illegally #define'd in 'rkhcfg.h'"
1571  #error " [MUST be RKH_ENABLED ] "
1572  #error "RKH_CFG_MP_EN illegally #define'd in 'rkhcfg.h'"
1573  #error " [MUST be RKH_ENABLED ] "
1574  #endif
1575 
1576 #endif
1577 
1578 #ifndef RKH_CFGPORT_REENTRANT_EN
1579  #error "RKH_CFGPORT_REENTRANT_EN not #define'd in 'rkhport.h'"
1580  #error " [MUST be RKH_ENABLED ] "
1581  #error " [ || RKH_DISABLED] "
1582 
1583 #elif ((RKH_CFGPORT_REENTRANT_EN != RKH_ENABLED) && \
1584  (RKH_CFGPORT_REENTRANT_EN != RKH_DISABLED))
1585  #error "RKH_CFGPORT_REENTRANT_EN illegally #define'd in 'rkhport.h'"
1586  #error " [MUST be RKH_ENABLED ] "
1587  #error " [ || RKH_DISABLED] "
1588 
1589 #endif
1590 
1591 #ifndef RKH_CFGPORT_TRC_SIZEOF_PTR
1592  #error "RKH_CFGPORT_TRC_SIZEOF_PTR not #define'd in 'rkhport.h'"
1593  #error " [MUST be 8 ( 8-bit pointer)] "
1594  #error " [ || 16 (16-bit pointer)] "
1595  #error " [ || 32 (32-bit pointer)] "
1596 
1597 #elif ((RKH_CFGPORT_TRC_SIZEOF_PTR != 8) && \
1598  (RKH_CFGPORT_TRC_SIZEOF_PTR != 16) && \
1599  (RKH_CFGPORT_TRC_SIZEOF_PTR != 32))
1600  #error "RKH_CFGPORT_TRC_SIZEOF_PTR illegally #define'd in 'rkhport.h'"
1601  #error " [MUST be 8 ( 8-bit pointer)] "
1602  #error " [ || 16 (16-bit pointer)] "
1603  #error " [ || 32 (32-bit pointer)] "
1604 
1605 #endif
1606 
1607 #ifndef RKH_CFGPORT_TRC_SIZEOF_FUN_PTR
1608  #error "RKH_CFGPORT_TRC_SIZEOF_FUN_PTR not #define'd in 'rkhport.h'"
1609  #error " [MUST be 8 ( 8-bit pointer)] "
1610  #error " [ || 16 (16-bit pointer)] "
1611  #error " [ || 32 (32-bit pointer)] "
1612 
1613 #elif ((RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 8) && \
1614  (RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 16) && \
1615  (RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 32))
1616  #error "RKH_CFGPORT_TRC_SIZEOF_FUN_PTR illegally #define'd in 'rkhport.h'"
1617  #error " [MUST be 8 ( 8-bit pointer)] "
1618  #error " [ || 16 (16-bit pointer)] "
1619  #error " [ || 32 (32-bit pointer)] "
1620 
1621 #endif
1622 
1633 #define RKH_TICK_RATE_MS \
1634  ((RKH_TNT_T)(1000 / RKH_CFG_FWK_TICK_RATE_HZ))
1635 
1645 #define RKH_TIME_MS(ms_) ((ms_) / RKH_TICK_RATE_MS)
1646 #define RKH_TIME_SEC(s_) ((s_) * 1000u / RKH_TICK_RATE_MS)
1647 #define RKH_TIME_MIN(m_) ((m_) * 60 * 1000u / RKH_TICK_RATE_MS)
1648 
1650 /*
1651  * The following macros and constants are INTERNAL to RKH and
1652  * the user application should NOT call it.
1653  */
1654 
1655 #define RKH_REGULAR 0x80
1656 #define RKH_PSEUDO 0
1657 #define RKH_TYPE(t,i) (t | i)
1658 
1659 #define RKH_UNKNOWN_VERTEX RKH_TYPE(0, 0)
1660 #define RKH_BASIC RKH_TYPE(RKH_REGULAR, 0)
1661 #define RKH_COMPOSITE RKH_TYPE(RKH_REGULAR, 0x01)
1662 #define RKH_SUBMACHINE RKH_TYPE(RKH_REGULAR, 0x02)
1663 #define RKH_REF_SUBMACHINE RKH_TYPE(RKH_REGULAR, 0x04)
1664 #define RKH_FINAL RKH_TYPE(RKH_REGULAR, 0x08)
1665 
1666 #define RKH_CONDITIONAL RKH_TYPE(RKH_PSEUDO, 0x02)
1667 #define RKH_CHOICE RKH_TYPE(RKH_PSEUDO, 0x04)
1668 #define RKH_SHISTORY RKH_TYPE(RKH_PSEUDO, 0x08)
1669 #define RKH_DHISTORY RKH_TYPE(RKH_PSEUDO, 0x10)
1670 #define RKH_ENPOINT RKH_TYPE(RKH_PSEUDO, 0x20)
1671 #define RKH_EXPOINT RKH_TYPE(RKH_PSEUDO, 0x40)
1672 
1673 #define RKH_NO_HISTORY RKH_UNKNOWN_VERTEX
1674 
1675 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_DISABLED || \
1676  (RKH_CFG_SMA_DEEP_HIST_EN == RKH_DISABLED && \
1677  RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_DISABLED && \
1678  RKH_CFG_SMA_SUBMACHINE_EN == RKH_DISABLED && \
1679  RKH_CFG_SMA_CONDITIONAL_EN == RKH_DISABLED && \
1680  RKH_CFG_SMA_CHOICE_EN == RKH_DISABLED))
1681  #define RKH_PSEUDOSTATE RKH_DISABLED
1682 #else
1683  #define RKH_PSEUDOSTATE RKH_ENABLED
1684 #endif
1685 
1686 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1687  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1688  (RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_ENABLED || \
1689  RKH_CFG_SMA_DEEP_HIST_EN == RKH_ENABLED))
1690  #define RKH_HISTORY_ENABLED
1691 #endif
1692 
1693 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1694  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1695  RKH_CFG_SMA_DEEP_HIST_EN == RKH_ENABLED)
1696  #define RKH_DEEP_ENABLED
1697 #endif
1698 
1699 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1700  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1701  RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_ENABLED)
1702  #define RKH_SHALLOW_ENABLED
1703 #endif
1704 
1705 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1706  RKH_CFG_SMA_SUBMACHINE_EN == RKH_ENABLED)
1707  #define RKH_SUBMACHINE_ENABLED
1708 #endif
1709 
1710 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1711  RKH_CFG_SMA_CHOICE_EN == RKH_ENABLED)
1712  #define RKH_CHOICE_ENABLED
1713 #endif
1714 
1715 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1716  (RKH_CFG_SMA_CONDITIONAL_EN == RKH_ENABLED || \
1717  RKH_CFG_SMA_CHOICE_EN == RKH_ENABLED))
1718  #define RKH_CHOICE_OR_CONDITIONAL_ENABLED
1719 #endif
1720 
1721 #if RKH_CFG_HOOK_DISPATCH_EN == RKH_ENABLED
1722  #define RKH_HOOK_DISPATCH(sma, e) \
1723  rkh_hook_dispatch((sma), (RKH_EVT_T *)(e))
1724 
1725 #else
1726  #define RKH_HOOK_DISPATCH(sma, e) (void)0
1727 #endif
1728 
1729 #if (RKH_CFG_HOOK_TIMEOUT_EN == RKH_ENABLED)
1730  #define RKH_HOOK_TIMEOUT(t) \
1731  rkh_hook_timeout((t))
1732 #else
1733  #define RKH_HOOK_TIMEOUT(t) (void)0
1734 #endif
1735 
1736 #if (RKH_CFG_HOOK_SIGNAL_EN == RKH_ENABLED)
1737  #define RKH_HOOK_SIGNAL(e) \
1738  rkh_hook_signal((RKH_EVT_T *)(e))
1739 #else
1740  #define RKH_HOOK_SIGNAL(e) (void)0
1741 #endif
1742 
1743 #if (RKH_CFG_HOOK_START_EN == RKH_ENABLED)
1744  #define RKH_HOOK_START() \
1745  rkh_hook_start()
1746 #else
1747  #define RKH_HOOK_START() (void)0
1748 #endif
1749 
1750 #if (RKH_CFG_HOOK_EXIT_EN == RKH_ENABLED)
1751  #define RKH_HOOK_EXIT() \
1752  rkh_hook_exit()
1753 #else
1754  #define RKH_HOOK_EXIT() (void)0
1755 #endif
1756 
1757 #if (RKH_CFG_HOOK_TIMETICK_EN == RKH_ENABLED)
1758  #define RKH_HOOK_TIMETICK() \
1759  rkh_hook_timetick()
1760 #else
1761  #define RKH_HOOK_TIMETICK() (void)0
1762 #endif
1763 
1764 #if (RKH_CFG_HOOK_PUT_TRCEVT_EN == RKH_ENABLED)
1765  #define RKH_HOOK_PUT_TRCEVT() \
1766  rkh_hook_putTrcEvt()
1767 #else
1768  #define RKH_HOOK_PUT_TRCEVT() (void)0
1769 #endif
1770 
1771 #if (RKH_CFG_TRC_EN == RKH_ENABLED && \
1772  (RKH_CFG_TRC_ALL_EN == RKH_ENABLED || \
1773  RKH_CFG_TRC_SMA_EN == RKH_ENABLED || \
1774  RKH_CFG_TRC_SM_EN == RKH_ENABLED || \
1775  RKH_CFG_TRC_FWK_EN == RKH_ENABLED))
1776  #define R_TRC_AO_NAME_EN RKH_ENABLED
1777 #else
1778  #define R_TRC_AO_NAME_EN RKH_DISABLED
1779 #endif
1780 
1781 #define RKH_SM_NAME(smName_) s_##smName_
1782 #define RKH_SMA_NAME(smaName_) s_##smaName_
1783 #define RKH_SM_CONST_NAME(smName_) rs_##smName_
1784 
1785 #define MKTRN(evt_, guard_, effect_, target_) \
1786  { \
1787  evt_, (RKH_GUARD_T)guard_, \
1788  (RKH_TRN_ACT_T)effect_, (RKHROM RKH_ST_T *)target_ \
1789  }
1790 
1791 #if RKH_CFG_SMA_SM_CONST_EN == RKH_ENABLED
1792  #define MKSM(constSM, initialState) \
1793  (RKHROM RKH_ROM_T *)(constSM), \
1794  (RKHROM RKH_ST_T *)(initialState)
1796  #if RKH_CFG_SMA_VFUNCT_EN == RKH_ENABLED
1797  #define MKSMA(constSM, initialState) \
1798  { \
1799  MKSM(constSM, initialState), \
1800  &rkhSmaVtbl \
1801  }
1802  #else
1803  #define MKSMA(constSM, initialState) \
1804  { \
1805  MKSM(constSM, initialState) \
1806  }
1807  #endif
1808 #else
1809  #if (RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
1810  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1811  #define MKSM(name, prio, ppty, initialState, initialAction, \
1812  initialEvt) \
1813  (prio), (ppty), #name, (RKHROM RKH_ST_T*)initialState, \
1814  ((RKH_INIT_ACT_T)initialAction), (initialEvt), \
1815  (RKHROM RKH_ST_T*)initialState
1816  #else
1817  #define MKSM(name, prio, ppty, initialState, initialAction, \
1818  initialEvt) \
1819  (prio), (ppty), (RKHROM RKH_ST_T*)initialState, \
1820  ((RKH_INIT_ACT_T)initialAction), (initialEvt), \
1821  (RKHROM RKH_ST_T*)initialState
1822  #endif
1823  #else
1824  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1825  #define MKSM(name, prio, ppty, initialState, initialAction, \
1826  initialEvt) \
1827  (prio), (ppty), #name, (RKHROM RKH_ST_T*)initialState, \
1828  ((RKH_INIT_ACT_T)initialAction), \
1829  (RKHROM RKH_ST_T*)initialState
1830  #else
1831  #define MKSM(name, prio, ppty, initialState, initialAction, \
1832  initialEvt) \
1833  (prio), (ppty), (RKHROM RKH_ST_T*)initialState, \
1834  ((RKH_INIT_ACT_T)initialAction), \
1835  (RKHROM RKH_ST_T*)initialState
1836  #endif
1837  #endif
1838  #if RKH_CFG_SMA_VFUNCT_EN == RKH_ENABLED
1839  #define MKSMA(name, prio, ppty, \
1840  initialState, initialAction, initialEvt) \
1841  { \
1842  MKSM(name, prio, ppty, initialState, \
1843  initialAction, initialEvt), /* RKH_SM_T members */ \
1844  &rkhSmaVtbl \
1845  }
1846  #else
1847  #define MKSMA(name, prio, ppty, \
1848  initialState, initialAction, initialEvt) \
1849  { \
1850  MKSM(name, prio, ppty, initialState, \
1851  initialAction, initialEvt) /* RKH_SM_T members */ \
1852  }
1853  #endif
1854 
1855  #define MKRT_SM(sm_, name_, prio_, ppty_, initialState_, initialAction_, \
1856  initialEvt_) \
1857  ((RKH_SM_T *)(sm_))->prio = prio_; \
1858  ((RKH_SM_T *)(sm_))->ppty = ppty_; \
1859  MKSM_NAME(sm_, name_); \
1860  ((RKH_SM_T *)(sm_))->istate = (RKHROM RKH_ST_T*)initialState_; \
1861  ((RKH_SM_T *)(sm_))->iaction = (RKH_INIT_ACT_T)initialAction_; \
1862  MKSM_IEVENT(sm_, initialEvt_); \
1863  ((RKH_SM_T *)(sm_))->state = (RKHROM RKH_ST_T*)initialState_
1864 
1865  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1866  #if RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED
1867  #define MKSM_NAME(sm_, name_) \
1868  ((RKH_SM_T *)sm_)->name = #name_
1869  #define MKSM_IEVENT(sm_, ievent_) \
1870  ((RKH_SM_T *)sm_)->ievent = ievent_
1871  #else
1872  #define MKSM_NAME(sm_, name_) \
1873  ((RKH_SM_T *)sm_)->name = #name_
1874  #define MKSM_IEVENT(sm_, ievent_)
1875  #endif
1876  #else
1877  #if RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED
1878  #define MKSM_NAME(sm_, name_) \
1879  #define MKSM_IEVENT(sm_, ievent_) \
1880  ((RKH_SM_T *)sm_)->ievent = ievent_
1881  #else
1882  #define MKSM_NAME(sm_, name_) \
1883  #define MKSM_IEVENT(sm_, ievent_)
1884  #endif
1885  #endif
1886 #endif
1887 
1888 #if (RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
1889  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1890  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1891  { \
1892  (prio), (ppty), # name, (RKHROM RKH_ST_T *)is, \
1893  (RKH_INIT_ACT_T)(ia), (ie) \
1894  }
1895  #else
1896  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1897  { \
1898  (prio), (ppty), (RKHROM RKH_ST_T *)is, \
1899  (RKH_INIT_ACT_T)(ia), (ie) \
1900  }
1901  #endif
1902 #else
1903  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1904  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1905  { \
1906  (prio), (ppty), # name, (RKHROM RKH_ST_T *)is, \
1907  (RKH_INIT_ACT_T)(ia) \
1908  }
1909  #else
1910  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1911  { \
1912  (prio), (ppty), (RKHROM RKH_ST_T *)is, \
1913  (RKH_INIT_ACT_T)(ia) \
1914  }
1915  #endif
1916 #endif
1917 
1918 #if R_TRC_AO_NAME_EN == RKH_ENABLED
1919  #define MKBASE(t, n) {t, # n}
1920 #else
1921  #define MKBASE(t, n) {t}
1922 #endif
1923 
1924 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED)
1925  #if (RKH_CFG_SMA_PPRO_EN == RKH_ENABLED)
1926  #if defined(RKH_HISTORY_ENABLED)
1927  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
1928  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL, d, \
1929  (RKH_INIT_ACT_T)dftTrn_, h
1930  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem) \
1931  RKHROM RKH_SHIST_T name##Hist = \
1932  { \
1933  MKBASE(kOfH, name##Hist), \
1934  (RKHROM RKH_ST_T *)&name, ramMem, \
1935  RKH_TRREG(0, dTG, dTA, dTT) \
1936  }
1937  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem) \
1938  RKHROM RKH_SHIST_T name = \
1939  { \
1940  MKBASE(kOfH, name), \
1941  (RKHROM RKH_ST_T *)parent, ramMem, \
1942  RKH_TRREG(0, dTG, dTA, dTT) \
1943  }
1944  #define MKFINAL(name_) \
1945  name_##_trtbl, NULL
1946  #define MKFINAL_INCOMP(name_) \
1947  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1948  #else
1949  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
1950  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL, d, \
1951  (RKH_INIT_ACT_T)dftTrn_
1952  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem)
1953  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem)
1954  #define MKFINAL(name_) \
1955  name_##_trtbl, NULL
1956  #define MKFINAL_INCOMP(name_) \
1957  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1958  #endif
1959  #else
1960  #if defined(RKH_HISTORY_ENABLED)
1961  #define MKBASIC(n,pp) n##_trtbl
1962  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, d, \
1963  (RKH_INIT_ACT_T)dftTrn_, h
1964  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem) \
1965  RKHROM RKH_SHIST_T name##Hist = \
1966  { \
1967  MKBASE(kOfH, name##Hist), \
1968  (RKHROM RKH_ST_T *)&name, ramMem, \
1969  RKH_TRREG(0, dTG, dTA, dTT) \
1970  }
1971  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem) \
1972  RKHROM RKH_SHIST_T name = \
1973  { \
1974  MKBASE(kOfH, name), \
1975  (RKHROM RKH_ST_T *)parent, ramMem, \
1976  RKH_TRREG(0, dTG, dTA, dTT) \
1977  }
1978  #define MKFINAL(name_) \
1979  name_##_trtbl
1980  #define MKFINAL_INCOMP(name_) \
1981  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1982  #else
1983  #define MKBASIC(n,pp) n##_trtbl
1984  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, d, \
1985  (RKH_INIT_ACT_T)dftTrn_
1986  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem)
1987  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem)
1988  #define MKFINAL(name_) \
1989  name_##_trtbl
1990  #define MKFINAL_INCOMP(name_) \
1991  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1992  #endif
1993  #endif
1994  #define MKST(en,ex,p) (RKH_ENT_ACT_T)en, \
1995  (RKH_EXT_ACT_T)ex, \
1996  (RKHROM RKH_ST_T *)p
1997  #define MKSBM(n,sbm) n##_trtbl,n##_exptbl,sbm
1998  #define MKMCH(d,i,n) d, (RKH_TRN_ACT_T)i, \
1999  (RKHROM RKH_ST_T * *)&rdyp_##n
2000  #define MKENP(e,s) e,(RKHROM RKH_ST_T *)s
2001 #else
2002  #if (RKH_CFG_SMA_PPRO_EN == RKH_ENABLED)
2003  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
2004  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL
2005  #define MKFINAL(name_)
2006  #define MKFINAL_INCOMP(name_)
2007  #else
2008  #define MKBASIC(n,pp) n##_trtbl
2009  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl
2010  #define MKFINAL(name_)
2011  #define MKFINAL_INCOMP(name_)
2012  #endif
2013  #define MKST(en,ex,p)
2014  #define MKSBM(n,sbm) n##_trtbl,n##_exptbl,sbm
2015  #define MKMCH(d,i,n) d, (RKH_TRN_ACT_T)i, \
2016  (RKHROM RKH_ST_T *)&rdyp_##n
2017  #define MKENP(e,s) e,(RKHROM RKH_ST_T *)s
2018 #endif
2019 
2020 #define MK_SET_EVT(ev_obj, ev_sig) \
2021  ((RKH_EVT_T *)(ev_obj))->e = (RKH_SIG_T)ev_sig; \
2022  ((RKH_EVT_T *)(ev_obj))->nref = 0; \
2023  ((RKH_EVT_T *)(ev_obj))->pool = 0
2024 
2025 #define MK_EVT(ev_obj, ev_sig) \
2026  RKH_EVT_T ev_obj = {ev_sig, 0, 0}
2027 
2028 #define MK_ROM_EVT(ev_obj, ev_sig) \
2029  RKHROM RKH_EVT_T ev_obj = {ev_sig, 0, 0}
2030 
2031 #define MK_EVT_STRUCT(ev_sig) \
2032  {ev_sig, 0, 0}
2033 
2034 #ifndef RKH_DIS_INTERRUPT
2035  #error \
2036  "rkhport.h, Must be defined the platform-dependent macro RKH_DIS_INTERRUPT"
2037 #endif
2038 
2039 #ifndef RKH_ENA_INTERRUPT
2040  #error \
2041  "rkhport.h, Must be defined the platform-dependent macro RKH_ENA_INTERRUPT"
2042 #endif
2043 
2044 #ifndef RKH_EN_DOXYGEN
2045  #define RKH_EN_DOXYGEN 0
2046 #endif
2047 
2048 #if RKH_EN_DOXYGEN == RKH_ENABLED
2049 
2066  #define RKH_CFGPORT_SMA_THREAD_EN RKH_ENABLED
2067 
2078  #define RKH_CFGPORT_SMA_THREAD_DATA_EN RKH_ENABLED
2079 
2092  #define RKH_CFGPORT_NATIVE_SCHEDULER_EN RKH_ENABLED
2093 
2105  #define RKH_CFGPORT_NATIVE_EQUEUE_EN RKH_ENABLED
2106 
2120  #define RKH_CFGPORT_NATIVE_DYN_EVT_EN RKH_ENABLED
2121 
2132  #define RKH_CFGPORT_REENTRANT_EN RKH_ENABLED
2133 
2143  #define RKH_CFGPORT_TRC_SIZEOF_PTR 32u
2144 
2154  #define RKH_CFGPORT_TRC_SIZEOF_FUN_PTR 32u
2155 
2165  #define RKH_CFGPORT_TRC_SIZEOF_TSTAMP 32u
2166 
2177  #define RKH_CFGPORT_SMA_QSTO_EN RKH_ENABLED
2178 
2189  #define RKH_CFGPORT_SMA_STK_EN RKH_ENABLED
2190 
2212  #define RKH_EQ_TYPE
2213 
2238  #define RKH_THREAD_TYPE
2239 
2262  #define RKH_OSSIGNAL_TYPE
2263 
2281  #define RKH_DIS_INTERRUPT()
2282  #define RKH_ENA_INTERRUPT()
2283 
2325  #define RKH_CPUSR_TYPE
2326  #define RKH_SR_ALLOC() \
2327  RKH_CPUSR_TYPE sr = (RKH_CPUSR_TYPE)0
2328  #define RKH_ENTER_CRITICAL(dummy)
2329  #define RKH_EXIT_CRITICAL(dummy)
2330 
2338  #define RKH_SMA_BLOCK(sma)
2339 
2349  #define RKH_SMA_READY(rg, sma)
2350 
2359  #define RKH_SMA_UNREADY(rg, sma)
2360 
2371  #define RKH_DYNE_TYPE
2372 
2389  #define RKH_DYNE_INIT(mp, sstart, ssize, esize)
2390 
2401  #define RKH_DYNE_GET_ESIZE(mp)
2402 
2416  #define RKH_DYNE_GET(mp, e)
2417 
2430  #define RKH_DYNE_PUT(mp, e)
2431 #endif
2432 
2433 #ifdef RKH_CPUSR_TYPE
2434  #if RKH_EN_DOXYGEN == RKH_DISABLED
2435  #define RKH_SR_ALLOC() RKH_CPUSR_TYPE sr = (RKH_CPUSR_TYPE)0
2436  #define RKH_ENTER_CRITICAL_() RKH_ENTER_CRITICAL(sr)
2437  #define RKH_EXIT_CRITICAL_() RKH_EXIT_CRITICAL(sr)
2438  #endif
2439 #else
2440  #define RKH_SR_ALLOC()
2441  #define RKH_ENTER_CRITICAL_() RKH_ENTER_CRITICAL(dummy)
2442  #define RKH_EXIT_CRITICAL_() RKH_EXIT_CRITICAL(dummy)
2443 #endif
2444 
2445 #if (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_ENABLED && \
2446  RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
2447  #define RKH_EXEC_INIT(me_, action_) \
2448  if ((RKH_INIT_ACT_T)action_) \
2449  { \
2450  (*(RKH_INIT_ACT_T)action_)((me_), \
2451  RKH_SMA_ACCESS_CONST(CM(me_), ievent)); \
2452  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_INI, \
2453  (me_), \
2454  0, \
2455  CM(me_)); \
2456  }
2457  #define RKH_EXEC_STATE_INIT(me_, action_) \
2458  RKH_EXEC_INIT(me_, action_)
2459 #elif (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_ENABLED && \
2460  RKH_CFG_SMA_INIT_EVT_EN == RKH_DISABLED)
2461  #define RKH_EXEC_INIT(me_, action_) \
2462  if ((RKH_INIT_ACT_T)action_) \
2463  { \
2464  (*(RKH_INIT_ACT_T)action_)((me_)); \
2465  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_INI, \
2466  (me_), \
2467  0, \
2468  CM(me_)); \
2469  }
2470  #define RKH_EXEC_STATE_INIT(me_, action_) \
2471  RKH_EXEC_INIT(me_, action_)
2472 #elif (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_DISABLED && \
2473  RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
2474  #define RKH_EXEC_INIT(me_, action_) \
2475  if ((RKH_INIT_ACT_T)action_) \
2476  { \
2477  (*(RKH_INIT_ACT_T)action_)(RKH_SMA_ACCESS_CONST(CM(me_), ievent)); \
2478  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_INI, \
2479  (me_), \
2480  0, \
2481  CM(me_)); \
2482  }
2483  #define RKH_EXEC_STATE_INIT(me_, action_) \
2484  RKH_EXEC_INIT(me_, action_)
2485 #else
2486  #define RKH_EXEC_INIT(me_, action_) \
2487  if ((RKH_INIT_ACT_T)action_) \
2488  { \
2489  (*(RKH_INIT_ACT_T)action_)(); \
2490  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_INI, \
2491  (me_), \
2492  0, \
2493  CM(me_)); \
2494  }
2495  #define RKH_EXEC_STATE_INIT(me_, action_) \
2496  RKH_EXEC_INIT(me_, action_)
2497 #endif
2498 
2499 #if RKH_CFG_SMA_ENT_ARG_SMA_EN == RKH_ENABLED
2500  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2501  #define RKH_EXEC_ENTRY(state_, me_) \
2502  if ((state_)->enter) \
2503  { \
2504  (*(state_)->enter)(me_, state_); \
2505  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2506  (me_), \
2507  (state_), \
2508  (state_)->enter); \
2509  }
2510  #else
2511  #define RKH_EXEC_ENTRY(state_, me_) \
2512  if ((state_)->enter) \
2513  { \
2514  (*(state_)->enter)(me_); \
2515  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2516  (me_), \
2517  (state_), \
2518  (state_)->enter); \
2519  }
2520  #endif
2521 #else
2522  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2523  #define RKH_EXEC_ENTRY(state_, me_) \
2524  if ((state_)->enter) \
2525  { \
2526  (*(state_)->enter)(state_); \
2527  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2528  (me_), \
2529  (state_), \
2530  (state_)->enter); \
2531  }
2532  #else
2533  #define RKH_EXEC_ENTRY(state_, me_) \
2534  if ((state_)->enter) \
2535  { \
2536  (*(state_)->enter)(); \
2537  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2538  (me_), \
2539  (state_), \
2540  (state_)->enter); \
2541  }
2542  #endif
2543 #endif
2544 
2545 #if RKH_CFG_SMA_EXT_ARG_SMA_EN == RKH_ENABLED
2546  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2547  #define RKH_EXEC_EXIT(state_, me_) \
2548  if ((state_)->exit) \
2549  { \
2550  (*(state_)->exit)(me_, state_); \
2551  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2552  (me_), \
2553  (state_), \
2554  (state_)->exit); \
2555  }
2556  #else
2557  #define RKH_EXEC_EXIT(state_, me_) \
2558  if ((state_)->exit) \
2559  { \
2560  (*(state_)->exit)(me_); \
2561  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2562  (me_), \
2563  (state_), \
2564  (state_)->exit); \
2565  }
2566  #endif
2567 #else
2568  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2569  #define RKH_EXEC_EXIT(state_, me_) \
2570  if ((state_)->exit) \
2571  { \
2572  (*(state_)->exit)(state_); \
2573  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2574  (me_), \
2575  (state_), \
2576  (state_)->exit); \
2577  }
2578  #else
2579  #define RKH_EXEC_EXIT(state_, me_) \
2580  if ((state_)->exit) \
2581  { \
2582  (*(state_)->exit)(); \
2583  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2584  (me_), \
2585  (state_), \
2586  (state_)->exit); \
2587  }
2588  #endif
2589 #endif
2590 
2591 #if RKH_CFG_SMA_PPRO_ARG_SMA_EN == RKH_ENABLED
2592  #define RKH_EXEC_PREPRO(state_, me_, evt_) \
2593  (*(state_)->prepro)(me_, evt_); \
2594  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_PP, \
2595  (me_), \
2596  (((RKH_SM_T *)me_))->state, \
2597  (state_)->prepro)
2598 #else
2599  #define RKH_EXEC_PREPRO(state_, me_, evt_) \
2600  (*(state_)->prepro)(evt_); \
2601  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_PP, \
2602  (me_), \
2603  (((RKH_SM_T *)me_))->state, \
2604  (state_)->prepro)
2605 #endif
2606 
2607 #if (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_ENABLED && \
2608  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_ENABLED)
2609  #define RKH_EXEC_EFF(action_, me_, evt_) \
2610  (*CTA(action_))((me_), (evt_)); \
2611  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2612  (me_), \
2613  (((RKH_SM_T *)me_))->state, \
2614  (action_))
2615 #elif (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_ENABLED && \
2616  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_DISABLED)
2617  #define RKH_EXEC_EFF(action_, me_, evt_) \
2618  (*CTA(action_))((evt_)); \
2619  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2620  (me_), \
2621  (((RKH_SM_T *)me_))->state, \
2622  (action_))
2623 #elif (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_DISABLED && \
2624  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_ENABLED)
2625  #define RKH_EXEC_EFF(action_, me_, evt_) \
2626  (*CTA(action_))((me_)); \
2627  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2628  (me_), \
2629  (((RKH_SM_T *)me_))->state, \
2630  (action_))
2631 #else
2632  #define RKH_EXEC_EFF(action_, me_, evt_) \
2633  (*CTA(action_))(); \
2634  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2635  (me_), \
2636  (((RKH_SM_T *)me_))->state, \
2637  (action_))
2638 #endif
2639 
2640 #if (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
2641  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
2642  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2643  (*(trn_)->guard)(me_, evt_)
2644 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
2645  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_DISABLED)
2646  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2647  (*(trn_)->guard)(evt_)
2648 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_DISABLED && \
2649  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
2650  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2651  (*(trn_)->guard)(me_)
2652 #else
2653  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2654  (*(trn_)->guard)()
2655 #endif
2656 
2657 /* -------------------------------- Constants ------------------------------ */
2658 /* ------------------------------- Data types ------------------------------ */
2659 typedef struct RKH_ROM_T RKH_ROM_T;
2660 typedef struct RKHSmaVtbl RKHSmaVtbl;
2661 typedef struct RKH_SM_T RKH_SM_T;
2662 typedef struct RKH_SMA_T RKH_SMA_T;
2663 typedef struct RKH_TR_T RKH_TR_T;
2664 typedef struct RKH_BASE_T RKH_BASE_T;
2665 typedef struct RKH_ST_T RKH_ST_T;
2666 typedef struct RKH_SHIST_T RKH_SHIST_T;
2667 typedef struct RKH_SBSC_T RKH_SBSC_T;
2668 typedef struct RKH_SCMP_T RKH_SCMP_T;
2669 typedef struct RKH_FINAL_T RKH_FINAL_T;
2670 typedef struct RKH_EXPCN_T RKH_EXPCN_T;
2671 typedef struct RKH_ENPCN_T RKH_ENPCN_T;
2672 typedef struct RKH_SSBM_T RKH_SSBM_T;
2673 typedef struct RKH_RSM_T RKH_RSM_T;
2674 typedef struct RKH_SENP_T RKH_SENP_T;
2675 typedef struct RKH_SEXP_T RKH_SEXP_T;
2676 typedef struct RKH_SCOND_T RKH_SCOND_T;
2677 typedef struct RKH_SCHOICE_T RKH_SCHOICE_T;
2678 
2690 #if (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_ENABLED && \
2691  RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
2692  typedef void (*RKH_INIT_ACT_T)(const RKH_SM_T *me,
2693  const struct RKH_EVT_T *e);
2694 #elif (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_ENABLED && \
2695  RKH_CFG_SMA_INIT_EVT_EN == RKH_DISABLED)
2696  typedef void (*RKH_INIT_ACT_T)(const RKH_SM_T *me);
2697 #elif (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_DISABLED && \
2698  RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
2699  typedef void (*RKH_INIT_ACT_T)(const struct RKH_EVT_T *e);
2700 #else
2701  typedef void (*RKH_INIT_ACT_T)(void);
2702 #endif
2703 
2712 typedef struct RKH_SMAI_T
2713 {
2714  rui16_t ndevt;
2715  rui16_t exectr;
2716 } RKH_SMAI_T;
2717 
2718 #if RKH_CFG_SMA_SM_CONST_EN == RKH_ENABLED
2719 
2731 {
2739  rui8_t prio;
2740 
2748  rui8_t ppty;
2749 
2758 #if R_TRC_AO_NAME_EN == RKH_ENABLED
2759  const char *name;
2760 #endif
2761 
2769  RKHROM RKH_ST_T *istate;
2770 
2779 
2788 #if RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED
2790 #endif
2791 };
2792 #endif
2793 
2805 #if RKH_CFG_SMA_SM_CONST_EN == RKH_ENABLED
2806 struct RKH_SM_T
2807 {
2813 
2818  RKHROM RKH_ST_T *state;
2819 };
2820 #else
2821 struct RKH_SM_T
2822 {
2830  rui8_t prio;
2831 
2839  rui8_t ppty;
2840 
2849 #if R_TRC_AO_NAME_EN == RKH_ENABLED
2850  const char *name;
2851 #endif
2852 
2860  RKHROM RKH_ST_T *istate;
2861 
2869  RKH_INIT_ACT_T iaction;
2870 
2879 #if RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED
2880  const RKH_EVT_T *ievent;
2881 #endif
2882 
2887  RKHROM RKH_ST_T *state;
2888 };
2889 #endif
2890 
2931 {
2937 
2942 #if RKH_CFG_SMA_VFUNCT_EN == RKH_ENABLED
2943  const RKHSmaVtbl *vptr;
2944 #endif
2945 
2963 #if RKH_CFGPORT_SMA_THREAD_EN == RKH_ENABLED
2965 
2985 #if RKH_CFGPORT_SMA_THREAD_DATA_EN == RKH_ENABLED
2987 #endif
2988 #endif
2989 
2995 
3001  rbool_t running;
3002 
3009 #if RKH_CFG_SMA_GET_INFO_EN == RKH_ENABLED
3011 #endif
3012 };
3013 
3015 typedef void (*RKHActivate)(RKH_SMA_T *me,
3016  const RKH_EVT_T **qSto, RKH_RQNE_T qSize,
3017  void *stkSto, rui32_t stkSize);
3018 
3020 typedef void (*RKHTask)(RKH_SMA_T *me, void *arg);
3021 
3023 #if defined(RKH_USE_TRC_SENDER)
3024 typedef void (*RKHPostFifo)(RKH_SMA_T *me, const RKH_EVT_T *e,
3025  const void *const sender);
3026 #else
3027 typedef void (*RKHPostFifo)(RKH_SMA_T *me, const RKH_EVT_T *e);
3028 #endif
3029 
3031 #if defined(RKH_USE_TRC_SENDER)
3032 typedef void (*RKHPostLifo)(RKH_SMA_T *me, const RKH_EVT_T *e,
3033  const void *const sender);
3034 #else
3035 typedef void (*RKHPostLifo)(RKH_SMA_T *me, const RKH_EVT_T *e);
3036 #endif
3037 
3043 {
3047 
3058 
3062 
3066 };
3067 
3094 #if RKH_CFG_SMA_ENT_ARG_SMA_EN == RKH_ENABLED
3095  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
3096  typedef void (*RKH_ENT_ACT_T)(const RKH_SM_T *me,
3097  const RKH_ST_T *state);
3098  #else
3099  typedef void (*RKH_ENT_ACT_T)(const RKH_SM_T *me);
3100  #endif
3101 #else
3102  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
3103  typedef void (*RKH_ENT_ACT_T)(const RKH_ST_T *state);
3104  #else
3105  typedef void (*RKH_ENT_ACT_T)(void);
3106  #endif
3107 #endif
3108 
3134 #if RKH_CFG_SMA_EXT_ARG_SMA_EN == RKH_ENABLED
3135  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
3136  typedef void (*RKH_EXT_ACT_T)(const RKH_SM_T *me,
3137  const RKH_ST_T *state);
3138  #else
3139  typedef void (*RKH_EXT_ACT_T)(const RKH_SM_T *me);
3140  #endif
3141 #else
3142  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
3143  typedef void (*RKH_EXT_ACT_T)(const RKH_ST_T *state);
3144  #else
3145  typedef void (*RKH_EXT_ACT_T)(void);
3146  #endif
3147 #endif
3148 
3167 #if RKH_CFG_SMA_PPRO_ARG_SMA_EN == RKH_ENABLED
3168  typedef RKH_SIG_T (*RKH_PPRO_T)(const RKH_SM_T *sma,
3169  RKH_EVT_T *pe);
3170 #else
3171  typedef RKH_SIG_T (*RKH_PPRO_T)(RKH_EVT_T *pe);
3172 #endif
3173 
3205 #if (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_ENABLED && \
3206  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_ENABLED)
3207  typedef void (*RKH_TRN_ACT_T)(const RKH_SM_T *me,
3208  RKH_EVT_T *pe);
3209 #elif (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_ENABLED && \
3210  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_DISABLED)
3211  typedef void (*RKH_TRN_ACT_T)(RKH_EVT_T *pe);
3212 #elif (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_DISABLED && \
3213  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_ENABLED)
3214  typedef void (*RKH_TRN_ACT_T)(const RKH_SM_T *me);
3215 #else
3216  typedef void (*RKH_TRN_ACT_T)(void);
3217 #endif
3218 
3243 #if (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
3244  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
3245 
3246  typedef rbool_t (*RKH_GUARD_T)(const RKH_SM_T *me,
3247  RKH_EVT_T *pe);
3248 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
3249  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_DISABLED)
3250  typedef rbool_t (*RKH_GUARD_T)(RKH_EVT_T *pe);
3251 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_DISABLED && \
3252  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
3253  typedef rbool_t (*RKH_GUARD_T)(const RKH_SM_T *me);
3254 #else
3255  typedef rbool_t (*RKH_GUARD_T)(void);
3256 #endif
3257 
3263 {
3278  ruint type;
3279 
3288 #if R_TRC_AO_NAME_EN == RKH_ENABLED
3289  const char *name;
3290 #endif
3291 };
3292 
3301 struct RKH_TR_T
3302 {
3308 
3314 
3320 
3325  RKHROM void *target;
3326 };
3327 
3333 struct RKH_ST_T
3334 {
3340 
3341 #if RKH_CFG_SMA_HCAL_EN == RKH_ENABLED
3342 
3347 
3353 
3358  RKHROM RKH_ST_T *parent;
3359 #endif
3360 };
3361 
3367 {
3368  RKH_ST_T st;
3369 
3374  RKHROM RKH_TR_T *trtbl;
3375 
3414 #if RKH_CFG_SMA_PPRO_EN == RKH_ENABLED
3416 #endif
3417 };
3418 
3424 {
3425  RKH_ST_T st;
3426 
3431  RKHROM RKH_TR_T *trtbl;
3432 
3471 #if RKH_CFG_SMA_PPRO_EN == RKH_ENABLED
3473 #endif
3474 
3475 #if RKH_CFG_SMA_HCAL_EN == RKH_ENABLED
3476 
3480  RKHROM void *defchild;
3481 
3487 
3492 #if defined(RKH_HISTORY_ENABLED)
3494 #endif
3495 #endif
3496 };
3497 
3503 {
3509 
3514  RKHROM RKH_TR_T *trtbl;
3515 
3520 #if RKH_CFG_SMA_PPRO_EN == RKH_ENABLED
3522 #endif
3523 };
3524 
3529 #if defined(RKH_SUBMACHINE_ENABLED)
3531 {
3537 
3542  RKHROM void *target;
3543 };
3544 
3550 {
3556 
3561  RKHROM void *target;
3562 };
3563 
3623 {
3624  RKH_ST_T st;
3625 
3630  RKHROM RKH_TR_T *trtbl;
3631 
3637 
3642  RKHROM RKH_RSM_T *sbm;
3643 };
3644 
3650 {
3656 
3661  RKHROM void *defchild;
3662 
3671 
3677  RKHROM RKH_ST_T * *dyp;
3678 };
3679 
3692 {
3698 
3704 
3709  RKHROM RKH_ST_T *parent;
3710 };
3711 
3723 {
3729 
3734  rui8_t ix;
3735 
3741 };
3742 #endif
3743 
3748 #if defined(RKH_CHOICE_OR_CONDITIONAL_ENABLED)
3750 {
3756 
3761  RKHROM RKH_TR_T *trtbl;
3762 };
3763 #endif
3764 
3769 #if defined(RKH_CHOICE_ENABLED)
3771 {
3777 
3782  RKHROM RKH_TR_T *trtbl;
3783 };
3784 #endif
3785 
3792 #if defined(RKH_HISTORY_ENABLED)
3794 {
3800 
3805  RKHROM RKH_ST_T *parent;
3806 
3812  RKHROM RKH_ST_T **target;
3813 
3818  RKHROM RKH_TR_T trn;
3819 };
3820 #endif
3821 
3822 /* -------------------------- External variables --------------------------- */
3824 extern const RKHSmaVtbl rkhSmaVtbl;
3825 
3826 /* -------------------------- Function prototypes -------------------------- */
3827 #if (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
3828  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
3829  rbool_t rkh_else(const RKH_SM_T *sma, RKH_EVT_T *pe);
3830 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
3831  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_DISABLED)
3832  rbool_t rkh_else(RKH_EVT_T *pe);
3833 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_DISABLED && \
3834  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
3835  rbool_t rkh_else(const RKH_SM_T *sma);
3836 #else
3837  rbool_t rkh_else(void);
3838 #endif
3839 
3840 /* -------------------- External C language linkage end -------------------- */
3841 #ifdef __cplusplus
3842 }
3843 #endif
3844 
3845 /* ------------------------------ Module end ------------------------------- */
3846 #endif
3847 
3848 /* ------------------------------ End of file ------------------------------ */
rui8_t ppty
State machine properties.
Definition: rkhitl.h:2748
RKH_SIG_T e
Signal of the event instance.
Definition: rkhevt.h:167
rbool_t running
The Boolean loop variable determining if the thread routine of the SMA is running.
Definition: rkhitl.h:3001
Platform - independent interface for RKH trace facility.
void(* RKH_INIT_ACT_T)(const RKH_SM_T *me, const struct RKH_EVT_T *e)
Initialization action.
Definition: rkhitl.h:2692
RKHROM RKH_ROM_T * romrkh
Points to constant parameters of state machine.
Definition: rkhitl.h:2812
rui8_t RKH_RQNE_T
This data type defines the maximum number of elements that any queue can contain. ...
Definition: rkhrq.h:95
RKH_TRN_ACT_T action
Points to transition action.
Definition: rkhitl.h:3555
RKH_EXT_ACT_T exit
Points to exit action.
Definition: rkhitl.h:3352
void(* RKH_TRN_ACT_T)(const RKH_SM_T *me, RKH_EVT_T *pe)
Transition action.
Definition: rkhitl.h:3207
RKH_PPRO_T prepro
Points to event preprocessor.
Definition: rkhitl.h:3472
RKH_ST_T st
Definition: rkhitl.h:3508
ruint type
State type.
Definition: rkhitl.h:3278
Describes a composite state.
Definition: rkhitl.h:3423
Describes the exit point connection.
Definition: rkhitl.h:3530
const char * name
Name of State Machine Application (a.k.a Active Object).
Definition: rkhitl.h:2759
RKH_INIT_ACT_T initialAction
Points to state's initial action.
Definition: rkhitl.h:3486
Describes a basic state.
Definition: rkhitl.h:3366
Describes the choice pseudostate.
Definition: rkhitl.h:3770
Describes the SMA (active object in UML).
Definition: rkhitl.h:2930
#define RKH_THREAD_TYPE
Frequently, the active object has its own task processing loop that waits for the signal to be posted...
Definition: rkhitl.h:2238
RKH_BASE_T base
Maintains the basic information of state.
Definition: rkhitl.h:3799
Represents events without parameters.
Definition: rkhevt.h:161
RKHROM RKH_ST_T * istate
Points to initial state.
Definition: rkhitl.h:2769
RKHROM RKH_ST_T * parent
Points to state's parent (submachine state).
Definition: rkhitl.h:3709
RKH_EQ_TYPE equeue
Event queue of the SMA (a.k.a Active Object).
Definition: rkhitl.h:2994
Describes a submachine state.
Definition: rkhitl.h:3622
RKHROM void * target
Points to target state.
Definition: rkhitl.h:3542
RKH_GUARD_T guard
Points to guard function.
Definition: rkhitl.h:3313
rui8_t RKH_SIG_T
Definition: rkhevt.h:92
RKH_SIG_T(* RKH_PPRO_T)(const RKH_SM_T *sma, RKH_EVT_T *pe)
Event preprocessor.
Definition: rkhitl.h:3168
Event data type and other related macros.This header file must be included in all modules(*...
RKH_SM_T sm
State machine.
Definition: rkhitl.h:2936
RKHROM RKH_ST_T * parent
Points to state's parent.
Definition: rkhitl.h:3358
RKH_TRN_ACT_T action
Points to transition action.
Definition: rkhitl.h:3319
RKH_BASE_T base
Maintains the basic information of state.
Definition: rkhitl.h:3755
RKH platform - dependent interface.
RKHROM RKH_TR_T * trtbl
Points to state transition table.
Definition: rkhitl.h:3431
RKHROM RKH_TR_T trn
History default transition.
Definition: rkhitl.h:3818
RKH user configurations.
Maintains the basic information of a state.
Definition: rkhitl.h:3262
void(* RKHTask)(RKH_SMA_T *me, void *arg)
Definition: rkhitl.h:3020
RKHROM RKH_TR_T * trtbl
Definition: rkhitl.h:3514
RKHROM RKH_ST_T * parent
Points to state's parent.
Definition: rkhitl.h:3805
RKH_INIT_ACT_T iaction
Points to initializing action (optional).
Definition: rkhitl.h:2778
Constant parameters of state machine.
Definition: rkhitl.h:2730
RKH_TRN_ACT_T iaction
Points to initializing action (optional).
Definition: rkhitl.h:3670
Platform - independent file that contains standard constants and macros.
rui8_t prio
SMA (a.k.a Active Object) priority.
Definition: rkhitl.h:2739
Describes the entry point connection.
Definition: rkhitl.h:3549
Describes the entry point pseudostate.
Definition: rkhitl.h:3691
RKHROM void * target
Points to target state.
Definition: rkhitl.h:3561
void(* RKH_ENT_ACT_T)(const RKH_SM_T *me)
Entry action.
Definition: rkhitl.h:3099
Describes the state machine.
Definition: rkhitl.h:2806
RKH_TRN_ACT_T action
Points to transition action.
Definition: rkhitl.h:3536
RKH_BASE_T base
Maintains the basic information of state.
Definition: rkhitl.h:3655
Virtual table for the RKH_SMA_T structure.
Definition: rkhitl.h:3042
Describes the state transition.
Definition: rkhitl.h:3301
RKH_THREAD_TYPE thread
Virtual pointer.
Definition: rkhitl.h:2964
RKHROM void * defchild
Points to state's default child.
Definition: rkhitl.h:3480
RKH_PPRO_T prepro
Definition: rkhitl.h:3521
RKH_BASE_T base
Maintains the basic information of state.
Definition: rkhitl.h:3776
RKH_SMAI_T sinfo
Performance information. This member is optional, thus it could be declared as NULL or eliminated in ...
Definition: rkhitl.h:3010
RKHROM RKH_SHIST_T * history
Points to state's history.
Definition: rkhitl.h:3493
Defines the data structure into which the collected performance information for state machine is stor...
Definition: rkhitl.h:2712
RKHROM RKH_ST_T ** dyp
Points to RAM memory location which stores the dynamic parent.
Definition: rkhitl.h:3677
RKHROM RKH_ST_T ** target
Points to RAM memory location which stores the state's history.
Definition: rkhitl.h:3812
RKHROM void * target
Points to target state.
Definition: rkhitl.h:3325
RKHPostFifo post_fifo
Definition: rkhitl.h:3061
RKHROM RKH_TR_T * trtbl
Points to state transition table.
Definition: rkhitl.h:3374
rui16_t exectr
Definition: rkhitl.h:2715
Describes a final state.
Definition: rkhitl.h:3502
Describes the history pseudostate.
Definition: rkhitl.h:3793
rui16_t ndevt
Definition: rkhitl.h:2714
void(* RKHPostFifo)(RKH_SMA_T *me, const RKH_EVT_T *e, const void *const sender)
Definition: rkhitl.h:3024
RKHROM RKH_TR_T * trtbl
Points to state transition table.
Definition: rkhitl.h:3630
RKHROM RKH_ENPCN_T * enpcn
Points to entry point connection.
Definition: rkhitl.h:3703
Describes a (referenced) submachine state machine.
Definition: rkhitl.h:3649
rui8_t ix
Index of exit point table.
Definition: rkhitl.h:3734
Describes the common properties of regular states (basic, composite, and submachine).
Definition: rkhitl.h:3333
RKH_BASE_T base
Maintains the basic information of state.
Definition: rkhitl.h:3728
#define RKH_OSSIGNAL_TYPE
The os_signal member of RKH_SMA_T is necessary when the underlying OS does not provide an adequate qu...
Definition: rkhitl.h:2262
RKHROM RKH_RSM_T * parent
Points to state's parent (referenced submachine).
Definition: rkhitl.h:3740
rbool_t(* RKH_GUARD_T)(const RKH_SM_T *me, RKH_EVT_T *pe)
Guard.
Definition: rkhitl.h:3246
RKH_OSSIGNAL_TYPE os_signal
OS-dependent object used to signal that an event has been queued.
Definition: rkhitl.h:2986
void(* RKHActivate)(RKH_SMA_T *me, const RKH_EVT_T **qSto, RKH_RQNE_T qSize, void *stkSto, rui32_t stkSize)
Definition: rkhitl.h:3015
void(* RKH_EXT_ACT_T)(const RKH_SM_T *me)
Exit action.
Definition: rkhitl.h:3139
RKH_BASE_T base
Maintains the basic information of state.
Definition: rkhitl.h:3697
Describes the exit point pseudostate.
Definition: rkhitl.h:3722
RKHTask task
Virtual function to control the execution of the AO (thread task).
Definition: rkhitl.h:3057
RKH_SIG_T event
Triggering event.
Definition: rkhitl.h:3307
const RKHSmaVtbl rkhSmaVtbl
RKHROM RKH_RSM_T * sbm
Points to submachine object.
Definition: rkhitl.h:3642
RKHROM RKH_EXPCN_T * exptbl
Points to state transition table.
Definition: rkhitl.h:3636
const RKH_EVT_T * ievent
Pointer to an event that will be passed to state machine application when it starts. Could be used to pass arguments to the state machine like an argc/argv. This argument is optional, thus it could be declared as NULL or eliminated in compile-time with RKH_CFG_SMA_INIT_EVT_EN = 0.
Definition: rkhitl.h:2789
RKH_BASE_T base
Maintains the basic information of state.
Definition: rkhitl.h:3339
#define RKH_EQ_TYPE
Defines the data type of the event queue for active objects. The event queue can be implemented with ...
Definition: rkhitl.h:2212
void(* RKHPostLifo)(RKH_SMA_T *me, const RKH_EVT_T *e, const void *const sender)
Definition: rkhitl.h:3032
Describes the conditional pseudostate.
Definition: rkhitl.h:3749
const char * name
Name of state or pseudostate.
Definition: rkhitl.h:3289
RKH_ENT_ACT_T enter
Points to entry action.
Definition: rkhitl.h:3346
RKHROM void * defchild
Points to state's default child.
Definition: rkhitl.h:3661
RKHActivate activate
Definition: rkhitl.h:3046
RKHROM RKH_TR_T * trtbl
Points to branch table.
Definition: rkhitl.h:3782
RKH_PPRO_T prepro
Points to event preprocessor.
Definition: rkhitl.h:3415
Defines the data types that uses RKH.
RKHPostLifo post_lifo
Definition: rkhitl.h:3065
RKHROM RKH_TR_T * trtbl
Points to branch table.
Definition: rkhitl.h:3761
RKHROM RKH_ST_T * state
Points to current stable state (simple or final state).
Definition: rkhitl.h:2818