2 * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
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:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
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.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
29 #ifndef INC_FREERTOS_H
30 #define INC_FREERTOS_H
33 * Include the generic headers required for the FreeRTOS port being used.
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
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.
50 #include <stdint.h> /* READ COMMENT ABOVE. */
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
63 /* Application specific configuration options. */
64 #include "FreeRTOSConfig.h"
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.
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.
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
80 #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
84 /* Basic FreeRTOS definitions. */
87 /* Definitions specific to the port being used. */
90 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
91 #ifndef configUSE_NEWLIB_REENTRANT
92 #define configUSE_NEWLIB_REENTRANT 0
95 /* Required if struct _reent is used. */
96 #if ( configUSE_NEWLIB_REENTRANT == 1 )
98 #include "newlib-freertos.h"
100 #endif /* if ( configUSE_NEWLIB_REENTRANT == 1 ) */
102 /* Must be defaulted before configUSE_PICOLIBC_TLS is used below. */
103 #ifndef configUSE_PICOLIBC_TLS
104 #define configUSE_PICOLIBC_TLS 0
107 #if ( configUSE_PICOLIBC_TLS == 1 )
109 #include "picolibc-freertos.h"
111 #endif /* if ( configUSE_PICOLIBC_TLS == 1 ) */
113 #ifndef configUSE_C_RUNTIME_TLS_SUPPORT
114 #define configUSE_C_RUNTIME_TLS_SUPPORT 0
117 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
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.
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.
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.
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.
134 #endif /* if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) */
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.
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.
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.
150 #if configMAX_PRIORITIES < 1
151 #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
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.
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.
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.
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.
172 #ifndef configUSE_CO_ROUTINES
173 #define configUSE_CO_ROUTINES 0
176 #ifndef INCLUDE_vTaskPrioritySet
177 #define INCLUDE_vTaskPrioritySet 0
180 #ifndef INCLUDE_uxTaskPriorityGet
181 #define INCLUDE_uxTaskPriorityGet 0
184 #ifndef INCLUDE_vTaskDelete
185 #define INCLUDE_vTaskDelete 0
188 #ifndef INCLUDE_vTaskSuspend
189 #define INCLUDE_vTaskSuspend 0
192 #ifdef INCLUDE_xTaskDelayUntil
193 #ifdef INCLUDE_vTaskDelayUntil
195 /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
196 * compatibility is maintained if only one or the other is defined, but
197 * there is a conflict if both are defined. */
198 #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
202 #ifndef INCLUDE_xTaskDelayUntil
203 #ifdef INCLUDE_vTaskDelayUntil
205 /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
206 * the project's FreeRTOSConfig.h probably pre-dates the introduction of
207 * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
208 * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
210 #define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil
214 #ifndef INCLUDE_xTaskDelayUntil
215 #define INCLUDE_xTaskDelayUntil 0
218 #ifndef INCLUDE_vTaskDelay
219 #define INCLUDE_vTaskDelay 0
222 #ifndef INCLUDE_xTaskGetIdleTaskHandle
223 #define INCLUDE_xTaskGetIdleTaskHandle 0
226 #ifndef INCLUDE_xTaskAbortDelay
227 #define INCLUDE_xTaskAbortDelay 0
230 #ifndef INCLUDE_xQueueGetMutexHolder
231 #define INCLUDE_xQueueGetMutexHolder 0
234 #ifndef INCLUDE_xSemaphoreGetMutexHolder
235 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
238 #ifndef INCLUDE_xTaskGetHandle
239 #define INCLUDE_xTaskGetHandle 0
242 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
243 #define INCLUDE_uxTaskGetStackHighWaterMark 0
246 #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
247 #define INCLUDE_uxTaskGetStackHighWaterMark2 0
250 #ifndef INCLUDE_eTaskGetState
251 #define INCLUDE_eTaskGetState 0
254 #ifndef INCLUDE_xTaskResumeFromISR
255 #define INCLUDE_xTaskResumeFromISR 1
258 #ifndef INCLUDE_xTimerPendFunctionCall
259 #define INCLUDE_xTimerPendFunctionCall 0
262 #ifndef INCLUDE_xTaskGetSchedulerState
263 #define INCLUDE_xTaskGetSchedulerState 0
266 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
267 #define INCLUDE_xTaskGetCurrentTaskHandle 1
270 #if configUSE_CO_ROUTINES != 0
271 #ifndef configMAX_CO_ROUTINE_PRIORITIES
272 #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
276 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
277 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
280 #ifndef configUSE_APPLICATION_TASK_TAG
281 #define configUSE_APPLICATION_TASK_TAG 0
284 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
285 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
288 #ifndef configUSE_RECURSIVE_MUTEXES
289 #define configUSE_RECURSIVE_MUTEXES 0
292 #ifndef configUSE_MUTEXES
293 #define configUSE_MUTEXES 0
296 #ifndef configUSE_TIMERS
297 #define configUSE_TIMERS 0
300 #ifndef configUSE_COUNTING_SEMAPHORES
301 #define configUSE_COUNTING_SEMAPHORES 0
304 #ifndef configUSE_ALTERNATIVE_API
305 #define configUSE_ALTERNATIVE_API 0
308 #ifndef portCRITICAL_NESTING_IN_TCB
309 #define portCRITICAL_NESTING_IN_TCB 0
312 #ifndef configMAX_TASK_NAME_LEN
313 #define configMAX_TASK_NAME_LEN 16
316 #ifndef configIDLE_SHOULD_YIELD
317 #define configIDLE_SHOULD_YIELD 1
320 #if configMAX_TASK_NAME_LEN < 1
321 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
325 #define configASSERT( x )
326 #define configASSERT_DEFINED 0
328 #define configASSERT_DEFINED 1
331 /* configPRECONDITION should be defined as configASSERT.
332 * The CBMC proofs need a way to track assumptions and assertions.
333 * A configPRECONDITION statement should express an implicit invariant or
334 * assumption made. A configASSERT statement should express an invariant that must
335 * hold explicit before calling the code. */
336 #ifndef configPRECONDITION
337 #define configPRECONDITION( X ) configASSERT( X )
338 #define configPRECONDITION_DEFINED 0
340 #define configPRECONDITION_DEFINED 1
343 #ifndef portMEMORY_BARRIER
344 #define portMEMORY_BARRIER()
347 #ifndef portSOFTWARE_BARRIER
348 #define portSOFTWARE_BARRIER()
351 /* The timers module relies on xTaskGetSchedulerState(). */
352 #if configUSE_TIMERS == 1
354 #ifndef configTIMER_TASK_PRIORITY
355 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
356 #endif /* configTIMER_TASK_PRIORITY */
358 #ifndef configTIMER_QUEUE_LENGTH
359 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
360 #endif /* configTIMER_QUEUE_LENGTH */
362 #ifndef configTIMER_TASK_STACK_DEPTH
363 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
364 #endif /* configTIMER_TASK_STACK_DEPTH */
366 #endif /* configUSE_TIMERS */
368 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
369 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
372 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
373 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
376 #ifndef portCLEAN_UP_TCB
377 #define portCLEAN_UP_TCB( pxTCB ) ( void ) ( pxTCB )
380 #ifndef portPRE_TASK_DELETE_HOOK
381 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
384 #ifndef portSETUP_TCB
385 #define portSETUP_TCB( pxTCB ) ( void ) ( pxTCB )
388 #ifndef configQUEUE_REGISTRY_SIZE
389 #define configQUEUE_REGISTRY_SIZE 0U
392 #if ( configQUEUE_REGISTRY_SIZE < 1 )
393 #define vQueueAddToRegistry( xQueue, pcName )
394 #define vQueueUnregisterQueue( xQueue )
395 #define pcQueueGetName( xQueue )
398 #ifndef configUSE_MINI_LIST_ITEM
399 #define configUSE_MINI_LIST_ITEM 1
402 #ifndef portPOINTER_SIZE_TYPE
403 #define portPOINTER_SIZE_TYPE uint32_t
406 /* Remove any unused trace macros. */
409 /* Used to perform any necessary initialisation - for example, open a file
410 * into which trace is to be written. */
416 /* Use to close a trace, for example close a file into which trace has been
421 #ifndef traceTASK_SWITCHED_IN
423 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
424 * to the task control block of the selected task. */
425 #define traceTASK_SWITCHED_IN()
428 #ifndef traceINCREASE_TICK_COUNT
430 /* Called before stepping the tick count after waking from tickless idle
432 #define traceINCREASE_TICK_COUNT( x )
435 #ifndef traceLOW_POWER_IDLE_BEGIN
436 /* Called immediately before entering tickless idle. */
437 #define traceLOW_POWER_IDLE_BEGIN()
440 #ifndef traceLOW_POWER_IDLE_END
441 /* Called when returning to the Idle task after a tickless idle. */
442 #define traceLOW_POWER_IDLE_END()
445 #ifndef traceTASK_SWITCHED_OUT
447 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
448 * to the task control block of the task being switched out. */
449 #define traceTASK_SWITCHED_OUT()
452 #ifndef traceTASK_PRIORITY_INHERIT
454 /* Called when a task attempts to take a mutex that is already held by a
455 * lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
456 * that holds the mutex. uxInheritedPriority is the priority the mutex holder
457 * will inherit (the priority of the task that is attempting to obtain the
459 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
462 #ifndef traceTASK_PRIORITY_DISINHERIT
464 /* Called when a task releases a mutex, the holding of which had resulted in
465 * the task inheriting the priority of a higher priority task.
466 * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
467 * mutex. uxOriginalPriority is the task's configured (base) priority. */
468 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
471 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
473 /* Task is about to block because it cannot read from a
474 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
475 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
476 * task that attempted the read. */
477 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
480 #ifndef traceBLOCKING_ON_QUEUE_PEEK
482 /* Task is about to block because it cannot read from a
483 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
484 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
485 * task that attempted the read. */
486 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
489 #ifndef traceBLOCKING_ON_QUEUE_SEND
491 /* Task is about to block because it cannot write to a
492 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
493 * upon which the write was attempted. pxCurrentTCB points to the TCB of the
494 * task that attempted the write. */
495 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
498 #ifndef configCHECK_FOR_STACK_OVERFLOW
499 #define configCHECK_FOR_STACK_OVERFLOW 0
502 #ifndef configRECORD_STACK_HIGH_ADDRESS
503 #define configRECORD_STACK_HIGH_ADDRESS 0
506 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
507 #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
510 /* The following event macros are embedded in the kernel API calls. */
512 #ifndef traceMOVED_TASK_TO_READY_STATE
513 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
516 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
517 #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
520 #ifndef traceQUEUE_CREATE
521 #define traceQUEUE_CREATE( pxNewQueue )
524 #ifndef traceQUEUE_CREATE_FAILED
525 #define traceQUEUE_CREATE_FAILED( ucQueueType )
528 #ifndef traceCREATE_MUTEX
529 #define traceCREATE_MUTEX( pxNewQueue )
532 #ifndef traceCREATE_MUTEX_FAILED
533 #define traceCREATE_MUTEX_FAILED()
536 #ifndef traceGIVE_MUTEX_RECURSIVE
537 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
540 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
541 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
544 #ifndef traceTAKE_MUTEX_RECURSIVE
545 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
548 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
549 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
552 #ifndef traceCREATE_COUNTING_SEMAPHORE
553 #define traceCREATE_COUNTING_SEMAPHORE()
556 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
557 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
560 #ifndef traceQUEUE_SET_SEND
561 #define traceQUEUE_SET_SEND traceQUEUE_SEND
564 #ifndef traceQUEUE_SEND
565 #define traceQUEUE_SEND( pxQueue )
568 #ifndef traceQUEUE_SEND_FAILED
569 #define traceQUEUE_SEND_FAILED( pxQueue )
572 #ifndef traceQUEUE_RECEIVE
573 #define traceQUEUE_RECEIVE( pxQueue )
576 #ifndef traceQUEUE_PEEK
577 #define traceQUEUE_PEEK( pxQueue )
580 #ifndef traceQUEUE_PEEK_FAILED
581 #define traceQUEUE_PEEK_FAILED( pxQueue )
584 #ifndef traceQUEUE_PEEK_FROM_ISR
585 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
588 #ifndef traceQUEUE_RECEIVE_FAILED
589 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
592 #ifndef traceQUEUE_SEND_FROM_ISR
593 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
596 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
597 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
600 #ifndef traceQUEUE_RECEIVE_FROM_ISR
601 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
604 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
605 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
608 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
609 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
612 #ifndef traceQUEUE_DELETE
613 #define traceQUEUE_DELETE( pxQueue )
616 #ifndef traceTASK_CREATE
617 #define traceTASK_CREATE( pxNewTCB )
620 #ifndef traceTASK_CREATE_FAILED
621 #define traceTASK_CREATE_FAILED()
624 #ifndef traceTASK_DELETE
625 #define traceTASK_DELETE( pxTaskToDelete )
628 #ifndef traceTASK_DELAY_UNTIL
629 #define traceTASK_DELAY_UNTIL( x )
632 #ifndef traceTASK_DELAY
633 #define traceTASK_DELAY()
636 #ifndef traceTASK_PRIORITY_SET
637 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
640 #ifndef traceTASK_SUSPEND
641 #define traceTASK_SUSPEND( pxTaskToSuspend )
644 #ifndef traceTASK_RESUME
645 #define traceTASK_RESUME( pxTaskToResume )
648 #ifndef traceTASK_RESUME_FROM_ISR
649 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
652 #ifndef traceTASK_INCREMENT_TICK
653 #define traceTASK_INCREMENT_TICK( xTickCount )
656 #ifndef traceTIMER_CREATE
657 #define traceTIMER_CREATE( pxNewTimer )
660 #ifndef traceTIMER_CREATE_FAILED
661 #define traceTIMER_CREATE_FAILED()
664 #ifndef traceTIMER_COMMAND_SEND
665 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
668 #ifndef traceTIMER_EXPIRED
669 #define traceTIMER_EXPIRED( pxTimer )
672 #ifndef traceTIMER_COMMAND_RECEIVED
673 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
677 #define traceMALLOC( pvAddress, uiSize )
681 #define traceFREE( pvAddress, uiSize )
684 #ifndef traceEVENT_GROUP_CREATE
685 #define traceEVENT_GROUP_CREATE( xEventGroup )
688 #ifndef traceEVENT_GROUP_CREATE_FAILED
689 #define traceEVENT_GROUP_CREATE_FAILED()
692 #ifndef traceEVENT_GROUP_SYNC_BLOCK
693 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
696 #ifndef traceEVENT_GROUP_SYNC_END
697 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
700 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
701 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
704 #ifndef traceEVENT_GROUP_WAIT_BITS_END
705 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
708 #ifndef traceEVENT_GROUP_CLEAR_BITS
709 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
712 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
713 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
716 #ifndef traceEVENT_GROUP_SET_BITS
717 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
720 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
721 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
724 #ifndef traceEVENT_GROUP_DELETE
725 #define traceEVENT_GROUP_DELETE( xEventGroup )
728 #ifndef tracePEND_FUNC_CALL
729 #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
732 #ifndef tracePEND_FUNC_CALL_FROM_ISR
733 #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
736 #ifndef traceQUEUE_REGISTRY_ADD
737 #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
740 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
741 #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
744 #ifndef traceTASK_NOTIFY_TAKE
745 #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
748 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
749 #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
752 #ifndef traceTASK_NOTIFY_WAIT
753 #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
756 #ifndef traceTASK_NOTIFY
757 #define traceTASK_NOTIFY( uxIndexToNotify )
760 #ifndef traceTASK_NOTIFY_FROM_ISR
761 #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
764 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
765 #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
768 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
769 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
772 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
773 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
776 #ifndef traceSTREAM_BUFFER_CREATE
777 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
780 #ifndef traceSTREAM_BUFFER_DELETE
781 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
784 #ifndef traceSTREAM_BUFFER_RESET
785 #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
788 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
789 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
792 #ifndef traceSTREAM_BUFFER_SEND
793 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
796 #ifndef traceSTREAM_BUFFER_SEND_FAILED
797 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
800 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
801 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
804 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
805 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
808 #ifndef traceSTREAM_BUFFER_RECEIVE
809 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
812 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
813 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
816 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
817 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
820 #ifndef configGENERATE_RUN_TIME_STATS
821 #define configGENERATE_RUN_TIME_STATS 0
824 #if ( configGENERATE_RUN_TIME_STATS == 1 )
826 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
827 #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.
828 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
830 #ifndef portGET_RUN_TIME_COUNTER_VALUE
831 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
832 #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.
833 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
834 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
836 #endif /* configGENERATE_RUN_TIME_STATS */
838 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
839 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
842 #ifndef configUSE_MALLOC_FAILED_HOOK
843 #define configUSE_MALLOC_FAILED_HOOK 0
846 #ifndef portPRIVILEGE_BIT
847 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
850 #ifndef portYIELD_WITHIN_API
851 #define portYIELD_WITHIN_API portYIELD
854 #ifndef portSUPPRESS_TICKS_AND_SLEEP
855 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
858 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
859 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
862 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
863 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
866 #ifndef configUSE_TICKLESS_IDLE
867 #define configUSE_TICKLESS_IDLE 0
870 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
871 #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
874 #ifndef configPRE_SLEEP_PROCESSING
875 #define configPRE_SLEEP_PROCESSING( x )
878 #ifndef configPOST_SLEEP_PROCESSING
879 #define configPOST_SLEEP_PROCESSING( x )
882 #ifndef configUSE_QUEUE_SETS
883 #define configUSE_QUEUE_SETS 0
886 #ifndef portTASK_USES_FLOATING_POINT
887 #define portTASK_USES_FLOATING_POINT()
890 #ifndef portALLOCATE_SECURE_CONTEXT
891 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
894 #ifndef portDONT_DISCARD
895 #define portDONT_DISCARD
898 #ifndef configUSE_TIME_SLICING
899 #define configUSE_TIME_SLICING 1
902 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
903 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
906 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
907 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
910 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
911 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
914 #ifndef configUSE_TRACE_FACILITY
915 #define configUSE_TRACE_FACILITY 0
918 #ifndef mtCOVERAGE_TEST_MARKER
919 #define mtCOVERAGE_TEST_MARKER()
922 #ifndef mtCOVERAGE_TEST_DELAY
923 #define mtCOVERAGE_TEST_DELAY()
926 #ifndef portASSERT_IF_IN_ISR
927 #define portASSERT_IF_IN_ISR()
930 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
931 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
934 #ifndef configAPPLICATION_ALLOCATED_HEAP
935 #define configAPPLICATION_ALLOCATED_HEAP 0
938 #ifndef configUSE_TASK_NOTIFICATIONS
939 #define configUSE_TASK_NOTIFICATIONS 1
942 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
943 #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
946 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
947 #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
950 #ifndef configUSE_POSIX_ERRNO
951 #define configUSE_POSIX_ERRNO 0
954 #ifndef configUSE_SB_COMPLETED_CALLBACK
956 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
957 #define configUSE_SB_COMPLETED_CALLBACK 0
960 #ifndef portTICK_TYPE_IS_ATOMIC
961 #define portTICK_TYPE_IS_ATOMIC 0
964 #ifndef configSUPPORT_STATIC_ALLOCATION
965 /* Defaults to 0 for backward compatibility. */
966 #define configSUPPORT_STATIC_ALLOCATION 0
969 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
970 /* Defaults to 1 for backward compatibility. */
971 #define configSUPPORT_DYNAMIC_ALLOCATION 1
974 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
975 #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
978 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
979 #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
980 #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.
984 #ifndef configSTACK_DEPTH_TYPE
986 /* Defaults to uint16_t for backward compatibility, but can be overridden
987 * in FreeRTOSConfig.h if uint16_t is too restrictive. */
988 #define configSTACK_DEPTH_TYPE uint16_t
991 #ifndef configRUN_TIME_COUNTER_TYPE
993 /* Defaults to uint32_t for backward compatibility, but can be overridden in
994 * FreeRTOSConfig.h if uint32_t is too restrictive. */
996 #define configRUN_TIME_COUNTER_TYPE uint32_t
999 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
1001 /* Defaults to size_t for backward compatibility, but can be overridden
1002 * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1004 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
1007 /* Sanity check the configuration. */
1008 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1009 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1012 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1013 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1016 #ifndef configINITIAL_TICK_COUNT
1017 #define configINITIAL_TICK_COUNT 0
1020 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1022 /* Either variables of tick type cannot be read atomically, or
1023 * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1024 * the tick count is returned to the standard critical section macros. */
1025 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
1026 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
1027 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
1028 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1031 /* The tick type can be read atomically, so critical sections used when the
1032 * tick count is returned can be defined away. */
1033 #define portTICK_TYPE_ENTER_CRITICAL()
1034 #define portTICK_TYPE_EXIT_CRITICAL()
1035 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
1036 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) ( x )
1037 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1039 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1041 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1042 #define configENABLE_BACKWARD_COMPATIBILITY 1
1045 #ifndef configPRINTF
1047 /* configPRINTF() was not defined, so define it away to nothing. To use
1048 * configPRINTF() then define it as follows (where MyPrintFunction() is
1049 * provided by the application writer):
1051 * void MyPrintFunction(const char *pcFormat, ... );
1052 #define configPRINTF( X ) MyPrintFunction X
1054 * Then call like a standard printf() function, but placing brackets around
1055 * all parameters so they are passed as a single parameter. For example:
1056 * configPRINTF( ("Value = %d", MyVariable) ); */
1057 #define configPRINTF( X )
1062 /* The application writer has not provided their own MAX macro, so define
1063 * the following generic implementation. */
1064 #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1069 /* The application writer has not provided their own MIN macro, so define
1070 * the following generic implementation. */
1071 #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1074 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1075 #define eTaskStateGet eTaskGetState
1076 #define portTickType TickType_t
1077 #define xTaskHandle TaskHandle_t
1078 #define xQueueHandle QueueHandle_t
1079 #define xSemaphoreHandle SemaphoreHandle_t
1080 #define xQueueSetHandle QueueSetHandle_t
1081 #define xQueueSetMemberHandle QueueSetMemberHandle_t
1082 #define xTimeOutType TimeOut_t
1083 #define xMemoryRegion MemoryRegion_t
1084 #define xTaskParameters TaskParameters_t
1085 #define xTaskStatusType TaskStatus_t
1086 #define xTimerHandle TimerHandle_t
1087 #define xCoRoutineHandle CoRoutineHandle_t
1088 #define pdTASK_HOOK_CODE TaskHookFunction_t
1089 #define portTICK_RATE_MS portTICK_PERIOD_MS
1090 #define pcTaskGetTaskName pcTaskGetName
1091 #define pcTimerGetTimerName pcTimerGetName
1092 #define pcQueueGetQueueName pcQueueGetName
1093 #define vTaskGetTaskInfo vTaskGetInfo
1094 #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
1096 /* Backward compatibility within the scheduler code only - these definitions
1097 * are not really required but are included for completeness. */
1098 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
1099 #define pdTASK_CODE TaskFunction_t
1100 #define xListItem ListItem_t
1101 #define xList List_t
1103 /* For libraries that break the list data hiding, and access list structure
1104 * members directly (which is not supposed to be done). */
1105 #define pxContainer pvContainer
1106 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1108 #if ( configUSE_ALTERNATIVE_API != 0 )
1109 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1112 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1113 * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1114 * This constant is not supported by all FreeRTOS ports that include floating
1116 #ifndef configUSE_TASK_FPU_SUPPORT
1117 #define configUSE_TASK_FPU_SUPPORT 1
1120 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1121 * currently used in ARMv8M ports. */
1122 #ifndef configENABLE_MPU
1123 #define configENABLE_MPU 0
1126 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1127 * currently used in ARMv8M ports. */
1128 #ifndef configENABLE_FPU
1129 #define configENABLE_FPU 1
1132 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1133 * currently used in ARMv8M ports. */
1134 #ifndef configENABLE_MVE
1135 #define configENABLE_MVE 0
1138 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1139 * This is currently used in ARMv8M ports. */
1140 #ifndef configENABLE_TRUSTZONE
1141 #define configENABLE_TRUSTZONE 1
1144 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1145 * the Secure Side only. */
1146 #ifndef configRUN_FREERTOS_SECURE_ONLY
1147 #define configRUN_FREERTOS_SECURE_ONLY 0
1150 #ifndef configRUN_ADDITIONAL_TESTS
1151 #define configRUN_ADDITIONAL_TESTS 0
1155 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1156 * dynamically allocated RAM, in which case when any task is deleted it is known
1157 * that both the task's stack and TCB need to be freed. Sometimes the
1158 * FreeRTOSConfig.h settings only allow a task to be created using statically
1159 * allocated RAM, in which case when any task is deleted it is known that neither
1160 * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
1161 * settings allow a task to be created using either statically or dynamically
1162 * allocated RAM, in which case a member of the TCB is used to record whether the
1163 * stack and/or TCB were allocated statically or dynamically, so when a task is
1164 * deleted the RAM that was allocated dynamically is freed again and no attempt is
1165 * made to free the RAM that was allocated statically.
1166 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1167 * task to be created using either statically or dynamically allocated RAM. Note
1168 * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1169 * a statically allocated stack and a dynamically allocated TCB.
1171 * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1172 * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1173 * when it is possible to have both static and dynamic allocation:
1174 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1175 * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
1176 * | | | | | | Static Possible | |
1177 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1178 * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
1179 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1180 * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
1181 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1182 * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1183 * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
1184 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1185 * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
1186 * | | | | xTaskCreateRestrictedStatic | | | |
1187 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1188 * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1189 * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
1190 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1191 * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1192 * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
1193 * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
1194 * | | | | xTaskCreateRestrictedStatic | | | |
1195 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1197 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
1198 ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1199 ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1202 * In line with software engineering best practice, FreeRTOS implements a strict
1203 * data hiding policy, so the real structures used by FreeRTOS to maintain the
1204 * state of tasks, queues, semaphores, etc. are not accessible to the application
1205 * code. However, if the application writer wants to statically allocate such
1206 * an object then the size of the object needs to be known. Dummy structures
1207 * that are guaranteed to have the same size and alignment requirements of the
1208 * real objects are used for this purpose. The dummy list and list item
1209 * structures below are used for inclusion in such a dummy structure.
1211 struct xSTATIC_LIST_ITEM
1213 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1217 void * pvDummy3[ 4 ];
1218 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1222 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1224 #if ( configUSE_MINI_LIST_ITEM == 1 )
1225 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1226 struct xSTATIC_MINI_LIST_ITEM
1228 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1232 void * pvDummy3[ 2 ];
1234 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1235 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1236 typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
1237 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1239 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1240 typedef struct xSTATIC_LIST
1242 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1245 UBaseType_t uxDummy2;
1247 StaticMiniListItem_t xDummy4;
1248 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1254 * In line with software engineering best practice, especially when supplying a
1255 * library that is likely to change in future versions, FreeRTOS implements a
1256 * strict data hiding policy. This means the Task structure used internally by
1257 * FreeRTOS is not accessible to application code. However, if the application
1258 * writer wants to statically allocate the memory required to create a task then
1259 * the size of the task object needs to be known. The StaticTask_t structure
1260 * below is provided for this purpose. Its sizes and alignment requirements are
1261 * guaranteed to match those of the genuine structure, no matter which
1262 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1263 * are set. Its contents are somewhat obfuscated in the hope users will
1264 * recognise that it would be unwise to make direct use of the structure members.
1266 typedef struct xSTATIC_TCB
1269 #if ( portUSING_MPU_WRAPPERS == 1 )
1270 xMPU_SETTINGS xDummy2;
1272 StaticListItem_t xDummy3[ 2 ];
1273 UBaseType_t uxDummy5;
1275 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1276 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1279 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1280 UBaseType_t uxDummy9;
1282 #if ( configUSE_TRACE_FACILITY == 1 )
1283 UBaseType_t uxDummy10[ 2 ];
1285 #if ( configUSE_MUTEXES == 1 )
1286 UBaseType_t uxDummy12[ 2 ];
1288 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1291 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1292 void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1294 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1295 configRUN_TIME_COUNTER_TYPE ulDummy16;
1297 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
1298 configTLS_BLOCK_TYPE xDummy17;
1300 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1301 uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1302 uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1304 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1308 #if ( INCLUDE_xTaskAbortDelay == 1 )
1311 #if ( configUSE_POSIX_ERRNO == 1 )
1317 * In line with software engineering best practice, especially when supplying a
1318 * library that is likely to change in future versions, FreeRTOS implements a
1319 * strict data hiding policy. This means the Queue structure used internally by
1320 * FreeRTOS is not accessible to application code. However, if the application
1321 * writer wants to statically allocate the memory required to create a queue
1322 * then the size of the queue object needs to be known. The StaticQueue_t
1323 * structure below is provided for this purpose. Its sizes and alignment
1324 * requirements are guaranteed to match those of the genuine structure, no
1325 * matter which architecture is being used, and no matter how the values in
1326 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
1327 * users will recognise that it would be unwise to make direct use of the
1328 * structure members.
1330 typedef struct xSTATIC_QUEUE
1332 void * pvDummy1[ 3 ];
1337 UBaseType_t uxDummy2;
1340 StaticList_t xDummy3[ 2 ];
1341 UBaseType_t uxDummy4[ 3 ];
1342 uint8_t ucDummy5[ 2 ];
1344 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1348 #if ( configUSE_QUEUE_SETS == 1 )
1352 #if ( configUSE_TRACE_FACILITY == 1 )
1353 UBaseType_t uxDummy8;
1357 typedef StaticQueue_t StaticSemaphore_t;
1360 * In line with software engineering best practice, especially when supplying a
1361 * library that is likely to change in future versions, FreeRTOS implements a
1362 * strict data hiding policy. This means the event group structure used
1363 * internally by FreeRTOS is not accessible to application code. However, if
1364 * the application writer wants to statically allocate the memory required to
1365 * create an event group then the size of the event group object needs to be
1366 * know. The StaticEventGroup_t structure below is provided for this purpose.
1367 * Its sizes and alignment requirements are guaranteed to match those of the
1368 * genuine structure, no matter which architecture is being used, and no matter
1369 * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1370 * obfuscated in the hope users will recognise that it would be unwise to make
1371 * direct use of the structure members.
1373 typedef struct xSTATIC_EVENT_GROUP
1376 StaticList_t xDummy2;
1378 #if ( configUSE_TRACE_FACILITY == 1 )
1379 UBaseType_t uxDummy3;
1382 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1385 } StaticEventGroup_t;
1388 * In line with software engineering best practice, especially when supplying a
1389 * library that is likely to change in future versions, FreeRTOS implements a
1390 * strict data hiding policy. This means the software timer structure used
1391 * internally by FreeRTOS is not accessible to application code. However, if
1392 * the application writer wants to statically allocate the memory required to
1393 * create a software timer then the size of the queue object needs to be known.
1394 * The StaticTimer_t structure below is provided for this purpose. Its sizes
1395 * and alignment requirements are guaranteed to match those of the genuine
1396 * structure, no matter which architecture is being used, and no matter how the
1397 * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1398 * the hope users will recognise that it would be unwise to make direct use of
1399 * the structure members.
1401 typedef struct xSTATIC_TIMER
1404 StaticListItem_t xDummy2;
1407 TaskFunction_t pvDummy6;
1408 #if ( configUSE_TRACE_FACILITY == 1 )
1409 UBaseType_t uxDummy7;
1415 * In line with software engineering best practice, especially when supplying a
1416 * library that is likely to change in future versions, FreeRTOS implements a
1417 * strict data hiding policy. This means the stream buffer structure used
1418 * internally by FreeRTOS is not accessible to application code. However, if
1419 * the application writer wants to statically allocate the memory required to
1420 * create a stream buffer then the size of the stream buffer object needs to be
1421 * known. The StaticStreamBuffer_t structure below is provided for this
1422 * purpose. Its size and alignment requirements are guaranteed to match those
1423 * of the genuine structure, no matter which architecture is being used, and
1424 * no matter how the values in FreeRTOSConfig.h are set. Its contents are
1425 * somewhat obfuscated in the hope users will recognise that it would be unwise
1426 * to make direct use of the structure members.
1428 typedef struct xSTATIC_STREAM_BUFFER
1430 size_t uxDummy1[ 4 ];
1431 void * pvDummy2[ 3 ];
1433 #if ( configUSE_TRACE_FACILITY == 1 )
1434 UBaseType_t uxDummy4;
1436 #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1437 void * pvDummy5[ 2 ];
1439 } StaticStreamBuffer_t;
1441 /* Message buffers are built on stream buffers. */
1442 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1450 #endif /* INC_FREERTOS_H */