QP/C++  7.3.3
Real-Time Embedded Framework
Loading...
Searching...
No Matches
qs_pkg.hpp
Go to the documentation of this file.
1//$file${include::qs_pkg.hpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
2//
3// Model: qpcpp.qm
4// File: ${include::qs_pkg.hpp}
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) : qpcpp
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.hpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
43#ifndef QS_PKG_HPP_
44#define QS_PKG_HPP_
45
46//============================================================================
47//! @cond INTERNAL
48
49namespace QP {
50
51//! QS received record types (RX channel)
52enum QSpyRxRecords : std::uint8_t {
53 QS_RX_INFO, //!< query Target info (ver, config, tstamp)
54 QS_RX_COMMAND, //!< execute a user-defined command in the Target
55 QS_RX_RESET, //!< reset the Target
56 QS_RX_TICK, //!< call system clock tick in the Target
57 QS_RX_PEEK, //!< peek Target memory
58 QS_RX_POKE, //!< poke Target memory
59 QS_RX_FILL, //!< fill Target memory
60 QS_RX_TEST_SETUP, //!< test setup
61 QS_RX_TEST_TEARDOWN, //!< test teardown
62 QS_RX_TEST_PROBE, //!< set a Test-Probe in the Target
63 QS_RX_GLB_FILTER, //!< set global filters in the Target
64 QS_RX_LOC_FILTER, //!< set local filters in the Target
65 QS_RX_AO_FILTER, //!< set local AO filter in the Target
66 QS_RX_CURR_OBJ, //!< set the "current-object" in the Target
67 QS_RX_TEST_CONTINUE, //!< continue a test after QS_TEST_PAUSE()
68 QS_RX_QUERY_CURR, //!< query the "current object" in the Target
69 QS_RX_EVENT //!< inject an event to the Target
70};
71
72constexpr std::uint8_t QS_FRAME {0x7EU};
73constexpr std::uint8_t QS_ESC {0x7DU};
74constexpr std::uint8_t QS_ESC_XOR {0x20U};
75constexpr std::uint8_t QS_GOOD_CHKSUM {0xFFU};
76
77} // namespace QP
78
79//----------------------------------------------------------------------------
80#define QS_BEGIN_PRE_(rec_, qsId_) \
81 if (QS_GLB_CHECK_(rec_) && QS_LOC_CHECK_(qsId_)) { \
82 QP::QS::beginRec_(static_cast<std::uint_fast8_t>(rec_));
83#define QS_END_PRE_() QP::QS::endRec_(); }
84
85#define QS_U8_PRE_(data_) \
86 (QP::QS::u8_raw_(static_cast<std::uint8_t>(data_)))
87#define QS_2U8_PRE_(data1_, data2_) \
88 (QP::QS::u8u8_raw_(static_cast<std::uint8_t>(data1_), \
89 static_cast<std::uint8_t>(data2_)))
90#define QS_U16_PRE_(data_) \
91 (QP::QS::u16_raw_(static_cast<std::uint16_t>(data_)))
92#define QS_U32_PRE_(data_) \
93 (QP::QS::u32_raw_(static_cast<std::uint32_t>(data_)))
94#define QS_STR_PRE_(msg_) (QP::QS::str_raw_(msg_))
95#define QS_OBJ_PRE_(obj_) (QP::QS::obj_raw_(obj_))
96
97#if (!defined Q_SIGNAL_SIZE || (Q_SIGNAL_SIZE == 1U))
98 #define QS_SIG_PRE_(sig_) \
99 (QP::QS::u8_raw_(static_cast<std::uint8_t>(sig_)))
100#elif (Q_SIGNAL_SIZE == 2U)
101 #define QS_SIG_PRE_(sig_) \
102 (QP::QS::u16_raw_(static_cast<std::uint16_t>(sig_)))
103#elif (Q_SIGNAL_SIZE == 4U)
104 #define QS_SIG_PRE_(sig_) \
105 (QP::QS::u32_raw_(static_cast<std::uint32_t>(sig_)))
106#endif
107
108#if (!defined QS_FUN_PTR_SIZE || (QS_FUN_PTR_SIZE == 2U))
109 #define QS_FUN_PRE_(fun_) \
110 (QP::QS::u16_raw_(reinterpret_cast<std::uint16_t>(fun_)))
111#elif (QS_FUN_PTR_SIZE == 4U)
112 #define QS_FUN_PRE_(fun_) \
113 (QP::QS::u32_raw_(reinterpret_cast<std::uint32_t>(fun_)))
114#elif (QS_FUN_PTR_SIZE == 8U)
115 #define QS_FUN_PRE_(fun_) \
116 (QP::QS::u64_raw_(reinterpret_cast<std::uint64_t>(fun_)))
117#else
118 #define QS_FUN_PRE_(fun_) \
119 (QP::QS::u32_raw_(reinterpret_cast<std::uint32_t>(fun_)))
120#endif
121
122//----------------------------------------------------------------------------
123#if (!defined QF_EQUEUE_CTR_SIZE || (QF_EQUEUE_CTR_SIZE == 1U))
124 #define QS_EQC_PRE_(ctr_) \
125 QP::QS::u8_raw_(static_cast<std::uint8_t>(ctr_))
126#elif (QF_EQUEUE_CTR_SIZE == 2U)
127 #define QS_EQC_PRE_(ctr_) \
128 QP::QS::u16_raw_(static_cast<std::uint16_t>(ctr_))
129#elif (QF_EQUEUE_CTR_SIZE == 4U)
130 #define QS_EQC_PRE_(ctr_) \
131 QP::QS::u32_raw_(static_cast<std::uint32_t>(ctr_))
132#else
133 #error "QF_EQUEUE_CTR_SIZE not defined"
134#endif
135
136#if (!defined QF_EVENT_SIZ_SIZE || (QF_EVENT_SIZ_SIZE == 1U))
137 #define QS_EVS_PRE_(size_) \
138 QP::QS::u8_raw_(static_cast<std::uint8_t>(size_))
139#elif (QF_EVENT_SIZ_SIZE == 2U)
140 #define QS_EVS_PRE_(size_) \
141 QP::QS::u16_raw_(static_cast<std::uint16_t>(size_))
142#elif (QF_EVENT_SIZ_SIZE == 4U)
143 #define QS_EVS_PRE_(size_) \
144 QP::QS::u32_raw_(static_cast<std::uint32_t>(size_))
145#endif
146
147#if (!defined QF_MPOOL_SIZ_SIZE || (QF_MPOOL_SIZ_SIZE == 1U))
148 #define QS_MPS_PRE_(size_) \
149 QP::QS::u8_raw_(static_cast<std::uint8_t>(size_))
150#elif (QF_MPOOL_SIZ_SIZE == 2U)
151 #define QS_MPS_PRE_(size_) \
152 QP::QS::u16_raw_(static_cast<std::uint16_t>(size_))
153#elif (QF_MPOOL_SIZ_SIZE == 4U)
154 #define QS_MPS_PRE_(size_) \
155 QP::QS::u32_raw_(static_cast<std::uint32_t>(size_))
156#endif
157
158#if (!defined QF_MPOOL_CTR_SIZE || (QF_MPOOL_CTR_SIZE == 1U))
159 #define QS_MPC_PRE_(ctr_) \
160 QP::QS::u8_raw_(static_cast<std::uint8_t>(ctr_))
161#elif (QF_MPOOL_CTR_SIZE == 2U)
162 #define QS_MPC_PRE_(ctr_) \
163 QP::QS::u16_raw_(static_cast<std::uint16_t>(ctr_))
164#elif (QF_MPOOL_CTR_SIZE == 4U)
165 #define QS_MPC_PRE_(ctr_) \
166 QP::QS::u32_raw_(static_cast<std::uint32_t>(ctr_))
167#endif
168
169#if (!defined QF_TIMEEVT_CTR_SIZE || (QF_TIMEEVT_CTR_SIZE == 1U))
170 #define QS_TEC_PRE_(ctr_) \
171 QP::QS::u8_raw_(static_cast<std::uint8_t>(ctr_))
172#elif (QF_TIMEEVT_CTR_SIZE == 2U)
173 #define QS_TEC_PRE_(ctr_) \
174 QP::QS::u16_raw_(static_cast<std::uint16_t>(ctr_))
175#elif (QF_TIMEEVT_CTR_SIZE == 4U)
176 #define QS_TEC_PRE_(ctr_) \
177 QP::QS::u32_raw_(static_cast<std::uint32_t>(ctr_))
178#endif
179
180#define QS_REC_NUM_(enum_) (static_cast<std::uint_fast8_t>(enum_))
181
182//----------------------------------------------------------------------------
183#define QS_INSERT_BYTE_(b_) \
184 buf[head] = (b_); \
185 ++head; \
186 if (head == end) { \
187 head = 0U; \
188 }
189
190#define QS_INSERT_ESC_BYTE_(b_) \
191 chksum = static_cast<std::uint8_t>(chksum + (b_)); \
192 if (((b_) != QS_FRAME) && ((b_) != QS_ESC)) { \
193 QS_INSERT_BYTE_(b_) \
194 } \
195 else { \
196 QS_INSERT_BYTE_(QS_ESC) \
197 QS_INSERT_BYTE_(static_cast<std::uint8_t>((b_) ^ QS_ESC_XOR)) \
198 priv_.used = priv_.used + 1U; \
199 }
200
201//----------------------------------------------------------------------------
202#if (defined Q_UTEST) && (Q_UTEST != 0)
203namespace QP {
204namespace QS {
205
206void processTestEvts_();
207
208} // namespace QS
209} // namespace QP
210#endif // Q_UTEST != 0
211
212//! @endcond
213//============================================================================
214
215#endif // QS_PKG_HPP_
void processTestEvts_()
Definition qutest.cpp:163
QP/C++ framework.
Definition qequeue.hpp:50