QP/C++  8.0.3
Real-Time Event Framework
Loading...
Searching...
No Matches
qs_dummy.hpp
Go to the documentation of this file.
1//============================================================================
2// QP/C++ Real-Time Event Framework (RTEF)
3//
4// Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
5//
6// Q u a n t u m L e a P s
7// ------------------------
8// Modern Embedded Software
9//
10// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
11//
12// This software is dual-licensed under the terms of the open-source GNU
13// General Public License (GPL) or under the terms of one of the closed-
14// source Quantum Leaps commercial licenses.
15//
16// Redistributions in source code must retain this top-level comment block.
17// Plagiarizing this software to sidestep the license obligations is illegal.
18//
19// NOTE:
20// The GPL does NOT permit the incorporation of this code into proprietary
21// programs. Please contact Quantum Leaps for commercial licensing options,
22// which expressly supersede the GPL and are designed explicitly for
23// closed-source distribution.
24//
25// Quantum Leaps contact information:
26// <www.state-machine.com/licensing>
27// <info@state-machine.com>
28//============================================================================
29#ifndef QS_DUMMY_HPP_
30#define QS_DUMMY_HPP_
31
32#ifdef Q_SPY
33 error Q_SPY must NOT be defined to include qs_dummy.hpp
34#endif
35
36#ifdef Q_UTEST
37 error Q_UTEST must NOT be defined to include qs_dummy.hpp
38#endif
39
40#define QS_INIT(arg_) (true)
41#define QS_EXIT() static_cast<void>(0)
42#define QS_DUMP() static_cast<void>(0)
43#define QS_GLB_FILTER(rec_) static_cast<void>(0)
44#define QS_LOC_FILTER(qsId_) static_cast<void>(0)
45
46#define QS_BEGIN_ID(rec_, qsId_) if (false) {
47#define QS_END() }
48#define QS_BEGIN_INCRIT(rec_, qsId_) if (false) {
49#define QS_END_INCRIT() }
50
51#define QS_I8(width_, data_) static_cast<void>(0)
52#define QS_U8(width_, data_) static_cast<void>(0)
53#define QS_I16(width_, data_) static_cast<void>(0)
54#define QS_U16(width_, data_) static_cast<void>(0)
55#define QS_I32(width_, data_) static_cast<void>(0)
56#define QS_U32(width_, data_) static_cast<void>(0)
57#define QS_F32(width_, data_) static_cast<void>(0)
58#define QS_F64(width_, data_) static_cast<void>(0)
59#define QS_I64(width_, data_) static_cast<void>(0)
60#define QS_U64(width_, data_) static_cast<void>(0)
61#define QS_ENUM(group_, value_) static_cast<void>(0)
62#define QS_STR(str_) static_cast<void>(0)
63#define QS_MEM(mem_, size_) static_cast<void>(0)
64#define QS_SIG(sig_, obj_) static_cast<void>(0)
65#define QS_OBJ(obj_) static_cast<void>(0)
66#define QS_FUN(fun_) static_cast<void>(0)
67
68#define QS_SIG_DICTIONARY(sig_, obj_) static_cast<void>(0)
69#define QS_OBJ_DICTIONARY(obj_) static_cast<void>(0)
70#define QS_OBJ_ARR_DICTIONARY(obj_, idx_) static_cast<void>(0)
71#define QS_FUN_DICTIONARY(fun_) static_cast<void>(0)
72#define QS_USR_DICTIONARY(rec_) static_cast<void>(0)
73#define QS_ENUM_DICTIONARY(value_, group_) static_cast<void>(0)
74#define QS_ASSERTION(module_, loc_, delay_) static_cast<void>(0)
75#define QS_FLUSH() static_cast<void>(0)
76
77#define QS_TEST_PROBE_DEF(fun_)
78#define QS_TEST_PROBE(code_)
79#define QS_TEST_PROBE_ID(id_, code_)
80#define QS_TEST_PAUSE() static_cast<void>(0)
81
82#define QS_OUTPUT() static_cast<void>(0)
83#define QS_RX_INPUT() static_cast<void>(0)
84#define QS_ONLY(code_) static_cast<void>(0)
85
86//============================================================================
87namespace QP {
88namespace QS {
89
90// QS API used inside applications
91#ifndef QS_TIME_SIZE
92 using QSTimeCtr = std::uint32_t;
93#elif (QS_TIME_SIZE == 2U)
94 using QSTimeCtr = std::uint16_t;
95#else
96 using QSTimeCtr = std::uint32_t;
97#endif
98
99void initBuf(std::uint8_t * const sto,
100 std::uint_fast32_t const stoSize) noexcept;
101std::uint16_t getByte() noexcept;
102std::uint8_t const *getBlock(std::uint16_t * const pNbytes) noexcept;
103void doOutput();
104bool onStartup(void const * arg);
106void onFlush();
108
109void rxInitBuf(std::uint8_t * const sto,
110 std::uint16_t const stoSize) noexcept;
111bool rxPut(std::uint8_t const b) noexcept;
112void rxParse();
113
114} // namespace QP
115} // namespace QS
116
117//============================================================================
118// QS API used inside test fixtures
119#ifdef Q_UTEST
120
121#if (QS_FUN_PTR_SIZE == 2U)
122 typedef uint16_t QSFun;
123#elif (QS_FUN_PTR_SIZE == 4U)
124 typedef uint32_t QSFun;
125#elif (QS_FUN_PTR_SIZE == 8U)
126 typedef uint64_t QSFun;
127#endif
128
129struct QS_TProbe {
130 QSFun addr;
131 uint32_t data;
132 uint8_t idx;
133};
134
135void QS_onTestSetup(void);
137void QS_onTestEvt(QEvt *e);
138void QS_onTestPost(void const *sender, QActive *recipient,
139 QEvt const *e, bool status);
140void QS_onTestLoop(void);
141
142#endif // def Q_UTEST
143
144//============================================================================
145// interface used only for internal implementation, but not in applications
146#ifdef QP_IMPL
147 // predefined QS trace records
148 #define QS_BEGIN_PRE(rec_, qsId_) if (false) {
149 #define QS_END_PRE() }
150 #define QS_U8_PRE(data_) static_cast<void>(0)
151 #define QS_2U8_PRE(data1_, data2_) static_cast<void>(0)
152 #define QS_U16_PRE(data_) static_cast<void>(0)
153 #define QS_U32_PRE(data_) static_cast<void>(0)
154 #define QS_TIME_PRE() static_cast<void>(0)
155 #define QS_SIG_PRE(sig_) static_cast<void>(0)
156 #define QS_EVS_PRE(size_) static_cast<void>(0)
157 #define QS_OBJ_PRE(obj_) static_cast<void>(0)
158 #define QS_FUN_PRE(fun_) static_cast<void>(0)
159 #define QS_EQC_PRE(ctr_) static_cast<void>(0)
160 #define QS_MPC_PRE(ctr_) static_cast<void>(0)
161 #define QS_MPS_PRE(size_) static_cast<void>(0)
162 #define QS_TEC_PRE(ctr_) static_cast<void>(0)
163
164 #define QS_CRIT_STAT
165 #define QS_CRIT_ENTRY() static_cast<void>(0)
166 #define QS_CRIT_EXIT() static_cast<void>(0)
167
168 #define QS_TR_CRIT_ENTRY() static_cast<void>(0)
169 #define QS_TR_CRIT_EXIT() static_cast<void>(0)
170 #define QS_TR_ISR_ENTRY(isrnest_, prio_) static_cast<void>(0)
171 #define QS_TR_ISR_EXIT(isrnest_, prio_) static_cast<void>(0)
172#endif // QP_IMPL
173
174#endif // QS_DUMMY_HPP_
#define Q_SPY
The preprocessor switch to activate the QS software tracing instrumentation in QP/C and application c...
QP/Spy software tracing (target-resident components)
Definition qs_dummy.hpp:88
void rxInitBuf(std::uint8_t *const sto, std::uint16_t const stoSize) noexcept
std::uint8_t const * getBlock(std::uint16_t *const pNbytes) noexcept
std::uint16_t getByte() noexcept
std::uint32_t QSTimeCtr
Definition qs_dummy.hpp:96
void initBuf(std::uint8_t *const sto, std::uint_fast32_t const stoSize) noexcept
bool rxPut(std::uint8_t const b) noexcept
void onCleanup()
void doOutput()
void onFlush()
void rxParse()
QSTimeCtr onGetTime()
bool onStartup(void const *arg)
QP/C++ framework.
Definition qequeue.hpp:36
void QS_onTestPost(void const *sender, QActive *recipient, QEvt const *e, bool status)
void QS_onTestSetup(void)
void QS_onTestLoop(void)
void QS_onTestTeardown(void)
void QS_onTestEvt(QEvt *e)
uint8_t idx
Definition qs_dummy.hpp:132
QSFun addr
Definition qs_dummy.hpp:130
uint32_t data
Definition qs_dummy.hpp:131