QP/C  7.3.4
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qs_pkg.h
Go to the documentation of this file.
1//$file${include::qs_pkg.h} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpc.qm
4// File: ${include::qs_pkg.h}
5//
6// This code has been generated by QM 6.1.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 : 2024-12-31
14// License scope:
15//
16// Copyright (C) 2005 Quantum Leaps, LLC <state-machine.com>.
17//
18// Q u a n t u m L e a P s
19// ------------------------
20// Modern Embedded Software
21//
22// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
23//
24// This software is dual-licensed under the terms of the open source GNU
25// General Public License version 3 (or any later version), or alternatively,
26// under the terms of one of the closed source Quantum Leaps commercial
27// licenses.
28//
29// The terms of the open source GNU General Public License version 3
30// can be found at: <www.gnu.org/licenses/gpl-3.0>
31//
32// The terms of the closed source Quantum Leaps commercial licenses
33// can be found at: <www.state-machine.com/licensing>
34//
35// Redistributions in source code must retain this top-level comment block.
36// Plagiarizing this software to sidestep the license obligations is illegal.
37//
38// Contact information:
39// <www.state-machine.com/licensing>
40// <info@state-machine.com>
41//
42//$endhead${include::qs_pkg.h} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#ifndef QS_PKG_H_
44#define QS_PKG_H_
45
46//============================================================================
47//! @cond INTERNAL
48
49//! QS received record types (RX channel)
50enum QSpyRxRecords {
51 QS_RX_INFO, //!< query Target info (ver, config, tstamp)
52 QS_RX_COMMAND, //!< execute a user-defined command in the Target
53 QS_RX_RESET, //!< reset the Target
54 QS_RX_TICK, //!< call system clock tick in the Target
55 QS_RX_PEEK, //!< peek Target memory
56 QS_RX_POKE, //!< poke Target memory
57 QS_RX_FILL, //!< fill Target memory
58 QS_RX_TEST_SETUP, //!< test setup
59 QS_RX_TEST_TEARDOWN, //!< test teardown
60 QS_RX_TEST_PROBE, //!< set a Test-Probe in the Target
61 QS_RX_GLB_FILTER, //!< set global filters in the Target
62 QS_RX_LOC_FILTER, //!< set local filters in the Target
63 QS_RX_AO_FILTER, //!< set local AO filter in the Target
64 QS_RX_CURR_OBJ, //!< set the "current-object" in the Target
65 QS_RX_TEST_CONTINUE, //!< continue a test after QS_TEST_PAUSE()
66 QS_RX_QUERY_CURR, //!< query the "current object" in the Target
67 QS_RX_EVENT //!< inject an event to the Target
68};
69
70//----------------------------------------------------------------------------
71#define QS_FRAME 0x7EU
72#define QS_ESC 0x7DU
73#define QS_ESC_XOR 0x20U
74#define QS_GOOD_CHKSUM 0xFFU
75
76//----------------------------------------------------------------------------
77#define QS_BEGIN_PRE_(rec_, qsId_) \
78 if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qsId_)) { \
79 QS_beginRec_((uint_fast8_t)(rec_));
80#define QS_END_PRE_() QS_endRec_(); }
81
82#define QS_U8_PRE_(data_) (QS_u8_raw_((uint8_t)(data_)))
83#define QS_2U8_PRE_(data1_, data2_) \
84 (QS_2u8_raw_((uint8_t)(data1_), (uint8_t)(data2_)))
85#define QS_U16_PRE_(data_) (QS_u16_raw_((uint16_t)(data_)))
86#define QS_U32_PRE_(data_) (QS_u32_raw_((uint32_t)(data_)))
87#define QS_STR_PRE_(msg_) (QS_str_raw_((msg_)))
88#define QS_OBJ_PRE_(obj_) (QS_obj_raw_(obj_))
89
90#if (!defined Q_SIGNAL_SIZE || (Q_SIGNAL_SIZE == 1U))
91 #define QS_SIG_PRE_(sig_) (QS_u8_raw_((uint8_t)sig_))
92#elif (Q_SIGNAL_SIZE == 2U)
93 #define QS_SIG_PRE_(sig_) (QS_u16_raw_((uint16_t)sig_))
94#elif (Q_SIGNAL_SIZE == 4U)
95 #define QS_SIG_PRE_(sig_) (QS_u32_raw_((uint32_t)sig_))
96#endif
97
98#if (!defined QS_FUN_PTR_SIZE || (QS_FUN_PTR_SIZE == 2U))
99 #define QS_FUN_PRE_(fun_) (QS_u16_raw_((uint16_t)(fun_)))
100#elif (QS_FUN_PTR_SIZE == 4U)
101 #define QS_FUN_PRE_(fun_) (QS_u32_raw_((uint32_t)(fun_)))
102#elif (QS_FUN_PTR_SIZE == 8U)
103 #define QS_FUN_PRE_(fun_) (QS_u64_raw_((uint64_t)(fun_)))
104#else
105 #define QS_FUN_PRE_(fun_) (QS_u32_raw_((uint32_t)(fun_)))
106#endif
107
108//----------------------------------------------------------------------------
109#if (!defined QF_EQUEUE_CTR_SIZE || (QF_EQUEUE_CTR_SIZE == 1U))
110 #define QS_EQC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
111#elif (QF_EQUEUE_CTR_SIZE == 2U)
112 #define QS_EQC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
113#elif (QF_EQUEUE_CTR_SIZE == 4U)
114 #define QS_EQC_PRE_(ctr_) QS_u32_raw_((uint32_t)(ctr_))
115#endif
116
117#if (!defined QF_EVENT_SIZ_SIZE || (QF_EVENT_SIZ_SIZE == 1U))
118 #define QS_EVS_PRE_(size_) QS_u8_raw_((uint8_t)(size_))
119#elif (QF_EVENT_SIZ_SIZE == 2U)
120 #define QS_EVS_PRE_(size_) QS_u16_raw_((uint16_t)(size_))
121#elif (QF_EVENT_SIZ_SIZE == 4U)
122 #define QS_EVS_PRE_(size_) QS_u32_raw_((uint32_t)(size_))
123#endif
124
125#if (!defined QF_MPOOL_SIZ_SIZE || (QF_MPOOL_SIZ_SIZE == 1U))
126 #define QS_MPS_PRE_(size_) QS_u8_raw_((uint8_t)(size_))
127#elif (QF_MPOOL_SIZ_SIZE == 2U)
128 #define QS_MPS_PRE_(size_) QS_u16_raw_((uint16_t)(size_))
129#elif (QF_MPOOL_SIZ_SIZE == 4U)
130 #define QS_MPS_PRE_(size_) QS_u32_raw_((uint32_t)(size_))
131#endif
132
133#if (!defined QF_MPOOL_CTR_SIZE || (QF_MPOOL_CTR_SIZE == 1U))
134 #define QS_MPC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
135#elif (QF_MPOOL_CTR_SIZE == 2U)
136 #define QS_MPC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
137#elif (QF_MPOOL_CTR_SIZE == 4U)
138 #define QS_MPC_PRE_(ctr_) QS_u32_raw_((uint16_t)(ctr_))
139#endif
140
141#if (!defined QF_TIMEEVT_CTR_SIZE || (QF_TIMEEVT_CTR_SIZE == 1U))
142 #define QS_TEC_PRE_(ctr_) QS_u8_raw_((uint8_t)(ctr_))
143#elif (QF_TIMEEVT_CTR_SIZE == 2U)
144 #define QS_TEC_PRE_(ctr_) QS_u16_raw_((uint16_t)(ctr_))
145#elif (QF_TIMEEVT_CTR_SIZE == 4U)
146 #define QS_TEC_PRE_(ctr_) QS_u32_raw_((uint32_t)(ctr_))
147#endif
148
149//----------------------------------------------------------------------------
150#define QS_INSERT_BYTE_(b_) \
151 buf[head] = (b_); \
152 ++head; \
153 if (head == end) { \
154 head = 0U; \
155 }
156
157#define QS_INSERT_ESC_BYTE_(b_) \
158 chksum = (uint8_t)(chksum + (b_)); \
159 if (((b_) != QS_FRAME) && ((b_) != QS_ESC)) { \
160 QS_INSERT_BYTE_(b_) \
161 } \
162 else { \
163 QS_INSERT_BYTE_(QS_ESC) \
164 QS_INSERT_BYTE_((uint8_t)((b_) ^ QS_ESC_XOR))\
165 ++QS_priv_.used; \
166 }
167
168//----------------------------------------------------------------------------
169#if (defined Q_UTEST) && (Q_UTEST != 0)
170void QS_processTestEvts_(void);
171#endif // Q_UTEST != 0
172
173//! @endcond
174//============================================================================
175
176#endif // QS_PKG_H_