2 * FreeRTOS Kernel <DEVELOPMENT BRANCH>
3 * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: MIT
7 * Permission is hereby granted, free of charge, to any person obtaining a copy of
8 * this software and associated documentation files (the "Software"), to deal in
9 * the Software without restriction, including without limitation the rights to
10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11 * the Software, and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in all
15 * copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 * https://www.FreeRTOS.org
25 * https://github.com/FreeRTOS
29 #ifndef INC_FREERTOS_H
30 #define INC_FREERTOS_H
33 * Include the generic headers required for the FreeRTOS port being used.
38 * If stdint.h cannot be located then:
39 * + If using GCC ensure the -nostdint options is *not* being used.
40 * + Ensure the project's include path includes the directory in which your
41 * compiler stores stdint.h.
42 * + Set any compiler options necessary for it to support C99, as technically
43 * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
45 * + The FreeRTOS download includes a simple stdint.h definition that can be
46 * used in cases where none is provided by the compiler. The files only
47 * contains the typedefs required to build FreeRTOS. Read the instructions
48 * in FreeRTOS/source/stdint.readme for more information.
50 #include <stdint.h> /* READ COMMENT ABOVE. */
58 /* Acceptable values for configTICK_TYPE_WIDTH_IN_BITS. */
59 #define TICK_TYPE_WIDTH_16_BITS 0
60 #define TICK_TYPE_WIDTH_32_BITS 1
61 #define TICK_TYPE_WIDTH_64_BITS 2
63 /* Application specific configuration options. */
64 #include "FreeRTOSConfig.h"
66 #if !defined( configUSE_16_BIT_TICKS ) && !defined( configTICK_TYPE_WIDTH_IN_BITS )
67 #error Missing definition: One of configUSE_16_BIT_TICKS and configTICK_TYPE_WIDTH_IN_BITS must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
70 #if defined( configUSE_16_BIT_TICKS ) && defined( configTICK_TYPE_WIDTH_IN_BITS )
71 #error Only one of configUSE_16_BIT_TICKS and configTICK_TYPE_WIDTH_IN_BITS must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
74 /* Define configTICK_TYPE_WIDTH_IN_BITS according to the
75 * value of configUSE_16_BIT_TICKS for backward compatibility. */
76 #ifndef configTICK_TYPE_WIDTH_IN_BITS
77 #if ( configUSE_16_BIT_TICKS == 1 )
78 #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_16_BITS
80 #define configTICK_TYPE_WIDTH_IN_BITS TICK_TYPE_WIDTH_32_BITS
84 /* Set configUSE_MPU_WRAPPERS_V1 to 1 to use MPU wrappers v1. */
85 #ifndef configUSE_MPU_WRAPPERS_V1
86 #define configUSE_MPU_WRAPPERS_V1 0
89 /* Set default value of configNUMBER_OF_CORES to 1 to use single core FreeRTOS. */
90 #ifndef configNUMBER_OF_CORES
91 #define configNUMBER_OF_CORES 1
94 /* Basic FreeRTOS definitions. */
97 /* Definitions specific to the port being used. */
100 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
101 #ifndef configUSE_NEWLIB_REENTRANT
102 #define configUSE_NEWLIB_REENTRANT 0
105 /* Required if struct _reent is used. */
106 #if ( configUSE_NEWLIB_REENTRANT == 1 )
108 #include "newlib-freertos.h"
110 #endif /* if ( configUSE_NEWLIB_REENTRANT == 1 ) */
112 /* Must be defaulted before configUSE_PICOLIBC_TLS is used below. */
113 #ifndef configUSE_PICOLIBC_TLS
114 #define configUSE_PICOLIBC_TLS 0
117 #if ( configUSE_PICOLIBC_TLS == 1 )
119 #include "picolibc-freertos.h"
121 #endif /* if ( configUSE_PICOLIBC_TLS == 1 ) */
123 #ifndef configUSE_C_RUNTIME_TLS_SUPPORT
124 #define configUSE_C_RUNTIME_TLS_SUPPORT 0
127 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
129 #ifndef configTLS_BLOCK_TYPE
130 #error Missing definition: configTLS_BLOCK_TYPE must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
133 #ifndef configINIT_TLS_BLOCK
134 #error Missing definition: configINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
137 #ifndef configSET_TLS_BLOCK
138 #error Missing definition: configSET_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
141 #ifndef configDEINIT_TLS_BLOCK
142 #error Missing definition: configDEINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
144 #endif /* if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) */
147 * Check all the required application specific macros have been defined.
148 * These macros are application specific and (as downloaded) are defined
149 * within FreeRTOSConfig.h.
152 #ifndef configMINIMAL_STACK_SIZE
153 #error Missing definition: configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h. configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task. Refer to the demo project provided for your port for a suitable value.
156 #ifndef configMAX_PRIORITIES
157 #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
160 #if configMAX_PRIORITIES < 1
161 #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
164 #ifndef configUSE_PREEMPTION
165 #error Missing definition: configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
168 #ifndef configUSE_IDLE_HOOK
169 #error Missing definition: configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
172 #if ( configNUMBER_OF_CORES > 1 )
173 #ifndef configUSE_MINIMAL_IDLE_HOOK
174 #error Missing definition: configUSE_MINIMAL_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
178 #ifndef configUSE_TICK_HOOK
179 #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.
182 #if ( ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_16_BITS ) && \
183 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_32_BITS ) && \
184 ( configTICK_TYPE_WIDTH_IN_BITS != TICK_TYPE_WIDTH_64_BITS ) )
185 #error Macro configTICK_TYPE_WIDTH_IN_BITS is defined to incorrect value. See the Configuration section of the FreeRTOS API documentation for details.
188 #ifndef configUSE_CO_ROUTINES
189 #define configUSE_CO_ROUTINES 0
192 #ifndef INCLUDE_vTaskPrioritySet
193 #define INCLUDE_vTaskPrioritySet 0
196 #ifndef INCLUDE_uxTaskPriorityGet
197 #define INCLUDE_uxTaskPriorityGet 0
200 #ifndef INCLUDE_vTaskDelete
201 #define INCLUDE_vTaskDelete 0
204 #ifndef INCLUDE_vTaskSuspend
205 #define INCLUDE_vTaskSuspend 0
208 #ifdef INCLUDE_xTaskDelayUntil
209 #ifdef INCLUDE_vTaskDelayUntil
211 /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
212 * compatibility is maintained if only one or the other is defined, but
213 * there is a conflict if both are defined. */
214 #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
218 #ifndef INCLUDE_xTaskDelayUntil
219 #ifdef INCLUDE_vTaskDelayUntil
221 /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
222 * the project's FreeRTOSConfig.h probably pre-dates the introduction of
223 * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
224 * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
226 #define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil
230 #ifndef INCLUDE_xTaskDelayUntil
231 #define INCLUDE_xTaskDelayUntil 0
234 #ifndef INCLUDE_vTaskDelay
235 #define INCLUDE_vTaskDelay 0
238 #ifndef INCLUDE_xTaskGetIdleTaskHandle
239 #define INCLUDE_xTaskGetIdleTaskHandle 0
242 #ifndef INCLUDE_xTaskAbortDelay
243 #define INCLUDE_xTaskAbortDelay 0
246 #ifndef INCLUDE_xQueueGetMutexHolder
247 #define INCLUDE_xQueueGetMutexHolder 0
250 #ifndef INCLUDE_xSemaphoreGetMutexHolder
251 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
254 #ifndef INCLUDE_xTaskGetHandle
255 #define INCLUDE_xTaskGetHandle 0
258 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
259 #define INCLUDE_uxTaskGetStackHighWaterMark 0
262 #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
263 #define INCLUDE_uxTaskGetStackHighWaterMark2 0
266 #ifndef INCLUDE_eTaskGetState
267 #define INCLUDE_eTaskGetState 0
270 #ifndef INCLUDE_xTaskResumeFromISR
271 #define INCLUDE_xTaskResumeFromISR 1
274 #ifndef INCLUDE_xTimerPendFunctionCall
275 #define INCLUDE_xTimerPendFunctionCall 0
278 #ifndef INCLUDE_xTaskGetSchedulerState
279 #define INCLUDE_xTaskGetSchedulerState 0
282 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
283 #define INCLUDE_xTaskGetCurrentTaskHandle 1
286 #if configUSE_CO_ROUTINES != 0
287 #ifndef configMAX_CO_ROUTINE_PRIORITIES
288 #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
292 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
293 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
296 #ifndef configUSE_APPLICATION_TASK_TAG
297 #define configUSE_APPLICATION_TASK_TAG 0
300 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
301 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
304 #ifndef configUSE_RECURSIVE_MUTEXES
305 #define configUSE_RECURSIVE_MUTEXES 0
308 #ifndef configUSE_MUTEXES
309 #define configUSE_MUTEXES 0
312 #ifndef configUSE_TIMERS
313 #define configUSE_TIMERS 0
316 #ifndef configUSE_COUNTING_SEMAPHORES
317 #define configUSE_COUNTING_SEMAPHORES 0
320 #ifndef configUSE_TASK_PREEMPTION_DISABLE
321 #define configUSE_TASK_PREEMPTION_DISABLE 0
324 #ifndef configUSE_ALTERNATIVE_API
325 #define configUSE_ALTERNATIVE_API 0
328 #ifndef portCRITICAL_NESTING_IN_TCB
329 #define portCRITICAL_NESTING_IN_TCB 0
332 #ifndef configMAX_TASK_NAME_LEN
333 #define configMAX_TASK_NAME_LEN 16
336 #ifndef configIDLE_SHOULD_YIELD
337 #define configIDLE_SHOULD_YIELD 1
340 #if configMAX_TASK_NAME_LEN < 1
341 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
345 #define configASSERT( x )
346 #define configASSERT_DEFINED 0
348 #define configASSERT_DEFINED 1
351 /* configPRECONDITION should be defined as configASSERT.
352 * The CBMC proofs need a way to track assumptions and assertions.
353 * A configPRECONDITION statement should express an implicit invariant or
354 * assumption made. A configASSERT statement should express an invariant that must
355 * hold explicit before calling the code. */
356 #ifndef configPRECONDITION
357 #define configPRECONDITION( X ) configASSERT( X )
358 #define configPRECONDITION_DEFINED 0
360 #define configPRECONDITION_DEFINED 1
363 #ifndef portMEMORY_BARRIER
364 #define portMEMORY_BARRIER()
367 #ifndef portSOFTWARE_BARRIER
368 #define portSOFTWARE_BARRIER()
371 #ifndef configRUN_MULTIPLE_PRIORITIES
372 #define configRUN_MULTIPLE_PRIORITIES 0
375 #ifndef portGET_CORE_ID
377 #if ( configNUMBER_OF_CORES == 1 )
378 #define portGET_CORE_ID() 0
380 #error configNUMBER_OF_CORES is set to more than 1 then portGET_CORE_ID must also be defined.
381 #endif /* configNUMBER_OF_CORES */
383 #endif /* portGET_CORE_ID */
385 #ifndef portYIELD_CORE
387 #if ( configNUMBER_OF_CORES == 1 )
388 #define portYIELD_CORE( x ) portYIELD()
390 #error configNUMBER_OF_CORES is set to more than 1 then portYIELD_CORE must also be defined.
391 #endif /* configNUMBER_OF_CORES */
393 #endif /* portYIELD_CORE */
395 #ifndef portSET_INTERRUPT_MASK
397 #if ( configNUMBER_OF_CORES > 1 )
398 #error portSET_INTERRUPT_MASK is required in SMP
401 #endif /* portSET_INTERRUPT_MASK */
403 #ifndef portCLEAR_INTERRUPT_MASK
405 #if ( configNUMBER_OF_CORES > 1 )
406 #error portCLEAR_INTERRUPT_MASK is required in SMP
409 #endif /* portCLEAR_INTERRUPT_MASK */
411 #ifndef portRELEASE_TASK_LOCK
413 #if ( configNUMBER_OF_CORES == 1 )
414 #define portRELEASE_TASK_LOCK()
416 #error portRELEASE_TASK_LOCK is required in SMP
419 #endif /* portRELEASE_TASK_LOCK */
421 #ifndef portGET_TASK_LOCK
423 #if ( configNUMBER_OF_CORES == 1 )
424 #define portGET_TASK_LOCK()
426 #error portGET_TASK_LOCK is required in SMP
429 #endif /* portGET_TASK_LOCK */
431 #ifndef portRELEASE_ISR_LOCK
433 #if ( configNUMBER_OF_CORES == 1 )
434 #define portRELEASE_ISR_LOCK()
436 #error portRELEASE_ISR_LOCK is required in SMP
439 #endif /* portRELEASE_ISR_LOCK */
441 #ifndef portGET_ISR_LOCK
443 #if ( configNUMBER_OF_CORES == 1 )
444 #define portGET_ISR_LOCK()
446 #error portGET_ISR_LOCK is required in SMP
449 #endif /* portGET_ISR_LOCK */
451 #ifndef portCHECK_IF_IN_ISR
453 #if ( configNUMBER_OF_CORES > 1 )
454 #error portCHECK_IF_IN_ISR is required in SMP
457 #endif /* portCHECK_IF_IN_ISR */
459 #ifndef portENTER_CRITICAL_FROM_ISR
461 #if ( configNUMBER_OF_CORES > 1 )
462 #error portENTER_CRITICAL_FROM_ISR is required in SMP
467 #ifndef portEXIT_CRITICAL_FROM_ISR
469 #if ( configNUMBER_OF_CORES > 1 )
470 #error portEXIT_CRITICAL_FROM_ISR is required in SMP
475 /* The timers module relies on xTaskGetSchedulerState(). */
476 #if configUSE_TIMERS == 1
478 #ifndef configTIMER_TASK_PRIORITY
479 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
480 #endif /* configTIMER_TASK_PRIORITY */
482 #ifndef configTIMER_QUEUE_LENGTH
483 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
484 #endif /* configTIMER_QUEUE_LENGTH */
486 #ifndef configTIMER_TASK_STACK_DEPTH
487 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
488 #endif /* configTIMER_TASK_STACK_DEPTH */
490 #ifndef portTIMER_CALLBACK_ATTRIBUTE
491 #define portTIMER_CALLBACK_ATTRIBUTE
492 #endif /* portTIMER_CALLBACK_ATTRIBUTE */
494 #endif /* configUSE_TIMERS */
496 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
497 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
500 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
501 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
504 #ifndef portCLEAN_UP_TCB
505 #define portCLEAN_UP_TCB( pxTCB ) ( void ) ( pxTCB )
508 #ifndef portPRE_TASK_DELETE_HOOK
509 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
512 #ifndef portSETUP_TCB
513 #define portSETUP_TCB( pxTCB ) ( void ) ( pxTCB )
516 #ifndef configQUEUE_REGISTRY_SIZE
517 #define configQUEUE_REGISTRY_SIZE 0U
520 #if ( configQUEUE_REGISTRY_SIZE < 1 )
521 #define vQueueAddToRegistry( xQueue, pcName )
522 #define vQueueUnregisterQueue( xQueue )
523 #define pcQueueGetName( xQueue )
526 #ifndef configUSE_MINI_LIST_ITEM
527 #define configUSE_MINI_LIST_ITEM 1
530 #ifndef portPOINTER_SIZE_TYPE
531 #define portPOINTER_SIZE_TYPE uint32_t
534 /* Remove any unused trace macros. */
537 /* Used to perform any necessary initialisation - for example, open a file
538 * into which trace is to be written. */
544 /* Use to close a trace, for example close a file into which trace has been
549 #ifndef traceTASK_SWITCHED_IN
551 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
552 * to the task control block of the selected task. */
553 #define traceTASK_SWITCHED_IN()
556 #ifndef traceINCREASE_TICK_COUNT
558 /* Called before stepping the tick count after waking from tickless idle
560 #define traceINCREASE_TICK_COUNT( x )
563 #ifndef traceLOW_POWER_IDLE_BEGIN
564 /* Called immediately before entering tickless idle. */
565 #define traceLOW_POWER_IDLE_BEGIN()
568 #ifndef traceLOW_POWER_IDLE_END
569 /* Called when returning to the Idle task after a tickless idle. */
570 #define traceLOW_POWER_IDLE_END()
573 #ifndef traceTASK_SWITCHED_OUT
575 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
576 * to the task control block of the task being switched out. */
577 #define traceTASK_SWITCHED_OUT()
580 #ifndef traceTASK_PRIORITY_INHERIT
582 /* Called when a task attempts to take a mutex that is already held by a
583 * lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
584 * that holds the mutex. uxInheritedPriority is the priority the mutex holder
585 * will inherit (the priority of the task that is attempting to obtain the
587 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
590 #ifndef traceTASK_PRIORITY_DISINHERIT
592 /* Called when a task releases a mutex, the holding of which had resulted in
593 * the task inheriting the priority of a higher priority task.
594 * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
595 * mutex. uxOriginalPriority is the task's configured (base) priority. */
596 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
599 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
601 /* Task is about to block because it cannot read from a
602 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
603 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
604 * task that attempted the read. */
605 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
608 #ifndef traceBLOCKING_ON_QUEUE_PEEK
610 /* Task is about to block because it cannot read from a
611 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
612 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
613 * task that attempted the read. */
614 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
617 #ifndef traceBLOCKING_ON_QUEUE_SEND
619 /* Task is about to block because it cannot write to a
620 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
621 * upon which the write was attempted. pxCurrentTCB points to the TCB of the
622 * task that attempted the write. */
623 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
626 #ifndef configCHECK_FOR_STACK_OVERFLOW
627 #define configCHECK_FOR_STACK_OVERFLOW 0
630 #ifndef configRECORD_STACK_HIGH_ADDRESS
631 #define configRECORD_STACK_HIGH_ADDRESS 0
634 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
635 #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
638 /* The following event macros are embedded in the kernel API calls. */
640 #ifndef traceMOVED_TASK_TO_READY_STATE
641 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
644 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
645 #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
648 #ifndef traceQUEUE_CREATE
649 #define traceQUEUE_CREATE( pxNewQueue )
652 #ifndef traceQUEUE_CREATE_FAILED
653 #define traceQUEUE_CREATE_FAILED( ucQueueType )
656 #ifndef traceCREATE_MUTEX
657 #define traceCREATE_MUTEX( pxNewQueue )
660 #ifndef traceCREATE_MUTEX_FAILED
661 #define traceCREATE_MUTEX_FAILED()
664 #ifndef traceGIVE_MUTEX_RECURSIVE
665 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
668 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
669 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
672 #ifndef traceTAKE_MUTEX_RECURSIVE
673 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
676 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
677 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
680 #ifndef traceCREATE_COUNTING_SEMAPHORE
681 #define traceCREATE_COUNTING_SEMAPHORE()
684 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
685 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
688 #ifndef traceQUEUE_SET_SEND
689 #define traceQUEUE_SET_SEND traceQUEUE_SEND
692 #ifndef traceQUEUE_SEND
693 #define traceQUEUE_SEND( pxQueue )
696 #ifndef traceQUEUE_SEND_FAILED
697 #define traceQUEUE_SEND_FAILED( pxQueue )
700 #ifndef traceQUEUE_RECEIVE
701 #define traceQUEUE_RECEIVE( pxQueue )
704 #ifndef traceQUEUE_PEEK
705 #define traceQUEUE_PEEK( pxQueue )
708 #ifndef traceQUEUE_PEEK_FAILED
709 #define traceQUEUE_PEEK_FAILED( pxQueue )
712 #ifndef traceQUEUE_PEEK_FROM_ISR
713 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
716 #ifndef traceQUEUE_RECEIVE_FAILED
717 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
720 #ifndef traceQUEUE_SEND_FROM_ISR
721 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
724 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
725 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
728 #ifndef traceQUEUE_RECEIVE_FROM_ISR
729 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
732 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
733 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
736 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
737 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
740 #ifndef traceQUEUE_DELETE
741 #define traceQUEUE_DELETE( pxQueue )
744 #ifndef traceTASK_CREATE
745 #define traceTASK_CREATE( pxNewTCB )
748 #ifndef traceTASK_CREATE_FAILED
749 #define traceTASK_CREATE_FAILED()
752 #ifndef traceTASK_DELETE
753 #define traceTASK_DELETE( pxTaskToDelete )
756 #ifndef traceTASK_DELAY_UNTIL
757 #define traceTASK_DELAY_UNTIL( x )
760 #ifndef traceTASK_DELAY
761 #define traceTASK_DELAY()
764 #ifndef traceTASK_PRIORITY_SET
765 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
768 #ifndef traceTASK_SUSPEND
769 #define traceTASK_SUSPEND( pxTaskToSuspend )
772 #ifndef traceTASK_RESUME
773 #define traceTASK_RESUME( pxTaskToResume )
776 #ifndef traceTASK_RESUME_FROM_ISR
777 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
780 #ifndef traceTASK_INCREMENT_TICK
781 #define traceTASK_INCREMENT_TICK( xTickCount )
784 #ifndef traceTIMER_CREATE
785 #define traceTIMER_CREATE( pxNewTimer )
788 #ifndef traceTIMER_CREATE_FAILED
789 #define traceTIMER_CREATE_FAILED()
792 #ifndef traceTIMER_COMMAND_SEND
793 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
796 #ifndef traceTIMER_EXPIRED
797 #define traceTIMER_EXPIRED( pxTimer )
800 #ifndef traceTIMER_COMMAND_RECEIVED
801 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
805 #define traceMALLOC( pvAddress, uiSize )
809 #define traceFREE( pvAddress, uiSize )
812 #ifndef traceEVENT_GROUP_CREATE
813 #define traceEVENT_GROUP_CREATE( xEventGroup )
816 #ifndef traceEVENT_GROUP_CREATE_FAILED
817 #define traceEVENT_GROUP_CREATE_FAILED()
820 #ifndef traceEVENT_GROUP_SYNC_BLOCK
821 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
824 #ifndef traceEVENT_GROUP_SYNC_END
825 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
828 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
829 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
832 #ifndef traceEVENT_GROUP_WAIT_BITS_END
833 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
836 #ifndef traceEVENT_GROUP_CLEAR_BITS
837 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
840 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
841 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
844 #ifndef traceEVENT_GROUP_SET_BITS
845 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
848 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
849 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
852 #ifndef traceEVENT_GROUP_DELETE
853 #define traceEVENT_GROUP_DELETE( xEventGroup )
856 #ifndef tracePEND_FUNC_CALL
857 #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
860 #ifndef tracePEND_FUNC_CALL_FROM_ISR
861 #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
864 #ifndef traceQUEUE_REGISTRY_ADD
865 #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
868 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
869 #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
872 #ifndef traceTASK_NOTIFY_TAKE
873 #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
876 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
877 #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
880 #ifndef traceTASK_NOTIFY_WAIT
881 #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
884 #ifndef traceTASK_NOTIFY
885 #define traceTASK_NOTIFY( uxIndexToNotify )
888 #ifndef traceTASK_NOTIFY_FROM_ISR
889 #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
892 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
893 #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
896 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
897 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
900 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
901 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
904 #ifndef traceSTREAM_BUFFER_CREATE
905 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
908 #ifndef traceSTREAM_BUFFER_DELETE
909 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
912 #ifndef traceSTREAM_BUFFER_RESET
913 #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
916 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
917 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
920 #ifndef traceSTREAM_BUFFER_SEND
921 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
924 #ifndef traceSTREAM_BUFFER_SEND_FAILED
925 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
928 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
929 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
932 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
933 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
936 #ifndef traceSTREAM_BUFFER_RECEIVE
937 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
940 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
941 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
944 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
945 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
948 #ifndef configGENERATE_RUN_TIME_STATS
949 #define configGENERATE_RUN_TIME_STATS 0
952 #if ( configGENERATE_RUN_TIME_STATS == 1 )
954 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
955 #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.
956 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
958 #ifndef portGET_RUN_TIME_COUNTER_VALUE
959 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
960 #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.
961 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
962 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
964 #endif /* configGENERATE_RUN_TIME_STATS */
966 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
967 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
970 #ifndef configUSE_MALLOC_FAILED_HOOK
971 #define configUSE_MALLOC_FAILED_HOOK 0
974 #ifndef portPRIVILEGE_BIT
975 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
978 #ifndef portYIELD_WITHIN_API
979 #define portYIELD_WITHIN_API portYIELD
982 #ifndef portSUPPRESS_TICKS_AND_SLEEP
983 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
986 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
987 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
990 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
991 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
994 #ifndef configUSE_TICKLESS_IDLE
995 #define configUSE_TICKLESS_IDLE 0
998 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
999 #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
1002 #ifndef configPRE_SLEEP_PROCESSING
1003 #define configPRE_SLEEP_PROCESSING( x )
1006 #ifndef configPOST_SLEEP_PROCESSING
1007 #define configPOST_SLEEP_PROCESSING( x )
1010 #ifndef configUSE_QUEUE_SETS
1011 #define configUSE_QUEUE_SETS 0
1014 #ifndef portTASK_USES_FLOATING_POINT
1015 #define portTASK_USES_FLOATING_POINT()
1018 #ifndef portALLOCATE_SECURE_CONTEXT
1019 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
1022 #ifndef portDONT_DISCARD
1023 #define portDONT_DISCARD
1026 #ifndef configUSE_TIME_SLICING
1027 #define configUSE_TIME_SLICING 1
1030 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
1031 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
1034 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
1035 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
1038 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
1039 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
1042 #ifndef configUSE_TRACE_FACILITY
1043 #define configUSE_TRACE_FACILITY 0
1046 #ifndef mtCOVERAGE_TEST_MARKER
1047 #define mtCOVERAGE_TEST_MARKER()
1050 #ifndef mtCOVERAGE_TEST_DELAY
1051 #define mtCOVERAGE_TEST_DELAY()
1054 #ifndef portASSERT_IF_IN_ISR
1055 #define portASSERT_IF_IN_ISR()
1058 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
1059 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
1062 #ifndef configAPPLICATION_ALLOCATED_HEAP
1063 #define configAPPLICATION_ALLOCATED_HEAP 0
1066 #ifndef configUSE_TASK_NOTIFICATIONS
1067 #define configUSE_TASK_NOTIFICATIONS 1
1070 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
1071 #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
1074 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
1075 #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
1078 #ifndef configUSE_POSIX_ERRNO
1079 #define configUSE_POSIX_ERRNO 0
1082 #ifndef configUSE_SB_COMPLETED_CALLBACK
1084 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
1085 #define configUSE_SB_COMPLETED_CALLBACK 0
1088 #ifndef portTICK_TYPE_IS_ATOMIC
1089 #define portTICK_TYPE_IS_ATOMIC 0
1092 #ifndef configSUPPORT_STATIC_ALLOCATION
1093 /* Defaults to 0 for backward compatibility. */
1094 #define configSUPPORT_STATIC_ALLOCATION 0
1097 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
1098 /* Defaults to 1 for backward compatibility. */
1099 #define configSUPPORT_DYNAMIC_ALLOCATION 1
1102 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
1103 #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
1106 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
1107 #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
1108 #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.
1112 #ifndef configSTACK_DEPTH_TYPE
1114 /* Defaults to uint16_t for backward compatibility, but can be overridden
1115 * in FreeRTOSConfig.h if uint16_t is too restrictive. */
1116 #define configSTACK_DEPTH_TYPE uint16_t
1119 #ifndef configRUN_TIME_COUNTER_TYPE
1121 /* Defaults to uint32_t for backward compatibility, but can be overridden in
1122 * FreeRTOSConfig.h if uint32_t is too restrictive. */
1124 #define configRUN_TIME_COUNTER_TYPE uint32_t
1127 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
1129 /* Defaults to size_t for backward compatibility, but can be overridden
1130 * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1132 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
1135 /* Sanity check the configuration. */
1136 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1137 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1140 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1141 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1144 #if ( ( configRUN_MULTIPLE_PRIORITIES == 0 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1145 #error configRUN_MULTIPLE_PRIORITIES must be set to 1 to use task preemption disable
1148 #if ( ( configUSE_PREEMPTION == 0 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1149 #error configUSE_PREEMPTION must be set to 1 to use task preemption disable
1152 #if ( ( configNUMBER_OF_CORES == 1 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1153 #error configUSE_TASK_PREEMPTION_DISABLE is not supported in single core FreeRTOS
1156 #ifndef configINITIAL_TICK_COUNT
1157 #define configINITIAL_TICK_COUNT 0
1160 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1162 /* Either variables of tick type cannot be read atomically, or
1163 * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1164 * the tick count is returned to the standard critical section macros. */
1165 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
1166 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
1167 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
1168 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1171 /* The tick type can be read atomically, so critical sections used when the
1172 * tick count is returned can be defined away. */
1173 #define portTICK_TYPE_ENTER_CRITICAL()
1174 #define portTICK_TYPE_EXIT_CRITICAL()
1175 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
1176 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) ( x )
1177 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1179 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1181 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1182 #define configENABLE_BACKWARD_COMPATIBILITY 1
1185 #ifndef configPRINTF
1187 /* configPRINTF() was not defined, so define it away to nothing. To use
1188 * configPRINTF() then define it as follows (where MyPrintFunction() is
1189 * provided by the application writer):
1191 * void MyPrintFunction(const char *pcFormat, ... );
1192 #define configPRINTF( X ) MyPrintFunction X
1194 * Then call like a standard printf() function, but placing brackets around
1195 * all parameters so they are passed as a single parameter. For example:
1196 * configPRINTF( ("Value = %d", MyVariable) ); */
1197 #define configPRINTF( X )
1202 /* The application writer has not provided their own MAX macro, so define
1203 * the following generic implementation. */
1204 #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1209 /* The application writer has not provided their own MIN macro, so define
1210 * the following generic implementation. */
1211 #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1214 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1215 #define eTaskStateGet eTaskGetState
1216 #define portTickType TickType_t
1217 #define xTaskHandle TaskHandle_t
1218 #define xQueueHandle QueueHandle_t
1219 #define xSemaphoreHandle SemaphoreHandle_t
1220 #define xQueueSetHandle QueueSetHandle_t
1221 #define xQueueSetMemberHandle QueueSetMemberHandle_t
1222 #define xTimeOutType TimeOut_t
1223 #define xMemoryRegion MemoryRegion_t
1224 #define xTaskParameters TaskParameters_t
1225 #define xTaskStatusType TaskStatus_t
1226 #define xTimerHandle TimerHandle_t
1227 #define xCoRoutineHandle CoRoutineHandle_t
1228 #define pdTASK_HOOK_CODE TaskHookFunction_t
1229 #define portTICK_RATE_MS portTICK_PERIOD_MS
1230 #define pcTaskGetTaskName pcTaskGetName
1231 #define pcTimerGetTimerName pcTimerGetName
1232 #define pcQueueGetQueueName pcQueueGetName
1233 #define vTaskGetTaskInfo vTaskGetInfo
1234 #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
1236 /* Backward compatibility within the scheduler code only - these definitions
1237 * are not really required but are included for completeness. */
1238 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
1239 #define pdTASK_CODE TaskFunction_t
1240 #define xListItem ListItem_t
1241 #define xList List_t
1243 /* For libraries that break the list data hiding, and access list structure
1244 * members directly (which is not supposed to be done). */
1245 #define pxContainer pvContainer
1246 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1248 #if ( configUSE_ALTERNATIVE_API != 0 )
1249 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1252 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1253 * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1254 * This constant is not supported by all FreeRTOS ports that include floating
1256 #ifndef configUSE_TASK_FPU_SUPPORT
1257 #define configUSE_TASK_FPU_SUPPORT 1
1260 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1261 * currently used in ARMv8M ports. */
1262 #ifndef configENABLE_MPU
1263 #define configENABLE_MPU 0
1266 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1267 * currently used in ARMv8M ports. */
1268 #ifndef configENABLE_FPU
1269 #define configENABLE_FPU 1
1272 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1273 * currently used in ARMv8M ports. */
1274 #ifndef configENABLE_MVE
1275 #define configENABLE_MVE 0
1278 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1279 * This is currently used in ARMv8M ports. */
1280 #ifndef configENABLE_TRUSTZONE
1281 #define configENABLE_TRUSTZONE 1
1284 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1285 * the Secure Side only. */
1286 #ifndef configRUN_FREERTOS_SECURE_ONLY
1287 #define configRUN_FREERTOS_SECURE_ONLY 0
1290 #ifndef configRUN_ADDITIONAL_TESTS
1291 #define configRUN_ADDITIONAL_TESTS 0
1294 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1295 * dynamically allocated RAM, in which case when any task is deleted it is known
1296 * that both the task's stack and TCB need to be freed. Sometimes the
1297 * FreeRTOSConfig.h settings only allow a task to be created using statically
1298 * allocated RAM, in which case when any task is deleted it is known that neither
1299 * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
1300 * settings allow a task to be created using either statically or dynamically
1301 * allocated RAM, in which case a member of the TCB is used to record whether the
1302 * stack and/or TCB were allocated statically or dynamically, so when a task is
1303 * deleted the RAM that was allocated dynamically is freed again and no attempt is
1304 * made to free the RAM that was allocated statically.
1305 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1306 * task to be created using either statically or dynamically allocated RAM. Note
1307 * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1308 * a statically allocated stack and a dynamically allocated TCB.
1310 * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1311 * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1312 * when it is possible to have both static and dynamic allocation:
1313 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1314 * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
1315 * | | | | | | Static Possible | |
1316 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1317 * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
1318 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1319 * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
1320 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1321 * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1322 * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
1323 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1324 * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
1325 * | | | | xTaskCreateRestrictedStatic | | | |
1326 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1327 * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1328 * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
1329 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1330 * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1331 * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
1332 * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
1333 * | | | | xTaskCreateRestrictedStatic | | | |
1334 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1336 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
1337 ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1338 ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1341 * In line with software engineering best practice, FreeRTOS implements a strict
1342 * data hiding policy, so the real structures used by FreeRTOS to maintain the
1343 * state of tasks, queues, semaphores, etc. are not accessible to the application
1344 * code. However, if the application writer wants to statically allocate such
1345 * an object then the size of the object needs to be known. Dummy structures
1346 * that are guaranteed to have the same size and alignment requirements of the
1347 * real objects are used for this purpose. The dummy list and list item
1348 * structures below are used for inclusion in such a dummy structure.
1350 struct xSTATIC_LIST_ITEM
1352 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1356 void * pvDummy3[ 4 ];
1357 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1361 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1363 #if ( configUSE_MINI_LIST_ITEM == 1 )
1364 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1365 struct xSTATIC_MINI_LIST_ITEM
1367 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1371 void * pvDummy3[ 2 ];
1373 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1374 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1375 typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
1376 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1378 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1379 typedef struct xSTATIC_LIST
1381 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1384 UBaseType_t uxDummy2;
1386 StaticMiniListItem_t xDummy4;
1387 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1393 * In line with software engineering best practice, especially when supplying a
1394 * library that is likely to change in future versions, FreeRTOS implements a
1395 * strict data hiding policy. This means the Task structure used internally by
1396 * FreeRTOS is not accessible to application code. However, if the application
1397 * writer wants to statically allocate the memory required to create a task then
1398 * the size of the task object needs to be known. The StaticTask_t structure
1399 * below is provided for this purpose. Its sizes and alignment requirements are
1400 * guaranteed to match those of the genuine structure, no matter which
1401 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1402 * are set. Its contents are somewhat obfuscated in the hope users will
1403 * recognise that it would be unwise to make direct use of the structure members.
1405 typedef struct xSTATIC_TCB
1408 #if ( portUSING_MPU_WRAPPERS == 1 )
1409 xMPU_SETTINGS xDummy2;
1411 #if ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 )
1412 UBaseType_t uxDummy26;
1414 StaticListItem_t xDummy3[ 2 ];
1415 UBaseType_t uxDummy5;
1417 #if ( configNUMBER_OF_CORES > 1 )
1418 BaseType_t xDummy23;
1419 UBaseType_t uxDummy24;
1421 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1422 #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
1423 BaseType_t xDummy25;
1425 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1428 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1429 UBaseType_t uxDummy9;
1431 #if ( configUSE_TRACE_FACILITY == 1 )
1432 UBaseType_t uxDummy10[ 2 ];
1434 #if ( configUSE_MUTEXES == 1 )
1435 UBaseType_t uxDummy12[ 2 ];
1437 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1440 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1441 void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1443 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1444 configRUN_TIME_COUNTER_TYPE ulDummy16;
1446 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
1447 configTLS_BLOCK_TYPE xDummy17;
1449 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1450 uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1451 uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1453 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1457 #if ( INCLUDE_xTaskAbortDelay == 1 )
1460 #if ( configUSE_POSIX_ERRNO == 1 )
1466 * In line with software engineering best practice, especially when supplying a
1467 * library that is likely to change in future versions, FreeRTOS implements a
1468 * strict data hiding policy. This means the Queue structure used internally by
1469 * FreeRTOS is not accessible to application code. However, if the application
1470 * writer wants to statically allocate the memory required to create a queue
1471 * then the size of the queue object needs to be known. The StaticQueue_t
1472 * structure below is provided for this purpose. Its sizes and alignment
1473 * requirements are guaranteed to match those of the genuine structure, no
1474 * matter which architecture is being used, and no matter how the values in
1475 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
1476 * users will recognise that it would be unwise to make direct use of the
1477 * structure members.
1479 typedef struct xSTATIC_QUEUE
1481 void * pvDummy1[ 3 ];
1486 UBaseType_t uxDummy2;
1489 StaticList_t xDummy3[ 2 ];
1490 UBaseType_t uxDummy4[ 3 ];
1491 uint8_t ucDummy5[ 2 ];
1493 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1497 #if ( configUSE_QUEUE_SETS == 1 )
1501 #if ( configUSE_TRACE_FACILITY == 1 )
1502 UBaseType_t uxDummy8;
1506 typedef StaticQueue_t StaticSemaphore_t;
1509 * In line with software engineering best practice, especially when supplying a
1510 * library that is likely to change in future versions, FreeRTOS implements a
1511 * strict data hiding policy. This means the event group structure used
1512 * internally by FreeRTOS is not accessible to application code. However, if
1513 * the application writer wants to statically allocate the memory required to
1514 * create an event group then the size of the event group object needs to be
1515 * know. The StaticEventGroup_t structure below is provided for this purpose.
1516 * Its sizes and alignment requirements are guaranteed to match those of the
1517 * genuine structure, no matter which architecture is being used, and no matter
1518 * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1519 * obfuscated in the hope users will recognise that it would be unwise to make
1520 * direct use of the structure members.
1522 typedef struct xSTATIC_EVENT_GROUP
1525 StaticList_t xDummy2;
1527 #if ( configUSE_TRACE_FACILITY == 1 )
1528 UBaseType_t uxDummy3;
1531 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1534 } StaticEventGroup_t;
1537 * In line with software engineering best practice, especially when supplying a
1538 * library that is likely to change in future versions, FreeRTOS implements a
1539 * strict data hiding policy. This means the software timer structure used
1540 * internally by FreeRTOS is not accessible to application code. However, if
1541 * the application writer wants to statically allocate the memory required to
1542 * create a software timer then the size of the queue object needs to be known.
1543 * The StaticTimer_t structure below is provided for this purpose. Its sizes
1544 * and alignment requirements are guaranteed to match those of the genuine
1545 * structure, no matter which architecture is being used, and no matter how the
1546 * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1547 * the hope users will recognise that it would be unwise to make direct use of
1548 * the structure members.
1550 typedef struct xSTATIC_TIMER
1553 StaticListItem_t xDummy2;
1556 TaskFunction_t pvDummy6;
1557 #if ( configUSE_TRACE_FACILITY == 1 )
1558 UBaseType_t uxDummy7;
1564 * In line with software engineering best practice, especially when supplying a
1565 * library that is likely to change in future versions, FreeRTOS implements a
1566 * strict data hiding policy. This means the stream buffer structure used
1567 * internally by FreeRTOS is not accessible to application code. However, if
1568 * the application writer wants to statically allocate the memory required to
1569 * create a stream buffer then the size of the stream buffer object needs to be
1570 * known. The StaticStreamBuffer_t structure below is provided for this
1571 * purpose. Its size and alignment requirements are guaranteed to match those
1572 * of the genuine structure, no matter which architecture is being used, and
1573 * no matter how the values in FreeRTOSConfig.h are set. Its contents are
1574 * somewhat obfuscated in the hope users will recognise that it would be unwise
1575 * to make direct use of the structure members.
1577 typedef struct xSTATIC_STREAM_BUFFER
1579 size_t uxDummy1[ 4 ];
1580 void * pvDummy2[ 3 ];
1582 #if ( configUSE_TRACE_FACILITY == 1 )
1583 UBaseType_t uxDummy4;
1585 #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1586 void * pvDummy5[ 2 ];
1588 } StaticStreamBuffer_t;
1590 /* Message buffers are built on stream buffers. */
1591 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1599 #endif /* INC_FREERTOS_H */