QP/C  7.0.1
Real-Time Embedded Framework
qs_pkg.h
Go to the documentation of this file.
1/*============================================================================
2*
3* Q u a n t u m L e a P s
4* ------------------------
5* Modern Embedded Software
6*
7* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
8*
9* SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
10*
11* This software is dual-licensed under the terms of open-source GPL 3.0
12* (or any later version), or alternatively, under the terms of one of the
13* closed-source Quantum Leaps commercial licenses.
14*
15* The terms of the open source GPL 3.0 license can be found at:
16* <www.gnu.org/licenses/gpl-3.0.txt>
17*
18* The terms of the closed-source Quantum Leaps commercial licenses
19* can be found at:
20* <www.state-machine.com/licensing>
21*
22* NOTE: Please do NOT plagiarize this software to sidestep the license
23* obligations. This is both unfair and illegal.
24*
25* Contact information:
26* <www.state-machine.com>
27* <info@state-machine.com>
28============================================================================*/
36#ifndef QS_PKG_H
37#define QS_PKG_H
38
39/*==========================================================================*/
40
63};
64
65/*==========================================================================*/
67#define QS_FRAME (0x7EU)
68
70#define QS_ESC (0x7DU)
71
73#define QS_GOOD_CHKSUM (0xFFU)
74
81#define QS_ESC_XOR (0x20U)
82
83/*==========================================================================*/
86void QS_target_info_pre_(uint8_t isReset);
87
88/*==========================================================================*/
93typedef struct {
94 void *currObj[MAX_OBJ];
95 uint8_t *buf;
97 QSCtr volatile head;
98 QSCtr volatile tail;
99#ifdef Q_UTEST
102#endif
103} QSrx;
104
109
110/*==========================================================================*/
118#define QS_BEGIN_PRE_(rec_, qs_id_) \
119 if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \
120 QS_CRIT_E_(); \
121 QS_beginRec_((uint_fast8_t)(rec_));
122
130#define QS_END_PRE_() \
131 QS_endRec_(); \
132 QS_CRIT_X_(); \
133 }
134
142#define QS_BEGIN_NOCRIT_PRE_(rec_, qs_id_) \
143 if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qs_id_)) { \
144 QS_beginRec_((uint_fast8_t)(rec_));
145
152#define QS_END_NOCRIT_PRE_() QS_endRec_(); }
153
155#define QS_U8_PRE_(data_) (QS_u8_raw_((uint8_t)(data_)))
156
158#define QS_2U8_PRE_(data1_, data2_) \
159 (QS_2u8_raw_((uint8_t)(data1_), (uint8_t)(data2_)))
160
162#define QS_U16_PRE_(data_) (QS_u16_raw_((uint16_t)(data_)))
163
165#define QS_U32_PRE_(data_) (QS_u32_raw_((uint32_t)(data_)))
166
168#define QS_STR_PRE_(msg_) (QS_str_raw_((msg_)))
169
170
171#if (!defined Q_SIGNAL_SIZE || (Q_SIGNAL_SIZE == 1U))
176 #define QS_SIG_PRE_(sig_) (QS_u8_raw_((uint8_t)sig_))
177#elif (Q_SIGNAL_SIZE == 2U)
178 #define QS_SIG_PRE_(sig_) (QS_u16_raw_((uint16_t)sig_))
179#elif (Q_SIGNAL_SIZE == 4U)
180 #define QS_SIG_PRE_(sig_) (QS_u32_raw_((uint32_t)sig_))
181#endif
182
183#define QS_OBJ_PRE_(obj_) (QS_obj_raw_(obj_))
184
185#if (!defined QS_FUN_PTR_SIZE || (QS_FUN_PTR_SIZE == 1U))
186 #define QS_FUN_PRE_(fun_) (QS_u8_raw_((uint8_t)(fun_)))
187#elif (QS_FUN_PTR_SIZE == 2U)
188 #define QS_FUN_PRE_(fun_) (QS_u16_raw_((uint16_t)(fun_)))
189#elif (QS_FUN_PTR_SIZE == 4U)
190 #define QS_FUN_PRE_(fun_) (QS_u32_raw_((uint32_t)(fun_)))
191#elif (QS_FUN_PTR_SIZE == 8U)
192 #define QS_FUN_PRE_(fun_) (QS_u64_raw_((uint64_t)(fun_)))
193#else
198 #define QS_FUN_PRE_(fun_) (QS_u32_raw_((uint32_t)(fun_)))
199#endif
200
201/*==========================================================================*/
202#if (!defined QF_EQUEUE_CTR_SIZE || (QF_EQUEUE_CTR_SIZE == 1U))
203
209 #define QS_EQC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
210#elif (QF_EQUEUE_CTR_SIZE == 2U)
211 #define QS_EQC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
212#elif (QF_EQUEUE_CTR_SIZE == 4U)
213 #define QS_EQC_PRE_(ctr_) QS_u32_raw_((uint32_t)(ctr_))
214#endif
215
216#if (!defined QF_EVENT_SIZ_SIZE || (QF_EVENT_SIZ_SIZE == 1U))
217
223 #define QS_EVS_PRE_(size_) QS_u8_raw_((uint8_t)(size_))
224#elif (QF_EVENT_SIZ_SIZE == 2U)
225 #define QS_EVS_PRE_(size_) QS_u16_raw_((uint16_t)(size_))
226#elif (QF_EVENT_SIZ_SIZE == 4U)
227 #define QS_EVS_PRE_(size_) QS_u32_raw_((uint32_t)(size_))
228#endif
229
230#if (!defined QF_MPOOL_SIZ_SIZE || (QF_MPOOL_SIZ_SIZE == 1U))
231
237 #define QS_MPS_PRE_(size_) QS_u8_raw_((uint8_t)(size_))
238#elif (QF_MPOOL_SIZ_SIZE == 2U)
239 #define QS_MPS_PRE_(size_) QS_u16_raw_((uint16_t)(size_))
240#elif (QF_MPOOL_SIZ_SIZE == 4U)
241 #define QS_MPS_PRE_(size_) QS_u32_raw_((uint32_t)(size_))
242#endif
243
244#if (!defined QF_MPOOL_CTR_SIZE || (QF_MPOOL_CTR_SIZE == 1U))
245
251 #define QS_MPC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
252#elif (QF_MPOOL_CTR_SIZE == 2U)
253 #define QS_MPC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
254#elif (QF_MPOOL_CTR_SIZE == 4U)
255 #define QS_MPC_PRE_(ctr_) QS_u32_raw_((uint16_t)(ctr_))
256#endif
257
258#if (!defined QF_TIMEEVT_CTR_SIZE || (QF_TIMEEVT_CTR_SIZE == 1U))
259
265 #define QS_TEC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
266#elif (QF_TIMEEVT_CTR_SIZE == 2U)
267 #define QS_TEC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
268#elif (QF_TIMEEVT_CTR_SIZE == 4U)
269 #define QS_TEC_PRE_(ctr_) QS_u32_raw_((uint32_t)(ctr_))
270#endif
271
272/*==========================================================================*/
274#define QS_INSERT_BYTE_(b_) \
275 buf[head] = (b_); \
276 ++head; \
277 if (head == end) { \
278 head = 0U; \
279 }
280
282#define QS_INSERT_ESC_BYTE_(b_) \
283 chksum = (uint8_t)(chksum + (b_)); \
284 if (((b_) != QS_FRAME) && ((b_) != QS_ESC)) { \
285 QS_INSERT_BYTE_(b_) \
286 } \
287 else { \
288 QS_INSERT_BYTE_(QS_ESC) \
289 QS_INSERT_BYTE_((uint8_t)((b_) ^ QS_ESC_XOR))\
290 ++QS_priv_.used; \
291 }
292
293#endif /* QS_PKG_H */
Priority Set of up to 64 elements.
Definition: qpset.h:120
@ MAX_OBJ
Definition: qs.h:1057
uint_fast16_t QSCtr
Definition: qs.h:41
QSpyRxRecords
Definition: qs_pkg.h:45
@ QS_RX_RESET
Definition: qs_pkg.h:48
@ QS_RX_EVENT
Definition: qs_pkg.h:62
@ QS_RX_LOC_FILTER
Definition: qs_pkg.h:57
@ QS_RX_FILL
Definition: qs_pkg.h:52
@ QS_RX_AO_FILTER
Definition: qs_pkg.h:58
@ QS_RX_TICK
Definition: qs_pkg.h:49
@ QS_RX_PEEK
Definition: qs_pkg.h:50
@ QS_RX_CURR_OBJ
Definition: qs_pkg.h:59
@ QS_RX_GLB_FILTER
Definition: qs_pkg.h:56
@ QS_RX_POKE
Definition: qs_pkg.h:51
@ QS_RX_INFO
Definition: qs_pkg.h:46
@ QS_RX_TEST_TEARDOWN
Definition: qs_pkg.h:54
@ QS_RX_TEST_PROBE
Definition: qs_pkg.h:55
@ QS_RX_TEST_SETUP
Definition: qs_pkg.h:53
@ QS_RX_COMMAND
Definition: qs_pkg.h:47
@ QS_RX_TEST_CONTINUE
Definition: qs_pkg.h:60
@ QS_RX_QUERY_CURR
Definition: qs_pkg.h:61
void QS_target_info_pre_(uint8_t isReset)
Definition: qs.c:361
Private QS-RX attributes to keep track of the current objects and the lock-free RX buffer.
Definition: qs_pkg.h:93
QPSet readySet
Definition: qs_pkg.h:100
uint8_t * buf
Definition: qs_pkg.h:95
QSCtr volatile tail
Definition: qs_pkg.h:98
bool inTestLoop
Definition: qs_pkg.h:101
QSCtr end
Definition: qs_pkg.h:96
QSrx QS_rxPriv_
Definition: qs_pkg.h:108
QSCtr volatile head
Definition: qs_pkg.h:97