QP/C++ 8.1.1
Real-Time Event Framework
Loading...
Searching...
No Matches
qp_config.hpp
Go to the documentation of this file.
1/*!@file
2@code_uid{qp_config.hpp, Sample @QPX configuration file}
3@code_litem{Details}
4This an example of a @QPX configuration file with the explanation
5of the available configuration macros. The `qp_config.hpp` file is
6required for every @QPX Application.
7
8@attention
9The `qp_config.hpp` file is required for every @QPX Application.
10
11@remark
12Some of the configuration macros listed in this file apply only
13to specific @QPX ports.
14
15@code_litem{Configuration Wizard support}
16The `qp_config.hpp` header files provided in the various @ref exa "@QPX examples"
17are formatted to support the "Configuration Wizard" editor available in some IDEs
18(e.g., KEIL uVision). The screen shot below shows how to edit `qp_config.hpp`
19in that mode.
20
21@image html qp_config.png
22@image latex qp_config.png width=5in
23
24@code_fw_trace
25- @tr{DVR_QP_MP2_D5_7_2}: <i>Directive 5.7.2(Advisory): Section of code should not be "commented out"</i>
26@endcode_uid
27*/
28#ifndef QP_CONFIG_HPP_
29#define QP_CONFIG_HPP_
30
31//------------------------------------------------------------------------------
32/*!
33@code_uid{#QP_API_VERSION, QP Framework API backwards-compatibility version}
34@code_litem{Details}
35QP API backwards compatibility with the @QPX API version.
36Lower `QP_API_VERSION` values enable backwards compatibility
37with lower (older) QP API versions.
38
39- 0 => maximum supported compatibility
40- 580 => QP 5.8.0 or newer
41- 660 => QP 6.6.0 or newer
42- 691 => QP 6.9.1 or newer
43- 700 => QP 7.0.0 or newer
44- 9999 => Latest QP API only (minimum compatibility)
45
46For example, `QP_API_VERSION==691` will enable the compatibility
47layer with QP version 6.9.1 and newer, but not older than 6.9.1.
48`QP_API_VERSION==0` enables the maximum currently supported
49backwards compatibility. Conversely, `QP_API_VERSION==9999` means
50that no backwards compatibility layer should be enabled.
51Default: 0 (All supported)
52@endcode_uid
53*/
54#define QP_API_VERSION 0
55
56//------------------------------------------------------------------------------
57/*!
58@code_uid{#Q_UNSAFE, Disable the QP Functional Safety (FuSa) Subsystem}
59@code_litem{Details}
60Defining the macro #Q_UNSAFE (in the application-specific qp_config.h header file)
61disables most of the QP FuSa Subsystem, affecting the following facilities:
62- Software assertions as a recommended technique
63 (called Failure Assertion Programming (FAP) in IEC 61508)
64- Software Self-Monitoring Safety Functions, which encompasses such techniques:
65 + @ref ssr-qp_dim-dis "Duplicate Inverse Storage" for critical variables
66 + @ref ssr-qp_cfm-lbound "Fixed Upper Loop Bound" for all loops
67 + @ref ssr-qp_cfm-icf "Invalid Control Flow" for all unreachable code paths
68
69The intent of the #Q_UNSAFE macro is to support verification (during development)
70that assertions (and more generally, Safety Functions) have _no side effects_
71on the primary functionalityare and are truly independent from the nominal
72flow of control.
73
74However, quite specifically, the #Q_UNSAFE macro should _not_ be used to permanently
75disable the @QPX FuSa Subsystem in the final, production release of the @QPX
76Application, especially in the context of a safety-related system.
77
78@attention
79Disabling QP FuSa Subsystem (by defining the macro #Q_UNSAFE) in the final production
80release, _contradicts_ the most fundamental principles of functional safety and
81is __not allowed__ in safety-related applications.
82
83@endcode_uid
84*/
85#define Q_UNSAFE
86
87//------------------------------------------------------------------------------
88// <h>QF Framework
89// <i>Active Object framework
90
91/*!
92@code_uid{#QF_MAX_ACTIVE,Maximum # Active Objects in the system (1..64)}
93@code_litem{Details}
94Defines the maximum # Active Objects that %QP Framework can manage at any time.
95- Minimum: 1
96- Default: 32
97- Maximum: 64 (inclusive)
98@endcode_uid
99*/
100#define QF_MAX_ACTIVE 32U
101
102/*!
103@code_uid{::QF_MAX_EPOOL,Maximum # event pools in the system (0..15)}
104@code_litem{Details}
105- Minimum: 0 -- no event pools at all
106- Default: 3
107- Maximum: 15 (inclusive)
108@endcode_uid
109*/
110#define QF_MAX_EPOOL 3U
111
112/*!
113@code_uid{::QF_MAX_TICK_RATE,Maximum # clock tick rates in the system (0..15)}
114@code_litem{Details}
115- Minimum: 0 -- no time events at all
116- Default: 1
117- Maximum: 15 (inclusive)
118@endcode_uid
119*/
120#define QF_MAX_TICK_RATE 1U
121
122//------------------------------------------------------------------------------
123/*!
124@code_uid{QEVT_PAR_INIT(), Event parameter initialization (RAII) for dynamic events}
125@code_litem{Details}
126When defined, the macro activates initialization of event parameters while
127creating dynamic events. This could be use for Resource Acquisition Is
128Initialization (__RAII__) for dynamic events.
129
130Default: undefined
131
132@sa
133- Q_NEW()
134- Q_NEW_X()
135- QP::QEvt::init()
136@endcode_uid
137*/
138#define QEVT_PAR_INIT
139
140//------------------------------------------------------------------------------
141/*!
142@code_uid{#QACTIVE_CAN_STOP, Enable the Active Object stop API}
143@code_litem{Details}
144When defined, enable Active Object stop API (Not recommended)
145
146Default: undefined
147@endcode_uid
148*/
149#define QACTIVE_CAN_STOP
150
151//------------------------------------------------------------------------------
152/*!
153@code_uid{#Q_XTOR, Enable the virtual destructor in the QP::QAsm base class}
154@code_litem{Details}
155When defined, the macro #Q_XTOR enables the virtual destructor in the QP::QAsm base
156class and all its subclasses: QP::QHsm, QP::QMsm, QP::QActive, QP::QMActive, etc.
157
158@note
159The virtual destructor is not enabled by default because such a destructor tends
160to pull in the `delete` operator, which then must be linked from a standard library.
161This is undesirable in many embedded systems.
162
163Default: undefined
164
165@sa
166- QP::QAsm::~QAsm()
167@endcode_uid
168*/
169#define Q_XTOR
170
171//------------------------------------------------------------------------------
172/*!
173@code_uid{#QF_EVENT_SIZ_SIZE, Maximum size of dynamic events managed by QP}
174@code_litem{Details}
175This macro controls the maximum size of dynamic events managed by %QP Framework.
176- 1U => 1 byte dynamic range (event size up to 255 bytes)
177- 2U => 2 byte dynamic range (event size up to 65535 bytes) (default)
178
179Default: 2 byte dynamic range (64K bytes maximum event size)
180*/
181#define QF_EVENT_SIZ_SIZE 2U
182
183//------------------------------------------------------------------------------
184/*!
185@code_uid{::QF_TIMEEVT_CTR_SIZE,Time event counter size}
186@code_litem{Details}
187This macro controls the dynamic range of timeouts allowed in QP::QTimeEvt.
188The timeouts are counted in tick _of the associated_ clock tick rate.
189- 1U => 1 byte (timeouts of up to 255 ticks)
190- 2U => 2 bytes (timeouts of up to 65535 ticks)
191- 4U => 4 bytes (timeouts of up to 2^32 ticks) (default)
192
193Default: 4 bytes (2^32 dynamic range)
194@endcode_uid
195*/
196#define QF_TIMEEVT_CTR_SIZE 4U
197
198//------------------------------------------------------------------------------
199/*!
200@code_uid{#QF_EQUEUE_CTR_SIZE, Event queue counter size}
201@code_litem{Details}
202This macro controls the maximum number of events that QP::QEQueue can hold
203- 1U => 1 byte (maximum 255 events) (default)
204- 2U => 2 bytes (maximum 65535 events)
205
206Default: 1 (maximum 255 events in a queue)
207@endcode_uid
208*/
209#define QF_EQUEUE_CTR_SIZE 1U
210
211//------------------------------------------------------------------------------
212/*!
213@code_uid{#QF_MPOOL_CTR_SIZE, Memory pool counter size (QF_MPOOL_CTR_SIZE)}
214@code_litem{Details}
215This macro controls the maximum number of memory blocks that QP::QMPool can hold
216- 1U => 1 byte (up to 255 memory blocks)
217- 2U => 2 bytes (up to 65535 memory blocks) (default)
218- 2U => 2 bytes (up to 2^32 memory blocks)
219
220Default: 2 bytes (up to 65535 memory blocks maximum in a pool)
221@endcode_uid
222*/
223#define QF_MPOOL_CTR_SIZE 2U
224
225//------------------------------------------------------------------------------
226/*!
227@code_uid{#QF_MPOOL_SIZ_SIZE, Memory block size (QF_MPOOL_SIZ_SIZE)}
228@code_litem{Details}
229This macro controls the maximum size of memory blocks that QP::QMPool can hold.
230- 1U => 1 byte dynamic range (event size up to 255 bytes)
231- 2 U=> 2 byte dynamic range (event size up to 65535 bytes) (default)
232
233Default: 2 byte dynamic range (64K bytes maximum block size)
234@endcode_uid
235*/
236#define QF_MPOOL_SIZ_SIZE 2U
237
238//==============================================================================
239// QS Software Tracing
240// Target-resident component of QP/Spy software tracing system
241// (tracing instrumentation and command-input).
242
243//------------------------------------------------------------------------------
244/*!
245@code_uid{#QS_TIME_SIZE, QS timestamp size (QS_TIME_SIZE)}
246@code_litem{Details}
247This macro controls the dynamic range of timestamp produced by QS software tracing.
248- 1U => 1 byte (timestamp wraps around at 255 )
249- 2U => 2 bytes (timestamp wraps around at 65535)
250- 4U => 4 bytes (timestamp wraps around at 2^32) (default)
251
252Default: 4 bytes (2^32 dynamic range)
253@sa
254- QP::QSTimeCtr
255- QP::QS::onGetTime()
256@endcode_uid
257*/
258#define QS_TIME_SIZE 4U
259
260//------------------------------------------------------------------------------
261/*!
262@code_uid{#QS_CTR_SIZE, QS buffer counter size}
263@code_litem{Details}
264This macro controls the maximum number of bytes held in the QS TX/RX buffers.
265- 1U => 1 byte (maximum 255 bytes)
266- 2U => 2 bytes (maximum 65535 bytes) (default)
267- 4U => 4 bytes (maximum 2^32 bytes)
268
269Default: 2 bytes (maximum 65535 bytes in QS buffers)
270@endcode_uid
271*/
272#define QS_CTR_SIZE 2U
273
274//==============================================================================
275/*!
276@code_uid{#QF_ON_CONTEXT_SW, Enable context switch callback WITHOUT QS}
277@code_litem{Details}
278When defined, enables context switch callback QF_onContextSw() in the built-in
279kernels (QV, QK, QXK).
280
281Default: undefined
282@endcode_uid
283*/
284#define QF_ON_CONTEXT_SW
285
286//------------------------------------------------------------------------------
287/*!
288@code_uid{#QF_MEM_ISOLATE, Enable MPU memory isolation}
289@code_litem{Details}
290When defined, enables memory isolation (requires MPU)
291@note
292Implies ::QF_ON_CONTEXT_SW (i.e., ::QF_ON_CONTEXT_SW gets defined)
293@endcode_uid
294*/
295#define QF_MEM_ISOLATE
296// </c>
297
298//------------------------------------------------------------------------------
299/*!
300@code_uid{#QK_USE_IRQ_NUM, Use IRQ handler for QK return-from-preemption in ARM Cortex-M}
301@code_litem{Details}
302If #QK_USE_IRQ_NUM macro is defined, it specifies the IRQ number in ARM Cortex-M
303to be used as the exception for return-from-preemption in the QK kernel.
304
305This macro should be defined only if the NMI handler is utilized in the project.
306The specified IRQ number must be otherwise unused.
307
308Default: undefined
309
310@sa
311Requires defining the macro #QK_USE_IRQ_HANDLER
312@endcode_uid
313*/
314#define QK_USE_IRQ_NUM 31
315
316/*!
317@code_uid{#QK_USE_IRQ_HANDLER, Use IRQ handler for QK return-from-preemption in ARM Cortex-M}
318@code_litem{Details}
319If #QK_USE_IRQ_HANDLER macro is defined, it specifies the IRQ handler name
320in ARM Cortex-M to be used as the exception for return-from-preemption
321in the QK kernel.
322
323This macro should be defined only if the NMI handler is utilized in the project.
324The specified IRQ handler must be otherwise unused.
325
326@sa
327Requires defining the macro #QK_USE_IRQ_NUM
328@endcode_uid
329*/
330#define QK_USE_IRQ_HANDLER Reserved31_IRQHandler
331
332//------------------------------------------------------------------------------
333/*!
334@code_uid{#QXK_USE_IRQ_NUM, Use IRQ handler for QXK return-from-preemption in ARM Cortex-M}
335@code_litem{Details}
336If #QXK_USE_IRQ_NUM macro is defined, it specifies the IRQ number in ARM Cortex-M
337to be used as the exception for return-from-preemption in the QXK kernel.
338
339This macro should be defined only if the NMI handler is utilized in the project.
340The specified IRQ number must be otherwise unused.
341
342Default: undefined
343
344@sa
345Requires defining the macro #QXK_USE_IRQ_HANDLER
346@endcode_uid
347*/
348#define QXK_USE_IRQ_NUM 31
349
350/*!
351@code_uid{#QXK_USE_IRQ_HANDLER, Use IRQ handler for QK return-from-preemption in ARM Cortex-M}
352@code_litem{Details}
353If #QXK_USE_IRQ_HANDLER macro is defined, it specifies the IRQ handler name
354in ARM Cortex-M to be used as the exception for return-from-preemption
355in the QK kernel.
356
357This macro should be defined only if the NMI handler is utilized in the project.
358The specified IRQ handler must be otherwise unused.
359
360Default: undefined
361
362@sa
363Requires defining the macro #QXK_USE_IRQ_NUM
364@endcode_uid
365*/
366#define QXK_USE_IRQ_HANDLER Reserved31_IRQHandler
367
368#endif // QP_CONFIG_HPP_