RKH
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 site: http://vortexmakes.com/que-es/
28  * RKH GitHub: https://github.com/vortexmakes/RKH
29  * RKH Sourceforge: https://sourceforge.net/projects/rkh-reactivesys/
30  * e-mail: lf@vortexmakes.com
31  * ---------------------------------------------------------------------------
32  */
33 
40 /* -------------------------- Development history -------------------------- */
41 /*
42  * 2015.10.24 LeFr v2.4.05 Initial version
43  */
44 
45 /* -------------------------------- Authors -------------------------------- */
46 /*
47  * LeFr Leandro Francucci lf@vortexmakes.com
48  */
49 
50 /* --------------------------------- Notes --------------------------------- */
51 /* --------------------------------- Module -------------------------------- */
52 #ifndef __RKHITL_H__
53 #define __RKHITL_H__
54 
55 /* ----------------------------- Include files ----------------------------- */
59 #include "rkhplat.h"
60 
66 #include "rkhevt.h"
67 
68 /* ---------------------- External C language linkage ---------------------- */
69 #ifdef __cplusplus
70 extern "C" {
71 #endif
72 
73 /* --------------------------------- Macros -------------------------------- */
74 #if (((RKH_CFG_TRC_EN == 1) && (RKH_CFG_SMA_TRC_SNDR_EN == 1)) || \
75  (defined(RKH_EN_DOXYGEN) && RKH_EN_DOXYGEN == 1))
92  #define RKH_USE_TRC_SENDER
93 #endif
94 
100 #define RKH_RELEASE rkh_version
101 
124 #define RKH_VERSION(a, b, c) \
125  (((((a) << 12) & 0xF000) | \
126  (((b) << 8) & 0x0F00) | \
127  (((c) & 0xFF) & 0x00FF)) & 0xFFFF)
128 
133 #define RKH_ANY ((RKH_SIG_T)(-1))
134 
144 #define RKH_COMPLETION_EVENT (RKH_ANY - 1)
145 
156 #define RKH_SM_CREATION_EVENT (RKH_ANY - 2)
157 
167 #define RKH_LOWEST_PRIO (RKH_CFG_FWK_MAX_SMA - 1)
168 
169 /*
170  * Verifies port file from rkhport.h included in rkhplat.h.
171  */
172 
173 #ifndef RKHROM
174 #error "rkhport.h, Missing RKHROM: Qualifier for ROM data storage. \
175  See Porting chapter in readme file for more information"
176 #endif
177 
178 #define FOREVER for (;; )
179 
180 /*
181  * Macros for casting
182  */
183 #define CB(p) ((RKH_BASE_T *)(p))
184 #define CST(p) ((RKH_ST_T *)(p))
185 #define CCMP(p) ((RKH_SCMP_T *)(p))
186 #define CBSC(p) ((RKH_SBSC_T *)(p))
187 #define CCD(p) ((RKH_SCOND_T *)(p))
188 #define CCH(p) ((RKH_SCHOICE_T *)(p))
189 #define CH(p) ((RKH_SHIST_T *)(p))
190 #define CSBM(p) ((RKH_SSBM_T *)(p))
191 #define CRSM(p) ((RKH_RSM_T *)(p))
192 #define CM(p) ((RKHROM RKH_SM_T *)(p))
193 #define CT(p) ((RKHROM RKH_TR_T *)(p))
194 #define CPT(p) ((RKHROM RKH_SCMP_T *)(p))
195 #define CPP(p) ((RKH_PPRO_T)(p))
196 #define CG(p) ((RKH_GUARD_T)(p))
197 #define CA(p) ((RKH_TRN_ACT_T)(p))
198 #define CENP(p) ((RKH_SENP_T *)(p))
199 #define CEXP(p) ((RKH_SEXP_T *)(p))
200 #define CENPCN(p) ((RKH_ENPCN_T *)(p))
201 #define CEXPCN(p) ((RKH_EXPCN_T *)(p))
202 #define CE(p) ((RKH_EVT_T *)(p))
203 #define CCE(p) ((const RKH_EVT_T *)(p))
204 #define CV(p) ((void *)(p))
205 #define CSMA(p) ((const RKH_SMA_T *)(p))
206 #define CQ(p) ((RKH_QUEUE_T *)(p))
207 #define CTA(ta) ((RKH_TRN_ACT_T)(ta))
208 
220 #define RKH_DCLR_PTR_TYPE(type_, me_) \
221  extern type_ * const me_
222 
223 /* ------------------------- Configuration errors -------------------------- */
224 
225 /*
226  * LOOK FOR MISSING #define CONSTANTS
227  *
228  * This section is used to generate ERROR messages at compile time if
229  * certain #define constants are MISSING in rkhcfg.h. This allows you to
230  * quickly determine the source of the error.
231  *
232  * You SHOULD NOT change this section UNLESS you would like to add more
233  * comments as to the source of the compile time error.
234  */
235 
236 /* MEMORY POOL --------------------------------------------------------- */
237 #ifndef RKH_CFG_MP_EN
238  #error "RKH_CFG_MP_EN not #define'd in 'rkhcfg.h'"
239  #error " [MUST be RKH_ENABLED ] "
240  #error " [ || RKH_DISABLED] "
241 
242 #elif ((RKH_CFG_MP_EN != RKH_ENABLED) && \
243  (RKH_CFG_MP_EN != RKH_DISABLED))
244  #error "RKH_CFG_MP_EN illegally #define'd in 'rkhcfg.h'"
245  #error " [MUST be RKH_ENABLED ] "
246  #error " [ || RKH_DISABLED] "
247 
248 #elif (RKH_CFG_MP_EN == RKH_ENABLED)
249 
250  #ifndef RKH_CFG_MP_REDUCED_EN
251  #error "RKH_CFG_MP_REDUCED_EN not #define'd in 'rkhcfg.h'"
252  #error " [MUST be RKH_ENABLED ] "
253  #error " [ || RKH_DISABLED] "
254 
255  #elif ((RKH_CFG_MP_REDUCED_EN != RKH_ENABLED) && \
256  (RKH_CFG_MP_REDUCED_EN != RKH_DISABLED))
257  #error "RKH_CFG_MP_REDUCED_EN illegally #define'd in 'rkhcfg.h'"
258  #error " [MUST be RKH_ENABLED ] "
259  #error " [ || RKH_DISABLED] "
260  #endif
261 
262  #ifndef RKH_CFG_MP_SIZEOF_BSIZE
263  #error "RKH_CFG_MP_SIZEOF_BSIZE not #define'd in 'rkhcfg.h'"
264  #error " [MUST be 8 ( 8-bit size)] "
265  #error " [ || 16 (16-bit size)] "
266  #error " [ || 32 (32-bit size)] "
267 
268  #elif ((RKH_CFG_MP_SIZEOF_BSIZE != 8) && \
269  (RKH_CFG_MP_SIZEOF_BSIZE != 16) && \
270  (RKH_CFG_MP_SIZEOF_BSIZE != 32))
271  #error "RKH_CFG_MP_SIZEOF_BSIZE illegally #define'd in 'rkhcfg.h'"
272  #error " [MUST be 8 ( 8-bit size)] "
273  #error " [ || 16 (16-bit size)] "
274  #error " [ || 32 (32-bit size)] "
275  #endif
276 
277  #ifndef RKH_CFG_MP_SIZEOF_NBLOCK
278  #error "RKH_CFG_MP_SIZEOF_NBLOCK not #define'd in 'rkhcfg.h'"
279  #error " [MUST be 8 ( 8-bit size)] "
280  #error " [ || 16 (16-bit size)] "
281  #error " [ || 32 (32-bit size)] "
282 
283  #elif ((RKH_CFG_MP_SIZEOF_NBLOCK != 8) && \
284  (RKH_CFG_MP_SIZEOF_NBLOCK != 16) && \
285  (RKH_CFG_MP_SIZEOF_NBLOCK != 32))
286  #error "RKH_CFG_MP_SIZEOF_NBLOCK illegally #define'd in 'rkhcfg.h'"
287  #error " [MUST be 8 ( 8-bit size)] "
288  #error " [ || 16 (16-bit size)] "
289  #error " [ || 32 (32-bit size)] "
290  #endif
291 
292  #ifndef RKH_CFG_MP_GET_BSIZE_EN
293  #error "RKH_CFG_MP_GET_BSIZE_EN not #define'd in 'rkhcfg.h'"
294  #error " [MUST be RKH_ENABLED ] "
295  #error " [ || RKH_DISABLED] "
296 
297  #elif ((RKH_CFG_MP_GET_BSIZE_EN != RKH_ENABLED) && \
298  (RKH_CFG_MP_GET_BSIZE_EN != RKH_DISABLED))
299  #error "RKH_CFG_MP_GET_BSIZE_EN illegally #define'd in 'rkhcfg.h'"
300  #error " [MUST be RKH_ENABLED ] "
301  #error " [ || RKH_DISABLED] "
302  #endif
303 
304  #ifndef RKH_CFG_MP_GET_NFREE_EN
305  #error "RKH_CFG_MP_GET_NFREE_EN not #define'd in 'rkhcfg.h'"
306  #error " [MUST be RKH_ENABLED ] "
307  #error " [ || RKH_DISABLED] "
308 
309  #elif ((RKH_CFG_MP_GET_NFREE_EN != RKH_ENABLED) && \
310  (RKH_CFG_MP_GET_NFREE_EN != RKH_DISABLED))
311  #error "RKH_CFG_MP_GET_NFREE_EN illegally #define'd in 'rkhcfg.h'"
312  #error " [MUST be RKH_ENABLED ] "
313  #error " [ || RKH_DISABLED] "
314  #endif
315 
316  #ifndef RKH_CFG_MP_GET_LWM_EN
317  #error "RKH_CFG_MP_GET_LWM_EN not #define'd in 'rkhcfg.h'"
318  #error " [MUST be RKH_ENABLED ] "
319  #error " [ || RKH_DISABLED] "
320 
321  #elif ((RKH_CFG_MP_GET_LWM_EN != RKH_ENABLED) && \
322  (RKH_CFG_MP_GET_LWM_EN != RKH_DISABLED))
323  #error "RKH_CFG_MP_GET_LWM_EN illegally #define'd in 'rkhcfg.h'"
324  #error " [MUST be RKH_ENABLED ] "
325  #error " [ || RKH_DISABLED] "
326  #endif
327 
328  #ifndef RKH_CFG_MP_GET_INFO_EN
329  #error "RKH_CFG_MP_GET_INFO_EN not #define'd in 'rkhcfg.h'"
330  #error " [MUST be RKH_ENABLED ] "
331  #error " [ || RKH_DISABLED] "
332 
333  #elif ((RKH_CFG_MP_GET_INFO_EN != RKH_ENABLED) && \
334  (RKH_CFG_MP_GET_INFO_EN != RKH_DISABLED))
335  #error "RKH_CFG_MP_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
336  #error " [MUST be RKH_ENABLED ] "
337  #error " [ || RKH_DISABLED] "
338  #endif
339 
340 #endif
341 
342 /* QUEUE --------------------------------------------------------- */
343 #ifndef RKH_CFG_QUE_EN
344  #error "RKH_CFG_QUE_EN not #define'd in 'rkhcfg.h'"
345  #error " [MUST be RKH_ENABLED ] "
346  #error " [ || RKH_DISABLED] "
347 
348 #elif ((RKH_CFG_QUE_EN != RKH_ENABLED) && \
349  (RKH_CFG_QUE_EN != RKH_DISABLED))
350  #error "RKH_CFG_QUE_EN illegally #define'd in 'rkhcfg.h'"
351  #error " [MUST be RKH_ENABLED ] "
352  #error " [ || RKH_DISABLED] "
353 
354 #endif
355 
356 #ifndef RKH_CFG_QUE_SIZEOF_NELEM
357  #error "RKH_CFG_QUE_SIZEOF_NELEM not #define'd in 'rkhcfg.h'"
358  #error " [MUST be 8 ( 8-bit size)] "
359  #error " [ || 16 (16-bit size)] "
360  #error " [ || 32 (32-bit size)] "
361 
362 #elif ((RKH_CFG_QUE_SIZEOF_NELEM != 8) && \
363  (RKH_CFG_QUE_SIZEOF_NELEM != 16) && \
364  (RKH_CFG_QUE_SIZEOF_NELEM != 32))
365  #error "RKH_CFG_QUE_SIZEOF_NELEM illegally #define'd in 'rkhcfg.h'"
366  #error " [MUST be 8 ( 8-bit size)] "
367  #error " [ || 16 (16-bit size)] "
368  #error " [ || 32 (32-bit size)] "
369 
370 #endif
371 
372 #ifndef RKH_CFG_QUE_GET_LWMARK_EN
373  #error "RKH_CFG_QUE_GET_LWMARK_EN not #define'd in 'rkhcfg.h'"
374  #error " [MUST be RKH_ENABLED ] "
375  #error " [ || RKH_DISABLED] "
376 
377 #elif ((RKH_CFG_QUE_GET_LWMARK_EN != RKH_ENABLED) && \
378  (RKH_CFG_QUE_GET_LWMARK_EN != RKH_DISABLED))
379  #error "RKH_CFG_QUE_GET_LWMARK_EN illegally #define'd in 'rkhcfg.h'"
380  #error " [MUST be RKH_ENABLED ] "
381  #error " [ || RKH_DISABLED] "
382 
383 #endif
384 
385 #ifndef RKH_CFG_QUE_READ_EN
386  #error "RKH_CFG_QUE_READ_EN not #define'd in 'rkhcfg.h'"
387  #error " [MUST be RKH_ENABLED ] "
388  #error " [ || RKH_DISABLED] "
389 
390 #elif ((RKH_CFG_QUE_READ_EN != RKH_ENABLED) && \
391  (RKH_CFG_QUE_READ_EN != RKH_DISABLED))
392  #error "RKH_CFG_QUE_READ_EN illegally #define'd in 'rkhcfg.h'"
393  #error " [MUST be RKH_ENABLED ] "
394  #error " [ || RKH_DISABLED] "
395 
396 #endif
397 
398 #ifndef RKH_CFG_QUE_DEPLETE_EN
399  #error "RKH_CFG_QUE_DEPLETE_EN not #define'd in 'rkhcfg.h'"
400  #error " [MUST be RKH_ENABLED ] "
401  #error " [ || RKH_DISABLED] "
402 
403 #elif ((RKH_CFG_QUE_DEPLETE_EN != RKH_ENABLED) && \
404  (RKH_CFG_QUE_DEPLETE_EN != RKH_DISABLED))
405  #error "RKH_CFG_QUE_DEPLETE_EN illegally #define'd in 'rkhcfg.h'"
406  #error " [MUST be RKH_ENABLED ] "
407  #error " [ || RKH_DISABLED] "
408 
409 #endif
410 
411 #ifndef RKH_CFG_QUE_IS_FULL_EN
412  #error "RKH_CFG_QUE_IS_FULL_EN not #define'd in 'rkhcfg.h'"
413  #error " [MUST be RKH_ENABLED ] "
414  #error " [ || RKH_DISABLED] "
415 
416 #elif ((RKH_CFG_QUE_IS_FULL_EN != RKH_ENABLED) && \
417  (RKH_CFG_QUE_IS_FULL_EN != RKH_DISABLED))
418  #error "RKH_CFG_QUE_IS_FULL_EN illegally #define'd in 'rkhcfg.h'"
419  #error " [MUST be RKH_ENABLED ] "
420  #error " [ || RKH_DISABLED] "
421 
422 #endif
423 
424 #ifndef RKH_CFG_QUE_GET_NELEMS_EN
425  #error "RKH_CFG_QUE_GET_NELEMS_EN not #define'd in 'rkhcfg.h'"
426  #error " [MUST be RKH_ENABLED ] "
427  #error " [ || RKH_DISABLED] "
428 
429 #elif ((RKH_CFG_QUE_GET_NELEMS_EN != RKH_ENABLED) && \
430  (RKH_CFG_QUE_GET_NELEMS_EN != RKH_DISABLED))
431  #error "RKH_CFG_QUE_GET_NELEMS_EN illegally #define'd in 'rkhcfg.h'"
432  #error " [MUST be RKH_ENABLED ] "
433  #error " [ || RKH_DISABLED] "
434 
435 #endif
436 
437 #ifndef RKH_CFG_QUE_PUT_LIFO_EN
438  #error "RKH_CFG_QUE_PUT_LIFO_EN not #define'd in 'rkhcfg.h'"
439  #error " [MUST be RKH_ENABLED ] "
440  #error " [ || RKH_DISABLED] "
441 
442 #elif ((RKH_CFG_QUE_PUT_LIFO_EN != RKH_ENABLED) && \
443  (RKH_CFG_QUE_PUT_LIFO_EN != RKH_DISABLED))
444  #error "RKH_CFG_QUE_PUT_LIFO_EN illegally #define'd in 'rkhcfg.h'"
445  #error " [MUST be RKH_ENABLED ] "
446  #error " [ || RKH_DISABLED] "
447 
448 #endif
449 
450 #ifndef RKH_CFG_QUE_GET_INFO_EN
451  #error "RKH_CFG_QUE_GET_INFO_EN not #define'd in 'rkhcfg.h'"
452  #error " [MUST be RKH_ENABLED ] "
453  #error " [ || RKH_DISABLED] "
454 
455 #elif ((RKH_CFG_QUE_GET_INFO_EN != RKH_ENABLED) && \
456  (RKH_CFG_QUE_GET_INFO_EN != RKH_DISABLED))
457  #error "RKH_CFG_QUE_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
458  #error " [MUST be RKH_ENABLED ] "
459  #error " [ || RKH_DISABLED] "
460 
461 #endif
462 
463 /* TIMER --------------------------------------------------------- */
464 #ifndef RKH_CFG_TMR_EN
465  #error "RKH_CFG_TMR_EN not #define'd in 'rkhcfg.h'"
466  #error " [MUST be RKH_ENABLED ] "
467  #error " [ || RKH_DISABLED] "
468 
469 #elif ((RKH_CFG_TMR_EN != RKH_ENABLED) && \
470  (RKH_CFG_TMR_EN != RKH_DISABLED))
471  #error "RKH_CFG_TMR_EN illegally #define'd in 'rkhcfg.h'"
472  #error " [MUST be RKH_ENABLED ] "
473  #error " [ || RKH_DISABLED] "
474 
475 #elif (RKH_CFG_TMR_EN == RKH_ENABLED)
476  #ifndef RKH_CFG_FWK_TICK_RATE_HZ
477  #error "RKH_CFG_FWK_TICK_RATE_HZ not #define'd in 'rkhcfg.h'"
478  #error " [MUST be RKH_ENABLED ] "
479  #error " [ || RKH_DISABLED] "
480  #elif (RKH_CFG_FWK_TICK_RATE_HZ <= 0u)
481  #error "RKH_CFG_FWK_TICK_RATE_HZ illegally #define'd in 'rkhcfg.h'"
482  #error " [MUST be > 0] "
483  #endif
484 
485  #ifndef RKH_CFG_TMR_SIZEOF_NTIMER
486  #error "RKH_CFG_TMR_SIZEOF_NTIMER not #define'd in 'rkhcfg.h'"
487  #error " [MUST be 8 ( 8-bit size)] "
488  #error " [ || 16 (16-bit size)] "
489  #error " [ || 32 (32-bit size)] "
490 
491  #elif ((RKH_CFG_TMR_SIZEOF_NTIMER != 8) && \
492  (RKH_CFG_TMR_SIZEOF_NTIMER != 16) && \
493  (RKH_CFG_TMR_SIZEOF_NTIMER != 32))
494  #error "RKH_CFG_TMR_SIZEOF_NTIMER illegally #define'd in 'rkhcfg.h'"
495  #error " [MUST be 8 ( 8-bit size)] "
496  #error " [ || 16 (16-bit size)] "
497  #error " [ || 32 (32-bit size)] "
498  #endif
499 
500  #ifndef RKH_CFG_TMR_HOOK_EN
501  #error "RKH_CFG_TMR_HOOK_EN not #define'd in 'rkhcfg.h'"
502  #error " [MUST be RKH_ENABLED ] "
503  #error " [ || RKH_DISABLED] "
504 
505  #elif ((RKH_CFG_TMR_HOOK_EN != RKH_ENABLED) && \
506  (RKH_CFG_TMR_HOOK_EN != RKH_DISABLED))
507  #error "RKH_CFG_TMR_HOOK_EN illegally #define'd in 'rkhcfg.h'"
508  #error " [MUST be RKH_ENABLED ] "
509  #error " [ || RKH_DISABLED] "
510  #endif
511 
512  #ifndef RKH_CFG_TMR_GET_INFO_EN
513  #error "RKH_CFG_TMR_GET_INFO_EN not #define'd in 'rkhcfg.h'"
514  #error " [MUST be RKH_ENABLED ] "
515  #error " [ || RKH_DISABLED] "
516 
517  #elif ((RKH_CFG_TMR_GET_INFO_EN != RKH_ENABLED) && \
518  (RKH_CFG_TMR_GET_INFO_EN != RKH_DISABLED))
519  #error "RKH_CFG_TMR_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
520  #error " [MUST be RKH_ENABLED ] "
521  #error " [ || RKH_DISABLED] "
522  #endif
523 
524 #endif
525 
526 /* STATE MACHINE APPLICATIONS -------------------------------------------- */
527 #ifndef RKH_CFG_SMA_GET_INFO_EN
528  #error "RKH_CFG_SMA_GET_INFO_EN not #define'd in 'rkhcfg.h'"
529  #error " [MUST be RKH_ENABLED ] "
530  #error " [ || RKH_DISABLED] "
531 
532 #elif ((RKH_CFG_SMA_GET_INFO_EN != RKH_ENABLED) && \
533  (RKH_CFG_SMA_GET_INFO_EN != RKH_DISABLED))
534  #error "RKH_CFG_SMA_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
535  #error " [MUST be RKH_ENABLED ] "
536  #error " [ || RKH_DISABLED] "
537 
538 #endif
539 
540 #ifndef RKH_CFG_SMA_PPRO_EN
541  #error "RKH_CFG_SMA_PPRO_EN not #define'd in 'rkhcfg.h'"
542  #error " [MUST be RKH_ENABLED ] "
543  #error " [ || RKH_DISABLED] "
544 
545 #elif ((RKH_CFG_SMA_PPRO_EN != RKH_ENABLED) && \
546  (RKH_CFG_SMA_PPRO_EN != RKH_DISABLED))
547  #error "RKH_CFG_SMA_PPRO_EN illegally #define'd in 'rkhcfg.h'"
548  #error " [MUST be RKH_ENABLED ] "
549  #error " [ || RKH_DISABLED] "
550 
551 #endif
552 
553 #ifndef RKH_CFG_SMA_HCAL_EN
554  #error "RKH_CFG_SMA_HCAL_EN not #define'd in 'rkhcfg.h'"
555  #error " [MUST be RKH_ENABLED ] "
556  #error " [ || RKH_DISABLED] "
557 
558 #elif ((RKH_CFG_SMA_HCAL_EN != RKH_ENABLED) && \
559  (RKH_CFG_SMA_HCAL_EN != RKH_DISABLED))
560  #error "RKH_CFG_SMA_HCAL_EN illegally #define'd in 'rkhcfg.h'"
561  #error " [MUST be RKH_ENABLED ] "
562  #error " [ || RKH_DISABLED] "
563 
564 #endif
565 
566 #ifndef RKH_CFG_SMA_MAX_HCAL_DEPTH
567  #error "RKH_CFG_SMA_MAX_HCAL_DEPTH not #define'd in 'rkhcfg.h'"
568  #error " [MUST be > 0] "
569  #error " [ && <= 8] "
570 
571 #elif ((RKH_CFG_SMA_MAX_HCAL_DEPTH == 0) || \
572  (RKH_CFG_SMA_MAX_HCAL_DEPTH > 8))
573  #error "RKH_CFG_SMA_MAX_HCAL_DEPTH illegally #define'd in 'rkhcfg.h'"
574  #error " [MUST be >= 0] "
575  #error " [ && <= 8] "
576 
577 #endif
578 
579 #ifndef RKH_CFG_SMA_MAX_TRC_SEGS
580  #error "RKH_CFG_SMA_MAX_TRC_SEGS not #define'd in 'rkhcfg.h'"
581  #error " [MUST be > 0] "
582  #error " [ && <= 8] "
583 
584 #elif ((RKH_CFG_SMA_MAX_TRC_SEGS == 0) || \
585  (RKH_CFG_SMA_MAX_TRC_SEGS > 8))
586  #error "RKH_CFG_SMA_MAX_TRC_SEGS illegally #define'd in 'rkhcfg.h'"
587  #error " [MUST be >= 0] "
588  #error " [ && <= 8] "
589 
590 #endif
591 
592 #ifndef RKH_CFG_SMA_PSEUDOSTATE_EN
593  #error "RKH_CFG_SMA_PSEUDOSTATE_EN not #define'd in 'rkhcfg.h'"
594  #error " [MUST be RKH_ENABLED ] "
595  #error " [ || RKH_DISABLED] "
596 
597 #elif ((RKH_CFG_SMA_PSEUDOSTATE_EN != RKH_ENABLED) && \
598  (RKH_CFG_SMA_PSEUDOSTATE_EN != RKH_DISABLED))
599  #error "RKH_CFG_SMA_PSEUDOSTATE_EN illegally #define'd in 'rkhcfg.h'"
600  #error " [MUST be RKH_ENABLED ] "
601  #error " [ || RKH_DISABLED] "
602 
603 #endif
604 
605 #ifndef RKH_CFG_SMA_DEEP_HIST_EN
606  #error "RKH_CFG_SMA_DEEP_HIST_EN not #define'd in 'rkhcfg.h'"
607  #error " [MUST be RKH_ENABLED ] "
608  #error " [ || RKH_DISABLED] "
609 
610 #elif ((RKH_CFG_SMA_DEEP_HIST_EN != RKH_ENABLED) && \
611  (RKH_CFG_SMA_DEEP_HIST_EN != RKH_DISABLED))
612  #error "RKH_CFG_SMA_DEEP_HIST_EN illegally #define'd in 'rkhcfg.h'"
613  #error " [MUST be RKH_ENABLED ] "
614  #error " [ || RKH_DISABLED] "
615 
616 #endif
617 
618 #ifndef RKH_CFG_SMA_SHALLOW_HIST_EN
619  #error "RKH_CFG_SMA_SHALLOW_HIST_EN not #define'd in 'rkhcfg.h'"
620  #error " [MUST be RKH_ENABLED ] "
621  #error " [ || RKH_DISABLED] "
622 
623 #elif ((RKH_CFG_SMA_SHALLOW_HIST_EN != RKH_ENABLED) && \
624  (RKH_CFG_SMA_SHALLOW_HIST_EN != RKH_DISABLED))
625  #error "RKH_CFG_SMA_SHALLOW_HIST_EN illegally #define'd in 'rkhcfg.h'"
626  #error " [MUST be RKH_ENABLED ] "
627  #error " [ || RKH_DISABLED] "
628 
629 #endif
630 
631 #ifndef RKH_CFG_SMA_CHOICE_EN
632  #error "RKH_CFG_SMA_CHOICE_EN not #define'd in 'rkhcfg.h'"
633  #error " [MUST be RKH_ENABLED ] "
634  #error " [ || RKH_DISABLED] "
635 
636 #elif ((RKH_CFG_SMA_CHOICE_EN != RKH_ENABLED) && \
637  (RKH_CFG_SMA_CHOICE_EN != RKH_DISABLED))
638  #error "RKH_CFG_SMA_CHOICE_EN illegally #define'd in 'rkhcfg.h'"
639  #error " [MUST be RKH_ENABLED ] "
640  #error " [ || RKH_DISABLED] "
641 
642 #endif
643 
644 #ifndef RKH_CFG_SMA_CONDITIONAL_EN
645  #error "RKH_CFG_SMA_CONDITIONAL_EN not #define'd in 'rkhcfg.h'"
646  #error " [MUST be RKH_ENABLED ] "
647  #error " [ || RKH_DISABLED] "
648 
649 #elif ((RKH_CFG_SMA_CONDITIONAL_EN != RKH_ENABLED) && \
650  (RKH_CFG_SMA_CONDITIONAL_EN != RKH_DISABLED))
651  #error "RKH_CFG_SMA_CONDITIONAL_EN illegally #define'd in 'rkhcfg.h'"
652  #error " [MUST be RKH_ENABLED ] "
653  #error " [ || RKH_DISABLED] "
654 
655 #endif
656 
657 #ifndef RKH_CFG_SMA_SUBMACHINE_EN
658  #error "RKH_CFG_SMA_SUBMACHINE_EN not #define'd in 'rkhcfg.h'"
659  #error " [MUST be RKH_ENABLED ] "
660  #error " [ || RKH_DISABLED] "
661 
662 #elif ((RKH_CFG_SMA_SUBMACHINE_EN != RKH_ENABLED) && \
663  (RKH_CFG_SMA_SUBMACHINE_EN != RKH_DISABLED))
664  #error "RKH_CFG_SMA_SUBMACHINE_EN illegally #define'd in 'rkhcfg.h'"
665  #error " [MUST be RKH_ENABLED ] "
666  #error " [ || RKH_DISABLED] "
667 
668 #endif
669 
670 #ifndef RKH_CFG_SMA_TRC_SNDR_EN
671  #error "RKH_CFG_SMA_TRC_SNDR_EN not #define'd in 'rkhcfg.h'"
672  #error " [MUST be RKH_ENABLED ] "
673  #error " [ || RKH_DISABLED] "
674 
675 #elif ((RKH_CFG_SMA_TRC_SNDR_EN != RKH_ENABLED) && \
676  (RKH_CFG_SMA_TRC_SNDR_EN != RKH_DISABLED))
677  #error "RKH_CFG_SMA_TRC_SNDR_EN illegally #define'd in 'rkhcfg.h'"
678  #error " [MUST be RKH_ENABLED ] "
679  #error " [ || RKH_DISABLED] "
680 
681 #endif
682 
683 #ifndef RKH_CFG_SMA_ENT_ARG_SMA_EN
684  #error "RKH_CFG_SMA_ENT_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
685  #error " [MUST be RKH_ENABLED ] "
686  #error " [ || RKH_DISABLED] "
687 
688 #elif ((RKH_CFG_SMA_ENT_ARG_SMA_EN != RKH_ENABLED) && \
689  (RKH_CFG_SMA_ENT_ARG_SMA_EN != RKH_DISABLED))
690  #error "RKH_CFG_SMA_ENT_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
691  #error " [MUST be RKH_ENABLED ] "
692  #error " [ || RKH_DISABLED] "
693 
694 #endif
695 
696 #ifndef RKH_CFG_SMA_ENT_ARG_STATE_EN
697  #error "RKH_CFG_SMA_ENT_ARG_STATE_EN not #define'd in 'rkhcfg.h'"
698  #error " [MUST be RKH_ENABLED ] "
699  #error " [ || RKH_DISABLED] "
700 
701 #elif ((RKH_CFG_SMA_ENT_ARG_STATE_EN != RKH_ENABLED) && \
702  (RKH_CFG_SMA_ENT_ARG_STATE_EN != RKH_DISABLED))
703  #error "RKH_CFG_SMA_ENT_ARG_STATE_EN illegally #define'd in 'rkhcfg.h'"
704  #error " [MUST be RKH_ENABLED ] "
705  #error " [ || RKH_DISABLED] "
706 
707 #endif
708 
709 #ifndef RKH_CFG_SMA_EXT_ARG_SMA_EN
710  #error "RKH_CFG_SMA_EXT_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
711  #error " [MUST be RKH_ENABLED ] "
712  #error " [ || RKH_DISABLED] "
713 
714 #elif ((RKH_CFG_SMA_EXT_ARG_SMA_EN != RKH_ENABLED) && \
715  (RKH_CFG_SMA_EXT_ARG_SMA_EN != RKH_DISABLED))
716  #error "RKH_CFG_SMA_EXT_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
717  #error " [MUST be RKH_ENABLED ] "
718  #error " [ || RKH_DISABLED] "
719 
720 #endif
721 
722 #ifndef RKH_CFG_SMA_EXT_ARG_STATE_EN
723  #error "RKH_CFG_SMA_EXT_ARG_STATE_EN not #define'd in 'rkhcfg.h'"
724  #error " [MUST be RKH_ENABLED ] "
725  #error " [ || RKH_DISABLED] "
726 
727 #elif ((RKH_CFG_SMA_EXT_ARG_STATE_EN != RKH_ENABLED) && \
728  (RKH_CFG_SMA_EXT_ARG_STATE_EN != RKH_DISABLED))
729  #error "RKH_CFG_SMA_EXT_ARG_STATE_EN illegally #define'd in 'rkhcfg.h'"
730  #error " [MUST be RKH_ENABLED ] "
731  #error " [ || RKH_DISABLED] "
732 
733 #endif
734 
735 #ifndef RKH_CFG_SMA_ACT_ARG_SMA_EN
736  #error "RKH_CFG_SMA_ACT_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
737  #error " [MUST be RKH_ENABLED ] "
738  #error " [ || RKH_DISABLED] "
739 
740 #elif ((RKH_CFG_SMA_ACT_ARG_SMA_EN != RKH_ENABLED) && \
741  (RKH_CFG_SMA_ACT_ARG_SMA_EN != RKH_DISABLED))
742  #error "RKH_CFG_SMA_ACT_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
743  #error " [MUST be RKH_ENABLED ] "
744  #error " [ || RKH_DISABLED] "
745 
746 #endif
747 
748 #ifndef RKH_CFG_SMA_ACT_ARG_EVT_EN
749  #error "RKH_CFG_SMA_ACT_ARG_EVT_EN not #define'd in 'rkhcfg.h'"
750  #error " [MUST be RKH_ENABLED ] "
751  #error " [ || RKH_DISABLED] "
752 
753 #elif ((RKH_CFG_SMA_ACT_ARG_EVT_EN != RKH_ENABLED) && \
754  (RKH_CFG_SMA_ACT_ARG_EVT_EN != RKH_DISABLED))
755  #error "RKH_CFG_SMA_ACT_ARG_EVT_EN illegally #define'd in 'rkhcfg.h'"
756  #error " [MUST be RKH_ENABLED ] "
757  #error " [ || RKH_DISABLED] "
758 
759 #endif
760 
761 #ifndef RKH_CFG_SMA_GRD_ARG_EVT_EN
762  #error "RKH_CFG_SMA_GRD_ARG_EVT_EN not #define'd in 'rkhcfg.h'"
763  #error " [MUST be RKH_ENABLED ] "
764  #error " [ || RKH_DISABLED] "
765 
766 #elif ((RKH_CFG_SMA_GRD_ARG_EVT_EN != RKH_ENABLED) && \
767  (RKH_CFG_SMA_GRD_ARG_EVT_EN != RKH_DISABLED))
768  #error "RKH_CFG_SMA_GRD_ARG_EVT_EN illegally #define'd in 'rkhcfg.h'"
769  #error " [MUST be RKH_ENABLED ] "
770  #error " [ || RKH_DISABLED] "
771 
772 #endif
773 
774 #ifndef RKH_CFG_SMA_GRD_ARG_SMA_EN
775  #error "RKH_CFG_SMA_GRD_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
776  #error " [MUST be RKH_ENABLED ] "
777  #error " [ || RKH_DISABLED] "
778 
779 #elif ((RKH_CFG_SMA_GRD_ARG_SMA_EN != RKH_ENABLED) && \
780  (RKH_CFG_SMA_GRD_ARG_SMA_EN != RKH_DISABLED))
781  #error "RKH_CFG_SMA_GRD_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
782  #error " [MUST be RKH_ENABLED ] "
783  #error " [ || RKH_DISABLED] "
784 
785 #endif
786 
787 #ifndef RKH_CFG_SMA_PPRO_ARG_SMA_EN
788  #error "RKH_CFG_SMA_PPRO_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
789  #error " [MUST be RKH_ENABLED ] "
790  #error " [ || RKH_DISABLED] "
791 
792 #elif ((RKH_CFG_SMA_PPRO_ARG_SMA_EN != RKH_ENABLED) && \
793  (RKH_CFG_SMA_PPRO_ARG_SMA_EN != RKH_DISABLED))
794  #error "RKH_CFG_SMA_PPRO_ARG_SMA_EN illegally #define'd in 'rkhcfg.h'"
795  #error " [MUST be RKH_ENABLED ] "
796  #error " [ || RKH_DISABLED] "
797 
798 #endif
799 
800 #ifndef RKH_CFG_SMA_SM_CONST_EN
801  #error "RKH_CFG_SMA_SM_CONST_EN not #define'd in 'rkhcfg.h'"
802  #error " [MUST be RKH_ENABLED ] "
803  #error " [ || RKH_DISABLED] "
804 
805 #elif ((RKH_CFG_SMA_SM_CONST_EN != RKH_ENABLED) && \
806  (RKH_CFG_SMA_SM_CONST_EN != RKH_DISABLED))
807  #error "RKH_CFG_SMA_SM_CONST_EN illegally #define'd in 'rkhcfg.h'"
808  #error " [MUST be RKH_ENABLED ] "
809  #error " [ || RKH_DISABLED] "
810 
811 #endif
812 
813 #ifndef RKH_CFG_SMA_RT_CTOR_EN
814  #error "RKH_CFG_SMA_RT_CTOR_EN not #define'd in 'rkhcfg.h'"
815  #error " [MUST be RKH_ENABLED ] "
816  #error " [ || RKH_DISABLED] "
817 
818 #elif ((RKH_CFG_SMA_RT_CTOR_EN != RKH_ENABLED) && \
819  (RKH_CFG_SMA_RT_CTOR_EN != RKH_DISABLED))
820  #error "RKH_CFG_SMA_RT_CTOR_EN illegally #define'd in 'rkhcfg.h'"
821  #error " [MUST be RKH_ENABLED ] "
822  #error " [ || RKH_DISABLED] "
823 
824 #endif
825 
826 #ifndef RKH_CFG_SMA_VFUNCT_EN
827  #error "RKH_CFG_SMA_VFUNCT_EN not #define'd in 'rkhcfg.h'"
828  #error " [MUST be RKH_ENABLED ] "
829  #error " [ || RKH_DISABLED] "
830 
831 #elif ((RKH_CFG_SMA_VFUNCT_EN != RKH_ENABLED) && \
832  (RKH_CFG_SMA_VFUNCT_EN != RKH_DISABLED))
833  #error "RKH_CFG_SMA_VFUNCT_EN illegally #define'd in 'rkhcfg.h'"
834  #error " [MUST be RKH_ENABLED ] "
835  #error " [ || RKH_DISABLED] "
836 
837 #endif
838 
839 #ifndef RKH_CFG_SMA_ORTHREG_EN
840  #error "RKH_CFG_SMA_ORTHREG_EN not #define'd in 'rkhcfg.h'"
841  #error " [MUST be RKH_ENABLED ] "
842  #error " [ || RKH_DISABLED] "
843 
844 #elif ((RKH_CFG_SMA_ORTHREG_EN != RKH_ENABLED) && \
845  (RKH_CFG_SMA_ORTHREG_EN != RKH_DISABLED))
846  #error "RKH_CFG_SMA_ORTHREG_EN illegally #define'd in 'rkhcfg.h'"
847  #error " [MUST be RKH_ENABLED ] "
848  #error " [ || RKH_DISABLED] "
849 
850 #endif
851 
852 /* TRACE --------------------------------------------------------- */
853 #ifndef RKH_CFG_TRC_EN
854  #error "RKH_CFG_TRC_EN not #define'd in 'rkhcfg.h'"
855  #error " [MUST be RKH_ENABLED ] "
856  #error " [ || RKH_DISABLED] "
857 
858 #elif ((RKH_CFG_TRC_EN != RKH_ENABLED) && \
859  (RKH_CFG_TRC_EN != RKH_DISABLED))
860  #error "RKH_CFG_TRC_EN illegally #define'd in 'rkhcfg.h'"
861  #error " [MUST be RKH_ENABLED ] "
862  #error " [ || RKH_DISABLED] "
863 
864 #elif (RKH_CFG_TRC_EN == RKH_ENABLED)
865 
866  #ifndef RKH_CFG_TRC_RTFIL_EN
867  #error "RKH_CFG_TRC_RTFIL_EN not #define'd in 'rkhcfg.h'"
868  #error " [MUST be RKH_ENABLED ] "
869  #error " [ || RKH_DISABLED] "
870 
871  #elif ((RKH_CFG_TRC_RTFIL_EN != RKH_ENABLED) && \
872  (RKH_CFG_TRC_RTFIL_EN != RKH_DISABLED))
873  #error "RKH_CFG_TRC_RTFIL_EN illegally #define'd in 'rkhcfg.h'"
874  #error " [MUST be RKH_ENABLED ] "
875  #error " [ || RKH_DISABLED] "
876  #endif
877 
878  #ifndef RKH_CFG_TRC_RTFIL_SMA_EN
879  #error "RKH_CFG_TRC_RTFIL_SMA_EN not #define'd in 'rkhcfg.h'"
880  #error " [MUST be RKH_ENABLED ] "
881  #error " [ || RKH_DISABLED] "
882 
883  #elif ((RKH_CFG_TRC_RTFIL_SMA_EN != RKH_ENABLED) && \
884  (RKH_CFG_TRC_RTFIL_SMA_EN != RKH_DISABLED))
885  #error "RKH_CFG_TRC_RTFIL_SMA_EN illegally #define'd in 'rkhcfg.h'"
886  #error " [MUST be RKH_ENABLED ] "
887  #error " [ || RKH_DISABLED] "
888  #endif
889 
890  #ifndef RKH_CFG_TRC_RTFIL_SIGNAL_EN
891  #error "RKH_CFG_TRC_RTFIL_SIGNAL_EN not #define'd in 'rkhcfg.h'"
892  #error " [MUST be RKH_ENABLED ] "
893  #error " [ || RKH_DISABLED] "
894 
895  #elif ((RKH_CFG_TRC_RTFIL_SIGNAL_EN != RKH_ENABLED) && \
896  (RKH_CFG_TRC_RTFIL_SIGNAL_EN != RKH_DISABLED))
897  #error "RKH_CFG_TRC_RTFIL_SIGNAL_EN illegally #define'd in 'rkhcfg.h'"
898  #error " [MUST be RKH_ENABLED ] "
899  #error " [ || RKH_DISABLED] "
900  #endif
901 
902  #ifndef RKH_CFG_TRC_USER_TRACE_EN
903  #error "RKH_CFG_TRC_USER_TRACE_EN not #define'd in 'rkhcfg.h'"
904  #error " [MUST be RKH_ENABLED ] "
905  #error " [ || RKH_DISABLED] "
906 
907  #elif ((RKH_CFG_TRC_USER_TRACE_EN != RKH_ENABLED) && \
908  (RKH_CFG_TRC_USER_TRACE_EN != RKH_DISABLED))
909  #error "RKH_CFG_TRC_USER_TRACE_EN illegally #define'd in 'rkhcfg.h'"
910  #error " [MUST be RKH_ENABLED ] "
911  #error " [ || RKH_DISABLED] "
912  #endif
913 
914  #ifndef RKH_CFG_TRC_ALL_EN
915  #error "RKH_CFG_TRC_ALL_EN not #define'd in 'rkhcfg.h'"
916  #error " [MUST be RKH_ENABLED ] "
917  #error " [ || RKH_DISABLED] "
918 
919  #elif ((RKH_CFG_TRC_ALL_EN != RKH_ENABLED) && \
920  (RKH_CFG_TRC_ALL_EN != RKH_DISABLED))
921  #error "RKH_CFG_TRC_ALL_EN illegally #define'd in 'rkhcfg.h'"
922  #error " [MUST be RKH_ENABLED ] "
923  #error " [ || RKH_DISABLED] "
924  #endif
925 
926  #ifndef RKH_CFG_TRC_MP_EN
927  #error "RKH_CFG_TRC_MP_EN not #define'd in 'rkhcfg.h'"
928  #error " [MUST be RKH_ENABLED ] "
929  #error " [ || RKH_DISABLED] "
930 
931  #elif ((RKH_CFG_TRC_MP_EN != RKH_ENABLED) && \
932  (RKH_CFG_TRC_MP_EN != RKH_DISABLED))
933  #error "RKH_CFG_TRC_MP_EN illegally #define'd in 'rkhcfg.h'"
934  #error " [MUST be RKH_ENABLED ] "
935  #error " [ || RKH_DISABLED] "
936  #endif
937 
938  #ifndef RKH_CFG_TRC_QUE_EN
939  #error "RKH_CFG_TRC_QUE_EN not #define'd in 'rkhcfg.h'"
940  #error " [MUST be RKH_ENABLED ] "
941  #error " [ || RKH_DISABLED] "
942 
943  #elif ((RKH_CFG_TRC_QUE_EN != RKH_ENABLED) && \
944  (RKH_CFG_TRC_QUE_EN != RKH_DISABLED))
945  #error "RKH_CFG_TRC_QUE_EN illegally #define'd in 'rkhcfg.h'"
946  #error " [MUST be RKH_ENABLED ] "
947  #error " [ || RKH_DISABLED] "
948  #endif
949 
950  #ifndef RKH_CFG_TRC_SMA_EN
951  #error "RKH_CFG_TRC_SMA_EN not #define'd in 'rkhcfg.h'"
952  #error " [MUST be RKH_ENABLED ] "
953  #error " [ || RKH_DISABLED] "
954 
955  #elif ((RKH_CFG_TRC_SMA_EN != RKH_ENABLED) && \
956  (RKH_CFG_TRC_SMA_EN != RKH_DISABLED))
957  #error "RKH_CFG_TRC_SMA_EN illegally #define'd in 'rkhcfg.h'"
958  #error " [MUST be RKH_ENABLED ] "
959  #error " [ || RKH_DISABLED] "
960  #endif
961 
962  #ifndef RKH_CFG_TRC_TMR_EN
963  #error "RKH_CFG_TRC_TMR_EN not #define'd in 'rkhcfg.h'"
964  #error " [MUST be RKH_ENABLED ] "
965  #error " [ || RKH_DISABLED] "
966 
967  #elif ((RKH_CFG_TRC_TMR_EN != RKH_ENABLED) && \
968  (RKH_CFG_TRC_TMR_EN != RKH_DISABLED))
969  #error "RKH_CFG_TRC_TMR_EN illegally #define'd in 'rkhcfg.h'"
970  #error " [MUST be RKH_ENABLED ] "
971  #error " [ || RKH_DISABLED] "
972  #endif
973 
974  #ifndef RKH_CFG_TRC_SM_EN
975  #error "RKH_CFG_TRC_SM_EN not #define'd in 'rkhcfg.h'"
976  #error " [MUST be RKH_ENABLED ] "
977  #error " [ || RKH_DISABLED] "
978 
979  #elif ((RKH_CFG_TRC_SM_EN != RKH_ENABLED) && \
980  (RKH_CFG_TRC_SM_EN != RKH_DISABLED))
981  #error "RKH_CFG_TRC_SM_EN illegally #define'd in 'rkhcfg.h'"
982  #error " [MUST be RKH_ENABLED ] "
983  #error " [ || RKH_DISABLED] "
984  #endif
985 
986  #ifndef RKH_CFG_TRC_FWK_EN
987  #error "RKH_CFG_TRC_FWK_EN not #define'd in 'rkhcfg.h'"
988  #error " [MUST be RKH_ENABLED ] "
989  #error " [ || RKH_DISABLED] "
990 
991  #elif ((RKH_CFG_TRC_FWK_EN != RKH_ENABLED) && \
992  (RKH_CFG_TRC_FWK_EN != RKH_DISABLED))
993  #error "RKH_CFG_TRC_FWK_EN illegally #define'd in 'rkhcfg.h'"
994  #error " [MUST be RKH_ENABLED ] "
995  #error " [ || RKH_DISABLED] "
996  #endif
997 
998  #ifndef RKH_CFG_TRC_ASSERT_EN
999  #error "RKH_CFG_TRC_ASSERT_EN not #define'd in 'rkhcfg.h'"
1000  #error " [MUST be RKH_ENABLED ] "
1001  #error " [ || RKH_DISABLED] "
1002 
1003  #elif ((RKH_CFG_TRC_ASSERT_EN != RKH_ENABLED) && \
1004  (RKH_CFG_TRC_ASSERT_EN != RKH_DISABLED))
1005  #error "RKH_CFG_TRC_ASSERT_EN illegally #define'd in 'rkhcfg.h'"
1006  #error " [MUST be RKH_ENABLED ] "
1007  #error " [ || RKH_DISABLED] "
1008  #endif
1009 
1010  #ifndef RKH_CFG_TRC_SM_INIT_EN
1011  #error "RKH_CFG_TRC_SM_INIT_EN not #define'd in 'rkhcfg.h'"
1012  #error " [MUST be RKH_ENABLED ] "
1013  #error " [ || RKH_DISABLED] "
1014 
1015  #elif ((RKH_CFG_TRC_SM_INIT_EN != RKH_ENABLED) && \
1016  (RKH_CFG_TRC_SM_INIT_EN != RKH_DISABLED))
1017  #error "RKH_CFG_TRC_SM_INIT_EN illegally #define'd in 'rkhcfg.h'"
1018  #error " [MUST be RKH_ENABLED ] "
1019  #error " [ || RKH_DISABLED] "
1020  #endif
1021 
1022  #ifndef RKH_CFG_TRC_SM_DCH_EN
1023  #error "RKH_CFG_TRC_SM_DCH_EN not #define'd in 'rkhcfg.h'"
1024  #error " [MUST be RKH_ENABLED ] "
1025  #error " [ || RKH_DISABLED] "
1026 
1027  #elif ((RKH_CFG_TRC_SM_DCH_EN != RKH_ENABLED) && \
1028  (RKH_CFG_TRC_SM_DCH_EN != RKH_DISABLED))
1029  #error "RKH_CFG_TRC_SM_DCH_EN illegally #define'd in 'rkhcfg.h'"
1030  #error " [MUST be RKH_ENABLED ] "
1031  #error " [ || RKH_DISABLED] "
1032  #endif
1033 
1034  #ifndef RKH_CFG_TRC_SM_CLRH_EN
1035  #error "RKH_CFG_TRC_SM_CLRH_EN not #define'd in 'rkhcfg.h'"
1036  #error " [MUST be RKH_ENABLED ] "
1037  #error " [ || RKH_DISABLED] "
1038 
1039  #elif ((RKH_CFG_TRC_SM_CLRH_EN != RKH_ENABLED) && \
1040  (RKH_CFG_TRC_SM_CLRH_EN != RKH_DISABLED))
1041  #error "RKH_CFG_TRC_SM_CLRH_EN illegally #define'd in 'rkhcfg.h'"
1042  #error " [MUST be RKH_ENABLED ] "
1043  #error " [ || RKH_DISABLED] "
1044  #endif
1045 
1046  #ifndef RKH_CFG_TRC_SM_TRN_EN
1047  #error "RKH_CFG_TRC_SM_TRN_EN not #define'd in 'rkhcfg.h'"
1048  #error " [MUST be RKH_ENABLED ] "
1049  #error " [ || RKH_DISABLED] "
1050 
1051  #elif ((RKH_CFG_TRC_SM_TRN_EN != RKH_ENABLED) && \
1052  (RKH_CFG_TRC_SM_TRN_EN != RKH_DISABLED))
1053  #error "RKH_CFG_TRC_SM_TRN_EN illegally #define'd in 'rkhcfg.h'"
1054  #error " [MUST be RKH_ENABLED ] "
1055  #error " [ || RKH_DISABLED] "
1056  #endif
1057 
1058  #ifndef RKH_CFG_TRC_SM_STATE_EN
1059  #error "RKH_CFG_TRC_SM_STATE_EN not #define'd in 'rkhcfg.h'"
1060  #error " [MUST be RKH_ENABLED ] "
1061  #error " [ || RKH_DISABLED] "
1062 
1063  #elif ((RKH_CFG_TRC_SM_STATE_EN != RKH_ENABLED) && \
1064  (RKH_CFG_TRC_SM_STATE_EN != RKH_DISABLED))
1065  #error "RKH_CFG_TRC_SM_STATE_EN illegally #define'd in 'rkhcfg.h'"
1066  #error " [MUST be RKH_ENABLED ] "
1067  #error " [ || RKH_DISABLED] "
1068  #endif
1069 
1070  #ifndef RKH_CFG_TRC_SM_ENSTATE_EN
1071  #error "RKH_CFG_TRC_SM_ENSTATE_EN not #define'd in 'rkhcfg.h'"
1072  #error " [MUST be RKH_ENABLED ] "
1073  #error " [ || RKH_DISABLED] "
1074 
1075  #elif ((RKH_CFG_TRC_SM_ENSTATE_EN != RKH_ENABLED) && \
1076  (RKH_CFG_TRC_SM_ENSTATE_EN != RKH_DISABLED))
1077  #error "RKH_CFG_TRC_SM_ENSTATE_EN illegally #define'd in 'rkhcfg.h'"
1078  #error " [MUST be RKH_ENABLED ] "
1079  #error " [ || RKH_DISABLED] "
1080  #endif
1081 
1082  #ifndef RKH_CFG_TRC_SM_EXSTATE_EN
1083  #error "RKH_CFG_TRC_SM_EXSTATE_EN not #define'd in 'rkhcfg.h'"
1084  #error " [MUST be RKH_ENABLED ] "
1085  #error " [ || RKH_DISABLED] "
1086 
1087  #elif ((RKH_CFG_TRC_SM_EXSTATE_EN != RKH_ENABLED) && \
1088  (RKH_CFG_TRC_SM_EXSTATE_EN != RKH_DISABLED))
1089  #error "RKH_CFG_TRC_SM_EXSTATE_EN illegally #define'd in 'rkhcfg.h'"
1090  #error " [MUST be RKH_ENABLED ] "
1091  #error " [ || RKH_DISABLED] "
1092  #endif
1093 
1094  #ifndef RKH_CFG_TRC_SM_NENEX_EN
1095  #error "RKH_CFG_TRC_SM_NENEX_EN not #define'd in 'rkhcfg.h'"
1096  #error " [MUST be RKH_ENABLED ] "
1097  #error " [ || RKH_DISABLED] "
1098 
1099  #elif ((RKH_CFG_TRC_SM_NENEX_EN != RKH_ENABLED) && \
1100  (RKH_CFG_TRC_SM_NENEX_EN != RKH_DISABLED))
1101  #error "RKH_CFG_TRC_SM_NENEX_EN illegally #define'd in 'rkhcfg.h'"
1102  #error " [MUST be RKH_ENABLED ] "
1103  #error " [ || RKH_DISABLED] "
1104  #endif
1105 
1106  #ifndef RKH_CFG_TRC_SM_NTRNACT_EN
1107  #error "RKH_CFG_TRC_SM_NTRNACT_EN not #define'd in 'rkhcfg.h'"
1108  #error " [MUST be RKH_ENABLED ] "
1109  #error " [ || RKH_DISABLED] "
1110 
1111  #elif ((RKH_CFG_TRC_SM_NTRNACT_EN != RKH_ENABLED) && \
1112  (RKH_CFG_TRC_SM_NTRNACT_EN != RKH_DISABLED))
1113  #error "RKH_CFG_TRC_SM_NTRNACT_EN illegally #define'd in 'rkhcfg.h'"
1114  #error " [MUST be RKH_ENABLED ] "
1115  #error " [ || RKH_DISABLED] "
1116  #endif
1117 
1118  #ifndef RKH_CFG_TRC_SM_TS_STATE_EN
1119  #error "RKH_CFG_TRC_SM_TS_STATE_EN not #define'd in 'rkhcfg.h'"
1120  #error " [MUST be RKH_ENABLED ] "
1121  #error " [ || RKH_DISABLED] "
1122 
1123  #elif ((RKH_CFG_TRC_SM_TS_STATE_EN != RKH_ENABLED) && \
1124  (RKH_CFG_TRC_SM_TS_STATE_EN != RKH_DISABLED))
1125  #error "RKH_CFG_TRC_SM_TS_STATE_EN illegally #define'd in 'rkhcfg.h'"
1126  #error " [MUST be RKH_ENABLED ] "
1127  #error " [ || RKH_DISABLED] "
1128  #endif
1129 
1130  #ifndef RKH_CFG_TRC_SM_PROCESS_EN
1131  #error "RKH_CFG_TRC_SM_PROCESS_EN not #define'd in 'rkhcfg.h'"
1132  #error " [MUST be RKH_ENABLED ] "
1133  #error " [ || RKH_DISABLED] "
1134 
1135  #elif ((RKH_CFG_TRC_SM_PROCESS_EN != RKH_ENABLED) && \
1136  (RKH_CFG_TRC_SM_PROCESS_EN != RKH_DISABLED))
1137  #error "RKH_CFG_TRC_SM_PROCESS_EN illegally #define'd in 'rkhcfg.h'"
1138  #error " [MUST be RKH_ENABLED ] "
1139  #error " [ || RKH_DISABLED] "
1140  #endif
1141 
1142  #ifndef RKH_CFG_TRC_SM_EXE_ACT_EN
1143  #error "RKH_CFG_TRC_SM_EXE_ACT_EN not #define'd in 'rkhcfg.h'"
1144  #error " [MUST be RKH_ENABLED ] "
1145  #error " [ || RKH_DISABLED] "
1146 
1147  #elif ((RKH_CFG_TRC_SM_EXE_ACT_EN != RKH_ENABLED) && \
1148  (RKH_CFG_TRC_SM_EXE_ACT_EN != RKH_DISABLED))
1149  #error "RKH_CFG_TRC_SM_EXE_ACT_EN illegally #define'd in 'rkhcfg.h'"
1150  #error " [MUST be RKH_ENABLED ] "
1151  #error " [ || RKH_DISABLED] "
1152  #endif
1153 
1154  #ifndef RKH_CFG_TRC_NSEQ_EN
1155  #error "RKH_CFG_TRC_NSEQ_EN not #define'd in 'rkhcfg.h'"
1156  #error " [MUST be RKH_ENABLED ] "
1157  #error " [ || RKH_DISABLED] "
1158 
1159  #elif ((RKH_CFG_TRC_NSEQ_EN != RKH_ENABLED) && \
1160  (RKH_CFG_TRC_NSEQ_EN != RKH_DISABLED))
1161  #error "RKH_CFG_TRC_NSEQ_EN illegally #define'd in 'rkhcfg.h'"
1162  #error " [MUST be RKH_ENABLED ] "
1163  #error " [ || RKH_DISABLED] "
1164  #endif
1165 
1166  #ifndef RKH_CFG_TRC_CHK_EN
1167  #error "RKH_CFG_TRC_CHK_EN not #define'd in 'rkhcfg.h'"
1168  #error " [MUST be RKH_ENABLED ] "
1169  #error " [ || RKH_DISABLED] "
1170 
1171  #elif ((RKH_CFG_TRC_CHK_EN != RKH_ENABLED) && \
1172  (RKH_CFG_TRC_CHK_EN != RKH_DISABLED))
1173  #error "RKH_CFG_TRC_CHK_EN illegally #define'd in 'rkhcfg.h'"
1174  #error " MUST be RKH_ENABLED ] "
1175  #error " || RKH_DISABLED] "
1176  #endif
1177 
1178  #ifndef RKH_CFG_TRC_TSTAMP_EN
1179  #error "RKH_CFG_TRC_TSTAMP_EN not #define'd in 'rkhcfg.h'"
1180  #error " MUST be RKH_ENABLED ] "
1181  #error " [ || RKH_DISABLED] "
1182 
1183  #elif ((RKH_CFG_TRC_TSTAMP_EN != RKH_ENABLED) && \
1184  (RKH_CFG_TRC_TSTAMP_EN != RKH_DISABLED))
1185  #error "RKH_CFG_TRC_TSTAMP_EN illegally #define'd in 'rkhcfg.h'"
1186  #error " [MUST be RKH_ENABLED ] "
1187  #error " [ || RKH_DISABLED] "
1188  #endif
1189 
1190  #ifndef RKH_CFGPORT_TRC_SIZEOF_TSTAMP
1191  #error "RKH_CFGPORT_TRC_SIZEOF_TSTAMP not #define'd in 'rkhcfg.h'"
1192  #error " [MUST be 8 ( 8-bit size)] "
1193  #error " [ || 16 (16-bit size)] "
1194  #error " [ || 32 (32-bit size)] "
1195 
1196  #elif ((RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 8) && \
1197  (RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 16) && \
1198  (RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 32))
1199  #error "RKH_CFGPORT_TRC_SIZEOF_TSTAMP illegally #define'd in 'rkhcfg.h'"
1200  #error " [MUST be 8 ( 8-bit size)] "
1201  #error " [ || 16 (16-bit size)] "
1202  #error " [ || 32 (32-bit size)] "
1203  #endif
1204 
1205  #ifndef RKH_CFGPORT_SMA_QSTO_EN
1206  #error "RKH_CFGPORT_SMA_QSTO_EN not #define'd in 'rkhcfg.h'"
1207  #error " [MUST be RKH_ENABLED ] "
1208  #error " [ || RKH_DISABLED] "
1209 
1210  #elif ((RKH_CFGPORT_SMA_QSTO_EN != RKH_ENABLED) && \
1211  (RKH_CFGPORT_SMA_QSTO_EN != RKH_DISABLED))
1212  #error "RKH_CFGPORT_SMA_QSTO_EN illegally #define'd in 'rkhcfg.h'"
1213  #error " [MUST be RKH_ENABLED ] "
1214  #error " [ || RKH_DISABLED] "
1215  #endif
1216 
1217  #ifndef RKH_CFGPORT_SMA_STK_EN
1218  #error "RKH_CFGPORT_SMA_STK_EN not #define'd in 'rkhcfg.h'"
1219  #error " [MUST be RKH_ENABLED ] "
1220  #error " [ || RKH_DISABLED] "
1221 
1222  #elif ((RKH_CFGPORT_SMA_STK_EN != RKH_ENABLED) && \
1223  (RKH_CFGPORT_SMA_STK_EN != RKH_DISABLED))
1224  #error "RKH_CFGPORT_SMA_STK_EN illegally #define'd in 'rkhcfg.h'"
1225  #error " [MUST be RKH_ENABLED ] "
1226  #error " [ || RKH_DISABLED] "
1227  #endif
1228 
1229  #ifndef RKH_CFG_TRC_SIZEOF_STREAM
1230  #error "RKH_CFG_TRC_SIZEOF_STREAM not #define'd in 'rkhcfg.h'"
1231  #error " [MUST be > 0] "
1232  #error " [ && <= 2048] "
1233 
1234  #elif ((RKH_CFG_TRC_SIZEOF_STREAM == 0) || \
1235  (RKH_CFG_TRC_SIZEOF_STREAM > 2048))
1236  #error "RKH_CFG_TRC_SIZEOF_STREAM illegally #define'd in 'rkhcfg.h'"
1237  #error " [MUST be > 0] "
1238  #error " [ && <= 2048] "
1239  #endif
1240 
1241 #endif
1242 
1243 /* FRAMEWORK --------------------------------------------------------- */
1244 #ifndef RKH_CFG_FWK_MAX_SMA
1245  #error "RKH_CFG_FWK_MAX_SMA not #define'd in 'rkhcfg.h'"
1246  #error " [MUST be >= 1] "
1247  #error " [ && <= 64] "
1248 
1249 #elif ((RKH_CFG_FWK_MAX_SMA == 0) || (RKH_CFG_FWK_MAX_SMA > 64))
1250  #error "RKH_CFG_FWK_MAX_SMA illegally #define'd in 'rkhcfg.h'"
1251  #error " [MUST be >= 1] "
1252  #error " [ && <= 64] "
1253 
1254 #endif
1255 
1256 #ifndef RKH_CFG_FWK_DYN_EVT_EN
1257  #error "RKH_CFG_FWK_DYN_EVT_EN not #define'd in 'rkhcfg.h'"
1258  #error " [MUST be RKH_ENABLED ] "
1259  #error " [ || RKH_DISABLED] "
1260 
1261 #elif (RKH_CFG_FWK_DYN_EVT_EN == RKH_DISABLED)
1262 
1263  /*
1264  * If the dynamic event support is disabled, RKH not allows to use
1265  * events with parameters, defer/recall mechanism, allocating and
1266  * recycling dynamic events, among other features.
1267  */
1268  #undef RKH_CFGPORT_NATIVE_DYN_EVT_EN
1269  #define RKH_CFGPORT_NATIVE_DYN_EVT_EN RKH_DISABLED
1270 
1271 #endif
1272 
1273 #ifndef RKH_CFG_FWK_MAX_EVT_POOL
1274  #error "RKH_CFG_FWK_MAX_EVT_POOL not #define'd in 'rkhcfg.h'"
1275  #error " [MUST be > 0] "
1276  #error " [ && < 256] "
1277 
1278 #elif (RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED)
1279  #if ((RKH_CFG_FWK_MAX_EVT_POOL == 0) || (RKH_CFG_FWK_MAX_EVT_POOL > 255))
1280  #error "RKH_CFG_FWK_MAX_EVT_POOL illegally #define'd in 'rkhcfg.h'"
1281  #error " [MUST be > 0] "
1282  #error " [ && < 256] "
1283  #endif
1284 
1285 #endif
1286 
1287 #ifndef RKH_CFG_FWK_SIZEOF_EVT
1288  #error "RKH_CFG_FWK_SIZEOF_EVT not #define'd in 'rkhcfg.h'"
1289  #error " [MUST be 8 ( 8-bit size)] "
1290  #error " [ || 16 (16-bit size)] "
1291  #error " [ || 32 (32-bit size)] "
1292 
1293 #elif ((RKH_CFG_FWK_SIZEOF_EVT != 8) && \
1294  (RKH_CFG_FWK_SIZEOF_EVT != 16) && \
1295  (RKH_CFG_FWK_SIZEOF_EVT != 32))
1296  #error "RKH_CFG_FWK_SIZEOF_EVT illegally #define'd in 'rkhcfg.h'"
1297  #error " [MUST be 8 ( 8-bit size)] "
1298  #error " [ || 16 (16-bit size)] "
1299  #error " [ || 32 (32-bit size)] "
1300 
1301 #endif
1302 
1303 #ifndef RKH_CFG_FWK_MAX_SIGNALS
1304  #error "RKH_CFG_FWK_MAX_SIGNALS not #define'd in 'rkhcfg.h'"
1305  #error " [MUST be > 0] "
1306  #error " [MUST be < 2^RKH_CFG_FWK_SIZEOF_EVT "
1307 
1308 #elif ((RKH_CFG_FWK_MAX_SIGNALS == 0u) || \
1309  (RKH_CFG_FWK_MAX_SIGNALS > (1u << RKH_CFG_FWK_SIZEOF_EVT)))
1310  #error "RKH_CFG_FWK_MAX_SIGNALS illegally #define'd in 'rkhcfg.h'"
1311  #error " [MUST be > 0] "
1312  #error " [MUST be < 2^RKH_CFG_FWK_SIZEOF_EVT "
1313 
1314 #endif
1315 
1316 #ifndef RKH_CFG_FWK_SIZEOF_EVT_SIZE
1317  #error "RKH_CFG_FWK_SIZEOF_EVT_SIZE not #define'd in 'rkhcfg.h'"
1318  #error " [MUST be 8 ( 8-bit size)] "
1319  #error " [ || 16 (16-bit size)] "
1320  #error " [ || 32 (32-bit size)] "
1321 
1322 #elif ((RKH_CFG_FWK_SIZEOF_EVT_SIZE != 8) && \
1323  (RKH_CFG_FWK_SIZEOF_EVT_SIZE != 16) && \
1324  (RKH_CFG_FWK_SIZEOF_EVT_SIZE != 32))
1325  #error "RKH_CFG_FWK_SIZEOF_EVT_SIZE illegally #define'd in 'rkhcfg.h'"
1326  #error " [MUST be 8 ( 8-bit size)] "
1327  #error " [ || 16 (16-bit size)] "
1328  #error " [ || 32 (32-bit size)] "
1329 
1330 #endif
1331 
1332 #ifndef RKH_CFG_FWK_DEFER_EVT_EN
1333  #error "RKH_CFG_FWK_DEFER_EVT_EN not #define'd in 'rkhcfg.h'"
1334  #error " [MUST be RKH_ENABLED ] "
1335  #error " [ || RKH_DISABLED] "
1336 
1337 #elif ((RKH_CFG_FWK_DEFER_EVT_EN == RKH_ENABLED) && \
1338  (RKH_CFG_QUE_EN == RKH_DISABLED))
1339  #error "RKH_CFG_QUE_EN illegally #define'd in 'rkhcfg.h'"
1340  #error " [MUST be RKH_ENABLED ] "
1341 
1342 #endif
1343 
1344 #ifndef RKH_CFG_FWK_ASSERT_EN
1345  #error "RKH_CFG_FWK_ASSERT_EN not #define'd in 'rkhport.h'"
1346  #error " [MUST be RKH_ENABLED ] "
1347  #error " [ || RKH_DISABLED] "
1348 
1349 #elif ((RKH_CFG_FWK_ASSERT_EN != RKH_ENABLED) && \
1350  (RKH_CFG_FWK_ASSERT_EN != RKH_DISABLED))
1351  #error "RKH_CFG_FWK_ASSERT_EN illegally #define'd in 'rkhport.h'"
1352  #error " [MUST be RKH_ENABLED ] "
1353  #error " [ || RKH_DISABLED] "
1354 
1355 #endif
1356 
1357 #ifndef RKH_CFG_HOOK_DISPATCH_EN
1358  #error "RKH_CFG_HOOK_DISPATCH_EN not #define'd in 'rkhcfg.h'"
1359  #error " [MUST be RKH_ENABLED ] "
1360  #error " [ || RKH_DISABLED] "
1361 
1362 #elif ((RKH_CFG_HOOK_DISPATCH_EN != RKH_ENABLED) && \
1363  (RKH_CFG_HOOK_DISPATCH_EN != RKH_DISABLED))
1364  #error "RKH_CFG_HOOK_DISPATCH_EN illegally #define'd in 'rkhcfg.h'"
1365  #error " [MUST be RKH_ENABLED ] "
1366  #error " [ || RKH_DISABLED] "
1367 
1368 #endif
1369 
1370 #ifndef RKH_CFG_HOOK_SIGNAL_EN
1371  #error "RKH_CFG_HOOK_SIGNAL_EN not #define'd in 'rkhcfg.h'"
1372  #error " [MUST be RKH_ENABLED ] "
1373  #error " [ || RKH_DISABLED] "
1374 
1375 #elif ((RKH_CFG_HOOK_SIGNAL_EN != RKH_ENABLED) && \
1376  (RKH_CFG_HOOK_SIGNAL_EN != RKH_DISABLED))
1377  #error "RKH_CFG_HOOK_SIGNAL_EN illegally #define'd in 'rkhcfg.h'"
1378  #error " [MUST be RKH_ENABLED ] "
1379  #error " [ || RKH_DISABLED] "
1380 
1381 #endif
1382 
1383 #ifndef RKH_CFG_HOOK_TIMEOUT_EN
1384  #error "RKH_CFG_HOOK_TIMEOUT_EN not #define'd in 'rkhcfg.h'"
1385  #error " [MUST be RKH_ENABLED ] "
1386  #error " [ || RKH_DISABLED] "
1387 
1388 #elif ((RKH_CFG_HOOK_TIMEOUT_EN != RKH_ENABLED) && \
1389  (RKH_CFG_HOOK_TIMEOUT_EN != RKH_DISABLED))
1390  #error "RKH_CFG_HOOK_TIMEOUT_EN illegally #define'd in 'rkhcfg.h'"
1391  #error " [MUST be RKH_ENABLED ] "
1392  #error " [ || RKH_DISABLED] "
1393 
1394 #endif
1395 
1396 #ifndef RKH_CFG_HOOK_START_EN
1397  #error "RKH_CFG_HOOK_START_EN not #define'd in 'rkhcfg.h'"
1398  #error " [MUST be RKH_ENABLED ] "
1399  #error " [ || RKH_DISABLED] "
1400 
1401 #elif ((RKH_CFG_HOOK_START_EN != RKH_ENABLED) && \
1402  (RKH_CFG_HOOK_START_EN != RKH_DISABLED))
1403  #error "RKH_CFG_HOOK_START_EN illegally #define'd in 'rkhcfg.h'"
1404  #error " [MUST be RKH_ENABLED ] "
1405  #error " [ || RKH_DISABLED] "
1406 
1407 #endif
1408 
1409 #ifndef RKH_CFG_HOOK_EXIT_EN
1410  #error "RKH_CFG_HOOK_EXIT_EN not #define'd in 'rkhcfg.h'"
1411  #error " [MUST be RKH_ENABLED ] "
1412  #error " [ || RKH_DISABLED] "
1413 
1414 #elif ((RKH_CFG_HOOK_EXIT_EN != RKH_ENABLED) && \
1415  (RKH_CFG_HOOK_EXIT_EN != RKH_DISABLED))
1416  #error "RKH_CFG_HOOK_EXIT_EN illegally #define'd in 'rkhcfg.h'"
1417  #error " [MUST be RKH_ENABLED ] "
1418  #error " [ || RKH_DISABLED] "
1419 
1420 #endif
1421 
1422 #ifndef RKH_CFG_HOOK_TIMETICK_EN
1423  #error "RKH_CFG_HOOK_TIMETICK_EN not #define'd in 'rkhcfg.h'"
1424  #error " [MUST be RKH_ENABLED ] "
1425  #error " [ || RKH_DISABLED] "
1426 
1427 #elif ((RKH_CFG_HOOK_TIMETICK_EN != RKH_ENABLED) && \
1428  (RKH_CFG_HOOK_TIMETICK_EN != RKH_DISABLED))
1429  #error "RKH_CFG_HOOK_TIMETICK_EN illegally #define'd in 'rkhcfg.h'"
1430  #error " [MUST be RKH_ENABLED ] "
1431  #error " [ || RKH_DISABLED] "
1432 
1433 #endif
1434 
1435 #ifndef RKH_CFG_HOOK_PUT_TRCEVT_EN
1436  #error "RKH_CFG_HOOK_PUT_TRCEVT_EN not #define'd in 'rkhcfg.h'"
1437  #error " [MUST be RKH_ENABLED ] "
1438  #error " [ || RKH_DISABLED] "
1439 
1440 #elif ((RKH_CFG_HOOK_PUT_TRCEVT_EN != RKH_ENABLED) && \
1441  (RKH_CFG_HOOK_PUT_TRCEVT_EN != RKH_DISABLED))
1442  #error "RKH_CFG_HOOK_PUT_TRCEVT_EN illegally #define'd in 'rkhcfg.h'"
1443  #error " [MUST be RKH_ENABLED ] "
1444  #error " [ || RKH_DISABLED] "
1445 
1446 #endif
1447 
1448 #ifndef RKH_CFG_SMA_INIT_EVT_EN
1449  #error "RKH_CFG_SMA_INIT_EVT_EN not #define'd in 'rkhcfg.h'"
1450  #error " [MUST be RKH_ENABLED ] "
1451  #error " [ || RKH_DISABLED] "
1452 
1453 #elif ((RKH_CFG_SMA_INIT_EVT_EN != RKH_ENABLED) && \
1454  (RKH_CFG_SMA_INIT_EVT_EN != RKH_DISABLED))
1455  #error "RKH_CFG_SMA_INIT_EVT_EN illegally #define'd in 'rkhcfg.h'"
1456  #error " [MUST be RKH_ENABLED ] "
1457  #error " [ || RKH_DISABLED] "
1458 
1459 #endif
1460 
1461 #ifdef RKH_CFG_FWK_AWARE_ISR_PRIO
1462 #if ((RKH_CFG_FWK_AWARE_ISR_PRIO < 0) || \
1463  (RKH_CFG_FWK_AWARE_ISR_PRIO > 255))
1464  #error "RKH_CFG_FWK_AWARE_ISR_PRIO illegally #define'd in 'rkhcfg.h'"
1465  #error " [MUST be >= 0] "
1466  #error " [ && <= 255] "
1467 #endif
1468 #endif
1469 
1470 /* PORT --------------------------------------------------------- */
1471 #ifndef RKH_CFGPORT_SMA_THREAD_EN
1472  #error "RKH_CFGPORT_SMA_THREAD_EN not #define'd in 'rkhport.h'"
1473  #error " [MUST be RKH_ENABLED ] "
1474  #error " [ || RKH_DISABLED] "
1475 
1476 #elif ((RKH_CFGPORT_SMA_THREAD_EN != RKH_ENABLED) && \
1477  (RKH_CFGPORT_SMA_THREAD_EN != RKH_DISABLED))
1478  #error "RKH_CFGPORT_SMA_THREAD_EN illegally #define'd in 'rkhport.h'"
1479  #error " [MUST be RKH_ENABLED ] "
1480  #error " [ || RKH_DISABLED] "
1481 
1482 #endif
1483 
1484 #ifndef RKH_CFGPORT_SMA_THREAD_DATA_EN
1485  #error "RKH_CFGPORT_SMA_THREAD_DATA_EN not #define'd in 'rkhport.h'"
1486  #error " [MUST be RKH_ENABLED ] "
1487  #error " [ || RKH_DISABLED] "
1488 
1489 #elif ((RKH_CFGPORT_SMA_THREAD_DATA_EN != RKH_ENABLED) && \
1490  (RKH_CFGPORT_SMA_THREAD_DATA_EN != RKH_DISABLED))
1491  #error "RKH_CFGPORT_SMA_THREAD_DATA_EN illegally #define'd in 'rkhport.h'"
1492  #error " [MUST be RKH_ENABLED ] "
1493  #error " [ || RKH_DISABLED] "
1494 
1495 #endif
1496 
1497 #ifndef RKH_CFGPORT_NATIVE_SCHEDULER_EN
1498  #error "RKH_CFGPORT_NATIVE_SCHEDULER_EN not #define'd in 'rkhport.h'"
1499  #error " [MUST be RKH_ENABLED ] "
1500  #error " [ || RKH_DISABLED] "
1501 
1502 #elif ((RKH_CFGPORT_NATIVE_SCHEDULER_EN != RKH_ENABLED) && \
1503  (RKH_CFGPORT_NATIVE_SCHEDULER_EN != RKH_DISABLED))
1504  #error "RKH_CFGPORT_NATIVE_SCHEDULER_EN illegally #define'd in 'rkhport.h'"
1505  #error " [MUST be RKH_ENABLED ] "
1506  #error " [ || RKH_DISABLED] "
1507 
1508 #endif
1509 
1510 #ifndef RKH_CFGPORT_NATIVE_EQUEUE_EN
1511  #error "RKH_CFGPORT_NATIVE_EQUEUE_EN not #define'd in 'rkhport.h'"
1512  #error " [MUST be RKH_ENABLED ] "
1513  #error " [ || RKH_DISABLED] "
1514 
1515 #elif ((RKH_CFGPORT_NATIVE_EQUEUE_EN != RKH_ENABLED) && \
1516  (RKH_CFGPORT_NATIVE_EQUEUE_EN != RKH_DISABLED))
1517  #error "RKH_CFGPORT_NATIVE_EQUEUE_EN illegally #define'd in 'rkhport.h'"
1518  #error " [MUST be RKH_ENABLED ] "
1519  #error " [ || RKH_DISABLED] "
1520 
1521 #elif ((RKH_CFGPORT_NATIVE_EQUEUE_EN == RKH_ENABLED) && \
1522  (RKH_CFG_QUE_EN != RKH_ENABLED))
1523  #error "RKH_CFG_QUE_EN illegally #define'd in 'rkhcfg.h'"
1524  #error " [MUST be RKH_ENABLED ] "
1525  #error " [ || RKH_DISABLED] "
1526 
1527 #endif
1528 
1529 #ifndef RKH_CFGPORT_NATIVE_DYN_EVT_EN
1530  #error "RKH_CFGPORT_NATIVE_DYN_EVT_EN not #define'd in 'rkhport.h'"
1531  #error " [MUST be RKH_ENABLED ] "
1532  #error " [ || RKH_DISABLED] "
1533 
1534 #elif ((RKH_CFGPORT_NATIVE_DYN_EVT_EN != RKH_ENABLED) && \
1535  (RKH_CFGPORT_NATIVE_DYN_EVT_EN != RKH_DISABLED))
1536  #error "RKH_CFGPORT_NATIVE_DYN_EVT_EN illegally #define'd in 'rkhport.h'"
1537  #error " [MUST be RKH_ENABLED ] "
1538  #error " [ || RKH_DISABLED] "
1539 
1540 #elif (RKH_CFGPORT_NATIVE_DYN_EVT_EN == RKH_ENABLED)
1541  #if ((RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED) && \
1542  (RKH_CFG_MP_EN == RKH_DISABLED))
1543  #error "RKH_CFG_FWK_DYN_EVT_EN illegally #define'd in 'rkhcfg.h'"
1544  #error " [MUST be RKH_ENABLED ] "
1545  #error "RKH_CFG_MP_EN illegally #define'd in 'rkhcfg.h'"
1546  #error " [MUST be RKH_ENABLED ] "
1547  #endif
1548 
1549 #endif
1550 
1551 #ifndef RKH_CFGPORT_REENTRANT_EN
1552  #error "RKH_CFGPORT_REENTRANT_EN not #define'd in 'rkhport.h'"
1553  #error " [MUST be RKH_ENABLED ] "
1554  #error " [ || RKH_DISABLED] "
1555 
1556 #elif ((RKH_CFGPORT_REENTRANT_EN != RKH_ENABLED) && \
1557  (RKH_CFGPORT_REENTRANT_EN != RKH_DISABLED))
1558  #error "RKH_CFGPORT_REENTRANT_EN illegally #define'd in 'rkhport.h'"
1559  #error " [MUST be RKH_ENABLED ] "
1560  #error " [ || RKH_DISABLED] "
1561 
1562 #endif
1563 
1564 #ifndef RKH_CFGPORT_TRC_SIZEOF_PTR
1565  #error "RKH_CFGPORT_TRC_SIZEOF_PTR not #define'd in 'rkhport.h'"
1566  #error " [MUST be 8 ( 8-bit pointer)] "
1567  #error " [ || 16 (16-bit pointer)] "
1568  #error " [ || 32 (32-bit pointer)] "
1569 
1570 #elif ((RKH_CFGPORT_TRC_SIZEOF_PTR != 8) && \
1571  (RKH_CFGPORT_TRC_SIZEOF_PTR != 16) && \
1572  (RKH_CFGPORT_TRC_SIZEOF_PTR != 32))
1573  #error "RKH_CFGPORT_TRC_SIZEOF_PTR illegally #define'd in 'rkhport.h'"
1574  #error " [MUST be 8 ( 8-bit pointer)] "
1575  #error " [ || 16 (16-bit pointer)] "
1576  #error " [ || 32 (32-bit pointer)] "
1577 
1578 #endif
1579 
1580 #ifndef RKH_CFGPORT_TRC_SIZEOF_FUN_PTR
1581  #error "RKH_CFGPORT_TRC_SIZEOF_FUN_PTR not #define'd in 'rkhport.h'"
1582  #error " [MUST be 8 ( 8-bit pointer)] "
1583  #error " [ || 16 (16-bit pointer)] "
1584  #error " [ || 32 (32-bit pointer)] "
1585 
1586 #elif ((RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 8) && \
1587  (RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 16) && \
1588  (RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 32))
1589  #error "RKH_CFGPORT_TRC_SIZEOF_FUN_PTR illegally #define'd in 'rkhport.h'"
1590  #error " [MUST be 8 ( 8-bit pointer)] "
1591  #error " [ || 16 (16-bit pointer)] "
1592  #error " [ || 32 (32-bit pointer)] "
1593 
1594 #endif
1595 
1606 #define RKH_TICK_RATE_MS \
1607  ((RKH_TNT_T)(1000 / RKH_CFG_FWK_TICK_RATE_HZ))
1608 
1618 #define RKH_TIME_MS(ms_) ((ms_) / RKH_TICK_RATE_MS)
1619 #define RKH_TIME_SEC(s_) ((s_) * 1000u / RKH_TICK_RATE_MS)
1620 #define RKH_TIME_MIN(m_) ((m_) * 60 * 1000u / RKH_TICK_RATE_MS)
1623 /*
1624  * The following macros and constants are INTERNAL to RKH and
1625  * the user application should NOT call it.
1626  */
1627 
1628 #define RKH_REGULAR 0x80
1629 #define RKH_PSEUDO 0
1630 #define RKH_TYPE(t,i) (t | i)
1631 
1632 #define RKH_UNKNOWN_VERTEX RKH_TYPE(0, 0)
1633 #define RKH_BASIC RKH_TYPE(RKH_REGULAR, 0)
1634 #define RKH_COMPOSITE RKH_TYPE(RKH_REGULAR, 0x01)
1635 #define RKH_SUBMACHINE RKH_TYPE(RKH_REGULAR, 0x02)
1636 #define RKH_REF_SUBMACHINE RKH_TYPE(RKH_REGULAR, 0x04)
1637 #define RKH_FINAL RKH_TYPE(RKH_REGULAR, 0x08)
1638 
1639 #define RKH_CONDITIONAL RKH_TYPE(RKH_PSEUDO, 0x02)
1640 #define RKH_CHOICE RKH_TYPE(RKH_PSEUDO, 0x04)
1641 #define RKH_SHISTORY RKH_TYPE(RKH_PSEUDO, 0x08)
1642 #define RKH_DHISTORY RKH_TYPE(RKH_PSEUDO, 0x10)
1643 #define RKH_ENPOINT RKH_TYPE(RKH_PSEUDO, 0x20)
1644 #define RKH_EXPOINT RKH_TYPE(RKH_PSEUDO, 0x40)
1645 
1646 #define RKH_NO_HISTORY RKH_UNKNOWN_VERTEX
1647 
1648 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_DISABLED || \
1649  (RKH_CFG_SMA_DEEP_HIST_EN == RKH_DISABLED && \
1650  RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_DISABLED && \
1651  RKH_CFG_SMA_SUBMACHINE_EN == RKH_DISABLED && \
1652  RKH_CFG_SMA_CONDITIONAL_EN == RKH_DISABLED && \
1653  RKH_CFG_SMA_CHOICE_EN == RKH_DISABLED))
1654  #define RKH_PSEUDOSTATE RKH_DISABLED
1655 #else
1656  #define RKH_PSEUDOSTATE RKH_ENABLED
1657 #endif
1658 
1659 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1660  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1661  (RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_ENABLED || \
1662  RKH_CFG_SMA_DEEP_HIST_EN == RKH_ENABLED))
1663  #define RKH_HISTORY_ENABLED
1664 #endif
1665 
1666 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1667  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1668  RKH_CFG_SMA_DEEP_HIST_EN == RKH_ENABLED)
1669  #define RKH_DEEP_ENABLED
1670 #endif
1671 
1672 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1673  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1674  RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_ENABLED)
1675  #define RKH_SHALLOW_ENABLED
1676 #endif
1677 
1678 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1679  RKH_CFG_SMA_SUBMACHINE_EN == RKH_ENABLED)
1680  #define RKH_SUBMACHINE_ENABLED
1681 #endif
1682 
1683 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1684  RKH_CFG_SMA_CHOICE_EN == RKH_ENABLED)
1685  #define RKH_CHOICE_ENABLED
1686 #endif
1687 
1688 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1689  (RKH_CFG_SMA_CONDITIONAL_EN == RKH_ENABLED || \
1690  RKH_CFG_SMA_CHOICE_EN == RKH_ENABLED))
1691  #define RKH_CHOICE_OR_CONDITIONAL_ENABLED
1692 #endif
1693 
1694 #if (RKH_CFG_TRC_EN == RKH_ENABLED && \
1695  (RKH_CFG_TRC_ALL_EN == RKH_ENABLED || \
1696  RKH_CFG_TRC_SMA_EN == RKH_ENABLED || \
1697  RKH_CFG_TRC_SM_EN == RKH_ENABLED || \
1698  RKH_CFG_TRC_FWK_EN == RKH_ENABLED))
1699  #define R_TRC_AO_NAME_EN RKH_ENABLED
1700 #else
1701  #define R_TRC_AO_NAME_EN RKH_DISABLED
1702 #endif
1703 
1704 #if (RKH_CFG_TRC_EN == RKH_ENABLED && \
1705  (RKH_CFG_TRC_ALL_EN == RKH_ENABLED || \
1706  RKH_CFG_TRC_MP_EN == RKH_ENABLED))
1707  #define RKH_MEMPOOL_EN RKH_ENABLED
1708 #else
1709  #define RKH_MEMPOOL_EN RKH_DISABLED
1710 #endif
1711 
1712 #define MKTRN(evt_, guard_, effect_, target_) \
1713  { \
1714  evt_, (RKH_GUARD_T)guard_, \
1715  (RKH_TRN_ACT_T)effect_, (RKHROM RKH_ST_T *)target_ \
1716  }
1717 
1718 #if RKH_CFG_SMA_SM_CONST_EN == RKH_ENABLED
1719  #define MKSM(constSM, initialState) \
1720  (RKHROM RKH_ROM_T *)(constSM), \
1721  (RKHROM RKH_ST_T *)(initialState)
1723  #if RKH_CFG_SMA_VFUNCT_EN == RKH_ENABLED
1724  #define MKSMA(constSM, initialState) \
1725  { \
1726  MKSM(constSM, initialState), \
1727  &rkhSmaVtbl \
1728  }
1729  #else
1730  #define MKSMA(constSM, initialState) \
1731  { \
1732  MKSM(constSM, initialState) \
1733  }
1734  #endif
1735 #else
1736  #if (RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
1737  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1738  #define MKSM(name, prio, ppty, initialState, initialAction, \
1739  initialEvt) \
1740  (prio), (ppty), #name, (RKHROM RKH_ST_T*)initialState, \
1741  ((RKH_TRN_ACT_T)initialAction), (initialEvt), \
1742  (RKHROM RKH_ST_T*)initialState
1743  #else
1744  #define MKSM(name, prio, ppty, initialState, initialAction, \
1745  initialEvt) \
1746  (prio), (ppty), (RKHROM RKH_ST_T*)initialState, \
1747  ((RKH_TRN_ACT_T)initialAction), (initialEvt), \
1748  (RKHROM RKH_ST_T*)initialState
1749  #endif
1750  #else
1751  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1752  #define MKSM(name, prio, ppty, initialState, initialAction, \
1753  initialEvt) \
1754  (prio), (ppty), #name, (RKHROM RKH_ST_T*)initialState, \
1755  ((RKH_TRN_ACT_T)initialAction), \
1756  (RKHROM RKH_ST_T*)initialState
1757  #else
1758  #define MKSM(name, prio, ppty, initialState, initialAction, \
1759  initialEvt) \
1760  (prio), (ppty), (RKHROM RKH_ST_T*)initialState, \
1761  ((RKH_TRN_ACT_T)initialAction), \
1762  (RKHROM RKH_ST_T*)initialState
1763  #endif
1764  #endif
1765  #if RKH_CFG_SMA_VFUNCT_EN == RKH_ENABLED
1766  #define MKSMA(name, prio, ppty, \
1767  initialState, initialAction, initialEvt) \
1768  { \
1769  MKSM(name, prio, ppty, initialState, \
1770  initialAction, initialEvt), /* RKH_SM_T members */ \
1771  &rkhSmaVtbl \
1772  }
1773  #else
1774  #define MKSMA(name, prio, ppty, \
1775  initialState, initialAction, initialEvt) \
1776  { \
1777  MKSM(name, prio, ppty, initialState, \
1778  initialAction, initialEvt) /* RKH_SM_T members */ \
1779  }
1780  #endif
1781 
1782  #define MKRT_SM(sm_, name_, prio_, ppty_, initialState_, initialAction_, \
1783  initialEvt_) \
1784  ((RKH_SM_T *)(sm_))->prio = prio_; \
1785  ((RKH_SM_T *)(sm_))->ppty = ppty_; \
1786  MKSM_NAME(sm_, name_); \
1787  ((RKH_SM_T *)(sm_))->istate = (RKHROM RKH_ST_T*)initialState_; \
1788  ((RKH_SM_T *)(sm_))->iaction = (RKH_TRN_ACT_T)initialAction_; \
1789  MKSM_IEVENT(sm_, initialEvt_); \
1790  ((RKH_SM_T *)(sm_))->state = (RKHROM RKH_ST_T*)initialState_
1791 
1792  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1793  #if RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED
1794  #define MKSM_NAME(sm_, name_) \
1795  ((RKH_SM_T *)sm_)->name = #name_
1796  #define MKSM_IEVENT(sm_, ievent_) \
1797  ((RKH_SM_T *)sm_)->ievent = ievent_
1798  #else
1799  #define MKSM_NAME(sm_, name_) \
1800  ((RKH_SM_T *)sm_)->name = #name_
1801  #define MKSM_IEVENT(sm_, ievent_)
1802  #endif
1803  #else
1804  #if RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED
1805  #define MKSM_NAME(sm_, name_) \
1806  #define MKSM_IEVENT(sm_, ievent_) \
1807  ((RKH_SM_T *)sm_)->ievent = ievent_
1808  #else
1809  #define MKSM_NAME(sm_, name_) \
1810  #define MKSM_IEVENT(sm_, ievent_)
1811  #endif
1812  #endif
1813 #endif
1814 
1815 #if (RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
1816  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1817  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1818  { \
1819  (prio), (ppty), # name, (RKHROM RKH_ST_T *)is, \
1820  (RKH_TRN_ACT_T)(ia), (ie) \
1821  }
1822  #else
1823  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1824  { \
1825  (prio), (ppty), (RKHROM RKH_ST_T *)is, \
1826  (RKH_TRN_ACT_T)(ia), (ie) \
1827  }
1828  #endif
1829 #else
1830  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1831  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1832  { \
1833  (prio), (ppty), # name, (RKHROM RKH_ST_T *)is, \
1834  (RKH_TRN_ACT_T)(ia) \
1835  }
1836  #else
1837  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1838  { \
1839  (prio), (ppty), (RKHROM RKH_ST_T *)is, \
1840  (RKH_TRN_ACT_T)(ia) \
1841  }
1842  #endif
1843 #endif
1844 
1845 #if R_TRC_AO_NAME_EN == RKH_ENABLED
1846  #define MKBASE(t, n) {t, # n}
1847 #else
1848  #define MKBASE(t, n) {t}
1849 #endif
1850 
1851 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED)
1852  #if (RKH_CFG_SMA_PPRO_EN == RKH_ENABLED)
1853  #if defined(RKH_HISTORY_ENABLED)
1854  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
1855  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL, d, \
1856  (RKH_TRN_ACT_T)dftTrn_, h
1857  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem) \
1858  RKHROM RKH_SHIST_T name##Hist = \
1859  { \
1860  MKBASE(kOfH, name##Hist), \
1861  (RKHROM RKH_ST_T *)&name, ramMem, \
1862  RKH_TRREG(0, dTG, dTA, dTT) \
1863  }
1864  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem) \
1865  RKHROM RKH_SHIST_T name = \
1866  { \
1867  MKBASE(kOfH, name), \
1868  (RKHROM RKH_ST_T *)parent, ramMem, \
1869  RKH_TRREG(0, dTG, dTA, dTT) \
1870  }
1871  #define MKFINAL(name_) \
1872  name_##_trtbl, NULL
1873  #define MKFINAL_INCOMP(name_) \
1874  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1875  #else
1876  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
1877  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL, d, \
1878  (RKH_TRN_ACT_T)dftTrn_
1879  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem)
1880  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem)
1881  #define MKFINAL(name_) \
1882  name_##_trtbl, NULL
1883  #define MKFINAL_INCOMP(name_) \
1884  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1885  #endif
1886  #else
1887  #if defined(RKH_HISTORY_ENABLED)
1888  #define MKBASIC(n,pp) n##_trtbl
1889  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, d, \
1890  (RKH_TRN_ACT_T)dftTrn_, h
1891  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem) \
1892  RKHROM RKH_SHIST_T name##Hist = \
1893  { \
1894  MKBASE(kOfH, name##Hist), \
1895  (RKHROM RKH_ST_T *)&name, ramMem, \
1896  RKH_TRREG(0, dTG, dTA, dTT) \
1897  }
1898  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem) \
1899  RKHROM RKH_SHIST_T name = \
1900  { \
1901  MKBASE(kOfH, name), \
1902  (RKHROM RKH_ST_T *)parent, ramMem, \
1903  RKH_TRREG(0, dTG, dTA, dTT) \
1904  }
1905  #define MKFINAL(name_) \
1906  name_##_trtbl
1907  #define MKFINAL_INCOMP(name_) \
1908  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1909  #else
1910  #define MKBASIC(n,pp) n##_trtbl
1911  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, d, \
1912  (RKH_TRN_ACT_T)dftTrn_
1913  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem)
1914  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem)
1915  #define MKFINAL(name_) \
1916  name_##_trtbl
1917  #define MKFINAL_INCOMP(name_) \
1918  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1919  #endif
1920  #endif
1921  #define MKST(en,ex,p) (RKH_ENT_ACT_T)en, \
1922  (RKH_EXT_ACT_T)ex, \
1923  (RKHROM RKH_ST_T *)p
1924  #define MKSBM(n,sbm) n##_trtbl,n##_exptbl,sbm
1925  #define MKMCH(d,i,n) d, (RKH_TRN_ACT_T)i, \
1926  (RKHROM RKH_ST_T * *)&rdyp_##n
1927  #define MKENP(e,s) e,(RKHROM RKH_ST_T *)s
1928 #else
1929  #if (RKH_CFG_SMA_PPRO_EN == RKH_ENABLED)
1930  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
1931  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL
1932  #define MKFINAL(name_)
1933  #define MKFINAL_INCOMP(name_)
1934  #else
1935  #define MKBASIC(n,pp) n##_trtbl
1936  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl
1937  #define MKFINAL(name_)
1938  #define MKFINAL_INCOMP(name_)
1939  #endif
1940  #define MKST(en,ex,p)
1941  #define MKSBM(n,sbm) n##_trtbl,n##_exptbl,sbm
1942  #define MKMCH(d,i,n) d, (RKH_TRN_ACT_T)i, \
1943  (RKHROM RKH_ST_T *)&rdyp_##n
1944  #define MKENP(e,s) e,(RKHROM RKH_ST_T *)s
1945 #endif
1946 
1947 #define MK_SET_EVT(ev_obj, ev_sig) \
1948  ((RKH_EVT_T *)(ev_obj))->e = (RKH_SIG_T)ev_sig; \
1949  ((RKH_EVT_T *)(ev_obj))->nref = 0; \
1950  ((RKH_EVT_T *)(ev_obj))->pool = 0
1951 
1952 #define MK_EVT(ev_obj, ev_sig) \
1953  RKH_EVT_T ev_obj = {ev_sig, 0, 0}
1954 
1955 #define MK_ROM_EVT(ev_obj, ev_sig) \
1956  RKHROM RKH_EVT_T ev_obj = {ev_sig, 0, 0}
1957 
1958 #define MK_EVT_STRUCT(ev_sig) \
1959  {ev_sig, 0, 0}
1960 
1961 #ifndef RKH_DIS_INTERRUPT
1962  #error \
1963  "rkhport.h, Must be defined the platform-dependent macro RKH_DIS_INTERRUPT"
1964 #endif
1965 
1966 #ifndef RKH_ENA_INTERRUPT
1967  #error \
1968  "rkhport.h, Must be defined the platform-dependent macro RKH_ENA_INTERRUPT"
1969 #endif
1970 
1971 #ifndef RKH_EN_DOXYGEN
1972  #define RKH_EN_DOXYGEN 0
1973 #endif
1974 
1975 #if RKH_EN_DOXYGEN == RKH_ENABLED
1998  #define RKH_DIS_INTERRUPT()
1999  #define RKH_ENA_INTERRUPT()
2050  #define RKH_CPUSR_TYPE
2051  #define RKH_SR_ALLOC() \
2052  RKH_CPUSR_TYPE sr = (RKH_CPUSR_TYPE)0
2053  #define RKH_ENTER_CRITICAL(dummy)
2054  #define RKH_EXIT_CRITICAL(dummy)
2074  #define RKH_CFGPORT_SMA_THREAD_EN RKH_ENABLED
2075 
2089  #define RKH_CFGPORT_SMA_THREAD_DATA_EN RKH_ENABLED
2090 
2104  #define RKH_CFGPORT_NATIVE_SCHEDULER_EN RKH_ENABLED
2105 
2117  #define RKH_CFGPORT_NATIVE_EQUEUE_EN RKH_ENABLED
2118 
2132  #define RKH_CFGPORT_NATIVE_DYN_EVT_EN RKH_ENABLED
2133 
2144  #define RKH_CFGPORT_REENTRANT_EN RKH_ENABLED
2145 
2155  #define RKH_CFGPORT_TRC_SIZEOF_PTR 32u
2156 
2166  #define RKH_CFGPORT_TRC_SIZEOF_FUN_PTR 32u
2167 
2177  #define RKH_CFGPORT_TRC_SIZEOF_TSTAMP 32u
2178 
2189  #define RKH_CFGPORT_SMA_QSTO_EN RKH_ENABLED
2190 
2201  #define RKH_CFGPORT_SMA_STK_EN RKH_ENABLED
2202 
2224  #define RKH_EQ_TYPE
2225 
2250  #define RKH_THREAD_TYPE
2251 
2274  #define RKH_OSSIGNAL_TYPE
2275 
2293  #define RKH_THREAD_STK_TYPE
2294 
2295 #endif
2296 
2297 #ifdef RKH_CPUSR_TYPE
2298  #if RKH_EN_DOXYGEN == RKH_DISABLED
2299  #define RKH_SR_ALLOC() RKH_CPUSR_TYPE sr = (RKH_CPUSR_TYPE)0
2300  #define RKH_ENTER_CRITICAL_() RKH_ENTER_CRITICAL(sr)
2301  #define RKH_EXIT_CRITICAL_() RKH_EXIT_CRITICAL(sr)
2302  #endif
2303 #else
2304  #define RKH_SR_ALLOC()
2305  #define RKH_ENTER_CRITICAL_() RKH_ENTER_CRITICAL(dummy)
2306  #define RKH_EXIT_CRITICAL_() RKH_EXIT_CRITICAL(dummy)
2307 #endif
2308 
2309 #if RKH_CFG_SMA_ENT_ARG_SMA_EN == RKH_ENABLED
2310  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2311  #define RKH_EXEC_ENTRY(state_, me_) \
2312  if ((state_)->enter) \
2313  { \
2314  (*(state_)->enter)(me_, state_); \
2315  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2316  (me_), \
2317  (state_), \
2318  (state_)->enter); \
2319  }
2320  #else
2321  #define RKH_EXEC_ENTRY(state_, me_) \
2322  if ((state_)->enter) \
2323  { \
2324  (*(state_)->enter)(me_); \
2325  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2326  (me_), \
2327  (state_), \
2328  (state_)->enter); \
2329  }
2330  #endif
2331 #else
2332  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2333  #define RKH_EXEC_ENTRY(state_, me_) \
2334  if ((state_)->enter) \
2335  { \
2336  (*(state_)->enter)(state_); \
2337  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2338  (me_), \
2339  (state_), \
2340  (state_)->enter); \
2341  }
2342  #else
2343  #define RKH_EXEC_ENTRY(state_, me_) \
2344  if ((state_)->enter) \
2345  { \
2346  (*(state_)->enter)(); \
2347  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2348  (me_), \
2349  (state_), \
2350  (state_)->enter); \
2351  }
2352  #endif
2353 #endif
2354 
2355 #if RKH_CFG_SMA_EXT_ARG_SMA_EN == RKH_ENABLED
2356  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2357  #define RKH_EXEC_EXIT(state_, me_) \
2358  if ((state_)->exit) \
2359  { \
2360  (*(state_)->exit)(me_, state_); \
2361  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2362  (me_), \
2363  (state_), \
2364  (state_)->exit); \
2365  }
2366  #else
2367  #define RKH_EXEC_EXIT(state_, me_) \
2368  if ((state_)->exit) \
2369  { \
2370  (*(state_)->exit)(me_); \
2371  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2372  (me_), \
2373  (state_), \
2374  (state_)->exit); \
2375  }
2376  #endif
2377 #else
2378  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2379  #define RKH_EXEC_EXIT(state_, me_) \
2380  if ((state_)->exit) \
2381  { \
2382  (*(state_)->exit)(state_); \
2383  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2384  (me_), \
2385  (state_), \
2386  (state_)->exit); \
2387  }
2388  #else
2389  #define RKH_EXEC_EXIT(state_, me_) \
2390  if ((state_)->exit) \
2391  { \
2392  (*(state_)->exit)(); \
2393  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2394  (me_), \
2395  (state_), \
2396  (state_)->exit); \
2397  }
2398  #endif
2399 #endif
2400 
2401 #if RKH_CFG_SMA_PPRO_ARG_SMA_EN == RKH_ENABLED
2402  #define RKH_EXEC_PREPRO(state_, me_, evt_) \
2403  (*(state_)->prepro)(me_, evt_); \
2404  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_PP, \
2405  (me_), \
2406  (((RKH_SM_T *)me_))->state, \
2407  (state_)->prepro)
2408 #else
2409  #define RKH_EXEC_PREPRO(state_, me_, evt_) \
2410  (*(state_)->prepro)(evt_); \
2411  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_PP, \
2412  (me_), \
2413  (((RKH_SM_T *)me_))->state, \
2414  (state_)->prepro)
2415 #endif
2416 
2417 #if (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_ENABLED && \
2418  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_ENABLED)
2419  #define RKH_EXEC_EFF(action_, me_, evt_) \
2420  (*CTA(action_))((me_), (evt_)); \
2421  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2422  (me_), \
2423  (((RKH_SM_T *)me_))->state, \
2424  (action_))
2425 #elif (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_ENABLED && \
2426  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_DISABLED)
2427  #define RKH_EXEC_EFF(action_, me_, evt_) \
2428  (*CTA(action_))((evt_)); \
2429  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2430  (me_), \
2431  (((RKH_SM_T *)me_))->state, \
2432  (action_))
2433 #elif (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_DISABLED && \
2434  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_ENABLED)
2435  #define RKH_EXEC_EFF(action_, me_, evt_) \
2436  (*CTA(action_))((me_)); \
2437  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2438  (me_), \
2439  (((RKH_SM_T *)me_))->state, \
2440  (action_))
2441 #else
2442  #define RKH_EXEC_EFF(action_, me_, evt_) \
2443  (*CTA(action_))(); \
2444  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2445  (me_), \
2446  (((RKH_SM_T *)me_))->state, \
2447  (action_))
2448 #endif
2449 
2450 #if (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
2451  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
2452  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2453  (*(trn_)->guard)(me_, evt_)
2454 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
2455  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_DISABLED)
2456  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2457  (*(trn_)->guard)(evt_)
2458 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_DISABLED && \
2459  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
2460  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2461  (*(trn_)->guard)(me_)
2462 #else
2463  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2464  (*(trn_)->guard)()
2465 #endif
2466 
2467 /* -------------------------------- Constants ------------------------------ */
2468 #ifndef NULL
2469 #define NULL (void *)0
2470 #endif
2471 
2472 /* ------------------------------- Data types ------------------------------ */
2473 typedef struct RKH_ROM_T RKH_ROM_T;
2474 typedef struct RKHSmaVtbl RKHSmaVtbl;
2475 typedef struct RKH_SM_T RKH_SM_T;
2476 typedef struct RKH_SMA_T RKH_SMA_T;
2477 typedef struct RKH_TR_T RKH_TR_T;
2478 typedef struct RKH_BASE_T RKH_BASE_T;
2479 typedef struct RKH_ST_T RKH_ST_T;
2480 typedef struct RKH_SHIST_T RKH_SHIST_T;
2481 typedef struct RKH_SBSC_T RKH_SBSC_T;
2482 typedef struct RKH_SCMP_T RKH_SCMP_T;
2483 typedef struct RKH_FINAL_T RKH_FINAL_T;
2484 typedef struct RKH_EXPCN_T RKH_EXPCN_T;
2485 typedef struct RKH_ENPCN_T RKH_ENPCN_T;
2486 typedef struct RKH_SSBM_T RKH_SSBM_T;
2487 typedef struct RKH_RSM_T RKH_RSM_T;
2488 typedef struct RKH_SENP_T RKH_SENP_T;
2489 typedef struct RKH_SEXP_T RKH_SEXP_T;
2490 typedef struct RKH_SCOND_T RKH_SCOND_T;
2491 typedef struct RKH_SCHOICE_T RKH_SCHOICE_T;
2492 
2493 /* -------------------------- External variables --------------------------- */
2498 extern RKHROM char noname[];
2499 
2500 /* -------------------------- Function prototypes -------------------------- */
2501 /* -------------------- External C language linkage end -------------------- */
2502 #ifdef __cplusplus
2503 }
2504 #endif
2505 
2506 /* ------------------------------ Module end ------------------------------- */
2507 #endif
2508 
2509 /* ------------------------------ End of file ------------------------------ */
Defines event data type and other related macros.
RKHROM char noname[]
String representing the name of undefined object name.
RKH platform abstraction layer.
Maintains the basic information of a state.
Definition: rkhsm.h:1994
Describes the entry point connection.
Definition: rkhsm.h:2281
Describes the exit point connection.
Definition: rkhsm.h:2262
Describes a final state.
Definition: rkhsm.h:2234
Constant parameters of state machine.
Definition: rkhsm.h:1829
Describes a (referenced) submachine state machine.
Definition: rkhsm.h:2381
Describes a basic state.
Definition: rkhsm.h:2098
Describes the choice pseudostate.
Definition: rkhsm.h:2502
Describes a composite state.
Definition: rkhsm.h:2155
Describes the conditional pseudostate.
Definition: rkhsm.h:2481
Describes the entry point pseudostate.
Definition: rkhsm.h:2423
Describes the exit point pseudostate.
Definition: rkhsm.h:2454
Describes the history pseudostate.
Definition: rkhsm.h:2524
Describes the state machine.
Definition: rkhsm.h:1905
Describes the SMA (active object in UML).
Definition: rkhsma.h:772
Describes a submachine state.
Definition: rkhsm.h:2354
Describes the common properties of regular states (basic, composite, and submachine).
Definition: rkhsm.h:2065
Describes the state transition.
Definition: rkhsm.h:2033
Virtual table for the RKH_SMA_T structure.
Definition: rkhsma.h:884