FreeRTOS
[armadillo_firmware.git] / FreeRTOS / Source / include / FreeRTOS.h
blob0ad67f4c3f0d054794c9e624c8afd2366206d87b
1 /*
2 FreeRTOS V6.0.5 - Copyright (C) 2010 Real Time Engineers Ltd.
4 ***************************************************************************
5 * *
6 * If you are: *
7 * *
8 * + New to FreeRTOS, *
9 * + Wanting to learn FreeRTOS or multitasking in general quickly *
10 * + Looking for basic training, *
11 * + Wanting to improve your FreeRTOS skills and productivity *
12 * *
13 * then take a look at the FreeRTOS eBook *
14 * *
15 * "Using the FreeRTOS Real Time Kernel - a Practical Guide" *
16 * http://www.FreeRTOS.org/Documentation *
17 * *
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! *
22 * *
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
40 FreeRTOS WEB site.
42 1 tab == 4 spaces!
44 http://www.FreeRTOS.org - Documentation, latest information, license and
45 contact details.
47 http://www.SafeRTOS.com - A version that is certified for use in safety
48 critical systems.
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.
61 #include <stddef.h>
63 /* Basic FreeRTOS definitions. */
64 #include "projdefs.h"
66 /* Application specific configuration options. */
67 #include "FreeRTOSConfig.h"
69 /* Definitions specific to the port being used. */
70 #include "portable.h"
73 /* Defines the prototype to which the application task hook function must
74 conform. */
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.
89 #endif
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.
93 #endif
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.
97 #endif
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.
101 #endif
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.
105 #endif
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.
109 #endif
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.
113 #endif
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.
117 #endif
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.
121 #endif
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.
125 #endif
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.
129 #endif
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.
133 #endif
135 #ifndef configUSE_APPLICATION_TASK_TAG
136 #define configUSE_APPLICATION_TASK_TAG 0
137 #endif
139 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
140 #define INCLUDE_uxTaskGetStackHighWaterMark 0
141 #endif
143 #ifndef configUSE_RECURSIVE_MUTEXES
144 #define configUSE_RECURSIVE_MUTEXES 0
145 #endif
147 #ifndef configUSE_MUTEXES
148 #define configUSE_MUTEXES 0
149 #endif
151 #ifndef configUSE_COUNTING_SEMAPHORES
152 #define configUSE_COUNTING_SEMAPHORES 0
153 #endif
155 #ifndef configUSE_ALTERNATIVE_API
156 #define configUSE_ALTERNATIVE_API 0
157 #endif
159 #ifndef portCRITICAL_NESTING_IN_TCB
160 #define portCRITICAL_NESTING_IN_TCB 0
161 #endif
163 #ifndef configMAX_TASK_NAME_LEN
164 #define configMAX_TASK_NAME_LEN 16
165 #endif
167 #ifndef configIDLE_SHOULD_YIELD
168 #define configIDLE_SHOULD_YIELD 1
169 #endif
171 #if configMAX_TASK_NAME_LEN < 1
172 #undef configMAX_TASK_NAME_LEN
173 #define configMAX_TASK_NAME_LEN 1
174 #endif
176 #ifndef INCLUDE_xTaskResumeFromISR
177 #define INCLUDE_xTaskResumeFromISR 1
178 #endif
180 #ifndef INCLUDE_xTaskGetSchedulerState
181 #define INCLUDE_xTaskGetSchedulerState 0
182 #endif
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
189 #else
190 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
191 #define INCLUDE_xTaskGetCurrentTaskHandle 0
192 #endif
193 #endif
196 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
197 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
198 #endif
200 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
201 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
202 #endif
205 #ifndef configQUEUE_REGISTRY_SIZE
206 #define configQUEUE_REGISTRY_SIZE 0
207 #endif
209 #if configQUEUE_REGISTRY_SIZE < 1
210 #define configQUEUE_REGISTRY_SIZE 0
211 #define vQueueAddToRegistry( xQueue, pcName )
212 #define vQueueUnregisterQueue( xQueue )
213 #endif
216 /* Remove any unused trace macros. */
217 #ifndef traceSTART
218 /* Used to perform any necessary initialisation - for example, open a file
219 into which trace is to be written. */
220 #define traceSTART()
221 #endif
223 #ifndef traceEND
224 /* Use to close a trace, for example close a file into which trace has been
225 written. */
226 #define traceEND()
227 #endif
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()
233 #endif
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()
239 #endif
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 )
247 #endif
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 )
255 #endif
257 #ifndef configCHECK_FOR_STACK_OVERFLOW
258 #define configCHECK_FOR_STACK_OVERFLOW 0
259 #endif
261 /* The following event macros are embedded in the kernel API calls. */
263 #ifndef traceQUEUE_CREATE
264 #define traceQUEUE_CREATE( pxNewQueue )
265 #endif
267 #ifndef traceQUEUE_CREATE_FAILED
268 #define traceQUEUE_CREATE_FAILED()
269 #endif
271 #ifndef traceCREATE_MUTEX
272 #define traceCREATE_MUTEX( pxNewQueue )
273 #endif
275 #ifndef traceCREATE_MUTEX_FAILED
276 #define traceCREATE_MUTEX_FAILED()
277 #endif
279 #ifndef traceGIVE_MUTEX_RECURSIVE
280 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
281 #endif
283 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
284 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
285 #endif
287 #ifndef traceTAKE_MUTEX_RECURSIVE
288 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
289 #endif
291 #ifndef traceCREATE_COUNTING_SEMAPHORE
292 #define traceCREATE_COUNTING_SEMAPHORE()
293 #endif
295 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
296 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
297 #endif
299 #ifndef traceQUEUE_SEND
300 #define traceQUEUE_SEND( pxQueue )
301 #endif
303 #ifndef traceQUEUE_SEND_FAILED
304 #define traceQUEUE_SEND_FAILED( pxQueue )
305 #endif
307 #ifndef traceQUEUE_RECEIVE
308 #define traceQUEUE_RECEIVE( pxQueue )
309 #endif
311 #ifndef traceQUEUE_PEEK
312 #define traceQUEUE_PEEK( pxQueue )
313 #endif
315 #ifndef traceQUEUE_RECEIVE_FAILED
316 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
317 #endif
319 #ifndef traceQUEUE_SEND_FROM_ISR
320 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
321 #endif
323 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
324 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
325 #endif
327 #ifndef traceQUEUE_RECEIVE_FROM_ISR
328 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
329 #endif
331 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
332 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
333 #endif
335 #ifndef traceQUEUE_DELETE
336 #define traceQUEUE_DELETE( pxQueue )
337 #endif
339 #ifndef traceTASK_CREATE
340 #define traceTASK_CREATE( pxNewTCB )
341 #endif
343 #ifndef traceTASK_CREATE_FAILED
344 #define traceTASK_CREATE_FAILED( pxNewTCB )
345 #endif
347 #ifndef traceTASK_DELETE
348 #define traceTASK_DELETE( pxTaskToDelete )
349 #endif
351 #ifndef traceTASK_DELAY_UNTIL
352 #define traceTASK_DELAY_UNTIL()
353 #endif
355 #ifndef traceTASK_DELAY
356 #define traceTASK_DELAY()
357 #endif
359 #ifndef traceTASK_PRIORITY_SET
360 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
361 #endif
363 #ifndef traceTASK_SUSPEND
364 #define traceTASK_SUSPEND( pxTaskToSuspend )
365 #endif
367 #ifndef traceTASK_RESUME
368 #define traceTASK_RESUME( pxTaskToResume )
369 #endif
371 #ifndef traceTASK_RESUME_FROM_ISR
372 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
373 #endif
375 #ifndef traceTASK_INCREMENT_TICK
376 #define traceTASK_INCREMENT_TICK( xTickCount )
377 #endif
379 #ifndef configGENERATE_RUN_TIME_STATS
380 #define configGENERATE_RUN_TIME_STATS 0
381 #endif
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()
397 #endif
399 #ifndef configUSE_MALLOC_FAILED_HOOK
400 #define configUSE_MALLOC_FAILED_HOOK 0
401 #endif
403 #ifndef portPRIVILEGE_BIT
404 #define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 )
405 #endif
407 #ifndef portYIELD_WITHIN_API
408 #define portYIELD_WITHIN_API portYIELD
409 #endif
411 #ifndef pvPortMallocAligned
412 #define pvPortMallocAligned( x, puxStackBuffer ) ( ( puxStackBuffer == NULL ) ? ( pvPortMalloc( x ) ) : ( puxStackBuffer ) )
413 #endif
415 #ifndef vPortFreeAligned
416 #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
417 #endif
419 #endif /* INC_FREERTOS_H */