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 traceQUEUE_CREATE
657 #define traceQUEUE_CREATE( pxNewQueue )
660 #ifndef traceQUEUE_CREATE_FAILED
661 #define traceQUEUE_CREATE_FAILED( ucQueueType )
664 #ifndef traceCREATE_MUTEX
665 #define traceCREATE_MUTEX( pxNewQueue )
668 #ifndef traceCREATE_MUTEX_FAILED
669 #define traceCREATE_MUTEX_FAILED()
672 #ifndef traceGIVE_MUTEX_RECURSIVE
673 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
676 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
677 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
680 #ifndef traceTAKE_MUTEX_RECURSIVE
681 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
684 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
685 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
688 #ifndef traceCREATE_COUNTING_SEMAPHORE
689 #define traceCREATE_COUNTING_SEMAPHORE()
692 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
693 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
696 #ifndef traceQUEUE_SET_SEND
697 #define traceQUEUE_SET_SEND traceQUEUE_SEND
700 #ifndef traceQUEUE_SEND
701 #define traceQUEUE_SEND( pxQueue )
704 #ifndef traceQUEUE_SEND_FAILED
705 #define traceQUEUE_SEND_FAILED( pxQueue )
708 #ifndef traceQUEUE_RECEIVE
709 #define traceQUEUE_RECEIVE( pxQueue )
712 #ifndef traceQUEUE_PEEK
713 #define traceQUEUE_PEEK( pxQueue )
716 #ifndef traceQUEUE_PEEK_FAILED
717 #define traceQUEUE_PEEK_FAILED( pxQueue )
720 #ifndef traceQUEUE_PEEK_FROM_ISR
721 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
724 #ifndef traceQUEUE_RECEIVE_FAILED
725 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
728 #ifndef traceQUEUE_SEND_FROM_ISR
729 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
732 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
733 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
736 #ifndef traceQUEUE_RECEIVE_FROM_ISR
737 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
740 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
741 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
744 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
745 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
748 #ifndef traceQUEUE_DELETE
749 #define traceQUEUE_DELETE( pxQueue )
752 #ifndef traceTASK_CREATE
753 #define traceTASK_CREATE( pxNewTCB )
756 #ifndef traceTASK_CREATE_FAILED
757 #define traceTASK_CREATE_FAILED()
760 #ifndef traceTASK_DELETE
761 #define traceTASK_DELETE( pxTaskToDelete )
764 #ifndef traceTASK_DELAY_UNTIL
765 #define traceTASK_DELAY_UNTIL( x )
768 #ifndef traceTASK_DELAY
769 #define traceTASK_DELAY()
772 #ifndef traceTASK_PRIORITY_SET
773 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
776 #ifndef traceTASK_SUSPEND
777 #define traceTASK_SUSPEND( pxTaskToSuspend )
780 #ifndef traceTASK_RESUME
781 #define traceTASK_RESUME( pxTaskToResume )
784 #ifndef traceTASK_RESUME_FROM_ISR
785 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
788 #ifndef traceTASK_INCREMENT_TICK
789 #define traceTASK_INCREMENT_TICK( xTickCount )
792 #ifndef traceTIMER_CREATE
793 #define traceTIMER_CREATE( pxNewTimer )
796 #ifndef traceTIMER_CREATE_FAILED
797 #define traceTIMER_CREATE_FAILED()
800 #ifndef traceTIMER_COMMAND_SEND
801 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
804 #ifndef traceTIMER_EXPIRED
805 #define traceTIMER_EXPIRED( pxTimer )
808 #ifndef traceTIMER_COMMAND_RECEIVED
809 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
813 #define traceMALLOC( pvAddress, uiSize )
817 #define traceFREE( pvAddress, uiSize )
820 #ifndef traceEVENT_GROUP_CREATE
821 #define traceEVENT_GROUP_CREATE( xEventGroup )
824 #ifndef traceEVENT_GROUP_CREATE_FAILED
825 #define traceEVENT_GROUP_CREATE_FAILED()
828 #ifndef traceEVENT_GROUP_SYNC_BLOCK
829 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
832 #ifndef traceEVENT_GROUP_SYNC_END
833 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
836 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
837 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
840 #ifndef traceEVENT_GROUP_WAIT_BITS_END
841 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) ( xTimeoutOccurred )
844 #ifndef traceEVENT_GROUP_CLEAR_BITS
845 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
848 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
849 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
852 #ifndef traceEVENT_GROUP_SET_BITS
853 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
856 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
857 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
860 #ifndef traceEVENT_GROUP_DELETE
861 #define traceEVENT_GROUP_DELETE( xEventGroup )
864 #ifndef tracePEND_FUNC_CALL
865 #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
868 #ifndef tracePEND_FUNC_CALL_FROM_ISR
869 #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
872 #ifndef traceQUEUE_REGISTRY_ADD
873 #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
876 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
877 #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
880 #ifndef traceTASK_NOTIFY_TAKE
881 #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
884 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
885 #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
888 #ifndef traceTASK_NOTIFY_WAIT
889 #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
892 #ifndef traceTASK_NOTIFY
893 #define traceTASK_NOTIFY( uxIndexToNotify )
896 #ifndef traceTASK_NOTIFY_FROM_ISR
897 #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
900 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
901 #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
904 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
905 #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
908 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
909 #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
912 #ifndef traceSTREAM_BUFFER_CREATE
913 #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
916 #ifndef traceSTREAM_BUFFER_DELETE
917 #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
920 #ifndef traceSTREAM_BUFFER_RESET
921 #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
924 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
925 #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
928 #ifndef traceSTREAM_BUFFER_SEND
929 #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
932 #ifndef traceSTREAM_BUFFER_SEND_FAILED
933 #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
936 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
937 #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
940 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
941 #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
944 #ifndef traceSTREAM_BUFFER_RECEIVE
945 #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
948 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
949 #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
952 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
953 #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
956 #ifndef configGENERATE_RUN_TIME_STATS
957 #define configGENERATE_RUN_TIME_STATS 0
960 #if ( configGENERATE_RUN_TIME_STATS == 1 )
962 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
963 #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.
964 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
966 #ifndef portGET_RUN_TIME_COUNTER_VALUE
967 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
968 #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.
969 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
970 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
972 #endif /* configGENERATE_RUN_TIME_STATS */
974 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
975 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
978 #ifndef configUSE_MALLOC_FAILED_HOOK
979 #define configUSE_MALLOC_FAILED_HOOK 0
982 #ifndef portPRIVILEGE_BIT
983 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
986 #ifndef portYIELD_WITHIN_API
987 #define portYIELD_WITHIN_API portYIELD
990 #ifndef portSUPPRESS_TICKS_AND_SLEEP
991 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
994 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
995 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
998 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
999 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
1002 #ifndef configUSE_TICKLESS_IDLE
1003 #define configUSE_TICKLESS_IDLE 0
1006 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
1007 #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
1010 #ifndef configPRE_SLEEP_PROCESSING
1011 #define configPRE_SLEEP_PROCESSING( x )
1014 #ifndef configPOST_SLEEP_PROCESSING
1015 #define configPOST_SLEEP_PROCESSING( x )
1018 #ifndef configUSE_QUEUE_SETS
1019 #define configUSE_QUEUE_SETS 0
1022 #ifndef portTASK_USES_FLOATING_POINT
1023 #define portTASK_USES_FLOATING_POINT()
1026 #ifndef portALLOCATE_SECURE_CONTEXT
1027 #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
1030 #ifndef portDONT_DISCARD
1031 #define portDONT_DISCARD
1034 #ifndef configUSE_TIME_SLICING
1035 #define configUSE_TIME_SLICING 1
1038 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
1039 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
1042 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
1043 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
1046 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
1047 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
1050 #ifndef configUSE_TRACE_FACILITY
1051 #define configUSE_TRACE_FACILITY 0
1054 #ifndef mtCOVERAGE_TEST_MARKER
1055 #define mtCOVERAGE_TEST_MARKER()
1058 #ifndef mtCOVERAGE_TEST_DELAY
1059 #define mtCOVERAGE_TEST_DELAY()
1062 #ifndef portASSERT_IF_IN_ISR
1063 #define portASSERT_IF_IN_ISR()
1066 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
1067 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
1070 #ifndef configAPPLICATION_ALLOCATED_HEAP
1071 #define configAPPLICATION_ALLOCATED_HEAP 0
1074 #ifndef configUSE_TASK_NOTIFICATIONS
1075 #define configUSE_TASK_NOTIFICATIONS 1
1078 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
1079 #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
1082 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
1083 #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
1086 #ifndef configUSE_POSIX_ERRNO
1087 #define configUSE_POSIX_ERRNO 0
1090 #ifndef configUSE_SB_COMPLETED_CALLBACK
1092 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
1093 #define configUSE_SB_COMPLETED_CALLBACK 0
1096 #ifndef portTICK_TYPE_IS_ATOMIC
1097 #define portTICK_TYPE_IS_ATOMIC 0
1100 #ifndef configSUPPORT_STATIC_ALLOCATION
1101 /* Defaults to 0 for backward compatibility. */
1102 #define configSUPPORT_STATIC_ALLOCATION 0
1105 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
1106 /* Defaults to 1 for backward compatibility. */
1107 #define configSUPPORT_DYNAMIC_ALLOCATION 1
1110 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
1111 #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
1114 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
1115 #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
1116 #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.
1120 #ifndef configSTACK_DEPTH_TYPE
1122 /* Defaults to uint16_t for backward compatibility, but can be overridden
1123 * in FreeRTOSConfig.h if uint16_t is too restrictive. */
1124 #define configSTACK_DEPTH_TYPE uint16_t
1127 #ifndef configRUN_TIME_COUNTER_TYPE
1129 /* Defaults to uint32_t for backward compatibility, but can be overridden in
1130 * FreeRTOSConfig.h if uint32_t is too restrictive. */
1132 #define configRUN_TIME_COUNTER_TYPE uint32_t
1135 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
1137 /* Defaults to size_t for backward compatibility, but can be overridden
1138 * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
1140 #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
1143 /* Sanity check the configuration. */
1144 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
1145 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1148 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1149 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1152 #if ( ( configRUN_MULTIPLE_PRIORITIES == 0 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1153 #error configRUN_MULTIPLE_PRIORITIES must be set to 1 to use task preemption disable
1156 #if ( ( configUSE_PREEMPTION == 0 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1157 #error configUSE_PREEMPTION must be set to 1 to use task preemption disable
1160 #if ( ( configNUMBER_OF_CORES == 1 ) && ( configUSE_TASK_PREEMPTION_DISABLE != 0 ) )
1161 #error configUSE_TASK_PREEMPTION_DISABLE is not supported in single core FreeRTOS
1164 #ifndef configINITIAL_TICK_COUNT
1165 #define configINITIAL_TICK_COUNT 0
1168 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1170 /* Either variables of tick type cannot be read atomically, or
1171 * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1172 * the tick count is returned to the standard critical section macros. */
1173 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
1174 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
1175 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
1176 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1179 /* The tick type can be read atomically, so critical sections used when the
1180 * tick count is returned can be defined away. */
1181 #define portTICK_TYPE_ENTER_CRITICAL()
1182 #define portTICK_TYPE_EXIT_CRITICAL()
1183 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
1184 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) ( x )
1185 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1187 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1189 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1190 #define configENABLE_BACKWARD_COMPATIBILITY 1
1193 #ifndef configPRINTF
1195 /* configPRINTF() was not defined, so define it away to nothing. To use
1196 * configPRINTF() then define it as follows (where MyPrintFunction() is
1197 * provided by the application writer):
1199 * void MyPrintFunction(const char *pcFormat, ... );
1200 #define configPRINTF( X ) MyPrintFunction X
1202 * Then call like a standard printf() function, but placing brackets around
1203 * all parameters so they are passed as a single parameter. For example:
1204 * configPRINTF( ("Value = %d", MyVariable) ); */
1205 #define configPRINTF( X )
1210 /* The application writer has not provided their own MAX macro, so define
1211 * the following generic implementation. */
1212 #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1217 /* The application writer has not provided their own MIN macro, so define
1218 * the following generic implementation. */
1219 #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1222 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1223 #define eTaskStateGet eTaskGetState
1224 #define portTickType TickType_t
1225 #define xTaskHandle TaskHandle_t
1226 #define xQueueHandle QueueHandle_t
1227 #define xSemaphoreHandle SemaphoreHandle_t
1228 #define xQueueSetHandle QueueSetHandle_t
1229 #define xQueueSetMemberHandle QueueSetMemberHandle_t
1230 #define xTimeOutType TimeOut_t
1231 #define xMemoryRegion MemoryRegion_t
1232 #define xTaskParameters TaskParameters_t
1233 #define xTaskStatusType TaskStatus_t
1234 #define xTimerHandle TimerHandle_t
1235 #define xCoRoutineHandle CoRoutineHandle_t
1236 #define pdTASK_HOOK_CODE TaskHookFunction_t
1237 #define portTICK_RATE_MS portTICK_PERIOD_MS
1238 #define pcTaskGetTaskName pcTaskGetName
1239 #define pcTimerGetTimerName pcTimerGetName
1240 #define pcQueueGetQueueName pcQueueGetName
1241 #define vTaskGetTaskInfo vTaskGetInfo
1242 #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
1244 /* Backward compatibility within the scheduler code only - these definitions
1245 * are not really required but are included for completeness. */
1246 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
1247 #define pdTASK_CODE TaskFunction_t
1248 #define xListItem ListItem_t
1249 #define xList List_t
1251 /* For libraries that break the list data hiding, and access list structure
1252 * members directly (which is not supposed to be done). */
1253 #define pxContainer pvContainer
1254 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1256 #if ( configUSE_ALTERNATIVE_API != 0 )
1257 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1260 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1261 * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1262 * This constant is not supported by all FreeRTOS ports that include floating
1264 #ifndef configUSE_TASK_FPU_SUPPORT
1265 #define configUSE_TASK_FPU_SUPPORT 1
1268 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1269 * currently used in ARMv8M ports. */
1270 #ifndef configENABLE_MPU
1271 #define configENABLE_MPU 0
1274 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1275 * currently used in ARMv8M ports. */
1276 #ifndef configENABLE_FPU
1277 #define configENABLE_FPU 1
1280 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1281 * currently used in ARMv8M ports. */
1282 #ifndef configENABLE_MVE
1283 #define configENABLE_MVE 0
1286 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1287 * This is currently used in ARMv8M ports. */
1288 #ifndef configENABLE_TRUSTZONE
1289 #define configENABLE_TRUSTZONE 1
1292 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1293 * the Secure Side only. */
1294 #ifndef configRUN_FREERTOS_SECURE_ONLY
1295 #define configRUN_FREERTOS_SECURE_ONLY 0
1298 #ifndef configRUN_ADDITIONAL_TESTS
1299 #define configRUN_ADDITIONAL_TESTS 0
1302 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1303 * dynamically allocated RAM, in which case when any task is deleted it is known
1304 * that both the task's stack and TCB need to be freed. Sometimes the
1305 * FreeRTOSConfig.h settings only allow a task to be created using statically
1306 * allocated RAM, in which case when any task is deleted it is known that neither
1307 * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
1308 * settings allow a task to be created using either statically or dynamically
1309 * allocated RAM, in which case a member of the TCB is used to record whether the
1310 * stack and/or TCB were allocated statically or dynamically, so when a task is
1311 * deleted the RAM that was allocated dynamically is freed again and no attempt is
1312 * made to free the RAM that was allocated statically.
1313 * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1314 * task to be created using either statically or dynamically allocated RAM. Note
1315 * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1316 * a statically allocated stack and a dynamically allocated TCB.
1318 * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1319 * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1320 * when it is possible to have both static and dynamic allocation:
1321 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1322 * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
1323 * | | | | | | Static Possible | |
1324 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1325 * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
1326 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1327 * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
1328 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1329 * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1330 * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
1331 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1332 * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
1333 * | | | | xTaskCreateRestrictedStatic | | | |
1334 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1335 * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1336 * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
1337 * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1338 * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
1339 * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
1340 * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
1341 * | | | | xTaskCreateRestrictedStatic | | | |
1342 * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1344 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
1345 ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1346 ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1349 * In line with software engineering best practice, FreeRTOS implements a strict
1350 * data hiding policy, so the real structures used by FreeRTOS to maintain the
1351 * state of tasks, queues, semaphores, etc. are not accessible to the application
1352 * code. However, if the application writer wants to statically allocate such
1353 * an object then the size of the object needs to be known. Dummy structures
1354 * that are guaranteed to have the same size and alignment requirements of the
1355 * real objects are used for this purpose. The dummy list and list item
1356 * structures below are used for inclusion in such a dummy structure.
1358 struct xSTATIC_LIST_ITEM
1360 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1364 void * pvDummy3[ 4 ];
1365 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1369 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1371 #if ( configUSE_MINI_LIST_ITEM == 1 )
1372 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1373 struct xSTATIC_MINI_LIST_ITEM
1375 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1379 void * pvDummy3[ 2 ];
1381 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1382 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1383 typedef struct xSTATIC_LIST_ITEM StaticMiniListItem_t;
1384 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1386 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1387 typedef struct xSTATIC_LIST
1389 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1392 UBaseType_t uxDummy2;
1394 StaticMiniListItem_t xDummy4;
1395 #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1401 * In line with software engineering best practice, especially when supplying a
1402 * library that is likely to change in future versions, FreeRTOS implements a
1403 * strict data hiding policy. This means the Task structure used internally by
1404 * FreeRTOS is not accessible to application code. However, if the application
1405 * writer wants to statically allocate the memory required to create a task then
1406 * the size of the task object needs to be known. The StaticTask_t structure
1407 * below is provided for this purpose. Its sizes and alignment requirements are
1408 * guaranteed to match those of the genuine structure, no matter which
1409 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1410 * are set. Its contents are somewhat obfuscated in the hope users will
1411 * recognise that it would be unwise to make direct use of the structure members.
1413 typedef struct xSTATIC_TCB
1416 #if ( portUSING_MPU_WRAPPERS == 1 )
1417 xMPU_SETTINGS xDummy2;
1419 #if ( configUSE_CORE_AFFINITY == 1 ) && ( configNUMBER_OF_CORES > 1 )
1420 UBaseType_t uxDummy26;
1422 StaticListItem_t xDummy3[ 2 ];
1423 UBaseType_t uxDummy5;
1425 #if ( configNUMBER_OF_CORES > 1 )
1426 BaseType_t xDummy23;
1427 UBaseType_t uxDummy24;
1429 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1430 #if ( configUSE_TASK_PREEMPTION_DISABLE == 1 )
1431 BaseType_t xDummy25;
1433 #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1436 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1437 UBaseType_t uxDummy9;
1439 #if ( configUSE_TRACE_FACILITY == 1 )
1440 UBaseType_t uxDummy10[ 2 ];
1442 #if ( configUSE_MUTEXES == 1 )
1443 UBaseType_t uxDummy12[ 2 ];
1445 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1448 #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1449 void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1451 #if ( configGENERATE_RUN_TIME_STATS == 1 )
1452 configRUN_TIME_COUNTER_TYPE ulDummy16;
1454 #if ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 )
1455 configTLS_BLOCK_TYPE xDummy17;
1457 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1458 uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1459 uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1461 #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1465 #if ( INCLUDE_xTaskAbortDelay == 1 )
1468 #if ( configUSE_POSIX_ERRNO == 1 )
1474 * In line with software engineering best practice, especially when supplying a
1475 * library that is likely to change in future versions, FreeRTOS implements a
1476 * strict data hiding policy. This means the Queue structure used internally by
1477 * FreeRTOS is not accessible to application code. However, if the application
1478 * writer wants to statically allocate the memory required to create a queue
1479 * then the size of the queue object needs to be known. The StaticQueue_t
1480 * structure below is provided for this purpose. Its sizes and alignment
1481 * requirements are guaranteed to match those of the genuine structure, no
1482 * matter which architecture is being used, and no matter how the values in
1483 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
1484 * users will recognise that it would be unwise to make direct use of the
1485 * structure members.
1487 typedef struct xSTATIC_QUEUE
1489 void * pvDummy1[ 3 ];
1494 UBaseType_t uxDummy2;
1497 StaticList_t xDummy3[ 2 ];
1498 UBaseType_t uxDummy4[ 3 ];
1499 uint8_t ucDummy5[ 2 ];
1501 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1505 #if ( configUSE_QUEUE_SETS == 1 )
1509 #if ( configUSE_TRACE_FACILITY == 1 )
1510 UBaseType_t uxDummy8;
1514 typedef StaticQueue_t StaticSemaphore_t;
1517 * In line with software engineering best practice, especially when supplying a
1518 * library that is likely to change in future versions, FreeRTOS implements a
1519 * strict data hiding policy. This means the event group structure used
1520 * internally by FreeRTOS is not accessible to application code. However, if
1521 * the application writer wants to statically allocate the memory required to
1522 * create an event group then the size of the event group object needs to be
1523 * know. The StaticEventGroup_t structure below is provided for this purpose.
1524 * Its sizes and alignment requirements are guaranteed to match those of the
1525 * genuine structure, no matter which architecture is being used, and no matter
1526 * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1527 * obfuscated in the hope users will recognise that it would be unwise to make
1528 * direct use of the structure members.
1530 typedef struct xSTATIC_EVENT_GROUP
1533 StaticList_t xDummy2;
1535 #if ( configUSE_TRACE_FACILITY == 1 )
1536 UBaseType_t uxDummy3;
1539 #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1542 } StaticEventGroup_t;
1545 * In line with software engineering best practice, especially when supplying a
1546 * library that is likely to change in future versions, FreeRTOS implements a
1547 * strict data hiding policy. This means the software timer structure used
1548 * internally by FreeRTOS is not accessible to application code. However, if
1549 * the application writer wants to statically allocate the memory required to
1550 * create a software timer then the size of the queue object needs to be known.
1551 * The StaticTimer_t structure below is provided for this purpose. Its sizes
1552 * and alignment requirements are guaranteed to match those of the genuine
1553 * structure, no matter which architecture is being used, and no matter how the
1554 * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1555 * the hope users will recognise that it would be unwise to make direct use of
1556 * the structure members.
1558 typedef struct xSTATIC_TIMER
1561 StaticListItem_t xDummy2;
1564 TaskFunction_t pvDummy6;
1565 #if ( configUSE_TRACE_FACILITY == 1 )
1566 UBaseType_t uxDummy7;
1572 * In line with software engineering best practice, especially when supplying a
1573 * library that is likely to change in future versions, FreeRTOS implements a
1574 * strict data hiding policy. This means the stream buffer structure used
1575 * internally by FreeRTOS is not accessible to application code. However, if
1576 * the application writer wants to statically allocate the memory required to
1577 * create a stream buffer then the size of the stream buffer object needs to be
1578 * known. The StaticStreamBuffer_t structure below is provided for this
1579 * purpose. Its size and alignment requirements are guaranteed to match those
1580 * of the genuine structure, no matter which architecture is being used, and
1581 * no matter how the values in FreeRTOSConfig.h are set. Its contents are
1582 * somewhat obfuscated in the hope users will recognise that it would be unwise
1583 * to make direct use of the structure members.
1585 typedef struct xSTATIC_STREAM_BUFFER
1587 size_t uxDummy1[ 4 ];
1588 void * pvDummy2[ 3 ];
1590 #if ( configUSE_TRACE_FACILITY == 1 )
1591 UBaseType_t uxDummy4;
1593 #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1594 void * pvDummy5[ 2 ];
1596 } StaticStreamBuffer_t;
1598 /* Message buffers are built on stream buffers. */
1599 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1607 #endif /* INC_FREERTOS_H */