QP/C 8.1.2
Real-Time Event Framework
Loading...
Searching...
No Matches
qp_config.h
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.h` file is
6required for every @QPX Application.
7
8@attention
9The `qp_config.h` 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.h` header files provided in the various @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.h`
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{DVP_QP_MC5_D4_4}: <i>MISRA-C:2025 Directive 4.4(Advisory): C++ line block comment may contain commented-out code</i>
26@endcode_uid
27*/
28#ifndef QP_CONFIG_H_
29#define QP_CONFIG_H_
30
31//------------------------------------------------------------------------------
32/*!
33@code_uid{#QP_API_VERSION, @QPX 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 ssrs-qp_dim-dis "Duplicate Inverse Storage" for critical variables
66 + @ref ssrs-qp_cfm-lbound "Fixed Upper Loop Bound" for all loops
67 + @ref ssrs-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 @QPX 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 used to apply __RAII__
128(Resource Acquisition Is Initialization) for dynamic events.
129
130Default: undefined
131
132@sa
133- Q_NEW()
134- Q_NEW_X()
135- @ref QEvt::QEvt_init() "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{#QF_EVENT_SIZ_SIZE, Maximum size of dynamic events managed by QP}
154
155@code_litem{Details}
156This macro controls the maximum size of dynamic events managed by @QPX Framework.
157- 1U => 1 byte dynamic range (event size up to 255 bytes)
158- 2U => 2 byte dynamic range (event size up to 65535 bytes) (default)
159
160Default: 2 byte dynamic range (64K bytes maximum event size)
161*/
162#define QF_EVENT_SIZ_SIZE 2U
163
164//------------------------------------------------------------------------------
165/*!
166@code_uid{::QF_TIMEEVT_CTR_SIZE,Time event counter size}
167@code_litem{Details}
168This macro controls the dynamic range of timeouts allowed in ::QTimeEvt.
169The timeouts are counted in tick _of the associated_ clock tick rate.
170- 1U => 1 byte (timeouts of up to 255 ticks)
171- 2U => 2 bytes (timeouts of up to 65535 ticks)
172- 4U => 4 bytes (timeouts of up to 2^32 ticks) (default)
173
174Default: 4 bytes (2^32 dynamic range)
175@endcode_uid
176*/
177#define QF_TIMEEVT_CTR_SIZE 4U
178
179//------------------------------------------------------------------------------
180/*!
181@code_uid{#QF_EQUEUE_CTR_SIZE, Event queue counter size}
182@code_litem{Details}
183This macro controls the maximum number of events that ::QEQueue can hold
184- 1U => 1 byte (maximum 255 events) (default)
185- 2U => 2 bytes (maximum 65535 events)
186
187Default: 1 (maximum 255 events in a queue)
188@endcode_uid
189*/
190#define QF_EQUEUE_CTR_SIZE 1U
191
192//------------------------------------------------------------------------------
193/*!
194@code_uid{#QF_MPOOL_CTR_SIZE, Memory pool counter size (QF_MPOOL_CTR_SIZE)}
195@code_litem{Details}
196This macro controls the maximum number of memory blocks that ::QMPool can hold
197- 1U => 1 byte (up to 255 memory blocks)
198- 2U => 2 bytes (up to 65535 memory blocks) (default)
199- 2U => 2 bytes (up to 2^32 memory blocks)
200
201Default: 2 bytes (up to 65535 memory blocks maximum in a pool)
202@endcode_uid
203*/
204#define QF_MPOOL_CTR_SIZE 2U
205
206//------------------------------------------------------------------------------
207/*!
208@code_uid{#QF_MPOOL_SIZ_SIZE, Memory block size (QF_MPOOL_SIZ_SIZE)}
209@code_litem{Details}
210This macro controls the maximum size of memory blocks that ::QMPool can hold.
211- 1U => 1 byte dynamic range (event size up to 255 bytes)
212- 2 U=> 2 byte dynamic range (event size up to 65535 bytes) (default)
213
214Default: 2 byte dynamic range (64K bytes maximum block size)
215@endcode_uid
216*/
217#define QF_MPOOL_SIZ_SIZE 2U
218
219//==============================================================================
220// QS Software Tracing
221// Target-resident component of QP/Spy software tracing system
222// (tracing instrumentation and command-input).
223
224//------------------------------------------------------------------------------
225/*!
226@code_uid{#QS_TIME_SIZE, QS timestamp size (QS_TIME_SIZE)}
227@code_litem{Details}
228This macro controls the dynamic range of timestamp produced by QS software tracing.
229- 1U => 1 byte (timestamp wraps around at 255 )
230- 2U => 2 bytes (timestamp wraps around at 65535)
231- 4U => 4 bytes (timestamp wraps around at 2^32) (default)
232
233Default: 4 bytes (2^32 dynamic range)
234@sa
235- ::QSTimeCtr
236- QS::QS_onGetTime()
237@endcode_uid
238*/
239#define QS_TIME_SIZE 4U
240
241//------------------------------------------------------------------------------
242/*!
243@code_uid{#QS_CTR_SIZE, QS buffer counter size}
244@code_litem{Details}
245This macro controls the maximum number of bytes held in the QS TX/RX buffers.
246- 1U => 1 byte (maximum 255 bytes)
247- 2U => 2 bytes (maximum 65535 bytes) (default)
248- 4U => 4 bytes (maximum 2^32 bytes)
249
250Default: 2 bytes (maximum 65535 bytes in QS buffers)
251@endcode_uid
252*/
253#define QS_CTR_SIZE 2U
254
255//==============================================================================
256/*!
257@code_uid{#QF_ON_CONTEXT_SW, Enable context switch callback WITHOUT QS}
258@code_litem{Details}
259When defined, enables context switch callback QF_onContextSw() in the built-in
260kernels (QV, QK, QXK).
261
262Default: undefined
263@endcode_uid
264*/
265#define QF_ON_CONTEXT_SW
266
267//------------------------------------------------------------------------------
268/*!
269@code_uid{#QF_MEM_ISOLATE, Enable MPU memory isolation}
270@code_litem{Details}
271When defined, enables memory isolation (requires MPU)
272@note
273Implies ::QF_ON_CONTEXT_SW (i.e., ::QF_ON_CONTEXT_SW gets defined)
274@endcode_uid
275*/
276#define QF_MEM_ISOLATE
277// </c>
278
279//------------------------------------------------------------------------------
280/*!
281@code_uid{#QK_USE_IRQ_NUM, Use IRQ handler for QK return-from-preemption in ARM Cortex-M}
282@code_litem{Details}
283If #QK_USE_IRQ_NUM macro is defined, it specifies the IRQ number in ARM Cortex-M
284to be used as the exception for return-from-preemption in the QK kernel.
285
286This macro should be defined only if the NMI handler is utilized in the project.
287The specified IRQ number must be otherwise unused.
288
289Default: undefined
290
291@sa
292Requires defining the macro #QK_USE_IRQ_HANDLER
293@endcode_uid
294*/
295#define QK_USE_IRQ_NUM 31
296
297/*!
298@code_uid{#QK_USE_IRQ_HANDLER, Use IRQ handler for QK return-from-preemption in ARM Cortex-M}
299@code_litem{Details}
300If #QK_USE_IRQ_HANDLER macro is defined, it specifies the IRQ handler name
301in ARM Cortex-M to be used as the exception for return-from-preemption
302in the QK kernel.
303
304This macro should be defined only if the NMI handler is utilized in the project.
305The specified IRQ handler must be otherwise unused.
306
307@sa
308Requires defining the macro #QK_USE_IRQ_NUM
309@endcode_uid
310*/
311#define QK_USE_IRQ_HANDLER Reserved31_IRQHandler
312
313//------------------------------------------------------------------------------
314/*!
315@code_uid{#QXK_USE_IRQ_NUM, Use IRQ handler for QXK return-from-preemption in ARM Cortex-M}
316@code_litem{Details}
317If #QXK_USE_IRQ_NUM macro is defined, it specifies the IRQ number in ARM Cortex-M
318to be used as the exception for return-from-preemption in the QXK kernel.
319
320This macro should be defined only if the NMI handler is utilized in the project.
321The specified IRQ number must be otherwise unused.
322
323Default: undefined
324
325@sa
326Requires defining the macro #QXK_USE_IRQ_HANDLER
327@endcode_uid
328*/
329#define QXK_USE_IRQ_NUM 31
330
331/*!
332@code_uid{#QXK_USE_IRQ_HANDLER, Use IRQ handler for QK return-from-preemption in ARM Cortex-M}
333@code_litem{Details}
334If #QXK_USE_IRQ_HANDLER macro is defined, it specifies the IRQ handler name
335in ARM Cortex-M to be used as the exception for return-from-preemption
336in the QK kernel.
337
338This macro should be defined only if the NMI handler is utilized in the project.
339The specified IRQ handler must be otherwise unused.
340
341Default: undefined
342
343@sa
344Requires defining the macro #QXK_USE_IRQ_NUM
345@endcode_uid
346*/
347#define QXK_USE_IRQ_HANDLER Reserved31_IRQHandler
348
349#endif // QP_CONFIG_H_