2 * FreeRTOS Kernel V10.6.2
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 /* Set configENABLE_ACCESS_CONTROL_LIST to 1 to enable access control list support. */
90 #ifndef configENABLE_ACCESS_CONTROL_LIST
91 #define configENABLE_ACCESS_CONTROL_LIST 0
94 /* Basic FreeRTOS definitions. */
97 /* Definitions specific to the port being used. */
100 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
101 #ifndef configUSE_NEWLIB_REENTRANT
102 #define configUSE_NEWLIB_REENTRANT 0
105 /* Required if struct _reent is used. */
106 #if ( configUSE_NEWLIB_REENTRANT == 1 )
108 #include "newlib-freertos.h"
110 #endif /* if ( configUSE_NEWLIB_REENTRANT == 1 ) */
112 /* Must be defaulted before configUSE_PICOLIBC_TLS is used below. */
113 #ifndef configUSE_PICOLIBC_TLS
114 #define configUSE_PICOLIBC_TLS 0
117 #if ( configUSE_PICOLIBC_TLS == 1 )
119 #include "picolibc-freertos.h"
121 #endif /* if ( configUSE_PICOLIBC_TLS == 1 ) */
123 #ifndef configUSE_C_RUNTIME_TLS_SUPPORT
124 #define configUSE_C_RUNTIME_TLS_SUPPORT 0
127 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
129 #ifndef configTLS_BLOCK_TYPE
130 #error Missing definition: configTLS_BLOCK_TYPE must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
133 #ifndef configINIT_TLS_BLOCK
134 #error Missing definition: configINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
137 #ifndef configSET_TLS_BLOCK
138 #error Missing definition: configSET_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
141 #ifndef configDEINIT_TLS_BLOCK
142 #error Missing definition: configDEINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
144 #endif /* if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) */
147 * Check all the required application specific macros have been defined.
148 * These macros are application specific and (as downloaded) are defined
149 * within FreeRTOSConfig.h.
152 #ifndef configMINIMAL_STACK_SIZE
153 #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.
156 #ifndef configMAX_PRIORITIES
157 #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
160 #if configMAX_PRIORITIES < 1
161 #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
164 #ifndef configUSE_PREEMPTION
165 #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.
168 #ifndef configUSE_IDLE_HOOK
169 #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.
172 #ifndef configUSE_TICK_HOOK
173 #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.
176 #if ( ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_16_BITS ) && \
177 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_32_BITS ) && \
178 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_64_BITS ) )
179 #error Macro configTICK_TYPE_WIDTH_IN_BITS is defined to incorrect value. See the Configuration section of the FreeRTOS API documentation for details.
182 #ifndef configUSE_CO_ROUTINES
183 #define configUSE_CO_ROUTINES 0
186 #ifndef INCLUDE_vTaskPrioritySet
187 #define INCLUDE_vTaskPrioritySet 0
190 #ifndef INCLUDE_uxTaskPriorityGet
191 #define INCLUDE_uxTaskPriorityGet 0
194 #ifndef INCLUDE_vTaskDelete
195 #define INCLUDE_vTaskDelete 0
198 #ifndef INCLUDE_vTaskSuspend
199 #define INCLUDE_vTaskSuspend 0
202 #ifdef INCLUDE_xTaskDelayUntil
203 #ifdef INCLUDE_vTaskDelayUntil
205 /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
206 * compatibility is maintained if only one or the other is defined, but
207 * there is a conflict if both are defined. */
208 #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
212 #ifndef INCLUDE_xTaskDelayUntil
213 #ifdef INCLUDE_vTaskDelayUntil
215 /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
216 * the project's FreeRTOSConfig.h probably pre-dates the introduction of
217 * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
218 * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
220 #define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil
224 #ifndef INCLUDE_xTaskDelayUntil
225 #define INCLUDE_xTaskDelayUntil 0
228 #ifndef INCLUDE_vTaskDelay
229 #define INCLUDE_vTaskDelay 0
232 #ifndef INCLUDE_xTaskGetIdleTaskHandle
233 #define INCLUDE_xTaskGetIdleTaskHandle 0
236 #ifndef INCLUDE_xTaskAbortDelay
237 #define INCLUDE_xTaskAbortDelay 0
240 #ifndef INCLUDE_xQueueGetMutexHolder
241 #define INCLUDE_xQueueGetMutexHolder 0
244 #ifndef INCLUDE_xSemaphoreGetMutexHolder
245 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
248 #ifndef INCLUDE_xTaskGetHandle
249 #define INCLUDE_xTaskGetHandle 0
252 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
253 #define INCLUDE_uxTaskGetStackHighWaterMark 0
256 #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
257 #define INCLUDE_uxTaskGetStackHighWaterMark2 0
260 #ifndef INCLUDE_eTaskGetState
261 #define INCLUDE_eTaskGetState 0
264 #ifndef INCLUDE_xTaskResumeFromISR
265 #define INCLUDE_xTaskResumeFromISR 1
268 #ifndef INCLUDE_xTimerPendFunctionCall
269 #define INCLUDE_xTimerPendFunctionCall 0
272 #ifndef INCLUDE_xTaskGetSchedulerState
273 #define INCLUDE_xTaskGetSchedulerState 0
276 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
277 #define INCLUDE_xTaskGetCurrentTaskHandle 1
280 #if configUSE_CO_ROUTINES != 0
281 #ifndef configMAX_CO_ROUTINE_PRIORITIES
282 #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
286 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
287 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
290 #ifndef configUSE_APPLICATION_TASK_TAG
291 #define configUSE_APPLICATION_TASK_TAG 0
294 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
295 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
298 #ifndef configUSE_RECURSIVE_MUTEXES
299 #define configUSE_RECURSIVE_MUTEXES 0
302 #ifndef configUSE_MUTEXES
303 #define configUSE_MUTEXES 0
306 #ifndef configUSE_TIMERS
307 #define configUSE_TIMERS 0
310 #ifndef configUSE_COUNTING_SEMAPHORES
311 #define configUSE_COUNTING_SEMAPHORES 0
314 #ifndef configUSE_ALTERNATIVE_API
315 #define configUSE_ALTERNATIVE_API 0
318 #ifndef portCRITICAL_NESTING_IN_TCB
319 #define portCRITICAL_NESTING_IN_TCB 0
322 #ifndef configMAX_TASK_NAME_LEN
323 #define configMAX_TASK_NAME_LEN 16
326 #ifndef configIDLE_SHOULD_YIELD
327 #define configIDLE_SHOULD_YIELD 1
330 #if configMAX_TASK_NAME_LEN < 1
331 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
335 #define configASSERT( x )
336 #define configASSERT_DEFINED 0
338 #define configASSERT_DEFINED 1
341 /* configPRECONDITION should be defined as configASSERT.
342 * The CBMC proofs need a way to track assumptions and assertions.
343 * A configPRECONDITION statement should express an implicit invariant or
344 * assumption made. A configASSERT statement should express an invariant that must
345 * hold explicit before calling the code. */
346 #ifndef configPRECONDITION
347 #define configPRECONDITION( X ) configASSERT( X )
348 #define configPRECONDITION_DEFINED 0
350 #define configPRECONDITION_DEFINED 1
353 #ifndef portMEMORY_BARRIER
354 #define portMEMORY_BARRIER()
357 #ifndef portSOFTWARE_BARRIER
358 #define portSOFTWARE_BARRIER()
361 /* The timers module relies on xTaskGetSchedulerState(). */
362 #if configUSE_TIMERS == 1
364 #ifndef configTIMER_TASK_PRIORITY
365 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
366 #endif /* configTIMER_TASK_PRIORITY */
368 #ifndef configTIMER_QUEUE_LENGTH
369 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
370 #endif /* configTIMER_QUEUE_LENGTH */
372 #ifndef configTIMER_TASK_STACK_DEPTH
373 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
374 #endif /* configTIMER_TASK_STACK_DEPTH */
376 #endif /* configUSE_TIMERS */
378 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
379 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
382 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
383 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
386 #ifndef portCLEAN_UP_TCB
387 #define portCLEAN_UP_TCB( pxTCB ) ( void ) ( pxTCB )
390 #ifndef portPRE_TASK_DELETE_HOOK
391 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
394 #ifndef portSETUP_TCB
395 #define portSETUP_TCB( pxTCB ) ( void ) ( pxTCB )
398 #ifndef configQUEUE_REGISTRY_SIZE
399 #define configQUEUE_REGISTRY_SIZE 0U
402 #if ( configQUEUE_REGISTRY_SIZE < 1 )
403 #define vQueueAddToRegistry( xQueue, pcName )
404 #define vQueueUnregisterQueue( xQueue )
405 #define pcQueueGetName( xQueue )
408 #ifndef configUSE_MINI_LIST_ITEM
409 #define configUSE_MINI_LIST_ITEM 1
412 #ifndef portPOINTER_SIZE_TYPE
413 #define portPOINTER_SIZE_TYPE uint32_t
416 /* Remove any unused trace macros. */
419 /* Used to perform any necessary initialisation - for example, open a file
420 * into which trace is to be written. */
426 /* Use to close a trace, for example close a file into which trace has been
431 #ifndef traceTASK_SWITCHED_IN
433 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
434 * to the task control block of the selected task. */
435 #define traceTASK_SWITCHED_IN()
438 #ifndef traceINCREASE_TICK_COUNT
440 /* Called before stepping the tick count after waking from tickless idle
442 #define traceINCREASE_TICK_COUNT( x )
445 #ifndef traceLOW_POWER_IDLE_BEGIN
446 /* Called immediately before entering tickless idle. */
447 #define traceLOW_POWER_IDLE_BEGIN()
450 #ifndef traceLOW_POWER_IDLE_END
451 /* Called when returning to the Idle task after a tickless idle. */
452 #define traceLOW_POWER_IDLE_END()
455 #ifndef traceTASK_SWITCHED_OUT
457 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
458 * to the task control block of the task being switched out. */
459 #define traceTASK_SWITCHED_OUT()
462 #ifndef traceTASK_PRIORITY_INHERIT
464 /* Called when a task attempts to take a mutex that is already held by a
465 * lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
466 * that holds the mutex. uxInheritedPriority is the priority the mutex holder
467 * will inherit (the priority of the task that is attempting to obtain the
469 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
472 #ifndef traceTASK_PRIORITY_DISINHERIT
474 /* Called when a task releases a mutex, the holding of which had resulted in
475 * the task inheriting the priority of a higher priority task.
476 * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
477 * mutex. uxOriginalPriority is the task's configured (base) priority. */
478 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
481 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
483 /* Task is about to block because it cannot read from a
484 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
485 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
486 * task that attempted the read. */
487 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
490 #ifndef traceBLOCKING_ON_QUEUE_PEEK
492 /* Task is about to block because it cannot read from a
493 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
494 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
495 * task that attempted the read. */
496 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
499 #ifndef traceBLOCKING_ON_QUEUE_SEND
501 /* Task is about to block because it cannot write to a
502 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
503 * upon which the write was attempted. pxCurrentTCB points to the TCB of the
504 * task that attempted the write. */
505 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
508 #ifndef configCHECK_FOR_STACK_OVERFLOW
509 #define configCHECK_FOR_STACK_OVERFLOW 0
512 #ifndef configRECORD_STACK_HIGH_ADDRESS
513 #define configRECORD_STACK_HIGH_ADDRESS 0
516 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
517 #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
520 /* The following event macros are embedded in the kernel API calls. */
522 #ifndef traceMOVED_TASK_TO_READY_STATE
523 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
526 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
527 #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
530 #ifndef traceQUEUE_CREATE
531 #define traceQUEUE_CREATE( pxNewQueue )
534 #ifndef traceQUEUE_CREATE_FAILED
535 #define traceQUEUE_CREATE_FAILED( ucQueueType )
538 #ifndef traceCREATE_MUTEX
539 #define traceCREATE_MUTEX( pxNewQueue )
542 #ifndef traceCREATE_MUTEX_FAILED
543 #define traceCREATE_MUTEX_FAILED()
546 #ifndef traceGIVE_MUTEX_RECURSIVE
547 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
550 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
551 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
554 #ifndef traceTAKE_MUTEX_RECURSIVE
555 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
558 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
559 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
562 #ifndef traceCREATE_COUNTING_SEMAPHORE
563 #define traceCREATE_COUNTING_SEMAPHORE()
566 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
567 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
570 #ifndef traceQUEUE_SET_SEND
571 #define traceQUEUE_SET_SEND traceQUEUE_SEND
574 #ifndef traceQUEUE_SEND
575 #define traceQUEUE_SEND( pxQueue )
578 #ifndef traceQUEUE_SEND_FAILED
579 #define traceQUEUE_SEND_FAILED( pxQueue )
582 #ifndef traceQUEUE_RECEIVE
583 #define traceQUEUE_RECEIVE( pxQueue )
586 #ifndef traceQUEUE_PEEK
587 #define traceQUEUE_PEEK( pxQueue )
590 #ifndef traceQUEUE_PEEK_FAILED
591 #define traceQUEUE_PEEK_FAILED( pxQueue )
594 #ifndef traceQUEUE_PEEK_FROM_ISR
595 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
598 #ifndef traceQUEUE_RECEIVE_FAILED
599 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
602 #ifndef traceQUEUE_SEND_FROM_ISR
603 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
606 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
607 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
610 #ifndef traceQUEUE_RECEIVE_FROM_ISR
611 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
614 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
615 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
618 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
619 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
622 #ifndef traceQUEUE_DELETE
623 #define traceQUEUE_DELETE( pxQueue )
626 #ifndef traceTASK_CREATE
627 #define traceTASK_CREATE( pxNewTCB )
630 #ifndef traceTASK_CREATE_FAILED
631 #define traceTASK_CREATE_FAILED()
634 #ifndef traceTASK_DELETE
635 #define traceTASK_DELETE( pxTaskToDelete )
638 #ifndef traceTASK_DELAY_UNTIL
639 #define traceTASK_DELAY_UNTIL( x )
642 #ifndef traceTASK_DELAY
643 #define traceTASK_DELAY()
646 #ifndef traceTASK_PRIORITY_SET
647 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
650 #ifndef traceTASK_SUSPEND
651 #define traceTASK_SUSPEND( pxTaskToSuspend )
654 #ifndef traceTASK_RESUME
655 #define traceTASK_RESUME( pxTaskToResume )
658 #ifndef traceTASK_RESUME_FROM_ISR
659 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
662 #ifndef traceTASK_INCREMENT_TICK
663 #define traceTASK_INCREMENT_TICK( xTickCount )
666 #ifndef traceTIMER_CREATE
667 #define traceTIMER_CREATE( pxNewTimer )
670 #ifndef traceTIMER_CREATE_FAILED
671 #define traceTIMER_CREATE_FAILED()
674 #ifndef traceTIMER_COMMAND_SEND
675 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
678 #ifndef traceTIMER_EXPIRED
679 #define traceTIMER_EXPIRED( pxTimer )
682 #ifndef traceTIMER_COMMAND_RECEIVED
683 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
687 #define traceMALLOC( pvAddress, uiSize )
691 #define traceFREE( pvAddress, uiSize )
694 #ifndef traceEVENT_GROUP_CREATE
695 #define traceEVENT_GROUP_CREATE( xEventGroup )
698 #ifndef traceEVENT_GROUP_CREATE_FAILED
699 #define traceEVENT_GROUP_CREATE_FAILED()
702 #ifndef traceEVENT_GROUP_SYNC_BLOCK
703 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
706 #ifndef traceEVENT_GROUP_SYNC_END
707 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
710 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
711 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
714 #ifndef traceEVENT_GROUP_WAIT_BITS_END
715 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
718 #ifndef traceEVENT_GROUP_CLEAR_BITS
719 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
722 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
723 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
726 #ifndef traceEVENT_GROUP_SET_BITS
727 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
730 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
731 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
734 #ifndef traceEVENT_GROUP_DELETE
735 #define traceEVENT_GROUP_DELETE( xEventGroup )
738 #ifndef tracePEND_FUNC_CALL
739 #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
742 #ifndef tracePEND_FUNC_CALL_FROM_ISR
743 #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
746 #ifndef traceQUEUE_REGISTRY_ADD
747 #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
750 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
751 #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
754 #ifndef traceTASK_NOTIFY_TAKE
755 #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
758 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
759 #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
762 #ifndef traceTASK_NOTIFY_WAIT
763 #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
766 #ifndef traceTASK_NOTIFY
767 #define traceTASK_NOTIFY( uxIndexToNotify )
770 #ifndef traceTASK_NOTIFY_FROM_ISR
771 #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
774 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
775 #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
778 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
779 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
782 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
783 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
786 #ifndef traceSTREAM_BUFFER_CREATE
787 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
790 #ifndef traceSTREAM_BUFFER_DELETE
791 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
794 #ifndef traceSTREAM_BUFFER_RESET
795 #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
798 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
799 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
802 #ifndef traceSTREAM_BUFFER_SEND
803 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
806 #ifndef traceSTREAM_BUFFER_SEND_FAILED
807 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
810 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
811 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
814 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
815 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
818 #ifndef traceSTREAM_BUFFER_RECEIVE
819 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
822 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
823 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
826 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
827 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
830 #ifndef configGENERATE_RUN_TIME_STATS
831 #define configGENERATE_RUN_TIME_STATS 0
834 #if ( configGENERATE_RUN_TIME_STATS == 1 )
836 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
837 #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.
838 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
840 #ifndef portGET_RUN_TIME_COUNTER_VALUE
841 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
842 #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.
843 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
844 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
846 #endif /* configGENERATE_RUN_TIME_STATS */
848 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
849 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
852 #ifndef configUSE_MALLOC_FAILED_HOOK
853 #define configUSE_MALLOC_FAILED_HOOK 0
856 #ifndef portPRIVILEGE_BIT
857 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
860 #ifndef portYIELD_WITHIN_API
861 #define portYIELD_WITHIN_API portYIELD
864 #ifndef portSUPPRESS_TICKS_AND_SLEEP
865 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
868 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
869 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
872 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
873 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
876 #ifndef configUSE_TICKLESS_IDLE
877 #define configUSE_TICKLESS_IDLE 0
880 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
881 #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
884 #ifndef configPRE_SLEEP_PROCESSING
885 #define configPRE_SLEEP_PROCESSING( x )
888 #ifndef configPOST_SLEEP_PROCESSING
889 #define configPOST_SLEEP_PROCESSING( x )
892 #ifndef configUSE_QUEUE_SETS
893 #define configUSE_QUEUE_SETS 0
896 #ifndef portTASK_USES_FLOATING_POINT
897 #define portTASK_USES_FLOATING_POINT()
900 #ifndef portALLOCATE_SECURE_CONTEXT
901 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
904 #ifndef portDONT_DISCARD
905 #define portDONT_DISCARD
908 #ifndef configUSE_TIME_SLICING
909 #define configUSE_TIME_SLICING 1
912 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
913 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
916 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
917 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
920 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
921 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
924 #ifndef configUSE_TRACE_FACILITY
925 #define configUSE_TRACE_FACILITY 0
928 #ifndef mtCOVERAGE_TEST_MARKER
929 #define mtCOVERAGE_TEST_MARKER()
932 #ifndef mtCOVERAGE_TEST_DELAY
933 #define mtCOVERAGE_TEST_DELAY()
936 #ifndef portASSERT_IF_IN_ISR
937 #define portASSERT_IF_IN_ISR()
940 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
941 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
944 #ifndef configAPPLICATION_ALLOCATED_HEAP
945 #define configAPPLICATION_ALLOCATED_HEAP 0
948 #ifndef configUSE_TASK_NOTIFICATIONS
949 #define configUSE_TASK_NOTIFICATIONS 1
952 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
953 #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
956 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
957 #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
960 #ifndef configUSE_POSIX_ERRNO
961 #define configUSE_POSIX_ERRNO 0
964 #ifndef configUSE_SB_COMPLETED_CALLBACK
966 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
967 #define configUSE_SB_COMPLETED_CALLBACK 0
970 #ifndef portTICK_TYPE_IS_ATOMIC
971 #define portTICK_TYPE_IS_ATOMIC 0
974 #ifndef configSUPPORT_STATIC_ALLOCATION
975 /* Defaults to 0 for backward compatibility. */
976 #define configSUPPORT_STATIC_ALLOCATION 0
979 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
980 /* Defaults to 1 for backward compatibility. */
981 #define configSUPPORT_DYNAMIC_ALLOCATION 1
984 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
985 #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
988 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
989 #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
990 #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.
994 #ifndef configSTACK_DEPTH_TYPE
996 /* Defaults to uint16_t for backward compatibility, but can be overridden
997 * in FreeRTOSConfig.h if uint16_t is too restrictive. */
998 #define configSTACK_DEPTH_TYPE uint16_t
1001 #ifndef configRUN_TIME_COUNTER_TYPE
1003 /* Defaults to uint32_t for backward compatibility, but can be overridden in
1004 * FreeRTOSConfig.h if uint32_t is too restrictive. */
1006 #define configRUN_TIME_COUNTER_TYPE uint32_t
1009 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
1011 /* Defaults to size_t for backward compatibility, but can be overridden
1012 * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1014 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
1017 /* Sanity check the configuration. */
1018 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1019 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1022 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1023 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1026 #ifndef configINITIAL_TICK_COUNT
1027 #define configINITIAL_TICK_COUNT 0
1030 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1032 /* Either variables of tick type cannot be read atomically, or
1033 * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1034 * the tick count is returned to the standard critical section macros. */
1035 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
1036 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
1037 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
1038 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1041 /* The tick type can be read atomically, so critical sections used when the
1042 * tick count is returned can be defined away. */
1043 #define portTICK_TYPE_ENTER_CRITICAL()
1044 #define portTICK_TYPE_EXIT_CRITICAL()
1045 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
1046 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) ( x )
1047 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1049 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1051 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1052 #define configENABLE_BACKWARD_COMPATIBILITY 1
1055 #ifndef configPRINTF
1057 /* configPRINTF() was not defined, so define it away to nothing. To use
1058 * configPRINTF() then define it as follows (where MyPrintFunction() is
1059 * provided by the application writer):
1061 * void MyPrintFunction(const char *pcFormat, ... );
1062 #define configPRINTF( X ) MyPrintFunction X
1064 * Then call like a standard printf() function, but placing brackets around
1065 * all parameters so they are passed as a single parameter. For example:
1066 * configPRINTF( ("Value = %d", MyVariable) ); */
1067 #define configPRINTF( X )
1072 /* The application writer has not provided their own MAX macro, so define
1073 * the following generic implementation. */
1074 #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1079 /* The application writer has not provided their own MIN macro, so define
1080 * the following generic implementation. */
1081 #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1084 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1085 #define eTaskStateGet eTaskGetState
1086 #define portTickType TickType_t
1087 #define xTaskHandle TaskHandle_t
1088 #define xQueueHandle QueueHandle_t
1089 #define xSemaphoreHandle SemaphoreHandle_t
1090 #define xQueueSetHandle QueueSetHandle_t
1091 #define xQueueSetMemberHandle QueueSetMemberHandle_t
1092 #define xTimeOutType TimeOut_t
1093 #define xMemoryRegion MemoryRegion_t
1094 #define xTaskParameters TaskParameters_t
1095 #define xTaskStatusType TaskStatus_t
1096 #define xTimerHandle TimerHandle_t
1097 #define xCoRoutineHandle CoRoutineHandle_t
1098 #define pdTASK_HOOK_CODE TaskHookFunction_t
1099 #define portTICK_RATE_MS portTICK_PERIOD_MS
1100 #define pcTaskGetTaskName pcTaskGetName
1101 #define pcTimerGetTimerName pcTimerGetName
1102 #define pcQueueGetQueueName pcQueueGetName
1103 #define vTaskGetTaskInfo vTaskGetInfo
1104 #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
1106 /* Backward compatibility within the scheduler code only - these definitions
1107 * are not really required but are included for completeness. */
1108 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
1109 #define pdTASK_CODE TaskFunction_t
1110 #define xListItem ListItem_t
1111 #define xList List_t
1113 /* For libraries that break the list data hiding, and access list structure
1114 * members directly (which is not supposed to be done). */
1115 #define pxContainer pvContainer
1116 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1118 #if ( configUSE_ALTERNATIVE_API != 0 )
1119 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1122 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1123 * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1124 * This constant is not supported by all FreeRTOS ports that include floating
1126 #ifndef configUSE_TASK_FPU_SUPPORT
1127 #define configUSE_TASK_FPU_SUPPORT 1
1130 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1131 * currently used in ARMv8M ports. */
1132 #ifndef configENABLE_MPU
1133 #define configENABLE_MPU 0
1136 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1137 * currently used in ARMv8M ports. */
1138 #ifndef configENABLE_FPU
1139 #define configENABLE_FPU 1
1142 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1143 * currently used in ARMv8M ports. */
1144 #ifndef configENABLE_MVE
1145 #define configENABLE_MVE 0
1148 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1149 * This is currently used in ARMv8M ports. */
1150 #ifndef configENABLE_TRUSTZONE
1151 #define configENABLE_TRUSTZONE 1
1154 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1155 * the Secure Side only. */
1156 #ifndef configRUN_FREERTOS_SECURE_ONLY
1157 #define configRUN_FREERTOS_SECURE_ONLY 0
1160 #ifndef configRUN_ADDITIONAL_TESTS
1161 #define configRUN_ADDITIONAL_TESTS 0
1165 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1166 * dynamically allocated RAM, in which case when any task is deleted it is known
1167 * that both the task's stack and TCB need to be freed. Sometimes the
1168 * FreeRTOSConfig.h settings only allow a task to be created using statically
1169 * allocated RAM, in which case when any task is deleted it is known that neither
1170 * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
1171 * settings allow a task to be created using either statically or dynamically
1172 * allocated RAM, in which case a member of the TCB is used to record whether the
1173 * stack and/or TCB were allocated statically or dynamically, so when a task is
1174 * deleted the RAM that was allocated dynamically is freed again and no attempt is
1175 * made to free the RAM that was allocated statically.
1176 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1177 * task to be created using either statically or dynamically allocated RAM. Note
1178 * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1179 * a statically allocated stack and a dynamically allocated TCB.
1181 * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1182 * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1183 * when it is possible to have both static and dynamic allocation:
1184 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1185 * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
1186 * | | | | | | Static Possible | |
1187 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1188 * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
1189 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1190 * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
1191 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1192 * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1193 * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
1194 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1195 * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
1196 * | | | | xTaskCreateRestrictedStatic | | | |
1197 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1198 * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1199 * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
1200 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1201 * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1202 * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
1203 * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
1204 * | | | | xTaskCreateRestrictedStatic | | | |
1205 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1207 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
1208 ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1209 ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1212 * In line with software engineering best practice, FreeRTOS implements a strict
1213 * data hiding policy, so the real structures used by FreeRTOS to maintain the
1214 * state of tasks, queues, semaphores, etc. are not accessible to the application
1215 * code. However, if the application writer wants to statically allocate such
1216 * an object then the size of the object needs to be known. Dummy structures
1217 * that are guaranteed to have the same size and alignment requirements of the
1218 * real objects are used for this purpose. The dummy list and list item
1219 * structures below are used for inclusion in such a dummy structure.
1221 struct xSTATIC_LIST_ITEM
1223 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1227 void * pvDummy3[ 4 ];
1228 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1232 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1234 #if ( configUSE_MINI_LIST_ITEM == 1 )
1235 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1236 struct xSTATIC_MINI_LIST_ITEM
1238 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1242 void * pvDummy3[ 2 ];
1244 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1245 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1246 typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
1247 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1249 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1250 typedef struct xSTATIC_LIST
1252 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1255 UBaseType_t uxDummy2;
1257 StaticMiniListItem_t xDummy4;
1258 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1264 * In line with software engineering best practice, especially when supplying a
1265 * library that is likely to change in future versions, FreeRTOS implements a
1266 * strict data hiding policy. This means the Task structure used internally by
1267 * FreeRTOS is not accessible to application code. However, if the application
1268 * writer wants to statically allocate the memory required to create a task then
1269 * the size of the task object needs to be known. The StaticTask_t structure
1270 * below is provided for this purpose. Its sizes and alignment requirements are
1271 * guaranteed to match those of the genuine structure, no matter which
1272 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1273 * are set. Its contents are somewhat obfuscated in the hope users will
1274 * recognise that it would be unwise to make direct use of the structure members.
1276 typedef struct xSTATIC_TCB
1279 #if ( portUSING_MPU_WRAPPERS == 1 )
1280 xMPU_SETTINGS xDummy2;
1282 StaticListItem_t xDummy3[ 2 ];
1283 UBaseType_t uxDummy5;
1285 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1286 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1289 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1290 UBaseType_t uxDummy9;
1292 #if ( configUSE_TRACE_FACILITY == 1 )
1293 UBaseType_t uxDummy10[ 2 ];
1295 #if ( configUSE_MUTEXES == 1 )
1296 UBaseType_t uxDummy12[ 2 ];
1298 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1301 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1302 void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1304 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1305 configRUN_TIME_COUNTER_TYPE ulDummy16;
1307 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
1308 configTLS_BLOCK_TYPE xDummy17;
1310 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1311 uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1312 uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1314 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1318 #if ( INCLUDE_xTaskAbortDelay == 1 )
1321 #if ( configUSE_POSIX_ERRNO == 1 )
1327 * In line with software engineering best practice, especially when supplying a
1328 * library that is likely to change in future versions, FreeRTOS implements a
1329 * strict data hiding policy. This means the Queue structure used internally by
1330 * FreeRTOS is not accessible to application code. However, if the application
1331 * writer wants to statically allocate the memory required to create a queue
1332 * then the size of the queue object needs to be known. The StaticQueue_t
1333 * structure below is provided for this purpose. Its sizes and alignment
1334 * requirements are guaranteed to match those of the genuine structure, no
1335 * matter which architecture is being used, and no matter how the values in
1336 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
1337 * users will recognise that it would be unwise to make direct use of the
1338 * structure members.
1340 typedef struct xSTATIC_QUEUE
1342 void * pvDummy1[ 3 ];
1347 UBaseType_t uxDummy2;
1350 StaticList_t xDummy3[ 2 ];
1351 UBaseType_t uxDummy4[ 3 ];
1352 uint8_t ucDummy5[ 2 ];
1354 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1358 #if ( configUSE_QUEUE_SETS == 1 )
1362 #if ( configUSE_TRACE_FACILITY == 1 )
1363 UBaseType_t uxDummy8;
1367 typedef StaticQueue_t StaticSemaphore_t;
1370 * In line with software engineering best practice, especially when supplying a
1371 * library that is likely to change in future versions, FreeRTOS implements a
1372 * strict data hiding policy. This means the event group structure used
1373 * internally by FreeRTOS is not accessible to application code. However, if
1374 * the application writer wants to statically allocate the memory required to
1375 * create an event group then the size of the event group object needs to be
1376 * know. The StaticEventGroup_t structure below is provided for this purpose.
1377 * Its sizes and alignment requirements are guaranteed to match those of the
1378 * genuine structure, no matter which architecture is being used, and no matter
1379 * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1380 * obfuscated in the hope users will recognise that it would be unwise to make
1381 * direct use of the structure members.
1383 typedef struct xSTATIC_EVENT_GROUP
1386 StaticList_t xDummy2;
1388 #if ( configUSE_TRACE_FACILITY == 1 )
1389 UBaseType_t uxDummy3;
1392 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1395 } StaticEventGroup_t;
1398 * In line with software engineering best practice, especially when supplying a
1399 * library that is likely to change in future versions, FreeRTOS implements a
1400 * strict data hiding policy. This means the software timer structure used
1401 * internally by FreeRTOS is not accessible to application code. However, if
1402 * the application writer wants to statically allocate the memory required to
1403 * create a software timer then the size of the queue object needs to be known.
1404 * The StaticTimer_t structure below is provided for this purpose. Its sizes
1405 * and alignment requirements are guaranteed to match those of the genuine
1406 * structure, no matter which architecture is being used, and no matter how the
1407 * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1408 * the hope users will recognise that it would be unwise to make direct use of
1409 * the structure members.
1411 typedef struct xSTATIC_TIMER
1414 StaticListItem_t xDummy2;
1417 TaskFunction_t pvDummy6;
1418 #if ( configUSE_TRACE_FACILITY == 1 )
1419 UBaseType_t uxDummy7;
1425 * In line with software engineering best practice, especially when supplying a
1426 * library that is likely to change in future versions, FreeRTOS implements a
1427 * strict data hiding policy. This means the stream buffer structure used
1428 * internally by FreeRTOS is not accessible to application code. However, if
1429 * the application writer wants to statically allocate the memory required to
1430 * create a stream buffer then the size of the stream buffer object needs to be
1431 * known. The StaticStreamBuffer_t structure below is provided for this
1432 * purpose. Its size and alignment requirements are guaranteed to match those
1433 * of the genuine structure, no matter which architecture is being used, and
1434 * no matter how the values in FreeRTOSConfig.h are set. Its contents are
1435 * somewhat obfuscated in the hope users will recognise that it would be unwise
1436 * to make direct use of the structure members.
1438 typedef struct xSTATIC_STREAM_BUFFER
1440 size_t uxDummy1[ 4 ];
1441 void * pvDummy2[ 3 ];
1443 #if ( configUSE_TRACE_FACILITY == 1 )
1444 UBaseType_t uxDummy4;
1446 #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1447 void * pvDummy5[ 2 ];
1449 } StaticStreamBuffer_t;
1451 /* Message buffers are built on stream buffers. */
1452 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1460 #endif /* INC_FREERTOS_H */