QP/C  7.0.1
Real-Time Embedded Framework
qs.h
Go to the documentation of this file.
1/*$file${include::qs.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
2/*
3* Model: qpc.qm
4* File: ${include::qs.h}
5*
6* This code has been generated by QM 5.2.1 <www.state-machine.com/qm>.
7* DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
8*
9* This code is covered by the following QP license:
10* License # : LicenseRef-QL-dual
11* Issued to : Any user of the QP/C real-time embedded framework
12* Framework(s) : qpc
13* Support ends : 2023-12-31
14* License scope:
15*
16* Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
17*
18* SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
19*
20* This software is dual-licensed under the terms of the open source GNU
21* General Public License version 3 (or any later version), or alternatively,
22* under the terms of one of the closed source Quantum Leaps commercial
23* licenses.
24*
25* The terms of the open source GNU General Public License version 3
26* can be found at: <www.gnu.org/licenses/gpl-3.0>
27*
28* The terms of the closed source Quantum Leaps commercial licenses
29* can be found at: <www.state-machine.com/licensing>
30*
31* Redistributions in source code must retain this top-level comment block.
32* Plagiarizing this software to sidestep the license obligations is illegal.
33*
34* Contact information:
35* <www.state-machine.com/licensing>
36* <info@state-machine.com>
37*/
38/*$endhead${include::qs.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
46#ifndef QS_H
47#define QS_H
48
49#ifndef Q_SPY
50 #error "Q_SPY must be defined to include qs.h"
51#endif
52
53/*==========================================================================*/
54/*$declare${QS-config} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
55
56/*${QS-config::QS_TIME_SIZE} ...............................................*/
65#ifndef QS_TIME_SIZE
66#define QS_TIME_SIZE 4U
67#endif /* ndef QS_TIME_SIZE */
68
69/*${QS-config::QS_TIME_SIZE defined incorrectly~} ..........................*/
70#if (QS_TIME_SIZE != 1U) && (QS_TIME_SIZE != 2U) && (QS_TIME_SIZE != 4U)
71#error QS_TIME_SIZE defined incorrectly, expected 1U, 2U, or 4U;
72#endif /* (QS_TIME_SIZE != 1U) && (QS_TIME_SIZE != 2U) && (QS_TIME_SIZE != 4U) */
73/*$enddecl${QS-config} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
74
75/*==========================================================================*/
76/*$declare${QS} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
77
78/*${QS::QSTimeCtr} .........................................................*/
80#if (QS_TIME_SIZE == 4U)
81typedef uint32_t QSTimeCtr;
82#endif /* (QS_TIME_SIZE == 4U) */
83
84/*${QS::QSTimeCtr} .........................................................*/
85#if (QS_TIME_SIZE == 2U)
86typedef uint16_t QSTimeCtr;
87#endif /* (QS_TIME_SIZE == 2U) */
88
89/*${QS::QSTimeCtr} .........................................................*/
90#if (QS_TIME_SIZE == 1U)
91typedef uint8_t QSTimeCtr;
92#endif /* (QS_TIME_SIZE == 1U) */
93
94/*${QS::QSFun} .............................................................*/
96#if (QS_FUN_PTR_SIZE == 4U)
97typedef uint32_t QSFun;
98#endif /* (QS_FUN_PTR_SIZE == 4U) */
99
100/*${QS::QSFun} .............................................................*/
101#if (QS_FUN_PTR_SIZE == 8U)
102typedef uint64_t QSFun;
103#endif /* (QS_FUN_PTR_SIZE == 8U) */
104
105/*${QS::QSFun} .............................................................*/
106#if (QS_FUN_PTR_SIZE == 2U)
107typedef uint16_t QSFun;
108#endif /* (QS_FUN_PTR_SIZE == 2U) */
109
110/*${QS::QSFun} .............................................................*/
111#if (QS_FUN_PTR_SIZE == 1U)
112typedef uint8_t QSFun;
113#endif /* (QS_FUN_PTR_SIZE == 1U) */
114
115/*${QS::QSCtr} .............................................................*/
117typedef uint_fast16_t QSCtr;
118
119/*${QS::QSpyPre} ...........................................................*/
135 /* [0] QS session (not maskable) */
138 /* [1] SM records */
149 /* [10] Active Object (AO) records */
160 /* [19] Event Queue (EQ) records */
166 /* [23] Framework (QF) records */
169 /* [24] Memory Pool (MP) records */
173 /* [26] Additional Framework (QF) records */
181 /* [32] Time Event (TE) records */
189 /* [38] Additional Framework (QF) records */
198 /* [45] Additional Active Object (AO) records */
201 /* [46] Additional Event Queue (EQ) records */
204 /* [47] Additional Memory Pool (MP) records */
207 /* [48] Scheduler (SC) records */
216 /* [55] Additional QEP records */
221 /* [58] Miscellaneous QS records (not maskable) */
237};
238
239/*${QS::QSpyGroups} ........................................................*/
257
258/*${QS::QSpyUserOffsets} ...................................................*/
261 QS_USER = 100,
266 QS_USER4 = (enum_t)QS_USER3 + 5
268
269/*${QS::QSpyIdOffsets} .....................................................*/
273 QS_EP_ID = 64,
274 QS_EQ_ID = 80,
275 QS_AP_ID = 96,
276};
277
278/*${QS::QSpyIdGroups} ......................................................*/
281 QS_ALL_IDS = 0xF0,
286};
287
288/*${QS::QSpyFunPtr} ........................................................*/
290typedef void (* QSpyFunPtr )(void);
291
292/*${QS::QS_EOD} ............................................................*/
296#define QS_EOD ((uint16_t)0xFFFFU)
297
298/*${QS::QSpyId} ............................................................*/
300typedef struct { uint8_t prio; } QSpyId;
301
302/*${QS::QS-tx::tx} .........................................................*/
308typedef struct {
309/* public: */
310
312 uint8_t glbFilter[16];
313
315 uint8_t locFilter[16];
316
318 void const * locFilter_AP;
319
321 uint8_t * buf;
322
325
327 QSCtr volatile head;
328
330 QSCtr volatile tail;
331
333 QSCtr volatile used;
334
336 uint8_t volatile seq;
337
339 uint8_t volatile chksum;
340
342 uint8_t volatile critNest;
343} QS_tx;
344
345/*${QS::QS-tx::preType} ....................................................*/
370
371/*${QS::QS-tx::priv_} ......................................................*/
373extern QS_tx QS_priv_;
374
375/*${QS::QS-tx::initBuf} ....................................................*/
400void QS_initBuf(
401 uint8_t * const sto,
402 uint_fast16_t const stoSize);
403
404/*${QS::QS-tx::getByte} ....................................................*/
419uint16_t QS_getByte(void);
420
421/*${QS::QS-tx::getBlock} ...................................................*/
449uint8_t const * QS_getBlock(uint16_t * const pNbytes);
450
451/*${QS::QS-tx::glbFilter_} .................................................*/
473void QS_glbFilter_(int_fast16_t const filter);
474
475/*${QS::QS-tx::locFilter_} .................................................*/
497void QS_locFilter_(int_fast16_t const filter);
498
499/*${QS::QS-tx::doOutput} ...................................................*/
503void QS_doOutput(void);
504
505/*${QS::QS-tx::beginRec_} ..................................................*/
515void QS_beginRec_(uint_fast8_t const rec);
516
517/*${QS::QS-tx::endRec_} ....................................................*/
527void QS_endRec_(void);
528
529/*${QS::QS-tx::u8_raw_} ....................................................*/
533void QS_u8_raw_(uint8_t const d);
534
535/*${QS::QS-tx::2u8_raw_} ...................................................*/
539void QS_2u8_raw_(
540 uint8_t const d1,
541 uint8_t const d2);
542
543/*${QS::QS-tx::u16_raw_} ...................................................*/
547void QS_u16_raw_(uint16_t d);
548
549/*${QS::QS-tx::u32_raw_} ...................................................*/
553void QS_u32_raw_(uint32_t d);
554
555/*${QS::QS-tx::obj_raw_} ...................................................*/
562void QS_obj_raw_(void const * const obj);
563
564/*${QS::QS-tx::str_raw_} ...................................................*/
571void QS_str_raw_(char const * str);
572
573/*${QS::QS-tx::u8_fmt_} ....................................................*/
581void QS_u8_fmt_(
582 uint8_t const format,
583 uint8_t const d);
584
585/*${QS::QS-tx::u16_fmt_} ...................................................*/
593void QS_u16_fmt_(
594 uint8_t format,
595 uint16_t d);
596
597/*${QS::QS-tx::u32_fmt_} ...................................................*/
604void QS_u32_fmt_(
605 uint8_t format,
606 uint32_t d);
607
608/*${QS::QS-tx::str_fmt_} ...................................................*/
612void QS_str_fmt_(char const * str);
613
614/*${QS::QS-tx::mem_fmt_} ...................................................*/
618void QS_mem_fmt_(
619 uint8_t const * blk,
620 uint8_t size);
621
622/*${QS::QS-tx::sig_dict_pre_} ..............................................*/
629 enum_t const sig,
630 void const * const obj,
631 char const * const name);
632
633/*${QS::QS-tx::obj_dict_pre_} ..............................................*/
640 void const * const obj,
641 char const * const name);
642
643/*${QS::QS-tx::obj_arr_dict_pre_} ..........................................*/
650 void const * const obj,
651 uint_fast16_t const idx,
652 char const * const name);
653
654/*${QS::QS-tx::fun_dict_pre_} ..............................................*/
661 QSpyFunPtr fun,
662 char const * const name);
663
664/*${QS::QS-tx::usr_dict_pre_} ..............................................*/
671 enum_t const rec,
672 char const * const name);
673
674/*${QS::QS-tx::ASSERTION} ..................................................*/
681void QS_ASSERTION(
682 char const * const module,
683 int_t const loc,
684 uint32_t const delay);
685
686/*${QS::QS-tx::target_info_pre_} ...........................................*/
690void QS_target_info_pre_(uint8_t const isReset);
691
692/*${QS::QS-tx::onStartup} ..................................................*/
696uint8_t QS_onStartup(void const * arg);
697
698/*${QS::QS-tx::onCleanup} ..................................................*/
699void QS_onCleanup(void);
700
701/*${QS::QS-tx::onFlush} ....................................................*/
702void QS_onFlush(void);
703
704/*${QS::QS-tx::onGetTime} ..................................................*/
706
707/*${QS::QS-tx-64bit::u64_raw_} .............................................*/
711void QS_u64_raw_(uint64_t d);
712
713/*${QS::QS-tx-64bit::u64_fmt_} .............................................*/
718void QS_u64_fmt_(
719 uint8_t format,
720 uint64_t d);
721
722/*${QS::QS-tx-fp::f32_fmt_} ................................................*/
727void QS_f32_fmt_(
728 uint8_t format,
729 float32_t d);
730
731/*${QS::QS-tx-fp::f64_fmt_} ................................................*/
736void QS_f64_fmt_(
737 uint8_t format,
738 float64_t d);
739
740/*${QS::QS-rx::rx} .........................................................*/
742typedef struct {
743/* public: */
744 void * currObj[8];
745 uint8_t * buf;
747 QSCtr volatile head;
748 QSCtr volatile tail;
749#ifdef Q_UTEST
751#endif /* def Q_UTEST */
752} QS_rx;
753
754/*${QS::QS-rx::rxPriv_} ....................................................*/
756extern QS_rx QS_rxPriv_;
757
758/*${QS::QS-rx::QSpyObjKind} ................................................*/
767 MAX_OBJ
769
770/*${QS::QS-rx::OSpyObjCombnation} ..........................................*/
775
776/*${QS::QS-rx::rxInitBuf} ..................................................*/
802void QS_rxInitBuf(
803 uint8_t * const sto,
804 uint16_t const stoSize);
805
806/*${QS::QS-rx::rxPut} ......................................................*/
810static inline bool QS_rxPut(uint8_t const b) {
811 QSCtr head = QS_rxPriv_.head + 1U;
812 if (head == QS_rxPriv_.end) {
813 head = 0U;
814 }
815 if (head != QS_rxPriv_.tail) { /* buffer NOT full? */
817 QS_rxPriv_.head = head; /* update the head to a *valid* index */
818 return true; /* byte placed in the buffer */
819 }
820 else {
821 return false; /* byte NOT placed in the buffer */
822 }
823}
824
825/*${QS::QS-rx::rxGetNfree} .................................................*/
837uint16_t QS_rxGetNfree(void);
838
839/*${QS::QS-rx::doInput} ....................................................*/
843void QS_doInput(void);
844
845/*${QS::QS-rx::setCurrObj} .................................................*/
852void QS_setCurrObj(
853 uint8_t obj_kind,
854 void * obj_ptr);
855
856/*${QS::QS-rx::queryCurrObj} ...............................................*/
864void QS_queryCurrObj(uint8_t obj_kind);
865
866/*${QS::QS-rx::rxParse} ....................................................*/
870void QS_rxParse(void);
871
872/*${QS::QS-rx::rxHandleGoodFrame_} .........................................*/
876void QS_rxHandleGoodFrame_(uint8_t const state);
877
878/*${QS::QS-rx::onReset} ....................................................*/
882void QS_onReset(void);
883
884/*${QS::QS-rx::onCommand} ..................................................*/
888void QS_onCommand(
889 uint8_t cmdId,
890 uint32_t param1,
891 uint32_t param2,
892 uint32_t param3);
893
894/*${QS::QS-rx::RX_PUT} .....................................................*/
898bool QS_RX_PUT(uint8_t const b);
899/*$enddecl${QS} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
900
901/*==========================================================================*/
902/*$declare${QS-macros} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
903
904/*${QS-macros::QS_INIT} ....................................................*/
913#define QS_INIT(arg_) (QS_onStartup(arg_))
914
915/*${QS-macros::QS_EXIT} ....................................................*/
923#define QS_EXIT() (QS_onCleanup())
924
925/*${QS-macros::QS_OUTPUT} ..................................................*/
931#define QS_OUTPUT() (QS_output())
932
933/*${QS-macros::QS_RX_INPUT} ................................................*/
939#define QS_RX_INPUT() (QS_rx_input())
940
941/*${QS-macros::QS_GLB_FILTER} ..............................................*/
956#define QS_GLB_FILTER(rec_) (QS_glbFilter_((int_fast16_t)(rec_)))
957
958/*${QS-macros::QS_LOC_FILTER} ..............................................*/
972#define QS_LOC_FILTER(qs_id_) (QS_locFilter_((int_fast16_t)(qs_id_)))
973
974/*${QS-macros::QS_BEGIN_ID} ................................................*/
987#define QS_BEGIN_ID(rec_, qs_id_) \
988if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \
989 QS_CRIT_STAT_ \
990 QS_CRIT_E_(); \
991 QS_beginRec_((uint_fast8_t)(rec_)); \
992 QS_TIME_PRE_(); {
993
994/*${QS-macros::QS_END} .....................................................*/
1000#define QS_END() } \
1001 QS_endRec_(); \
1002 QS_CRIT_X_(); \
1003}
1004
1005/*${QS-macros::QS_FLUSH} ...................................................*/
1014#define QS_FLUSH() (QS_onFlush())
1015
1016/*${QS-macros::QS_BEGIN_NOCRIT} ............................................*/
1018#define QS_BEGIN_NOCRIT(rec_, qs_id_) \
1019if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \
1020 QS_beginRec_((uint_fast8_t)(rec_)); \
1021 QS_TIME_PRE_(); {
1022
1023/*${QS-macros::QS_END_NOCRIT} ..............................................*/
1025#define QS_END_NOCRIT() } \
1026 QS_endRec_();\
1027}
1028
1029/*${QS-macros::QS_GLB_CHECK_} ..............................................*/
1031#define QS_GLB_CHECK_(rec_) \
1032 (((uint_fast8_t)QS_priv_.glbFilter[(uint_fast8_t)(rec_) >> 3U] \
1033 & ((uint_fast8_t)1U << ((uint_fast8_t)(rec_) & 7U))) != 0U)
1034
1035/*${QS-macros::QS_LOC_CHECK_} ..............................................*/
1037#define QS_LOC_CHECK_(qs_id_) \
1038 (((uint_fast8_t)QS_priv_.locFilter[(uint_fast8_t)(qs_id_) >> 3U] \
1039 & ((uint_fast8_t)1U << ((uint_fast8_t)(qs_id_) & 7U))) != 0U)
1040
1041/*${QS-macros::QS_REC_DONE} ................................................*/
1042#ifndef QS_REC_DONE
1048#define QS_REC_DONE() ((void)0)
1049#endif /* ndef QS_REC_DONE */
1050
1051/*${QS-macros::QS_I8} ......................................................*/
1053#define QS_I8(width_, data_) \
1054 (QS_u8_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I8_T, (data_)))
1055
1056/*${QS-macros::QS_U8} ......................................................*/
1058#define QS_U8(width_, data_) \
1059 (QS_u8_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_U8_T, (data_)))
1060
1061/*${QS-macros::QS_I16} .....................................................*/
1063#define QS_I16(width_, data_) \
1064 (QS_u16_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I16_T, (data_)))
1065
1066/*${QS-macros::QS_U16} .....................................................*/
1068#define QS_U16(width_, data_) \
1069 (QS_u16_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_U16_T, (data_)))
1070
1071/*${QS-macros::QS_I32} .....................................................*/
1073#define QS_I32(width_, data_) \
1074 (QS_u32_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I32_T, (data_)))
1075
1076/*${QS-macros::QS_U32} .....................................................*/
1078#define QS_U32(width_, data_) \
1079 (QS_u32_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_U32_T, (data_)))
1080
1081/*${QS-macros::QS_I64} .....................................................*/
1083#define QS_I64(width_, data_) \
1084 (QS_u64_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_I64_T, (data_)))
1085
1086/*${QS-macros::QS_U64} .....................................................*/
1088#define QS_U64(width_, data_) \
1089 (QS_u64_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_U64_T, (data_)))
1090
1091/*${QS-macros::QS_F32} .....................................................*/
1093#define QS_F32(width_, data_) \
1094 (QS_f32_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_F32_T, (data_)))
1095
1096/*${QS-macros::QS_F64} .....................................................*/
1098#define QS_F64(width_, data_) \
1099 (QS_f64_fmt_((uint8_t)(((width_) << 4)) | (uint8_t)QS_F64_T, (data_)))
1100
1101/*${QS-macros::QS_STR} .....................................................*/
1103#define QS_STR(str_) (QS_str_fmt_((str_)))
1104
1105/*${QS-macros::QS_MEM} .....................................................*/
1107#define QS_MEM(mem_, size_) (QS_mem_fmt_((mem_), (size_)))
1108
1109/*${QS-macros::QS_TIME_PRE_} ...............................................*/
1110#if (QS_TIME_SIZE == 4U)
1114#define QS_TIME_PRE_() (QS_u32_raw_(QS_onGetTime()))
1115#endif /* (QS_TIME_SIZE == 4U) */
1116
1117/*${QS-macros::QS_TIME_PRE_} ...............................................*/
1118#if (QS_TIME_SIZE == 2U)
1119#define QS_TIME_PRE_() (QS_u16_raw_(QS_onGetTime()))
1120#endif /* (QS_TIME_SIZE == 2U) */
1121
1122/*${QS-macros::QS_TIME_PRE_} ...............................................*/
1123#if (QS_TIME_SIZE == 1U)
1124#define QS_TIME_PRE_() (QS_u8_raw_(QS_onGetTime()))
1125#endif /* (QS_TIME_SIZE == 1U) */
1126
1127/*${QS-macros::QS_OBJ} .....................................................*/
1128#if (QS_OBJ_PTR_SIZE == 4U)
1130#define QS_OBJ(obj_) (QS_u32_fmt_(QS_OBJ_T, (uint32_t)(obj_)))
1131#endif /* (QS_OBJ_PTR_SIZE == 4U) */
1132
1133/*${QS-macros::QS_OBJ} .....................................................*/
1134#if (QS_OBJ_PTR_SIZE == 2U)
1135#define QS_OBJ(obj_) (QS_u16_fmt_(QS_OBJ_T, (uint16_t)(obj_)))
1136#endif /* (QS_OBJ_PTR_SIZE == 2U) */
1137
1138/*${QS-macros::QS_OBJ} .....................................................*/
1139#if (QS_OBJ_PTR_SIZE == 1U)
1140#define QS_OBJ(obj_) (QS_u8_fmt_(QS_OBJ_T, (uint8_t)(obj_)))
1141#endif /* (QS_OBJ_PTR_SIZE == 1U) */
1142
1143/*${QS-macros::QS_OBJ} .....................................................*/
1144#if (QS_OBJ_PTR_SIZE == 8U)
1145#define QS_OBJ(obj_) (QS_u64_fmt_(QS_OBJ_T, (uint64_t)(obj_)))
1146#endif /* (QS_OBJ_PTR_SIZE == 8U) */
1147
1148/*${QS-macros::QS_FUN} .....................................................*/
1149#if (QS_FUN_PTR_SIZE == 4U)
1150/* Output formatted function pointer to the QS record */
1151#define QS_FUN(fun_) (QS_u32_fmt_(QS_FUN_T, (uint32_t)(fun_)))
1152#endif /* (QS_FUN_PTR_SIZE == 4U) */
1153
1154/*${QS-macros::QS_FUN} .....................................................*/
1155#if (QS_FUN_PTR_SIZE == 2U)
1156#define QS_FUN(fun_) (QS_u16_fmt_(QS_FUN_T, (uint16_t)(fun_)))
1157#endif /* (QS_FUN_PTR_SIZE == 2U) */
1158
1159/*${QS-macros::QS_FUN} .....................................................*/
1160#if (QS_FUN_PTR_SIZE == 1U)
1161#define QS_FUN(fun_) (QS_u8_fmt_(QS_FUN_T, (uint8_t)(fun_)))
1162#endif /* (QS_FUN_PTR_SIZE == 1U) */
1163
1164/*${QS-macros::QS_FUN} .....................................................*/
1165#if (QS_FUN_PTR_SIZE == 8U)
1166#define QS_FUN(fun_) (QS_u64_fmt_(QS_FUN_T, (uint64_t)(fun_)))
1167#endif /* (QS_FUN_PTR_SIZE == 8U) */
1168
1169/*${QS-macros::QS_SIG} .....................................................*/
1170#if (Q_SIGNAL_SIZE == 4U)
1174#define QS_SIG(sig_, obj_) \
1175 QS_u32_fmt_(QS_SIG_T, (sig_)); \
1176 QS_obj_raw_(obj_)
1177#endif /* (Q_SIGNAL_SIZE == 4U) */
1178
1179/*${QS-macros::QS_SIG} .....................................................*/
1180#if (Q_SIGNAL_SIZE == 2U)
1181#define QS_SIG(sig_, obj_) \
1182 QS_u16_fmt_(QS_SIG_T, (sig_)); \
1183 QS_obj_raw_(obj_)
1184#endif /* (Q_SIGNAL_SIZE == 2U) */
1185
1186/*${QS-macros::QS_SIG} .....................................................*/
1187#if (Q_SIGNAL_SIZE == 1U)
1188#define QS_SIG(sig_, obj_) \
1189 QS_u8_fmt_(QS_SIG_T, (sig_)); \
1190 QS_obj_raw_(obj_)
1191#endif /* (Q_SIGNAL_SIZE == 1U) */
1192
1193/*${QS-macros::QS_SIG_DICTIONARY} ..........................................*/
1234#define QS_SIG_DICTIONARY(sig_, obj_) \
1235 (QS_sig_dict_pre_((sig_), (obj_), #sig_))
1236
1237/*${QS-macros::QS_OBJ_DICTIONARY} ..........................................*/
1252#define QS_OBJ_DICTIONARY(obj_) \
1253 (QS_obj_dict_pre_((obj_), #obj_))
1254
1255/*${QS-macros::QS_OBJ_ARR_DICTIONARY} ......................................*/
1271#define QS_OBJ_ARR_DICTIONARY(obj_, idx_) \
1272 (QS_obj_arr_dict_pre_((obj_), (idx_), #obj_))
1273
1274/*${QS-macros::QS_FUN_DICTIONARY} ..........................................*/
1288#define QS_FUN_DICTIONARY(fun_) \
1289 (QS_fun_dict_pre_((void (*)(void))(fun_), #fun_))
1290
1291/*${QS-macros::QS_USR_DICTIONARY} ..........................................*/
1298#define QS_USR_DICTIONARY(rec_) \
1299 (QS_usr_dict_pre_((rec_), #rec_))
1300
1301/*${QS-macros::QF_QS_CRIT_ENTRY} ...........................................*/
1304
1305/*${QS-macros::QF_QS_CRIT_EXIT} ............................................*/
1308
1309/*${QS-macros::QF_QS_ISR_ENTRY} ............................................*/
1312 uint_fast8_t const isrnest,
1313 uint_fast8_t const prio_);
1314
1315/*${QS-macros::QF_QS_ISR_EXIT} .............................................*/
1319void QF_QS_ISR_EXIT(
1320 uint_fast8_t isrnest,
1321 uint_fast8_t prio);
1322
1323/*${QS-macros::QF_QS_ACTION} ...............................................*/
1325#define QF_QS_ACTION(act_) (act_)
1326/*$enddecl${QS-macros} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
1327
1328/*==========================================================================*/
1329/* Facilities for QS critical section */
1330
1331/* QS-specific critical section */
1332#ifdef QS_CRIT_ENTRY /* separate QS critical section defined? */
1333
1334#ifndef QS_CRIT_STAT_TYPE
1335 #define QS_CRIT_STAT_
1336 #define QS_CRIT_E_() QS_CRIT_ENTRY(dummy)
1337 #define QS_CRIT_X_() QS_CRIT_EXIT(dummy); QS_REC_DONE()
1338#else
1339 #define QS_CRIT_STAT_ QS_CRIT_STAT_TYPE critStat_;
1340 #define QS_CRIT_E_() QS_CRIT_ENTRY(critStat_)
1341 #define QS_CRIT_X_() QS_CRIT_EXIT(critStat_); QS_REC_DONE()
1342#endif /* QS_CRIT_STAT_TYPE */
1343
1344#else /* separate QS critical section not defined--use the QF definition */
1345
1346#ifndef QF_CRIT_STAT_TYPE
1357 #define QS_CRIT_STAT_
1358
1368 #define QS_CRIT_E_() QF_CRIT_ENTRY(dummy)
1369
1379 #define QS_CRIT_X_() QF_CRIT_EXIT(dummy); QS_REC_DONE()
1380
1381#elif (!defined QS_CRIT_STAT_)
1382
1383 #define QS_CRIT_STAT_ QF_CRIT_STAT_TYPE critStat_;
1384 #define QS_CRIT_E_() QF_CRIT_ENTRY(critStat_)
1385 #define QS_CRIT_X_() QF_CRIT_EXIT(critStat_); QS_REC_DONE()
1386
1387#endif /* simple unconditional interrupt disabling used */
1388
1389#endif /* separate QS critical section not defined */
1390
1391/*==========================================================================*/
1392/* Macros for use in QUTest only */
1393#ifdef Q_UTEST
1394
1395/*$declare${QUTest} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
1396
1397/*${QUTest::QS::TProbe} ....................................................*/
1400 QSFun addr;
1401 uint32_t data;
1402 uint8_t idx;
1403};
1404
1405/*${QUTest::QS::TestData} ..................................................*/
1408 struct QS_TProbe tpBuf[16];
1409 uint8_t tpNum;
1411};
1412
1413/*${QUTest::QS::testData} ..................................................*/
1415extern struct QS_TestData QS_testData;
1416
1417/*${QUTest::QS::processTestEvts_} ..........................................*/
1421void QS_processTestEvts_(void);
1422
1423/*${QUTest::QS::test_pause_} ...............................................*/
1427void QS_test_pause_(void);
1428
1429/*${QUTest::QS::getTestProbe_} .............................................*/
1433uint32_t QS_getTestProbe_(QSpyFunPtr api);
1434
1435/*${QUTest::QS::onTestSetup} ...............................................*/
1439void QS_onTestSetup(void);
1440
1441/*${QUTest::QS::onTestTeardown} ............................................*/
1445void QS_onTestTeardown(void);
1446
1447/*${QUTest::QS::onTestEvt} .................................................*/
1451void QS_onTestEvt(QEvt * e);
1452
1453/*${QUTest::QS::onTestPost} ................................................*/
1457void QS_onTestPost(
1458 void const * sender,
1459 QActive * recipient,
1460 QEvt const * e,
1461 bool status);
1462
1463/*${QUTest::QS::onTestLoop} ................................................*/
1467void QS_onTestLoop(void);
1468
1469/*${QUTest::QHsmDummy} .....................................................*/
1478typedef struct {
1479/* protected: */
1481} QHsmDummy;
1482
1483/* public: */
1484
1488void QHsmDummy_ctor(QHsmDummy * const me);
1489
1493void QHsmDummy_init_(
1494 QHsm * const me,
1495 void const * const par,
1496 uint_fast8_t const qs_id);
1497
1502 QHsm * const me,
1503 QEvt const * const e,
1504 uint_fast8_t const qs_id);
1505
1506/*${QUTest::QActiveDummy} ..................................................*/
1515typedef struct {
1516/* protected: */
1518} QActiveDummy;
1519
1520/* public: */
1521
1525void QActiveDummy_ctor(QActiveDummy * const me);
1526
1531 QHsm * const me,
1532 void const * const par,
1533 uint_fast8_t const qs_id);
1534
1539 QHsm * const me,
1540 QEvt const * const e,
1541 uint_fast8_t const qs_id);
1542
1547 QActive * const me,
1548 uint_fast8_t const prio,
1549 QEvt const * * const qSto,
1550 uint_fast16_t const qLen,
1551 void * const stkSto,
1552 uint_fast16_t const stkSize,
1553 void const * const par);
1554
1559 QActive * const me,
1560 QEvt const * const e,
1561 uint_fast16_t const margin,
1562 void const * const sender);
1563
1568 QActive * const me,
1569 QEvt const * const e);
1570
1571/*${QUTest::QUTEST_ON_POST} ................................................*/
1573#define QUTEST_ON_POST 124
1574/*$enddecl${QUTest} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
1575
1577#define QS_TEST_PROBE_DEF(fun_) \
1578 uint32_t const qs_tp_ = QS_getTestProbe_((void (*)(void))(fun_));
1579
1581#define QS_TEST_PROBE(code_) \
1582 if (qs_tp_ != 0U) { code_ }
1583
1585#define QS_TEST_PROBE_ID(id_, code_) \
1586 if (qs_tp_ == (uint32_t)(id_)) { code_ }
1587
1589#define QS_TEST_PAUSE() (QS_test_pause_())
1590
1591#else /* Q_UTEST not defined */
1592
1593/* dummy definitions when not building for QUTEST */
1594#define QS_TEST_PROBE_DEF(fun_)
1595#define QS_TEST_PROBE(code_)
1596#define QS_TEST_PROBE_ID(id_, code_)
1597#define QS_TEST_PAUSE() ((void)0)
1598
1599#endif /* Q_UTEST */
1600
1601#endif /* def QS_H */
int int_t
Definition: qassert.h:73
float float32_t
Definition: qep.h:102
double float64_t
Definition: qep.h:114
int enum_t
Definition: qep.h:90
void QS_locFilter_(int_fast16_t const filter)
Definition: qs.c:334
void QS_endRec_(void)
Definition: qs.c:409
void QS_fun_dict_pre_(QSpyFunPtr fun, char const *const name)
Definition: qs.c:754
void QS_target_info_pre_(uint8_t const isReset)
Definition: qs.c:804
void QS_beginRec_(uint_fast8_t const rec)
Definition: qs.c:389
void QS_u16_raw_(uint16_t d)
Definition: qs.c:471
void QS_initBuf(uint8_t *const sto, uint_fast16_t const stoSize)
Definition: qs.c:68
void QS_u16_fmt_(uint8_t format, uint16_t d)
Definition: qs.c:562
void QS_obj_arr_dict_pre_(void const *const obj, uint_fast16_t const idx, char const *const name)
Definition: qs.c:693
void QS_u32_raw_(uint32_t d)
Definition: qs.c:489
uint8_t const * QS_getBlock(uint16_t *const pNbytes)
Definition: qs.c:119
void QS_u8_raw_(uint8_t const d)
Definition: qs.c:439
void QS_str_fmt_(char const *str)
Definition: qs.c:608
void QS_u32_fmt_(uint8_t format, uint32_t d)
Definition: qs.c:584
void QS_u8_fmt_(uint8_t const format, uint8_t const d)
Definition: qs.c:543
void QS_usr_dict_pre_(enum_t const rec, char const *const name)
Definition: qs.c:770
void QS_str_raw_(char const *str)
Definition: qs.c:522
void QS_ASSERTION(char const *const module, int_t const loc, uint32_t const delay)
Definition: qs.c:786
void QS_obj_dict_pre_(void const *const obj, char const *const name)
Definition: qs.c:677
uint16_t QS_getByte(void)
Definition: qs.c:99
void QS_sig_dict_pre_(enum_t const sig, void const *const obj, char const *const name)
Definition: qs.c:659
void QS_glbFilter_(int_fast16_t const filter)
Definition: qs.c:153
void QS_2u8_raw_(uint8_t const d1, uint8_t const d2)
Definition: qs.c:453
void QS_obj_raw_(void const *const obj)
Definition: qs.c:507
void QS_mem_fmt_(uint8_t const *blk, uint8_t size)
Definition: qs.c:632
uint8_t volatile chksum
Definition: qs.h:339
uint32_t data
Definition: qs.h:1401
uint8_t idx
Definition: qs.h:1402
QSFun addr
Definition: qs.h:1400
void const * locFilter_AP
Definition: qs.h:318
void QS_onCleanup(void)
uint8_t * buf
Definition: qs.h:321
QSpyIdOffsets
Definition: qs.h:271
@ QS_EQ_ID
Definition: qs.h:274
@ QS_EP_ID
Definition: qs.h:273
@ QS_AP_ID
Definition: qs.h:275
@ QS_AO_ID
Definition: qs.h:272
QS_preType
Definition: qs.h:352
@ QS_STR_T
Definition: qs.h:361
@ QS_U64_T
Definition: qs.h:367
@ QS_MEM_T
Definition: qs.h:362
@ QS_OBJ_T
Definition: qs.h:364
@ QS_F32_T
Definition: qs.h:359
@ QS_SIG_T
Definition: qs.h:363
@ QS_HEX_FMT
Definition: qs.h:368
@ QS_U8_T
Definition: qs.h:354
@ QS_I64_T
Definition: qs.h:366
@ QS_I8_T
Definition: qs.h:353
@ QS_FUN_T
Definition: qs.h:365
@ QS_F64_T
Definition: qs.h:360
@ QS_U32_T
Definition: qs.h:358
@ QS_I32_T
Definition: qs.h:357
@ QS_I16_T
Definition: qs.h:355
@ QS_U16_T
Definition: qs.h:356
void QF_QS_ISR_ENTRY(uint_fast8_t const isrnest, uint_fast8_t const prio_)
void QF_QS_CRIT_EXIT(void)
QS_rx QS_rxPriv_
Definition: qs_rx.c:211
uint32_t QSTimeCtr
Definition: qs.h:81
QSTimeCtr testTime
Definition: qs.h:1410
QSCtr volatile tail
Definition: qs.h:330
uint8_t tpNum
Definition: qs.h:1409
QSCtr volatile used
Definition: qs.h:333
uint_fast16_t QSCtr
Definition: qs.h:117
bool inTestLoop
Definition: qs.h:750
QS_tx QS_priv_
Definition: qs.c:65
QSTimeCtr QS_onGetTime(void)
Definition: qutest.c:400
QSpyUserOffsets
Definition: qs.h:260
@ QS_USER0
Definition: qs.h:262
@ QS_USER3
Definition: qs.h:265
@ QS_USER1
Definition: qs.h:263
@ QS_USER
Definition: qs.h:261
@ QS_USER2
Definition: qs.h:264
@ QS_USER4
Definition: qs.h:266
QSpyPre
Definition: qs.h:134
@ QS_ASSERT_FAIL
Definition: qs.h:233
@ QS_QF_TIMEEVT_AUTO_DISARM
Definition: qs.h:183
@ QS_MUTEX_UNLOCK
Definition: qs.h:209
@ QS_MAX
Definition: qs.h:236
@ QS_QF_INT_ENABLE
Definition: qs.h:196
@ QS_QF_RUN
Definition: qs.h:234
@ QS_QF_MPOOL_GET_ATTEMPT
Definition: qs.h:205
@ QS_QF_DELETE_REF
Definition: qs.h:190
@ QS_QF_ACTIVE_RECALL
Definition: qs.h:151
@ QS_QF_EQUEUE_GET_LAST
Definition: qs.h:164
@ QS_QF_TIMEEVT_DISARM
Definition: qs.h:185
@ QS_TEST_PROBE_GET
Definition: qs.h:223
@ QS_QEP_STATE_INIT
Definition: qs.h:141
@ QS_QEP_TRAN_HIST
Definition: qs.h:217
@ QS_QF_TIMEEVT_REARM
Definition: qs.h:186
@ QS_FUN_DICT
Definition: qs.h:226
@ QS_QF_PUBLISH
Definition: qs.h:174
@ QS_QF_ACTIVE_POST_LIFO
Definition: qs.h:155
@ QS_QEP_TRAN_EP
Definition: qs.h:218
@ QS_QEP_STATE_EXIT
Definition: qs.h:140
@ QS_TARGET_DONE
Definition: qs.h:229
@ QS_QF_GC_ATTEMPT
Definition: qs.h:177
@ QS_QF_CRIT_ENTRY
Definition: qs.h:191
@ QS_QF_MPOOL_PUT
Definition: qs.h:171
@ QS_QF_EQUEUE_POST_ATTEMPT
Definition: qs.h:202
@ QS_QF_GC
Definition: qs.h:178
@ QS_QF_ACTIVE_GET
Definition: qs.h:156
@ QS_QF_CRIT_EXIT
Definition: qs.h:192
@ QS_QF_TIMEEVT_POST
Definition: qs.h:187
@ QS_QF_INT_DISABLE
Definition: qs.h:195
@ QS_OBJ_DICT
Definition: qs.h:225
@ QS_QF_MPOOL_GET
Definition: qs.h:170
@ QS_QF_TIMEEVT_DISARM_ATTEMPT
Definition: qs.h:184
@ QS_QF_ACTIVE_RECALL_ATTEMPT
Definition: qs.h:158
@ QS_QEP_INIT_TRAN
Definition: qs.h:142
@ QS_MUTEX_LOCK
Definition: qs.h:208
@ QS_TARGET_INFO
Definition: qs.h:228
@ QS_QEP_INTERN_TRAN
Definition: qs.h:143
@ QS_QEP_TRAN_XP
Definition: qs.h:219
@ QS_RX_STATUS
Definition: qs.h:230
@ QS_SCHED_IDLE
Definition: qs.h:213
@ QS_QF_EQUEUE_POST_LIFO
Definition: qs.h:162
@ QS_QEP_STATE_ENTRY
Definition: qs.h:139
@ QS_QEP_UNHANDLED
Definition: qs.h:147
@ QS_QF_ACTIVE_POST_ATTEMPT
Definition: qs.h:199
@ QS_QEP_TRAN
Definition: qs.h:144
@ QS_QF_EQUEUE_GET
Definition: qs.h:163
@ QS_QF_ISR_ENTRY
Definition: qs.h:193
@ QS_QF_NEW_ATTEMPT
Definition: qs.h:167
@ QS_QF_ISR_EXIT
Definition: qs.h:194
@ QS_QF_TICK
Definition: qs.h:179
@ QS_QF_ACTIVE_UNSUBSCRIBE
Definition: qs.h:153
@ QS_QEP_DISPATCH
Definition: qs.h:146
@ QS_QF_ACTIVE_DEFER
Definition: qs.h:150
@ QS_SCHED_LOCK
Definition: qs.h:210
@ QS_QF_NEW_REF
Definition: qs.h:175
@ QS_TEST_PAUSED
Definition: qs.h:222
@ QS_SCHED_UNLOCK
Definition: qs.h:211
@ QS_EMPTY
Definition: qs.h:136
@ QS_QF_ACTIVE_POST
Definition: qs.h:154
@ QS_SIG_DICT
Definition: qs.h:224
@ QS_QUERY_DATA
Definition: qs.h:231
@ QS_QF_TIMEEVT_ARM
Definition: qs.h:182
@ QS_QEP_IGNORED
Definition: qs.h:145
@ QS_USR_DICT
Definition: qs.h:227
@ QS_QF_NEW
Definition: qs.h:176
@ QS_QF_EQUEUE_POST
Definition: qs.h:161
@ QS_QF_ACTIVE_GET_LAST
Definition: qs.h:157
@ QS_SCHED_NEXT
Definition: qs.h:212
@ QS_PEEK_DATA
Definition: qs.h:232
@ QS_QF_ACTIVE_SUBSCRIBE
Definition: qs.h:152
@ QS_SCHED_RESUME
Definition: qs.h:214
void QS_onFlush(void)
QSCtr end
Definition: qs.h:324
uint8_t volatile seq
Definition: qs.h:336
uint8_t prio
Definition: qs.h:300
QSCtr volatile head
Definition: qs.h:327
struct QS_TestData QS_testData
Definition: qutest.c:70
QSpyGroups
Definition: qs.h:241
@ QS_U2_RECORDS
Definition: qs.h:252
@ QS_MP_RECORDS
Definition: qs.h:246
@ QS_TE_RECORDS
Definition: qs.h:247
@ QS_SM_RECORDS
Definition: qs.h:243
@ QS_U0_RECORDS
Definition: qs.h:250
@ QS_U3_RECORDS
Definition: qs.h:253
@ QS_U4_RECORDS
Definition: qs.h:254
@ QS_AO_RECORDS
Definition: qs.h:244
@ QS_QF_RECORDS
Definition: qs.h:248
@ QS_SC_RECORDS
Definition: qs.h:249
@ QS_U1_RECORDS
Definition: qs.h:251
@ QS_EQ_RECORDS
Definition: qs.h:245
@ QS_ALL_RECORDS
Definition: qs.h:242
@ QS_UA_RECORDS
Definition: qs.h:255
QS_OSpyObjCombnation
Definition: qs.h:772
@ SM_AO_OBJ
Definition: qs.h:773
void QF_QS_CRIT_ENTRY(void)
uint8_t volatile critNest
Definition: qs.h:342
struct QS_TProbe tpBuf[16]
Definition: qs.h:1408
void(* QSpyFunPtr)(void)
Definition: qs.h:290
QS_QSpyObjKind
Definition: qs.h:760
@ SM_OBJ
Definition: qs.h:761
@ EQ_OBJ
Definition: qs.h:764
@ AO_OBJ
Definition: qs.h:762
@ TE_OBJ
Definition: qs.h:765
@ MAX_OBJ
Definition: qs.h:767
@ AP_OBJ
Definition: qs.h:766
@ MP_OBJ
Definition: qs.h:763
QSpyIdGroups
Definition: qs.h:280
@ QS_EP_IDS
Definition: qs.h:283
@ QS_AO_IDS
Definition: qs.h:282
@ QS_EQ_IDS
Definition: qs.h:284
@ QS_ALL_IDS
Definition: qs.h:281
@ QS_AP_IDS
Definition: qs.h:285
Test Probe attributes.
Definition: qs.h:1399
QUTest data.
Definition: qs.h:1407
QS software tracing parameters for QS input (QS-RX)
Definition: qs.h:742
Software tracing, output QS-TX.
Definition: qs.h:308
QS ID type for applying local filtering.
Definition: qs.h:300
void QS_u64_fmt_(uint8_t format, uint64_t d)
Definition: qs_64bit.c:79
void QS_u64_raw_(uint64_t d)
Definition: qs_64bit.c:60
void QS_f32_fmt_(uint8_t format, float32_t d)
Definition: qs_fp.c:60
void QS_f64_fmt_(uint8_t format, float64_t d)
Definition: qs_fp.c:90
void QS_queryCurrObj(uint8_t obj_kind)
Definition: qs_rx.c:271
void QS_rxParse(void)
Definition: qs_rx.c:325
void QS_rxInitBuf(uint8_t *const sto, uint16_t const stoSize)
Definition: qs_rx.c:214
void QS_rxHandleGoodFrame_(uint8_t const state)
Definition: qs_rx.c:370
bool QS_RX_PUT(uint8_t const b)
Definition: qs_rx.c:687
void QS_setCurrObj(uint8_t obj_kind, void *obj_ptr)
Definition: qs_rx.c:262
uint16_t QS_rxGetNfree(void)
Definition: qs_rx.c:248
void QS_processTestEvts_(void)
Definition: qutest.c:73
void QS_test_pause_(void)
Definition: qutest.c:100
uint32_t QS_getTestProbe_(QSpyFunPtr api)
Definition: qutest.c:107
QActiveDummy Object class.
Definition: qs.h:1515
void QActiveDummy_ctor(QActiveDummy *const me)
Definition: qutest.c:189
void QActiveDummy_postLIFO_(QActive *const me, QEvt const *const e)
Definition: qutest.c:312
QActive super
Definition: qs.h:1517
void QActiveDummy_dispatch_(QHsm *const me, QEvt const *const e, uint_fast8_t const qs_id)
Definition: qutest.c:218
void QActiveDummy_init_(QHsm *const me, void const *const par, uint_fast8_t const qs_id)
Definition: qutest.c:207
void QActiveDummy_start_(QActive *const me, uint_fast8_t const prio, QEvt const **const qSto, uint_fast16_t const qLen, void *const stkSto, uint_fast16_t const stkSize, void const *const par)
Definition: qutest.c:229
bool QActiveDummy_post_(QActive *const me, QEvt const *const e, uint_fast16_t const margin, void const *const sender)
Definition: qutest.c:256
Active object class (based on the QHsm implementation strategy)
Definition: qf.h:324
uint8_t prio
Definition: qf.h:384
QEQueueCtr volatile head
Definition: qequeue.h:166
Event class.
Definition: qep.h:177
QSignal sig
Definition: qep.h:185
QHsmDummy class.
Definition: qs.h:1478
void QHsmDummy_ctor(QHsmDummy *const me)
Definition: qutest.c:142
QHsm super
Definition: qs.h:1480
void QHsmDummy_dispatch_(QHsm *const me, QEvt const *const e, uint_fast8_t const qs_id)
Definition: qutest.c:172
void QHsmDummy_init_(QHsm *const me, void const *const par, uint_fast8_t const qs_id)
Definition: qutest.c:156
Hierarchical State Machine class.
Definition: qep.h:359
union QHsmAttr state
Definition: qep.h:374