QTools  7.2.1
Collection of Host-Based Tools
Loading...
Searching...
No Matches
qpc_qs_pkg.h
Go to the documentation of this file.
1/*$file${include::qs_pkg.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/
2/*
3* Model: qpc.qm
4* File: ${include::qs_pkg.h}
5*
6* This code has been generated by QM 5.2.5 <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_pkg.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/
39/*! @file
40* @brief Internal (package scope) QS/C interface.
41*/
42#ifndef QS_PKG_H_
43#define QS_PKG_H_
44
45/*==========================================================================*/
46
47/*! QS received record types (RX channel)
48* @details
49* This enumeration specifies the record types for the QS receive channel
50*/
52 QS_RX_INFO, /*!< query Target info (ver, config, tstamp) */
53 QS_RX_COMMAND, /*!< execute a user-defined command in the Target */
54 QS_RX_RESET, /*!< reset the Target */
55 QS_RX_TICK, /*!< call QTIMEEVT_TICK_X() in the Target */
56 QS_RX_PEEK, /*!< peek Target memory */
57 QS_RX_POKE, /*!< poke Target memory */
58 QS_RX_FILL, /*!< fill Target memory */
59 QS_RX_TEST_SETUP, /*!< test setup */
60 QS_RX_TEST_TEARDOWN, /*!< test teardown */
61 QS_RX_TEST_PROBE, /*!< set a Test-Probe in the Target */
62 QS_RX_GLB_FILTER, /*!< set global filters in the Target */
63 QS_RX_LOC_FILTER, /*!< set local filters in the Target */
64 QS_RX_AO_FILTER, /*!< set local AO filter in the Target */
65 QS_RX_CURR_OBJ, /*!< set the "current-object" in the Target */
66 QS_RX_TEST_CONTINUE, /*!< continue a test after QS_TEST_PAUSE() */
67 QS_RX_QUERY_CURR, /*!< query the "current object" in the Target */
68 QS_RX_EVENT /*!< inject an event to the Target */
69};
70
71/*==========================================================================*/
72/*! Frame character of the QS output protocol */
73#define QS_FRAME (0x7EU)
74
75/*! Escape character of the QS output protocol */
76#define QS_ESC (0x7DU)
77
78/*! The expected checksum value over a correct QS record */
79#define QS_GOOD_CHKSUM (0xFFU)
80
81/*! Escape modifier of the QS output protocol */
82/**
83* @details
84* The escaped byte is XOR-ed with the escape modifier before it is inserted
85* into the QS buffer.
86*/
87#define QS_ESC_XOR (0x20U)
88
89/*==========================================================================*/
90/*! Internal QS macro to begin a predefined QS record with
91* entering critical section.
92*
93* @note This macro is intended to use only inside QP components and NOT
94* at the application level.
95* @sa QS_BEGIN_ID()
96*/
97#define QS_BEGIN_PRE_(rec_, qs_id_) \
98 if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \
99 QS_CRIT_E_(); \
100 QS_beginRec_((uint_fast8_t)(rec_));
101
102/*! Internal QS macro to end a predefined QS record with
103* exiting critical section.
104*
105* @note This macro is intended to use only inside QP components and NOT
106* at the application level.
107* @sa QS_END()
108*/
109#define QS_END_PRE_() \
110 QS_endRec_(); \
111 QS_CRIT_X_(); \
112 }
113
114/*! Internal macro to begin a predefined QS record without
115* entering critical section.
116*
117* @note This macro is intended to use only inside QP components and NOT
118* at the application level.
119* @sa QS_BEGIN_NOCRIT()
120*/
121#define QS_BEGIN_NOCRIT_PRE_(rec_, qs_id_) \
122 if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \
123 QS_beginRec_((uint_fast8_t)(rec_));
124
125/*! Internal QS macro to end a predefined QS record without
126* exiting critical section
127*
128* @note This macro is intended to use only inside QP components and NOT
129* at the application level. @sa #QS_END_NOCRIT
130*/
131#define QS_END_NOCRIT_PRE_() QS_endRec_(); }
132
133/*! Internal QS macro to output a predefined uint8_t data element */
134#define QS_U8_PRE_(data_) (QS_u8_raw_((uint8_t)(data_)))
135
136/*! Internal QS macro to output 2 predefined uint8_t data elements */
137#define QS_2U8_PRE_(data1_, data2_) \
138 (QS_2u8_raw_((uint8_t)(data1_), (uint8_t)(data2_)))
139
140/*! Internal QS macro to output an predefined uint16_t data element */
141#define QS_U16_PRE_(data_) (QS_u16_raw_((uint16_t)(data_)))
142
143/*! Internal QS macro to output a predefined uint32_t data element */
144#define QS_U32_PRE_(data_) (QS_u32_raw_((uint32_t)(data_)))
145
146/*! Internal QS macro to output a predefined zero-terminated string element */
147#define QS_STR_PRE_(msg_) (QS_str_raw_((msg_)))
148
149#if (!defined Q_SIGNAL_SIZE || (Q_SIGNAL_SIZE == 1U))
150 /*! Internal macro to output an unformatted event signal data element */
151 /**
152 * @note the size of the pointer depends on the macro #Q_SIGNAL_SIZE.
153 */
154 #define QS_SIG_PRE_(sig_) (QS_u8_raw_((uint8_t)sig_))
155#elif (Q_SIGNAL_SIZE == 2U)
156 #define QS_SIG_PRE_(sig_) (QS_u16_raw_((uint16_t)sig_))
157#elif (Q_SIGNAL_SIZE == 4U)
158 #define QS_SIG_PRE_(sig_) (QS_u32_raw_((uint32_t)sig_))
159#endif
160
161#define QS_OBJ_PRE_(obj_) (QS_obj_raw_(obj_))
162
163#if (!defined QS_FUN_PTR_SIZE || (QS_FUN_PTR_SIZE == 1U))
164 #define QS_FUN_PRE_(fun_) (QS_u8_raw_((uint8_t)(fun_)))
165#elif (QS_FUN_PTR_SIZE == 2U)
166 #define QS_FUN_PRE_(fun_) (QS_u16_raw_((uint16_t)(fun_)))
167#elif (QS_FUN_PTR_SIZE == 4U)
168 #define QS_FUN_PRE_(fun_) (QS_u32_raw_((uint32_t)(fun_)))
169#elif (QS_FUN_PTR_SIZE == 8U)
170 #define QS_FUN_PRE_(fun_) (QS_u64_raw_((uint64_t)(fun_)))
171#else
172 /*! Internal macro to output an unformatted function pointer */
173 /** @note the size of the pointer depends on the macro #QS_FUN_PTR_SIZE.
174 * If the size is not defined the size of pointer is assumed 4-bytes.
175 */
176 #define QS_FUN_PRE_(fun_) (QS_u32_raw_((uint32_t)(fun_)))
177#endif
178
179/*==========================================================================*/
180#if (!defined QF_EQUEUE_CTR_SIZE || (QF_EQUEUE_CTR_SIZE == 1U))
181
182 /*! Internal QS macro to output an unformatted event queue counter
183 * data element. */
184 /**
185 * @note the counter size depends on the macro #QF_EQUEUE_CTR_SIZE.
186 */
187 #define QS_EQC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
188#elif (QF_EQUEUE_CTR_SIZE == 2U)
189 #define QS_EQC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
190#elif (QF_EQUEUE_CTR_SIZE == 4U)
191 #define QS_EQC_PRE_(ctr_) QS_u32_raw_((uint32_t)(ctr_))
192#endif
193
194#if (!defined QF_EVENT_SIZ_SIZE || (QF_EVENT_SIZ_SIZE == 1U))
195
196 /*! Internal QS macro to output an unformatted event size
197 * data element. */
198 /**
199 * @note the event size depends on the macro #QF_EVENT_SIZ_SIZE.
200 */
201 #define QS_EVS_PRE_(size_) QS_u8_raw_((uint8_t)(size_))
202#elif (QF_EVENT_SIZ_SIZE == 2U)
203 #define QS_EVS_PRE_(size_) QS_u16_raw_((uint16_t)(size_))
204#elif (QF_EVENT_SIZ_SIZE == 4U)
205 #define QS_EVS_PRE_(size_) QS_u32_raw_((uint32_t)(size_))
206#endif
207
208#if (!defined QF_MPOOL_SIZ_SIZE || (QF_MPOOL_SIZ_SIZE == 1U))
209
210 /*! Internal QS macro to output an unformatted memory pool
211 * block-size data element */
212 /**
213 * @note the block-size depends on the macro #QF_MPOOL_SIZ_SIZE.
214 */
215 #define QS_MPS_PRE_(size_) QS_u8_raw_((uint8_t)(size_))
216#elif (QF_MPOOL_SIZ_SIZE == 2U)
217 #define QS_MPS_PRE_(size_) QS_u16_raw_((uint16_t)(size_))
218#elif (QF_MPOOL_SIZ_SIZE == 4U)
219 #define QS_MPS_PRE_(size_) QS_u32_raw_((uint32_t)(size_))
220#endif
221
222#if (!defined QF_MPOOL_CTR_SIZE || (QF_MPOOL_CTR_SIZE == 1U))
223
224 /*! Internal QS macro to output an unformatted memory pool
225 * block-counter data element. */
226 /**
227 * @note the counter size depends on the macro #QF_MPOOL_CTR_SIZE.
228 */
229 #define QS_MPC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
230#elif (QF_MPOOL_CTR_SIZE == 2U)
231 #define QS_MPC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
232#elif (QF_MPOOL_CTR_SIZE == 4U)
233 #define QS_MPC_PRE_(ctr_) QS_u32_raw_((uint16_t)(ctr_))
234#endif
235
236#if (!defined QF_TIMEEVT_CTR_SIZE || (QF_TIMEEVT_CTR_SIZE == 1U))
237
238 /*! Internal QS macro to output an unformatted time event
239 * tick-counter data element */
240 /**
241 * @note the counter size depends on the macro #QF_TIMEEVT_CTR_SIZE.
242 */
243 #define QS_TEC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
244#elif (QF_TIMEEVT_CTR_SIZE == 2U)
245 #define QS_TEC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
246#elif (QF_TIMEEVT_CTR_SIZE == 4U)
247 #define QS_TEC_PRE_(ctr_) QS_u32_raw_((uint32_t)(ctr_))
248#endif
249
250/*==========================================================================*/
251/*! Internal QS macro to insert an un-escaped byte into the QS buffer */
252#define QS_INSERT_BYTE_(b_) \
253 buf[head] = (b_); \
254 ++head; \
255 if (head == end) { \
256 head = 0U; \
257 }
258
259/*! Internal QS macro to insert an escaped byte into the QS buffer */
260#define QS_INSERT_ESC_BYTE_(b_) \
261 chksum = (uint8_t)(chksum + (b_)); \
262 if (((b_) != QS_FRAME) && ((b_) != QS_ESC)) { \
263 QS_INSERT_BYTE_(b_) \
264 } \
265 else { \
266 QS_INSERT_BYTE_(QS_ESC) \
267 QS_INSERT_BYTE_((uint8_t)((b_) ^ QS_ESC_XOR))\
268 ++QS_priv_.used; \
269 }
270
271#endif /* QS_PKG_H_ */
QSpyRxRecords
Definition: qpc_qs_pkg.h:51
@ QS_RX_RESET
Definition: qpc_qs_pkg.h:54
@ QS_RX_EVENT
Definition: qpc_qs_pkg.h:68
@ QS_RX_LOC_FILTER
Definition: qpc_qs_pkg.h:63
@ QS_RX_FILL
Definition: qpc_qs_pkg.h:58
@ QS_RX_AO_FILTER
Definition: qpc_qs_pkg.h:64
@ QS_RX_TICK
Definition: qpc_qs_pkg.h:55
@ QS_RX_PEEK
Definition: qpc_qs_pkg.h:56
@ QS_RX_CURR_OBJ
Definition: qpc_qs_pkg.h:65
@ QS_RX_GLB_FILTER
Definition: qpc_qs_pkg.h:62
@ QS_RX_POKE
Definition: qpc_qs_pkg.h:57
@ QS_RX_INFO
Definition: qpc_qs_pkg.h:52
@ QS_RX_TEST_TEARDOWN
Definition: qpc_qs_pkg.h:60
@ QS_RX_TEST_PROBE
Definition: qpc_qs_pkg.h:61
@ QS_RX_TEST_SETUP
Definition: qpc_qs_pkg.h:59
@ QS_RX_COMMAND
Definition: qpc_qs_pkg.h:53
@ QS_RX_TEST_CONTINUE
Definition: qpc_qs_pkg.h:66
@ QS_RX_QUERY_CURR
Definition: qpc_qs_pkg.h:67