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 site: http://vortexmakes.com/que-es/
28  * RKH GitHub: https://github.com/vortexmakes/RKH
29  * RKH Sourceforge: https://sourceforge.net/projects/rkh-reactivesys/
30  * e-mail: lf@vortexmakes.com
31  * ---------------------------------------------------------------------------
32  */
33 
41 /* -------------------------- Development history -------------------------- */
42 /*
43  * 2017.04.15 LeFr v2.4.05 Initial version
44  */
45 
46 /* -------------------------------- Authors -------------------------------- */
47 /*
48  * LeFr Leandro Francucci lf@vortexmakes.com
49  */
50 
51 /* --------------------------------- Notes --------------------------------- */
52 /* --------------------------------- Module -------------------------------- */
53 #ifndef __RKHTRC_DEF_H__
54 #define __RKHTRC_DEF_H__
55 
56 /* ----------------------------- Include files ----------------------------- */
57 #include "rkhitl.h"
58 
59 /* ---------------------- External C language linkage ---------------------- */
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 /* --------------------------------- Macros -------------------------------- */
75 #define RKH_CFG_TRC_SIZEOF_TE_ID 8
76 
77 #if RKH_CFG_TRC_SIZEOF_TE_ID == 8
78  #define RKH_TRC_TE_ID(teid) \
79  RKH_TRC_UI8(teid)
80 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 16
81  #define RKH_TRC_TE_ID(teid) \
82  RKH_TRC_UI16(teid)
83 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 32
84  #define RKH_TRC_TE_ID(teid) \
85  RKH_TRC_UI32(teid)
86 #else
87  #define RKH_TRC_TE_ID(teid) \
88  RKH_TRC_UI8(teid)
89 #endif
90 
104 #if RKH_CFG_TRC_RTFIL_SMA_EN == RKH_ENABLED
105  #define RKH_TRC_AO_ISOFF(prio) \
106  && rkh_trc_symFil_isoff(RKHFilterSma, (RKH_TRC_FSLOT)(prio))
107 #else
108  #define RKH_TRC_AO_ISOFF(prio)
109 #endif
110 
113 #define RKH_TRC_IS_RESERVED_SIG(sig) \
114  (sig == RKH_COMPLETION_EVENT)
115 
129 #if RKH_CFG_TRC_RTFIL_SIGNAL_EN == RKH_ENABLED
130  #define RKH_TRC_SIG_ISOFF(sig) \
131  && (RKH_TRC_IS_RESERVED_SIG(sig) || \
132  rkh_trc_symFil_isoff(RKHFilterSignal, (RKH_TRC_FSLOT)(sig)))
133 #else
134  #define RKH_TRC_SIG_ISOFF(sig)
135 #endif
136 
137 /* -------------------------------- Constants ------------------------------ */
138 #if RKH_CFG_TRC_SIZEOF_TE_ID == 8
139  #define RKH_NBITS_GROUP 3
140 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 16
141  #define RKH_NBITS_GROUP 8
142 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 32
143  #define RKH_NBITS_GROUP 8
144 #else
145  #define RKH_NBITS_GROUP 3
146 #endif
147 
148 #define RKH_NBIT_EVENT_PER_GROUP (RKH_CFG_TRC_SIZEOF_TE_ID - \
149  RKH_NBITS_GROUP)
150 #define RKH_TRC_MAX_GROUPS RKH_BIT(RKH_NBITS_GROUP)
151 #define RKH_MAX_NUM_TE_PER_GROUP RKH_BIT(RKH_NBIT_EVENT_PER_GROUP)
152 #define NGSH RKH_NBIT_EVENT_PER_GROUP
153 #define RKH_GRP_MASK \
154  (RKH_TE_ID_T)((RKH_BIT(RKH_NBITS_GROUP) - 1) << \
155  RKH_NBIT_EVENT_PER_GROUP)
156 #define RKH_TE_MASK \
157  (RKH_TE_ID_T)(RKH_BIT(RKH_NBIT_EVENT_PER_GROUP) - 1)
158 
165 #define RKH_TRC_MAX_EVENTS \
166  (RKH_MAX_NUM_TE_PER_GROUP * RKH_TRC_MAX_GROUPS)
167 
168 #if ((RKH_CFG_FWK_MAX_SMA & (8 - 1)) == 0)
174  #define RKH_TRC_MAX_SMA (RKH_CFG_FWK_MAX_SMA / 8)
175 #else
176  #define RKH_TRC_MAX_SMA (RKH_CFG_FWK_MAX_SMA / 8 + 1)
177 #endif
178 
179 #if ((RKH_CFG_FWK_MAX_SIGNALS & (8 - 1)) == 0)
185  #define RKH_TRC_MAX_SIGNALS (RKH_CFG_FWK_MAX_SIGNALS / 8)
186 #else
187  #define RKH_TRC_MAX_SIGNALS (RKH_CFG_FWK_MAX_SIGNALS / 8 + 1)
188 #endif
189 
207 #define RKH_MP_START GRPLSH(RKH_TG_MP)
208 #define RKH_QUE_START GRPLSH(RKH_TG_QUE)
209 #define RKH_SMA_START GRPLSH(RKH_TG_SMA)
210 #define RKH_SM_START GRPLSH(RKH_TG_SM)
211 #define RKH_TMR_START GRPLSH(RKH_TG_TMR)
212 #define RKH_FWK_START GRPLSH(RKH_TG_FWK)
213 #define RKH_USR_START GRPLSH(RKH_TG_USR)
214 #define RKH_UT_START GRPLSH(RKH_TG_UT)
223 #define RKH_MP_TTBL_RANGE 1
224 #define RKH_QUE_TTBL_RANGE 1
225 #define RKH_SMA_TTBL_RANGE 2
226 #define RKH_SM_TTBL_RANGE 3
227 #define RKH_TIM_TTBL_RANGE 1
228 #define RKH_FWK_TTBL_RANGE 3
229 #define RKH_USR_TTBL_RANGE 4
230 #define RKH_UT_TTBL_RANGE 2
236 #define RKH_TOT_NUM_TRC_EVTS \
237  (RKH_MP_TTBL_RANGE + \
238  RKH_QUE_TTBL_RANGE + \
239  RKH_SMA_TTBL_RANGE + \
240  RKH_SM_TTBL_RANGE + \
241  RKH_TIM_TTBL_RANGE + \
242  RKH_FWK_TTBL_RANGE + \
243  RKH_USR_TTBL_RANGE + \
244  RKH_UT_TTBL_RANGE)
245 
251 #if (RKH_TOT_NUM_TRC_EVTS <= RKH_TOT_NUM_TRC_EVTS)
252  #define RKH_TRC_MAX_EVENTS_IN_BYTES RKH_TOT_NUM_TRC_EVTS
253 #else
254  #error "rkhtrc.h, the total number of trace events represented"
255  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
256 #endif
257 
258 #define RKH_MP_TTBL_OFFSET 0
259 #define RKH_QUE_TTBL_OFFSET (RKH_MP_TTBL_OFFSET + RKH_MP_TTBL_RANGE)
260 #define RKH_SMA_TTBL_OFFSET (RKH_QUE_TTBL_OFFSET + RKH_QUE_TTBL_RANGE)
261 #define RKH_SM_TTBL_OFFSET (RKH_SMA_TTBL_OFFSET + RKH_SMA_TTBL_RANGE)
262 #define RKH_TIM_TTBL_OFFSET (RKH_SM_TTBL_OFFSET + RKH_SM_TTBL_RANGE)
263 #define RKH_FWK_TTBL_OFFSET (RKH_TIM_TTBL_OFFSET + RKH_TIM_TTBL_RANGE)
264 #define RKH_USR_TTBL_OFFSET (RKH_FWK_TTBL_OFFSET + RKH_FWK_TTBL_RANGE)
265 #define RKH_UT_TTBL_OFFSET (RKH_USR_TTBL_OFFSET + RKH_USR_TTBL_RANGE)
266 
267 #define GRPLSH(grp) \
268  /*(RKH_TE_ID_T)(((grp) & (rui8_t)(RKH_TRC_MAX_GROUPS - 1)) << NGSH)*/ \
269  (((grp) & (RKH_TRC_MAX_GROUPS - 1)) << NGSH)
270 
271 #define EXTE(te, grp) \
272  (RKH_TE_ID_T)((te) - GRPLSH(grp))
273 
274 #define GETGRP(e) \
275  (RKH_TG_T)(((e) & RKH_GRP_MASK) >> RKH_NBIT_EVENT_PER_GROUP)
276 #define GETEVT(e) \
277  (RKH_TE_ID_T)((e) & RKH_TE_MASK)
278 
279 #define ECHANGE 0
280 #define EUNCHANGE 1
281 
286 #define RKH_TRC_ALL_GROUPS RKH_TG_NGROUP
287 
292 #define RKH_TRC_ALL_EVENTS RKH_TE_NEVENT
293 
298 #define RKH_TRC_SET_ALL(mode_) \
299  ((mode_) | RKH_TRC_ALL_FILTERS)
300 
301 #define RKH_TRC_ALL_FILTERS 0x80
302 #define RKH_FILTER_MODE_MASK ~RKH_TRC_ALL_FILTERS
303 
305 #define RKH_XOR 0x20
306 
308 #define RKH_FLG 0x7E
309 
311 #define RKH_ESC 0x7D
312 
313 /* --- RKH group of trace events ------------------------------------------- */
315 #define RKH_TG_MP 0
316 
318 #define RKH_TG_QUE 1
319 
321 #define RKH_TG_SMA 2
322 
324 #define RKH_TG_SM 3
325 
327 #define RKH_TG_TMR 4
328 
330 #define RKH_TG_FWK 5
331 
333 #define RKH_TG_USR 6
334 
336 #define RKH_TG_UT 7
337 
339 #define RKH_TG_NGROUP 8
340 
341 /* --- Memory Pool events (MP group) --------------------------------------- */
343 #define RKH_TE_MP_INIT RKH_MP_START
345 #define RKH_TE_MP_GET (RKH_TE_MP_INIT + 1)
347 #define RKH_TE_MP_PUT (RKH_TE_MP_GET + 1)
348 #define RKH_MP_END RKH_TE_MP_PUT
349 
350 /* --- Queue events (QUE group) --------------------------------------------- */
352 #define RKH_TE_QUE_INIT RKH_QUE_START
354 #define RKH_TE_QUE_GET (RKH_TE_QUE_INIT + 1)
356 #define RKH_TE_QUE_FIFO (RKH_TE_QUE_GET + 1)
358 #define RKH_TE_QUE_LIFO (RKH_TE_QUE_FIFO + 1)
360 #define RKH_TE_QUE_FULL (RKH_TE_QUE_LIFO + 1)
362 #define RKH_TE_QUE_DPT (RKH_TE_QUE_FULL + 1)
364 #define RKH_TE_QUE_GET_LAST (RKH_TE_QUE_DPT +1 )
365 #define RKH_QUE_END RKH_TE_QUE_GET_LAST
366 
367 /* --- State Machine Application events (SMA group) ------------------------ */
369 #define RKH_TE_SMA_ACT RKH_SMA_START
371 #define RKH_TE_SMA_TERM (RKH_TE_SMA_ACT + 1)
373 #define RKH_TE_SMA_GET (RKH_TE_SMA_TERM + 1)
375 #define RKH_TE_SMA_FIFO (RKH_TE_SMA_GET + 1)
377 #define RKH_TE_SMA_LIFO (RKH_TE_SMA_FIFO + 1)
379 #define RKH_TE_SMA_REG (RKH_TE_SMA_LIFO + 1)
381 #define RKH_TE_SMA_UNREG (RKH_TE_SMA_REG + 1)
383 #define RKH_TE_SMA_DEFER (RKH_TE_SMA_UNREG + 1)
385 #define RKH_TE_SMA_RCALL (RKH_TE_SMA_DEFER + 1)
386 #define RKH_SMA_END RKH_TE_SMA_RCALL
387 
388 /* --- State machine events (SM group) ------------------------------------- */
390 #define RKH_TE_SM_INIT RKH_SM_START
392 #define RKH_TE_SM_CLRH (RKH_TE_SM_INIT + 1)
394 #define RKH_TE_SM_TRN (RKH_TE_SM_CLRH + 1)
396 #define RKH_TE_SM_STATE (RKH_TE_SM_TRN + 1)
398 #define RKH_TE_SM_ENSTATE (RKH_TE_SM_STATE + 1)
400 #define RKH_TE_SM_EXSTATE (RKH_TE_SM_ENSTATE + 1)
402 #define RKH_TE_SM_NENEX (RKH_TE_SM_EXSTATE + 1)
404 #define RKH_TE_SM_NTRNACT (RKH_TE_SM_NENEX + 1)
406 #define RKH_TE_SM_TS_STATE (RKH_TE_SM_NTRNACT + 1)
408 #define RKH_TE_SM_EVT_PROC (RKH_TE_SM_TS_STATE + 1)
410 #define RKH_TE_SM_EVT_NFOUND (RKH_TE_SM_EVT_PROC + 1)
412 #define RKH_TE_SM_GRD_FALSE (RKH_TE_SM_EVT_NFOUND + 1)
414 #define RKH_TE_SM_CND_NFOUND (RKH_TE_SM_GRD_FALSE + 1)
416 #define RKH_TE_SM_UNKN_STATE (RKH_TE_SM_CND_NFOUND + 1)
418 #define RKH_TE_SM_EX_HLEVEL (RKH_TE_SM_UNKN_STATE + 1)
420 #define RKH_TE_SM_EX_TSEG (RKH_TE_SM_EX_HLEVEL + 1)
422 #define RKH_TE_SM_EXE_ACT (RKH_TE_SM_EX_TSEG + 1)
424 #define RKH_TE_SM_DCH (RKH_TE_SM_EXE_ACT + 1)
425 #define RKH_SM_END RKH_TE_SM_DCH
426 
427 /* --- Timer events (TMR group) -------------------------------------------- */
429 #define RKH_TE_TMR_INIT RKH_TMR_START
431 #define RKH_TE_TMR_START (RKH_TE_TMR_INIT + 1)
433 #define RKH_TE_TMR_STOP (RKH_TE_TMR_START + 1)
435 #define RKH_TE_TMR_TOUT (RKH_TE_TMR_STOP + 1)
437 #define RKH_TE_TMR_REM (RKH_TE_TMR_TOUT + 1)
438 #define RKH_TMR_END RKH_TE_TMR_REM
439 
440 /* --- Framework and misc. events (FWK group) ------------------------------ */
442 #define RKH_TE_FWK_EN RKH_FWK_START
444 #define RKH_TE_FWK_EX (RKH_TE_FWK_EN + 1)
446 #define RKH_TE_FWK_EPREG (RKH_TE_FWK_EX + 1)
448 #define RKH_TE_FWK_AE (RKH_TE_FWK_EPREG + 1)
450 #define RKH_TE_FWK_GC (RKH_TE_FWK_AE + 1)
452 #define RKH_TE_FWK_GCR (RKH_TE_FWK_GC + 1)
454 #define RKH_TE_FWK_OBJ (RKH_TE_FWK_GCR + 1)
456 #define RKH_TE_FWK_SIG (RKH_TE_FWK_OBJ + 1)
458 #define RKH_TE_FWK_FUN (RKH_TE_FWK_SIG + 1)
460 #define RKH_TE_FWK_EXE_FUN (RKH_TE_FWK_FUN + 1)
462 #define RKH_TE_FWK_SYNC_EVT (RKH_TE_FWK_EXE_FUN + 1)
464 #define RKH_TE_FWK_TUSR (RKH_TE_FWK_SYNC_EVT + 1)
466 #define RKH_TE_FWK_TCFG (RKH_TE_FWK_TUSR + 1)
468 #define RKH_TE_FWK_ASSERT (RKH_TE_FWK_TCFG + 1)
470 #define RKH_TE_FWK_AO (RKH_TE_FWK_ASSERT + 1)
472 #define RKH_TE_FWK_STATE (RKH_TE_FWK_AO + 1)
474 #define RKH_TE_FWK_PSTATE (RKH_TE_FWK_STATE + 1)
476 #define RKH_TE_FWK_TIMER (RKH_TE_FWK_PSTATE + 1)
478 #define RKH_TE_FWK_EPOOL (RKH_TE_FWK_TIMER + 1)
480 #define RKH_TE_FWK_QUEUE (RKH_TE_FWK_EPOOL + 1)
482 #define RKH_TE_FWK_ACTOR (RKH_TE_FWK_QUEUE + 1)
483 #define RKH_FWK_END RKH_TE_FWK_ACTOR
484 
485 /* --- User events (USR group) --------------------------------------------- */
486 #define RKH_TE_USER RKH_USR_START
487 
488 /* --- Unit test harness events (UT group) --------------------------------- */
489 #define RKH_TE_UT_INIT RKH_UT_START
490 #define RKH_TE_UT_CLEANUP (RKH_TE_UT_INIT + 1)
491 #define RKH_TE_UT_VERIFY (RKH_TE_UT_CLEANUP + 1)
492 #define RKH_TE_UT_IGNORE_GROUP (RKH_TE_UT_VERIFY + 1)
493 #define RKH_TE_UT_EXPECT (RKH_TE_UT_IGNORE_GROUP + 1)
494 #define RKH_TE_UT_EXPECT_ANYARGS (RKH_TE_UT_EXPECT + 1)
495 #define RKH_TE_UT_IGNORE (RKH_TE_UT_EXPECT_ANYARGS + 1)
496 #define RKH_TE_UT_IGNORE_ARG (RKH_TE_UT_IGNORE + 1)
497 #define RKH_TE_UT_SUCCESS (RKH_TE_UT_IGNORE_ARG + 1)
498 #define RKH_TE_UT_FAIL (RKH_TE_UT_SUCCESS + 1)
499 #define RKH_UT_END RKH_TE_UT_IGNORE_ARG
500 
501 /* The last trace event */
502 #define RKH_TE_NEVENT (RKH_UT_END + 1)
503 
504 /* ------------------------- Configuration errors -------------------------- */
505 /*
506  * LOOK FOR WRONG #define CONSTANTS
507  *
508  * This section is used to generate ERROR messages at compile time if
509  * certain #define constants are WRONG in rkhtrc.h. This allows you to
510  * quickly determine the source of the error.
511  *
512  * You SHOULD NOT change this section UNLESS you would like to add more
513  * comments as to the source of the compile time error.
514  */
515 #if ((RKH_MP_END - RKH_MP_START) > ((RKH_MP_TTBL_RANGE * 8) - 1))
516  #error "rkhtrc.h, the total number of trace events represented"
517  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
518 #endif
519 
520 #if ((RKH_QUE_END - RKH_QUE_START) > ((RKH_QUE_TTBL_RANGE * 8) - 1))
521  #error "rkhtrc.h, the total number of trace events represented"
522  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
523 #endif
524 
525 #if ((RKH_SMA_END - RKH_SMA_START) > ((RKH_SMA_TTBL_RANGE * 8) - 1))
526  #error "rkhtrc.h, the total number of trace events represented"
527  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
528 #endif
529 
530 #if ((RKH_SM_END - RKH_SM_START) > ((RKH_SM_TTBL_RANGE * 8) - 1))
531  #error "rkhtrc.h, the total number of trace events represented"
532  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
533 #endif
534 
535 #if ((RKH_TMR_END - RKH_TMR_START) > ((RKH_TIM_TTBL_RANGE * 8) - 1))
536  #error "rkhtrc.h, the total number of trace events represented"
537  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
538 #endif
539 
540 #if ((RKH_FWK_END - RKH_FWK_START) > ((RKH_FWK_TTBL_RANGE * 8) - 1))
541  #error "rkhtrc.h, the total number of trace events represented"
542  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
543 #endif
544 
545 #if ((RKH_UT_END - RKH_UT_START) > ((RKH_UT_TTBL_RANGE * 8) - 1))
546  #error "rkhtrc.h, the total number of trace events represented"
547  #error "by RKH_TOT_NUM_TRC_EVTS must be <= RKH_TRC_MAX_EVENTS"
548 #endif
549 
550 #if RKH_CFG_TRC_RTFIL_EN == RKH_ENABLED
571  #define RKH_TRC_BEGIN(eid_, prio_, sig_) \
572  if (rkh_trc_isoff_(eid_) \
573  RKH_TRC_AO_ISOFF(prio_) \
574  RKH_TRC_SIG_ISOFF(sig_)) \
575  { \
576  RKH_ENTER_CRITICAL_(); \
577  rkh_trc_begin(eid_);
578 
579  #define RKH_TRC_BEGIN_WOAO(eid_, sig_) \
580  if (rkh_trc_isoff_(eid_) \
581  RKH_TRC_SIG_ISOFF(sig_)) \
582  { \
583  RKH_ENTER_CRITICAL_(); \
584  rkh_trc_begin(eid_);
585 
586  #define RKH_TRC_BEGIN_WOSIG(eid_, prio_) \
587  if (rkh_trc_isoff_(eid_) \
588  RKH_TRC_AO_ISOFF(prio_)) \
589  { \
590  RKH_ENTER_CRITICAL_(); \
591  rkh_trc_begin(eid_);
592 
593  #define RKH_TRC_BEGIN_WOAOSIG(eid_) \
594  if (rkh_trc_isoff_(eid_)) \
595  { \
596  RKH_ENTER_CRITICAL_(); \
597  rkh_trc_begin(eid_);
598 
609  #define RKH_TRC_END() \
610  rkh_trc_end(); \
611  RKH_EXIT_CRITICAL_(); \
612  }
613 
622  #define RKH_TRC_BEGIN_NOCRIT(eid_, prio_, sig_) \
623  if (rkh_trc_isoff_(eid_) \
624  RKH_TRC_AO_ISOFF(prio_) \
625  RKH_TRC_SIG_ISOFF(sig_)) \
626  { \
627  rkh_trc_begin(eid_);
628 
637  #define RKH_TRC_BEGIN_WOAO_NOCRIT(eid_, sig_) \
638  if (rkh_trc_isoff_(eid_) \
639  RKH_TRC_SIG_ISOFF(sig_)) \
640  { \
641  rkh_trc_begin(eid_);
642 
651  #define RKH_TRC_BEGIN_WOSIG_NOCRIT(eid_, prio_) \
652  if (rkh_trc_isoff_(eid_) \
653  RKH_TRC_AO_ISOFF(prio_)) \
654  { \
655  rkh_trc_begin(eid_);
656 
664  #define RKH_TRC_BEGIN_WOAOSIG_NOCRIT(eid_) \
665  if (rkh_trc_isoff_(eid_)) \
666  { \
667  rkh_trc_begin(eid_);
668 
672  #define RKH_TRC_END_NOCRIT() \
673  rkh_trc_end(); \
674  }
675 #else
676  #define RKH_TRC_BEGIN(eid_, prio_, sig_) \
677  RKH_ENTER_CRITICAL_(); \
678  rkh_trc_begin(eid_);
679 
680  #define RKH_TRC_BEGIN_WOAO(eid_, sig_) \
681  RKH_ENTER_CRITICAL_(); \
682  rkh_trc_begin(eid_);
683 
684  #define RKH_TRC_BEGIN_WOSIG(eid_, prio_) \
685  RKH_ENTER_CRITICAL_(); \
686  rkh_trc_begin(eid_);
687 
688  #define RKH_TRC_BEGIN_WOAOSIG(eid_) \
689  RKH_ENTER_CRITICAL_(); \
690  rkh_trc_begin(eid_);
691 
692  #define RKH_TRC_END() \
693  rkh_trc_end(); \
694  RKH_EXIT_CRITICAL_();
695 
696  #define RKH_TRC_BEGIN_NOCRIT(eid_, prio_, sig_) \
697  rkh_trc_begin(eid_);
698 
699  #define RKH_TRC_BEGIN_WOAO_NOCRIT(eid_, sig_) \
700  rkh_trc_begin(eid_);
701 
702  #define RKH_TRC_BEGIN_WOSIG_NOCRIT(eid_, prio_) \
703  rkh_trc_begin(eid_);
704 
705  #define RKH_TRC_BEGIN_WOAOSIG_NOCRIT(eid_) \
706  rkh_trc_begin(eid_);
707 
708  #define RKH_TRC_END_NOCRIT() \
709  rkh_trc_end();
710 #endif
711 
716 #define RKH_TRC_BEGIN_WOFIL(eid_) \
717  RKH_SR_ALLOC(); \
718  RKH_ENTER_CRITICAL_(); \
719  rkh_trc_begin(eid_);
720 
725 #define RKH_TRC_END_WOFIL() \
726  rkh_trc_end(); \
727  RKH_EXIT_CRITICAL_();
728 
732 #define RKH_TRC_BEGIN_WOFIL_NOCRIT(eid_) \
733  rkh_trc_begin(eid_);
734 
739 #define RKH_TRC_END_WOFIL_NOCRIT() \
740  rkh_trc_end(); \
741 
746 #define RKH_TRC_BEGIN_DFT(eid_) \
747  RKH_SR_ALLOC(); \
748  RKH_ENTER_CRITICAL_(); \
749  rkh_trc_clear_chk(); \
750  RKH_TRC_TE_ID(eid_);
751 
756 #define RKH_TRC_END_DFT() \
757  rkh_trc_end(); \
758  RKH_EXIT_CRITICAL_();
759 
764 #define RKH_TRC_U8_RAW(d) \
765  rkh_trc_put((d))
766 
771 #define RKH_TRC_UI8(d) \
772  rkh_trc_u8((rui8_t)(d))
773 
778 #define RKH_TRC_UI16(d) \
779  rkh_trc_u16((d))
780 
785 #define RKH_TRC_UI32(d) \
786  rkh_trc_u32((d))
787 
792 #define RKH_TRC_STR(s) \
793  rkh_trc_str((s))
794 
795 #if RKH_CFG_TRC_USER_TRACE_EN == RKH_ENABLED
799  #define RKH_TRC_USR_BEGIN(eid_) \
800  RKH_SR_ALLOC(); \
801  if (rkh_trc_isoff_(eid_)) \
802  { \
803  RKH_ENTER_CRITICAL_(); \
804  rkh_trc_begin(eid_);
805 
809  #define RKH_TRC_USR_END() \
810  rkh_trc_end(); \
811  RKH_EXIT_CRITICAL_(); \
812  }
813 
818  #define RKH_TRC_USR_BEGIN_NOCRIT(eid_) \
819  if (rkh_trc_isoff_(eid_)) \
820  { \
821  rkh_trc_begin(eid_);
822 
826  #define RKH_TRC_USR_END_NOCRIT() \
827  rkh_trc_end(); \
828  }
829 
834  #define RKH_TUSR_I8(w_, d_) \
835  rkh_trc_fmt_u8((rui8_t)(((w_) << 4)) | (rui8_t)RKH_I8_T, \
836  (d_))
837 
842  #define RKH_TUSR_UI8(w_, d_) \
843  rkh_trc_fmt_u8((rui8_t)(((w_) << 4)) | (rui8_t)RKH_UI8_T, \
844  (d_))
845 
850  #define RKH_TUSR_I16(w_, d_) \
851  rkh_trc_fmt_u16((rui8_t)(((w_) << 4)) | (rui8_t)RKH_I16_T, \
852  (d_))
853 
858  #define RKH_TUSR_UI16(w_, d_) \
859  rkh_trc_fmt_u16((rui8_t)(((w_) << 4)) | (rui8_t)RKH_UI16_T, \
860  (d_))
861 
866  #define RKH_TUSR_I32(w_, d_) \
867  rkh_trc_fmt_u32((rui8_t)(((w_) << 4)) | (rui8_t)RKH_I32_T, \
868  (d_))
869 
874  #define RKH_TUSR_UI32(w_, d_) \
875  rkh_trc_fmt_u32((rui8_t)(((w_) << 4)) | (rui8_t)RKH_UI32_T, \
876  (d_))
877 
882  #define RKH_TUSR_X32(w_, d_) \
883  rkh_trc_fmt_u32((rui8_t)(((w_) << 4)) | (rui8_t)RKH_X32_T, \
884  (d_))
885 
890  #define RKH_TUSR_STR(s_) \
891  rkh_trc_fmt_str((s_))
892 
898  #define RKH_TUSR_MEM(mem_, size_) \
899  rkh_trc_fmt_mem((mem_), (size_))
900 
905  #if RKH_CFGPORT_TRC_SIZEOF_PTR == 16
906  #define RKH_TUSR_OBJ(obj_) \
907  rkh_trc_fmt_u16((rui8_t)RKH_OBJ_T, (rui16_t)(obj_))
908  #elif RKH_CFGPORT_TRC_SIZEOF_PTR == 32
909  #define RKH_TUSR_OBJ(obj_) \
910  rkh_trc_fmt_u32((rui8_t)RKH_OBJ_T, (rui32_t)(obj_))
911  #else
912  #define RKH_TUSR_OBJ(obj_) \
913  rkh_trc_fmt_u32((rui8_t)RKH_OBJ_T, (rui32_t)(obj_))
914  #endif
915 
920  #if RKH_CFGPORT_TRC_SIZEOF_FUN_PTR == 16u
921  #define RKH_TUSR_FUN(fun_) \
922  rkh_trc_fmt_u16((rui8_t)RKH_FUN_T, (rui16_t)(fun_))
923  #elif RKH_CFGPORT_TRC_SIZEOF_FUN_PTR == 32
924  #define RKH_TUSR_FUN(fun_) \
925  rkh_trc_fmt_u32((rui8_t)RKH_FUN_T, (rui32_t)(fun_))
926  #else
927  #define RKH_TUSR_FUN(fun_) \
928  rkh_trc_fmt_u32((rui8_t)RKH_FUN_T, (rui32_t)(fun_))
929  #endif
930 
935  #if RKH_CFG_FWK_SIZEOF_EVT == 8
936  #define RKH_TUSR_SIG(sig_) \
937  rkh_trc_fmt_u8((rui8_t)RKH_ESIG_T, (rui8_t)(sig_))
938  #elif RKH_CFG_FWK_SIZEOF_EVT == 16
939  #define RKH_TUSR_SIG(sig_) \
940  rkh_trc_fmt_u16((rui8_t)RKH_ESIG_T, (rui16_t)(sig_))
941  #elif RKH_CFG_FWK_SIZEOF_EVT == 32
942  #define RKH_TUSR_SIG(sig_) \
943  rkh_trc_fmt_u32((rui8_t)RKH_ESIG_T, (rui32_t)(sig_))
944  #else
945  #define RKH_TUSR_SIG(sig_) \
946  rkh_trc_fmt_u8((rui8_t)RKH_ESIG_T, (rui8_t)(sig_))
947  #endif
948 #else
949  #define RKH_TRC_USR_BEGIN(eid_) (void)0;
950  #define RKH_TRC_USR_END() (void)0
951  #define RKH_TRC_USR_BEGIN_NOCRIT(eid_) (void)0
952  #define RKH_TRC_USR_END_NOCRIT() (void)0
953  #define RKH_TUSR_I8(w_, d_) (void)0
954  #define RKH_TUSR_UI8(w_, d_) (void)0
955  #define RKH_TUSR_I16(w_, d_) (void)0
956  #define RKH_TUSR_UI16(w_, d_) (void)0
957  #define RKH_TUSR_I32(w_, d_) (void)0
958  #define RKH_TUSR_UI32(w_, d_) (void)0
959  #define RKH_TUSR_X32(w_, d_) (void)0
960  #define RKH_TUSR_STR(s_) (void)0
961  #define RKH_TUSR_MEM(mem_, size_) (void)0
962  #define RKH_TUSR_OBJ(obj_) (void)0
963  #define RKH_TUSR_FUN(fun_) (void)0
964  #define RKH_TUSR_SIG(sig_) (void)0
965 #endif
966 
971 #if RKH_CFGPORT_TRC_SIZEOF_PTR == 16
972  #define RKH_TRC_SYM(sym) \
973  RKH_TRC_UI16((rui16_t)sym)
974 #elif RKH_CFGPORT_TRC_SIZEOF_PTR == 32
975  #define RKH_TRC_SYM(sym) \
976  RKH_TRC_UI32((rui32_t)sym)
977 #else
978  #define RKH_TRC_SYM(sym) \
979  RKH_TRC_UI32((rui32_t)sym)
980 #endif
981 
986 #if defined(RKH_USE_TRC_SENDER)
987  #define RKH_TRC_SNDR(sym) \
988  RKH_TRC_SYM(sym)
989 #else
990  #define RKH_TRC_SNDR(sym)
991 #endif
992 
997 #if RKH_CFGPORT_TRC_SIZEOF_FUN_PTR == 16
998  #define RKH_TRC_FUN(sym) \
999  RKH_TRC_UI16((rui16_t)sym)
1000 #elif RKH_CFGPORT_TRC_SIZEOF_FUN_PTR == 32
1001  #define RKH_TRC_FUN(sym) \
1002  RKH_TRC_UI32((rui32_t)sym)
1003 #else
1004  #define RKH_TRC_FUN(sym) \
1005  RKH_TRC_UI32((rui32_t)sym)
1006 #endif
1007 
1011 #if RKH_CFG_TMR_SIZEOF_NTIMER == 8
1012  #define RKH_TRC_NTICK(nt) \
1013  RKH_TRC_UI8(nt)
1014 #elif RKH_CFG_TMR_SIZEOF_NTIMER == 16
1015  #define RKH_TRC_NTICK(nt) \
1016  RKH_TRC_UI16(nt)
1017 #elif RKH_CFG_TMR_SIZEOF_NTIMER == 32
1018  #define RKH_TRC_NTICK(nt) \
1019  RKH_TRC_UI32(nt)
1020 #else
1021  #define RKH_TRC_NTICK(nt) \
1022  RKH_TRC_UI8(nt)
1023 #endif
1024 
1028 #if RKH_CFG_MP_SIZEOF_NBLOCK == 8
1029  #define RKH_TRC_NBLK(nb) \
1030  RKH_TRC_UI8(nb)
1031  #if RKH_CFG_MP_GET_LWM_EN == RKH_ENABLED
1032  #define RKH_TRC_MP_NMIN(nm) \
1033  RKH_TRC_UI8(nm)
1034  #else
1035  #define RKH_TRC_MP_NMIN(nm)
1036  #endif
1037 #elif RKH_CFG_MP_SIZEOF_NBLOCK == 16
1038  #define RKH_TRC_NBLK(nb) \
1039  RKH_TRC_UI16(nb)
1040  #if RKH_CFG_MP_GET_LWM_EN == RKH_ENABLED
1041  #define RKH_TRC_MP_NMIN(nm) \
1042  RKH_TRC_UI16(nm)
1043  #else
1044  #define RKH_TRC_MP_NMIN(nm)
1045  #endif
1046 #elif RKH_CFG_MP_SIZEOF_NBLOCK == 32
1047  #define RKH_TRC_NBLK(nb) \
1048  RKH_TRC_UI32(nb)
1049  #if RKH_CFG_MP_GET_LWM_EN == RKH_ENABLED
1050  #define RKH_TRC_MP_NMIN(nm) \
1051  RKH_TRC_UI32(nm)
1052  #else
1053  #define RKH_TRC_MP_NMIN(nm)
1054  #endif
1055 #else
1056  #define RKH_TRC_NBLK(nb) \
1057  RKH_TRC_UI8(nb)
1058  #if RKH_CFG_MP_GET_LWM_EN == RKH_ENABLED
1059  #define RKH_TRC_MP_NMIN(nm) \
1060  RKH_TRC_UI8(nm)
1061  #else
1062  #define RKH_TRC_MP_NMIN(nm)
1063  #endif
1064 #endif
1065 
1069 #if RKH_CFG_MP_SIZEOF_BSIZE == 8
1070  #define RKH_TRC_BSIZE(bs) \
1071  RKH_TRC_UI8(bs)
1072 #elif RKH_CFG_MP_SIZEOF_BSIZE == 16
1073  #define RKH_TRC_BSIZE(bs) \
1074  RKH_TRC_UI16(bs)
1075 #elif RKH_CFG_MP_SIZEOF_BSIZE == 32
1076  #define RKH_TRC_BSIZE(bs) \
1077  RKH_TRC_UI32(bs)
1078 #else
1079  #define RKH_TRC_BSIZE(bs) \
1080  RKH_TRC_UI8(bs)
1081 #endif
1082 
1086 #if RKH_CFG_QUE_SIZEOF_NELEM == 8
1087  #define RKH_TRC_NE(ne) \
1088  RKH_TRC_UI8(ne)
1089  #if RKH_CFG_QUE_GET_LWMARK_EN == RKH_ENABLED
1090  #define RKH_TRC_QUE_NMIN(nm) \
1091  RKH_TRC_UI8(nm)
1092  #else
1093  #define RKH_TRC_QUE_NMIN(nm)
1094  #endif
1095 #elif RKH_CFG_QUE_SIZEOF_NELEM == 16
1096  #define RKH_TRC_NE(ne) \
1097  RKH_TRC_UI16(ne)
1098  #if RKH_CFG_QUE_GET_LWMARK_EN == RKH_ENABLED
1099  #define RKH_TRC_QUE_NMIN(nm) \
1100  RKH_TRC_UI16(nm)
1101  #else
1102  #define RKH_TRC_QUE_NMIN(nm)
1103  #endif
1104 #elif RKH_CFG_QUE_SIZEOF_NELEM == 32
1105  #define RKH_TRC_NE(ne) \
1106  RKH_TRC_UI32(ne)
1107  #if RKH_CFG_QUE_GET_LWMARK_EN == RKH_ENABLED
1108  #define RKH_TRC_QUE_NMIN(nm) \
1109  RKH_TRC_UI32(nm)
1110  #else
1111  #define RKH_TRC_QUE_NMIN(nm)
1112  #endif
1113 #else
1114  #define RKH_TRC_NE(ne) \
1115  RKH_TRC_UI8(ne)
1116  #if RKH_CFG_QUE_GET_LWMARK_EN == RKH_ENABLED
1117  #define RKH_TRC_QUE_NMIN(nm) \
1118  RKH_TRC_UI8(nm)
1119  #else
1120  #define RKH_TRC_QUE_NMIN(nm)
1121  #endif
1122 #endif
1123 
1127 #if RKH_CFG_FWK_SIZEOF_EVT == 8
1128  #define RKH_TRC_SIG(e) \
1129  RKH_TRC_UI8(e)
1130 #elif RKH_CFG_FWK_SIZEOF_EVT == 16
1131  #define RKH_TRC_SIG(e) \
1132  RKH_TRC_UI16(e)
1133 #elif RKH_CFG_FWK_SIZEOF_EVT == 32
1134  #define RKH_TRC_SIG(e) \
1135  RKH_TRC_UI32(e)
1136 #else
1137  #define RKH_TRC_SIG(e) \
1138  RKH_TRC_UI8(e)
1139 #endif
1140 
1144 #if RKH_CFG_FWK_SIZEOF_EVT_SIZE == 8
1145  #define RKH_TRC_ES(es) \
1146  RKH_TRC_UI8(es)
1147 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 16
1148  #define RKH_TRC_ES(es) \
1149  RKH_TRC_UI16(es)
1150 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 32
1151  #define RKH_TRC_ES(es) \
1152  RKH_TRC_UI32(es)
1153 #else
1154  #define RKH_TRC_ES(es) \
1155  RKH_TRC_UI8(es)
1156 #endif
1157 
1166 {
1178  RKH_ESIG_T
1179 };
1180 
1181 /* ------------------------------- Data types ------------------------------ */
1214 #if RKH_CFG_TRC_SIZEOF_TE_ID == 8
1215  typedef rui8_t RKH_TE_ID_T;
1216 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 16
1217  typedef rui16_t RKH_TE_ID_T;
1218 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 32
1219  typedef rui32_t RKH_TE_ID_T;
1220 #else
1221  typedef rui8_t RKH_TE_ID_T;
1222 #endif
1223 
1231 #if RKH_CFG_TRC_TSTAMP_EN == RKH_ENABLED
1232  #if RKH_CFGPORT_TRC_SIZEOF_TSTAMP == 8
1233  typedef rui8_t RKH_TS_T;
1234  #elif RKH_CFGPORT_TRC_SIZEOF_TSTAMP == 16
1235  typedef rui16_t RKH_TS_T;
1236  #elif RKH_CFGPORT_TRC_SIZEOF_TSTAMP == 32
1237  typedef rui32_t RKH_TS_T;
1238  #else
1239  typedef rui16_t RKH_TS_T;
1240  #endif
1241 #else
1242  typedef rui16_t RKH_TS_T;
1243 #endif
1244 
1245 #if RKH_CFG_TRC_SIZEOF_STREAM < 255u
1246  typedef rui8_t TRCQTY_T;
1247 #else
1248  typedef rui16_t TRCQTY_T;
1249 #endif
1250 
1255 typedef rui8_t RKH_TG_T;
1256 
1262 {
1270 
1271 #if RKH_CFG_TRC_SIZEOF_TE_ID == 8
1272 typedef rui8_t RKH_GM_OFFSET_T;
1273 typedef rui8_t RKH_GM_RANGE_T;
1274 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 16
1275 typedef rui16_t RKH_GM_OFFSET_T;
1276 typedef rui8_t RKH_GM_RANGE_T;
1277 #elif RKH_CFG_TRC_SIZEOF_TE_ID == 32
1278 typedef rui32_t RKH_GM_OFFSET_T;
1279 typedef rui32_t RKH_GM_RANGE_T;
1280 #else
1281 typedef rui8_t RKH_GM_OFFSET_T;
1282 typedef rui8_t RKH_GM_RANGE_T;
1283 #endif
1284 
1285 typedef struct
1286 {
1287  RKH_GM_OFFSET_T offset;
1288  RKH_GM_RANGE_T range;
1289 } RKH_GMTBL_T;
1290 
1291 /* -------------------------- External variables --------------------------- */
1292 /* -------------------------- Function prototypes -------------------------- */
1293 /* -------------------- External C language linkage end -------------------- */
1294 #ifdef __cplusplus
1295 }
1296 #endif
1297 
1298 /* ------------------------------ Module end ------------------------------- */
1299 #endif
1300 
1301 /* ------------------------------ End of file ------------------------------ */
RKH engine interface.This header file is directly included in RKH interface file, rkh....
rui8_t RKH_TG_T
Group of events.
RKH_TRC_FMT
Enumerates data formats recognized by Trazer.
@ RKH_X32_T
@ RKH_I16_T
@ RKH_I32_T
@ RKH_UI16_T
@ RKH_STR_T
@ RKH_UI32_T
@ RKH_I8_T
@ RKH_ESIG_T
@ RKH_MEM_T
@ RKH_FUN_T
@ RKH_OBJ_T
@ RKH_UI8_T
rui32_t RKH_TS_T
Defines the size of trace timestamp.
rui8_t RKH_TE_ID_T
Describes a trace event identification (ID).
RKH_SUBTE_SM_EXE_ACT
Sub-event of RKH_TE_SM_EXE_ACT event.
@ RKH_SUBTE_SM_EXE_ACT_EX
Executes a behavior (action) of state machine, it could be an entry, exit, effect,...
@ RKH_SUBTE_SM_EXE_ACT_PP
Executes a behavior (action) of state machine, it could be an entry, exit, effect,...
@ RKH_SUBTE_SM_EXE_ACT_EN
Executes a behavior (action) of state machine, it could be an entry, exit, effect,...
@ RKH_SUBTE_SM_EXE_ACT_EFF
Executes a behavior (action) of state machine, it could be an entry, exit, effect,...
@ RKH_SUBTE_SM_EXE_ACT_INI
Executes a behavior (action) of state machine, it could be an entry, exit, effect,...
@ RKH_SUBTE_SM_EXE_ACT_GRD
Executes a behavior (action) of state machine, it could be an entry, exit, effect,...