2 * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
29 #ifndef INC_FREERTOS_H
30 #define INC_FREERTOS_H
33 * Include the generic headers required for the FreeRTOS port being used.
38 * If stdint.h cannot be located then:
39 * + If using GCC ensure the -nostdint options is *not* being used.
40 * + Ensure the project's include path includes the directory in which your
41 * compiler stores stdint.h.
42 * + Set any compiler options necessary for it to support C99, as technically
43 * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
45 * + The FreeRTOS download includes a simple stdint.h definition that can be
46 * used in cases where none is provided by the compiler. The files only
47 * contains the typedefs required to build FreeRTOS. Read the instructions
48 * in FreeRTOS/source/stdint.readme for more information.
50 #include <stdint.h> /* READ COMMENT ABOVE. */
58 /* Acceptable values for configTICK_TYPE_WIDTH_IN_BITS. */
59 #define TICK_TYPE_WIDTH_16_BITS 0
60 #define TICK_TYPE_WIDTH_32_BITS 1
61 #define TICK_TYPE_WIDTH_64_BITS 2
63 /* Application specific configuration options. */
64 #include "FreeRTOSConfig.h"
66 #if !defined( configUSE_16_BIT_TICKS ) && !defined( configTICK_TYPE_WIDTH_IN_BITS )
67 #error Missing definition: One of configUSE_16_BIT_TICKS and configTICK_TYPE_WIDTH_IN_BITS must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
70 #if defined( configUSE_16_BIT_TICKS ) && defined( configTICK_TYPE_WIDTH_IN_BITS )
71 #error Only one of configUSE_16_BIT_TICKS and configTICK_TYPE_WIDTH_IN_BITS must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
74 /* Define configTICK_TYPE_WIDTH_IN_BITS according to the
75 * value of configUSE_16_BIT_TICKS for backward compatibility. */
76 #ifndef configTICK_TYPE_WIDTH_IN_BITS
77 #if ( configUSE_16_BIT_TICKS == 1 )
78 #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_16_BITS
80 #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
84 /* Basic FreeRTOS definitions. */
87 /* Definitions specific to the port being used. */
90 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
91 #ifndef configUSE_NEWLIB_REENTRANT
92 #define configUSE_NEWLIB_REENTRANT 0
95 /* Required if struct _reent is used. */
96 #if ( configUSE_NEWLIB_REENTRANT == 1 )
98 #include "newlib-freertos.h"
100 #endif /* if ( configUSE_NEWLIB_REENTRANT == 1 ) */
102 /* Must be defaulted before configUSE_PICOLIBC_TLS is used below. */
103 #ifndef configUSE_PICOLIBC_TLS
104 #define configUSE_PICOLIBC_TLS 0
107 #if ( configUSE_PICOLIBC_TLS == 1 )
109 #include "picolibc-freertos.h"
111 #endif /* if ( configUSE_PICOLIBC_TLS == 1 ) */
113 #ifndef configUSE_C_RUNTIME_TLS_SUPPORT
114 #define configUSE_C_RUNTIME_TLS_SUPPORT 0
117 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
119 #ifndef configTLS_BLOCK_TYPE
120 #error Missing definition: configTLS_BLOCK_TYPE must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
123 #ifndef configINIT_TLS_BLOCK
124 #error Missing definition: configINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
127 #ifndef configSET_TLS_BLOCK
128 #error Missing definition: configSET_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
131 #ifndef configDEINIT_TLS_BLOCK
132 #error Missing definition: configDEINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
134 #endif /* if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) */
137 * Check all the required application specific macros have been defined.
138 * These macros are application specific and (as downloaded) are defined
139 * within FreeRTOSConfig.h.
142 #ifndef configMINIMAL_STACK_SIZE
143 #error Missing definition: configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h. configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task. Refer to the demo project provided for your port for a suitable value.
146 #ifndef configMAX_PRIORITIES
147 #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
150 #if configMAX_PRIORITIES < 1
151 #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
154 #ifndef configUSE_PREEMPTION
155 #error Missing definition: configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
158 #ifndef configUSE_IDLE_HOOK
159 #error Missing definition: configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
162 #ifndef configUSE_TICK_HOOK
163 #error Missing definition: configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
166 #if ( ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_16_BITS ) && \
167 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_32_BITS ) && \
168 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_64_BITS ) )
169 #error Macro configTICK_TYPE_WIDTH_IN_BITS is defined to incorrect value. See the Configuration section of the FreeRTOS API documentation for details.
172 #ifndef INCLUDE_vTaskPrioritySet
173 #define INCLUDE_vTaskPrioritySet 0
176 #ifndef INCLUDE_uxTaskPriorityGet
177 #define INCLUDE_uxTaskPriorityGet 0
180 #ifndef INCLUDE_vTaskDelete
181 #define INCLUDE_vTaskDelete 0
184 #ifndef INCLUDE_vTaskSuspend
185 #define INCLUDE_vTaskSuspend 0
188 #ifdef INCLUDE_xTaskDelayUntil
189 #ifdef INCLUDE_vTaskDelayUntil
191 /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
192 * compatibility is maintained if only one or the other is defined, but
193 * there is a conflict if both are defined. */
194 #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
198 #ifndef INCLUDE_xTaskDelayUntil
199 #ifdef INCLUDE_vTaskDelayUntil
201 /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
202 * the project's FreeRTOSConfig.h probably pre-dates the introduction of
203 * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
204 * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
206 #define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil
210 #ifndef INCLUDE_xTaskDelayUntil
211 #define INCLUDE_xTaskDelayUntil 0
214 #ifndef INCLUDE_vTaskDelay
215 #define INCLUDE_vTaskDelay 0
218 #ifndef INCLUDE_xTaskGetIdleTaskHandle
219 #define INCLUDE_xTaskGetIdleTaskHandle 0
222 #ifndef INCLUDE_xTaskAbortDelay
223 #define INCLUDE_xTaskAbortDelay 0
226 #ifndef INCLUDE_xQueueGetMutexHolder
227 #define INCLUDE_xQueueGetMutexHolder 0
230 #ifndef INCLUDE_xSemaphoreGetMutexHolder
231 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
234 #ifndef INCLUDE_xTaskGetHandle
235 #define INCLUDE_xTaskGetHandle 0
238 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
239 #define INCLUDE_uxTaskGetStackHighWaterMark 0
242 #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
243 #define INCLUDE_uxTaskGetStackHighWaterMark2 0
246 #ifndef INCLUDE_eTaskGetState
247 #define INCLUDE_eTaskGetState 0
250 #ifndef INCLUDE_xTaskResumeFromISR
251 #define INCLUDE_xTaskResumeFromISR 1
254 #ifndef INCLUDE_xTimerPendFunctionCall
255 #define INCLUDE_xTimerPendFunctionCall 0
258 #ifndef INCLUDE_xTaskGetSchedulerState
259 #define INCLUDE_xTaskGetSchedulerState 0
262 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
263 #define INCLUDE_xTaskGetCurrentTaskHandle 1
266 #if ( defined( configUSE_CO_ROUTINES ) && configUSE_CO_ROUTINES != 0 )
267 #warning Co-routines have been removed from FreeRTOS-Kernel versions released after V10.5.1. You can view previous versions of the FreeRTOS Kernel at github.com/freertos/freertos-kernel/tree/V10.5.1 .
270 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
271 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
274 #ifndef configUSE_APPLICATION_TASK_TAG
275 #define configUSE_APPLICATION_TASK_TAG 0
278 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
279 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
282 #ifndef configUSE_RECURSIVE_MUTEXES
283 #define configUSE_RECURSIVE_MUTEXES 0
286 #ifndef configUSE_MUTEXES
287 #define configUSE_MUTEXES 0
290 #ifndef configUSE_TIMERS
291 #define configUSE_TIMERS 0
294 #ifndef configUSE_COUNTING_SEMAPHORES
295 #define configUSE_COUNTING_SEMAPHORES 0
298 #ifndef configUSE_ALTERNATIVE_API
299 #define configUSE_ALTERNATIVE_API 0
302 #ifndef portCRITICAL_NESTING_IN_TCB
303 #define portCRITICAL_NESTING_IN_TCB 0
306 #ifndef configMAX_TASK_NAME_LEN
307 #define configMAX_TASK_NAME_LEN 16
310 #ifndef configIDLE_SHOULD_YIELD
311 #define configIDLE_SHOULD_YIELD 1
314 #if configMAX_TASK_NAME_LEN < 1
315 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
319 #define configASSERT( x )
320 #define configASSERT_DEFINED 0
322 #define configASSERT_DEFINED 1
325 /* configPRECONDITION should be defined as configASSERT.
326 * The CBMC proofs need a way to track assumptions and assertions.
327 * A configPRECONDITION statement should express an implicit invariant or
328 * assumption made. A configASSERT statement should express an invariant that must
329 * hold explicit before calling the code. */
330 #ifndef configPRECONDITION
331 #define configPRECONDITION( X ) configASSERT( X )
332 #define configPRECONDITION_DEFINED 0
334 #define configPRECONDITION_DEFINED 1
337 #ifndef portMEMORY_BARRIER
338 #define portMEMORY_BARRIER()
341 #ifndef portSOFTWARE_BARRIER
342 #define portSOFTWARE_BARRIER()
345 /* The timers module relies on xTaskGetSchedulerState(). */
346 #if configUSE_TIMERS == 1
348 #ifndef configTIMER_TASK_PRIORITY
349 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
350 #endif /* configTIMER_TASK_PRIORITY */
352 #ifndef configTIMER_QUEUE_LENGTH
353 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
354 #endif /* configTIMER_QUEUE_LENGTH */
356 #ifndef configTIMER_TASK_STACK_DEPTH
357 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
358 #endif /* configTIMER_TASK_STACK_DEPTH */
360 #endif /* configUSE_TIMERS */
362 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
363 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
366 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
367 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
370 #ifndef portCLEAN_UP_TCB
371 #define portCLEAN_UP_TCB( pxTCB ) ( void ) ( pxTCB )
374 #ifndef portPRE_TASK_DELETE_HOOK
375 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
378 #ifndef portSETUP_TCB
379 #define portSETUP_TCB( pxTCB ) ( void ) ( pxTCB )
382 #ifndef configQUEUE_REGISTRY_SIZE
383 #define configQUEUE_REGISTRY_SIZE 0U
386 #if ( configQUEUE_REGISTRY_SIZE < 1 )
387 #define vQueueAddToRegistry( xQueue, pcName )
388 #define vQueueUnregisterQueue( xQueue )
389 #define pcQueueGetName( xQueue )
392 #ifndef configUSE_MINI_LIST_ITEM
393 #define configUSE_MINI_LIST_ITEM 1
396 #ifndef portPOINTER_SIZE_TYPE
397 #define portPOINTER_SIZE_TYPE uint32_t
400 /* Remove any unused trace macros. */
403 /* Used to perform any necessary initialisation - for example, open a file
404 * into which trace is to be written. */
410 /* Use to close a trace, for example close a file into which trace has been
415 #ifndef traceTASK_SWITCHED_IN
417 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
418 * to the task control block of the selected task. */
419 #define traceTASK_SWITCHED_IN()
422 #ifndef traceINCREASE_TICK_COUNT
424 /* Called before stepping the tick count after waking from tickless idle
426 #define traceINCREASE_TICK_COUNT( x )
429 #ifndef traceLOW_POWER_IDLE_BEGIN
430 /* Called immediately before entering tickless idle. */
431 #define traceLOW_POWER_IDLE_BEGIN()
434 #ifndef traceLOW_POWER_IDLE_END
435 /* Called when returning to the Idle task after a tickless idle. */
436 #define traceLOW_POWER_IDLE_END()
439 #ifndef traceTASK_SWITCHED_OUT
441 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
442 * to the task control block of the task being switched out. */
443 #define traceTASK_SWITCHED_OUT()
446 #ifndef traceTASK_PRIORITY_INHERIT
448 /* Called when a task attempts to take a mutex that is already held by a
449 * lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
450 * that holds the mutex. uxInheritedPriority is the priority the mutex holder
451 * will inherit (the priority of the task that is attempting to obtain the
453 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
456 #ifndef traceTASK_PRIORITY_DISINHERIT
458 /* Called when a task releases a mutex, the holding of which had resulted in
459 * the task inheriting the priority of a higher priority task.
460 * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
461 * mutex. uxOriginalPriority is the task's configured (base) priority. */
462 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
465 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
467 /* Task is about to block because it cannot read from a
468 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
469 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
470 * task that attempted the read. */
471 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
474 #ifndef traceBLOCKING_ON_QUEUE_PEEK
476 /* Task is about to block because it cannot read from a
477 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
478 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
479 * task that attempted the read. */
480 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
483 #ifndef traceBLOCKING_ON_QUEUE_SEND
485 /* Task is about to block because it cannot write to a
486 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
487 * upon which the write was attempted. pxCurrentTCB points to the TCB of the
488 * task that attempted the write. */
489 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
492 #ifndef configCHECK_FOR_STACK_OVERFLOW
493 #define configCHECK_FOR_STACK_OVERFLOW 0
496 #ifndef configRECORD_STACK_HIGH_ADDRESS
497 #define configRECORD_STACK_HIGH_ADDRESS 0
500 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
501 #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
504 /* The following event macros are embedded in the kernel API calls. */
506 #ifndef traceMOVED_TASK_TO_READY_STATE
507 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
510 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
511 #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
514 #ifndef traceQUEUE_CREATE
515 #define traceQUEUE_CREATE( pxNewQueue )
518 #ifndef traceQUEUE_CREATE_FAILED
519 #define traceQUEUE_CREATE_FAILED( ucQueueType )
522 #ifndef traceCREATE_MUTEX
523 #define traceCREATE_MUTEX( pxNewQueue )
526 #ifndef traceCREATE_MUTEX_FAILED
527 #define traceCREATE_MUTEX_FAILED()
530 #ifndef traceGIVE_MUTEX_RECURSIVE
531 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
534 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
535 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
538 #ifndef traceTAKE_MUTEX_RECURSIVE
539 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
542 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
543 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
546 #ifndef traceCREATE_COUNTING_SEMAPHORE
547 #define traceCREATE_COUNTING_SEMAPHORE()
550 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
551 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
554 #ifndef traceQUEUE_SET_SEND
555 #define traceQUEUE_SET_SEND traceQUEUE_SEND
558 #ifndef traceQUEUE_SEND
559 #define traceQUEUE_SEND( pxQueue )
562 #ifndef traceQUEUE_SEND_FAILED
563 #define traceQUEUE_SEND_FAILED( pxQueue )
566 #ifndef traceQUEUE_RECEIVE
567 #define traceQUEUE_RECEIVE( pxQueue )
570 #ifndef traceQUEUE_PEEK
571 #define traceQUEUE_PEEK( pxQueue )
574 #ifndef traceQUEUE_PEEK_FAILED
575 #define traceQUEUE_PEEK_FAILED( pxQueue )
578 #ifndef traceQUEUE_PEEK_FROM_ISR
579 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
582 #ifndef traceQUEUE_RECEIVE_FAILED
583 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
586 #ifndef traceQUEUE_SEND_FROM_ISR
587 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
590 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
591 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
594 #ifndef traceQUEUE_RECEIVE_FROM_ISR
595 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
598 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
599 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
602 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
603 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
606 #ifndef traceQUEUE_DELETE
607 #define traceQUEUE_DELETE( pxQueue )
610 #ifndef traceTASK_CREATE
611 #define traceTASK_CREATE( pxNewTCB )
614 #ifndef traceTASK_CREATE_FAILED
615 #define traceTASK_CREATE_FAILED()
618 #ifndef traceTASK_DELETE
619 #define traceTASK_DELETE( pxTaskToDelete )
622 #ifndef traceTASK_DELAY_UNTIL
623 #define traceTASK_DELAY_UNTIL( x )
626 #ifndef traceTASK_DELAY
627 #define traceTASK_DELAY()
630 #ifndef traceTASK_PRIORITY_SET
631 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
634 #ifndef traceTASK_SUSPEND
635 #define traceTASK_SUSPEND( pxTaskToSuspend )
638 #ifndef traceTASK_RESUME
639 #define traceTASK_RESUME( pxTaskToResume )
642 #ifndef traceTASK_RESUME_FROM_ISR
643 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
646 #ifndef traceTASK_INCREMENT_TICK
647 #define traceTASK_INCREMENT_TICK( xTickCount )
650 #ifndef traceTIMER_CREATE
651 #define traceTIMER_CREATE( pxNewTimer )
654 #ifndef traceTIMER_CREATE_FAILED
655 #define traceTIMER_CREATE_FAILED()
658 #ifndef traceTIMER_COMMAND_SEND
659 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
662 #ifndef traceTIMER_EXPIRED
663 #define traceTIMER_EXPIRED( pxTimer )
666 #ifndef traceTIMER_COMMAND_RECEIVED
667 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
671 #define traceMALLOC( pvAddress, uiSize )
675 #define traceFREE( pvAddress, uiSize )
678 #ifndef traceEVENT_GROUP_CREATE
679 #define traceEVENT_GROUP_CREATE( xEventGroup )
682 #ifndef traceEVENT_GROUP_CREATE_FAILED
683 #define traceEVENT_GROUP_CREATE_FAILED()
686 #ifndef traceEVENT_GROUP_SYNC_BLOCK
687 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
690 #ifndef traceEVENT_GROUP_SYNC_END
691 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
694 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
695 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
698 #ifndef traceEVENT_GROUP_WAIT_BITS_END
699 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
702 #ifndef traceEVENT_GROUP_CLEAR_BITS
703 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
706 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
707 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
710 #ifndef traceEVENT_GROUP_SET_BITS
711 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
714 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
715 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
718 #ifndef traceEVENT_GROUP_DELETE
719 #define traceEVENT_GROUP_DELETE( xEventGroup )
722 #ifndef tracePEND_FUNC_CALL
723 #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
726 #ifndef tracePEND_FUNC_CALL_FROM_ISR
727 #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
730 #ifndef traceQUEUE_REGISTRY_ADD
731 #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
734 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
735 #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
738 #ifndef traceTASK_NOTIFY_TAKE
739 #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
742 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
743 #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
746 #ifndef traceTASK_NOTIFY_WAIT
747 #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
750 #ifndef traceTASK_NOTIFY
751 #define traceTASK_NOTIFY( uxIndexToNotify )
754 #ifndef traceTASK_NOTIFY_FROM_ISR
755 #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
758 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
759 #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
762 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
763 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
766 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
767 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
770 #ifndef traceSTREAM_BUFFER_CREATE
771 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
774 #ifndef traceSTREAM_BUFFER_DELETE
775 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
778 #ifndef traceSTREAM_BUFFER_RESET
779 #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
782 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
783 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
786 #ifndef traceSTREAM_BUFFER_SEND
787 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
790 #ifndef traceSTREAM_BUFFER_SEND_FAILED
791 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
794 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
795 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
798 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
799 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
802 #ifndef traceSTREAM_BUFFER_RECEIVE
803 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
806 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
807 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
810 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
811 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
814 #ifndef configGENERATE_RUN_TIME_STATS
815 #define configGENERATE_RUN_TIME_STATS 0
818 #if ( configGENERATE_RUN_TIME_STATS == 1 )
820 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
821 #error If configGENERATE_RUN_TIME_STATS is defined then portCONFIGURE_TIMER_FOR_RUN_TIME_STATS must also be defined. portCONFIGURE_TIMER_FOR_RUN_TIME_STATS should call a port layer function to setup a peripheral timer/counter that can then be used as the run time counter time base.
822 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
824 #ifndef portGET_RUN_TIME_COUNTER_VALUE
825 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
826 #error If configGENERATE_RUN_TIME_STATS is defined then either portGET_RUN_TIME_COUNTER_VALUE or portALT_GET_RUN_TIME_COUNTER_VALUE must also be defined. See the examples provided and the FreeRTOS web site for more information.
827 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
828 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
830 #endif /* configGENERATE_RUN_TIME_STATS */
832 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
833 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
836 #ifndef configUSE_MALLOC_FAILED_HOOK
837 #define configUSE_MALLOC_FAILED_HOOK 0
840 #ifndef portPRIVILEGE_BIT
841 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
844 #ifndef portYIELD_WITHIN_API
845 #define portYIELD_WITHIN_API portYIELD
848 #ifndef portSUPPRESS_TICKS_AND_SLEEP
849 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
852 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
853 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
856 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
857 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
860 #ifndef configUSE_TICKLESS_IDLE
861 #define configUSE_TICKLESS_IDLE 0
864 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
865 #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
868 #ifndef configPRE_SLEEP_PROCESSING
869 #define configPRE_SLEEP_PROCESSING( x )
872 #ifndef configPOST_SLEEP_PROCESSING
873 #define configPOST_SLEEP_PROCESSING( x )
876 #ifndef configUSE_QUEUE_SETS
877 #define configUSE_QUEUE_SETS 0
880 #ifndef portTASK_USES_FLOATING_POINT
881 #define portTASK_USES_FLOATING_POINT()
884 #ifndef portALLOCATE_SECURE_CONTEXT
885 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
888 #ifndef portDONT_DISCARD
889 #define portDONT_DISCARD
896 #ifndef configUSE_TIME_SLICING
897 #define configUSE_TIME_SLICING 1
900 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
901 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
904 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
905 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
908 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
909 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
912 #ifndef configUSE_TRACE_FACILITY
913 #define configUSE_TRACE_FACILITY 0
916 #ifndef mtCOVERAGE_TEST_MARKER
917 #define mtCOVERAGE_TEST_MARKER()
920 #ifndef mtCOVERAGE_TEST_DELAY
921 #define mtCOVERAGE_TEST_DELAY()
924 #ifndef portASSERT_IF_IN_ISR
925 #define portASSERT_IF_IN_ISR()
928 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
929 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
932 #ifndef configAPPLICATION_ALLOCATED_HEAP
933 #define configAPPLICATION_ALLOCATED_HEAP 0
936 #ifndef configUSE_TASK_NOTIFICATIONS
937 #define configUSE_TASK_NOTIFICATIONS 1
940 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
941 #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
944 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
945 #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
948 #ifndef configUSE_POSIX_ERRNO
949 #define configUSE_POSIX_ERRNO 0
952 #ifndef configUSE_SB_COMPLETED_CALLBACK
954 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
955 #define configUSE_SB_COMPLETED_CALLBACK 0
958 #ifndef portTICK_TYPE_IS_ATOMIC
959 #define portTICK_TYPE_IS_ATOMIC 0
962 #ifndef configSUPPORT_STATIC_ALLOCATION
963 /* Defaults to 0 for backward compatibility. */
964 #define configSUPPORT_STATIC_ALLOCATION 0
967 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
968 /* Defaults to 1 for backward compatibility. */
969 #define configSUPPORT_DYNAMIC_ALLOCATION 1
972 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
973 #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
976 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
977 #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
978 #error configUSE_STATS_FORMATTING_FUNCTIONS is 1 but the functions it enables are not used because neither configUSE_TRACE_FACILITY or configGENERATE_RUN_TIME_STATS are 1. Set configUSE_STATS_FORMATTING_FUNCTIONS to 0 in FreeRTOSConfig.h.
982 #ifndef configSTACK_DEPTH_TYPE
984 /* Defaults to uint16_t for backward compatibility, but can be overridden
985 * in FreeRTOSConfig.h if uint16_t is too restrictive. */
986 #define configSTACK_DEPTH_TYPE uint16_t
989 #ifndef configRUN_TIME_COUNTER_TYPE
991 /* Defaults to uint32_t for backward compatibility, but can be overridden in
992 * FreeRTOSConfig.h if uint32_t is too restrictive. */
994 #define configRUN_TIME_COUNTER_TYPE uint32_t
997 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
999 /* Defaults to size_t for backward compatibility, but can be overridden
1000 * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1002 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
1005 /* Sanity check the configuration. */
1006 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1007 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1010 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1011 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1014 #ifndef configINITIAL_TICK_COUNT
1015 #define configINITIAL_TICK_COUNT 0
1018 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1020 /* Either variables of tick type cannot be read atomically, or
1021 * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1022 * the tick count is returned to the standard critical section macros. */
1023 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
1024 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
1025 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
1026 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1029 /* The tick type can be read atomically, so critical sections used when the
1030 * tick count is returned can be defined away. */
1031 #define portTICK_TYPE_ENTER_CRITICAL()
1032 #define portTICK_TYPE_EXIT_CRITICAL()
1033 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
1034 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) ( x )
1035 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1037 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1039 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1040 #define configENABLE_BACKWARD_COMPATIBILITY 1
1043 #ifndef configPRINTF
1045 /* configPRINTF() was not defined, so define it away to nothing. To use
1046 * configPRINTF() then define it as follows (where MyPrintFunction() is
1047 * provided by the application writer):
1049 * void MyPrintFunction(const char *pcFormat, ... );
1050 #define configPRINTF( X ) MyPrintFunction X
1052 * Then call like a standard printf() function, but placing brackets around
1053 * all parameters so they are passed as a single parameter. For example:
1054 * configPRINTF( ("Value = %d", MyVariable) ); */
1055 #define configPRINTF( X )
1060 /* The application writer has not provided their own MAX macro, so define
1061 * the following generic implementation. */
1062 #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1067 /* The application writer has not provided their own MIN macro, so define
1068 * the following generic implementation. */
1069 #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1072 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1073 #define eTaskStateGet eTaskGetState
1074 #define portTickType TickType_t
1075 #define xTaskHandle TaskHandle_t
1076 #define xQueueHandle QueueHandle_t
1077 #define xSemaphoreHandle SemaphoreHandle_t
1078 #define xQueueSetHandle QueueSetHandle_t
1079 #define xQueueSetMemberHandle QueueSetMemberHandle_t
1080 #define xTimeOutType TimeOut_t
1081 #define xMemoryRegion MemoryRegion_t
1082 #define xTaskParameters TaskParameters_t
1083 #define xTaskStatusType TaskStatus_t
1084 #define xTimerHandle TimerHandle_t
1085 #define pdTASK_HOOK_CODE TaskHookFunction_t
1086 #define portTICK_RATE_MS portTICK_PERIOD_MS
1087 #define pcTaskGetTaskName pcTaskGetName
1088 #define pcTimerGetTimerName pcTimerGetName
1089 #define pcQueueGetQueueName pcQueueGetName
1090 #define vTaskGetTaskInfo vTaskGetInfo
1091 #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
1093 /* Backward compatibility within the scheduler code only - these definitions
1094 * are not really required but are included for completeness. */
1095 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
1096 #define pdTASK_CODE TaskFunction_t
1097 #define xListItem ListItem_t
1098 #define xList List_t
1100 /* For libraries that break the list data hiding, and access list structure
1101 * members directly (which is not supposed to be done). */
1102 #define pxContainer pvContainer
1103 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1105 #if ( configUSE_ALTERNATIVE_API != 0 )
1106 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1109 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1110 * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1111 * This constant is not supported by all FreeRTOS ports that include floating
1113 #ifndef configUSE_TASK_FPU_SUPPORT
1114 #define configUSE_TASK_FPU_SUPPORT 1
1117 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1118 * currently used in ARMv8M ports. */
1119 #ifndef configENABLE_MPU
1120 #define configENABLE_MPU 0
1123 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1124 * currently used in ARMv8M ports. */
1125 #ifndef configENABLE_FPU
1126 #define configENABLE_FPU 1
1129 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1130 * currently used in ARMv8M ports. */
1131 #ifndef configENABLE_MVE
1132 #define configENABLE_MVE 0
1135 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1136 * This is currently used in ARMv8M ports. */
1137 #ifndef configENABLE_TRUSTZONE
1138 #define configENABLE_TRUSTZONE 1
1141 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1142 * the Secure Side only. */
1143 #ifndef configRUN_FREERTOS_SECURE_ONLY
1144 #define configRUN_FREERTOS_SECURE_ONLY 0
1147 #ifndef configRUN_ADDITIONAL_TESTS
1148 #define configRUN_ADDITIONAL_TESTS 0
1152 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1153 * dynamically allocated RAM, in which case when any task is deleted it is known
1154 * that both the task's stack and TCB need to be freed. Sometimes the
1155 * FreeRTOSConfig.h settings only allow a task to be created using statically
1156 * allocated RAM, in which case when any task is deleted it is known that neither
1157 * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
1158 * settings allow a task to be created using either statically or dynamically
1159 * allocated RAM, in which case a member of the TCB is used to record whether the
1160 * stack and/or TCB were allocated statically or dynamically, so when a task is
1161 * deleted the RAM that was allocated dynamically is freed again and no attempt is
1162 * made to free the RAM that was allocated statically.
1163 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1164 * task to be created using either statically or dynamically allocated RAM. Note
1165 * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1166 * a statically allocated stack and a dynamically allocated TCB.
1168 * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1169 * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1170 * when it is possible to have both static and dynamic allocation:
1171 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1172 * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
1173 * | | | | | | Static Possible | |
1174 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1175 * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
1176 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1177 * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
1178 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1179 * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1180 * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
1181 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1182 * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
1183 * | | | | xTaskCreateRestrictedStatic | | | |
1184 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1185 * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1186 * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
1187 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1188 * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1189 * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
1190 * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
1191 * | | | | xTaskCreateRestrictedStatic | | | |
1192 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1194 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
1195 ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1196 ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1199 * In line with software engineering best practice, FreeRTOS implements a strict
1200 * data hiding policy, so the real structures used by FreeRTOS to maintain the
1201 * state of tasks, queues, semaphores, etc. are not accessible to the application
1202 * code. However, if the application writer wants to statically allocate such
1203 * an object then the size of the object needs to be known. Dummy structures
1204 * that are guaranteed to have the same size and alignment requirements of the
1205 * real objects are used for this purpose. The dummy list and list item
1206 * structures below are used for inclusion in such a dummy structure.
1208 struct xSTATIC_LIST_ITEM
1210 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1214 void * pvDummy3[ 4 ];
1215 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1219 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1221 #if ( configUSE_MINI_LIST_ITEM == 1 )
1222 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1223 struct xSTATIC_MINI_LIST_ITEM
1225 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1229 void * pvDummy3[ 2 ];
1231 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1232 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1233 typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
1234 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1236 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1237 typedef struct xSTATIC_LIST
1239 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1242 UBaseType_t uxDummy2;
1244 StaticMiniListItem_t xDummy4;
1245 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1251 * In line with software engineering best practice, especially when supplying a
1252 * library that is likely to change in future versions, FreeRTOS implements a
1253 * strict data hiding policy. This means the Task structure used internally by
1254 * FreeRTOS is not accessible to application code. However, if the application
1255 * writer wants to statically allocate the memory required to create a task then
1256 * the size of the task object needs to be known. The StaticTask_t structure
1257 * below is provided for this purpose. Its sizes and alignment requirements are
1258 * guaranteed to match those of the genuine structure, no matter which
1259 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1260 * are set. Its contents are somewhat obfuscated in the hope users will
1261 * recognise that it would be unwise to make direct use of the structure members.
1263 typedef struct xSTATIC_TCB
1266 #if ( portUSING_MPU_WRAPPERS == 1 )
1267 xMPU_SETTINGS xDummy2;
1269 StaticListItem_t xDummy3[ 2 ];
1270 UBaseType_t uxDummy5;
1272 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1273 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1276 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1277 UBaseType_t uxDummy9;
1279 #if ( configUSE_TRACE_FACILITY == 1 )
1280 UBaseType_t uxDummy10[ 2 ];
1282 #if ( configUSE_MUTEXES == 1 )
1283 UBaseType_t uxDummy12[ 2 ];
1285 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1288 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1289 void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1291 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1292 configRUN_TIME_COUNTER_TYPE ulDummy16;
1294 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
1295 configTLS_BLOCK_TYPE xDummy17;
1297 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1298 uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1299 uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1301 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1305 #if ( INCLUDE_xTaskAbortDelay == 1 )
1308 #if ( configUSE_POSIX_ERRNO == 1 )
1314 * In line with software engineering best practice, especially when supplying a
1315 * library that is likely to change in future versions, FreeRTOS implements a
1316 * strict data hiding policy. This means the Queue structure used internally by
1317 * FreeRTOS is not accessible to application code. However, if the application
1318 * writer wants to statically allocate the memory required to create a queue
1319 * then the size of the queue object needs to be known. The StaticQueue_t
1320 * structure below is provided for this purpose. Its sizes and alignment
1321 * requirements are guaranteed to match those of the genuine structure, no
1322 * matter which architecture is being used, and no matter how the values in
1323 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
1324 * users will recognise that it would be unwise to make direct use of the
1325 * structure members.
1327 typedef struct xSTATIC_QUEUE
1329 void * pvDummy1[ 3 ];
1334 UBaseType_t uxDummy2;
1337 StaticList_t xDummy3[ 2 ];
1338 UBaseType_t uxDummy4[ 3 ];
1339 uint8_t ucDummy5[ 2 ];
1341 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1345 #if ( configUSE_QUEUE_SETS == 1 )
1349 #if ( configUSE_TRACE_FACILITY == 1 )
1350 UBaseType_t uxDummy8;
1354 typedef StaticQueue_t StaticSemaphore_t;
1357 * In line with software engineering best practice, especially when supplying a
1358 * library that is likely to change in future versions, FreeRTOS implements a
1359 * strict data hiding policy. This means the event group structure used
1360 * internally by FreeRTOS is not accessible to application code. However, if
1361 * the application writer wants to statically allocate the memory required to
1362 * create an event group then the size of the event group object needs to be
1363 * know. The StaticEventGroup_t structure below is provided for this purpose.
1364 * Its sizes and alignment requirements are guaranteed to match those of the
1365 * genuine structure, no matter which architecture is being used, and no matter
1366 * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1367 * obfuscated in the hope users will recognise that it would be unwise to make
1368 * direct use of the structure members.
1370 typedef struct xSTATIC_EVENT_GROUP
1373 StaticList_t xDummy2;
1375 #if ( configUSE_TRACE_FACILITY == 1 )
1376 UBaseType_t uxDummy3;
1379 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1382 } StaticEventGroup_t;
1385 * In line with software engineering best practice, especially when supplying a
1386 * library that is likely to change in future versions, FreeRTOS implements a
1387 * strict data hiding policy. This means the software timer structure used
1388 * internally by FreeRTOS is not accessible to application code. However, if
1389 * the application writer wants to statically allocate the memory required to
1390 * create a software timer then the size of the queue object needs to be known.
1391 * The StaticTimer_t structure below is provided for this purpose. Its sizes
1392 * and alignment requirements are guaranteed to match those of the genuine
1393 * structure, no matter which architecture is being used, and no matter how the
1394 * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1395 * the hope users will recognise that it would be unwise to make direct use of
1396 * the structure members.
1398 typedef struct xSTATIC_TIMER
1401 StaticListItem_t xDummy2;
1404 TaskFunction_t pvDummy6;
1405 #if ( configUSE_TRACE_FACILITY == 1 )
1406 UBaseType_t uxDummy7;
1412 * In line with software engineering best practice, especially when supplying a
1413 * library that is likely to change in future versions, FreeRTOS implements a
1414 * strict data hiding policy. This means the stream buffer structure used
1415 * internally by FreeRTOS is not accessible to application code. However, if
1416 * the application writer wants to statically allocate the memory required to
1417 * create a stream buffer then the size of the stream buffer object needs to be
1418 * known. The StaticStreamBuffer_t structure below is provided for this
1419 * purpose. Its size and alignment requirements are guaranteed to match those
1420 * of the genuine structure, no matter which architecture is being used, and
1421 * no matter how the values in FreeRTOSConfig.h are set. Its contents are
1422 * somewhat obfuscated in the hope users will recognise that it would be unwise
1423 * to make direct use of the structure members.
1425 typedef struct xSTATIC_STREAM_BUFFER
1427 size_t uxDummy1[ 4 ];
1428 void * pvDummy2[ 3 ];
1430 #if ( configUSE_TRACE_FACILITY == 1 )
1431 UBaseType_t uxDummy4;
1433 #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1434 void * pvDummy5[ 2 ];
1436 } StaticStreamBuffer_t;
1438 /* Message buffers are built on stream buffers. */
1439 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1447 #endif /* INC_FREERTOS_H */