Go to the documentation of this file.
66 #ifndef INC_FREERTOS_H
67 #define INC_FREERTOS_H
79 #include "FreeRTOSConfig.h"
83 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
84 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
105 #ifndef configUSE_PREEMPTION
106 #error Missing definition: configUSE_PREEMPTION should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
109 #ifndef configUSE_IDLE_HOOK
110 #error Missing definition: configUSE_IDLE_HOOK should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
113 #ifndef configUSE_TICK_HOOK
114 #error Missing definition: configUSE_TICK_HOOK should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
117 #ifndef configUSE_CO_ROUTINES
118 #error Missing definition: configUSE_CO_ROUTINES should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
121 #ifndef INCLUDE_vTaskPrioritySet
122 #error Missing definition: INCLUDE_vTaskPrioritySet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
125 #ifndef INCLUDE_uxTaskPriorityGet
126 #error Missing definition: INCLUDE_uxTaskPriorityGet should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
129 #ifndef INCLUDE_vTaskDelete
130 #error Missing definition: INCLUDE_vTaskDelete should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
133 #ifndef INCLUDE_vTaskSuspend
134 #error Missing definition: INCLUDE_vTaskSuspend should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
137 #ifndef INCLUDE_vTaskDelayUntil
138 #error Missing definition: INCLUDE_vTaskDelayUntil should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
141 #ifndef INCLUDE_vTaskDelay
142 #error Missing definition: INCLUDE_vTaskDelay should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
145 #ifndef configUSE_16_BIT_TICKS
146 #error Missing definition: configUSE_16_BIT_TICKS should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
149 #ifndef INCLUDE_xTaskGetIdleTaskHandle
150 #define INCLUDE_xTaskGetIdleTaskHandle 0
153 #ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle
154 #define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
157 #ifndef INCLUDE_xQueueGetMutexHolder
158 #define INCLUDE_xQueueGetMutexHolder 0
161 #ifndef INCLUDE_xSemaphoreGetMutexHolder
162 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
165 #ifndef INCLUDE_pcTaskGetTaskName
166 #define INCLUDE_pcTaskGetTaskName 0
169 #ifndef configUSE_APPLICATION_TASK_TAG
170 #define configUSE_APPLICATION_TASK_TAG 0
173 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
174 #define INCLUDE_uxTaskGetStackHighWaterMark 0
177 #ifndef INCLUDE_eTaskGetState
178 #define INCLUDE_eTaskGetState 0
181 #ifndef configUSE_RECURSIVE_MUTEXES
182 #define configUSE_RECURSIVE_MUTEXES 0
185 #ifndef configUSE_MUTEXES
186 #define configUSE_MUTEXES 0
189 #ifndef configUSE_TIMERS
190 #define configUSE_TIMERS 0
193 #ifndef configUSE_COUNTING_SEMAPHORES
194 #define configUSE_COUNTING_SEMAPHORES 0
197 #ifndef configUSE_ALTERNATIVE_API
198 #define configUSE_ALTERNATIVE_API 0
201 #ifndef portCRITICAL_NESTING_IN_TCB
202 #define portCRITICAL_NESTING_IN_TCB 0
205 #ifndef configMAX_TASK_NAME_LEN
206 #define configMAX_TASK_NAME_LEN 16
209 #ifndef configIDLE_SHOULD_YIELD
210 #define configIDLE_SHOULD_YIELD 1
213 #if configMAX_TASK_NAME_LEN < 1
214 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
217 #ifndef INCLUDE_xTaskResumeFromISR
218 #define INCLUDE_xTaskResumeFromISR 1
222 #define configASSERT( x )
223 #define configASSERT_DEFINED 0
225 #define configASSERT_DEFINED 1
229 #if configUSE_TIMERS == 1
231 #ifndef configTIMER_TASK_PRIORITY
232 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
235 #ifndef configTIMER_QUEUE_LENGTH
236 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
239 #ifndef configTIMER_TASK_STACK_DEPTH
240 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
245 #ifndef INCLUDE_xTaskGetSchedulerState
246 #define INCLUDE_xTaskGetSchedulerState 0
249 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
250 #define INCLUDE_xTaskGetCurrentTaskHandle 0
254 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
255 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
258 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
259 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
262 #ifndef portCLEAN_UP_TCB
263 #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
266 #ifndef portSETUP_TCB
267 #define portSETUP_TCB( pxTCB ) ( void ) pxTCB
270 #ifndef configQUEUE_REGISTRY_SIZE
271 #define configQUEUE_REGISTRY_SIZE 0U
274 #if ( configQUEUE_REGISTRY_SIZE < 1 )
275 #define vQueueAddToRegistry( xQueue, pcName )
276 #define vQueueUnregisterQueue( xQueue )
279 #ifndef portPOINTER_SIZE_TYPE
280 #define portPOINTER_SIZE_TYPE unsigned long
296 #ifndef traceTASK_SWITCHED_IN
299 #define traceTASK_SWITCHED_IN()
302 #ifndef traceINCREASE_TICK_COUNT
305 #define traceINCREASE_TICK_COUNT( x )
308 #ifndef traceLOW_POWER_IDLE_BEGIN
310 #define traceLOW_POWER_IDLE_BEGIN()
313 #ifndef traceLOW_POWER_IDLE_END
315 #define traceLOW_POWER_IDLE_END()
318 #ifndef traceTASK_SWITCHED_OUT
321 #define traceTASK_SWITCHED_OUT()
324 #ifndef traceTASK_PRIORITY_INHERIT
330 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
333 #ifndef traceTASK_PRIORITY_DISINHERIT
338 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
341 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
346 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
349 #ifndef traceBLOCKING_ON_QUEUE_SEND
354 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
357 #ifndef configCHECK_FOR_STACK_OVERFLOW
358 #define configCHECK_FOR_STACK_OVERFLOW 0
363 #ifndef traceMOVED_TASK_TO_READY_STATE
364 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
367 #ifndef traceQUEUE_CREATE
368 #define traceQUEUE_CREATE( pxNewQueue )
371 #ifndef traceQUEUE_CREATE_FAILED
372 #define traceQUEUE_CREATE_FAILED( ucQueueType )
375 #ifndef traceCREATE_MUTEX
376 #define traceCREATE_MUTEX( pxNewQueue )
379 #ifndef traceCREATE_MUTEX_FAILED
380 #define traceCREATE_MUTEX_FAILED()
383 #ifndef traceGIVE_MUTEX_RECURSIVE
384 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
387 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
388 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
391 #ifndef traceTAKE_MUTEX_RECURSIVE
392 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
395 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
396 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
399 #ifndef traceCREATE_COUNTING_SEMAPHORE
400 #define traceCREATE_COUNTING_SEMAPHORE()
403 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
404 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
407 #ifndef traceQUEUE_SEND
408 #define traceQUEUE_SEND( pxQueue )
411 #ifndef traceQUEUE_SEND_FAILED
412 #define traceQUEUE_SEND_FAILED( pxQueue )
415 #ifndef traceQUEUE_RECEIVE
416 #define traceQUEUE_RECEIVE( pxQueue )
419 #ifndef traceQUEUE_PEEK
420 #define traceQUEUE_PEEK( pxQueue )
423 #ifndef traceQUEUE_PEEK_FROM_ISR
424 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
427 #ifndef traceQUEUE_RECEIVE_FAILED
428 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
431 #ifndef traceQUEUE_SEND_FROM_ISR
432 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
435 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
436 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
439 #ifndef traceQUEUE_RECEIVE_FROM_ISR
440 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
443 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
444 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
447 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
448 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
451 #ifndef traceQUEUE_DELETE
452 #define traceQUEUE_DELETE( pxQueue )
455 #ifndef traceTASK_CREATE
456 #define traceTASK_CREATE( pxNewTCB )
459 #ifndef traceTASK_CREATE_FAILED
460 #define traceTASK_CREATE_FAILED()
463 #ifndef traceTASK_DELETE
464 #define traceTASK_DELETE( pxTaskToDelete )
467 #ifndef traceTASK_DELAY_UNTIL
468 #define traceTASK_DELAY_UNTIL()
471 #ifndef traceTASK_DELAY
472 #define traceTASK_DELAY()
475 #ifndef traceTASK_PRIORITY_SET
476 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
479 #ifndef traceTASK_SUSPEND
480 #define traceTASK_SUSPEND( pxTaskToSuspend )
483 #ifndef traceTASK_RESUME
484 #define traceTASK_RESUME( pxTaskToResume )
487 #ifndef traceTASK_RESUME_FROM_ISR
488 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
491 #ifndef traceTASK_INCREMENT_TICK
492 #define traceTASK_INCREMENT_TICK( xTickCount )
495 #ifndef traceTIMER_CREATE
496 #define traceTIMER_CREATE( pxNewTimer )
499 #ifndef traceTIMER_CREATE_FAILED
500 #define traceTIMER_CREATE_FAILED()
503 #ifndef traceTIMER_COMMAND_SEND
504 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
507 #ifndef traceTIMER_EXPIRED
508 #define traceTIMER_EXPIRED( pxTimer )
511 #ifndef traceTIMER_COMMAND_RECEIVED
512 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
516 #define traceMALLOC( pvAddress, uiSize )
520 #define traceFREE( pvAddress, uiSize )
523 #ifndef configGENERATE_RUN_TIME_STATS
524 #define configGENERATE_RUN_TIME_STATS 0
527 #if ( configGENERATE_RUN_TIME_STATS == 1 )
529 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
530 #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.
533 #ifndef portGET_RUN_TIME_COUNTER_VALUE
534 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
535 #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.
541 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
542 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
545 #ifndef configUSE_MALLOC_FAILED_HOOK
546 #define configUSE_MALLOC_FAILED_HOOK 0
549 #ifndef portPRIVILEGE_BIT
550 #define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 )
553 #ifndef portYIELD_WITHIN_API
554 #define portYIELD_WITHIN_API portYIELD
557 #ifndef pvPortMallocAligned
558 #define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
561 #ifndef vPortFreeAligned
562 #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
565 #ifndef portSUPPRESS_TICKS_AND_SLEEP
566 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
569 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
570 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
573 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
574 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
577 #ifndef configUSE_TICKLESS_IDLE
578 #define configUSE_TICKLESS_IDLE 0
581 #ifndef configPRE_SLEEP_PROCESSING
582 #define configPRE_SLEEP_PROCESSING( x )
585 #ifndef configPOST_SLEEP_PROCESSING
586 #define configPOST_SLEEP_PROCESSING( x )
589 #ifndef configUSE_QUEUE_SETS
590 #define configUSE_QUEUE_SETS 0
593 #ifndef portTASK_USES_FLOATING_POINT
594 #define portTASK_USES_FLOATING_POINT()
597 #ifndef configUSE_TIME_SLICING
598 #define configUSE_TIME_SLICING 1
601 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
602 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
605 #ifndef configUSE_NEWLIB_REENTRANT
606 #define configUSE_NEWLIB_REENTRANT 0
609 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
610 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
613 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
614 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
618 #define eTaskStateGet eTaskGetState