2 FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
4 ***************************************************************************
9 * + Wanting to learn FreeRTOS or multitasking in general quickly *
10 * + Looking for basic training, *
11 * + Wanting to improve your FreeRTOS skills and productivity *
13 * then take a look at the FreeRTOS eBook *
15 * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
16 * http://www.FreeRTOS.org/Documentation *
18 * A pdf reference manual is also available. Both are usually delivered *
19 * to your inbox within 20 minutes to two hours when purchased between 8am *
20 * and 8pm GMT (although please allow up to 24 hours in case of *
21 * exceptional circumstances). Thank you for your support! *
23 ***************************************************************************
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 exception to the GPL is included to allow you to distribute
31 a combined work that includes FreeRTOS without being obliged to provide the
32 source code for proprietary components outside of the FreeRTOS kernel.
33 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
34 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35 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. */
66 /* Application specific configuration options. */
67 #include "FreeRTOSConfig.h"
69 /* Definitions specific to the port being used. */
73 /* Defines the prototype to which the application task hook function must
75 typedef portBASE_TYPE (*pdTASK_HOOK_CODE
)( void * );
82 * Check all the required application specific macros have been defined.
83 * These macros are application specific and (as downloaded) are defined
84 * within FreeRTOSConfig.h.
87 #ifndef configUSE_PREEMPTION
88 #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.
91 #ifndef configUSE_IDLE_HOOK
92 #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.
95 #ifndef configUSE_TICK_HOOK
96 #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.
99 #ifndef configUSE_CO_ROUTINES
100 #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.
103 #ifndef INCLUDE_vTaskPrioritySet
104 #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.
107 #ifndef INCLUDE_uxTaskPriorityGet
108 #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.
111 #ifndef INCLUDE_vTaskDelete
112 #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.
115 #ifndef INCLUDE_vTaskCleanUpResources
116 #error Missing definition: INCLUDE_vTaskCleanUpResources should be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
119 #ifndef INCLUDE_vTaskSuspend
120 #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.
123 #ifndef INCLUDE_vTaskDelayUntil
124 #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.
127 #ifndef INCLUDE_vTaskDelay
128 #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.
131 #ifndef configUSE_16_BIT_TICKS
132 #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.
135 #ifndef configUSE_APPLICATION_TASK_TAG
136 #define configUSE_APPLICATION_TASK_TAG 0
139 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
140 #define INCLUDE_uxTaskGetStackHighWaterMark 0
143 #ifndef configUSE_RECURSIVE_MUTEXES
144 #define configUSE_RECURSIVE_MUTEXES 0
147 #ifndef configUSE_MUTEXES
148 #define configUSE_MUTEXES 0
151 #ifndef configUSE_COUNTING_SEMAPHORES
152 #define configUSE_COUNTING_SEMAPHORES 0
155 #ifndef configUSE_ALTERNATIVE_API
156 #define configUSE_ALTERNATIVE_API 0
159 #ifndef portCRITICAL_NESTING_IN_TCB
160 #define portCRITICAL_NESTING_IN_TCB 0
163 #ifndef configMAX_TASK_NAME_LEN
164 #define configMAX_TASK_NAME_LEN 16
167 #ifndef configIDLE_SHOULD_YIELD
168 #define configIDLE_SHOULD_YIELD 1
171 #if configMAX_TASK_NAME_LEN < 1
172 #undef configMAX_TASK_NAME_LEN
173 #define configMAX_TASK_NAME_LEN 1
176 #ifndef INCLUDE_xTaskResumeFromISR
177 #define INCLUDE_xTaskResumeFromISR 1
180 #ifndef INCLUDE_xTaskGetSchedulerState
181 #define INCLUDE_xTaskGetSchedulerState 0
184 #if ( configUSE_MUTEXES == 1 )
185 /* xTaskGetCurrentTaskHandle is used by the priority inheritance mechanism
186 within the mutex implementation so must be available if mutexes are used. */
187 #undef INCLUDE_xTaskGetCurrentTaskHandle
188 #define INCLUDE_xTaskGetCurrentTaskHandle 1
190 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
191 #define INCLUDE_xTaskGetCurrentTaskHandle 0
196 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
197 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
200 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
201 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
205 #ifndef configQUEUE_REGISTRY_SIZE
206 #define configQUEUE_REGISTRY_SIZE 0
209 #if configQUEUE_REGISTRY_SIZE < 1
210 #define configQUEUE_REGISTRY_SIZE 0
211 #define vQueueAddToRegistry( xQueue, pcName )
212 #define vQueueUnregisterQueue( xQueue )
216 /* Remove any unused trace macros. */
218 /* Used to perform any necessary initialisation - for example, open a file
219 into which trace is to be written. */
224 /* Use to close a trace, for example close a file into which trace has been
229 #ifndef traceTASK_SWITCHED_IN
230 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
231 to the task control block of the selected task. */
232 #define traceTASK_SWITCHED_IN()
235 #ifndef traceTASK_SWITCHED_OUT
236 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
237 to the task control block of the task being switched out. */
238 #define traceTASK_SWITCHED_OUT()
241 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
242 /* Task is about to block because it cannot read from a
243 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
244 upon which the read was attempted. pxCurrentTCB points to the TCB of the
245 task that attempted the read. */
246 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
249 #ifndef traceBLOCKING_ON_QUEUE_SEND
250 /* Task is about to block because it cannot write to a
251 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
252 upon which the write was attempted. pxCurrentTCB points to the TCB of the
253 task that attempted the write. */
254 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
257 #ifndef configCHECK_FOR_STACK_OVERFLOW
258 #define configCHECK_FOR_STACK_OVERFLOW 0
261 /* The following event macros are embedded in the kernel API calls. */
263 #ifndef traceQUEUE_CREATE
264 #define traceQUEUE_CREATE( pxNewQueue )
267 #ifndef traceQUEUE_CREATE_FAILED
268 #define traceQUEUE_CREATE_FAILED()
271 #ifndef traceCREATE_MUTEX
272 #define traceCREATE_MUTEX( pxNewQueue )
275 #ifndef traceCREATE_MUTEX_FAILED
276 #define traceCREATE_MUTEX_FAILED()
279 #ifndef traceGIVE_MUTEX_RECURSIVE
280 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
283 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
284 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
287 #ifndef traceTAKE_MUTEX_RECURSIVE
288 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
291 #ifndef traceCREATE_COUNTING_SEMAPHORE
292 #define traceCREATE_COUNTING_SEMAPHORE()
295 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
296 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
299 #ifndef traceQUEUE_SEND
300 #define traceQUEUE_SEND( pxQueue )
303 #ifndef traceQUEUE_SEND_FAILED
304 #define traceQUEUE_SEND_FAILED( pxQueue )
307 #ifndef traceQUEUE_RECEIVE
308 #define traceQUEUE_RECEIVE( pxQueue )
311 #ifndef traceQUEUE_PEEK
312 #define traceQUEUE_PEEK( pxQueue )
315 #ifndef traceQUEUE_RECEIVE_FAILED
316 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
319 #ifndef traceQUEUE_SEND_FROM_ISR
320 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
323 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
324 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
327 #ifndef traceQUEUE_RECEIVE_FROM_ISR
328 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
331 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
332 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
335 #ifndef traceQUEUE_DELETE
336 #define traceQUEUE_DELETE( pxQueue )
339 #ifndef traceTASK_CREATE
340 #define traceTASK_CREATE( pxNewTCB )
343 #ifndef traceTASK_CREATE_FAILED
344 #define traceTASK_CREATE_FAILED( pxNewTCB )
347 #ifndef traceTASK_DELETE
348 #define traceTASK_DELETE( pxTaskToDelete )
351 #ifndef traceTASK_DELAY_UNTIL
352 #define traceTASK_DELAY_UNTIL()
355 #ifndef traceTASK_DELAY
356 #define traceTASK_DELAY()
359 #ifndef traceTASK_PRIORITY_SET
360 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
363 #ifndef traceTASK_SUSPEND
364 #define traceTASK_SUSPEND( pxTaskToSuspend )
367 #ifndef traceTASK_RESUME
368 #define traceTASK_RESUME( pxTaskToResume )
371 #ifndef traceTASK_RESUME_FROM_ISR
372 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
375 #ifndef traceTASK_INCREMENT_TICK
376 #define traceTASK_INCREMENT_TICK( xTickCount )
379 #ifndef configGENERATE_RUN_TIME_STATS
380 #define configGENERATE_RUN_TIME_STATS 0
383 #if ( configGENERATE_RUN_TIME_STATS == 1 )
385 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
386 #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.
387 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
389 #ifndef portGET_RUN_TIME_COUNTER_VALUE
390 #error If configGENERATE_RUN_TIME_STATS is defined then portGET_RUN_TIME_COUNTER_VALUE must also be defined. portGET_RUN_TIME_COUNTER_VALUE should evaluate to the counter value of the timer/counter peripheral used as the run time counter time base.
391 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
393 #endif /* configGENERATE_RUN_TIME_STATS */
395 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
396 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
399 #ifndef configUSE_MALLOC_FAILED_HOOK
400 #define configUSE_MALLOC_FAILED_HOOK 0
403 #ifndef portPRIVILEGE_BIT
404 #define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 )
407 #ifndef portYIELD_WITHIN_API
408 #define portYIELD_WITHIN_API portYIELD
411 #ifndef pvPortMallocAligned
412 #define pvPortMallocAligned( x, puxStackBuffer ) ( ( puxStackBuffer == NULL ) ? ( pvPortMalloc( x ) ) : ( puxStackBuffer ) )
415 #ifndef vPortFreeAligned
416 #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
419 #endif /* INC_FREERTOS_H */