2 FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.
5 ***************************************************************************
7 * FreeRTOS tutorial books are available in pdf and paperback. *
8 * Complete, revised, and edited pdf reference manuals are also *
11 * Purchasing FreeRTOS documentation will not only help you, by *
12 * ensuring you get running as quickly as possible and with an *
13 * in-depth knowledge of how to use FreeRTOS, it will also help *
14 * the FreeRTOS project to continue with its mission of providing *
15 * professional grade, cross platform, de facto standard solutions *
16 * for microcontrollers - completely free of charge! *
18 * >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
20 * Thank you for using FreeRTOS, and thank you for your support! *
22 ***************************************************************************
25 This file is part of the FreeRTOS distribution.
27 FreeRTOS is free software; you can redistribute it and/or modify it under
28 the terms of the GNU General Public License (version 2) as published by the
29 Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
30 >>>NOTE<<< The modification to the GPL is included to allow you to
31 distribute a combined work that includes FreeRTOS without being obliged to
32 provide the source code for proprietary components outside of the FreeRTOS
33 kernel. FreeRTOS is distributed in the hope that it will be useful, but
34 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
35 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
36 more details. You should have received a copy of the GNU General Public
37 License and the FreeRTOS license exception along with FreeRTOS; if not it
38 can be viewed here: http://www.freertos.org/a00114.html and also obtained
39 by writing to Richard Barry, contact details for whom are available on the
44 http://www.FreeRTOS.org - Documentation, latest information, license and
47 http://www.SafeRTOS.com - A version that is certified for use in safety
50 http://www.OpenRTOS.com - Commercial support, development, porting,
51 licensing and training services.
54 #ifndef INC_FREERTOS_H
55 #define INC_FREERTOS_H
59 * Include the generic headers required for the FreeRTOS port being used.
63 /* Basic FreeRTOS definitions. */
64 #include "os/projdefs.h"
66 /* Application specific configuration options. */
67 #include "os/FreeRTOSConfig.h"
69 /* Definitions specific to the port being used. */
70 #include "os/portable.h"
72 /* Definitions specific R4 core. */
73 #include "sys/sys_core.h"
75 /* Defines the prototype to which the application task hook function must
77 typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
84 * Check all the required application specific macros have been defined.
85 * These macros are application specific and (as downloaded) are defined
86 * within FreeRTOSConfig.h.
89 #ifndef configUSE_PREEMPTION
90 #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.
93 #ifndef configUSE_IDLE_HOOK
94 #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.
97 #ifndef configUSE_TICK_HOOK
98 #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.
101 #ifndef configUSE_CO_ROUTINES
102 #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.
105 #ifndef INCLUDE_vTaskPrioritySet
106 #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.
109 #ifndef INCLUDE_uxTaskPriorityGet
110 #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.
113 #ifndef INCLUDE_vTaskDelete
114 #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.
117 #ifndef INCLUDE_vTaskSuspend
118 #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.
121 #ifndef INCLUDE_vTaskDelayUntil
122 #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.
125 #ifndef INCLUDE_vTaskDelay
126 #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.
129 #ifndef configUSE_16_BIT_TICKS
130 #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.
133 #ifndef INCLUDE_xTaskGetIdleTaskHandle
134 #define INCLUDE_xTaskGetIdleTaskHandle 0
137 #ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle
138 #define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
141 #ifndef INCLUDE_pcTaskGetTaskName
142 #define INCLUDE_pcTaskGetTaskName 0
145 #ifndef configUSE_APPLICATION_TASK_TAG
146 #define configUSE_APPLICATION_TASK_TAG 0
149 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
150 #define INCLUDE_uxTaskGetStackHighWaterMark 0
153 #ifndef configUSE_RECURSIVE_MUTEXES
154 #define configUSE_RECURSIVE_MUTEXES 0
157 #ifndef configUSE_MUTEXES
158 #define configUSE_MUTEXES 0
161 #ifndef configUSE_TIMERS
162 #define configUSE_TIMERS 0
165 #ifndef configUSE_COUNTING_SEMAPHORES
166 #define configUSE_COUNTING_SEMAPHORES 0
169 #ifndef configUSE_ALTERNATIVE_API
170 #define configUSE_ALTERNATIVE_API 0
173 #ifndef portCRITICAL_NESTING_IN_TCB
174 #define portCRITICAL_NESTING_IN_TCB 0
177 #ifndef configMAX_TASK_NAME_LEN
178 #define configMAX_TASK_NAME_LEN 16
181 #ifndef configIDLE_SHOULD_YIELD
182 #define configIDLE_SHOULD_YIELD 1
185 #if configMAX_TASK_NAME_LEN < 1
186 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
189 #ifndef INCLUDE_xTaskResumeFromISR
190 #define INCLUDE_xTaskResumeFromISR 1
194 #define configASSERT( x )
197 /* The timers module relies on xTaskGetSchedulerState(). */
198 #if configUSE_TIMERS == 1
200 #ifndef configTIMER_TASK_PRIORITY
201 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
202 #endif /* configTIMER_TASK_PRIORITY */
204 #ifndef configTIMER_QUEUE_LENGTH
205 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
206 #endif /* configTIMER_QUEUE_LENGTH */
208 #ifndef configTIMER_TASK_STACK_DEPTH
209 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
210 #endif /* configTIMER_TASK_STACK_DEPTH */
212 #endif /* configUSE_TIMERS */
214 #ifndef INCLUDE_xTaskGetSchedulerState
215 #define INCLUDE_xTaskGetSchedulerState 0
218 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
219 #define INCLUDE_xTaskGetCurrentTaskHandle 0
223 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
224 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
227 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
228 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
232 #ifndef configQUEUE_REGISTRY_SIZE
233 #define configQUEUE_REGISTRY_SIZE 0U
236 #if ( configQUEUE_REGISTRY_SIZE < 1 )
237 #define vQueueAddToRegistry( xQueue, pcName )
238 #define vQueueUnregisterQueue( xQueue )
241 #ifndef portPOINTER_SIZE_TYPE
242 #define portPOINTER_SIZE_TYPE unsigned long
245 /* Remove any unused trace macros. */
247 /* Used to perform any necessary initialisation - for example, open a file
248 into which trace is to be written. */
253 /* Use to close a trace, for example close a file into which trace has been
258 #ifndef traceTASK_SWITCHED_IN
259 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
260 to the task control block of the selected task. */
261 #define traceTASK_SWITCHED_IN()
264 #ifndef traceTASK_SWITCHED_OUT
265 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
266 to the task control block of the task being switched out. */
267 #define traceTASK_SWITCHED_OUT()
270 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
271 /* Task is about to block because it cannot read from a
272 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
273 upon which the read was attempted. pxCurrentTCB points to the TCB of the
274 task that attempted the read. */
275 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
278 #ifndef traceBLOCKING_ON_QUEUE_SEND
279 /* Task is about to block because it cannot write to a
280 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
281 upon which the write was attempted. pxCurrentTCB points to the TCB of the
282 task that attempted the write. */
283 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
286 #ifndef configCHECK_FOR_STACK_OVERFLOW
287 #define configCHECK_FOR_STACK_OVERFLOW 0
290 /* The following event macros are embedded in the kernel API calls. */
292 #ifndef traceQUEUE_CREATE
293 #define traceQUEUE_CREATE( pxNewQueue )
296 #ifndef traceQUEUE_CREATE_FAILED
297 #define traceQUEUE_CREATE_FAILED()
300 #ifndef traceCREATE_MUTEX
301 #define traceCREATE_MUTEX( pxNewQueue )
304 #ifndef traceCREATE_MUTEX_FAILED
305 #define traceCREATE_MUTEX_FAILED()
308 #ifndef traceGIVE_MUTEX_RECURSIVE
309 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
312 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
313 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
316 #ifndef traceTAKE_MUTEX_RECURSIVE
317 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
320 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
321 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
324 #ifndef traceCREATE_COUNTING_SEMAPHORE
325 #define traceCREATE_COUNTING_SEMAPHORE()
328 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
329 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
332 #ifndef traceQUEUE_SEND
333 #define traceQUEUE_SEND( pxQueue )
336 #ifndef traceQUEUE_SEND_FAILED
337 #define traceQUEUE_SEND_FAILED( pxQueue )
340 #ifndef traceQUEUE_RECEIVE
341 #define traceQUEUE_RECEIVE( pxQueue )
344 #ifndef traceQUEUE_PEEK
345 #define traceQUEUE_PEEK( pxQueue )
348 #ifndef traceQUEUE_RECEIVE_FAILED
349 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
352 #ifndef traceQUEUE_SEND_FROM_ISR
353 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
356 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
357 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
360 #ifndef traceQUEUE_RECEIVE_FROM_ISR
361 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
364 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
365 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
368 #ifndef traceQUEUE_DELETE
369 #define traceQUEUE_DELETE( pxQueue )
372 #ifndef traceTASK_CREATE
373 #define traceTASK_CREATE( pxNewTCB )
376 #ifndef traceTASK_CREATE_FAILED
377 #define traceTASK_CREATE_FAILED()
380 #ifndef traceTASK_DELETE
381 #define traceTASK_DELETE( pxTaskToDelete )
384 #ifndef traceTASK_DELAY_UNTIL
385 #define traceTASK_DELAY_UNTIL()
388 #ifndef traceTASK_DELAY
389 #define traceTASK_DELAY()
392 #ifndef traceTASK_PRIORITY_SET
393 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
396 #ifndef traceTASK_SUSPEND
397 #define traceTASK_SUSPEND( pxTaskToSuspend )
400 #ifndef traceTASK_RESUME
401 #define traceTASK_RESUME( pxTaskToResume )
404 #ifndef traceTASK_RESUME_FROM_ISR
405 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
408 #ifndef traceTASK_INCREMENT_TICK
409 #define traceTASK_INCREMENT_TICK( xTickCount )
412 #ifndef traceTIMER_CREATE
413 #define traceTIMER_CREATE( pxNewTimer )
416 #ifndef traceTIMER_CREATE_FAILED
417 #define traceTIMER_CREATE_FAILED()
420 #ifndef traceTIMER_COMMAND_SEND
421 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
424 #ifndef traceTIMER_EXPIRED
425 #define traceTIMER_EXPIRED( pxTimer )
428 #ifndef traceTIMER_COMMAND_RECEIVED
429 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
432 #ifndef configGENERATE_RUN_TIME_STATS
433 #define configGENERATE_RUN_TIME_STATS 0
436 #if ( configGENERATE_RUN_TIME_STATS == 1 )
438 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
439 #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.
440 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
442 #ifndef portGET_RUN_TIME_COUNTER_VALUE
443 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
444 #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.
445 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
446 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
448 #endif /* configGENERATE_RUN_TIME_STATS */
450 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
451 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
454 #ifndef configUSE_MALLOC_FAILED_HOOK
455 #define configUSE_MALLOC_FAILED_HOOK 0
458 #ifndef portPRIVILEGE_BIT
459 #define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 )
462 #ifndef portYIELD_WITHIN_API
463 #define portYIELD_WITHIN_API portYIELD
466 #ifndef pvPortMallocAligned
467 #define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
470 #ifndef vPortFreeAligned
471 #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
474 #endif /* INC_FREERTOS_H */