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 /* Set configUSE_MPU_WRAPPERS_V1 to 1 to use MPU wrappers v1. */
85 #ifndef configUSE_MPU_WRAPPERS_V1
86 #define configUSE_MPU_WRAPPERS_V1 0
89 /* Basic FreeRTOS definitions. */
92 /* Definitions specific to the port being used. */
95 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
96 #ifndef configUSE_NEWLIB_REENTRANT
97 #define configUSE_NEWLIB_REENTRANT 0
100 /* Required if struct _reent is used. */
101 #if ( configUSE_NEWLIB_REENTRANT == 1 )
103 #include "newlib-freertos.h"
105 #endif /* if ( configUSE_NEWLIB_REENTRANT == 1 ) */
107 /* Must be defaulted before configUSE_PICOLIBC_TLS is used below. */
108 #ifndef configUSE_PICOLIBC_TLS
109 #define configUSE_PICOLIBC_TLS 0
112 #if ( configUSE_PICOLIBC_TLS == 1 )
114 #include "picolibc-freertos.h"
116 #endif /* if ( configUSE_PICOLIBC_TLS == 1 ) */
118 #ifndef configUSE_C_RUNTIME_TLS_SUPPORT
119 #define configUSE_C_RUNTIME_TLS_SUPPORT 0
122 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
124 #ifndef configTLS_BLOCK_TYPE
125 #error Missing definition: configTLS_BLOCK_TYPE must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
128 #ifndef configINIT_TLS_BLOCK
129 #error Missing definition: configINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
132 #ifndef configSET_TLS_BLOCK
133 #error Missing definition: configSET_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
136 #ifndef configDEINIT_TLS_BLOCK
137 #error Missing definition: configDEINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
139 #endif /* if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) */
142 * Check all the required application specific macros have been defined.
143 * These macros are application specific and (as downloaded) are defined
144 * within FreeRTOSConfig.h.
147 #ifndef configMINIMAL_STACK_SIZE
148 #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.
151 #ifndef configMAX_PRIORITIES
152 #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
155 #if configMAX_PRIORITIES < 1
156 #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
159 #ifndef configUSE_PREEMPTION
160 #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.
163 #ifndef configUSE_IDLE_HOOK
164 #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.
167 #ifndef configUSE_TICK_HOOK
168 #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.
171 #if ( ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_16_BITS ) && \
172 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_32_BITS ) && \
173 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_64_BITS ) )
174 #error Macro configTICK_TYPE_WIDTH_IN_BITS is defined to incorrect value. See the Configuration section of the FreeRTOS API documentation for details.
177 #ifndef configUSE_CO_ROUTINES
178 #define configUSE_CO_ROUTINES 0
181 #ifndef INCLUDE_vTaskPrioritySet
182 #define INCLUDE_vTaskPrioritySet 0
185 #ifndef INCLUDE_uxTaskPriorityGet
186 #define INCLUDE_uxTaskPriorityGet 0
189 #ifndef INCLUDE_vTaskDelete
190 #define INCLUDE_vTaskDelete 0
193 #ifndef INCLUDE_vTaskSuspend
194 #define INCLUDE_vTaskSuspend 0
197 #ifdef INCLUDE_xTaskDelayUntil
198 #ifdef INCLUDE_vTaskDelayUntil
200 /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
201 * compatibility is maintained if only one or the other is defined, but
202 * there is a conflict if both are defined. */
203 #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
207 #ifndef INCLUDE_xTaskDelayUntil
208 #ifdef INCLUDE_vTaskDelayUntil
210 /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
211 * the project's FreeRTOSConfig.h probably pre-dates the introduction of
212 * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
213 * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
215 #define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil
219 #ifndef INCLUDE_xTaskDelayUntil
220 #define INCLUDE_xTaskDelayUntil 0
223 #ifndef INCLUDE_vTaskDelay
224 #define INCLUDE_vTaskDelay 0
227 #ifndef INCLUDE_xTaskGetIdleTaskHandle
228 #define INCLUDE_xTaskGetIdleTaskHandle 0
231 #ifndef INCLUDE_xTaskAbortDelay
232 #define INCLUDE_xTaskAbortDelay 0
235 #ifndef INCLUDE_xQueueGetMutexHolder
236 #define INCLUDE_xQueueGetMutexHolder 0
239 #ifndef INCLUDE_xSemaphoreGetMutexHolder
240 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
243 #ifndef INCLUDE_xTaskGetHandle
244 #define INCLUDE_xTaskGetHandle 0
247 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
248 #define INCLUDE_uxTaskGetStackHighWaterMark 0
251 #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
252 #define INCLUDE_uxTaskGetStackHighWaterMark2 0
255 #ifndef INCLUDE_eTaskGetState
256 #define INCLUDE_eTaskGetState 0
259 #ifndef INCLUDE_xTaskResumeFromISR
260 #define INCLUDE_xTaskResumeFromISR 1
263 #ifndef INCLUDE_xTimerPendFunctionCall
264 #define INCLUDE_xTimerPendFunctionCall 0
267 #ifndef INCLUDE_xTaskGetSchedulerState
268 #define INCLUDE_xTaskGetSchedulerState 0
271 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
272 #define INCLUDE_xTaskGetCurrentTaskHandle 1
275 #if configUSE_CO_ROUTINES != 0
276 #ifndef configMAX_CO_ROUTINE_PRIORITIES
277 #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
281 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
282 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
285 #ifndef configUSE_APPLICATION_TASK_TAG
286 #define configUSE_APPLICATION_TASK_TAG 0
289 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
290 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
293 #ifndef configUSE_RECURSIVE_MUTEXES
294 #define configUSE_RECURSIVE_MUTEXES 0
297 #ifndef configUSE_MUTEXES
298 #define configUSE_MUTEXES 0
301 #ifndef configUSE_TIMERS
302 #define configUSE_TIMERS 0
305 #ifndef configUSE_COUNTING_SEMAPHORES
306 #define configUSE_COUNTING_SEMAPHORES 0
309 #ifndef configUSE_ALTERNATIVE_API
310 #define configUSE_ALTERNATIVE_API 0
313 #ifndef portCRITICAL_NESTING_IN_TCB
314 #define portCRITICAL_NESTING_IN_TCB 0
317 #ifndef configMAX_TASK_NAME_LEN
318 #define configMAX_TASK_NAME_LEN 16
321 #ifndef configIDLE_SHOULD_YIELD
322 #define configIDLE_SHOULD_YIELD 1
325 #if configMAX_TASK_NAME_LEN < 1
326 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
330 #define configASSERT( x )
331 #define configASSERT_DEFINED 0
333 #define configASSERT_DEFINED 1
336 /* configPRECONDITION should be defined as configASSERT.
337 * The CBMC proofs need a way to track assumptions and assertions.
338 * A configPRECONDITION statement should express an implicit invariant or
339 * assumption made. A configASSERT statement should express an invariant that must
340 * hold explicit before calling the code. */
341 #ifndef configPRECONDITION
342 #define configPRECONDITION( X ) configASSERT( X )
343 #define configPRECONDITION_DEFINED 0
345 #define configPRECONDITION_DEFINED 1
348 #ifndef portMEMORY_BARRIER
349 #define portMEMORY_BARRIER()
352 #ifndef portSOFTWARE_BARRIER
353 #define portSOFTWARE_BARRIER()
356 /* The timers module relies on xTaskGetSchedulerState(). */
357 #if configUSE_TIMERS == 1
359 #ifndef configTIMER_TASK_PRIORITY
360 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
361 #endif /* configTIMER_TASK_PRIORITY */
363 #ifndef configTIMER_QUEUE_LENGTH
364 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
365 #endif /* configTIMER_QUEUE_LENGTH */
367 #ifndef configTIMER_TASK_STACK_DEPTH
368 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
369 #endif /* configTIMER_TASK_STACK_DEPTH */
371 #endif /* configUSE_TIMERS */
373 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
374 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
377 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
378 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
381 #ifndef portCLEAN_UP_TCB
382 #define portCLEAN_UP_TCB( pxTCB ) ( void ) ( pxTCB )
385 #ifndef portPRE_TASK_DELETE_HOOK
386 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
389 #ifndef portSETUP_TCB
390 #define portSETUP_TCB( pxTCB ) ( void ) ( pxTCB )
393 #ifndef configQUEUE_REGISTRY_SIZE
394 #define configQUEUE_REGISTRY_SIZE 0U
397 #if ( configQUEUE_REGISTRY_SIZE < 1 )
398 #define vQueueAddToRegistry( xQueue, pcName )
399 #define vQueueUnregisterQueue( xQueue )
400 #define pcQueueGetName( xQueue )
403 #ifndef configUSE_MINI_LIST_ITEM
404 #define configUSE_MINI_LIST_ITEM 1
407 #ifndef portPOINTER_SIZE_TYPE
408 #define portPOINTER_SIZE_TYPE uint32_t
411 /* Remove any unused trace macros. */
414 /* Used to perform any necessary initialisation - for example, open a file
415 * into which trace is to be written. */
421 /* Use to close a trace, for example close a file into which trace has been
426 #ifndef traceTASK_SWITCHED_IN
428 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
429 * to the task control block of the selected task. */
430 #define traceTASK_SWITCHED_IN()
433 #ifndef traceINCREASE_TICK_COUNT
435 /* Called before stepping the tick count after waking from tickless idle
437 #define traceINCREASE_TICK_COUNT( x )
440 #ifndef traceLOW_POWER_IDLE_BEGIN
441 /* Called immediately before entering tickless idle. */
442 #define traceLOW_POWER_IDLE_BEGIN()
445 #ifndef traceLOW_POWER_IDLE_END
446 /* Called when returning to the Idle task after a tickless idle. */
447 #define traceLOW_POWER_IDLE_END()
450 #ifndef traceTASK_SWITCHED_OUT
452 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
453 * to the task control block of the task being switched out. */
454 #define traceTASK_SWITCHED_OUT()
457 #ifndef traceTASK_PRIORITY_INHERIT
459 /* Called when a task attempts to take a mutex that is already held by a
460 * lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
461 * that holds the mutex. uxInheritedPriority is the priority the mutex holder
462 * will inherit (the priority of the task that is attempting to obtain the
464 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
467 #ifndef traceTASK_PRIORITY_DISINHERIT
469 /* Called when a task releases a mutex, the holding of which had resulted in
470 * the task inheriting the priority of a higher priority task.
471 * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
472 * mutex. uxOriginalPriority is the task's configured (base) priority. */
473 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
476 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
478 /* Task is about to block because it cannot read from a
479 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
480 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
481 * task that attempted the read. */
482 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
485 #ifndef traceBLOCKING_ON_QUEUE_PEEK
487 /* Task is about to block because it cannot read from a
488 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
489 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
490 * task that attempted the read. */
491 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
494 #ifndef traceBLOCKING_ON_QUEUE_SEND
496 /* Task is about to block because it cannot write to a
497 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
498 * upon which the write was attempted. pxCurrentTCB points to the TCB of the
499 * task that attempted the write. */
500 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
503 #ifndef configCHECK_FOR_STACK_OVERFLOW
504 #define configCHECK_FOR_STACK_OVERFLOW 0
507 #ifndef configRECORD_STACK_HIGH_ADDRESS
508 #define configRECORD_STACK_HIGH_ADDRESS 0
511 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
512 #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
515 /* The following event macros are embedded in the kernel API calls. */
517 #ifndef traceMOVED_TASK_TO_READY_STATE
518 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
521 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
522 #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
525 #ifndef traceQUEUE_CREATE
526 #define traceQUEUE_CREATE( pxNewQueue )
529 #ifndef traceQUEUE_CREATE_FAILED
530 #define traceQUEUE_CREATE_FAILED( ucQueueType )
533 #ifndef traceCREATE_MUTEX
534 #define traceCREATE_MUTEX( pxNewQueue )
537 #ifndef traceCREATE_MUTEX_FAILED
538 #define traceCREATE_MUTEX_FAILED()
541 #ifndef traceGIVE_MUTEX_RECURSIVE
542 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
545 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
546 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
549 #ifndef traceTAKE_MUTEX_RECURSIVE
550 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
553 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
554 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
557 #ifndef traceCREATE_COUNTING_SEMAPHORE
558 #define traceCREATE_COUNTING_SEMAPHORE()
561 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
562 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
565 #ifndef traceQUEUE_SET_SEND
566 #define traceQUEUE_SET_SEND traceQUEUE_SEND
569 #ifndef traceQUEUE_SEND
570 #define traceQUEUE_SEND( pxQueue )
573 #ifndef traceQUEUE_SEND_FAILED
574 #define traceQUEUE_SEND_FAILED( pxQueue )
577 #ifndef traceQUEUE_RECEIVE
578 #define traceQUEUE_RECEIVE( pxQueue )
581 #ifndef traceQUEUE_PEEK
582 #define traceQUEUE_PEEK( pxQueue )
585 #ifndef traceQUEUE_PEEK_FAILED
586 #define traceQUEUE_PEEK_FAILED( pxQueue )
589 #ifndef traceQUEUE_PEEK_FROM_ISR
590 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
593 #ifndef traceQUEUE_RECEIVE_FAILED
594 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
597 #ifndef traceQUEUE_SEND_FROM_ISR
598 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
601 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
602 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
605 #ifndef traceQUEUE_RECEIVE_FROM_ISR
606 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
609 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
610 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
613 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
614 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
617 #ifndef traceQUEUE_DELETE
618 #define traceQUEUE_DELETE( pxQueue )
621 #ifndef traceTASK_CREATE
622 #define traceTASK_CREATE( pxNewTCB )
625 #ifndef traceTASK_CREATE_FAILED
626 #define traceTASK_CREATE_FAILED()
629 #ifndef traceTASK_DELETE
630 #define traceTASK_DELETE( pxTaskToDelete )
633 #ifndef traceTASK_DELAY_UNTIL
634 #define traceTASK_DELAY_UNTIL( x )
637 #ifndef traceTASK_DELAY
638 #define traceTASK_DELAY()
641 #ifndef traceTASK_PRIORITY_SET
642 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
645 #ifndef traceTASK_SUSPEND
646 #define traceTASK_SUSPEND( pxTaskToSuspend )
649 #ifndef traceTASK_RESUME
650 #define traceTASK_RESUME( pxTaskToResume )
653 #ifndef traceTASK_RESUME_FROM_ISR
654 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
657 #ifndef traceTASK_INCREMENT_TICK
658 #define traceTASK_INCREMENT_TICK( xTickCount )
661 #ifndef traceTIMER_CREATE
662 #define traceTIMER_CREATE( pxNewTimer )
665 #ifndef traceTIMER_CREATE_FAILED
666 #define traceTIMER_CREATE_FAILED()
669 #ifndef traceTIMER_COMMAND_SEND
670 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
673 #ifndef traceTIMER_EXPIRED
674 #define traceTIMER_EXPIRED( pxTimer )
677 #ifndef traceTIMER_COMMAND_RECEIVED
678 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
682 #define traceMALLOC( pvAddress, uiSize )
686 #define traceFREE( pvAddress, uiSize )
689 #ifndef traceEVENT_GROUP_CREATE
690 #define traceEVENT_GROUP_CREATE( xEventGroup )
693 #ifndef traceEVENT_GROUP_CREATE_FAILED
694 #define traceEVENT_GROUP_CREATE_FAILED()
697 #ifndef traceEVENT_GROUP_SYNC_BLOCK
698 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
701 #ifndef traceEVENT_GROUP_SYNC_END
702 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
705 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
706 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
709 #ifndef traceEVENT_GROUP_WAIT_BITS_END
710 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
713 #ifndef traceEVENT_GROUP_CLEAR_BITS
714 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
717 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
718 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
721 #ifndef traceEVENT_GROUP_SET_BITS
722 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
725 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
726 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
729 #ifndef traceEVENT_GROUP_DELETE
730 #define traceEVENT_GROUP_DELETE( xEventGroup )
733 #ifndef tracePEND_FUNC_CALL
734 #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
737 #ifndef tracePEND_FUNC_CALL_FROM_ISR
738 #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
741 #ifndef traceQUEUE_REGISTRY_ADD
742 #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
745 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
746 #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
749 #ifndef traceTASK_NOTIFY_TAKE
750 #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
753 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
754 #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
757 #ifndef traceTASK_NOTIFY_WAIT
758 #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
761 #ifndef traceTASK_NOTIFY
762 #define traceTASK_NOTIFY( uxIndexToNotify )
765 #ifndef traceTASK_NOTIFY_FROM_ISR
766 #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
769 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
770 #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
773 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
774 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
777 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
778 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
781 #ifndef traceSTREAM_BUFFER_CREATE
782 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
785 #ifndef traceSTREAM_BUFFER_DELETE
786 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
789 #ifndef traceSTREAM_BUFFER_RESET
790 #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
793 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
794 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
797 #ifndef traceSTREAM_BUFFER_SEND
798 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
801 #ifndef traceSTREAM_BUFFER_SEND_FAILED
802 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
805 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
806 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
809 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
810 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
813 #ifndef traceSTREAM_BUFFER_RECEIVE
814 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
817 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
818 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
821 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
822 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
825 #ifndef configGENERATE_RUN_TIME_STATS
826 #define configGENERATE_RUN_TIME_STATS 0
829 #if ( configGENERATE_RUN_TIME_STATS == 1 )
831 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
832 #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.
833 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
835 #ifndef portGET_RUN_TIME_COUNTER_VALUE
836 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
837 #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.
838 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
839 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
841 #endif /* configGENERATE_RUN_TIME_STATS */
843 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
844 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
847 #ifndef configUSE_MALLOC_FAILED_HOOK
848 #define configUSE_MALLOC_FAILED_HOOK 0
851 #ifndef portPRIVILEGE_BIT
852 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
855 #ifndef portYIELD_WITHIN_API
856 #define portYIELD_WITHIN_API portYIELD
859 #ifndef portSUPPRESS_TICKS_AND_SLEEP
860 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
863 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
864 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
867 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
868 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
871 #ifndef configUSE_TICKLESS_IDLE
872 #define configUSE_TICKLESS_IDLE 0
875 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
876 #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
879 #ifndef configPRE_SLEEP_PROCESSING
880 #define configPRE_SLEEP_PROCESSING( x )
883 #ifndef configPOST_SLEEP_PROCESSING
884 #define configPOST_SLEEP_PROCESSING( x )
887 #ifndef configUSE_QUEUE_SETS
888 #define configUSE_QUEUE_SETS 0
891 #ifndef portTASK_USES_FLOATING_POINT
892 #define portTASK_USES_FLOATING_POINT()
895 #ifndef portALLOCATE_SECURE_CONTEXT
896 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
899 #ifndef portDONT_DISCARD
900 #define portDONT_DISCARD
903 #ifndef configUSE_TIME_SLICING
904 #define configUSE_TIME_SLICING 1
907 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
908 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
911 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
912 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
915 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
916 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
919 #ifndef configUSE_TRACE_FACILITY
920 #define configUSE_TRACE_FACILITY 0
923 #ifndef mtCOVERAGE_TEST_MARKER
924 #define mtCOVERAGE_TEST_MARKER()
927 #ifndef mtCOVERAGE_TEST_DELAY
928 #define mtCOVERAGE_TEST_DELAY()
931 #ifndef portASSERT_IF_IN_ISR
932 #define portASSERT_IF_IN_ISR()
935 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
936 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
939 #ifndef configAPPLICATION_ALLOCATED_HEAP
940 #define configAPPLICATION_ALLOCATED_HEAP 0
943 #ifndef configUSE_TASK_NOTIFICATIONS
944 #define configUSE_TASK_NOTIFICATIONS 1
947 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
948 #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
951 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
952 #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
955 #ifndef configUSE_POSIX_ERRNO
956 #define configUSE_POSIX_ERRNO 0
959 #ifndef configUSE_SB_COMPLETED_CALLBACK
961 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
962 #define configUSE_SB_COMPLETED_CALLBACK 0
965 #ifndef portTICK_TYPE_IS_ATOMIC
966 #define portTICK_TYPE_IS_ATOMIC 0
969 #ifndef configSUPPORT_STATIC_ALLOCATION
970 /* Defaults to 0 for backward compatibility. */
971 #define configSUPPORT_STATIC_ALLOCATION 0
974 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
975 /* Defaults to 1 for backward compatibility. */
976 #define configSUPPORT_DYNAMIC_ALLOCATION 1
979 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
980 #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
983 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
984 #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
985 #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.
989 #ifndef configSTACK_DEPTH_TYPE
991 /* Defaults to uint16_t for backward compatibility, but can be overridden
992 * in FreeRTOSConfig.h if uint16_t is too restrictive. */
993 #define configSTACK_DEPTH_TYPE uint16_t
996 #ifndef configRUN_TIME_COUNTER_TYPE
998 /* Defaults to uint32_t for backward compatibility, but can be overridden in
999 * FreeRTOSConfig.h if uint32_t is too restrictive. */
1001 #define configRUN_TIME_COUNTER_TYPE uint32_t
1004 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
1006 /* Defaults to size_t for backward compatibility, but can be overridden
1007 * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1009 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
1012 /* Sanity check the configuration. */
1013 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1014 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1017 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1018 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1021 #ifndef configINITIAL_TICK_COUNT
1022 #define configINITIAL_TICK_COUNT 0
1025 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1027 /* Either variables of tick type cannot be read atomically, or
1028 * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1029 * the tick count is returned to the standard critical section macros. */
1030 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
1031 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
1032 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
1033 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1036 /* The tick type can be read atomically, so critical sections used when the
1037 * tick count is returned can be defined away. */
1038 #define portTICK_TYPE_ENTER_CRITICAL()
1039 #define portTICK_TYPE_EXIT_CRITICAL()
1040 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
1041 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) ( x )
1042 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1044 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1046 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1047 #define configENABLE_BACKWARD_COMPATIBILITY 1
1050 #ifndef configPRINTF
1052 /* configPRINTF() was not defined, so define it away to nothing. To use
1053 * configPRINTF() then define it as follows (where MyPrintFunction() is
1054 * provided by the application writer):
1056 * void MyPrintFunction(const char *pcFormat, ... );
1057 #define configPRINTF( X ) MyPrintFunction X
1059 * Then call like a standard printf() function, but placing brackets around
1060 * all parameters so they are passed as a single parameter. For example:
1061 * configPRINTF( ("Value = %d", MyVariable) ); */
1062 #define configPRINTF( X )
1067 /* The application writer has not provided their own MAX macro, so define
1068 * the following generic implementation. */
1069 #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1074 /* The application writer has not provided their own MIN macro, so define
1075 * the following generic implementation. */
1076 #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1079 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1080 #define eTaskStateGet eTaskGetState
1081 #define portTickType TickType_t
1082 #define xTaskHandle TaskHandle_t
1083 #define xQueueHandle QueueHandle_t
1084 #define xSemaphoreHandle SemaphoreHandle_t
1085 #define xQueueSetHandle QueueSetHandle_t
1086 #define xQueueSetMemberHandle QueueSetMemberHandle_t
1087 #define xTimeOutType TimeOut_t
1088 #define xMemoryRegion MemoryRegion_t
1089 #define xTaskParameters TaskParameters_t
1090 #define xTaskStatusType TaskStatus_t
1091 #define xTimerHandle TimerHandle_t
1092 #define xCoRoutineHandle CoRoutineHandle_t
1093 #define pdTASK_HOOK_CODE TaskHookFunction_t
1094 #define portTICK_RATE_MS portTICK_PERIOD_MS
1095 #define pcTaskGetTaskName pcTaskGetName
1096 #define pcTimerGetTimerName pcTimerGetName
1097 #define pcQueueGetQueueName pcQueueGetName
1098 #define vTaskGetTaskInfo vTaskGetInfo
1099 #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
1101 /* Backward compatibility within the scheduler code only - these definitions
1102 * are not really required but are included for completeness. */
1103 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
1104 #define pdTASK_CODE TaskFunction_t
1105 #define xListItem ListItem_t
1106 #define xList List_t
1108 /* For libraries that break the list data hiding, and access list structure
1109 * members directly (which is not supposed to be done). */
1110 #define pxContainer pvContainer
1111 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1113 #if ( configUSE_ALTERNATIVE_API != 0 )
1114 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1117 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1118 * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1119 * This constant is not supported by all FreeRTOS ports that include floating
1121 #ifndef configUSE_TASK_FPU_SUPPORT
1122 #define configUSE_TASK_FPU_SUPPORT 1
1125 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1126 * currently used in ARMv8M ports. */
1127 #ifndef configENABLE_MPU
1128 #define configENABLE_MPU 0
1131 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1132 * currently used in ARMv8M ports. */
1133 #ifndef configENABLE_FPU
1134 #define configENABLE_FPU 1
1137 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1138 * currently used in ARMv8M ports. */
1139 #ifndef configENABLE_MVE
1140 #define configENABLE_MVE 0
1143 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1144 * This is currently used in ARMv8M ports. */
1145 #ifndef configENABLE_TRUSTZONE
1146 #define configENABLE_TRUSTZONE 1
1149 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1150 * the Secure Side only. */
1151 #ifndef configRUN_FREERTOS_SECURE_ONLY
1152 #define configRUN_FREERTOS_SECURE_ONLY 0
1155 #ifndef configRUN_ADDITIONAL_TESTS
1156 #define configRUN_ADDITIONAL_TESTS 0
1160 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1161 * dynamically allocated RAM, in which case when any task is deleted it is known
1162 * that both the task's stack and TCB need to be freed. Sometimes the
1163 * FreeRTOSConfig.h settings only allow a task to be created using statically
1164 * allocated RAM, in which case when any task is deleted it is known that neither
1165 * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
1166 * settings allow a task to be created using either statically or dynamically
1167 * allocated RAM, in which case a member of the TCB is used to record whether the
1168 * stack and/or TCB were allocated statically or dynamically, so when a task is
1169 * deleted the RAM that was allocated dynamically is freed again and no attempt is
1170 * made to free the RAM that was allocated statically.
1171 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1172 * task to be created using either statically or dynamically allocated RAM. Note
1173 * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1174 * a statically allocated stack and a dynamically allocated TCB.
1176 * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1177 * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1178 * when it is possible to have both static and dynamic allocation:
1179 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1180 * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
1181 * | | | | | | Static Possible | |
1182 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1183 * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
1184 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1185 * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
1186 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1187 * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1188 * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
1189 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1190 * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
1191 * | | | | xTaskCreateRestrictedStatic | | | |
1192 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1193 * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1194 * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
1195 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1196 * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1197 * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
1198 * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
1199 * | | | | xTaskCreateRestrictedStatic | | | |
1200 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1202 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
1203 ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1204 ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1207 * In line with software engineering best practice, FreeRTOS implements a strict
1208 * data hiding policy, so the real structures used by FreeRTOS to maintain the
1209 * state of tasks, queues, semaphores, etc. are not accessible to the application
1210 * code. However, if the application writer wants to statically allocate such
1211 * an object then the size of the object needs to be known. Dummy structures
1212 * that are guaranteed to have the same size and alignment requirements of the
1213 * real objects are used for this purpose. The dummy list and list item
1214 * structures below are used for inclusion in such a dummy structure.
1216 struct xSTATIC_LIST_ITEM
1218 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1222 void * pvDummy3[ 4 ];
1223 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1227 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1229 #if ( configUSE_MINI_LIST_ITEM == 1 )
1230 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1231 struct xSTATIC_MINI_LIST_ITEM
1233 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1237 void * pvDummy3[ 2 ];
1239 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1240 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1241 typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
1242 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1244 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1245 typedef struct xSTATIC_LIST
1247 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1250 UBaseType_t uxDummy2;
1252 StaticMiniListItem_t xDummy4;
1253 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1259 * In line with software engineering best practice, especially when supplying a
1260 * library that is likely to change in future versions, FreeRTOS implements a
1261 * strict data hiding policy. This means the Task structure used internally by
1262 * FreeRTOS is not accessible to application code. However, if the application
1263 * writer wants to statically allocate the memory required to create a task then
1264 * the size of the task object needs to be known. The StaticTask_t structure
1265 * below is provided for this purpose. Its sizes and alignment requirements are
1266 * guaranteed to match those of the genuine structure, no matter which
1267 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1268 * are set. Its contents are somewhat obfuscated in the hope users will
1269 * recognise that it would be unwise to make direct use of the structure members.
1271 typedef struct xSTATIC_TCB
1274 #if ( portUSING_MPU_WRAPPERS == 1 )
1275 xMPU_SETTINGS xDummy2;
1277 StaticListItem_t xDummy3[ 2 ];
1278 UBaseType_t uxDummy5;
1280 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1281 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1284 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1285 UBaseType_t uxDummy9;
1287 #if ( configUSE_TRACE_FACILITY == 1 )
1288 UBaseType_t uxDummy10[ 2 ];
1290 #if ( configUSE_MUTEXES == 1 )
1291 UBaseType_t uxDummy12[ 2 ];
1293 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1296 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1297 void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1299 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1300 configRUN_TIME_COUNTER_TYPE ulDummy16;
1302 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
1303 configTLS_BLOCK_TYPE xDummy17;
1305 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1306 uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1307 uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1309 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1313 #if ( INCLUDE_xTaskAbortDelay == 1 )
1316 #if ( configUSE_POSIX_ERRNO == 1 )
1322 * In line with software engineering best practice, especially when supplying a
1323 * library that is likely to change in future versions, FreeRTOS implements a
1324 * strict data hiding policy. This means the Queue structure used internally by
1325 * FreeRTOS is not accessible to application code. However, if the application
1326 * writer wants to statically allocate the memory required to create a queue
1327 * then the size of the queue object needs to be known. The StaticQueue_t
1328 * structure below is provided for this purpose. Its sizes and alignment
1329 * requirements are guaranteed to match those of the genuine structure, no
1330 * matter which architecture is being used, and no matter how the values in
1331 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
1332 * users will recognise that it would be unwise to make direct use of the
1333 * structure members.
1335 typedef struct xSTATIC_QUEUE
1337 void * pvDummy1[ 3 ];
1342 UBaseType_t uxDummy2;
1345 StaticList_t xDummy3[ 2 ];
1346 UBaseType_t uxDummy4[ 3 ];
1347 uint8_t ucDummy5[ 2 ];
1349 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1353 #if ( configUSE_QUEUE_SETS == 1 )
1357 #if ( configUSE_TRACE_FACILITY == 1 )
1358 UBaseType_t uxDummy8;
1362 typedef StaticQueue_t StaticSemaphore_t;
1365 * In line with software engineering best practice, especially when supplying a
1366 * library that is likely to change in future versions, FreeRTOS implements a
1367 * strict data hiding policy. This means the event group structure used
1368 * internally by FreeRTOS is not accessible to application code. However, if
1369 * the application writer wants to statically allocate the memory required to
1370 * create an event group then the size of the event group object needs to be
1371 * know. The StaticEventGroup_t structure below is provided for this purpose.
1372 * Its sizes and alignment requirements are guaranteed to match those of the
1373 * genuine structure, no matter which architecture is being used, and no matter
1374 * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1375 * obfuscated in the hope users will recognise that it would be unwise to make
1376 * direct use of the structure members.
1378 typedef struct xSTATIC_EVENT_GROUP
1381 StaticList_t xDummy2;
1383 #if ( configUSE_TRACE_FACILITY == 1 )
1384 UBaseType_t uxDummy3;
1387 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1390 } StaticEventGroup_t;
1393 * In line with software engineering best practice, especially when supplying a
1394 * library that is likely to change in future versions, FreeRTOS implements a
1395 * strict data hiding policy. This means the software timer structure used
1396 * internally by FreeRTOS is not accessible to application code. However, if
1397 * the application writer wants to statically allocate the memory required to
1398 * create a software timer then the size of the queue object needs to be known.
1399 * The StaticTimer_t structure below is provided for this purpose. Its sizes
1400 * and alignment requirements are guaranteed to match those of the genuine
1401 * structure, no matter which architecture is being used, and no matter how the
1402 * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1403 * the hope users will recognise that it would be unwise to make direct use of
1404 * the structure members.
1406 typedef struct xSTATIC_TIMER
1409 StaticListItem_t xDummy2;
1412 TaskFunction_t pvDummy6;
1413 #if ( configUSE_TRACE_FACILITY == 1 )
1414 UBaseType_t uxDummy7;
1420 * In line with software engineering best practice, especially when supplying a
1421 * library that is likely to change in future versions, FreeRTOS implements a
1422 * strict data hiding policy. This means the stream buffer structure used
1423 * internally by FreeRTOS is not accessible to application code. However, if
1424 * the application writer wants to statically allocate the memory required to
1425 * create a stream buffer then the size of the stream buffer object needs to be
1426 * known. The StaticStreamBuffer_t structure below is provided for this
1427 * purpose. Its size and alignment requirements are guaranteed to match those
1428 * of the genuine structure, no matter which architecture is being used, and
1429 * no matter how the values in FreeRTOSConfig.h are set. Its contents are
1430 * somewhat obfuscated in the hope users will recognise that it would be unwise
1431 * to make direct use of the structure members.
1433 typedef struct xSTATIC_STREAM_BUFFER
1435 size_t uxDummy1[ 4 ];
1436 void * pvDummy2[ 3 ];
1438 #if ( configUSE_TRACE_FACILITY == 1 )
1439 UBaseType_t uxDummy4;
1441 #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1442 void * pvDummy5[ 2 ];
1444 } StaticStreamBuffer_t;
1446 /* Message buffers are built on stream buffers. */
1447 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1455 #endif /* INC_FREERTOS_H */