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