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