xref: /Kernel-v10.6.2/include/FreeRTOS.h (revision ef7b253b56c9788077f5ecd6c9deb4021923d646)
1 /*
2  * FreeRTOS Kernel V10.6.2
3  * Copyright (C) 2021 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy of
8  * this software and associated documentation files (the "Software"), to deal in
9  * the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  * the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * https://www.FreeRTOS.org
25  * https://github.com/FreeRTOS
26  *
27  */
28 
29 #ifndef INC_FREERTOS_H
30 #define INC_FREERTOS_H
31 
32 /*
33  * Include the generic headers required for the FreeRTOS port being used.
34  */
35 #include <stddef.h>
36 
37 /*
38  * If stdint.h cannot be located then:
39  *   + If using GCC ensure the -nostdint options is *not* being used.
40  *   + Ensure the project's include path includes the directory in which your
41  *     compiler stores stdint.h.
42  *   + Set any compiler options necessary for it to support C99, as technically
43  *     stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
44  *     other way).
45  *   + The FreeRTOS download includes a simple stdint.h definition that can be
46  *     used in cases where none is provided by the compiler.  The files only
47  *     contains the typedefs required to build FreeRTOS.  Read the instructions
48  *     in FreeRTOS/source/stdint.readme for more information.
49  */
50 #include <stdint.h> /* READ COMMENT ABOVE. */
51 
52 /* *INDENT-OFF* */
53 #ifdef __cplusplus
54     extern "C" {
55 #endif
56 /* *INDENT-ON* */
57 
58 /* Acceptable values for configTICK_TYPE_WIDTH_IN_BITS. */
59 #define TICK_TYPE_WIDTH_16_BITS    0
60 #define TICK_TYPE_WIDTH_32_BITS    1
61 #define TICK_TYPE_WIDTH_64_BITS    2
62 
63 /* Application specific configuration options. */
64 #include "FreeRTOSConfig.h"
65 
66 #if !defined( configUSE_16_BIT_TICKS ) && !defined( configTICK_TYPE_WIDTH_IN_BITS )
67     #error Missing definition:  One of configUSE_16_BIT_TICKS and configTICK_TYPE_WIDTH_IN_BITS must be defined in FreeRTOSConfig.h.  See the Configuration section of the FreeRTOS API documentation for details.
68 #endif
69 
70 #if defined( configUSE_16_BIT_TICKS ) && defined( configTICK_TYPE_WIDTH_IN_BITS )
71     #error Only one of configUSE_16_BIT_TICKS and configTICK_TYPE_WIDTH_IN_BITS must be defined in FreeRTOSConfig.h.  See the Configuration section of the FreeRTOS API documentation for details.
72 #endif
73 
74 /* Define configTICK_TYPE_WIDTH_IN_BITS according to the
75  * value of configUSE_16_BIT_TICKS for backward compatibility. */
76 #ifndef configTICK_TYPE_WIDTH_IN_BITS
77     #if ( configUSE_16_BIT_TICKS == 1 )
78         #define configTICK_TYPE_WIDTH_IN_BITS    TICK_TYPE_WIDTH_16_BITS
79     #else
80         #define configTICK_TYPE_WIDTH_IN_BITS    TICK_TYPE_WIDTH_32_BITS
81     #endif
82 #endif
83 
84 /* Set configUSE_MPU_WRAPPERS_V1 to 1 to use MPU wrappers v1. */
85 #ifndef configUSE_MPU_WRAPPERS_V1
86     #define configUSE_MPU_WRAPPERS_V1    0
87 #endif
88 
89 /* Set configENABLE_ACCESS_CONTROL_LIST to 1 to enable access control list support. */
90 #ifndef configENABLE_ACCESS_CONTROL_LIST
91     #define configENABLE_ACCESS_CONTROL_LIST    0
92 #endif
93 
94 /* Basic FreeRTOS definitions. */
95 #include "projdefs.h"
96 
97 /* Definitions specific to the port being used. */
98 #include "portable.h"
99 
100 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
101 #ifndef configUSE_NEWLIB_REENTRANT
102     #define configUSE_NEWLIB_REENTRANT    0
103 #endif
104 
105 /* Required if struct _reent is used. */
106 #if ( configUSE_NEWLIB_REENTRANT == 1 )
107 
108     #include "newlib-freertos.h"
109 
110 #endif /* if ( configUSE_NEWLIB_REENTRANT == 1 ) */
111 
112 /* Must be defaulted before configUSE_PICOLIBC_TLS is used below. */
113 #ifndef configUSE_PICOLIBC_TLS
114     #define configUSE_PICOLIBC_TLS    0
115 #endif
116 
117 #if ( configUSE_PICOLIBC_TLS == 1 )
118 
119     #include "picolibc-freertos.h"
120 
121 #endif /* if ( configUSE_PICOLIBC_TLS == 1 ) */
122 
123 #ifndef configUSE_C_RUNTIME_TLS_SUPPORT
124     #define configUSE_C_RUNTIME_TLS_SUPPORT    0
125 #endif
126 
127 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
128 
129     #ifndef configTLS_BLOCK_TYPE
130         #error Missing definition:  configTLS_BLOCK_TYPE must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
131     #endif
132 
133     #ifndef configINIT_TLS_BLOCK
134         #error Missing definition:  configINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
135     #endif
136 
137     #ifndef configSET_TLS_BLOCK
138         #error Missing definition:  configSET_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
139     #endif
140 
141     #ifndef configDEINIT_TLS_BLOCK
142         #error Missing definition:  configDEINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
143     #endif
144 #endif /* if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) */
145 
146 /*
147  * Check all the required application specific macros have been defined.
148  * These macros are application specific and (as downloaded) are defined
149  * within FreeRTOSConfig.h.
150  */
151 
152 #ifndef configMINIMAL_STACK_SIZE
153     #error Missing definition:  configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h.  configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task.  Refer to the demo project provided for your port for a suitable value.
154 #endif
155 
156 #ifndef configMAX_PRIORITIES
157     #error Missing definition:  configMAX_PRIORITIES must be defined in FreeRTOSConfig.h.  See the Configuration section of the FreeRTOS API documentation for details.
158 #endif
159 
160 #if configMAX_PRIORITIES < 1
161     #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
162 #endif
163 
164 #ifndef configUSE_PREEMPTION
165     #error Missing definition:  configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.
166 #endif
167 
168 #ifndef configUSE_IDLE_HOOK
169     #error Missing definition:  configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.
170 #endif
171 
172 #ifndef configUSE_TICK_HOOK
173     #error Missing definition:  configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0.  See the Configuration section of the FreeRTOS API documentation for details.
174 #endif
175 
176 #if ( ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_16_BITS ) && \
177     ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_32_BITS ) &&   \
178     ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_64_BITS ) )
179     #error Macro configTICK_TYPE_WIDTH_IN_BITS is defined to incorrect value.  See the Configuration section of the FreeRTOS API documentation for details.
180 #endif
181 
182 #ifndef configUSE_CO_ROUTINES
183     #define configUSE_CO_ROUTINES    0
184 #endif
185 
186 #ifndef INCLUDE_vTaskPrioritySet
187     #define INCLUDE_vTaskPrioritySet    0
188 #endif
189 
190 #ifndef INCLUDE_uxTaskPriorityGet
191     #define INCLUDE_uxTaskPriorityGet    0
192 #endif
193 
194 #ifndef INCLUDE_vTaskDelete
195     #define INCLUDE_vTaskDelete    0
196 #endif
197 
198 #ifndef INCLUDE_vTaskSuspend
199     #define INCLUDE_vTaskSuspend    0
200 #endif
201 
202 #ifdef INCLUDE_xTaskDelayUntil
203     #ifdef INCLUDE_vTaskDelayUntil
204 
205 /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil.  Backward
206  * compatibility is maintained if only one or the other is defined, but
207  * there is a conflict if both are defined. */
208         #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined.  INCLUDE_vTaskDelayUntil is no longer required and should be removed
209     #endif
210 #endif
211 
212 #ifndef INCLUDE_xTaskDelayUntil
213     #ifdef INCLUDE_vTaskDelayUntil
214 
215 /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
216  * the project's FreeRTOSConfig.h probably pre-dates the introduction of
217  * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
218  * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
219  */
220         #define INCLUDE_xTaskDelayUntil    INCLUDE_vTaskDelayUntil
221     #endif
222 #endif
223 
224 #ifndef INCLUDE_xTaskDelayUntil
225     #define INCLUDE_xTaskDelayUntil    0
226 #endif
227 
228 #ifndef INCLUDE_vTaskDelay
229     #define INCLUDE_vTaskDelay    0
230 #endif
231 
232 #ifndef INCLUDE_xTaskGetIdleTaskHandle
233     #define INCLUDE_xTaskGetIdleTaskHandle    0
234 #endif
235 
236 #ifndef INCLUDE_xTaskAbortDelay
237     #define INCLUDE_xTaskAbortDelay    0
238 #endif
239 
240 #ifndef INCLUDE_xQueueGetMutexHolder
241     #define INCLUDE_xQueueGetMutexHolder    0
242 #endif
243 
244 #ifndef INCLUDE_xSemaphoreGetMutexHolder
245     #define INCLUDE_xSemaphoreGetMutexHolder    INCLUDE_xQueueGetMutexHolder
246 #endif
247 
248 #ifndef INCLUDE_xTaskGetHandle
249     #define INCLUDE_xTaskGetHandle    0
250 #endif
251 
252 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
253     #define INCLUDE_uxTaskGetStackHighWaterMark    0
254 #endif
255 
256 #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
257     #define INCLUDE_uxTaskGetStackHighWaterMark2    0
258 #endif
259 
260 #ifndef INCLUDE_eTaskGetState
261     #define INCLUDE_eTaskGetState    0
262 #endif
263 
264 #ifndef INCLUDE_xTaskResumeFromISR
265     #define INCLUDE_xTaskResumeFromISR    1
266 #endif
267 
268 #ifndef INCLUDE_xTimerPendFunctionCall
269     #define INCLUDE_xTimerPendFunctionCall    0
270 #endif
271 
272 #ifndef INCLUDE_xTaskGetSchedulerState
273     #define INCLUDE_xTaskGetSchedulerState    0
274 #endif
275 
276 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
277     #define INCLUDE_xTaskGetCurrentTaskHandle    1
278 #endif
279 
280 #if configUSE_CO_ROUTINES != 0
281     #ifndef configMAX_CO_ROUTINE_PRIORITIES
282         #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
283     #endif
284 #endif
285 
286 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
287     #define configUSE_DAEMON_TASK_STARTUP_HOOK    0
288 #endif
289 
290 #ifndef configUSE_APPLICATION_TASK_TAG
291     #define configUSE_APPLICATION_TASK_TAG    0
292 #endif
293 
294 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
295     #define configNUM_THREAD_LOCAL_STORAGE_POINTERS    0
296 #endif
297 
298 #ifndef configUSE_RECURSIVE_MUTEXES
299     #define configUSE_RECURSIVE_MUTEXES    0
300 #endif
301 
302 #ifndef configUSE_MUTEXES
303     #define configUSE_MUTEXES    0
304 #endif
305 
306 #ifndef configUSE_TIMERS
307     #define configUSE_TIMERS    0
308 #endif
309 
310 #ifndef configUSE_COUNTING_SEMAPHORES
311     #define configUSE_COUNTING_SEMAPHORES    0
312 #endif
313 
314 #ifndef configUSE_ALTERNATIVE_API
315     #define configUSE_ALTERNATIVE_API    0
316 #endif
317 
318 #ifndef portCRITICAL_NESTING_IN_TCB
319     #define portCRITICAL_NESTING_IN_TCB    0
320 #endif
321 
322 #ifndef configMAX_TASK_NAME_LEN
323     #define configMAX_TASK_NAME_LEN    16
324 #endif
325 
326 #ifndef configIDLE_SHOULD_YIELD
327     #define configIDLE_SHOULD_YIELD    1
328 #endif
329 
330 #if configMAX_TASK_NAME_LEN < 1
331     #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
332 #endif
333 
334 #ifndef configASSERT
335     #define configASSERT( x )
336     #define configASSERT_DEFINED    0
337 #else
338     #define configASSERT_DEFINED    1
339 #endif
340 
341 /* configPRECONDITION should be defined as configASSERT.
342  * The CBMC proofs need a way to track assumptions and assertions.
343  * A configPRECONDITION statement should express an implicit invariant or
344  * assumption made.  A configASSERT statement should express an invariant that must
345  * hold explicit before calling the code. */
346 #ifndef configPRECONDITION
347     #define configPRECONDITION( X )    configASSERT( X )
348     #define configPRECONDITION_DEFINED    0
349 #else
350     #define configPRECONDITION_DEFINED    1
351 #endif
352 
353 #ifndef portMEMORY_BARRIER
354     #define portMEMORY_BARRIER()
355 #endif
356 
357 #ifndef portSOFTWARE_BARRIER
358     #define portSOFTWARE_BARRIER()
359 #endif
360 
361 /* The timers module relies on xTaskGetSchedulerState(). */
362 #if configUSE_TIMERS == 1
363 
364     #ifndef configTIMER_TASK_PRIORITY
365         #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
366     #endif /* configTIMER_TASK_PRIORITY */
367 
368     #ifndef configTIMER_QUEUE_LENGTH
369         #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
370     #endif /* configTIMER_QUEUE_LENGTH */
371 
372     #ifndef configTIMER_TASK_STACK_DEPTH
373         #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
374     #endif /* configTIMER_TASK_STACK_DEPTH */
375 
376 #endif /* configUSE_TIMERS */
377 
378 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
379     #define portSET_INTERRUPT_MASK_FROM_ISR()    0
380 #endif
381 
382 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
383     #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue )    ( void ) ( uxSavedStatusValue )
384 #endif
385 
386 #ifndef portCLEAN_UP_TCB
387     #define portCLEAN_UP_TCB( pxTCB )    ( void ) ( pxTCB )
388 #endif
389 
390 #ifndef portPRE_TASK_DELETE_HOOK
391     #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
392 #endif
393 
394 #ifndef portSETUP_TCB
395     #define portSETUP_TCB( pxTCB )    ( void ) ( pxTCB )
396 #endif
397 
398 #ifndef configQUEUE_REGISTRY_SIZE
399     #define configQUEUE_REGISTRY_SIZE    0U
400 #endif
401 
402 #if ( configQUEUE_REGISTRY_SIZE < 1 )
403     #define vQueueAddToRegistry( xQueue, pcName )
404     #define vQueueUnregisterQueue( xQueue )
405     #define pcQueueGetName( xQueue )
406 #endif
407 
408 #ifndef configUSE_MINI_LIST_ITEM
409     #define configUSE_MINI_LIST_ITEM    1
410 #endif
411 
412 #ifndef portPOINTER_SIZE_TYPE
413     #define portPOINTER_SIZE_TYPE    uint32_t
414 #endif
415 
416 /* Remove any unused trace macros. */
417 #ifndef traceSTART
418 
419 /* Used to perform any necessary initialisation - for example, open a file
420  * into which trace is to be written. */
421     #define traceSTART()
422 #endif
423 
424 #ifndef traceEND
425 
426 /* Use to close a trace, for example close a file into which trace has been
427  * written. */
428     #define traceEND()
429 #endif
430 
431 #ifndef traceTASK_SWITCHED_IN
432 
433 /* Called after a task has been selected to run.  pxCurrentTCB holds a pointer
434  * to the task control block of the selected task. */
435     #define traceTASK_SWITCHED_IN()
436 #endif
437 
438 #ifndef traceINCREASE_TICK_COUNT
439 
440 /* Called before stepping the tick count after waking from tickless idle
441  * sleep. */
442     #define traceINCREASE_TICK_COUNT( x )
443 #endif
444 
445 #ifndef traceLOW_POWER_IDLE_BEGIN
446     /* Called immediately before entering tickless idle. */
447     #define traceLOW_POWER_IDLE_BEGIN()
448 #endif
449 
450 #ifndef traceLOW_POWER_IDLE_END
451     /* Called when returning to the Idle task after a tickless idle. */
452     #define traceLOW_POWER_IDLE_END()
453 #endif
454 
455 #ifndef traceTASK_SWITCHED_OUT
456 
457 /* Called before a task has been selected to run.  pxCurrentTCB holds a pointer
458  * to the task control block of the task being switched out. */
459     #define traceTASK_SWITCHED_OUT()
460 #endif
461 
462 #ifndef traceTASK_PRIORITY_INHERIT
463 
464 /* Called when a task attempts to take a mutex that is already held by a
465  * lower priority task.  pxTCBOfMutexHolder is a pointer to the TCB of the task
466  * that holds the mutex.  uxInheritedPriority is the priority the mutex holder
467  * will inherit (the priority of the task that is attempting to obtain the
468  * muted. */
469     #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
470 #endif
471 
472 #ifndef traceTASK_PRIORITY_DISINHERIT
473 
474 /* Called when a task releases a mutex, the holding of which had resulted in
475  * the task inheriting the priority of a higher priority task.
476  * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
477  * mutex.  uxOriginalPriority is the task's configured (base) priority. */
478     #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
479 #endif
480 
481 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
482 
483 /* Task is about to block because it cannot read from a
484  * queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore
485  * upon which the read was attempted.  pxCurrentTCB points to the TCB of the
486  * task that attempted the read. */
487     #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
488 #endif
489 
490 #ifndef traceBLOCKING_ON_QUEUE_PEEK
491 
492 /* Task is about to block because it cannot read from a
493  * queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore
494  * upon which the read was attempted.  pxCurrentTCB points to the TCB of the
495  * task that attempted the read. */
496     #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
497 #endif
498 
499 #ifndef traceBLOCKING_ON_QUEUE_SEND
500 
501 /* Task is about to block because it cannot write to a
502  * queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore
503  * upon which the write was attempted.  pxCurrentTCB points to the TCB of the
504  * task that attempted the write. */
505     #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
506 #endif
507 
508 #ifndef configCHECK_FOR_STACK_OVERFLOW
509     #define configCHECK_FOR_STACK_OVERFLOW    0
510 #endif
511 
512 #ifndef configRECORD_STACK_HIGH_ADDRESS
513     #define configRECORD_STACK_HIGH_ADDRESS    0
514 #endif
515 
516 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
517     #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H    0
518 #endif
519 
520 /* The following event macros are embedded in the kernel API calls. */
521 
522 #ifndef traceMOVED_TASK_TO_READY_STATE
523     #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
524 #endif
525 
526 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
527     #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
528 #endif
529 
530 #ifndef traceQUEUE_CREATE
531     #define traceQUEUE_CREATE( pxNewQueue )
532 #endif
533 
534 #ifndef traceQUEUE_CREATE_FAILED
535     #define traceQUEUE_CREATE_FAILED( ucQueueType )
536 #endif
537 
538 #ifndef traceCREATE_MUTEX
539     #define traceCREATE_MUTEX( pxNewQueue )
540 #endif
541 
542 #ifndef traceCREATE_MUTEX_FAILED
543     #define traceCREATE_MUTEX_FAILED()
544 #endif
545 
546 #ifndef traceGIVE_MUTEX_RECURSIVE
547     #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
548 #endif
549 
550 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
551     #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
552 #endif
553 
554 #ifndef traceTAKE_MUTEX_RECURSIVE
555     #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
556 #endif
557 
558 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
559     #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
560 #endif
561 
562 #ifndef traceCREATE_COUNTING_SEMAPHORE
563     #define traceCREATE_COUNTING_SEMAPHORE()
564 #endif
565 
566 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
567     #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
568 #endif
569 
570 #ifndef traceQUEUE_SET_SEND
571     #define traceQUEUE_SET_SEND    traceQUEUE_SEND
572 #endif
573 
574 #ifndef traceQUEUE_SEND
575     #define traceQUEUE_SEND( pxQueue )
576 #endif
577 
578 #ifndef traceQUEUE_SEND_FAILED
579     #define traceQUEUE_SEND_FAILED( pxQueue )
580 #endif
581 
582 #ifndef traceQUEUE_RECEIVE
583     #define traceQUEUE_RECEIVE( pxQueue )
584 #endif
585 
586 #ifndef traceQUEUE_PEEK
587     #define traceQUEUE_PEEK( pxQueue )
588 #endif
589 
590 #ifndef traceQUEUE_PEEK_FAILED
591     #define traceQUEUE_PEEK_FAILED( pxQueue )
592 #endif
593 
594 #ifndef traceQUEUE_PEEK_FROM_ISR
595     #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
596 #endif
597 
598 #ifndef traceQUEUE_RECEIVE_FAILED
599     #define traceQUEUE_RECEIVE_FAILED( pxQueue )
600 #endif
601 
602 #ifndef traceQUEUE_SEND_FROM_ISR
603     #define traceQUEUE_SEND_FROM_ISR( pxQueue )
604 #endif
605 
606 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
607     #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
608 #endif
609 
610 #ifndef traceQUEUE_RECEIVE_FROM_ISR
611     #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
612 #endif
613 
614 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
615     #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
616 #endif
617 
618 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
619     #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
620 #endif
621 
622 #ifndef traceQUEUE_DELETE
623     #define traceQUEUE_DELETE( pxQueue )
624 #endif
625 
626 #ifndef traceTASK_CREATE
627     #define traceTASK_CREATE( pxNewTCB )
628 #endif
629 
630 #ifndef traceTASK_CREATE_FAILED
631     #define traceTASK_CREATE_FAILED()
632 #endif
633 
634 #ifndef traceTASK_DELETE
635     #define traceTASK_DELETE( pxTaskToDelete )
636 #endif
637 
638 #ifndef traceTASK_DELAY_UNTIL
639     #define traceTASK_DELAY_UNTIL( x )
640 #endif
641 
642 #ifndef traceTASK_DELAY
643     #define traceTASK_DELAY()
644 #endif
645 
646 #ifndef traceTASK_PRIORITY_SET
647     #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
648 #endif
649 
650 #ifndef traceTASK_SUSPEND
651     #define traceTASK_SUSPEND( pxTaskToSuspend )
652 #endif
653 
654 #ifndef traceTASK_RESUME
655     #define traceTASK_RESUME( pxTaskToResume )
656 #endif
657 
658 #ifndef traceTASK_RESUME_FROM_ISR
659     #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
660 #endif
661 
662 #ifndef traceTASK_INCREMENT_TICK
663     #define traceTASK_INCREMENT_TICK( xTickCount )
664 #endif
665 
666 #ifndef traceTIMER_CREATE
667     #define traceTIMER_CREATE( pxNewTimer )
668 #endif
669 
670 #ifndef traceTIMER_CREATE_FAILED
671     #define traceTIMER_CREATE_FAILED()
672 #endif
673 
674 #ifndef traceTIMER_COMMAND_SEND
675     #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
676 #endif
677 
678 #ifndef traceTIMER_EXPIRED
679     #define traceTIMER_EXPIRED( pxTimer )
680 #endif
681 
682 #ifndef traceTIMER_COMMAND_RECEIVED
683     #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
684 #endif
685 
686 #ifndef traceMALLOC
687     #define traceMALLOC( pvAddress, uiSize )
688 #endif
689 
690 #ifndef traceFREE
691     #define traceFREE( pvAddress, uiSize )
692 #endif
693 
694 #ifndef traceEVENT_GROUP_CREATE
695     #define traceEVENT_GROUP_CREATE( xEventGroup )
696 #endif
697 
698 #ifndef traceEVENT_GROUP_CREATE_FAILED
699     #define traceEVENT_GROUP_CREATE_FAILED()
700 #endif
701 
702 #ifndef traceEVENT_GROUP_SYNC_BLOCK
703     #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
704 #endif
705 
706 #ifndef traceEVENT_GROUP_SYNC_END
707     #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred )    ( void ) ( xTimeoutOccurred )
708 #endif
709 
710 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
711     #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
712 #endif
713 
714 #ifndef traceEVENT_GROUP_WAIT_BITS_END
715     #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred )    ( void ) ( xTimeoutOccurred )
716 #endif
717 
718 #ifndef traceEVENT_GROUP_CLEAR_BITS
719     #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
720 #endif
721 
722 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
723     #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
724 #endif
725 
726 #ifndef traceEVENT_GROUP_SET_BITS
727     #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
728 #endif
729 
730 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
731     #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
732 #endif
733 
734 #ifndef traceEVENT_GROUP_DELETE
735     #define traceEVENT_GROUP_DELETE( xEventGroup )
736 #endif
737 
738 #ifndef tracePEND_FUNC_CALL
739     #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
740 #endif
741 
742 #ifndef tracePEND_FUNC_CALL_FROM_ISR
743     #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
744 #endif
745 
746 #ifndef traceQUEUE_REGISTRY_ADD
747     #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
748 #endif
749 
750 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
751     #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
752 #endif
753 
754 #ifndef traceTASK_NOTIFY_TAKE
755     #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
756 #endif
757 
758 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
759     #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
760 #endif
761 
762 #ifndef traceTASK_NOTIFY_WAIT
763     #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
764 #endif
765 
766 #ifndef traceTASK_NOTIFY
767     #define traceTASK_NOTIFY( uxIndexToNotify )
768 #endif
769 
770 #ifndef traceTASK_NOTIFY_FROM_ISR
771     #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
772 #endif
773 
774 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
775     #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
776 #endif
777 
778 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
779     #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
780 #endif
781 
782 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
783     #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
784 #endif
785 
786 #ifndef traceSTREAM_BUFFER_CREATE
787     #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
788 #endif
789 
790 #ifndef traceSTREAM_BUFFER_DELETE
791     #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
792 #endif
793 
794 #ifndef traceSTREAM_BUFFER_RESET
795     #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
796 #endif
797 
798 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
799     #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
800 #endif
801 
802 #ifndef traceSTREAM_BUFFER_SEND
803     #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
804 #endif
805 
806 #ifndef traceSTREAM_BUFFER_SEND_FAILED
807     #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
808 #endif
809 
810 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
811     #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
812 #endif
813 
814 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
815     #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
816 #endif
817 
818 #ifndef traceSTREAM_BUFFER_RECEIVE
819     #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
820 #endif
821 
822 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
823     #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
824 #endif
825 
826 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
827     #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
828 #endif
829 
830 #ifndef configGENERATE_RUN_TIME_STATS
831     #define configGENERATE_RUN_TIME_STATS    0
832 #endif
833 
834 #if ( configGENERATE_RUN_TIME_STATS == 1 )
835 
836     #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
837         #error If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined.  portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base.
838     #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
839 
840     #ifndef portGET_RUN_TIME_COUNTER_VALUE
841         #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
842             #error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined.  See the examples provided and the FreeRTOS web site for more information.
843         #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
844     #endif /* portGET_RUN_TIME_COUNTER_VALUE */
845 
846 #endif /* configGENERATE_RUN_TIME_STATS */
847 
848 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
849     #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
850 #endif
851 
852 #ifndef configUSE_MALLOC_FAILED_HOOK
853     #define configUSE_MALLOC_FAILED_HOOK    0
854 #endif
855 
856 #ifndef portPRIVILEGE_BIT
857     #define portPRIVILEGE_BIT    ( ( UBaseType_t ) 0x00 )
858 #endif
859 
860 #ifndef portYIELD_WITHIN_API
861     #define portYIELD_WITHIN_API    portYIELD
862 #endif
863 
864 #ifndef portSUPPRESS_TICKS_AND_SLEEP
865     #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
866 #endif
867 
868 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
869     #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP    2
870 #endif
871 
872 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
873     #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
874 #endif
875 
876 #ifndef configUSE_TICKLESS_IDLE
877     #define configUSE_TICKLESS_IDLE    0
878 #endif
879 
880 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
881     #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
882 #endif
883 
884 #ifndef configPRE_SLEEP_PROCESSING
885     #define configPRE_SLEEP_PROCESSING( x )
886 #endif
887 
888 #ifndef configPOST_SLEEP_PROCESSING
889     #define configPOST_SLEEP_PROCESSING( x )
890 #endif
891 
892 #ifndef configUSE_QUEUE_SETS
893     #define configUSE_QUEUE_SETS    0
894 #endif
895 
896 #ifndef portTASK_USES_FLOATING_POINT
897     #define portTASK_USES_FLOATING_POINT()
898 #endif
899 
900 #ifndef portALLOCATE_SECURE_CONTEXT
901     #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
902 #endif
903 
904 #ifndef portDONT_DISCARD
905     #define portDONT_DISCARD
906 #endif
907 
908 #ifndef configUSE_TIME_SLICING
909     #define configUSE_TIME_SLICING    1
910 #endif
911 
912 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
913     #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS    0
914 #endif
915 
916 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
917     #define configUSE_STATS_FORMATTING_FUNCTIONS    0
918 #endif
919 
920 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
921     #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
922 #endif
923 
924 #ifndef configUSE_TRACE_FACILITY
925     #define configUSE_TRACE_FACILITY    0
926 #endif
927 
928 #ifndef mtCOVERAGE_TEST_MARKER
929     #define mtCOVERAGE_TEST_MARKER()
930 #endif
931 
932 #ifndef mtCOVERAGE_TEST_DELAY
933     #define mtCOVERAGE_TEST_DELAY()
934 #endif
935 
936 #ifndef portASSERT_IF_IN_ISR
937     #define portASSERT_IF_IN_ISR()
938 #endif
939 
940 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
941     #define configUSE_PORT_OPTIMISED_TASK_SELECTION    0
942 #endif
943 
944 #ifndef configAPPLICATION_ALLOCATED_HEAP
945     #define configAPPLICATION_ALLOCATED_HEAP    0
946 #endif
947 
948 #ifndef configUSE_TASK_NOTIFICATIONS
949     #define configUSE_TASK_NOTIFICATIONS    1
950 #endif
951 
952 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
953     #define configTASK_NOTIFICATION_ARRAY_ENTRIES    1
954 #endif
955 
956 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
957     #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
958 #endif
959 
960 #ifndef configUSE_POSIX_ERRNO
961     #define configUSE_POSIX_ERRNO    0
962 #endif
963 
964 #ifndef configUSE_SB_COMPLETED_CALLBACK
965 
966 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
967     #define configUSE_SB_COMPLETED_CALLBACK    0
968 #endif
969 
970 #ifndef portTICK_TYPE_IS_ATOMIC
971     #define portTICK_TYPE_IS_ATOMIC    0
972 #endif
973 
974 #ifndef configSUPPORT_STATIC_ALLOCATION
975     /* Defaults to 0 for backward compatibility. */
976     #define configSUPPORT_STATIC_ALLOCATION    0
977 #endif
978 
979 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
980     /* Defaults to 1 for backward compatibility. */
981     #define configSUPPORT_DYNAMIC_ALLOCATION    1
982 #endif
983 
984 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
985     #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
986 #endif
987 
988 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
989     #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
990         #error configUSE_STATS_FORMATTING_FUNCTIONS is 1 but the functions it enables are not used because neither configUSE_TRACE_FACILITY or configGENERATE_RUN_TIME_STATS are 1.  Set configUSE_STATS_FORMATTING_FUNCTIONS to 0 in FreeRTOSConfig.h.
991     #endif
992 #endif
993 
994 #ifndef configSTACK_DEPTH_TYPE
995 
996 /* Defaults to uint16_t for backward compatibility, but can be overridden
997  * in FreeRTOSConfig.h if uint16_t is too restrictive. */
998     #define configSTACK_DEPTH_TYPE    uint16_t
999 #endif
1000 
1001 #ifndef configRUN_TIME_COUNTER_TYPE
1002 
1003 /* Defaults to uint32_t for backward compatibility, but can be overridden in
1004  * FreeRTOSConfig.h if uint32_t is too restrictive. */
1005 
1006     #define configRUN_TIME_COUNTER_TYPE    uint32_t
1007 #endif
1008 
1009 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
1010 
1011 /* Defaults to size_t for backward compatibility, but can be overridden
1012  * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1013  * in a size_t. */
1014     #define configMESSAGE_BUFFER_LENGTH_TYPE    size_t
1015 #endif
1016 
1017 /* Sanity check the configuration. */
1018 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1019     #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1020 #endif
1021 
1022 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1023     #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1024 #endif
1025 
1026 #ifndef configINITIAL_TICK_COUNT
1027     #define configINITIAL_TICK_COUNT    0
1028 #endif
1029 
1030 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1031 
1032 /* Either variables of tick type cannot be read atomically, or
1033  * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1034  * the tick count is returned to the standard critical section macros. */
1035     #define portTICK_TYPE_ENTER_CRITICAL()                      portENTER_CRITICAL()
1036     #define portTICK_TYPE_EXIT_CRITICAL()                       portEXIT_CRITICAL()
1037     #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR()         portSET_INTERRUPT_MASK_FROM_ISR()
1038     #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x )    portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1039 #else
1040 
1041 /* The tick type can be read atomically, so critical sections used when the
1042  * tick count is returned can be defined away. */
1043     #define portTICK_TYPE_ENTER_CRITICAL()
1044     #define portTICK_TYPE_EXIT_CRITICAL()
1045     #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR()         0
1046     #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x )    ( void ) ( x )
1047 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1048 
1049 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1050  * V8 if desired. */
1051 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1052     #define configENABLE_BACKWARD_COMPATIBILITY    1
1053 #endif
1054 
1055 #ifndef configPRINTF
1056 
1057 /* configPRINTF() was not defined, so define it away to nothing.  To use
1058  * configPRINTF() then define it as follows (where MyPrintFunction() is
1059  * provided by the application writer):
1060  *
1061  * void MyPrintFunction(const char *pcFormat, ... );
1062  #define configPRINTF( X )   MyPrintFunction X
1063  *
1064  * Then call like a standard printf() function, but placing brackets around
1065  * all parameters so they are passed as a single parameter.  For example:
1066  * configPRINTF( ("Value = %d", MyVariable) ); */
1067     #define configPRINTF( X )
1068 #endif
1069 
1070 #ifndef configMAX
1071 
1072 /* The application writer has not provided their own MAX macro, so define
1073  * the following generic implementation. */
1074     #define configMAX( a, b )    ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1075 #endif
1076 
1077 #ifndef configMIN
1078 
1079 /* The application writer has not provided their own MIN macro, so define
1080  * the following generic implementation. */
1081     #define configMIN( a, b )    ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1082 #endif
1083 
1084 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1085     #define eTaskStateGet                 eTaskGetState
1086     #define portTickType                  TickType_t
1087     #define xTaskHandle                   TaskHandle_t
1088     #define xQueueHandle                  QueueHandle_t
1089     #define xSemaphoreHandle              SemaphoreHandle_t
1090     #define xQueueSetHandle               QueueSetHandle_t
1091     #define xQueueSetMemberHandle         QueueSetMemberHandle_t
1092     #define xTimeOutType                  TimeOut_t
1093     #define xMemoryRegion                 MemoryRegion_t
1094     #define xTaskParameters               TaskParameters_t
1095     #define xTaskStatusType               TaskStatus_t
1096     #define xTimerHandle                  TimerHandle_t
1097     #define xCoRoutineHandle              CoRoutineHandle_t
1098     #define pdTASK_HOOK_CODE              TaskHookFunction_t
1099     #define portTICK_RATE_MS              portTICK_PERIOD_MS
1100     #define pcTaskGetTaskName             pcTaskGetName
1101     #define pcTimerGetTimerName           pcTimerGetName
1102     #define pcQueueGetQueueName           pcQueueGetName
1103     #define vTaskGetTaskInfo              vTaskGetInfo
1104     #define xTaskGetIdleRunTimeCounter    ulTaskGetIdleRunTimeCounter
1105 
1106 /* Backward compatibility within the scheduler code only - these definitions
1107  * are not really required but are included for completeness. */
1108     #define tmrTIMER_CALLBACK             TimerCallbackFunction_t
1109     #define pdTASK_CODE                   TaskFunction_t
1110     #define xListItem                     ListItem_t
1111     #define xList                         List_t
1112 
1113 /* For libraries that break the list data hiding, and access list structure
1114  * members directly (which is not supposed to be done). */
1115     #define pxContainer                   pvContainer
1116 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1117 
1118 #if ( configUSE_ALTERNATIVE_API != 0 )
1119     #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1120 #endif
1121 
1122 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1123  * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1124  * This constant is not supported by all FreeRTOS ports that include floating
1125  * point support. */
1126 #ifndef configUSE_TASK_FPU_SUPPORT
1127     #define configUSE_TASK_FPU_SUPPORT    1
1128 #endif
1129 
1130 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1131  * currently used in ARMv8M ports. */
1132 #ifndef configENABLE_MPU
1133     #define configENABLE_MPU    0
1134 #endif
1135 
1136 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1137  * currently used in ARMv8M ports. */
1138 #ifndef configENABLE_FPU
1139     #define configENABLE_FPU    1
1140 #endif
1141 
1142 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1143  * currently used in ARMv8M ports. */
1144 #ifndef configENABLE_MVE
1145     #define configENABLE_MVE    0
1146 #endif
1147 
1148 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1149  * This is currently used in ARMv8M ports. */
1150 #ifndef configENABLE_TRUSTZONE
1151     #define configENABLE_TRUSTZONE    1
1152 #endif
1153 
1154 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1155  * the Secure Side only. */
1156 #ifndef configRUN_FREERTOS_SECURE_ONLY
1157     #define configRUN_FREERTOS_SECURE_ONLY    0
1158 #endif
1159 
1160 #ifndef configRUN_ADDITIONAL_TESTS
1161     #define configRUN_ADDITIONAL_TESTS    0
1162 #endif
1163 
1164 
1165 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1166  * dynamically allocated RAM, in which case when any task is deleted it is known
1167  * that both the task's stack and TCB need to be freed.  Sometimes the
1168  * FreeRTOSConfig.h settings only allow a task to be created using statically
1169  * allocated RAM, in which case when any task is deleted it is known that neither
1170  * the task's stack or TCB should be freed.  Sometimes the FreeRTOSConfig.h
1171  * settings allow a task to be created using either statically or dynamically
1172  * allocated RAM, in which case a member of the TCB is used to record whether the
1173  * stack and/or TCB were allocated statically or dynamically, so when a task is
1174  * deleted the RAM that was allocated dynamically is freed again and no attempt is
1175  * made to free the RAM that was allocated statically.
1176  * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1177  * task to be created using either statically or dynamically allocated RAM.  Note
1178  * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1179  * a statically allocated stack and a dynamically allocated TCB.
1180  *
1181  * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1182  * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1183  * when it is possible to have both static and dynamic allocation:
1184  *  +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1185  * | MPU | Dynamic | Static |     Available Functions     |       Possible Allocations        | Both Dynamic and | Need Free |
1186  * |     |         |        |                             |                                   | Static Possible  |           |
1187  * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1188  * | 0   | 0       | 1      | xTaskCreateStatic           | TCB - Static, Stack - Static      | No               | No        |
1189  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1190  * | 0   | 1       | 0      | xTaskCreate                 | TCB - Dynamic, Stack - Dynamic    | No               | Yes       |
1191  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1192  * | 0   | 1       | 1      | xTaskCreate,                | 1. TCB - Dynamic, Stack - Dynamic | Yes              | Yes       |
1193  * |     |         |        | xTaskCreateStatic           | 2. TCB - Static, Stack - Static   |                  |           |
1194  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1195  * | 1   | 0       | 1      | xTaskCreateStatic,          | TCB - Static, Stack - Static      | No               | No        |
1196  * |     |         |        | xTaskCreateRestrictedStatic |                                   |                  |           |
1197  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1198  * | 1   | 1       | 0      | xTaskCreate,                | 1. TCB - Dynamic, Stack - Dynamic | Yes              | Yes       |
1199  * |     |         |        | xTaskCreateRestricted       | 2. TCB - Dynamic, Stack - Static  |                  |           |
1200  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1201  * | 1   | 1       | 1      | xTaskCreate,                | 1. TCB - Dynamic, Stack - Dynamic | Yes              | Yes       |
1202  * |     |         |        | xTaskCreateStatic,          | 2. TCB - Dynamic, Stack - Static  |                  |           |
1203  * |     |         |        | xTaskCreateRestricted,      | 3. TCB - Static, Stack - Static   |                  |           |
1204  * |     |         |        | xTaskCreateRestrictedStatic |                                   |                  |           |
1205  * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1206  */
1207 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE                                                                                     \
1208     ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1209       ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1210 
1211 /*
1212  * In line with software engineering best practice, FreeRTOS implements a strict
1213  * data hiding policy, so the real structures used by FreeRTOS to maintain the
1214  * state of tasks, queues, semaphores, etc. are not accessible to the application
1215  * code.  However, if the application writer wants to statically allocate such
1216  * an object then the size of the object needs to be known.  Dummy structures
1217  * that are guaranteed to have the same size and alignment requirements of the
1218  * real objects are used for this purpose.  The dummy list and list item
1219  * structures below are used for inclusion in such a dummy structure.
1220  */
1221 struct xSTATIC_LIST_ITEM
1222 {
1223     #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1224         TickType_t xDummy1;
1225     #endif
1226     TickType_t xDummy2;
1227     void * pvDummy3[ 4 ];
1228     #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1229         TickType_t xDummy4;
1230     #endif
1231 };
1232 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1233 
1234 #if ( configUSE_MINI_LIST_ITEM == 1 )
1235     /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1236     struct xSTATIC_MINI_LIST_ITEM
1237     {
1238         #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1239             TickType_t xDummy1;
1240         #endif
1241         TickType_t xDummy2;
1242         void * pvDummy3[ 2 ];
1243     };
1244     typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1245 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1246     typedef struct xSTATIC_LIST_ITEM      StaticMiniListItem_t;
1247 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1248 
1249 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1250 typedef struct xSTATIC_LIST
1251 {
1252     #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1253         TickType_t xDummy1;
1254     #endif
1255     UBaseType_t uxDummy2;
1256     void * pvDummy3;
1257     StaticMiniListItem_t xDummy4;
1258     #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1259         TickType_t xDummy5;
1260     #endif
1261 } StaticList_t;
1262 
1263 /*
1264  * In line with software engineering best practice, especially when supplying a
1265  * library that is likely to change in future versions, FreeRTOS implements a
1266  * strict data hiding policy.  This means the Task structure used internally by
1267  * FreeRTOS is not accessible to application code.  However, if the application
1268  * writer wants to statically allocate the memory required to create a task then
1269  * the size of the task object needs to be known.  The StaticTask_t structure
1270  * below is provided for this purpose.  Its sizes and alignment requirements are
1271  * guaranteed to match those of the genuine structure, no matter which
1272  * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1273  * are set.  Its contents are somewhat obfuscated in the hope users will
1274  * recognise that it would be unwise to make direct use of the structure members.
1275  */
1276 typedef struct xSTATIC_TCB
1277 {
1278     void * pxDummy1;
1279     #if ( portUSING_MPU_WRAPPERS == 1 )
1280         xMPU_SETTINGS xDummy2;
1281     #endif
1282     StaticListItem_t xDummy3[ 2 ];
1283     UBaseType_t uxDummy5;
1284     void * pxDummy6;
1285     uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1286     #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1287         void * pxDummy8;
1288     #endif
1289     #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1290         UBaseType_t uxDummy9;
1291     #endif
1292     #if ( configUSE_TRACE_FACILITY == 1 )
1293         UBaseType_t uxDummy10[ 2 ];
1294     #endif
1295     #if ( configUSE_MUTEXES == 1 )
1296         UBaseType_t uxDummy12[ 2 ];
1297     #endif
1298     #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1299         void * pxDummy14;
1300     #endif
1301     #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1302         void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1303     #endif
1304     #if ( configGENERATE_RUN_TIME_STATS == 1 )
1305         configRUN_TIME_COUNTER_TYPE ulDummy16;
1306     #endif
1307     #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
1308         configTLS_BLOCK_TYPE xDummy17;
1309     #endif
1310     #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1311         uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1312         uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1313     #endif
1314     #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1315         uint8_t uxDummy20;
1316     #endif
1317 
1318     #if ( INCLUDE_xTaskAbortDelay == 1 )
1319         uint8_t ucDummy21;
1320     #endif
1321     #if ( configUSE_POSIX_ERRNO == 1 )
1322         int iDummy22;
1323     #endif
1324 } StaticTask_t;
1325 
1326 /*
1327  * In line with software engineering best practice, especially when supplying a
1328  * library that is likely to change in future versions, FreeRTOS implements a
1329  * strict data hiding policy.  This means the Queue structure used internally by
1330  * FreeRTOS is not accessible to application code.  However, if the application
1331  * writer wants to statically allocate the memory required to create a queue
1332  * then the size of the queue object needs to be known.  The StaticQueue_t
1333  * structure below is provided for this purpose.  Its sizes and alignment
1334  * requirements are guaranteed to match those of the genuine structure, no
1335  * matter which architecture is being used, and no matter how the values in
1336  * FreeRTOSConfig.h are set.  Its contents are somewhat obfuscated in the hope
1337  * users will recognise that it would be unwise to make direct use of the
1338  * structure members.
1339  */
1340 typedef struct xSTATIC_QUEUE
1341 {
1342     void * pvDummy1[ 3 ];
1343 
1344     union
1345     {
1346         void * pvDummy2;
1347         UBaseType_t uxDummy2;
1348     } u;
1349 
1350     StaticList_t xDummy3[ 2 ];
1351     UBaseType_t uxDummy4[ 3 ];
1352     uint8_t ucDummy5[ 2 ];
1353 
1354     #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1355         uint8_t ucDummy6;
1356     #endif
1357 
1358     #if ( configUSE_QUEUE_SETS == 1 )
1359         void * pvDummy7;
1360     #endif
1361 
1362     #if ( configUSE_TRACE_FACILITY == 1 )
1363         UBaseType_t uxDummy8;
1364         uint8_t ucDummy9;
1365     #endif
1366 } StaticQueue_t;
1367 typedef StaticQueue_t StaticSemaphore_t;
1368 
1369 /*
1370  * In line with software engineering best practice, especially when supplying a
1371  * library that is likely to change in future versions, FreeRTOS implements a
1372  * strict data hiding policy.  This means the event group structure used
1373  * internally by FreeRTOS is not accessible to application code.  However, if
1374  * the application writer wants to statically allocate the memory required to
1375  * create an event group then the size of the event group object needs to be
1376  * know.  The StaticEventGroup_t structure below is provided for this purpose.
1377  * Its sizes and alignment requirements are guaranteed to match those of the
1378  * genuine structure, no matter which architecture is being used, and no matter
1379  * how the values in FreeRTOSConfig.h are set.  Its contents are somewhat
1380  * obfuscated in the hope users will recognise that it would be unwise to make
1381  * direct use of the structure members.
1382  */
1383 typedef struct xSTATIC_EVENT_GROUP
1384 {
1385     TickType_t xDummy1;
1386     StaticList_t xDummy2;
1387 
1388     #if ( configUSE_TRACE_FACILITY == 1 )
1389         UBaseType_t uxDummy3;
1390     #endif
1391 
1392     #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1393         uint8_t ucDummy4;
1394     #endif
1395 } StaticEventGroup_t;
1396 
1397 /*
1398  * In line with software engineering best practice, especially when supplying a
1399  * library that is likely to change in future versions, FreeRTOS implements a
1400  * strict data hiding policy.  This means the software timer structure used
1401  * internally by FreeRTOS is not accessible to application code.  However, if
1402  * the application writer wants to statically allocate the memory required to
1403  * create a software timer then the size of the queue object needs to be known.
1404  * The StaticTimer_t structure below is provided for this purpose.  Its sizes
1405  * and alignment requirements are guaranteed to match those of the genuine
1406  * structure, no matter which architecture is being used, and no matter how the
1407  * values in FreeRTOSConfig.h are set.  Its contents are somewhat obfuscated in
1408  * the hope users will recognise that it would be unwise to make direct use of
1409  * the structure members.
1410  */
1411 typedef struct xSTATIC_TIMER
1412 {
1413     void * pvDummy1;
1414     StaticListItem_t xDummy2;
1415     TickType_t xDummy3;
1416     void * pvDummy5;
1417     TaskFunction_t pvDummy6;
1418     #if ( configUSE_TRACE_FACILITY == 1 )
1419         UBaseType_t uxDummy7;
1420     #endif
1421     uint8_t ucDummy8;
1422 } StaticTimer_t;
1423 
1424 /*
1425  * In line with software engineering best practice, especially when supplying a
1426  * library that is likely to change in future versions, FreeRTOS implements a
1427  * strict data hiding policy.  This means the stream buffer structure used
1428  * internally by FreeRTOS is not accessible to application code.  However, if
1429  * the application writer wants to statically allocate the memory required to
1430  * create a stream buffer then the size of the stream buffer object needs to be
1431  * known.  The StaticStreamBuffer_t structure below is provided for this
1432  * purpose.  Its size and alignment requirements are guaranteed to match those
1433  * of the genuine structure, no matter which architecture is being used, and
1434  * no matter how the values in FreeRTOSConfig.h are set.  Its contents are
1435  * somewhat obfuscated in the hope users will recognise that it would be unwise
1436  * to make direct use of the structure members.
1437  */
1438 typedef struct xSTATIC_STREAM_BUFFER
1439 {
1440     size_t uxDummy1[ 4 ];
1441     void * pvDummy2[ 3 ];
1442     uint8_t ucDummy3;
1443     #if ( configUSE_TRACE_FACILITY == 1 )
1444         UBaseType_t uxDummy4;
1445     #endif
1446     #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1447         void * pvDummy5[ 2 ];
1448     #endif
1449 } StaticStreamBuffer_t;
1450 
1451 /* Message buffers are built on stream buffers. */
1452 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1453 
1454 /* *INDENT-OFF* */
1455 #ifdef __cplusplus
1456     }
1457 #endif
1458 /* *INDENT-ON* */
1459 
1460 #endif /* INC_FREERTOS_H */
1461