2 * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
29 #ifndef INC_FREERTOS_H
30 #define INC_FREERTOS_H
33 * Include the generic headers required for the FreeRTOS port being used.
38 * If stdint.h cannot be located then:
39 * + If using GCC ensure the -nostdint options is *not* being used.
40 * + Ensure the project's include path includes the directory in which your
41 * compiler stores stdint.h.
42 * + Set any compiler options necessary for it to support C99, as technically
43 * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
45 * + The FreeRTOS download includes a simple stdint.h definition that can be
46 * used in cases where none is provided by the compiler. The files only
47 * contains the typedefs required to build FreeRTOS. Read the instructions
48 * in FreeRTOS/source/stdint.readme for more information.
50 #include <stdint.h> /* READ COMMENT ABOVE. */
58 /* Acceptable values for configTICK_TYPE_WIDTH_IN_BITS. */
59 #define TICK_TYPE_WIDTH_16_BITS 0
60 #define TICK_TYPE_WIDTH_32_BITS 1
61 #define TICK_TYPE_WIDTH_64_BITS 2
63 /* Application specific configuration options. */
64 #include "FreeRTOSConfig.h"
66 #if !defined( configUSE_16_BIT_TICKS ) && !defined( configTICK_TYPE_WIDTH_IN_BITS )
67 #error Missing definition: One of configUSE_16_BIT_TICKS and configTICK_TYPE_WIDTH_IN_BITS must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
70 #if defined( configUSE_16_BIT_TICKS ) && defined( configTICK_TYPE_WIDTH_IN_BITS )
71 #error Only one of configUSE_16_BIT_TICKS and configTICK_TYPE_WIDTH_IN_BITS must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
74 /* Define configTICK_TYPE_WIDTH_IN_BITS according to the
75 * value of configUSE_16_BIT_TICKS for backward compatibility. */
76 #ifndef configTICK_TYPE_WIDTH_IN_BITS
77 #if ( configUSE_16_BIT_TICKS == 1 )
78 #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_16_BITS
80 #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
84 /* Basic FreeRTOS definitions. */
87 /* Definitions specific to the port being used. */
90 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
91 #ifndef configUSE_NEWLIB_REENTRANT
92 #define configUSE_NEWLIB_REENTRANT 0
95 /* Required if struct _reent is used. */
96 #if ( configUSE_NEWLIB_REENTRANT == 1 )
98 /* Note Newlib support has been included by popular demand, but is not
99 * used by the FreeRTOS maintainers themselves. FreeRTOS is not
100 * responsible for resulting newlib operation. User must be familiar with
101 * newlib and must provide system-wide implementations of the necessary
102 * stubs. Be warned that (at the time of writing) the current newlib design
103 * implements a system-wide malloc() that must be provided with locks.
105 * See the third party link http://www.nadler.com/embedded/newlibAndFreeRTOS.html
106 * for additional information. */
109 #define configUSE_C_RUNTIME_TLS_SUPPORT 1
111 #ifndef configTLS_BLOCK_TYPE
112 #define configTLS_BLOCK_TYPE struct _reent
115 #ifndef configINIT_TLS_BLOCK
116 #define configINIT_TLS_BLOCK( xTLSBlock ) _REENT_INIT_PTR( &( xTLSBlock ) )
119 #ifndef configSET_TLS_BLOCK
120 #define configSET_TLS_BLOCK( xTLSBlock ) ( _impure_ptr = &( xTLSBlock ) )
123 #ifndef configDEINIT_TLS_BLOCK
124 #define configDEINIT_TLS_BLOCK( xTLSBlock ) _reclaim_reent( &( xTLSBlock ) )
126 #endif /* if ( configUSE_NEWLIB_REENTRANT == 1 ) */
128 #ifndef configUSE_C_RUNTIME_TLS_SUPPORT
129 #define configUSE_C_RUNTIME_TLS_SUPPORT 0
132 #if ( ( configUSE_NEWLIB_REENTRANT == 0 ) && ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) )
134 #ifndef configTLS_BLOCK_TYPE
135 #error Missing definition: configTLS_BLOCK_TYPE must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
138 #ifndef configINIT_TLS_BLOCK
139 #error Missing definition: configINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
142 #ifndef configSET_TLS_BLOCK
143 #error Missing definition: configSET_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
146 #ifndef configDEINIT_TLS_BLOCK
147 #error Missing definition: configDEINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
149 #endif /* if ( ( configUSE_NEWLIB_REENTRANT == 0 ) && ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) ) */
152 * Check all the required application specific macros have been defined.
153 * These macros are application specific and (as downloaded) are defined
154 * within FreeRTOSConfig.h.
157 #ifndef configMINIMAL_STACK_SIZE
158 #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.
161 #ifndef configMAX_PRIORITIES
162 #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
165 #if configMAX_PRIORITIES < 1
166 #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
169 #ifndef configUSE_PREEMPTION
170 #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.
173 #ifndef configUSE_IDLE_HOOK
174 #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.
177 #ifndef configUSE_TICK_HOOK
178 #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.
181 #if ( ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_16_BITS ) && \
182 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_32_BITS ) && \
183 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_64_BITS ) )
184 #error Macro configTICK_TYPE_WIDTH_IN_BITS is defined to incorrect value. See the Configuration section of the FreeRTOS API documentation for details.
187 #ifndef INCLUDE_vTaskPrioritySet
188 #define INCLUDE_vTaskPrioritySet 0
191 #ifndef INCLUDE_uxTaskPriorityGet
192 #define INCLUDE_uxTaskPriorityGet 0
195 #ifndef INCLUDE_vTaskDelete
196 #define INCLUDE_vTaskDelete 0
199 #ifndef INCLUDE_vTaskSuspend
200 #define INCLUDE_vTaskSuspend 0
203 #ifdef INCLUDE_xTaskDelayUntil
204 #ifdef INCLUDE_vTaskDelayUntil
206 /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
207 * compatibility is maintained if only one or the other is defined, but
208 * there is a conflict if both are defined. */
209 #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
213 #ifndef INCLUDE_xTaskDelayUntil
214 #ifdef INCLUDE_vTaskDelayUntil
216 /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
217 * the project's FreeRTOSConfig.h probably pre-dates the introduction of
218 * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
219 * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
221 #define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil
225 #ifndef INCLUDE_xTaskDelayUntil
226 #define INCLUDE_xTaskDelayUntil 0
229 #ifndef INCLUDE_vTaskDelay
230 #define INCLUDE_vTaskDelay 0
233 #ifndef INCLUDE_xTaskGetIdleTaskHandle
234 #define INCLUDE_xTaskGetIdleTaskHandle 0
237 #ifndef INCLUDE_xTaskAbortDelay
238 #define INCLUDE_xTaskAbortDelay 0
241 #ifndef INCLUDE_xQueueGetMutexHolder
242 #define INCLUDE_xQueueGetMutexHolder 0
245 #ifndef INCLUDE_xSemaphoreGetMutexHolder
246 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
249 #ifndef INCLUDE_xTaskGetHandle
250 #define INCLUDE_xTaskGetHandle 0
253 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
254 #define INCLUDE_uxTaskGetStackHighWaterMark 0
257 #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
258 #define INCLUDE_uxTaskGetStackHighWaterMark2 0
261 #ifndef INCLUDE_eTaskGetState
262 #define INCLUDE_eTaskGetState 0
265 #ifndef INCLUDE_xTaskResumeFromISR
266 #define INCLUDE_xTaskResumeFromISR 1
269 #ifndef INCLUDE_xTimerPendFunctionCall
270 #define INCLUDE_xTimerPendFunctionCall 0
273 #ifndef INCLUDE_xTaskGetSchedulerState
274 #define INCLUDE_xTaskGetSchedulerState 0
277 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
278 #define INCLUDE_xTaskGetCurrentTaskHandle 1
281 #if ( defined( configUSE_CO_ROUTINES ) && configUSE_CO_ROUTINES != 0 )
282 #warning Co-routines have been removed from FreeRTOS-Kernel versions released after V10.5.1. You can view previous versions of the FreeRTOS Kernel at github.com/freertos/freertos-kernel/tree/V10.5.1 .
285 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
286 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
289 #ifndef configUSE_APPLICATION_TASK_TAG
290 #define configUSE_APPLICATION_TASK_TAG 0
293 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
294 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
297 #ifndef configUSE_RECURSIVE_MUTEXES
298 #define configUSE_RECURSIVE_MUTEXES 0
301 #ifndef configUSE_MUTEXES
302 #define configUSE_MUTEXES 0
305 #ifndef configUSE_TIMERS
306 #define configUSE_TIMERS 0
309 #ifndef configUSE_COUNTING_SEMAPHORES
310 #define configUSE_COUNTING_SEMAPHORES 0
313 #ifndef configUSE_ALTERNATIVE_API
314 #define configUSE_ALTERNATIVE_API 0
317 #ifndef portCRITICAL_NESTING_IN_TCB
318 #define portCRITICAL_NESTING_IN_TCB 0
321 #ifndef configMAX_TASK_NAME_LEN
322 #define configMAX_TASK_NAME_LEN 16
325 #ifndef configIDLE_SHOULD_YIELD
326 #define configIDLE_SHOULD_YIELD 1
329 #if configMAX_TASK_NAME_LEN < 1
330 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
334 #define configASSERT( x )
335 #define configASSERT_DEFINED 0
337 #define configASSERT_DEFINED 1
340 /* configPRECONDITION should be defined as configASSERT.
341 * The CBMC proofs need a way to track assumptions and assertions.
342 * A configPRECONDITION statement should express an implicit invariant or
343 * assumption made. A configASSERT statement should express an invariant that must
344 * hold explicit before calling the code. */
345 #ifndef configPRECONDITION
346 #define configPRECONDITION( X ) configASSERT( X )
347 #define configPRECONDITION_DEFINED 0
349 #define configPRECONDITION_DEFINED 1
352 #ifndef portMEMORY_BARRIER
353 #define portMEMORY_BARRIER()
356 #ifndef portSOFTWARE_BARRIER
357 #define portSOFTWARE_BARRIER()
360 /* The timers module relies on xTaskGetSchedulerState(). */
361 #if configUSE_TIMERS == 1
363 #ifndef configTIMER_TASK_PRIORITY
364 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
365 #endif /* configTIMER_TASK_PRIORITY */
367 #ifndef configTIMER_QUEUE_LENGTH
368 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
369 #endif /* configTIMER_QUEUE_LENGTH */
371 #ifndef configTIMER_TASK_STACK_DEPTH
372 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
373 #endif /* configTIMER_TASK_STACK_DEPTH */
375 #endif /* configUSE_TIMERS */
377 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
378 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
381 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
382 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
385 #ifndef portCLEAN_UP_TCB
386 #define portCLEAN_UP_TCB( pxTCB ) ( void ) ( pxTCB )
389 #ifndef portPRE_TASK_DELETE_HOOK
390 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
393 #ifndef portSETUP_TCB
394 #define portSETUP_TCB( pxTCB ) ( void ) ( pxTCB )
397 #ifndef configQUEUE_REGISTRY_SIZE
398 #define configQUEUE_REGISTRY_SIZE 0U
401 #if ( configQUEUE_REGISTRY_SIZE < 1 )
402 #define vQueueAddToRegistry( xQueue, pcName )
403 #define vQueueUnregisterQueue( xQueue )
404 #define pcQueueGetName( xQueue )
407 #ifndef configUSE_MINI_LIST_ITEM
408 #define configUSE_MINI_LIST_ITEM 1
411 #ifndef portPOINTER_SIZE_TYPE
412 #define portPOINTER_SIZE_TYPE uint32_t
415 /* Remove any unused trace macros. */
418 /* Used to perform any necessary initialisation - for example, open a file
419 * into which trace is to be written. */
425 /* Use to close a trace, for example close a file into which trace has been
430 #ifndef traceTASK_SWITCHED_IN
432 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
433 * to the task control block of the selected task. */
434 #define traceTASK_SWITCHED_IN()
437 #ifndef traceINCREASE_TICK_COUNT
439 /* Called before stepping the tick count after waking from tickless idle
441 #define traceINCREASE_TICK_COUNT( x )
444 #ifndef traceLOW_POWER_IDLE_BEGIN
445 /* Called immediately before entering tickless idle. */
446 #define traceLOW_POWER_IDLE_BEGIN()
449 #ifndef traceLOW_POWER_IDLE_END
450 /* Called when returning to the Idle task after a tickless idle. */
451 #define traceLOW_POWER_IDLE_END()
454 #ifndef traceTASK_SWITCHED_OUT
456 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
457 * to the task control block of the task being switched out. */
458 #define traceTASK_SWITCHED_OUT()
461 #ifndef traceTASK_PRIORITY_INHERIT
463 /* Called when a task attempts to take a mutex that is already held by a
464 * lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
465 * that holds the mutex. uxInheritedPriority is the priority the mutex holder
466 * will inherit (the priority of the task that is attempting to obtain the
468 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
471 #ifndef traceTASK_PRIORITY_DISINHERIT
473 /* Called when a task releases a mutex, the holding of which had resulted in
474 * the task inheriting the priority of a higher priority task.
475 * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
476 * mutex. uxOriginalPriority is the task's configured (base) priority. */
477 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
480 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
482 /* Task is about to block because it cannot read from a
483 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
484 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
485 * task that attempted the read. */
486 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
489 #ifndef traceBLOCKING_ON_QUEUE_PEEK
491 /* Task is about to block because it cannot read from a
492 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
493 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
494 * task that attempted the read. */
495 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
498 #ifndef traceBLOCKING_ON_QUEUE_SEND
500 /* Task is about to block because it cannot write to a
501 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
502 * upon which the write was attempted. pxCurrentTCB points to the TCB of the
503 * task that attempted the write. */
504 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
507 #ifndef configCHECK_FOR_STACK_OVERFLOW
508 #define configCHECK_FOR_STACK_OVERFLOW 0
511 #ifndef configRECORD_STACK_HIGH_ADDRESS
512 #define configRECORD_STACK_HIGH_ADDRESS 0
515 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
516 #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
519 /* The following event macros are embedded in the kernel API calls. */
521 #ifndef traceMOVED_TASK_TO_READY_STATE
522 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
525 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
526 #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
529 #ifndef traceQUEUE_CREATE
530 #define traceQUEUE_CREATE( pxNewQueue )
533 #ifndef traceQUEUE_CREATE_FAILED
534 #define traceQUEUE_CREATE_FAILED( ucQueueType )
537 #ifndef traceCREATE_MUTEX
538 #define traceCREATE_MUTEX( pxNewQueue )
541 #ifndef traceCREATE_MUTEX_FAILED
542 #define traceCREATE_MUTEX_FAILED()
545 #ifndef traceGIVE_MUTEX_RECURSIVE
546 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
549 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
550 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
553 #ifndef traceTAKE_MUTEX_RECURSIVE
554 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
557 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
558 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
561 #ifndef traceCREATE_COUNTING_SEMAPHORE
562 #define traceCREATE_COUNTING_SEMAPHORE()
565 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
566 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
569 #ifndef traceQUEUE_SET_SEND
570 #define traceQUEUE_SET_SEND traceQUEUE_SEND
573 #ifndef traceQUEUE_SEND
574 #define traceQUEUE_SEND( pxQueue )
577 #ifndef traceQUEUE_SEND_FAILED
578 #define traceQUEUE_SEND_FAILED( pxQueue )
581 #ifndef traceQUEUE_RECEIVE
582 #define traceQUEUE_RECEIVE( pxQueue )
585 #ifndef traceQUEUE_PEEK
586 #define traceQUEUE_PEEK( pxQueue )
589 #ifndef traceQUEUE_PEEK_FAILED
590 #define traceQUEUE_PEEK_FAILED( pxQueue )
593 #ifndef traceQUEUE_PEEK_FROM_ISR
594 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
597 #ifndef traceQUEUE_RECEIVE_FAILED
598 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
601 #ifndef traceQUEUE_SEND_FROM_ISR
602 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
605 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
606 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
609 #ifndef traceQUEUE_RECEIVE_FROM_ISR
610 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
613 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
614 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
617 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
618 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
621 #ifndef traceQUEUE_DELETE
622 #define traceQUEUE_DELETE( pxQueue )
625 #ifndef traceTASK_CREATE
626 #define traceTASK_CREATE( pxNewTCB )
629 #ifndef traceTASK_CREATE_FAILED
630 #define traceTASK_CREATE_FAILED()
633 #ifndef traceTASK_DELETE
634 #define traceTASK_DELETE( pxTaskToDelete )
637 #ifndef traceTASK_DELAY_UNTIL
638 #define traceTASK_DELAY_UNTIL( x )
641 #ifndef traceTASK_DELAY
642 #define traceTASK_DELAY()
645 #ifndef traceTASK_PRIORITY_SET
646 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
649 #ifndef traceTASK_SUSPEND
650 #define traceTASK_SUSPEND( pxTaskToSuspend )
653 #ifndef traceTASK_RESUME
654 #define traceTASK_RESUME( pxTaskToResume )
657 #ifndef traceTASK_RESUME_FROM_ISR
658 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
661 #ifndef traceTASK_INCREMENT_TICK
662 #define traceTASK_INCREMENT_TICK( xTickCount )
665 #ifndef traceTIMER_CREATE
666 #define traceTIMER_CREATE( pxNewTimer )
669 #ifndef traceTIMER_CREATE_FAILED
670 #define traceTIMER_CREATE_FAILED()
673 #ifndef traceTIMER_COMMAND_SEND
674 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
677 #ifndef traceTIMER_EXPIRED
678 #define traceTIMER_EXPIRED( pxTimer )
681 #ifndef traceTIMER_COMMAND_RECEIVED
682 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
686 #define traceMALLOC( pvAddress, uiSize )
690 #define traceFREE( pvAddress, uiSize )
693 #ifndef traceEVENT_GROUP_CREATE
694 #define traceEVENT_GROUP_CREATE( xEventGroup )
697 #ifndef traceEVENT_GROUP_CREATE_FAILED
698 #define traceEVENT_GROUP_CREATE_FAILED()
701 #ifndef traceEVENT_GROUP_SYNC_BLOCK
702 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
705 #ifndef traceEVENT_GROUP_SYNC_END
706 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
709 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
710 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
713 #ifndef traceEVENT_GROUP_WAIT_BITS_END
714 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
717 #ifndef traceEVENT_GROUP_CLEAR_BITS
718 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
721 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
722 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
725 #ifndef traceEVENT_GROUP_SET_BITS
726 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
729 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
730 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
733 #ifndef traceEVENT_GROUP_DELETE
734 #define traceEVENT_GROUP_DELETE( xEventGroup )
737 #ifndef tracePEND_FUNC_CALL
738 #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
741 #ifndef tracePEND_FUNC_CALL_FROM_ISR
742 #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
745 #ifndef traceQUEUE_REGISTRY_ADD
746 #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
749 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
750 #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
753 #ifndef traceTASK_NOTIFY_TAKE
754 #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
757 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
758 #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
761 #ifndef traceTASK_NOTIFY_WAIT
762 #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
765 #ifndef traceTASK_NOTIFY
766 #define traceTASK_NOTIFY( uxIndexToNotify )
769 #ifndef traceTASK_NOTIFY_FROM_ISR
770 #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
773 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
774 #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
777 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
778 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
781 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
782 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
785 #ifndef traceSTREAM_BUFFER_CREATE
786 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
789 #ifndef traceSTREAM_BUFFER_DELETE
790 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
793 #ifndef traceSTREAM_BUFFER_RESET
794 #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
797 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
798 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
801 #ifndef traceSTREAM_BUFFER_SEND
802 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
805 #ifndef traceSTREAM_BUFFER_SEND_FAILED
806 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
809 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
810 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
813 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
814 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
817 #ifndef traceSTREAM_BUFFER_RECEIVE
818 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
821 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
822 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
825 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
826 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
829 #ifndef configGENERATE_RUN_TIME_STATS
830 #define configGENERATE_RUN_TIME_STATS 0
833 #if ( configGENERATE_RUN_TIME_STATS == 1 )
835 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
836 #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.
837 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
839 #ifndef portGET_RUN_TIME_COUNTER_VALUE
840 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
841 #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.
842 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
843 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
845 #endif /* configGENERATE_RUN_TIME_STATS */
847 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
848 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
851 #ifndef configUSE_MALLOC_FAILED_HOOK
852 #define configUSE_MALLOC_FAILED_HOOK 0
855 #ifndef portPRIVILEGE_BIT
856 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
859 #ifndef portYIELD_WITHIN_API
860 #define portYIELD_WITHIN_API portYIELD
863 #ifndef portSUPPRESS_TICKS_AND_SLEEP
864 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
867 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
868 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
871 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
872 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
875 #ifndef configUSE_TICKLESS_IDLE
876 #define configUSE_TICKLESS_IDLE 0
879 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
880 #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
883 #ifndef configPRE_SLEEP_PROCESSING
884 #define configPRE_SLEEP_PROCESSING( x )
887 #ifndef configPOST_SLEEP_PROCESSING
888 #define configPOST_SLEEP_PROCESSING( x )
891 #ifndef configUSE_QUEUE_SETS
892 #define configUSE_QUEUE_SETS 0
895 #ifndef portTASK_USES_FLOATING_POINT
896 #define portTASK_USES_FLOATING_POINT()
899 #ifndef portALLOCATE_SECURE_CONTEXT
900 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
903 #ifndef portDONT_DISCARD
904 #define portDONT_DISCARD
907 #ifndef configUSE_TIME_SLICING
908 #define configUSE_TIME_SLICING 1
911 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
912 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
915 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
916 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
919 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
920 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
923 #ifndef configUSE_TRACE_FACILITY
924 #define configUSE_TRACE_FACILITY 0
927 #ifndef mtCOVERAGE_TEST_MARKER
928 #define mtCOVERAGE_TEST_MARKER()
931 #ifndef mtCOVERAGE_TEST_DELAY
932 #define mtCOVERAGE_TEST_DELAY()
935 #ifndef portASSERT_IF_IN_ISR
936 #define portASSERT_IF_IN_ISR()
939 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
940 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
943 #ifndef configAPPLICATION_ALLOCATED_HEAP
944 #define configAPPLICATION_ALLOCATED_HEAP 0
947 #ifndef configUSE_TASK_NOTIFICATIONS
948 #define configUSE_TASK_NOTIFICATIONS 1
951 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
952 #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
955 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
956 #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
959 #ifndef configUSE_POSIX_ERRNO
960 #define configUSE_POSIX_ERRNO 0
963 #ifndef configUSE_SB_COMPLETED_CALLBACK
965 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
966 #define configUSE_SB_COMPLETED_CALLBACK 0
969 #ifndef portTICK_TYPE_IS_ATOMIC
970 #define portTICK_TYPE_IS_ATOMIC 0
973 #ifndef configSUPPORT_STATIC_ALLOCATION
974 /* Defaults to 0 for backward compatibility. */
975 #define configSUPPORT_STATIC_ALLOCATION 0
978 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
979 /* Defaults to 1 for backward compatibility. */
980 #define configSUPPORT_DYNAMIC_ALLOCATION 1
983 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
984 #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
987 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
988 #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
989 #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.
993 #ifndef configSTACK_DEPTH_TYPE
995 /* Defaults to uint16_t for backward compatibility, but can be overridden
996 * in FreeRTOSConfig.h if uint16_t is too restrictive. */
997 #define configSTACK_DEPTH_TYPE uint16_t
1000 #ifndef configRUN_TIME_COUNTER_TYPE
1002 /* Defaults to uint32_t for backward compatibility, but can be overridden in
1003 * FreeRTOSConfig.h if uint32_t is too restrictive. */
1005 #define configRUN_TIME_COUNTER_TYPE uint32_t
1008 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
1010 /* Defaults to size_t for backward compatibility, but can be overridden
1011 * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1013 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
1016 /* Sanity check the configuration. */
1017 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1018 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1021 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1022 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1025 #ifndef configINITIAL_TICK_COUNT
1026 #define configINITIAL_TICK_COUNT 0
1029 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1031 /* Either variables of tick type cannot be read atomically, or
1032 * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1033 * the tick count is returned to the standard critical section macros. */
1034 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
1035 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
1036 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
1037 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1040 /* The tick type can be read atomically, so critical sections used when the
1041 * tick count is returned can be defined away. */
1042 #define portTICK_TYPE_ENTER_CRITICAL()
1043 #define portTICK_TYPE_EXIT_CRITICAL()
1044 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
1045 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) ( x )
1046 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1048 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1050 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1051 #define configENABLE_BACKWARD_COMPATIBILITY 1
1054 #ifndef configPRINTF
1056 /* configPRINTF() was not defined, so define it away to nothing. To use
1057 * configPRINTF() then define it as follows (where MyPrintFunction() is
1058 * provided by the application writer):
1060 * void MyPrintFunction(const char *pcFormat, ... );
1061 #define configPRINTF( X ) MyPrintFunction X
1063 * Then call like a standard printf() function, but placing brackets around
1064 * all parameters so they are passed as a single parameter. For example:
1065 * configPRINTF( ("Value = %d", MyVariable) ); */
1066 #define configPRINTF( X )
1071 /* The application writer has not provided their own MAX macro, so define
1072 * the following generic implementation. */
1073 #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1078 /* The application writer has not provided their own MIN macro, so define
1079 * the following generic implementation. */
1080 #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1083 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1084 #define eTaskStateGet eTaskGetState
1085 #define portTickType TickType_t
1086 #define xTaskHandle TaskHandle_t
1087 #define xQueueHandle QueueHandle_t
1088 #define xSemaphoreHandle SemaphoreHandle_t
1089 #define xQueueSetHandle QueueSetHandle_t
1090 #define xQueueSetMemberHandle QueueSetMemberHandle_t
1091 #define xTimeOutType TimeOut_t
1092 #define xMemoryRegion MemoryRegion_t
1093 #define xTaskParameters TaskParameters_t
1094 #define xTaskStatusType TaskStatus_t
1095 #define xTimerHandle TimerHandle_t
1096 #define pdTASK_HOOK_CODE TaskHookFunction_t
1097 #define portTICK_RATE_MS portTICK_PERIOD_MS
1098 #define pcTaskGetTaskName pcTaskGetName
1099 #define pcTimerGetTimerName pcTimerGetName
1100 #define pcQueueGetQueueName pcQueueGetName
1101 #define vTaskGetTaskInfo vTaskGetInfo
1102 #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
1104 /* Backward compatibility within the scheduler code only - these definitions
1105 * are not really required but are included for completeness. */
1106 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
1107 #define pdTASK_CODE TaskFunction_t
1108 #define xListItem ListItem_t
1109 #define xList List_t
1111 /* For libraries that break the list data hiding, and access list structure
1112 * members directly (which is not supposed to be done). */
1113 #define pxContainer pvContainer
1114 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1116 #if ( configUSE_ALTERNATIVE_API != 0 )
1117 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1120 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1121 * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1122 * This constant is not supported by all FreeRTOS ports that include floating
1124 #ifndef configUSE_TASK_FPU_SUPPORT
1125 #define configUSE_TASK_FPU_SUPPORT 1
1128 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1129 * currently used in ARMv8M ports. */
1130 #ifndef configENABLE_MPU
1131 #define configENABLE_MPU 0
1134 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1135 * currently used in ARMv8M ports. */
1136 #ifndef configENABLE_FPU
1137 #define configENABLE_FPU 1
1140 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1141 * currently used in ARMv8M ports. */
1142 #ifndef configENABLE_MVE
1143 #define configENABLE_MVE 0
1146 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1147 * This is currently used in ARMv8M ports. */
1148 #ifndef configENABLE_TRUSTZONE
1149 #define configENABLE_TRUSTZONE 1
1152 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1153 * the Secure Side only. */
1154 #ifndef configRUN_FREERTOS_SECURE_ONLY
1155 #define configRUN_FREERTOS_SECURE_ONLY 0
1158 #ifndef configRUN_ADDITIONAL_TESTS
1159 #define configRUN_ADDITIONAL_TESTS 0
1163 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1164 * dynamically allocated RAM, in which case when any task is deleted it is known
1165 * that both the task's stack and TCB need to be freed. Sometimes the
1166 * FreeRTOSConfig.h settings only allow a task to be created using statically
1167 * allocated RAM, in which case when any task is deleted it is known that neither
1168 * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
1169 * settings allow a task to be created using either statically or dynamically
1170 * allocated RAM, in which case a member of the TCB is used to record whether the
1171 * stack and/or TCB were allocated statically or dynamically, so when a task is
1172 * deleted the RAM that was allocated dynamically is freed again and no attempt is
1173 * made to free the RAM that was allocated statically.
1174 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1175 * task to be created using either statically or dynamically allocated RAM. Note
1176 * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1177 * a statically allocated stack and a dynamically allocated TCB.
1179 * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1180 * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1181 * when it is possible to have both static and dynamic allocation:
1182 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1183 * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
1184 * | | | | | | Static Possible | |
1185 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1186 * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
1187 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1188 * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
1189 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1190 * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1191 * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
1192 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1193 * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
1194 * | | | | xTaskCreateRestrictedStatic | | | |
1195 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1196 * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1197 * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
1198 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1199 * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1200 * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
1201 * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
1202 * | | | | xTaskCreateRestrictedStatic | | | |
1203 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1205 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
1206 ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1207 ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1210 * In line with software engineering best practice, FreeRTOS implements a strict
1211 * data hiding policy, so the real structures used by FreeRTOS to maintain the
1212 * state of tasks, queues, semaphores, etc. are not accessible to the application
1213 * code. However, if the application writer wants to statically allocate such
1214 * an object then the size of the object needs to be known. Dummy structures
1215 * that are guaranteed to have the same size and alignment requirements of the
1216 * real objects are used for this purpose. The dummy list and list item
1217 * structures below are used for inclusion in such a dummy structure.
1219 struct xSTATIC_LIST_ITEM
1221 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1225 void * pvDummy3[ 4 ];
1226 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1230 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1232 #if ( configUSE_MINI_LIST_ITEM == 1 )
1233 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1234 struct xSTATIC_MINI_LIST_ITEM
1236 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1240 void * pvDummy3[ 2 ];
1242 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1243 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1244 typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
1245 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1247 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1248 typedef struct xSTATIC_LIST
1250 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1253 UBaseType_t uxDummy2;
1255 StaticMiniListItem_t xDummy4;
1256 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1262 * In line with software engineering best practice, especially when supplying a
1263 * library that is likely to change in future versions, FreeRTOS implements a
1264 * strict data hiding policy. This means the Task structure used internally by
1265 * FreeRTOS is not accessible to application code. However, if the application
1266 * writer wants to statically allocate the memory required to create a task then
1267 * the size of the task object needs to be known. The StaticTask_t structure
1268 * below is provided for this purpose. Its sizes and alignment requirements are
1269 * guaranteed to match those of the genuine structure, no matter which
1270 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1271 * are set. Its contents are somewhat obfuscated in the hope users will
1272 * recognise that it would be unwise to make direct use of the structure members.
1274 typedef struct xSTATIC_TCB
1277 #if ( portUSING_MPU_WRAPPERS == 1 )
1278 xMPU_SETTINGS xDummy2;
1280 StaticListItem_t xDummy3[ 2 ];
1281 UBaseType_t uxDummy5;
1283 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1284 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1287 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1288 UBaseType_t uxDummy9;
1290 #if ( configUSE_TRACE_FACILITY == 1 )
1291 UBaseType_t uxDummy10[ 2 ];
1293 #if ( configUSE_MUTEXES == 1 )
1294 UBaseType_t uxDummy12[ 2 ];
1296 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1299 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1300 void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1302 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1303 configRUN_TIME_COUNTER_TYPE ulDummy16;
1305 #if ( ( configUSE_NEWLIB_REENTRANT == 1 ) || ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) )
1306 configTLS_BLOCK_TYPE xDummy17;
1308 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1309 uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1310 uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1312 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1316 #if ( INCLUDE_xTaskAbortDelay == 1 )
1319 #if ( configUSE_POSIX_ERRNO == 1 )
1325 * In line with software engineering best practice, especially when supplying a
1326 * library that is likely to change in future versions, FreeRTOS implements a
1327 * strict data hiding policy. This means the Queue structure used internally by
1328 * FreeRTOS is not accessible to application code. However, if the application
1329 * writer wants to statically allocate the memory required to create a queue
1330 * then the size of the queue object needs to be known. The StaticQueue_t
1331 * structure below is provided for this purpose. Its sizes and alignment
1332 * requirements are guaranteed to match those of the genuine structure, no
1333 * matter which architecture is being used, and no matter how the values in
1334 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
1335 * users will recognise that it would be unwise to make direct use of the
1336 * structure members.
1338 typedef struct xSTATIC_QUEUE
1340 void * pvDummy1[ 3 ];
1345 UBaseType_t uxDummy2;
1348 StaticList_t xDummy3[ 2 ];
1349 UBaseType_t uxDummy4[ 3 ];
1350 uint8_t ucDummy5[ 2 ];
1352 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1356 #if ( configUSE_QUEUE_SETS == 1 )
1360 #if ( configUSE_TRACE_FACILITY == 1 )
1361 UBaseType_t uxDummy8;
1365 typedef StaticQueue_t StaticSemaphore_t;
1368 * In line with software engineering best practice, especially when supplying a
1369 * library that is likely to change in future versions, FreeRTOS implements a
1370 * strict data hiding policy. This means the event group structure used
1371 * internally by FreeRTOS is not accessible to application code. However, if
1372 * the application writer wants to statically allocate the memory required to
1373 * create an event group then the size of the event group object needs to be
1374 * know. The StaticEventGroup_t structure below is provided for this purpose.
1375 * Its sizes and alignment requirements are guaranteed to match those of the
1376 * genuine structure, no matter which architecture is being used, and no matter
1377 * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1378 * obfuscated in the hope users will recognise that it would be unwise to make
1379 * direct use of the structure members.
1381 typedef struct xSTATIC_EVENT_GROUP
1384 StaticList_t xDummy2;
1386 #if ( configUSE_TRACE_FACILITY == 1 )
1387 UBaseType_t uxDummy3;
1390 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1393 } StaticEventGroup_t;
1396 * In line with software engineering best practice, especially when supplying a
1397 * library that is likely to change in future versions, FreeRTOS implements a
1398 * strict data hiding policy. This means the software timer structure used
1399 * internally by FreeRTOS is not accessible to application code. However, if
1400 * the application writer wants to statically allocate the memory required to
1401 * create a software timer then the size of the queue object needs to be known.
1402 * The StaticTimer_t structure below is provided for this purpose. Its sizes
1403 * and alignment requirements are guaranteed to match those of the genuine
1404 * structure, no matter which architecture is being used, and no matter how the
1405 * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1406 * the hope users will recognise that it would be unwise to make direct use of
1407 * the structure members.
1409 typedef struct xSTATIC_TIMER
1412 StaticListItem_t xDummy2;
1415 TaskFunction_t pvDummy6;
1416 #if ( configUSE_TRACE_FACILITY == 1 )
1417 UBaseType_t uxDummy7;
1423 * In line with software engineering best practice, especially when supplying a
1424 * library that is likely to change in future versions, FreeRTOS implements a
1425 * strict data hiding policy. This means the stream buffer structure used
1426 * internally by FreeRTOS is not accessible to application code. However, if
1427 * the application writer wants to statically allocate the memory required to
1428 * create a stream buffer then the size of the stream buffer object needs to be
1429 * known. The StaticStreamBuffer_t structure below is provided for this
1430 * purpose. Its size and alignment requirements are guaranteed to match those
1431 * of the genuine structure, no matter which architecture is being used, and
1432 * no matter how the values in FreeRTOSConfig.h are set. Its contents are
1433 * somewhat obfuscated in the hope users will recognise that it would be unwise
1434 * to make direct use of the structure members.
1436 typedef struct xSTATIC_STREAM_BUFFER
1438 size_t uxDummy1[ 4 ];
1439 void * pvDummy2[ 3 ];
1441 #if ( configUSE_TRACE_FACILITY == 1 )
1442 UBaseType_t uxDummy4;
1444 #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1445 void * pvDummy5[ 2 ];
1447 } StaticStreamBuffer_t;
1449 /* Message buffers are built on stream buffers. */
1450 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1458 #endif /* INC_FREERTOS_H */