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