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