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