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 #ifndef configUSE_CORE_AFFINITY
476 #define configUSE_CORE_AFFINITY 0
477 #endif /* configUSE_CORE_AFFINITY */
479 #ifndef configUSE_MINIMAL_IDLE_HOOK
480 #define configUSE_MINIMAL_IDLE_HOOK 0
481 #endif /* configUSE_MINIMAL_IDLE_HOOK */
483 /* The timers module relies on xTaskGetSchedulerState(). */
484 #if configUSE_TIMERS == 1
486 #ifndef configTIMER_TASK_PRIORITY
487 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
488 #endif /* configTIMER_TASK_PRIORITY */
490 #ifndef configTIMER_QUEUE_LENGTH
491 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
492 #endif /* configTIMER_QUEUE_LENGTH */
494 #ifndef configTIMER_TASK_STACK_DEPTH
495 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
496 #endif /* configTIMER_TASK_STACK_DEPTH */
498 #ifndef portTIMER_CALLBACK_ATTRIBUTE
499 #define portTIMER_CALLBACK_ATTRIBUTE
500 #endif /* portTIMER_CALLBACK_ATTRIBUTE */
502 #endif /* configUSE_TIMERS */
504 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
505 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
508 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
509 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) ( uxSavedStatusValue )
512 #ifndef portCLEAN_UP_TCB
513 #define portCLEAN_UP_TCB( pxTCB ) ( void ) ( pxTCB )
516 #ifndef portPRE_TASK_DELETE_HOOK
517 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
520 #ifndef portSETUP_TCB
521 #define portSETUP_TCB( pxTCB ) ( void ) ( pxTCB )
524 #ifndef configQUEUE_REGISTRY_SIZE
525 #define configQUEUE_REGISTRY_SIZE 0U
528 #if ( configQUEUE_REGISTRY_SIZE < 1 )
529 #define vQueueAddToRegistry( xQueue, pcName )
530 #define vQueueUnregisterQueue( xQueue )
531 #define pcQueueGetName( xQueue )
534 #ifndef configUSE_MINI_LIST_ITEM
535 #define configUSE_MINI_LIST_ITEM 1
538 #ifndef portPOINTER_SIZE_TYPE
539 #define portPOINTER_SIZE_TYPE uint32_t
542 /* Remove any unused trace macros. */
545 /* Used to perform any necessary initialisation - for example, open a file
546 * into which trace is to be written. */
552 /* Use to close a trace, for example close a file into which trace has been
557 #ifndef traceTASK_SWITCHED_IN
559 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
560 * to the task control block of the selected task. */
561 #define traceTASK_SWITCHED_IN()
564 #ifndef traceINCREASE_TICK_COUNT
566 /* Called before stepping the tick count after waking from tickless idle
568 #define traceINCREASE_TICK_COUNT( x )
571 #ifndef traceLOW_POWER_IDLE_BEGIN
572 /* Called immediately before entering tickless idle. */
573 #define traceLOW_POWER_IDLE_BEGIN()
576 #ifndef traceLOW_POWER_IDLE_END
577 /* Called when returning to the Idle task after a tickless idle. */
578 #define traceLOW_POWER_IDLE_END()
581 #ifndef traceTASK_SWITCHED_OUT
583 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
584 * to the task control block of the task being switched out. */
585 #define traceTASK_SWITCHED_OUT()
588 #ifndef traceTASK_PRIORITY_INHERIT
590 /* Called when a task attempts to take a mutex that is already held by a
591 * lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
592 * that holds the mutex. uxInheritedPriority is the priority the mutex holder
593 * will inherit (the priority of the task that is attempting to obtain the
595 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
598 #ifndef traceTASK_PRIORITY_DISINHERIT
600 /* Called when a task releases a mutex, the holding of which had resulted in
601 * the task inheriting the priority of a higher priority task.
602 * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
603 * mutex. uxOriginalPriority is the task's configured (base) priority. */
604 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
607 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
609 /* Task is about to block because it cannot read from a
610 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
611 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
612 * task that attempted the read. */
613 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
616 #ifndef traceBLOCKING_ON_QUEUE_PEEK
618 /* Task is about to block because it cannot read from a
619 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
620 * upon which the read was attempted. pxCurrentTCB points to the TCB of the
621 * task that attempted the read. */
622 #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
625 #ifndef traceBLOCKING_ON_QUEUE_SEND
627 /* Task is about to block because it cannot write to a
628 * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
629 * upon which the write was attempted. pxCurrentTCB points to the TCB of the
630 * task that attempted the write. */
631 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
634 #ifndef configCHECK_FOR_STACK_OVERFLOW
635 #define configCHECK_FOR_STACK_OVERFLOW 0
638 #ifndef configRECORD_STACK_HIGH_ADDRESS
639 #define configRECORD_STACK_HIGH_ADDRESS 0
642 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
643 #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
646 /* The following event macros are embedded in the kernel API calls. */
648 #ifndef traceMOVED_TASK_TO_READY_STATE
649 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
652 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
653 #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
656 #ifndef traceMOVED_TASK_TO_DELAYED_LIST
657 #define traceMOVED_TASK_TO_DELAYED_LIST()
660 #ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
661 #define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
664 #ifndef traceQUEUE_CREATE
665 #define traceQUEUE_CREATE( pxNewQueue )
668 #ifndef traceQUEUE_CREATE_FAILED
669 #define traceQUEUE_CREATE_FAILED( ucQueueType )
672 #ifndef traceCREATE_MUTEX
673 #define traceCREATE_MUTEX( pxNewQueue )
676 #ifndef traceCREATE_MUTEX_FAILED
677 #define traceCREATE_MUTEX_FAILED()
680 #ifndef traceGIVE_MUTEX_RECURSIVE
681 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
684 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
685 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
688 #ifndef traceTAKE_MUTEX_RECURSIVE
689 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
692 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
693 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
696 #ifndef traceCREATE_COUNTING_SEMAPHORE
697 #define traceCREATE_COUNTING_SEMAPHORE()
700 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
701 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
704 #ifndef traceQUEUE_SET_SEND
705 #define traceQUEUE_SET_SEND traceQUEUE_SEND
708 #ifndef traceQUEUE_SEND
709 #define traceQUEUE_SEND( pxQueue )
712 #ifndef traceQUEUE_SEND_FAILED
713 #define traceQUEUE_SEND_FAILED( pxQueue )
716 #ifndef traceQUEUE_RECEIVE
717 #define traceQUEUE_RECEIVE( pxQueue )
720 #ifndef traceQUEUE_PEEK
721 #define traceQUEUE_PEEK( pxQueue )
724 #ifndef traceQUEUE_PEEK_FAILED
725 #define traceQUEUE_PEEK_FAILED( pxQueue )
728 #ifndef traceQUEUE_PEEK_FROM_ISR
729 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
732 #ifndef traceQUEUE_RECEIVE_FAILED
733 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
736 #ifndef traceQUEUE_SEND_FROM_ISR
737 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
740 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
741 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
744 #ifndef traceQUEUE_RECEIVE_FROM_ISR
745 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
748 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
749 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
752 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
753 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
756 #ifndef traceQUEUE_DELETE
757 #define traceQUEUE_DELETE( pxQueue )
760 #ifndef traceTASK_CREATE
761 #define traceTASK_CREATE( pxNewTCB )
764 #ifndef traceTASK_CREATE_FAILED
765 #define traceTASK_CREATE_FAILED()
768 #ifndef traceTASK_DELETE
769 #define traceTASK_DELETE( pxTaskToDelete )
772 #ifndef traceTASK_DELAY_UNTIL
773 #define traceTASK_DELAY_UNTIL( x )
776 #ifndef traceTASK_DELAY
777 #define traceTASK_DELAY()
780 #ifndef traceTASK_PRIORITY_SET
781 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
784 #ifndef traceTASK_SUSPEND
785 #define traceTASK_SUSPEND( pxTaskToSuspend )
788 #ifndef traceTASK_RESUME
789 #define traceTASK_RESUME( pxTaskToResume )
792 #ifndef traceTASK_RESUME_FROM_ISR
793 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
796 #ifndef traceTASK_INCREMENT_TICK
797 #define traceTASK_INCREMENT_TICK( xTickCount )
800 #ifndef traceTIMER_CREATE
801 #define traceTIMER_CREATE( pxNewTimer )
804 #ifndef traceTIMER_CREATE_FAILED
805 #define traceTIMER_CREATE_FAILED()
808 #ifndef traceTIMER_COMMAND_SEND
809 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
812 #ifndef traceTIMER_EXPIRED
813 #define traceTIMER_EXPIRED( pxTimer )
816 #ifndef traceTIMER_COMMAND_RECEIVED
817 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
821 #define traceMALLOC( pvAddress, uiSize )
825 #define traceFREE( pvAddress, uiSize )
828 #ifndef traceEVENT_GROUP_CREATE
829 #define traceEVENT_GROUP_CREATE( xEventGroup )
832 #ifndef traceEVENT_GROUP_CREATE_FAILED
833 #define traceEVENT_GROUP_CREATE_FAILED()
836 #ifndef traceEVENT_GROUP_SYNC_BLOCK
837 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
840 #ifndef traceEVENT_GROUP_SYNC_END
841 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
844 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
845 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
848 #ifndef traceEVENT_GROUP_WAIT_BITS_END
849 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
852 #ifndef traceEVENT_GROUP_CLEAR_BITS
853 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
856 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
857 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
860 #ifndef traceEVENT_GROUP_SET_BITS
861 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
864 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
865 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
868 #ifndef traceEVENT_GROUP_DELETE
869 #define traceEVENT_GROUP_DELETE( xEventGroup )
872 #ifndef tracePEND_FUNC_CALL
873 #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
876 #ifndef tracePEND_FUNC_CALL_FROM_ISR
877 #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
880 #ifndef traceQUEUE_REGISTRY_ADD
881 #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
884 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
885 #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
888 #ifndef traceTASK_NOTIFY_TAKE
889 #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
892 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
893 #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
896 #ifndef traceTASK_NOTIFY_WAIT
897 #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
900 #ifndef traceTASK_NOTIFY
901 #define traceTASK_NOTIFY( uxIndexToNotify )
904 #ifndef traceTASK_NOTIFY_FROM_ISR
905 #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
908 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
909 #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
912 #ifndef traceISR_EXIT_TO_SCHEDULER
913 #define traceISR_EXIT_TO_SCHEDULER()
916 #ifndef traceISR_EXIT
917 #define traceISR_EXIT()
920 #ifndef traceISR_ENTER
921 #define traceISR_ENTER()
924 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
925 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
928 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
929 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
932 #ifndef traceSTREAM_BUFFER_CREATE
933 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
936 #ifndef traceSTREAM_BUFFER_DELETE
937 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
940 #ifndef traceSTREAM_BUFFER_RESET
941 #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
944 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
945 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
948 #ifndef traceSTREAM_BUFFER_SEND
949 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
952 #ifndef traceSTREAM_BUFFER_SEND_FAILED
953 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
956 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
957 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
960 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
961 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
964 #ifndef traceSTREAM_BUFFER_RECEIVE
965 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
968 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
969 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
972 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
973 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
976 #ifndef configGENERATE_RUN_TIME_STATS
977 #define configGENERATE_RUN_TIME_STATS 0
980 #if ( configGENERATE_RUN_TIME_STATS == 1 )
982 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
983 #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.
984 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
986 #ifndef portGET_RUN_TIME_COUNTER_VALUE
987 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
988 #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.
989 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
990 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
992 #endif /* configGENERATE_RUN_TIME_STATS */
994 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
995 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
998 #ifndef configUSE_MALLOC_FAILED_HOOK
999 #define configUSE_MALLOC_FAILED_HOOK 0
1002 #ifndef portPRIVILEGE_BIT
1003 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
1006 #ifndef portYIELD_WITHIN_API
1007 #define portYIELD_WITHIN_API portYIELD
1010 #ifndef portSUPPRESS_TICKS_AND_SLEEP
1011 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
1014 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
1015 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
1018 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
1019 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
1022 #ifndef configUSE_TICKLESS_IDLE
1023 #define configUSE_TICKLESS_IDLE 0
1026 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
1027 #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
1030 #ifndef configPRE_SLEEP_PROCESSING
1031 #define configPRE_SLEEP_PROCESSING( x )
1034 #ifndef configPOST_SLEEP_PROCESSING
1035 #define configPOST_SLEEP_PROCESSING( x )
1038 #ifndef configUSE_QUEUE_SETS
1039 #define configUSE_QUEUE_SETS 0
1042 #ifndef portTASK_USES_FLOATING_POINT
1043 #define portTASK_USES_FLOATING_POINT()
1046 #ifndef portALLOCATE_SECURE_CONTEXT
1047 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
1050 #ifndef portDONT_DISCARD
1051 #define portDONT_DISCARD
1054 #ifndef configUSE_TIME_SLICING
1055 #define configUSE_TIME_SLICING 1
1058 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
1059 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
1062 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
1063 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
1066 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
1067 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
1070 #ifndef configUSE_TRACE_FACILITY
1071 #define configUSE_TRACE_FACILITY 0
1074 #ifndef mtCOVERAGE_TEST_MARKER
1075 #define mtCOVERAGE_TEST_MARKER()
1078 #ifndef mtCOVERAGE_TEST_DELAY
1079 #define mtCOVERAGE_TEST_DELAY()
1082 #ifndef portASSERT_IF_IN_ISR
1083 #define portASSERT_IF_IN_ISR()
1086 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
1087 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
1090 #ifndef configAPPLICATION_ALLOCATED_HEAP
1091 #define configAPPLICATION_ALLOCATED_HEAP 0
1094 #ifndef configENABLE_HEAP_PROTECTOR
1095 #define configENABLE_HEAP_PROTECTOR 0
1098 #ifndef configUSE_TASK_NOTIFICATIONS
1099 #define configUSE_TASK_NOTIFICATIONS 1
1102 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
1103 #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
1106 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
1107 #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
1110 #ifndef configUSE_POSIX_ERRNO
1111 #define configUSE_POSIX_ERRNO 0
1114 #ifndef configUSE_SB_COMPLETED_CALLBACK
1116 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
1117 #define configUSE_SB_COMPLETED_CALLBACK 0
1120 #ifndef portTICK_TYPE_IS_ATOMIC
1121 #define portTICK_TYPE_IS_ATOMIC 0
1124 #ifndef configSUPPORT_STATIC_ALLOCATION
1125 /* Defaults to 0 for backward compatibility. */
1126 #define configSUPPORT_STATIC_ALLOCATION 0
1129 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
1130 /* Defaults to 1 for backward compatibility. */
1131 #define configSUPPORT_DYNAMIC_ALLOCATION 1
1134 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
1135 #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
1138 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
1139 #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
1140 #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.
1144 #ifndef configSTACK_DEPTH_TYPE
1146 /* Defaults to uint16_t for backward compatibility, but can be overridden
1147 * in FreeRTOSConfig.h if uint16_t is too restrictive. */
1148 #define configSTACK_DEPTH_TYPE uint16_t
1151 #ifndef configRUN_TIME_COUNTER_TYPE
1153 /* Defaults to uint32_t for backward compatibility, but can be overridden in
1154 * FreeRTOSConfig.h if uint32_t is too restrictive. */
1156 #define configRUN_TIME_COUNTER_TYPE uint32_t
1159 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
1161 /* Defaults to size_t for backward compatibility, but can be overridden
1162 * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1164 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
1167 /* Sanity check the configuration. */
1168 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1169 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1172 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1173 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1176 #if ( ( configRUN_MULTIPLE_PRIORITIES == 0 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1177 #error configRUN_MULTIPLE_PRIORITIES must be set to 1 to use task preemption disable
1180 #if ( ( configUSE_PREEMPTION == 0 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1181 #error configUSE_PREEMPTION must be set to 1 to use task preemption disable
1184 #if ( ( configNUMBER_OF_CORES == 1 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1185 #error configUSE_TASK_PREEMPTION_DISABLE is not supported in single core FreeRTOS
1188 #if ( ( configNUMBER_OF_CORES == 1 ) && ( configUSE_CORE_AFFINITY != 0 ) )
1189 #error configUSE_CORE_AFFINITY is not supported in single core FreeRTOS
1192 #if ( ( configNUMBER_OF_CORES > 1 ) && ( configUSE_PORT_OPTIMISED_TASK_SELECTION != 0 ) )
1193 #error configUSE_PORT_OPTIMISED_TASK_SELECTION is not supported in SMP FreeRTOS
1196 #ifndef configINITIAL_TICK_COUNT
1197 #define configINITIAL_TICK_COUNT 0
1200 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1202 /* Either variables of tick type cannot be read atomically, or
1203 * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1204 * the tick count is returned to the standard critical section macros. */
1205 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
1206 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
1207 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
1208 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1211 /* The tick type can be read atomically, so critical sections used when the
1212 * tick count is returned can be defined away. */
1213 #define portTICK_TYPE_ENTER_CRITICAL()
1214 #define portTICK_TYPE_EXIT_CRITICAL()
1215 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
1216 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) ( x )
1217 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1219 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1221 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1222 #define configENABLE_BACKWARD_COMPATIBILITY 1
1225 #ifndef configPRINTF
1227 /* configPRINTF() was not defined, so define it away to nothing. To use
1228 * configPRINTF() then define it as follows (where MyPrintFunction() is
1229 * provided by the application writer):
1231 * void MyPrintFunction(const char *pcFormat, ... );
1232 #define configPRINTF( X ) MyPrintFunction X
1234 * Then call like a standard printf() function, but placing brackets around
1235 * all parameters so they are passed as a single parameter. For example:
1236 * configPRINTF( ("Value = %d", MyVariable) ); */
1237 #define configPRINTF( X )
1242 /* The application writer has not provided their own MAX macro, so define
1243 * the following generic implementation. */
1244 #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1249 /* The application writer has not provided their own MIN macro, so define
1250 * the following generic implementation. */
1251 #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1254 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1255 #define eTaskStateGet eTaskGetState
1256 #define portTickType TickType_t
1257 #define xTaskHandle TaskHandle_t
1258 #define xQueueHandle QueueHandle_t
1259 #define xSemaphoreHandle SemaphoreHandle_t
1260 #define xQueueSetHandle QueueSetHandle_t
1261 #define xQueueSetMemberHandle QueueSetMemberHandle_t
1262 #define xTimeOutType TimeOut_t
1263 #define xMemoryRegion MemoryRegion_t
1264 #define xTaskParameters TaskParameters_t
1265 #define xTaskStatusType TaskStatus_t
1266 #define xTimerHandle TimerHandle_t
1267 #define xCoRoutineHandle CoRoutineHandle_t
1268 #define pdTASK_HOOK_CODE TaskHookFunction_t
1269 #define portTICK_RATE_MS portTICK_PERIOD_MS
1270 #define pcTaskGetTaskName pcTaskGetName
1271 #define pcTimerGetTimerName pcTimerGetName
1272 #define pcQueueGetQueueName pcQueueGetName
1273 #define vTaskGetTaskInfo vTaskGetInfo
1274 #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
1276 /* Backward compatibility within the scheduler code only - these definitions
1277 * are not really required but are included for completeness. */
1278 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
1279 #define pdTASK_CODE TaskFunction_t
1280 #define xListItem ListItem_t
1281 #define xList List_t
1283 /* For libraries that break the list data hiding, and access list structure
1284 * members directly (which is not supposed to be done). */
1285 #define pxContainer pvContainer
1286 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1288 #if ( configUSE_ALTERNATIVE_API != 0 )
1289 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1292 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1293 * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1294 * This constant is not supported by all FreeRTOS ports that include floating
1296 #ifndef configUSE_TASK_FPU_SUPPORT
1297 #define configUSE_TASK_FPU_SUPPORT 1
1300 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1301 * currently used in ARMv8M ports. */
1302 #ifndef configENABLE_MPU
1303 #define configENABLE_MPU 0
1306 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1307 * currently used in ARMv8M ports. */
1308 #ifndef configENABLE_FPU
1309 #define configENABLE_FPU 1
1312 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1313 * currently used in ARMv8M ports. */
1314 #ifndef configENABLE_MVE
1315 #define configENABLE_MVE 0
1318 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1319 * This is currently used in ARMv8M ports. */
1320 #ifndef configENABLE_TRUSTZONE
1321 #define configENABLE_TRUSTZONE 1
1324 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1325 * the Secure Side only. */
1326 #ifndef configRUN_FREERTOS_SECURE_ONLY
1327 #define configRUN_FREERTOS_SECURE_ONLY 0
1330 #ifndef configRUN_ADDITIONAL_TESTS
1331 #define configRUN_ADDITIONAL_TESTS 0
1334 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1335 * dynamically allocated RAM, in which case when any task is deleted it is known
1336 * that both the task's stack and TCB need to be freed. Sometimes the
1337 * FreeRTOSConfig.h settings only allow a task to be created using statically
1338 * allocated RAM, in which case when any task is deleted it is known that neither
1339 * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
1340 * settings allow a task to be created using either statically or dynamically
1341 * allocated RAM, in which case a member of the TCB is used to record whether the
1342 * stack and/or TCB were allocated statically or dynamically, so when a task is
1343 * deleted the RAM that was allocated dynamically is freed again and no attempt is
1344 * made to free the RAM that was allocated statically.
1345 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1346 * task to be created using either statically or dynamically allocated RAM. Note
1347 * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1348 * a statically allocated stack and a dynamically allocated TCB.
1350 * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1351 * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1352 * when it is possible to have both static and dynamic allocation:
1353 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1354 * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
1355 * | | | | | | Static Possible | |
1356 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1357 * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
1358 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1359 * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
1360 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1361 * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1362 * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
1363 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1364 * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
1365 * | | | | xTaskCreateRestrictedStatic | | | |
1366 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1367 * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1368 * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
1369 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1370 * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1371 * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
1372 * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
1373 * | | | | xTaskCreateRestrictedStatic | | | |
1374 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1376 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
1377 ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1378 ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1381 * In line with software engineering best practice, FreeRTOS implements a strict
1382 * data hiding policy, so the real structures used by FreeRTOS to maintain the
1383 * state of tasks, queues, semaphores, etc. are not accessible to the application
1384 * code. However, if the application writer wants to statically allocate such
1385 * an object then the size of the object needs to be known. Dummy structures
1386 * that are guaranteed to have the same size and alignment requirements of the
1387 * real objects are used for this purpose. The dummy list and list item
1388 * structures below are used for inclusion in such a dummy structure.
1390 struct xSTATIC_LIST_ITEM
1392 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1396 void * pvDummy3[ 4 ];
1397 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1401 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1403 #if ( configUSE_MINI_LIST_ITEM == 1 )
1404 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1405 struct xSTATIC_MINI_LIST_ITEM
1407 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1411 void * pvDummy3[ 2 ];
1413 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1414 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1415 typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
1416 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1418 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1419 typedef struct xSTATIC_LIST
1421 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1424 UBaseType_t uxDummy2;
1426 StaticMiniListItem_t xDummy4;
1427 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1433 * In line with software engineering best practice, especially when supplying a
1434 * library that is likely to change in future versions, FreeRTOS implements a
1435 * strict data hiding policy. This means the Task structure used internally by
1436 * FreeRTOS is not accessible to application code. However, if the application
1437 * writer wants to statically allocate the memory required to create a task then
1438 * the size of the task object needs to be known. The StaticTask_t structure
1439 * below is provided for this purpose. Its sizes and alignment requirements are
1440 * guaranteed to match those of the genuine structure, no matter which
1441 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1442 * are set. Its contents are somewhat obfuscated in the hope users will
1443 * recognise that it would be unwise to make direct use of the structure members.
1445 typedef struct xSTATIC_TCB
1448 #if ( portUSING_MPU_WRAPPERS == 1 )
1449 xMPU_SETTINGS xDummy2;
1451 #if ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 )
1452 UBaseType_t uxDummy26;
1454 StaticListItem_t xDummy3[ 2 ];
1455 UBaseType_t uxDummy5;
1457 #if ( configNUMBER_OF_CORES > 1 )
1458 BaseType_t xDummy23;
1459 UBaseType_t uxDummy24;
1461 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1462 #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
1463 BaseType_t xDummy25;
1465 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1468 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1469 UBaseType_t uxDummy9;
1471 #if ( configUSE_TRACE_FACILITY == 1 )
1472 UBaseType_t uxDummy10[ 2 ];
1474 #if ( configUSE_MUTEXES == 1 )
1475 UBaseType_t uxDummy12[ 2 ];
1477 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1480 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1481 void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1483 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1484 configRUN_TIME_COUNTER_TYPE ulDummy16;
1486 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
1487 configTLS_BLOCK_TYPE xDummy17;
1489 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1490 uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1491 uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1493 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1497 #if ( INCLUDE_xTaskAbortDelay == 1 )
1500 #if ( configUSE_POSIX_ERRNO == 1 )
1506 * In line with software engineering best practice, especially when supplying a
1507 * library that is likely to change in future versions, FreeRTOS implements a
1508 * strict data hiding policy. This means the Queue structure used internally by
1509 * FreeRTOS is not accessible to application code. However, if the application
1510 * writer wants to statically allocate the memory required to create a queue
1511 * then the size of the queue object needs to be known. The StaticQueue_t
1512 * structure below is provided for this purpose. Its sizes and alignment
1513 * requirements are guaranteed to match those of the genuine structure, no
1514 * matter which architecture is being used, and no matter how the values in
1515 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
1516 * users will recognise that it would be unwise to make direct use of the
1517 * structure members.
1519 typedef struct xSTATIC_QUEUE
1521 void * pvDummy1[ 3 ];
1526 UBaseType_t uxDummy2;
1529 StaticList_t xDummy3[ 2 ];
1530 UBaseType_t uxDummy4[ 3 ];
1531 uint8_t ucDummy5[ 2 ];
1533 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1537 #if ( configUSE_QUEUE_SETS == 1 )
1541 #if ( configUSE_TRACE_FACILITY == 1 )
1542 UBaseType_t uxDummy8;
1546 typedef StaticQueue_t StaticSemaphore_t;
1549 * In line with software engineering best practice, especially when supplying a
1550 * library that is likely to change in future versions, FreeRTOS implements a
1551 * strict data hiding policy. This means the event group structure used
1552 * internally by FreeRTOS is not accessible to application code. However, if
1553 * the application writer wants to statically allocate the memory required to
1554 * create an event group then the size of the event group object needs to be
1555 * know. The StaticEventGroup_t structure below is provided for this purpose.
1556 * Its sizes and alignment requirements are guaranteed to match those of the
1557 * genuine structure, no matter which architecture is being used, and no matter
1558 * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1559 * obfuscated in the hope users will recognise that it would be unwise to make
1560 * direct use of the structure members.
1562 typedef struct xSTATIC_EVENT_GROUP
1565 StaticList_t xDummy2;
1567 #if ( configUSE_TRACE_FACILITY == 1 )
1568 UBaseType_t uxDummy3;
1571 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1574 } StaticEventGroup_t;
1577 * In line with software engineering best practice, especially when supplying a
1578 * library that is likely to change in future versions, FreeRTOS implements a
1579 * strict data hiding policy. This means the software timer structure used
1580 * internally by FreeRTOS is not accessible to application code. However, if
1581 * the application writer wants to statically allocate the memory required to
1582 * create a software timer then the size of the queue object needs to be known.
1583 * The StaticTimer_t structure below is provided for this purpose. Its sizes
1584 * and alignment requirements are guaranteed to match those of the genuine
1585 * structure, no matter which architecture is being used, and no matter how the
1586 * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1587 * the hope users will recognise that it would be unwise to make direct use of
1588 * the structure members.
1590 typedef struct xSTATIC_TIMER
1593 StaticListItem_t xDummy2;
1596 TaskFunction_t pvDummy6;
1597 #if ( configUSE_TRACE_FACILITY == 1 )
1598 UBaseType_t uxDummy7;
1604 * In line with software engineering best practice, especially when supplying a
1605 * library that is likely to change in future versions, FreeRTOS implements a
1606 * strict data hiding policy. This means the stream buffer structure used
1607 * internally by FreeRTOS is not accessible to application code. However, if
1608 * the application writer wants to statically allocate the memory required to
1609 * create a stream buffer then the size of the stream buffer object needs to be
1610 * known. The StaticStreamBuffer_t structure below is provided for this
1611 * purpose. Its size and alignment requirements are guaranteed to match those
1612 * of the genuine structure, no matter which architecture is being used, and
1613 * no matter how the values in FreeRTOSConfig.h are set. Its contents are
1614 * somewhat obfuscated in the hope users will recognise that it would be unwise
1615 * to make direct use of the structure members.
1617 typedef struct xSTATIC_STREAM_BUFFER
1619 size_t uxDummy1[ 4 ];
1620 void * pvDummy2[ 3 ];
1622 #if ( configUSE_TRACE_FACILITY == 1 )
1623 UBaseType_t uxDummy4;
1625 #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1626 void * pvDummy5[ 2 ];
1628 } StaticStreamBuffer_t;
1630 /* Message buffers are built on stream buffers. */
1631 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1639 #endif /* INC_FREERTOS_H */