RKH
rkhtrc_define.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 
39 /* -------------------------- Development history -------------------------- */
40 /*
41  * 2017.04.15 LeFr v2.4.05 Initial version
42  */
43 
44 /* -------------------------------- Authors -------------------------------- */
45 /*
46  * LeFr Leandro Francucci francuccilea@gmail.com
47  */
48 
49 /* --------------------------------- Notes --------------------------------- */
50 /* --------------------------------- Module -------------------------------- */
51 #ifndef __RKHTRC_DEF_H__
52 #define __RKHTRC_DEF_H__
53 
54 /* ----------------------------- Include files ----------------------------- */
55 #include "rkhitl.h"
56 
57 /* ---------------------- External C language linkage ---------------------- */
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /* --------------------------------- Macros -------------------------------- */
73 #define RKH_CFG_TRC_SIZEOF_TE_ID 8
74 
75 #if RKH_CFG_TRC_SIZEOF_TE_ID == 8
76  #define RKH_TRC_TE_ID(teid) \
77  RKH_TRC_UI8(teid)
78 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 16
79  #define RKH_TRC_TE_ID(teid) \
80  RKH_TRC_UI16(teid)
81 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 32
82  #define RKH_TRC_TE_ID(teid) \
83  RKH_TRC_UI32(teid)
84 #else
85  #define RKH_TRC_TE_ID(teid) \
86  RKH_TRC_UI8(teid)
87 #endif
88 
102 #if RKH_CFG_TRC_RTFIL_SMA_EN == RKH_ENABLED
103  #define RKH_TRC_AO_ISOFF(prio) \
104  && rkh_trc_symFil_isoff(RKHFilterSma, (RKH_TRC_FSLOT)(prio))
105 #else
106  #define RKH_TRC_AO_ISOFF(prio)
107 #endif
108 
111 #define RKH_TRC_IS_RESERVED_SIG(sig) \
112  (sig == RKH_COMPLETION_EVENT)
113 
127 #if RKH_CFG_TRC_RTFIL_SIGNAL_EN == RKH_ENABLED
128  #define RKH_TRC_SIG_ISOFF(sig) \
129  && (RKH_TRC_IS_RESERVED_SIG(sig) || \
130  rkh_trc_symFil_isoff(RKHFilterSignal, (RKH_TRC_FSLOT)(sig)))
131 #else
132  #define RKH_TRC_SIG_ISOFF(sig)
133 #endif
134 
135 /* -------------------------------- Constants ------------------------------ */
136 #if RKH_CFG_TRC_SIZEOF_TE_ID == 8
137  #define RKH_NBITS_GROUP 3
138 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 16
139  #define RKH_NBITS_GROUP 8
140 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 32
141  #define RKH_NBITS_GROUP 8
142 #else
143  #define RKH_NBITS_GROUP 3
144 #endif
145 
146 #define RKH_NBIT_EVENT_PER_GROUP (RKH_CFG_TRC_SIZEOF_TE_ID - \
147  RKH_NBITS_GROUP)
148 #define RKH_TRC_MAX_GROUPS RKH_BIT(RKH_NBITS_GROUP)
149 #define RKH_MAX_NUM_TE_PER_GROUP RKH_BIT(RKH_NBIT_EVENT_PER_GROUP)
150 #define NGSH RKH_NBIT_EVENT_PER_GROUP
151 #define RKH_GRP_MASK \
152  (RKH_TE_ID_T)((RKH_BIT(RKH_NBITS_GROUP) - 1) << \
153  RKH_NBIT_EVENT_PER_GROUP)
154 #define RKH_TE_MASK \
155  (RKH_TE_ID_T)(RKH_BIT(RKH_NBIT_EVENT_PER_GROUP) - 1)
156 
163 #define RKH_TRC_MAX_EVENTS \
164  (RKH_MAX_NUM_TE_PER_GROUP * RKH_TRC_MAX_GROUPS)
165 
166 #if ((RKH_CFG_FWK_MAX_SMA & (8 - 1)) == 0)
167 
172  #define RKH_TRC_MAX_SMA (RKH_CFG_FWK_MAX_SMA / 8)
173 #else
174  #define RKH_TRC_MAX_SMA (RKH_CFG_FWK_MAX_SMA / 8 + 1)
175 #endif
176 
177 #if ((RKH_CFG_FWK_MAX_SIGNALS & (8 - 1)) == 0)
178 
183  #define RKH_TRC_MAX_SIGNALS (RKH_CFG_FWK_MAX_SIGNALS / 8)
184 #else
185  #define RKH_TRC_MAX_SIGNALS (RKH_CFG_FWK_MAX_SIGNALS / 8 + 1)
186 #endif
187 
205 #define RKH_MP_START GRPLSH(RKH_TG_MP)
206 #define RKH_QUE_START GRPLSH(RKH_TG_QUE)
207 #define RKH_SMA_START GRPLSH(RKH_TG_SMA)
208 #define RKH_SM_START GRPLSH(RKH_TG_SM)
209 #define RKH_TMR_START GRPLSH(RKH_TG_TMR)
210 #define RKH_FWK_START GRPLSH(RKH_TG_FWK)
211 #define RKH_USR_START GRPLSH(RKH_TG_USR)
212 #define RKH_UT_START GRPLSH(RKH_TG_UT)
213 
221 #define RKH_MP_TTBL_RANGE 1
222 #define RKH_QUE_TTBL_RANGE 1
223 #define RKH_SMA_TTBL_RANGE 2
224 #define RKH_SM_TTBL_RANGE 3
225 #define RKH_TIM_TTBL_RANGE 1
226 #define RKH_FWK_TTBL_RANGE 3
227 #define RKH_USR_TTBL_RANGE 4
228 #define RKH_UT_TTBL_RANGE 2
229 
234 #define RKH_TOT_NUM_TRC_EVTS \
235  (RKH_MP_TTBL_RANGE + \
236  RKH_QUE_TTBL_RANGE + \
237  RKH_SMA_TTBL_RANGE + \
238  RKH_SM_TTBL_RANGE + \
239  RKH_TIM_TTBL_RANGE + \
240  RKH_FWK_TTBL_RANGE + \
241  RKH_USR_TTBL_RANGE + \
242  RKH_UT_TTBL_RANGE)
243 
249 #if (RKH_TOT_NUM_TRC_EVTS <= RKH_TOT_NUM_TRC_EVTS)
250  #define RKH_TRC_MAX_EVENTS_IN_BYTES RKH_TOT_NUM_TRC_EVTS
251 #else
252  #error "rkhtrc.h, the total number of trace events represented"
253  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
254 #endif
255 
256 #define RKH_MP_TTBL_OFFSET 0
257 #define RKH_QUE_TTBL_OFFSET (RKH_MP_TTBL_OFFSET + RKH_MP_TTBL_RANGE)
258 #define RKH_SMA_TTBL_OFFSET (RKH_QUE_TTBL_OFFSET + RKH_QUE_TTBL_RANGE)
259 #define RKH_SM_TTBL_OFFSET (RKH_SMA_TTBL_OFFSET + RKH_SMA_TTBL_RANGE)
260 #define RKH_TIM_TTBL_OFFSET (RKH_SM_TTBL_OFFSET + RKH_SM_TTBL_RANGE)
261 #define RKH_FWK_TTBL_OFFSET (RKH_TIM_TTBL_OFFSET + RKH_TIM_TTBL_RANGE)
262 #define RKH_USR_TTBL_OFFSET (RKH_FWK_TTBL_OFFSET + RKH_FWK_TTBL_RANGE)
263 #define RKH_UT_TTBL_OFFSET (RKH_USR_TTBL_OFFSET + RKH_USR_TTBL_RANGE)
264 
265 #define GRPLSH(grp) \
266  /*(RKH_TE_ID_T)(((grp) & (rui8_t)(RKH_TRC_MAX_GROUPS - 1)) << NGSH)*/ \
267  (((grp) & (RKH_TRC_MAX_GROUPS - 1)) << NGSH)
268 
269 #define EXTE(te, grp) \
270  (RKH_TE_ID_T)((te) - GRPLSH(grp))
271 
272 #define GETGRP(e) \
273  (RKH_TG_T)(((e) & RKH_GRP_MASK) >> RKH_NBIT_EVENT_PER_GROUP)
274 #define GETEVT(e) \
275  (RKH_TE_ID_T)((e) & RKH_TE_MASK)
276 
277 #define ECHANGE 0
278 #define EUNCHANGE 1
279 
284 #define RKH_TRC_ALL_GROUPS RKH_TG_NGROUP
285 
290 #define RKH_TRC_ALL_EVENTS RKH_TE_NEVENT
291 
296 #define RKH_TRC_SET_ALL(mode_) \
297  ((mode_) | RKH_TRC_ALL_FILTERS)
298 
299 #define RKH_TRC_ALL_FILTERS 0x80
300 #define RKH_FILTER_MODE_MASK ~RKH_TRC_ALL_FILTERS
301 
303 #define RKH_XOR 0x20
304 
306 #define RKH_FLG 0x7E
307 
309 #define RKH_ESC 0x7D
310 
311 /* --- RKH group of trace events ------------------------------------------- */
313 #define RKH_TG_MP 0
314 
316 #define RKH_TG_QUE 1
317 
319 #define RKH_TG_SMA 2
320 
322 #define RKH_TG_SM 3
323 
325 #define RKH_TG_TMR 4
326 
328 #define RKH_TG_FWK 5
329 
331 #define RKH_TG_USR 6
332 
334 #define RKH_TG_UT 7
335 
337 #define RKH_TG_NGROUP 8
338 
339 /* --- Memory Pool events (MP group) --------------------------------------- */
341 #define RKH_TE_MP_INIT RKH_MP_START
342 
343 #define RKH_TE_MP_GET (RKH_TE_MP_INIT + 1)
344 
345 #define RKH_TE_MP_PUT (RKH_TE_MP_GET + 1)
346 #define RKH_MP_END RKH_TE_MP_PUT
347 
348 /* --- Queue events (QUE group) --------------------------------------------- */
350 #define RKH_TE_QUE_INIT RKH_QUE_START
351 
352 #define RKH_TE_QUE_GET (RKH_TE_QUE_INIT + 1)
353 
354 #define RKH_TE_QUE_FIFO (RKH_TE_QUE_GET + 1)
355 
356 #define RKH_TE_QUE_LIFO (RKH_TE_QUE_FIFO + 1)
357 
358 #define RKH_TE_QUE_FULL (RKH_TE_QUE_LIFO + 1)
359 
360 #define RKH_TE_QUE_DPT (RKH_TE_QUE_FULL + 1)
361 
362 #define RKH_TE_QUE_GET_LAST (RKH_TE_QUE_DPT +1 )
363 #define RKH_QUE_END RKH_TE_QUE_GET_LAST
364 
365 /* --- State Machine Application events (SMA group) ------------------------ */
367 #define RKH_TE_SMA_ACT RKH_SMA_START
368 
369 #define RKH_TE_SMA_TERM (RKH_TE_SMA_ACT + 1)
370 
371 #define RKH_TE_SMA_GET (RKH_TE_SMA_TERM + 1)
372 
373 #define RKH_TE_SMA_FIFO (RKH_TE_SMA_GET + 1)
374 
375 #define RKH_TE_SMA_LIFO (RKH_TE_SMA_FIFO + 1)
376 
377 #define RKH_TE_SMA_REG (RKH_TE_SMA_LIFO + 1)
378 
379 #define RKH_TE_SMA_UNREG (RKH_TE_SMA_REG + 1)
380 
381 #define RKH_TE_SMA_DEFER (RKH_TE_SMA_UNREG + 1)
382 
383 #define RKH_TE_SMA_RCALL (RKH_TE_SMA_DEFER + 1)
384 #define RKH_SMA_END RKH_TE_SMA_RCALL
385 
386 /* --- State machine events (SM group) ------------------------------------- */
388 #define RKH_TE_SM_INIT RKH_SM_START
389 
390 #define RKH_TE_SM_CLRH (RKH_TE_SM_INIT + 1)
391 
392 #define RKH_TE_SM_TRN (RKH_TE_SM_CLRH + 1)
393 
394 #define RKH_TE_SM_STATE (RKH_TE_SM_TRN + 1)
395 
396 #define RKH_TE_SM_ENSTATE (RKH_TE_SM_STATE + 1)
397 
398 #define RKH_TE_SM_EXSTATE (RKH_TE_SM_ENSTATE + 1)
399 
400 #define RKH_TE_SM_NENEX (RKH_TE_SM_EXSTATE + 1)
401 
402 #define RKH_TE_SM_NTRNACT (RKH_TE_SM_NENEX + 1)
403 
404 #define RKH_TE_SM_TS_STATE (RKH_TE_SM_NTRNACT + 1)
405 
406 #define RKH_TE_SM_EVT_PROC (RKH_TE_SM_TS_STATE + 1)
407 
408 #define RKH_TE_SM_EVT_NFOUND (RKH_TE_SM_EVT_PROC + 1)
409 
410 #define RKH_TE_SM_GRD_FALSE (RKH_TE_SM_EVT_NFOUND + 1)
411 
412 #define RKH_TE_SM_CND_NFOUND (RKH_TE_SM_GRD_FALSE + 1)
413 
414 #define RKH_TE_SM_UNKN_STATE (RKH_TE_SM_CND_NFOUND + 1)
415 
416 #define RKH_TE_SM_EX_HLEVEL (RKH_TE_SM_UNKN_STATE + 1)
417 
418 #define RKH_TE_SM_EX_TSEG (RKH_TE_SM_EX_HLEVEL + 1)
419 
420 #define RKH_TE_SM_EXE_ACT (RKH_TE_SM_EX_TSEG + 1)
421 
422 #define RKH_TE_SM_DCH (RKH_TE_SM_EXE_ACT + 1)
423 #define RKH_SM_END RKH_TE_SM_DCH
424 
425 /* --- Timer events (TMR group) -------------------------------------------- */
427 #define RKH_TE_TMR_INIT RKH_TMR_START
428 
429 #define RKH_TE_TMR_START (RKH_TE_TMR_INIT + 1)
430 
431 #define RKH_TE_TMR_STOP (RKH_TE_TMR_START + 1)
432 
433 #define RKH_TE_TMR_TOUT (RKH_TE_TMR_STOP + 1)
434 
435 #define RKH_TE_TMR_REM (RKH_TE_TMR_TOUT + 1)
436 #define RKH_TMR_END RKH_TE_TMR_REM
437 
438 /* --- Framework and misc. events (FWK group) ------------------------------ */
440 #define RKH_TE_FWK_EN RKH_FWK_START
441 
442 #define RKH_TE_FWK_EX (RKH_TE_FWK_EN + 1)
443 
444 #define RKH_TE_FWK_EPREG (RKH_TE_FWK_EX + 1)
445 
446 #define RKH_TE_FWK_AE (RKH_TE_FWK_EPREG + 1)
447 
448 #define RKH_TE_FWK_GC (RKH_TE_FWK_AE + 1)
449 
450 #define RKH_TE_FWK_GCR (RKH_TE_FWK_GC + 1)
451 
452 #define RKH_TE_FWK_OBJ (RKH_TE_FWK_GCR + 1)
453 
454 #define RKH_TE_FWK_SIG (RKH_TE_FWK_OBJ + 1)
455 
456 #define RKH_TE_FWK_FUN (RKH_TE_FWK_SIG + 1)
457 
458 #define RKH_TE_FWK_EXE_FUN (RKH_TE_FWK_FUN + 1)
459 
460 #define RKH_TE_FWK_SYNC_EVT (RKH_TE_FWK_EXE_FUN + 1)
461 
462 #define RKH_TE_FWK_TUSR (RKH_TE_FWK_SYNC_EVT + 1)
463 
464 #define RKH_TE_FWK_TCFG (RKH_TE_FWK_TUSR + 1)
465 
466 #define RKH_TE_FWK_ASSERT (RKH_TE_FWK_TCFG + 1)
467 
468 #define RKH_TE_FWK_AO (RKH_TE_FWK_ASSERT + 1)
469 
470 #define RKH_TE_FWK_STATE (RKH_TE_FWK_AO + 1)
471 
472 #define RKH_TE_FWK_PSTATE (RKH_TE_FWK_STATE + 1)
473 
474 #define RKH_TE_FWK_TIMER (RKH_TE_FWK_PSTATE + 1)
475 
476 #define RKH_TE_FWK_EPOOL (RKH_TE_FWK_TIMER + 1)
477 
478 #define RKH_TE_FWK_QUEUE (RKH_TE_FWK_EPOOL + 1)
479 
480 #define RKH_TE_FWK_ACTOR (RKH_TE_FWK_QUEUE + 1)
481 #define RKH_FWK_END RKH_TE_FWK_ACTOR
482 
483 /* --- User events (USR group) --------------------------------------------- */
484 #define RKH_TE_USER RKH_USR_START
485 
486 /* --- Unit test harness events (UT group) --------------------------------- */
487 #define RKH_TE_UT_INIT RKH_UT_START
488 #define RKH_TE_UT_CLEANUP (RKH_TE_UT_INIT + 1)
489 #define RKH_TE_UT_VERIFY (RKH_TE_UT_CLEANUP + 1)
490 #define RKH_TE_UT_IGNORE_GROUP (RKH_TE_UT_VERIFY + 1)
491 #define RKH_TE_UT_EXPECT (RKH_TE_UT_IGNORE_GROUP + 1)
492 #define RKH_TE_UT_EXPECT_ANYARGS (RKH_TE_UT_EXPECT + 1)
493 #define RKH_TE_UT_IGNORE (RKH_TE_UT_EXPECT_ANYARGS + 1)
494 #define RKH_TE_UT_IGNORE_ARG (RKH_TE_UT_IGNORE + 1)
495 #define RKH_TE_UT_SUCCESS (RKH_TE_UT_IGNORE_ARG + 1)
496 #define RKH_TE_UT_FAIL (RKH_TE_UT_SUCCESS + 1)
497 #define RKH_UT_END RKH_TE_UT_IGNORE_ARG
498 
499 /* The last trace event */
500 #define RKH_TE_NEVENT (RKH_UT_END + 1)
501 
502 /* ------------------------- Configuration errors -------------------------- */
503 /*
504  * LOOK FOR WRONG #define CONSTANTS
505  *
506  * This section is used to generate ERROR messages at compile time if
507  * certain #define constants are WRONG in rkhtrc.h. This allows you to
508  * quickly determine the source of the error.
509  *
510  * You SHOULD NOT change this section UNLESS you would like to add more
511  * comments as to the source of the compile time error.
512  */
513 #if ((RKH_MP_END - RKH_MP_START) > ((RKH_MP_TTBL_RANGE * 8) - 1))
514  #error "rkhtrc.h, the total number of trace events represented"
515  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
516 #endif
517 
518 #if ((RKH_QUE_END - RKH_QUE_START) > ((RKH_QUE_TTBL_RANGE * 8) - 1))
519  #error "rkhtrc.h, the total number of trace events represented"
520  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
521 #endif
522 
523 #if ((RKH_SMA_END - RKH_SMA_START) > ((RKH_SMA_TTBL_RANGE * 8) - 1))
524  #error "rkhtrc.h, the total number of trace events represented"
525  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
526 #endif
527 
528 #if ((RKH_SM_END - RKH_SM_START) > ((RKH_SM_TTBL_RANGE * 8) - 1))
529  #error "rkhtrc.h, the total number of trace events represented"
530  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
531 #endif
532 
533 #if ((RKH_TMR_END - RKH_TMR_START) > ((RKH_TIM_TTBL_RANGE * 8) - 1))
534  #error "rkhtrc.h, the total number of trace events represented"
535  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
536 #endif
537 
538 #if ((RKH_FWK_END - RKH_FWK_START) > ((RKH_FWK_TTBL_RANGE * 8) - 1))
539  #error "rkhtrc.h, the total number of trace events represented"
540  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
541 #endif
542 
543 #if ((RKH_UT_END - RKH_UT_START) > ((RKH_UT_TTBL_RANGE * 8) - 1))
544  #error "rkhtrc.h, the total number of trace events represented"
545  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
546 #endif
547 
548 #if RKH_CFG_TRC_RTFIL_EN == RKH_ENABLED
549 
569  #define RKH_TRC_BEGIN(eid_, prio_, sig_) \
570  if (rkh_trc_isoff_(eid_) \
571  RKH_TRC_AO_ISOFF(prio_) \
572  RKH_TRC_SIG_ISOFF(sig_)) \
573  { \
574  RKH_ENTER_CRITICAL_(); \
575  rkh_trc_begin(eid_);
576 
577  #define RKH_TRC_BEGIN_WOAO(eid_, sig_) \
578  if (rkh_trc_isoff_(eid_) \
579  RKH_TRC_SIG_ISOFF(sig_)) \
580  { \
581  RKH_ENTER_CRITICAL_(); \
582  rkh_trc_begin(eid_);
583 
584  #define RKH_TRC_BEGIN_WOSIG(eid_, prio_) \
585  if (rkh_trc_isoff_(eid_) \
586  RKH_TRC_AO_ISOFF(prio_)) \
587  { \
588  RKH_ENTER_CRITICAL_(); \
589  rkh_trc_begin(eid_);
590 
591  #define RKH_TRC_BEGIN_WOAOSIG(eid_) \
592  if (rkh_trc_isoff_(eid_)) \
593  { \
594  RKH_ENTER_CRITICAL_(); \
595  rkh_trc_begin(eid_);
596 
607  #define RKH_TRC_END() \
608  rkh_trc_end(); \
609  RKH_EXIT_CRITICAL_(); \
610  }
611 
620  #define RKH_TRC_BEGIN_NOCRIT(eid_, prio_, sig_) \
621  if (rkh_trc_isoff_(eid_) \
622  RKH_TRC_AO_ISOFF(prio_) \
623  RKH_TRC_SIG_ISOFF(sig_)) \
624  { \
625  rkh_trc_begin(eid_);
626 
635  #define RKH_TRC_BEGIN_WOAO_NOCRIT(eid_, sig_) \
636  if (rkh_trc_isoff_(eid_) \
637  RKH_TRC_SIG_ISOFF(sig_)) \
638  { \
639  rkh_trc_begin(eid_);
640 
649  #define RKH_TRC_BEGIN_WOSIG_NOCRIT(eid_, prio_) \
650  if (rkh_trc_isoff_(eid_) \
651  RKH_TRC_AO_ISOFF(prio_)) \
652  { \
653  rkh_trc_begin(eid_);
654 
662  #define RKH_TRC_BEGIN_WOAOSIG_NOCRIT(eid_) \
663  if (rkh_trc_isoff_(eid_)) \
664  { \
665  rkh_trc_begin(eid_);
666 
670  #define RKH_TRC_END_NOCRIT() \
671  rkh_trc_end(); \
672  }
673 #else
674  #define RKH_TRC_BEGIN(eid_, prio_, sig_) \
675  RKH_ENTER_CRITICAL_(); \
676  rkh_trc_begin(eid_);
677 
678  #define RKH_TRC_BEGIN_WOAO(eid_, sig_) \
679  RKH_ENTER_CRITICAL_(); \
680  rkh_trc_begin(eid_);
681 
682  #define RKH_TRC_BEGIN_WOSIG(eid_, prio_) \
683  RKH_ENTER_CRITICAL_(); \
684  rkh_trc_begin(eid_);
685 
686  #define RKH_TRC_BEGIN_WOAOSIG(eid_) \
687  RKH_ENTER_CRITICAL_(); \
688  rkh_trc_begin(eid_);
689 
690  #define RKH_TRC_END() \
691  rkh_trc_end(); \
692  RKH_EXIT_CRITICAL_();
693 
694  #define RKH_TRC_BEGIN_NOCRIT(eid_, prio_, sig_) \
695  rkh_trc_begin(eid_);
696 
697  #define RKH_TRC_BEGIN_WOAO_NOCRIT(eid_, sig_) \
698  rkh_trc_begin(eid_);
699 
700  #define RKH_TRC_BEGIN_WOSIG_NOCRIT(eid_, prio_) \
701  rkh_trc_begin(eid_);
702 
703  #define RKH_TRC_BEGIN_WOAOSIG_NOCRIT(eid_) \
704  rkh_trc_begin(eid_);
705 
706  #define RKH_TRC_END_NOCRIT() \
707  rkh_trc_end();
708 #endif
709 
714 #define RKH_TRC_BEGIN_WOFIL(eid_) \
715  RKH_SR_ALLOC(); \
716  RKH_ENTER_CRITICAL_(); \
717  rkh_trc_begin(eid_);
718 
723 #define RKH_TRC_END_WOFIL() \
724  rkh_trc_end(); \
725  RKH_EXIT_CRITICAL_();
726 
730 #define RKH_TRC_BEGIN_WOFIL_NOCRIT(eid_) \
731  rkh_trc_begin(eid_);
732 
737 #define RKH_TRC_END_WOFIL_NOCRIT() \
738  rkh_trc_end(); \
739 
740 
744 #define RKH_TRC_BEGIN_DFT(eid_) \
745  RKH_SR_ALLOC(); \
746  RKH_ENTER_CRITICAL_(); \
747  rkh_trc_clear_chk(); \
748  RKH_TRC_TE_ID(eid_);
749 
754 #define RKH_TRC_END_DFT() \
755  rkh_trc_end(); \
756  RKH_EXIT_CRITICAL_();
757 
762 #define RKH_TRC_U8_RAW(d) \
763  rkh_trc_put((d))
764 
769 #define RKH_TRC_UI8(d) \
770  rkh_trc_u8((rui8_t)(d))
771 
776 #define RKH_TRC_UI16(d) \
777  rkh_trc_u16((d))
778 
783 #define RKH_TRC_UI32(d) \
784  rkh_trc_u32((d))
785 
790 #define RKH_TRC_STR(s) \
791  rkh_trc_str((s))
792 
793 #if RKH_CFG_TRC_USER_TRACE_EN == RKH_ENABLED
794 
797  #define RKH_TRC_USR_BEGIN(eid_) \
798  RKH_SR_ALLOC(); \
799  if (rkh_trc_isoff_(eid_)) \
800  { \
801  RKH_ENTER_CRITICAL_(); \
802  rkh_trc_begin(eid_);
803 
807  #define RKH_TRC_USR_END() \
808  rkh_trc_end(); \
809  RKH_EXIT_CRITICAL_(); \
810  }
811 
816  #define RKH_TRC_USR_BEGIN_NOCRIT(eid_) \
817  if (rkh_trc_isoff_(eid_)) \
818  { \
819  rkh_trc_begin(eid_);
820 
824  #define RKH_TRC_USR_END_NOCRIT() \
825  rkh_trc_end(); \
826  }
827 
832  #define RKH_TUSR_I8(w_, d_) \
833  rkh_trc_fmt_u8((rui8_t)(((w_) << 4)) | (rui8_t)RKH_I8_T, \
834  (d_))
835 
840  #define RKH_TUSR_UI8(w_, d_) \
841  rkh_trc_fmt_u8((rui8_t)(((w_) << 4)) | (rui8_t)RKH_UI8_T, \
842  (d_))
843 
848  #define RKH_TUSR_I16(w_, d_) \
849  rkh_trc_fmt_u16((rui8_t)(((w_) << 4)) | (rui8_t)RKH_I16_T, \
850  (d_))
851 
856  #define RKH_TUSR_UI16(w_, d_) \
857  rkh_trc_fmt_u16((rui8_t)(((w_) << 4)) | (rui8_t)RKH_UI16_T, \
858  (d_))
859 
864  #define RKH_TUSR_I32(w_, d_) \
865  rkh_trc_fmt_u32((rui8_t)(((w_) << 4)) | (rui8_t)RKH_I32_T, \
866  (d_))
867 
872  #define RKH_TUSR_UI32(w_, d_) \
873  rkh_trc_fmt_u32((rui8_t)(((w_) << 4)) | (rui8_t)RKH_UI32_T, \
874  (d_))
875 
880  #define RKH_TUSR_X32(w_, d_) \
881  rkh_trc_fmt_u32((rui8_t)(((w_) << 4)) | (rui8_t)RKH_X32_T, \
882  (d_))
883 
888  #define RKH_TUSR_STR(s_) \
889  rkh_trc_fmt_str((s_))
890 
896  #define RKH_TUSR_MEM(mem_, size_) \
897  rkh_trc_fmt_mem((mem_), (size_))
898 
903  #if RKH_CFGPORT_TRC_SIZEOF_PTR == 16
904  #define RKH_TUSR_OBJ(obj_) \
905  rkh_trc_fmt_u16((rui8_t)RKH_OBJ_T, (rui16_t)(obj_))
906  #elif RKH_CFGPORT_TRC_SIZEOF_PTR == 32
907  #define RKH_TUSR_OBJ(obj_) \
908  rkh_trc_fmt_u32((rui8_t)RKH_OBJ_T, (rui32_t)(obj_))
909  #else
910  #define RKH_TUSR_OBJ(obj_) \
911  rkh_trc_fmt_u32((rui8_t)RKH_OBJ_T, (rui32_t)(obj_))
912  #endif
913 
918  #if RKH_CFGPORT_TRC_SIZEOF_FUN_PTR == 16u
919  #define RKH_TUSR_FUN(fun_) \
920  rkh_trc_fmt_u16((rui8_t)RKH_FUN_T, (rui16_t)(fun_))
921  #elif RKH_CFGPORT_TRC_SIZEOF_FUN_PTR == 32
922  #define RKH_TUSR_FUN(fun_) \
923  rkh_trc_fmt_u32((rui8_t)RKH_FUN_T, (rui32_t)(fun_))
924  #else
925  #define RKH_TUSR_FUN(fun_) \
926  rkh_trc_fmt_u32((rui8_t)RKH_FUN_T, (rui32_t)(fun_))
927  #endif
928 
933  #if RKH_CFG_FWK_SIZEOF_EVT == 8
934  #define RKH_TUSR_SIG(sig_) \
935  rkh_trc_fmt_u8((rui8_t)RKH_ESIG_T, (rui8_t)(sig_))
936  #elif RKH_CFG_FWK_SIZEOF_EVT == 16
937  #define RKH_TUSR_SIG(sig_) \
938  rkh_trc_fmt_u16((rui8_t)RKH_ESIG_T, (rui16_t)(sig_))
939  #elif RKH_CFG_FWK_SIZEOF_EVT == 32
940  #define RKH_TUSR_SIG(sig_) \
941  rkh_trc_fmt_u32((rui8_t)RKH_ESIG_T, (rui32_t)(sig_))
942  #else
943  #define RKH_TUSR_SIG(sig_) \
944  rkh_trc_fmt_u8((rui8_t)RKH_ESIG_T, (rui8_t)(sig_))
945  #endif
946 #else
947  #define RKH_TRC_USR_BEGIN(eid_) (void)0;
948  #define RKH_TRC_USR_END() (void)0
949  #define RKH_TRC_USR_BEGIN_NOCRIT(eid_) (void)0
950  #define RKH_TRC_USR_END_NOCRIT() (void)0
951  #define RKH_TUSR_I8(w_, d_) (void)0
952  #define RKH_TUSR_UI8(w_, d_) (void)0
953  #define RKH_TUSR_I16(w_, d_) (void)0
954  #define RKH_TUSR_UI16(w_, d_) (void)0
955  #define RKH_TUSR_I32(w_, d_) (void)0
956  #define RKH_TUSR_UI32(w_, d_) (void)0
957  #define RKH_TUSR_X32(w_, d_) (void)0
958  #define RKH_TUSR_STR(s_) (void)0
959  #define RKH_TUSR_MEM(mem_, size_) (void)0
960  #define RKH_TUSR_OBJ(obj_) (void)0
961  #define RKH_TUSR_FUN(fun_) (void)0
962  #define RKH_TUSR_SIG(sig_) (void)0
963 #endif
964 
969 #if RKH_CFGPORT_TRC_SIZEOF_PTR == 16
970  #define RKH_TRC_SYM(sym) \
971  RKH_TRC_UI16((rui16_t)sym)
972 #elif RKH_CFGPORT_TRC_SIZEOF_PTR == 32
973  #define RKH_TRC_SYM(sym) \
974  RKH_TRC_UI32((rui32_t)sym)
975 #else
976  #define RKH_TRC_SYM(sym) \
977  RKH_TRC_UI32((rui32_t)sym)
978 #endif
979 
984 #if defined(RKH_USE_TRC_SENDER)
985  #define RKH_TRC_SNDR(sym) \
986  RKH_TRC_SYM(sym)
987 #else
988  #define RKH_TRC_SNDR(sym)
989 #endif
990 
995 #if RKH_CFGPORT_TRC_SIZEOF_FUN_PTR == 16
996  #define RKH_TRC_FUN(sym) \
997  RKH_TRC_UI16((rui16_t)sym)
998 #elif RKH_CFGPORT_TRC_SIZEOF_FUN_PTR == 32
999  #define RKH_TRC_FUN(sym) \
1000  RKH_TRC_UI32((rui32_t)sym)
1001 #else
1002  #define RKH_TRC_FUN(sym) \
1003  RKH_TRC_UI32((rui32_t)sym)
1004 #endif
1005 
1009 #if RKH_CFG_TMR_SIZEOF_NTIMER == 8
1010  #define RKH_TRC_NTICK(nt) \
1011  RKH_TRC_UI8(nt)
1012 #elif RKH_CFG_TMR_SIZEOF_NTIMER == 16
1013  #define RKH_TRC_NTICK(nt) \
1014  RKH_TRC_UI16(nt)
1015 #elif RKH_CFG_TMR_SIZEOF_NTIMER == 32
1016  #define RKH_TRC_NTICK(nt) \
1017  RKH_TRC_UI32(nt)
1018 #else
1019  #define RKH_TRC_NTICK(nt) \
1020  RKH_TRC_UI8(nt)
1021 #endif
1022 
1026 #if RKH_CFG_MP_SIZEOF_NBLOCK == 8
1027  #define RKH_TRC_NBLK(nb) \
1028  RKH_TRC_UI8(nb)
1029  #if RKH_CFG_MP_GET_LWM_EN == RKH_ENABLED
1030  #define RKH_TRC_MP_NMIN(nm) \
1031  RKH_TRC_UI8(nm)
1032  #else
1033  #define RKH_TRC_MP_NMIN(nm)
1034  #endif
1035 #elif RKH_CFG_MP_SIZEOF_NBLOCK == 16
1036  #define RKH_TRC_NBLK(nb) \
1037  RKH_TRC_UI16(nb)
1038  #if RKH_CFG_MP_GET_LWM_EN == RKH_ENABLED
1039  #define RKH_TRC_MP_NMIN(nm) \
1040  RKH_TRC_UI16(nm)
1041  #else
1042  #define RKH_TRC_MP_NMIN(nm)
1043  #endif
1044 #elif RKH_CFG_MP_SIZEOF_NBLOCK == 32
1045  #define RKH_TRC_NBLK(nb) \
1046  RKH_TRC_UI32(nb)
1047  #if RKH_CFG_MP_GET_LWM_EN == RKH_ENABLED
1048  #define RKH_TRC_MP_NMIN(nm) \
1049  RKH_TRC_UI32(nm)
1050  #else
1051  #define RKH_TRC_MP_NMIN(nm)
1052  #endif
1053 #else
1054  #define RKH_TRC_NBLK(nb) \
1055  RKH_TRC_UI8(nb)
1056  #if RKH_CFG_MP_GET_LWM_EN == RKH_ENABLED
1057  #define RKH_TRC_MP_NMIN(nm) \
1058  RKH_TRC_UI8(nm)
1059  #else
1060  #define RKH_TRC_MP_NMIN(nm)
1061  #endif
1062 #endif
1063 
1067 #if RKH_CFG_MP_SIZEOF_BSIZE == 8
1068  #define RKH_TRC_BSIZE(bs) \
1069  RKH_TRC_UI8(bs)
1070 #elif RKH_CFG_MP_SIZEOF_BSIZE == 16
1071  #define RKH_TRC_BSIZE(bs) \
1072  RKH_TRC_UI16(bs)
1073 #elif RKH_CFG_MP_SIZEOF_BSIZE == 32
1074  #define RKH_TRC_BSIZE(bs) \
1075  RKH_TRC_UI32(bs)
1076 #else
1077  #define RKH_TRC_BSIZE(bs) \
1078  RKH_TRC_UI8(bs)
1079 #endif
1080 
1084 #if RKH_CFG_QUE_SIZEOF_NELEM == 8
1085  #define RKH_TRC_NE(ne) \
1086  RKH_TRC_UI8(ne)
1087  #if RKH_CFG_QUE_GET_LWMARK_EN == RKH_ENABLED
1088  #define RKH_TRC_QUE_NMIN(nm) \
1089  RKH_TRC_UI8(nm)
1090  #else
1091  #define RKH_TRC_QUE_NMIN(nm)
1092  #endif
1093 #elif RKH_CFG_QUE_SIZEOF_NELEM == 16
1094  #define RKH_TRC_NE(ne) \
1095  RKH_TRC_UI16(ne)
1096  #if RKH_CFG_QUE_GET_LWMARK_EN == RKH_ENABLED
1097  #define RKH_TRC_QUE_NMIN(nm) \
1098  RKH_TRC_UI16(nm)
1099  #else
1100  #define RKH_TRC_QUE_NMIN(nm)
1101  #endif
1102 #elif RKH_CFG_QUE_SIZEOF_NELEM == 32
1103  #define RKH_TRC_NE(ne) \
1104  RKH_TRC_UI32(ne)
1105  #if RKH_CFG_QUE_GET_LWMARK_EN == RKH_ENABLED
1106  #define RKH_TRC_QUE_NMIN(nm) \
1107  RKH_TRC_UI32(nm)
1108  #else
1109  #define RKH_TRC_QUE_NMIN(nm)
1110  #endif
1111 #else
1112  #define RKH_TRC_NE(ne) \
1113  RKH_TRC_UI8(ne)
1114  #if RKH_CFG_QUE_GET_LWMARK_EN == RKH_ENABLED
1115  #define RKH_TRC_QUE_NMIN(nm) \
1116  RKH_TRC_UI8(nm)
1117  #else
1118  #define RKH_TRC_QUE_NMIN(nm)
1119  #endif
1120 #endif
1121 
1125 #if RKH_CFG_FWK_SIZEOF_EVT == 8
1126  #define RKH_TRC_SIG(e) \
1127  RKH_TRC_UI8(e)
1128 #elif RKH_CFG_FWK_SIZEOF_EVT == 16
1129  #define RKH_TRC_SIG(e) \
1130  RKH_TRC_UI16(e)
1131 #elif RKH_CFG_FWK_SIZEOF_EVT == 32
1132  #define RKH_TRC_SIG(e) \
1133  RKH_TRC_UI32(e)
1134 #else
1135  #define RKH_TRC_SIG(e) \
1136  RKH_TRC_UI8(e)
1137 #endif
1138 
1142 #if RKH_CFG_FWK_SIZEOF_EVT_SIZE == 8
1143  #define RKH_TRC_ES(es) \
1144  RKH_TRC_UI8(es)
1145 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 16
1146  #define RKH_TRC_ES(es) \
1147  RKH_TRC_UI16(es)
1148 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 32
1149  #define RKH_TRC_ES(es) \
1150  RKH_TRC_UI32(es)
1151 #else
1152  #define RKH_TRC_ES(es) \
1153  RKH_TRC_UI8(es)
1154 #endif
1155 
1164 {
1177 };
1178 
1179 /* ------------------------------- Data types ------------------------------ */
1212 #if RKH_CFG_TRC_SIZEOF_TE_ID == 8
1213  typedef rui8_t RKH_TE_ID_T;
1214 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 16
1215  typedef rui16_t RKH_TE_ID_T;
1216 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 32
1217  typedef rui32_t RKH_TE_ID_T;
1218 #else
1219  typedef rui8_t RKH_TE_ID_T;
1220 #endif
1221 
1229 #if RKH_CFG_TRC_TSTAMP_EN == RKH_ENABLED
1230  #if RKH_CFGPORT_TRC_SIZEOF_TSTAMP == 8
1231  typedef rui8_t RKH_TS_T;
1232  #elif RKH_CFGPORT_TRC_SIZEOF_TSTAMP == 16
1233  typedef rui16_t RKH_TS_T;
1234  #elif RKH_CFGPORT_TRC_SIZEOF_TSTAMP == 32
1235  typedef rui32_t RKH_TS_T;
1236  #else
1237  typedef rui16_t RKH_TS_T;
1238  #endif
1239 #else
1240  typedef rui16_t RKH_TS_T;
1241 #endif
1242 
1243 #if RKH_CFG_TRC_SIZEOF_STREAM < 255u
1244  typedef rui8_t TRCQTY_T;
1245 #else
1246  typedef rui16_t TRCQTY_T;
1247 #endif
1248 
1253 typedef rui8_t RKH_TG_T;
1254 
1260 {
1268 
1269 #if RKH_CFG_TRC_SIZEOF_TE_ID == 8
1270 typedef rui8_t RKH_GM_OFFSET_T;
1271 typedef rui8_t RKH_GM_RANGE_T;
1272 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 16
1273 typedef rui16_t RKH_GM_OFFSET_T;
1274 typedef rui8_t RKH_GM_RANGE_T;
1275 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 32
1276 typedef rui32_t RKH_GM_OFFSET_T;
1277 typedef rui32_t RKH_GM_RANGE_T;
1278 #else
1279 typedef rui8_t RKH_GM_OFFSET_T;
1280 typedef rui8_t RKH_GM_RANGE_T;
1281 #endif
1282 
1283 typedef struct
1284 {
1285  RKH_GM_OFFSET_T offset;
1286  RKH_GM_RANGE_T range;
1287 } RKH_GMTBL_T;
1288 
1289 /* -------------------------- External variables --------------------------- */
1290 /* -------------------------- Function prototypes -------------------------- */
1291 /* -------------------- External C language linkage end -------------------- */
1292 #ifdef __cplusplus
1293 }
1294 #endif
1295 
1296 /* ------------------------------ Module end ------------------------------- */
1297 #endif
1298 
1299 /* ------------------------------ End of file ------------------------------ */
Executes a behavior (action) of state machine, it could be an entry, exit, effect, init, preprocessor or guard.
RKH_TRC_FMT
Enumerates data formats recognized by Trazer.
Executes a behavior (action) of state machine, it could be an entry, exit, effect, init, preprocessor or guard.
Executes a behavior (action) of state machine, it could be an entry, exit, effect, init, preprocessor or guard.
RKH engine interface.This header file is directly included in RKH interface file, rkh...
RKH_SUBTE_SM_EXE_ACT
Sub-event of RKH_TE_SM_EXE_ACT event.
rui8_t RKH_TE_ID_T
Describes a trace event identification (ID).
rui32_t RKH_TS_T
Defines the size of trace timestamp.
rui8_t RKH_TG_T
Group of events.
Executes a behavior (action) of state machine, it could be an entry, exit, effect, init, preprocessor or guard.
Executes a behavior (action) of state machine, it could be an entry, exit, effect, init, preprocessor or guard.
Executes a behavior (action) of state machine, it could be an entry, exit, effect, init, preprocessor or guard.