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