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 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 ----------------------------- */
57 #include "rkhplat.h"
58 
64 #include "rkhevt.h"
65 
66 /* ---------------------- External C language linkage ---------------------- */
67 #ifdef __cplusplus
68 extern "C" {
69 #endif
70 
71 /* --------------------------------- Macros -------------------------------- */
72 #if (((RKH_CFG_TRC_EN == 1) && (RKH_CFG_SMA_TRC_SNDR_EN == 1)) || \
73  (defined(RKH_EN_DOXYGEN) && RKH_EN_DOXYGEN == 1))
74 
90  #define RKH_USE_TRC_SENDER
91 #endif
92 
98 #define RKH_RELEASE rkh_version
99 
122 #define RKH_VERSION(a, b, c) \
123  (((((a) << 12) & 0xF000) | \
124  (((b) << 8) & 0x0F00) | \
125  (((c) & 0xFF) & 0x00FF)) & 0xFFFF)
126 
131 #define RKH_ANY ((RKH_SIG_T)(-1))
132 
142 #define RKH_COMPLETION_EVENT (RKH_ANY - 1)
143 
153 #define RKH_LOWEST_PRIO (RKH_CFG_FWK_MAX_SMA - 1)
154 
155 /*
156  * Verifies port file from rkhport.h included in rkhplat.h.
157  */
158 
159 #ifndef RKHROM
160 #error "rkhport.h, Missing RKHROM: Qualifier for ROM data storage. \
161  See Porting chapter in readme file for more information"
162 #endif
163 
164 #define FOREVER for (;; )
165 
166 /*
167  * Macros for casting
168  */
169 #define CB(p) ((RKH_BASE_T *)(p))
170 #define CST(p) ((RKH_ST_T *)(p))
171 #define CCMP(p) ((RKH_SCMP_T *)(p))
172 #define CBSC(p) ((RKH_SBSC_T *)(p))
173 #define CCD(p) ((RKH_SCOND_T *)(p))
174 #define CCH(p) ((RKH_SCHOICE_T *)(p))
175 #define CH(p) ((RKH_SHIST_T *)(p))
176 #define CSBM(p) ((RKH_SSBM_T *)(p))
177 #define CRSM(p) ((RKH_RSM_T *)(p))
178 #define CM(p) ((RKHROM RKH_SM_T *)(p))
179 #define CT(p) ((RKHROM RKH_TR_T *)(p))
180 #define CPT(p) ((RKHROM RKH_SCMP_T *)(p))
181 #define CPP(p) ((RKH_PPRO_T)(p))
182 #define CG(p) ((RKH_GUARD_T)(p))
183 #define CA(p) ((RKH_TRN_ACT_T)(p))
184 #define CENP(p) ((RKH_SENP_T *)(p))
185 #define CEXP(p) ((RKH_SEXP_T *)(p))
186 #define CENPCN(p) ((RKH_ENPCN_T *)(p))
187 #define CEXPCN(p) ((RKH_EXPCN_T *)(p))
188 #define CE(p) ((RKH_EVT_T *)(p))
189 #define CCE(p) ((const RKH_EVT_T *)(p))
190 #define CV(p) ((void *)(p))
191 #define CSMA(p) ((const RKH_SMA_T *)(p))
192 #define CQ(p) ((RKH_QUEUE_T *)(p))
193 #define CIA(s) ((RKH_INIT_ACT_T)(RKH_SMA_ACCESS_CONST(sma, iaction)))
194 #define CTA(ta) ((RKH_TRN_ACT_T)(ta))
195 
207 #define RKH_DCLR_PTR_TYPE(type_, me_) \
208  extern type_ * const me_
209 
210 /* ------------------------- Configuration errors -------------------------- */
211 
212 /*
213  * LOOK FOR MISSING #define CONSTANTS
214  *
215  * This section is used to generate ERROR messages at compile time if
216  * certain #define constants are MISSING in rkhcfg.h. This allows you to
217  * quickly determine the source of the error.
218  *
219  * You SHOULD NOT change this section UNLESS you would like to add more
220  * comments as to the source of the compile time error.
221  */
222 
223 /* MEMORY POOL --------------------------------------------------------- */
224 #ifndef RKH_CFG_MP_EN
225  #error "RKH_CFG_MP_EN not #define'd in 'rkhcfg.h'"
226  #error " [MUST be RKH_ENABLED ] "
227  #error " [ || RKH_DISABLED] "
228 
229 #elif ((RKH_CFG_MP_EN != RKH_ENABLED) && \
230  (RKH_CFG_MP_EN != RKH_DISABLED))
231  #error "RKH_CFG_MP_EN illegally #define'd in 'rkhcfg.h'"
232  #error " [MUST be RKH_ENABLED ] "
233  #error " [ || RKH_DISABLED] "
234 
235 #elif (RKH_CFG_MP_EN == RKH_ENABLED)
236 
237  #ifndef RKH_CFG_MP_REDUCED_EN
238  #error "RKH_CFG_MP_REDUCED_EN not #define'd in 'rkhcfg.h'"
239  #error " [MUST be RKH_ENABLED ] "
240  #error " [ || RKH_DISABLED] "
241 
242  #elif ((RKH_CFG_MP_REDUCED_EN != RKH_ENABLED) && \
243  (RKH_CFG_MP_REDUCED_EN != RKH_DISABLED))
244  #error "RKH_CFG_MP_REDUCED_EN illegally #define'd in 'rkhcfg.h'"
245  #error " [MUST be RKH_ENABLED ] "
246  #error " [ || RKH_DISABLED] "
247  #endif
248 
249  #ifndef RKH_CFG_MP_SIZEOF_BSIZE
250  #error "RKH_CFG_MP_SIZEOF_BSIZE not #define'd in 'rkhcfg.h'"
251  #error " [MUST be 8 ( 8-bit size)] "
252  #error " [ || 16 (16-bit size)] "
253  #error " [ || 32 (32-bit size)] "
254 
255  #elif ((RKH_CFG_MP_SIZEOF_BSIZE != 8) && \
256  (RKH_CFG_MP_SIZEOF_BSIZE != 16) && \
257  (RKH_CFG_MP_SIZEOF_BSIZE != 32))
258  #error "RKH_CFG_MP_SIZEOF_BSIZE illegally #define'd in 'rkhcfg.h'"
259  #error " [MUST be 8 ( 8-bit size)] "
260  #error " [ || 16 (16-bit size)] "
261  #error " [ || 32 (32-bit size)] "
262  #endif
263 
264  #ifndef RKH_CFG_MP_SIZEOF_NBLOCK
265  #error "RKH_CFG_MP_SIZEOF_NBLOCK not #define'd in 'rkhcfg.h'"
266  #error " [MUST be 8 ( 8-bit size)] "
267  #error " [ || 16 (16-bit size)] "
268  #error " [ || 32 (32-bit size)] "
269 
270  #elif ((RKH_CFG_MP_SIZEOF_NBLOCK != 8) && \
271  (RKH_CFG_MP_SIZEOF_NBLOCK != 16) && \
272  (RKH_CFG_MP_SIZEOF_NBLOCK != 32))
273  #error "RKH_CFG_MP_SIZEOF_NBLOCK illegally #define'd in 'rkhcfg.h'"
274  #error " [MUST be 8 ( 8-bit size)] "
275  #error " [ || 16 (16-bit size)] "
276  #error " [ || 32 (32-bit size)] "
277  #endif
278 
279  #ifndef RKH_CFG_MP_GET_BSIZE_EN
280  #error "RKH_CFG_MP_GET_BSIZE_EN not #define'd in 'rkhcfg.h'"
281  #error " [MUST be RKH_ENABLED ] "
282  #error " [ || RKH_DISABLED] "
283 
284  #elif ((RKH_CFG_MP_GET_BSIZE_EN != RKH_ENABLED) && \
285  (RKH_CFG_MP_GET_BSIZE_EN != RKH_DISABLED))
286  #error "RKH_CFG_MP_GET_BSIZE_EN illegally #define'd in 'rkhcfg.h'"
287  #error " [MUST be RKH_ENABLED ] "
288  #error " [ || RKH_DISABLED] "
289  #endif
290 
291  #ifndef RKH_CFG_MP_GET_NFREE_EN
292  #error "RKH_CFG_MP_GET_NFREE_EN not #define'd in 'rkhcfg.h'"
293  #error " [MUST be RKH_ENABLED ] "
294  #error " [ || RKH_DISABLED] "
295 
296  #elif ((RKH_CFG_MP_GET_NFREE_EN != RKH_ENABLED) && \
297  (RKH_CFG_MP_GET_NFREE_EN != RKH_DISABLED))
298  #error "RKH_CFG_MP_GET_NFREE_EN illegally #define'd in 'rkhcfg.h'"
299  #error " [MUST be RKH_ENABLED ] "
300  #error " [ || RKH_DISABLED] "
301  #endif
302 
303  #ifndef RKH_CFG_MP_GET_LWM_EN
304  #error "RKH_CFG_MP_GET_LWM_EN not #define'd in 'rkhcfg.h'"
305  #error " [MUST be RKH_ENABLED ] "
306  #error " [ || RKH_DISABLED] "
307 
308  #elif ((RKH_CFG_MP_GET_LWM_EN != RKH_ENABLED) && \
309  (RKH_CFG_MP_GET_LWM_EN != RKH_DISABLED))
310  #error "RKH_CFG_MP_GET_LWM_EN illegally #define'd in 'rkhcfg.h'"
311  #error " [MUST be RKH_ENABLED ] "
312  #error " [ || RKH_DISABLED] "
313  #endif
314 
315  #ifndef RKH_CFG_MP_GET_INFO_EN
316  #error "RKH_CFG_MP_GET_INFO_EN not #define'd in 'rkhcfg.h'"
317  #error " [MUST be RKH_ENABLED ] "
318  #error " [ || RKH_DISABLED] "
319 
320  #elif ((RKH_CFG_MP_GET_INFO_EN != RKH_ENABLED) && \
321  (RKH_CFG_MP_GET_INFO_EN != RKH_DISABLED))
322  #error "RKH_CFG_MP_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
323  #error " [MUST be RKH_ENABLED ] "
324  #error " [ || RKH_DISABLED] "
325  #endif
326 
327 #endif
328 
329 /* QUEUE --------------------------------------------------------- */
330 #ifndef RKH_CFG_QUE_EN
331  #error "RKH_CFG_QUE_EN not #define'd in 'rkhcfg.h'"
332  #error " [MUST be RKH_ENABLED ] "
333  #error " [ || RKH_DISABLED] "
334 
335 #elif ((RKH_CFG_QUE_EN != RKH_ENABLED) && \
336  (RKH_CFG_QUE_EN != RKH_DISABLED))
337  #error "RKH_CFG_QUE_EN illegally #define'd in 'rkhcfg.h'"
338  #error " [MUST be RKH_ENABLED ] "
339  #error " [ || RKH_DISABLED] "
340 
341 #endif
342 
343 #ifndef RKH_CFG_QUE_SIZEOF_NELEM
344  #error "RKH_CFG_QUE_SIZEOF_NELEM not #define'd in 'rkhcfg.h'"
345  #error " [MUST be 8 ( 8-bit size)] "
346  #error " [ || 16 (16-bit size)] "
347  #error " [ || 32 (32-bit size)] "
348 
349 #elif ((RKH_CFG_QUE_SIZEOF_NELEM != 8) && \
350  (RKH_CFG_QUE_SIZEOF_NELEM != 16) && \
351  (RKH_CFG_QUE_SIZEOF_NELEM != 32))
352  #error "RKH_CFG_QUE_SIZEOF_NELEM illegally #define'd in 'rkhcfg.h'"
353  #error " [MUST be 8 ( 8-bit size)] "
354  #error " [ || 16 (16-bit size)] "
355  #error " [ || 32 (32-bit size)] "
356 
357 #endif
358 
359 #ifndef RKH_CFG_QUE_GET_LWMARK_EN
360  #error "RKH_CFG_QUE_GET_LWMARK_EN not #define'd in 'rkhcfg.h'"
361  #error " [MUST be RKH_ENABLED ] "
362  #error " [ || RKH_DISABLED] "
363 
364 #elif ((RKH_CFG_QUE_GET_LWMARK_EN != RKH_ENABLED) && \
365  (RKH_CFG_QUE_GET_LWMARK_EN != RKH_DISABLED))
366  #error "RKH_CFG_QUE_GET_LWMARK_EN illegally #define'd in 'rkhcfg.h'"
367  #error " [MUST be RKH_ENABLED ] "
368  #error " [ || RKH_DISABLED] "
369 
370 #endif
371 
372 #ifndef RKH_CFG_QUE_READ_EN
373  #error "RKH_CFG_QUE_READ_EN not #define'd in 'rkhcfg.h'"
374  #error " [MUST be RKH_ENABLED ] "
375  #error " [ || RKH_DISABLED] "
376 
377 #elif ((RKH_CFG_QUE_READ_EN != RKH_ENABLED) && \
378  (RKH_CFG_QUE_READ_EN != RKH_DISABLED))
379  #error "RKH_CFG_QUE_READ_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_DEPLETE_EN
386  #error "RKH_CFG_QUE_DEPLETE_EN not #define'd in 'rkhcfg.h'"
387  #error " [MUST be RKH_ENABLED ] "
388  #error " [ || RKH_DISABLED] "
389 
390 #elif ((RKH_CFG_QUE_DEPLETE_EN != RKH_ENABLED) && \
391  (RKH_CFG_QUE_DEPLETE_EN != RKH_DISABLED))
392  #error "RKH_CFG_QUE_DEPLETE_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_IS_FULL_EN
399  #error "RKH_CFG_QUE_IS_FULL_EN not #define'd in 'rkhcfg.h'"
400  #error " [MUST be RKH_ENABLED ] "
401  #error " [ || RKH_DISABLED] "
402 
403 #elif ((RKH_CFG_QUE_IS_FULL_EN != RKH_ENABLED) && \
404  (RKH_CFG_QUE_IS_FULL_EN != RKH_DISABLED))
405  #error "RKH_CFG_QUE_IS_FULL_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_GET_NELEMS_EN
412  #error "RKH_CFG_QUE_GET_NELEMS_EN not #define'd in 'rkhcfg.h'"
413  #error " [MUST be RKH_ENABLED ] "
414  #error " [ || RKH_DISABLED] "
415 
416 #elif ((RKH_CFG_QUE_GET_NELEMS_EN != RKH_ENABLED) && \
417  (RKH_CFG_QUE_GET_NELEMS_EN != RKH_DISABLED))
418  #error "RKH_CFG_QUE_GET_NELEMS_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_PUT_LIFO_EN
425  #error "RKH_CFG_QUE_PUT_LIFO_EN not #define'd in 'rkhcfg.h'"
426  #error " [MUST be RKH_ENABLED ] "
427  #error " [ || RKH_DISABLED] "
428 
429 #elif ((RKH_CFG_QUE_PUT_LIFO_EN != RKH_ENABLED) && \
430  (RKH_CFG_QUE_PUT_LIFO_EN != RKH_DISABLED))
431  #error "RKH_CFG_QUE_PUT_LIFO_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_GET_INFO_EN
438  #error "RKH_CFG_QUE_GET_INFO_EN not #define'd in 'rkhcfg.h'"
439  #error " [MUST be RKH_ENABLED ] "
440  #error " [ || RKH_DISABLED] "
441 
442 #elif ((RKH_CFG_QUE_GET_INFO_EN != RKH_ENABLED) && \
443  (RKH_CFG_QUE_GET_INFO_EN != RKH_DISABLED))
444  #error "RKH_CFG_QUE_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
445  #error " [MUST be RKH_ENABLED ] "
446  #error " [ || RKH_DISABLED] "
447 
448 #endif
449 
450 /* TIMER --------------------------------------------------------- */
451 #ifndef RKH_CFG_TMR_EN
452  #error "RKH_CFG_TMR_EN not #define'd in 'rkhcfg.h'"
453  #error " [MUST be RKH_ENABLED ] "
454  #error " [ || RKH_DISABLED] "
455 
456 #elif ((RKH_CFG_TMR_EN != RKH_ENABLED) && \
457  (RKH_CFG_TMR_EN != RKH_DISABLED))
458  #error "RKH_CFG_TMR_EN illegally #define'd in 'rkhcfg.h'"
459  #error " [MUST be RKH_ENABLED ] "
460  #error " [ || RKH_DISABLED] "
461 
462 #elif (RKH_CFG_TMR_EN == RKH_ENABLED)
463  #ifndef RKH_CFG_FWK_TICK_RATE_HZ
464  #error "RKH_CFG_FWK_TICK_RATE_HZ not #define'd in 'rkhcfg.h'"
465  #error " [MUST be RKH_ENABLED ] "
466  #error " [ || RKH_DISABLED] "
467  #elif (RKH_CFG_FWK_TICK_RATE_HZ <= 0u)
468  #error "RKH_CFG_FWK_TICK_RATE_HZ illegally #define'd in 'rkhcfg.h'"
469  #error " [MUST be > 0] "
470  #endif
471 
472  #ifndef RKH_CFG_TMR_SIZEOF_NTIMER
473  #error "RKH_CFG_TMR_SIZEOF_NTIMER not #define'd in 'rkhcfg.h'"
474  #error " [MUST be 8 ( 8-bit size)] "
475  #error " [ || 16 (16-bit size)] "
476  #error " [ || 32 (32-bit size)] "
477 
478  #elif ((RKH_CFG_TMR_SIZEOF_NTIMER != 8) && \
479  (RKH_CFG_TMR_SIZEOF_NTIMER != 16) && \
480  (RKH_CFG_TMR_SIZEOF_NTIMER != 32))
481  #error "RKH_CFG_TMR_SIZEOF_NTIMER illegally #define'd in 'rkhcfg.h'"
482  #error " [MUST be 8 ( 8-bit size)] "
483  #error " [ || 16 (16-bit size)] "
484  #error " [ || 32 (32-bit size)] "
485  #endif
486 
487  #ifndef RKH_CFG_TMR_HOOK_EN
488  #error "RKH_CFG_TMR_HOOK_EN not #define'd in 'rkhcfg.h'"
489  #error " [MUST be RKH_ENABLED ] "
490  #error " [ || RKH_DISABLED] "
491 
492  #elif ((RKH_CFG_TMR_HOOK_EN != RKH_ENABLED) && \
493  (RKH_CFG_TMR_HOOK_EN != RKH_DISABLED))
494  #error "RKH_CFG_TMR_HOOK_EN illegally #define'd in 'rkhcfg.h'"
495  #error " [MUST be RKH_ENABLED ] "
496  #error " [ || RKH_DISABLED] "
497  #endif
498 
499  #ifndef RKH_CFG_TMR_GET_INFO_EN
500  #error "RKH_CFG_TMR_GET_INFO_EN not #define'd in 'rkhcfg.h'"
501  #error " [MUST be RKH_ENABLED ] "
502  #error " [ || RKH_DISABLED] "
503 
504  #elif ((RKH_CFG_TMR_GET_INFO_EN != RKH_ENABLED) && \
505  (RKH_CFG_TMR_GET_INFO_EN != RKH_DISABLED))
506  #error "RKH_CFG_TMR_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
507  #error " [MUST be RKH_ENABLED ] "
508  #error " [ || RKH_DISABLED] "
509  #endif
510 
511 #endif
512 
513 /* STATE MACHINE APPLICATIONS -------------------------------------------- */
514 #ifndef RKH_CFG_SMA_GET_INFO_EN
515  #error "RKH_CFG_SMA_GET_INFO_EN not #define'd in 'rkhcfg.h'"
516  #error " [MUST be RKH_ENABLED ] "
517  #error " [ || RKH_DISABLED] "
518 
519 #elif ((RKH_CFG_SMA_GET_INFO_EN != RKH_ENABLED) && \
520  (RKH_CFG_SMA_GET_INFO_EN != RKH_DISABLED))
521  #error "RKH_CFG_SMA_GET_INFO_EN illegally #define'd in 'rkhcfg.h'"
522  #error " [MUST be RKH_ENABLED ] "
523  #error " [ || RKH_DISABLED] "
524 
525 #endif
526 
527 #ifndef RKH_CFG_SMA_PPRO_EN
528  #error "RKH_CFG_SMA_PPRO_EN not #define'd in 'rkhcfg.h'"
529  #error " [MUST be RKH_ENABLED ] "
530  #error " [ || RKH_DISABLED] "
531 
532 #elif ((RKH_CFG_SMA_PPRO_EN != RKH_ENABLED) && \
533  (RKH_CFG_SMA_PPRO_EN != RKH_DISABLED))
534  #error "RKH_CFG_SMA_PPRO_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_HCAL_EN
541  #error "RKH_CFG_SMA_HCAL_EN not #define'd in 'rkhcfg.h'"
542  #error " [MUST be RKH_ENABLED ] "
543  #error " [ || RKH_DISABLED] "
544 
545 #elif ((RKH_CFG_SMA_HCAL_EN != RKH_ENABLED) && \
546  (RKH_CFG_SMA_HCAL_EN != RKH_DISABLED))
547  #error "RKH_CFG_SMA_HCAL_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_MAX_HCAL_DEPTH
554  #error "RKH_CFG_SMA_MAX_HCAL_DEPTH not #define'd in 'rkhcfg.h'"
555  #error " [MUST be > 0] "
556  #error " [ && <= 8] "
557 
558 #elif ((RKH_CFG_SMA_MAX_HCAL_DEPTH == 0) || \
559  (RKH_CFG_SMA_MAX_HCAL_DEPTH > 8))
560  #error "RKH_CFG_SMA_MAX_HCAL_DEPTH illegally #define'd in 'rkhcfg.h'"
561  #error " [MUST be >= 0] "
562  #error " [ && <= 8] "
563 
564 #endif
565 
566 #ifndef RKH_CFG_SMA_MAX_TRC_SEGS
567  #error "RKH_CFG_SMA_MAX_TRC_SEGS not #define'd in 'rkhcfg.h'"
568  #error " [MUST be > 0] "
569  #error " [ && <= 8] "
570 
571 #elif ((RKH_CFG_SMA_MAX_TRC_SEGS == 0) || \
572  (RKH_CFG_SMA_MAX_TRC_SEGS > 8))
573  #error "RKH_CFG_SMA_MAX_TRC_SEGS illegally #define'd in 'rkhcfg.h'"
574  #error " [MUST be >= 0] "
575  #error " [ && <= 8] "
576 
577 #endif
578 
579 #ifndef RKH_CFG_SMA_PSEUDOSTATE_EN
580  #error "RKH_CFG_SMA_PSEUDOSTATE_EN not #define'd in 'rkhcfg.h'"
581  #error " [MUST be RKH_ENABLED ] "
582  #error " [ || RKH_DISABLED] "
583 
584 #elif ((RKH_CFG_SMA_PSEUDOSTATE_EN != RKH_ENABLED) && \
585  (RKH_CFG_SMA_PSEUDOSTATE_EN != RKH_DISABLED))
586  #error "RKH_CFG_SMA_PSEUDOSTATE_EN illegally #define'd in 'rkhcfg.h'"
587  #error " [MUST be RKH_ENABLED ] "
588  #error " [ || RKH_DISABLED] "
589 
590 #endif
591 
592 #ifndef RKH_CFG_SMA_DEEP_HIST_EN
593  #error "RKH_CFG_SMA_DEEP_HIST_EN not #define'd in 'rkhcfg.h'"
594  #error " [MUST be RKH_ENABLED ] "
595  #error " [ || RKH_DISABLED] "
596 
597 #elif ((RKH_CFG_SMA_DEEP_HIST_EN != RKH_ENABLED) && \
598  (RKH_CFG_SMA_DEEP_HIST_EN != RKH_DISABLED))
599  #error "RKH_CFG_SMA_DEEP_HIST_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_SHALLOW_HIST_EN
606  #error "RKH_CFG_SMA_SHALLOW_HIST_EN not #define'd in 'rkhcfg.h'"
607  #error " [MUST be RKH_ENABLED ] "
608  #error " [ || RKH_DISABLED] "
609 
610 #elif ((RKH_CFG_SMA_SHALLOW_HIST_EN != RKH_ENABLED) && \
611  (RKH_CFG_SMA_SHALLOW_HIST_EN != RKH_DISABLED))
612  #error "RKH_CFG_SMA_SHALLOW_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_CHOICE_EN
619  #error "RKH_CFG_SMA_CHOICE_EN not #define'd in 'rkhcfg.h'"
620  #error " [MUST be RKH_ENABLED ] "
621  #error " [ || RKH_DISABLED] "
622 
623 #elif ((RKH_CFG_SMA_CHOICE_EN != RKH_ENABLED) && \
624  (RKH_CFG_SMA_CHOICE_EN != RKH_DISABLED))
625  #error "RKH_CFG_SMA_CHOICE_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_CONDITIONAL_EN
632  #error "RKH_CFG_SMA_CONDITIONAL_EN not #define'd in 'rkhcfg.h'"
633  #error " [MUST be RKH_ENABLED ] "
634  #error " [ || RKH_DISABLED] "
635 
636 #elif ((RKH_CFG_SMA_CONDITIONAL_EN != RKH_ENABLED) && \
637  (RKH_CFG_SMA_CONDITIONAL_EN != RKH_DISABLED))
638  #error "RKH_CFG_SMA_CONDITIONAL_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_SUBMACHINE_EN
645  #error "RKH_CFG_SMA_SUBMACHINE_EN not #define'd in 'rkhcfg.h'"
646  #error " [MUST be RKH_ENABLED ] "
647  #error " [ || RKH_DISABLED] "
648 
649 #elif ((RKH_CFG_SMA_SUBMACHINE_EN != RKH_ENABLED) && \
650  (RKH_CFG_SMA_SUBMACHINE_EN != RKH_DISABLED))
651  #error "RKH_CFG_SMA_SUBMACHINE_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_TRC_SNDR_EN
658  #error "RKH_CFG_SMA_TRC_SNDR_EN not #define'd in 'rkhcfg.h'"
659  #error " [MUST be RKH_ENABLED ] "
660  #error " [ || RKH_DISABLED] "
661 
662 #elif ((RKH_CFG_SMA_TRC_SNDR_EN != RKH_ENABLED) && \
663  (RKH_CFG_SMA_TRC_SNDR_EN != RKH_DISABLED))
664  #error "RKH_CFG_SMA_TRC_SNDR_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_INIT_ARG_SMA_EN
671  #error "RKH_CFG_SMA_INIT_ARG_SMA_EN not #define'd in 'rkhcfg.h'"
672  #error " [MUST be RKH_ENABLED ] "
673  #error " [ || RKH_DISABLED] "
674 
675 #elif ((RKH_CFG_SMA_INIT_ARG_SMA_EN != RKH_ENABLED) && \
676  (RKH_CFG_SMA_INIT_ARG_SMA_EN != RKH_DISABLED))
677  #error "RKH_CFG_SMA_INIT_ARG_SMA_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 /* TRACE --------------------------------------------------------- */
840 #ifndef RKH_CFG_TRC_EN
841  #error "RKH_CFG_TRC_EN not #define'd in 'rkhcfg.h'"
842  #error " [MUST be RKH_ENABLED ] "
843  #error " [ || RKH_DISABLED] "
844 
845 #elif ((RKH_CFG_TRC_EN != RKH_ENABLED) && \
846  (RKH_CFG_TRC_EN != RKH_DISABLED))
847  #error "RKH_CFG_TRC_EN illegally #define'd in 'rkhcfg.h'"
848  #error " [MUST be RKH_ENABLED ] "
849  #error " [ || RKH_DISABLED] "
850 
851 #elif (RKH_CFG_TRC_EN == RKH_ENABLED)
852 
853  #ifndef RKH_CFG_TRC_RTFIL_EN
854  #error "RKH_CFG_TRC_RTFIL_EN not #define'd in 'rkhcfg.h'"
855  #error " [MUST be RKH_ENABLED ] "
856  #error " [ || RKH_DISABLED] "
857 
858  #elif ((RKH_CFG_TRC_RTFIL_EN != RKH_ENABLED) && \
859  (RKH_CFG_TRC_RTFIL_EN != RKH_DISABLED))
860  #error "RKH_CFG_TRC_RTFIL_EN illegally #define'd in 'rkhcfg.h'"
861  #error " [MUST be RKH_ENABLED ] "
862  #error " [ || RKH_DISABLED] "
863  #endif
864 
865  #ifndef RKH_CFG_TRC_RTFIL_SMA_EN
866  #error "RKH_CFG_TRC_RTFIL_SMA_EN not #define'd in 'rkhcfg.h'"
867  #error " [MUST be RKH_ENABLED ] "
868  #error " [ || RKH_DISABLED] "
869 
870  #elif ((RKH_CFG_TRC_RTFIL_SMA_EN != RKH_ENABLED) && \
871  (RKH_CFG_TRC_RTFIL_SMA_EN != RKH_DISABLED))
872  #error "RKH_CFG_TRC_RTFIL_SMA_EN illegally #define'd in 'rkhcfg.h'"
873  #error " [MUST be RKH_ENABLED ] "
874  #error " [ || RKH_DISABLED] "
875  #endif
876 
877  #ifndef RKH_CFG_TRC_RTFIL_SIGNAL_EN
878  #error "RKH_CFG_TRC_RTFIL_SIGNAL_EN not #define'd in 'rkhcfg.h'"
879  #error " [MUST be RKH_ENABLED ] "
880  #error " [ || RKH_DISABLED] "
881 
882  #elif ((RKH_CFG_TRC_RTFIL_SIGNAL_EN != RKH_ENABLED) && \
883  (RKH_CFG_TRC_RTFIL_SIGNAL_EN != RKH_DISABLED))
884  #error "RKH_CFG_TRC_RTFIL_SIGNAL_EN illegally #define'd in 'rkhcfg.h'"
885  #error " [MUST be RKH_ENABLED ] "
886  #error " [ || RKH_DISABLED] "
887  #endif
888 
889  #ifndef RKH_CFG_TRC_USER_TRACE_EN
890  #error "RKH_CFG_TRC_USER_TRACE_EN not #define'd in 'rkhcfg.h'"
891  #error " [MUST be RKH_ENABLED ] "
892  #error " [ || RKH_DISABLED] "
893 
894  #elif ((RKH_CFG_TRC_USER_TRACE_EN != RKH_ENABLED) && \
895  (RKH_CFG_TRC_USER_TRACE_EN != RKH_DISABLED))
896  #error "RKH_CFG_TRC_USER_TRACE_EN illegally #define'd in 'rkhcfg.h'"
897  #error " [MUST be RKH_ENABLED ] "
898  #error " [ || RKH_DISABLED] "
899  #endif
900 
901  #ifndef RKH_CFG_TRC_ALL_EN
902  #error "RKH_CFG_TRC_ALL_EN not #define'd in 'rkhcfg.h'"
903  #error " [MUST be RKH_ENABLED ] "
904  #error " [ || RKH_DISABLED] "
905 
906  #elif ((RKH_CFG_TRC_ALL_EN != RKH_ENABLED) && \
907  (RKH_CFG_TRC_ALL_EN != RKH_DISABLED))
908  #error "RKH_CFG_TRC_ALL_EN illegally #define'd in 'rkhcfg.h'"
909  #error " [MUST be RKH_ENABLED ] "
910  #error " [ || RKH_DISABLED] "
911  #endif
912 
913  #ifndef RKH_CFG_TRC_MP_EN
914  #error "RKH_CFG_TRC_MP_EN not #define'd in 'rkhcfg.h'"
915  #error " [MUST be RKH_ENABLED ] "
916  #error " [ || RKH_DISABLED] "
917 
918  #elif ((RKH_CFG_TRC_MP_EN != RKH_ENABLED) && \
919  (RKH_CFG_TRC_MP_EN != RKH_DISABLED))
920  #error "RKH_CFG_TRC_MP_EN illegally #define'd in 'rkhcfg.h'"
921  #error " [MUST be RKH_ENABLED ] "
922  #error " [ || RKH_DISABLED] "
923  #endif
924 
925  #ifndef RKH_CFG_TRC_QUE_EN
926  #error "RKH_CFG_TRC_QUE_EN not #define'd in 'rkhcfg.h'"
927  #error " [MUST be RKH_ENABLED ] "
928  #error " [ || RKH_DISABLED] "
929 
930  #elif ((RKH_CFG_TRC_QUE_EN != RKH_ENABLED) && \
931  (RKH_CFG_TRC_QUE_EN != RKH_DISABLED))
932  #error "RKH_CFG_TRC_QUE_EN illegally #define'd in 'rkhcfg.h'"
933  #error " [MUST be RKH_ENABLED ] "
934  #error " [ || RKH_DISABLED] "
935  #endif
936 
937  #ifndef RKH_CFG_TRC_SMA_EN
938  #error "RKH_CFG_TRC_SMA_EN not #define'd in 'rkhcfg.h'"
939  #error " [MUST be RKH_ENABLED ] "
940  #error " [ || RKH_DISABLED] "
941 
942  #elif ((RKH_CFG_TRC_SMA_EN != RKH_ENABLED) && \
943  (RKH_CFG_TRC_SMA_EN != RKH_DISABLED))
944  #error "RKH_CFG_TRC_SMA_EN illegally #define'd in 'rkhcfg.h'"
945  #error " [MUST be RKH_ENABLED ] "
946  #error " [ || RKH_DISABLED] "
947  #endif
948 
949  #ifndef RKH_CFG_TRC_TMR_EN
950  #error "RKH_CFG_TRC_TMR_EN not #define'd in 'rkhcfg.h'"
951  #error " [MUST be RKH_ENABLED ] "
952  #error " [ || RKH_DISABLED] "
953 
954  #elif ((RKH_CFG_TRC_TMR_EN != RKH_ENABLED) && \
955  (RKH_CFG_TRC_TMR_EN != RKH_DISABLED))
956  #error "RKH_CFG_TRC_TMR_EN illegally #define'd in 'rkhcfg.h'"
957  #error " [MUST be RKH_ENABLED ] "
958  #error " [ || RKH_DISABLED] "
959  #endif
960 
961  #ifndef RKH_CFG_TRC_SM_EN
962  #error "RKH_CFG_TRC_SM_EN not #define'd in 'rkhcfg.h'"
963  #error " [MUST be RKH_ENABLED ] "
964  #error " [ || RKH_DISABLED] "
965 
966  #elif ((RKH_CFG_TRC_SM_EN != RKH_ENABLED) && \
967  (RKH_CFG_TRC_SM_EN != RKH_DISABLED))
968  #error "RKH_CFG_TRC_SM_EN illegally #define'd in 'rkhcfg.h'"
969  #error " [MUST be RKH_ENABLED ] "
970  #error " [ || RKH_DISABLED] "
971  #endif
972 
973  #ifndef RKH_CFG_TRC_FWK_EN
974  #error "RKH_CFG_TRC_FWK_EN not #define'd in 'rkhcfg.h'"
975  #error " [MUST be RKH_ENABLED ] "
976  #error " [ || RKH_DISABLED] "
977 
978  #elif ((RKH_CFG_TRC_FWK_EN != RKH_ENABLED) && \
979  (RKH_CFG_TRC_FWK_EN != RKH_DISABLED))
980  #error "RKH_CFG_TRC_FWK_EN illegally #define'd in 'rkhcfg.h'"
981  #error " [MUST be RKH_ENABLED ] "
982  #error " [ || RKH_DISABLED] "
983  #endif
984 
985  #ifndef RKH_CFG_TRC_ASSERT_EN
986  #error "RKH_CFG_TRC_ASSERT_EN not #define'd in 'rkhcfg.h'"
987  #error " [MUST be RKH_ENABLED ] "
988  #error " [ || RKH_DISABLED] "
989 
990  #elif ((RKH_CFG_TRC_ASSERT_EN != RKH_ENABLED) && \
991  (RKH_CFG_TRC_ASSERT_EN != RKH_DISABLED))
992  #error "RKH_CFG_TRC_ASSERT_EN illegally #define'd in 'rkhcfg.h'"
993  #error " [MUST be RKH_ENABLED ] "
994  #error " [ || RKH_DISABLED] "
995  #endif
996 
997  #ifndef RKH_CFG_TRC_SM_INIT_EN
998  #error "RKH_CFG_TRC_SM_INIT_EN not #define'd in 'rkhcfg.h'"
999  #error " [MUST be RKH_ENABLED ] "
1000  #error " [ || RKH_DISABLED] "
1001 
1002  #elif ((RKH_CFG_TRC_SM_INIT_EN != RKH_ENABLED) && \
1003  (RKH_CFG_TRC_SM_INIT_EN != RKH_DISABLED))
1004  #error "RKH_CFG_TRC_SM_INIT_EN illegally #define'd in 'rkhcfg.h'"
1005  #error " [MUST be RKH_ENABLED ] "
1006  #error " [ || RKH_DISABLED] "
1007  #endif
1008 
1009  #ifndef RKH_CFG_TRC_SM_DCH_EN
1010  #error "RKH_CFG_TRC_SM_DCH_EN not #define'd in 'rkhcfg.h'"
1011  #error " [MUST be RKH_ENABLED ] "
1012  #error " [ || RKH_DISABLED] "
1013 
1014  #elif ((RKH_CFG_TRC_SM_DCH_EN != RKH_ENABLED) && \
1015  (RKH_CFG_TRC_SM_DCH_EN != RKH_DISABLED))
1016  #error "RKH_CFG_TRC_SM_DCH_EN illegally #define'd in 'rkhcfg.h'"
1017  #error " [MUST be RKH_ENABLED ] "
1018  #error " [ || RKH_DISABLED] "
1019  #endif
1020 
1021  #ifndef RKH_CFG_TRC_SM_CLRH_EN
1022  #error "RKH_CFG_TRC_SM_CLRH_EN not #define'd in 'rkhcfg.h'"
1023  #error " [MUST be RKH_ENABLED ] "
1024  #error " [ || RKH_DISABLED] "
1025 
1026  #elif ((RKH_CFG_TRC_SM_CLRH_EN != RKH_ENABLED) && \
1027  (RKH_CFG_TRC_SM_CLRH_EN != RKH_DISABLED))
1028  #error "RKH_CFG_TRC_SM_CLRH_EN illegally #define'd in 'rkhcfg.h'"
1029  #error " [MUST be RKH_ENABLED ] "
1030  #error " [ || RKH_DISABLED] "
1031  #endif
1032 
1033  #ifndef RKH_CFG_TRC_SM_TRN_EN
1034  #error "RKH_CFG_TRC_SM_TRN_EN not #define'd in 'rkhcfg.h'"
1035  #error " [MUST be RKH_ENABLED ] "
1036  #error " [ || RKH_DISABLED] "
1037 
1038  #elif ((RKH_CFG_TRC_SM_TRN_EN != RKH_ENABLED) && \
1039  (RKH_CFG_TRC_SM_TRN_EN != RKH_DISABLED))
1040  #error "RKH_CFG_TRC_SM_TRN_EN illegally #define'd in 'rkhcfg.h'"
1041  #error " [MUST be RKH_ENABLED ] "
1042  #error " [ || RKH_DISABLED] "
1043  #endif
1044 
1045  #ifndef RKH_CFG_TRC_SM_STATE_EN
1046  #error "RKH_CFG_TRC_SM_STATE_EN not #define'd in 'rkhcfg.h'"
1047  #error " [MUST be RKH_ENABLED ] "
1048  #error " [ || RKH_DISABLED] "
1049 
1050  #elif ((RKH_CFG_TRC_SM_STATE_EN != RKH_ENABLED) && \
1051  (RKH_CFG_TRC_SM_STATE_EN != RKH_DISABLED))
1052  #error "RKH_CFG_TRC_SM_STATE_EN illegally #define'd in 'rkhcfg.h'"
1053  #error " [MUST be RKH_ENABLED ] "
1054  #error " [ || RKH_DISABLED] "
1055  #endif
1056 
1057  #ifndef RKH_CFG_TRC_SM_ENSTATE_EN
1058  #error "RKH_CFG_TRC_SM_ENSTATE_EN not #define'd in 'rkhcfg.h'"
1059  #error " [MUST be RKH_ENABLED ] "
1060  #error " [ || RKH_DISABLED] "
1061 
1062  #elif ((RKH_CFG_TRC_SM_ENSTATE_EN != RKH_ENABLED) && \
1063  (RKH_CFG_TRC_SM_ENSTATE_EN != RKH_DISABLED))
1064  #error "RKH_CFG_TRC_SM_ENSTATE_EN illegally #define'd in 'rkhcfg.h'"
1065  #error " [MUST be RKH_ENABLED ] "
1066  #error " [ || RKH_DISABLED] "
1067  #endif
1068 
1069  #ifndef RKH_CFG_TRC_SM_EXSTATE_EN
1070  #error "RKH_CFG_TRC_SM_EXSTATE_EN not #define'd in 'rkhcfg.h'"
1071  #error " [MUST be RKH_ENABLED ] "
1072  #error " [ || RKH_DISABLED] "
1073 
1074  #elif ((RKH_CFG_TRC_SM_EXSTATE_EN != RKH_ENABLED) && \
1075  (RKH_CFG_TRC_SM_EXSTATE_EN != RKH_DISABLED))
1076  #error "RKH_CFG_TRC_SM_EXSTATE_EN illegally #define'd in 'rkhcfg.h'"
1077  #error " [MUST be RKH_ENABLED ] "
1078  #error " [ || RKH_DISABLED] "
1079  #endif
1080 
1081  #ifndef RKH_CFG_TRC_SM_NENEX_EN
1082  #error "RKH_CFG_TRC_SM_NENEX_EN not #define'd in 'rkhcfg.h'"
1083  #error " [MUST be RKH_ENABLED ] "
1084  #error " [ || RKH_DISABLED] "
1085 
1086  #elif ((RKH_CFG_TRC_SM_NENEX_EN != RKH_ENABLED) && \
1087  (RKH_CFG_TRC_SM_NENEX_EN != RKH_DISABLED))
1088  #error "RKH_CFG_TRC_SM_NENEX_EN illegally #define'd in 'rkhcfg.h'"
1089  #error " [MUST be RKH_ENABLED ] "
1090  #error " [ || RKH_DISABLED] "
1091  #endif
1092 
1093  #ifndef RKH_CFG_TRC_SM_NTRNACT_EN
1094  #error "RKH_CFG_TRC_SM_NTRNACT_EN not #define'd in 'rkhcfg.h'"
1095  #error " [MUST be RKH_ENABLED ] "
1096  #error " [ || RKH_DISABLED] "
1097 
1098  #elif ((RKH_CFG_TRC_SM_NTRNACT_EN != RKH_ENABLED) && \
1099  (RKH_CFG_TRC_SM_NTRNACT_EN != RKH_DISABLED))
1100  #error "RKH_CFG_TRC_SM_NTRNACT_EN illegally #define'd in 'rkhcfg.h'"
1101  #error " [MUST be RKH_ENABLED ] "
1102  #error " [ || RKH_DISABLED] "
1103  #endif
1104 
1105  #ifndef RKH_CFG_TRC_SM_TS_STATE_EN
1106  #error "RKH_CFG_TRC_SM_TS_STATE_EN not #define'd in 'rkhcfg.h'"
1107  #error " [MUST be RKH_ENABLED ] "
1108  #error " [ || RKH_DISABLED] "
1109 
1110  #elif ((RKH_CFG_TRC_SM_TS_STATE_EN != RKH_ENABLED) && \
1111  (RKH_CFG_TRC_SM_TS_STATE_EN != RKH_DISABLED))
1112  #error "RKH_CFG_TRC_SM_TS_STATE_EN illegally #define'd in 'rkhcfg.h'"
1113  #error " [MUST be RKH_ENABLED ] "
1114  #error " [ || RKH_DISABLED] "
1115  #endif
1116 
1117  #ifndef RKH_CFG_TRC_SM_PROCESS_EN
1118  #error "RKH_CFG_TRC_SM_PROCESS_EN not #define'd in 'rkhcfg.h'"
1119  #error " [MUST be RKH_ENABLED ] "
1120  #error " [ || RKH_DISABLED] "
1121 
1122  #elif ((RKH_CFG_TRC_SM_PROCESS_EN != RKH_ENABLED) && \
1123  (RKH_CFG_TRC_SM_PROCESS_EN != RKH_DISABLED))
1124  #error "RKH_CFG_TRC_SM_PROCESS_EN illegally #define'd in 'rkhcfg.h'"
1125  #error " [MUST be RKH_ENABLED ] "
1126  #error " [ || RKH_DISABLED] "
1127  #endif
1128 
1129  #ifndef RKH_CFG_TRC_SM_EXE_ACT_EN
1130  #error "RKH_CFG_TRC_SM_EXE_ACT_EN not #define'd in 'rkhcfg.h'"
1131  #error " [MUST be RKH_ENABLED ] "
1132  #error " [ || RKH_DISABLED] "
1133 
1134  #elif ((RKH_CFG_TRC_SM_EXE_ACT_EN != RKH_ENABLED) && \
1135  (RKH_CFG_TRC_SM_EXE_ACT_EN != RKH_DISABLED))
1136  #error "RKH_CFG_TRC_SM_EXE_ACT_EN illegally #define'd in 'rkhcfg.h'"
1137  #error " [MUST be RKH_ENABLED ] "
1138  #error " [ || RKH_DISABLED] "
1139  #endif
1140 
1141  #ifndef RKH_CFG_TRC_NSEQ_EN
1142  #error "RKH_CFG_TRC_NSEQ_EN not #define'd in 'rkhcfg.h'"
1143  #error " [MUST be RKH_ENABLED ] "
1144  #error " [ || RKH_DISABLED] "
1145 
1146  #elif ((RKH_CFG_TRC_NSEQ_EN != RKH_ENABLED) && \
1147  (RKH_CFG_TRC_NSEQ_EN != RKH_DISABLED))
1148  #error "RKH_CFG_TRC_NSEQ_EN illegally #define'd in 'rkhcfg.h'"
1149  #error " [MUST be RKH_ENABLED ] "
1150  #error " [ || RKH_DISABLED] "
1151  #endif
1152 
1153  #ifndef RKH_CFG_TRC_CHK_EN
1154  #error "RKH_CFG_TRC_CHK_EN not #define'd in 'rkhcfg.h'"
1155  #error " [MUST be RKH_ENABLED ] "
1156  #error " [ || RKH_DISABLED] "
1157 
1158  #elif ((RKH_CFG_TRC_CHK_EN != RKH_ENABLED) && \
1159  (RKH_CFG_TRC_CHK_EN != RKH_DISABLED))
1160  #error "RKH_CFG_TRC_CHK_EN illegally #define'd in 'rkhcfg.h'"
1161  #error " MUST be RKH_ENABLED ] "
1162  #error " || RKH_DISABLED] "
1163  #endif
1164 
1165  #ifndef RKH_CFG_TRC_TSTAMP_EN
1166  #error "RKH_CFG_TRC_TSTAMP_EN not #define'd in 'rkhcfg.h'"
1167  #error " MUST be RKH_ENABLED ] "
1168  #error " [ || RKH_DISABLED] "
1169 
1170  #elif ((RKH_CFG_TRC_TSTAMP_EN != RKH_ENABLED) && \
1171  (RKH_CFG_TRC_TSTAMP_EN != RKH_DISABLED))
1172  #error "RKH_CFG_TRC_TSTAMP_EN illegally #define'd in 'rkhcfg.h'"
1173  #error " [MUST be RKH_ENABLED ] "
1174  #error " [ || RKH_DISABLED] "
1175  #endif
1176 
1177  #ifndef RKH_CFGPORT_TRC_SIZEOF_TSTAMP
1178  #error "RKH_CFGPORT_TRC_SIZEOF_TSTAMP not #define'd in 'rkhcfg.h'"
1179  #error " [MUST be 8 ( 8-bit size)] "
1180  #error " [ || 16 (16-bit size)] "
1181  #error " [ || 32 (32-bit size)] "
1182 
1183  #elif ((RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 8) && \
1184  (RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 16) && \
1185  (RKH_CFGPORT_TRC_SIZEOF_TSTAMP != 32))
1186  #error "RKH_CFGPORT_TRC_SIZEOF_TSTAMP illegally #define'd in 'rkhcfg.h'"
1187  #error " [MUST be 8 ( 8-bit size)] "
1188  #error " [ || 16 (16-bit size)] "
1189  #error " [ || 32 (32-bit size)] "
1190  #endif
1191 
1192  #ifndef RKH_CFGPORT_SMA_QSTO_EN
1193  #error "RKH_CFGPORT_SMA_QSTO_EN not #define'd in 'rkhcfg.h'"
1194  #error " [MUST be RKH_ENABLED ] "
1195  #error " [ || RKH_DISABLED] "
1196 
1197  #elif ((RKH_CFGPORT_SMA_QSTO_EN != RKH_ENABLED) && \
1198  (RKH_CFGPORT_SMA_QSTO_EN != RKH_DISABLED))
1199  #error "RKH_CFGPORT_SMA_QSTO_EN illegally #define'd in 'rkhcfg.h'"
1200  #error " [MUST be RKH_ENABLED ] "
1201  #error " [ || RKH_DISABLED] "
1202  #endif
1203 
1204  #ifndef RKH_CFGPORT_SMA_STK_EN
1205  #error "RKH_CFGPORT_SMA_STK_EN not #define'd in 'rkhcfg.h'"
1206  #error " [MUST be RKH_ENABLED ] "
1207  #error " [ || RKH_DISABLED] "
1208 
1209  #elif ((RKH_CFGPORT_SMA_STK_EN != RKH_ENABLED) && \
1210  (RKH_CFGPORT_SMA_STK_EN != RKH_DISABLED))
1211  #error "RKH_CFGPORT_SMA_STK_EN illegally #define'd in 'rkhcfg.h'"
1212  #error " [MUST be RKH_ENABLED ] "
1213  #error " [ || RKH_DISABLED] "
1214  #endif
1215 
1216  #ifndef RKH_CFG_TRC_SIZEOF_STREAM
1217  #error "RKH_CFG_TRC_SIZEOF_STREAM not #define'd in 'rkhcfg.h'"
1218  #error " [MUST be > 0] "
1219  #error " [ && <= 2048] "
1220 
1221  #elif ((RKH_CFG_TRC_SIZEOF_STREAM == 0) || \
1222  (RKH_CFG_TRC_SIZEOF_STREAM > 2048))
1223  #error "RKH_CFG_TRC_SIZEOF_STREAM illegally #define'd in 'rkhcfg.h'"
1224  #error " [MUST be > 0] "
1225  #error " [ && <= 2048] "
1226  #endif
1227 
1228 #endif
1229 
1230 /* FRAMEWORK --------------------------------------------------------- */
1231 #ifndef RKH_CFG_FWK_MAX_SMA
1232  #error "RKH_CFG_FWK_MAX_SMA not #define'd in 'rkhcfg.h'"
1233  #error " [MUST be >= 1] "
1234  #error " [ && <= 64] "
1235 
1236 #elif ((RKH_CFG_FWK_MAX_SMA == 0) || (RKH_CFG_FWK_MAX_SMA > 64))
1237  #error "RKH_CFG_FWK_MAX_SMA illegally #define'd in 'rkhcfg.h'"
1238  #error " [MUST be >= 1] "
1239  #error " [ && <= 64] "
1240 
1241 #endif
1242 
1243 #ifndef RKH_CFG_FWK_DYN_EVT_EN
1244  #error "RKH_CFG_FWK_DYN_EVT_EN not #define'd in 'rkhcfg.h'"
1245  #error " [MUST be RKH_ENABLED ] "
1246  #error " [ || RKH_DISABLED] "
1247 
1248 #elif (RKH_CFG_FWK_DYN_EVT_EN == RKH_DISABLED)
1249 
1250  /*
1251  * If the dynamic event support is disabled, RKH not allows to use
1252  * events with parameters, defer/recall mechanism, allocating and
1253  * recycling dynamic events, among other features.
1254  */
1255  #undef RKH_CFGPORT_NATIVE_DYN_EVT_EN
1256  #define RKH_CFGPORT_NATIVE_DYN_EVT_EN RKH_DISABLED
1257 
1258 #endif
1259 
1260 #ifndef RKH_CFG_FWK_MAX_EVT_POOL
1261  #error "RKH_CFG_FWK_MAX_EVT_POOL not #define'd in 'rkhcfg.h'"
1262  #error " [MUST be > 0] "
1263  #error " [ && < 256] "
1264 
1265 #elif (RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED)
1266  #if ((RKH_CFG_FWK_MAX_EVT_POOL == 0) || (RKH_CFG_FWK_MAX_EVT_POOL > 255))
1267  #error "RKH_CFG_FWK_MAX_EVT_POOL illegally #define'd in 'rkhcfg.h'"
1268  #error " [MUST be > 0] "
1269  #error " [ && < 256] "
1270  #endif
1271 
1272 #endif
1273 
1274 #ifndef RKH_CFG_FWK_SIZEOF_EVT
1275  #error "RKH_CFG_FWK_SIZEOF_EVT not #define'd in 'rkhcfg.h'"
1276  #error " [MUST be 8 ( 8-bit size)] "
1277  #error " [ || 16 (16-bit size)] "
1278  #error " [ || 32 (32-bit size)] "
1279 
1280 #elif ((RKH_CFG_FWK_SIZEOF_EVT != 8) && \
1281  (RKH_CFG_FWK_SIZEOF_EVT != 16) && \
1282  (RKH_CFG_FWK_SIZEOF_EVT != 32))
1283  #error "RKH_CFG_FWK_SIZEOF_EVT illegally #define'd in 'rkhcfg.h'"
1284  #error " [MUST be 8 ( 8-bit size)] "
1285  #error " [ || 16 (16-bit size)] "
1286  #error " [ || 32 (32-bit size)] "
1287 
1288 #endif
1289 
1290 #ifndef RKH_CFG_FWK_MAX_SIGNALS
1291  #error "RKH_CFG_FWK_MAX_SIGNALS not #define'd in 'rkhcfg.h'"
1292  #error " [MUST be > 0] "
1293  #error " [MUST be < 2^RKH_CFG_FWK_SIZEOF_EVT "
1294 
1295 #elif ((RKH_CFG_FWK_MAX_SIGNALS == 0u) || \
1296  (RKH_CFG_FWK_MAX_SIGNALS >= RKH_BIT(RKH_CFG_FWK_SIZEOF_EVT)))
1297  #error "RKH_CFG_FWK_MAX_SIGNALS illegally #define'd in 'rkhcfg.h'"
1298  #error " [MUST be > 0] "
1299  #error " [MUST be < 2^RKH_CFG_FWK_SIZEOF_EVT "
1300 
1301 #endif
1302 
1303 #ifndef RKH_CFG_FWK_SIZEOF_EVT_SIZE
1304  #error "RKH_CFG_FWK_SIZEOF_EVT_SIZE not #define'd in 'rkhcfg.h'"
1305  #error " [MUST be 8 ( 8-bit size)] "
1306  #error " [ || 16 (16-bit size)] "
1307  #error " [ || 32 (32-bit size)] "
1308 
1309 #elif ((RKH_CFG_FWK_SIZEOF_EVT_SIZE != 8) && \
1310  (RKH_CFG_FWK_SIZEOF_EVT_SIZE != 16) && \
1311  (RKH_CFG_FWK_SIZEOF_EVT_SIZE != 32))
1312  #error "RKH_CFG_FWK_SIZEOF_EVT_SIZE illegally #define'd in 'rkhcfg.h'"
1313  #error " [MUST be 8 ( 8-bit size)] "
1314  #error " [ || 16 (16-bit size)] "
1315  #error " [ || 32 (32-bit size)] "
1316 
1317 #endif
1318 
1319 #ifndef RKH_CFG_FWK_DEFER_EVT_EN
1320  #error "RKH_CFG_FWK_DEFER_EVT_EN not #define'd in 'rkhcfg.h'"
1321  #error " [MUST be RKH_ENABLED ] "
1322  #error " [ || RKH_DISABLED] "
1323 
1324 #elif ((RKH_CFG_FWK_DEFER_EVT_EN == RKH_ENABLED) && \
1325  (RKH_CFG_QUE_EN == RKH_DISABLED))
1326  #error "RKH_CFG_QUE_EN illegally #define'd in 'rkhcfg.h'"
1327  #error " [MUST be RKH_ENABLED ] "
1328 
1329 #endif
1330 
1331 #ifndef RKH_CFG_FWK_ASSERT_EN
1332  #error "RKH_CFG_FWK_ASSERT_EN not #define'd in 'rkhport.h'"
1333  #error " [MUST be RKH_ENABLED ] "
1334  #error " [ || RKH_DISABLED] "
1335 
1336 #elif ((RKH_CFG_FWK_ASSERT_EN != RKH_ENABLED) && \
1337  (RKH_CFG_FWK_ASSERT_EN != RKH_DISABLED))
1338  #error "RKH_CFG_FWK_ASSERT_EN illegally #define'd in 'rkhport.h'"
1339  #error " [MUST be RKH_ENABLED ] "
1340  #error " [ || RKH_DISABLED] "
1341 
1342 #endif
1343 
1344 #ifndef RKH_CFG_HOOK_DISPATCH_EN
1345  #error "RKH_CFG_HOOK_DISPATCH_EN not #define'd in 'rkhcfg.h'"
1346  #error " [MUST be RKH_ENABLED ] "
1347  #error " [ || RKH_DISABLED] "
1348 
1349 #elif ((RKH_CFG_HOOK_DISPATCH_EN != RKH_ENABLED) && \
1350  (RKH_CFG_HOOK_DISPATCH_EN != RKH_DISABLED))
1351  #error "RKH_CFG_HOOK_DISPATCH_EN illegally #define'd in 'rkhcfg.h'"
1352  #error " [MUST be RKH_ENABLED ] "
1353  #error " [ || RKH_DISABLED] "
1354 
1355 #endif
1356 
1357 #ifndef RKH_CFG_HOOK_SIGNAL_EN
1358  #error "RKH_CFG_HOOK_SIGNAL_EN not #define'd in 'rkhcfg.h'"
1359  #error " [MUST be RKH_ENABLED ] "
1360  #error " [ || RKH_DISABLED] "
1361 
1362 #elif ((RKH_CFG_HOOK_SIGNAL_EN != RKH_ENABLED) && \
1363  (RKH_CFG_HOOK_SIGNAL_EN != RKH_DISABLED))
1364  #error "RKH_CFG_HOOK_SIGNAL_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_TIMEOUT_EN
1371  #error "RKH_CFG_HOOK_TIMEOUT_EN not #define'd in 'rkhcfg.h'"
1372  #error " [MUST be RKH_ENABLED ] "
1373  #error " [ || RKH_DISABLED] "
1374 
1375 #elif ((RKH_CFG_HOOK_TIMEOUT_EN != RKH_ENABLED) && \
1376  (RKH_CFG_HOOK_TIMEOUT_EN != RKH_DISABLED))
1377  #error "RKH_CFG_HOOK_TIMEOUT_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_START_EN
1384  #error "RKH_CFG_HOOK_START_EN not #define'd in 'rkhcfg.h'"
1385  #error " [MUST be RKH_ENABLED ] "
1386  #error " [ || RKH_DISABLED] "
1387 
1388 #elif ((RKH_CFG_HOOK_START_EN != RKH_ENABLED) && \
1389  (RKH_CFG_HOOK_START_EN != RKH_DISABLED))
1390  #error "RKH_CFG_HOOK_START_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_EXIT_EN
1397  #error "RKH_CFG_HOOK_EXIT_EN not #define'd in 'rkhcfg.h'"
1398  #error " [MUST be RKH_ENABLED ] "
1399  #error " [ || RKH_DISABLED] "
1400 
1401 #elif ((RKH_CFG_HOOK_EXIT_EN != RKH_ENABLED) && \
1402  (RKH_CFG_HOOK_EXIT_EN != RKH_DISABLED))
1403  #error "RKH_CFG_HOOK_EXIT_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_TIMETICK_EN
1410  #error "RKH_CFG_HOOK_TIMETICK_EN not #define'd in 'rkhcfg.h'"
1411  #error " [MUST be RKH_ENABLED ] "
1412  #error " [ || RKH_DISABLED] "
1413 
1414 #elif ((RKH_CFG_HOOK_TIMETICK_EN != RKH_ENABLED) && \
1415  (RKH_CFG_HOOK_TIMETICK_EN != RKH_DISABLED))
1416  #error "RKH_CFG_HOOK_TIMETICK_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_PUT_TRCEVT_EN
1423  #error "RKH_CFG_HOOK_PUT_TRCEVT_EN not #define'd in 'rkhcfg.h'"
1424  #error " [MUST be RKH_ENABLED ] "
1425  #error " [ || RKH_DISABLED] "
1426 
1427 #elif ((RKH_CFG_HOOK_PUT_TRCEVT_EN != RKH_ENABLED) && \
1428  (RKH_CFG_HOOK_PUT_TRCEVT_EN != RKH_DISABLED))
1429  #error "RKH_CFG_HOOK_PUT_TRCEVT_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_SMA_INIT_EVT_EN
1436  #error "RKH_CFG_SMA_INIT_EVT_EN not #define'd in 'rkhcfg.h'"
1437  #error " [MUST be RKH_ENABLED ] "
1438  #error " [ || RKH_DISABLED] "
1439 
1440 #elif ((RKH_CFG_SMA_INIT_EVT_EN != RKH_ENABLED) && \
1441  (RKH_CFG_SMA_INIT_EVT_EN != RKH_DISABLED))
1442  #error "RKH_CFG_SMA_INIT_EVT_EN illegally #define'd in 'rkhcfg.h'"
1443  #error " [MUST be RKH_ENABLED ] "
1444  #error " [ || RKH_DISABLED] "
1445 
1446 #endif
1447 
1448 /* PORT --------------------------------------------------------- */
1449 #ifndef RKH_CFGPORT_SMA_THREAD_EN
1450  #error "RKH_CFGPORT_SMA_THREAD_EN not #define'd in 'rkhport.h'"
1451  #error " [MUST be RKH_ENABLED ] "
1452  #error " [ || RKH_DISABLED] "
1453 
1454 #elif ((RKH_CFGPORT_SMA_THREAD_EN != RKH_ENABLED) && \
1455  (RKH_CFGPORT_SMA_THREAD_EN != RKH_DISABLED))
1456  #error "RKH_CFGPORT_SMA_THREAD_EN illegally #define'd in 'rkhport.h'"
1457  #error " [MUST be RKH_ENABLED ] "
1458  #error " [ || RKH_DISABLED] "
1459 
1460 #endif
1461 
1462 #ifndef RKH_CFGPORT_SMA_THREAD_DATA_EN
1463  #error "RKH_CFGPORT_SMA_THREAD_DATA_EN not #define'd in 'rkhport.h'"
1464  #error " [MUST be RKH_ENABLED ] "
1465  #error " [ || RKH_DISABLED] "
1466 
1467 #elif ((RKH_CFGPORT_SMA_THREAD_DATA_EN != RKH_ENABLED) && \
1468  (RKH_CFGPORT_SMA_THREAD_DATA_EN != RKH_DISABLED))
1469  #error "RKH_CFGPORT_SMA_THREAD_DATA_EN illegally #define'd in 'rkhport.h'"
1470  #error " [MUST be RKH_ENABLED ] "
1471  #error " [ || RKH_DISABLED] "
1472 
1473 #endif
1474 
1475 #ifndef RKH_CFGPORT_NATIVE_SCHEDULER_EN
1476  #error "RKH_CFGPORT_NATIVE_SCHEDULER_EN not #define'd in 'rkhport.h'"
1477  #error " [MUST be RKH_ENABLED ] "
1478  #error " [ || RKH_DISABLED] "
1479 
1480 #elif ((RKH_CFGPORT_NATIVE_SCHEDULER_EN != RKH_ENABLED) && \
1481  (RKH_CFGPORT_NATIVE_SCHEDULER_EN != RKH_DISABLED))
1482  #error "RKH_CFGPORT_NATIVE_SCHEDULER_EN illegally #define'd in 'rkhport.h'"
1483  #error " [MUST be RKH_ENABLED ] "
1484  #error " [ || RKH_DISABLED] "
1485 
1486 #endif
1487 
1488 #ifndef RKH_CFGPORT_NATIVE_EQUEUE_EN
1489  #error "RKH_CFGPORT_NATIVE_EQUEUE_EN not #define'd in 'rkhport.h'"
1490  #error " [MUST be RKH_ENABLED ] "
1491  #error " [ || RKH_DISABLED] "
1492 
1493 #elif ((RKH_CFGPORT_NATIVE_EQUEUE_EN != RKH_ENABLED) && \
1494  (RKH_CFGPORT_NATIVE_EQUEUE_EN != RKH_DISABLED))
1495  #error "RKH_CFGPORT_NATIVE_EQUEUE_EN illegally #define'd in 'rkhport.h'"
1496  #error " [MUST be RKH_ENABLED ] "
1497  #error " [ || RKH_DISABLED] "
1498 
1499 #elif ((RKH_CFGPORT_NATIVE_EQUEUE_EN == RKH_ENABLED) && \
1500  (RKH_CFG_QUE_EN != RKH_ENABLED))
1501  #error "RKH_CFG_QUE_EN illegally #define'd in 'rkhcfg.h'"
1502  #error " [MUST be RKH_ENABLED ] "
1503  #error " [ || RKH_DISABLED] "
1504 
1505 #endif
1506 
1507 #ifndef RKH_CFGPORT_NATIVE_DYN_EVT_EN
1508  #error "RKH_CFGPORT_NATIVE_DYN_EVT_EN not #define'd in 'rkhport.h'"
1509  #error " [MUST be RKH_ENABLED ] "
1510  #error " [ || RKH_DISABLED] "
1511 
1512 #elif ((RKH_CFGPORT_NATIVE_DYN_EVT_EN != RKH_ENABLED) && \
1513  (RKH_CFGPORT_NATIVE_DYN_EVT_EN != RKH_DISABLED))
1514  #error "RKH_CFGPORT_NATIVE_DYN_EVT_EN illegally #define'd in 'rkhport.h'"
1515  #error " [MUST be RKH_ENABLED ] "
1516  #error " [ || RKH_DISABLED] "
1517 
1518 #elif (RKH_CFGPORT_NATIVE_DYN_EVT_EN == RKH_ENABLED)
1519  #if ((RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED) && \
1520  (RKH_CFG_MP_EN == RKH_DISABLED))
1521  #error "RKH_CFG_FWK_DYN_EVT_EN illegally #define'd in 'rkhcfg.h'"
1522  #error " [MUST be RKH_ENABLED ] "
1523  #error "RKH_CFG_MP_EN illegally #define'd in 'rkhcfg.h'"
1524  #error " [MUST be RKH_ENABLED ] "
1525  #endif
1526 
1527 #endif
1528 
1529 #ifndef RKH_CFGPORT_REENTRANT_EN
1530  #error "RKH_CFGPORT_REENTRANT_EN not #define'd in 'rkhport.h'"
1531  #error " [MUST be RKH_ENABLED ] "
1532  #error " [ || RKH_DISABLED] "
1533 
1534 #elif ((RKH_CFGPORT_REENTRANT_EN != RKH_ENABLED) && \
1535  (RKH_CFGPORT_REENTRANT_EN != RKH_DISABLED))
1536  #error "RKH_CFGPORT_REENTRANT_EN illegally #define'd in 'rkhport.h'"
1537  #error " [MUST be RKH_ENABLED ] "
1538  #error " [ || RKH_DISABLED] "
1539 
1540 #endif
1541 
1542 #ifndef RKH_CFGPORT_TRC_SIZEOF_PTR
1543  #error "RKH_CFGPORT_TRC_SIZEOF_PTR not #define'd in 'rkhport.h'"
1544  #error " [MUST be 8 ( 8-bit pointer)] "
1545  #error " [ || 16 (16-bit pointer)] "
1546  #error " [ || 32 (32-bit pointer)] "
1547 
1548 #elif ((RKH_CFGPORT_TRC_SIZEOF_PTR != 8) && \
1549  (RKH_CFGPORT_TRC_SIZEOF_PTR != 16) && \
1550  (RKH_CFGPORT_TRC_SIZEOF_PTR != 32))
1551  #error "RKH_CFGPORT_TRC_SIZEOF_PTR illegally #define'd in 'rkhport.h'"
1552  #error " [MUST be 8 ( 8-bit pointer)] "
1553  #error " [ || 16 (16-bit pointer)] "
1554  #error " [ || 32 (32-bit pointer)] "
1555 
1556 #endif
1557 
1558 #ifndef RKH_CFGPORT_TRC_SIZEOF_FUN_PTR
1559  #error "RKH_CFGPORT_TRC_SIZEOF_FUN_PTR not #define'd in 'rkhport.h'"
1560  #error " [MUST be 8 ( 8-bit pointer)] "
1561  #error " [ || 16 (16-bit pointer)] "
1562  #error " [ || 32 (32-bit pointer)] "
1563 
1564 #elif ((RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 8) && \
1565  (RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 16) && \
1566  (RKH_CFGPORT_TRC_SIZEOF_FUN_PTR != 32))
1567  #error "RKH_CFGPORT_TRC_SIZEOF_FUN_PTR illegally #define'd in 'rkhport.h'"
1568  #error " [MUST be 8 ( 8-bit pointer)] "
1569  #error " [ || 16 (16-bit pointer)] "
1570  #error " [ || 32 (32-bit pointer)] "
1571 
1572 #endif
1573 
1584 #define RKH_TICK_RATE_MS \
1585  ((RKH_TNT_T)(1000 / RKH_CFG_FWK_TICK_RATE_HZ))
1586 
1596 #define RKH_TIME_MS(ms_) ((ms_) / RKH_TICK_RATE_MS)
1597 #define RKH_TIME_SEC(s_) ((s_) * 1000u / RKH_TICK_RATE_MS)
1598 #define RKH_TIME_MIN(m_) ((m_) * 60 * 1000u / RKH_TICK_RATE_MS)
1599 
1601 /*
1602  * The following macros and constants are INTERNAL to RKH and
1603  * the user application should NOT call it.
1604  */
1605 
1606 #define RKH_REGULAR 0x80
1607 #define RKH_PSEUDO 0
1608 #define RKH_TYPE(t,i) (t | i)
1609 
1610 #define RKH_UNKNOWN_VERTEX RKH_TYPE(0, 0)
1611 #define RKH_BASIC RKH_TYPE(RKH_REGULAR, 0)
1612 #define RKH_COMPOSITE RKH_TYPE(RKH_REGULAR, 0x01)
1613 #define RKH_SUBMACHINE RKH_TYPE(RKH_REGULAR, 0x02)
1614 #define RKH_REF_SUBMACHINE RKH_TYPE(RKH_REGULAR, 0x04)
1615 #define RKH_FINAL RKH_TYPE(RKH_REGULAR, 0x08)
1616 
1617 #define RKH_CONDITIONAL RKH_TYPE(RKH_PSEUDO, 0x02)
1618 #define RKH_CHOICE RKH_TYPE(RKH_PSEUDO, 0x04)
1619 #define RKH_SHISTORY RKH_TYPE(RKH_PSEUDO, 0x08)
1620 #define RKH_DHISTORY RKH_TYPE(RKH_PSEUDO, 0x10)
1621 #define RKH_ENPOINT RKH_TYPE(RKH_PSEUDO, 0x20)
1622 #define RKH_EXPOINT RKH_TYPE(RKH_PSEUDO, 0x40)
1623 
1624 #define RKH_NO_HISTORY RKH_UNKNOWN_VERTEX
1625 
1626 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_DISABLED || \
1627  (RKH_CFG_SMA_DEEP_HIST_EN == RKH_DISABLED && \
1628  RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_DISABLED && \
1629  RKH_CFG_SMA_SUBMACHINE_EN == RKH_DISABLED && \
1630  RKH_CFG_SMA_CONDITIONAL_EN == RKH_DISABLED && \
1631  RKH_CFG_SMA_CHOICE_EN == RKH_DISABLED))
1632  #define RKH_PSEUDOSTATE RKH_DISABLED
1633 #else
1634  #define RKH_PSEUDOSTATE RKH_ENABLED
1635 #endif
1636 
1637 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1638  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1639  (RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_ENABLED || \
1640  RKH_CFG_SMA_DEEP_HIST_EN == RKH_ENABLED))
1641  #define RKH_HISTORY_ENABLED
1642 #endif
1643 
1644 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1645  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1646  RKH_CFG_SMA_DEEP_HIST_EN == RKH_ENABLED)
1647  #define RKH_DEEP_ENABLED
1648 #endif
1649 
1650 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED && \
1651  RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1652  RKH_CFG_SMA_SHALLOW_HIST_EN == RKH_ENABLED)
1653  #define RKH_SHALLOW_ENABLED
1654 #endif
1655 
1656 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1657  RKH_CFG_SMA_SUBMACHINE_EN == RKH_ENABLED)
1658  #define RKH_SUBMACHINE_ENABLED
1659 #endif
1660 
1661 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1662  RKH_CFG_SMA_CHOICE_EN == RKH_ENABLED)
1663  #define RKH_CHOICE_ENABLED
1664 #endif
1665 
1666 #if (RKH_CFG_SMA_PSEUDOSTATE_EN == RKH_ENABLED && \
1667  (RKH_CFG_SMA_CONDITIONAL_EN == RKH_ENABLED || \
1668  RKH_CFG_SMA_CHOICE_EN == RKH_ENABLED))
1669  #define RKH_CHOICE_OR_CONDITIONAL_ENABLED
1670 #endif
1671 
1672 #if (RKH_CFG_TRC_EN == RKH_ENABLED && \
1673  (RKH_CFG_TRC_ALL_EN == RKH_ENABLED || \
1674  RKH_CFG_TRC_SMA_EN == RKH_ENABLED || \
1675  RKH_CFG_TRC_SM_EN == RKH_ENABLED || \
1676  RKH_CFG_TRC_FWK_EN == RKH_ENABLED))
1677  #define R_TRC_AO_NAME_EN RKH_ENABLED
1678 #else
1679  #define R_TRC_AO_NAME_EN RKH_DISABLED
1680 #endif
1681 
1682 #define MKTRN(evt_, guard_, effect_, target_) \
1683  { \
1684  evt_, (RKH_GUARD_T)guard_, \
1685  (RKH_TRN_ACT_T)effect_, (RKHROM RKH_ST_T *)target_ \
1686  }
1687 
1688 #if RKH_CFG_SMA_SM_CONST_EN == RKH_ENABLED
1689  #define MKSM(constSM, initialState) \
1690  (RKHROM RKH_ROM_T *)(constSM), \
1691  (RKHROM RKH_ST_T *)(initialState)
1693  #if RKH_CFG_SMA_VFUNCT_EN == RKH_ENABLED
1694  #define MKSMA(constSM, initialState) \
1695  { \
1696  MKSM(constSM, initialState), \
1697  &rkhSmaVtbl \
1698  }
1699  #else
1700  #define MKSMA(constSM, initialState) \
1701  { \
1702  MKSM(constSM, initialState) \
1703  }
1704  #endif
1705 #else
1706  #if (RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
1707  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1708  #define MKSM(name, prio, ppty, initialState, initialAction, \
1709  initialEvt) \
1710  (prio), (ppty), #name, (RKHROM RKH_ST_T*)initialState, \
1711  ((RKH_INIT_ACT_T)initialAction), (initialEvt), \
1712  (RKHROM RKH_ST_T*)initialState
1713  #else
1714  #define MKSM(name, prio, ppty, initialState, initialAction, \
1715  initialEvt) \
1716  (prio), (ppty), (RKHROM RKH_ST_T*)initialState, \
1717  ((RKH_INIT_ACT_T)initialAction), (initialEvt), \
1718  (RKHROM RKH_ST_T*)initialState
1719  #endif
1720  #else
1721  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1722  #define MKSM(name, prio, ppty, initialState, initialAction, \
1723  initialEvt) \
1724  (prio), (ppty), #name, (RKHROM RKH_ST_T*)initialState, \
1725  ((RKH_INIT_ACT_T)initialAction), \
1726  (RKHROM RKH_ST_T*)initialState
1727  #else
1728  #define MKSM(name, prio, ppty, initialState, initialAction, \
1729  initialEvt) \
1730  (prio), (ppty), (RKHROM RKH_ST_T*)initialState, \
1731  ((RKH_INIT_ACT_T)initialAction), \
1732  (RKHROM RKH_ST_T*)initialState
1733  #endif
1734  #endif
1735  #if RKH_CFG_SMA_VFUNCT_EN == RKH_ENABLED
1736  #define MKSMA(name, prio, ppty, \
1737  initialState, initialAction, initialEvt) \
1738  { \
1739  MKSM(name, prio, ppty, initialState, \
1740  initialAction, initialEvt), /* RKH_SM_T members */ \
1741  &rkhSmaVtbl \
1742  }
1743  #else
1744  #define MKSMA(name, prio, ppty, \
1745  initialState, initialAction, initialEvt) \
1746  { \
1747  MKSM(name, prio, ppty, initialState, \
1748  initialAction, initialEvt) /* RKH_SM_T members */ \
1749  }
1750  #endif
1751 
1752  #define MKRT_SM(sm_, name_, prio_, ppty_, initialState_, initialAction_, \
1753  initialEvt_) \
1754  ((RKH_SM_T *)(sm_))->prio = prio_; \
1755  ((RKH_SM_T *)(sm_))->ppty = ppty_; \
1756  MKSM_NAME(sm_, name_); \
1757  ((RKH_SM_T *)(sm_))->istate = (RKHROM RKH_ST_T*)initialState_; \
1758  ((RKH_SM_T *)(sm_))->iaction = (RKH_INIT_ACT_T)initialAction_; \
1759  MKSM_IEVENT(sm_, initialEvt_); \
1760  ((RKH_SM_T *)(sm_))->state = (RKHROM RKH_ST_T*)initialState_
1761 
1762  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1763  #if RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED
1764  #define MKSM_NAME(sm_, name_) \
1765  ((RKH_SM_T *)sm_)->name = #name_
1766  #define MKSM_IEVENT(sm_, ievent_) \
1767  ((RKH_SM_T *)sm_)->ievent = ievent_
1768  #else
1769  #define MKSM_NAME(sm_, name_) \
1770  ((RKH_SM_T *)sm_)->name = #name_
1771  #define MKSM_IEVENT(sm_, ievent_)
1772  #endif
1773  #else
1774  #if RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED
1775  #define MKSM_NAME(sm_, name_) \
1776  #define MKSM_IEVENT(sm_, ievent_) \
1777  ((RKH_SM_T *)sm_)->ievent = ievent_
1778  #else
1779  #define MKSM_NAME(sm_, name_) \
1780  #define MKSM_IEVENT(sm_, ievent_)
1781  #endif
1782  #endif
1783 #endif
1784 
1785 #if (RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
1786  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1787  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1788  { \
1789  (prio), (ppty), # name, (RKHROM RKH_ST_T *)is, \
1790  (RKH_INIT_ACT_T)(ia), (ie) \
1791  }
1792  #else
1793  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1794  { \
1795  (prio), (ppty), (RKHROM RKH_ST_T *)is, \
1796  (RKH_INIT_ACT_T)(ia), (ie) \
1797  }
1798  #endif
1799 #else
1800  #if R_TRC_AO_NAME_EN == RKH_ENABLED
1801  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1802  { \
1803  (prio), (ppty), # name, (RKHROM RKH_ST_T *)is, \
1804  (RKH_INIT_ACT_T)(ia) \
1805  }
1806  #else
1807  #define MKRRKH(name, prio, ppty, is, ia, ie) \
1808  { \
1809  (prio), (ppty), (RKHROM RKH_ST_T *)is, \
1810  (RKH_INIT_ACT_T)(ia) \
1811  }
1812  #endif
1813 #endif
1814 
1815 #if R_TRC_AO_NAME_EN == RKH_ENABLED
1816  #define MKBASE(t, n) {t, # n}
1817 #else
1818  #define MKBASE(t, n) {t}
1819 #endif
1820 
1821 #if (RKH_CFG_SMA_HCAL_EN == RKH_ENABLED)
1822  #if (RKH_CFG_SMA_PPRO_EN == RKH_ENABLED)
1823  #if defined(RKH_HISTORY_ENABLED)
1824  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
1825  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL, d, \
1826  (RKH_INIT_ACT_T)dftTrn_, h
1827  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem) \
1828  RKHROM RKH_SHIST_T name##Hist = \
1829  { \
1830  MKBASE(kOfH, name##Hist), \
1831  (RKHROM RKH_ST_T *)&name, ramMem, \
1832  RKH_TRREG(0, dTG, dTA, dTT) \
1833  }
1834  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem) \
1835  RKHROM RKH_SHIST_T name = \
1836  { \
1837  MKBASE(kOfH, name), \
1838  (RKHROM RKH_ST_T *)parent, ramMem, \
1839  RKH_TRREG(0, dTG, dTA, dTT) \
1840  }
1841  #define MKFINAL(name_) \
1842  name_##_trtbl, NULL
1843  #define MKFINAL_INCOMP(name_) \
1844  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1845  #else
1846  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
1847  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL, d, \
1848  (RKH_INIT_ACT_T)dftTrn_
1849  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem)
1850  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem)
1851  #define MKFINAL(name_) \
1852  name_##_trtbl, NULL
1853  #define MKFINAL_INCOMP(name_) \
1854  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1855  #endif
1856  #else
1857  #if defined(RKH_HISTORY_ENABLED)
1858  #define MKBASIC(n,pp) n##_trtbl
1859  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, d, \
1860  (RKH_INIT_ACT_T)dftTrn_, h
1861  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem) \
1862  RKHROM RKH_SHIST_T name##Hist = \
1863  { \
1864  MKBASE(kOfH, name##Hist), \
1865  (RKHROM RKH_ST_T *)&name, ramMem, \
1866  RKH_TRREG(0, dTG, dTA, dTT) \
1867  }
1868  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem) \
1869  RKHROM RKH_SHIST_T name = \
1870  { \
1871  MKBASE(kOfH, name), \
1872  (RKHROM RKH_ST_T *)parent, ramMem, \
1873  RKH_TRREG(0, dTG, dTA, dTT) \
1874  }
1875  #define MKFINAL(name_) \
1876  name_##_trtbl
1877  #define MKFINAL_INCOMP(name_) \
1878  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1879  #else
1880  #define MKBASIC(n,pp) n##_trtbl
1881  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, d, \
1882  (RKH_INIT_ACT_T)dftTrn_
1883  #define MKHIST_INCOMP(name, kOfH, dTG, dTA, dTT, ramMem)
1884  #define MKHISTORY(name, parent, kOfH, dTG, dTA, dTT, ramMem)
1885  #define MKFINAL(name_) \
1886  name_##_trtbl
1887  #define MKFINAL_INCOMP(name_) \
1888  RKH_CREATE_FINAL_STATE(name_##Final, &name_)
1889  #endif
1890  #endif
1891  #define MKST(en,ex,p) (RKH_ENT_ACT_T)en, \
1892  (RKH_EXT_ACT_T)ex, \
1893  (RKHROM RKH_ST_T *)p
1894  #define MKSBM(n,sbm) n##_trtbl,n##_exptbl,sbm
1895  #define MKMCH(d,i,n) d, (RKH_TRN_ACT_T)i, \
1896  (RKHROM RKH_ST_T * *)&rdyp_##n
1897  #define MKENP(e,s) e,(RKHROM RKH_ST_T *)s
1898 #else
1899  #if (RKH_CFG_SMA_PPRO_EN == RKH_ENABLED)
1900  #define MKBASIC(n,pp) n##_trtbl, (RKH_PPRO_T)pp
1901  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl, NULL
1902  #define MKFINAL(name_)
1903  #define MKFINAL_INCOMP(name_)
1904  #else
1905  #define MKBASIC(n,pp) n##_trtbl
1906  #define MKCOMP(n, d, dftTrn_, h) n##_trtbl
1907  #define MKFINAL(name_)
1908  #define MKFINAL_INCOMP(name_)
1909  #endif
1910  #define MKST(en,ex,p)
1911  #define MKSBM(n,sbm) n##_trtbl,n##_exptbl,sbm
1912  #define MKMCH(d,i,n) d, (RKH_TRN_ACT_T)i, \
1913  (RKHROM RKH_ST_T *)&rdyp_##n
1914  #define MKENP(e,s) e,(RKHROM RKH_ST_T *)s
1915 #endif
1916 
1917 #define MK_SET_EVT(ev_obj, ev_sig) \
1918  ((RKH_EVT_T *)(ev_obj))->e = (RKH_SIG_T)ev_sig; \
1919  ((RKH_EVT_T *)(ev_obj))->nref = 0; \
1920  ((RKH_EVT_T *)(ev_obj))->pool = 0
1921 
1922 #define MK_EVT(ev_obj, ev_sig) \
1923  RKH_EVT_T ev_obj = {ev_sig, 0, 0}
1924 
1925 #define MK_ROM_EVT(ev_obj, ev_sig) \
1926  RKHROM RKH_EVT_T ev_obj = {ev_sig, 0, 0}
1927 
1928 #define MK_EVT_STRUCT(ev_sig) \
1929  {ev_sig, 0, 0}
1930 
1931 #ifndef RKH_DIS_INTERRUPT
1932  #error \
1933  "rkhport.h, Must be defined the platform-dependent macro RKH_DIS_INTERRUPT"
1934 #endif
1935 
1936 #ifndef RKH_ENA_INTERRUPT
1937  #error \
1938  "rkhport.h, Must be defined the platform-dependent macro RKH_ENA_INTERRUPT"
1939 #endif
1940 
1941 #ifndef RKH_EN_DOXYGEN
1942  #define RKH_EN_DOXYGEN 0
1943 #endif
1944 
1945 #if RKH_EN_DOXYGEN == RKH_ENABLED
1946 
1968  #define RKH_DIS_INTERRUPT()
1969  #define RKH_ENA_INTERRUPT()
1970 
2020  #define RKH_CPUSR_TYPE
2021  #define RKH_SR_ALLOC() \
2022  RKH_CPUSR_TYPE sr = (RKH_CPUSR_TYPE)0
2023  #define RKH_ENTER_CRITICAL(dummy)
2024  #define RKH_EXIT_CRITICAL(dummy)
2025 
2044  #define RKH_CFGPORT_SMA_THREAD_EN RKH_ENABLED
2045 
2059  #define RKH_CFGPORT_SMA_THREAD_DATA_EN RKH_ENABLED
2060 
2074  #define RKH_CFGPORT_NATIVE_SCHEDULER_EN RKH_ENABLED
2075 
2087  #define RKH_CFGPORT_NATIVE_EQUEUE_EN RKH_ENABLED
2088 
2102  #define RKH_CFGPORT_NATIVE_DYN_EVT_EN RKH_ENABLED
2103 
2114  #define RKH_CFGPORT_REENTRANT_EN RKH_ENABLED
2115 
2125  #define RKH_CFGPORT_TRC_SIZEOF_PTR 32u
2126 
2136  #define RKH_CFGPORT_TRC_SIZEOF_FUN_PTR 32u
2137 
2147  #define RKH_CFGPORT_TRC_SIZEOF_TSTAMP 32u
2148 
2159  #define RKH_CFGPORT_SMA_QSTO_EN RKH_ENABLED
2160 
2171  #define RKH_CFGPORT_SMA_STK_EN RKH_ENABLED
2172 
2194  #define RKH_EQ_TYPE
2195 
2220  #define RKH_THREAD_TYPE
2221 
2244  #define RKH_OSSIGNAL_TYPE
2245 
2263  #define RKH_THREAD_STK_TYPE
2264 
2265 #endif
2266 
2267 #ifdef RKH_CPUSR_TYPE
2268  #if RKH_EN_DOXYGEN == RKH_DISABLED
2269  #define RKH_SR_ALLOC() RKH_CPUSR_TYPE sr = (RKH_CPUSR_TYPE)0
2270  #define RKH_ENTER_CRITICAL_() RKH_ENTER_CRITICAL(sr)
2271  #define RKH_EXIT_CRITICAL_() RKH_EXIT_CRITICAL(sr)
2272  #endif
2273 #else
2274  #define RKH_SR_ALLOC()
2275  #define RKH_ENTER_CRITICAL_() RKH_ENTER_CRITICAL(dummy)
2276  #define RKH_EXIT_CRITICAL_() RKH_EXIT_CRITICAL(dummy)
2277 #endif
2278 
2279 #if (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_ENABLED && \
2280  RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
2281  #define RKH_EXEC_INIT(me_, action_) \
2282  if ((RKH_INIT_ACT_T)action_) \
2283  { \
2284  (*(RKH_INIT_ACT_T)action_)((me_), \
2285  RKH_SMA_ACCESS_CONST(CM(me_), ievent)); \
2286  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_INI, \
2287  (me_), \
2288  0, \
2289  CM(me_)); \
2290  }
2291  #define RKH_EXEC_STATE_INIT(me_, action_) \
2292  RKH_EXEC_INIT(me_, action_)
2293 #elif (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_ENABLED && \
2294  RKH_CFG_SMA_INIT_EVT_EN == RKH_DISABLED)
2295  #define RKH_EXEC_INIT(me_, action_) \
2296  if ((RKH_INIT_ACT_T)action_) \
2297  { \
2298  (*(RKH_INIT_ACT_T)action_)((me_)); \
2299  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_INI, \
2300  (me_), \
2301  0, \
2302  CM(me_)); \
2303  }
2304  #define RKH_EXEC_STATE_INIT(me_, action_) \
2305  RKH_EXEC_INIT(me_, action_)
2306 #elif (RKH_CFG_SMA_INIT_ARG_SMA_EN == RKH_DISABLED && \
2307  RKH_CFG_SMA_INIT_EVT_EN == RKH_ENABLED)
2308  #define RKH_EXEC_INIT(me_, action_) \
2309  if ((RKH_INIT_ACT_T)action_) \
2310  { \
2311  (*(RKH_INIT_ACT_T)action_)(RKH_SMA_ACCESS_CONST(CM(me_), ievent)); \
2312  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_INI, \
2313  (me_), \
2314  0, \
2315  CM(me_)); \
2316  }
2317  #define RKH_EXEC_STATE_INIT(me_, action_) \
2318  RKH_EXEC_INIT(me_, action_)
2319 #else
2320  #define RKH_EXEC_INIT(me_, action_) \
2321  if ((RKH_INIT_ACT_T)action_) \
2322  { \
2323  (*(RKH_INIT_ACT_T)action_)(); \
2324  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_INI, \
2325  (me_), \
2326  0, \
2327  CM(me_)); \
2328  }
2329  #define RKH_EXEC_STATE_INIT(me_, action_) \
2330  RKH_EXEC_INIT(me_, action_)
2331 #endif
2332 
2333 #if RKH_CFG_SMA_ENT_ARG_SMA_EN == RKH_ENABLED
2334  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2335  #define RKH_EXEC_ENTRY(state_, me_) \
2336  if ((state_)->enter) \
2337  { \
2338  (*(state_)->enter)(me_, state_); \
2339  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2340  (me_), \
2341  (state_), \
2342  (state_)->enter); \
2343  }
2344  #else
2345  #define RKH_EXEC_ENTRY(state_, me_) \
2346  if ((state_)->enter) \
2347  { \
2348  (*(state_)->enter)(me_); \
2349  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2350  (me_), \
2351  (state_), \
2352  (state_)->enter); \
2353  }
2354  #endif
2355 #else
2356  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2357  #define RKH_EXEC_ENTRY(state_, me_) \
2358  if ((state_)->enter) \
2359  { \
2360  (*(state_)->enter)(state_); \
2361  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2362  (me_), \
2363  (state_), \
2364  (state_)->enter); \
2365  }
2366  #else
2367  #define RKH_EXEC_ENTRY(state_, me_) \
2368  if ((state_)->enter) \
2369  { \
2370  (*(state_)->enter)(); \
2371  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EN, \
2372  (me_), \
2373  (state_), \
2374  (state_)->enter); \
2375  }
2376  #endif
2377 #endif
2378 
2379 #if RKH_CFG_SMA_EXT_ARG_SMA_EN == RKH_ENABLED
2380  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2381  #define RKH_EXEC_EXIT(state_, me_) \
2382  if ((state_)->exit) \
2383  { \
2384  (*(state_)->exit)(me_, state_); \
2385  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2386  (me_), \
2387  (state_), \
2388  (state_)->exit); \
2389  }
2390  #else
2391  #define RKH_EXEC_EXIT(state_, me_) \
2392  if ((state_)->exit) \
2393  { \
2394  (*(state_)->exit)(me_); \
2395  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2396  (me_), \
2397  (state_), \
2398  (state_)->exit); \
2399  }
2400  #endif
2401 #else
2402  #if RKH_CFG_SMA_ENT_ARG_STATE_EN == RKH_ENABLED
2403  #define RKH_EXEC_EXIT(state_, me_) \
2404  if ((state_)->exit) \
2405  { \
2406  (*(state_)->exit)(state_); \
2407  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2408  (me_), \
2409  (state_), \
2410  (state_)->exit); \
2411  }
2412  #else
2413  #define RKH_EXEC_EXIT(state_, me_) \
2414  if ((state_)->exit) \
2415  { \
2416  (*(state_)->exit)(); \
2417  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EX, \
2418  (me_), \
2419  (state_), \
2420  (state_)->exit); \
2421  }
2422  #endif
2423 #endif
2424 
2425 #if RKH_CFG_SMA_PPRO_ARG_SMA_EN == RKH_ENABLED
2426  #define RKH_EXEC_PREPRO(state_, me_, evt_) \
2427  (*(state_)->prepro)(me_, evt_); \
2428  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_PP, \
2429  (me_), \
2430  (((RKH_SM_T *)me_))->state, \
2431  (state_)->prepro)
2432 #else
2433  #define RKH_EXEC_PREPRO(state_, me_, evt_) \
2434  (*(state_)->prepro)(evt_); \
2435  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_PP, \
2436  (me_), \
2437  (((RKH_SM_T *)me_))->state, \
2438  (state_)->prepro)
2439 #endif
2440 
2441 #if (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_ENABLED && \
2442  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_ENABLED)
2443  #define RKH_EXEC_EFF(action_, me_, evt_) \
2444  (*CTA(action_))((me_), (evt_)); \
2445  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2446  (me_), \
2447  (((RKH_SM_T *)me_))->state, \
2448  (action_))
2449 #elif (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_ENABLED && \
2450  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_DISABLED)
2451  #define RKH_EXEC_EFF(action_, me_, evt_) \
2452  (*CTA(action_))((evt_)); \
2453  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2454  (me_), \
2455  (((RKH_SM_T *)me_))->state, \
2456  (action_))
2457 #elif (RKH_CFG_SMA_ACT_ARG_EVT_EN == RKH_DISABLED && \
2458  RKH_CFG_SMA_ACT_ARG_SMA_EN == RKH_ENABLED)
2459  #define RKH_EXEC_EFF(action_, me_, evt_) \
2460  (*CTA(action_))((me_)); \
2461  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2462  (me_), \
2463  (((RKH_SM_T *)me_))->state, \
2464  (action_))
2465 #else
2466  #define RKH_EXEC_EFF(action_, me_, evt_) \
2467  (*CTA(action_))(); \
2468  RKH_TR_SM_EXE_ACT(RKH_SUBTE_SM_EXE_ACT_EFF, \
2469  (me_), \
2470  (((RKH_SM_T *)me_))->state, \
2471  (action_))
2472 #endif
2473 
2474 #if (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
2475  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
2476  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2477  (*(trn_)->guard)(me_, evt_)
2478 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_ENABLED && \
2479  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_DISABLED)
2480  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2481  (*(trn_)->guard)(evt_)
2482 #elif (RKH_CFG_SMA_GRD_ARG_EVT_EN == RKH_DISABLED && \
2483  RKH_CFG_SMA_GRD_ARG_SMA_EN == RKH_ENABLED)
2484  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2485  (*(trn_)->guard)(me_)
2486 #else
2487  #define RKH_EXEC_GUARD(trn_, me_, evt_) \
2488  (*(trn_)->guard)()
2489 #endif
2490 
2491 /* -------------------------------- Constants ------------------------------ */
2492 #ifndef NULL
2493 #define NULL (void *)0
2494 #endif
2495 
2496 /* ------------------------------- Data types ------------------------------ */
2497 typedef struct RKH_ROM_T RKH_ROM_T;
2498 typedef struct RKHSmaVtbl RKHSmaVtbl;
2499 typedef struct RKH_SM_T RKH_SM_T;
2500 typedef struct RKH_SMA_T RKH_SMA_T;
2501 typedef struct RKH_TR_T RKH_TR_T;
2502 typedef struct RKH_BASE_T RKH_BASE_T;
2503 typedef struct RKH_ST_T RKH_ST_T;
2504 typedef struct RKH_SHIST_T RKH_SHIST_T;
2505 typedef struct RKH_SBSC_T RKH_SBSC_T;
2506 typedef struct RKH_SCMP_T RKH_SCMP_T;
2507 typedef struct RKH_FINAL_T RKH_FINAL_T;
2508 typedef struct RKH_EXPCN_T RKH_EXPCN_T;
2509 typedef struct RKH_ENPCN_T RKH_ENPCN_T;
2510 typedef struct RKH_SSBM_T RKH_SSBM_T;
2511 typedef struct RKH_RSM_T RKH_RSM_T;
2512 typedef struct RKH_SENP_T RKH_SENP_T;
2513 typedef struct RKH_SEXP_T RKH_SEXP_T;
2514 typedef struct RKH_SCOND_T RKH_SCOND_T;
2515 typedef struct RKH_SCHOICE_T RKH_SCHOICE_T;
2516 
2517 /* -------------------------- External variables --------------------------- */
2522 extern RKHROM char noname[];
2523 
2524 /* -------------------------- Function prototypes -------------------------- */
2525 /* -------------------- External C language linkage end -------------------- */
2526 #ifdef __cplusplus
2527 }
2528 #endif
2529 
2530 /* ------------------------------ Module end ------------------------------- */
2531 #endif
2532 
2533 /* ------------------------------ End of file ------------------------------ */
Describes a composite state.
Definition: rkhsm.h:2152
Describes the exit point connection.
Definition: rkhsm.h:2259
Describes a basic state.
Definition: rkhsm.h:2095
Describes the choice pseudostate.
Definition: rkhsm.h:2499
Describes the SMA (active object in UML).
Definition: rkhsma.h:748
Describes a submachine state.
Definition: rkhsm.h:2351
Defines event data type and other related macros.
RKH platform abstraction layer.
RKHROM char noname[]
String representing the name of undefined object name.
Maintains the basic information of a state.
Definition: rkhsm.h:1991
Constant parameters of state machine.
Definition: rkhsm.h:1636
Describes the entry point connection.
Definition: rkhsm.h:2278
Describes the entry point pseudostate.
Definition: rkhsm.h:2420
Describes the state machine.
Definition: rkhsm.h:1712
Virtual table for the RKH_SMA_T structure.
Definition: rkhsma.h:860
Describes the state transition.
Definition: rkhsm.h:2030
Describes a final state.
Definition: rkhsm.h:2231
Describes the history pseudostate.
Definition: rkhsm.h:2521
Describes a (referenced) submachine state machine.
Definition: rkhsm.h:2378
Describes the common properties of regular states (basic, composite, and submachine).
Definition: rkhsm.h:2062
Describes the exit point pseudostate.
Definition: rkhsm.h:2451
Describes the conditional pseudostate.
Definition: rkhsm.h:2478