]> begriffs open source - freertos/blob - Source/include/FreeRTOS.h
Update to V5.1.2.
[freertos] / Source / include / FreeRTOS.h
1 /*\r
2         FreeRTOS.org V5.1.2 - Copyright (C) 2003-2009 Richard Barry.\r
3 \r
4         This file is part of the FreeRTOS.org distribution.\r
5 \r
6         FreeRTOS.org is free software; you can redistribute it and/or modify\r
7         it under the terms of the GNU General Public License as published by\r
8         the Free Software Foundation; either version 2 of the License, or\r
9         (at your option) any later version.\r
10 \r
11         FreeRTOS.org is distributed in the hope that it will be useful,\r
12         but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14         GNU General Public License for more details.\r
15 \r
16         You should have received a copy of the GNU General Public License\r
17         along with FreeRTOS.org; if not, write to the Free Software\r
18         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19 \r
20         A special exception to the GPL can be applied should you wish to distribute\r
21         a combined work that includes FreeRTOS.org, without being obliged to provide\r
22         the source code for any proprietary components.  See the licensing section\r
23         of http://www.FreeRTOS.org for full details of how and when the exception\r
24         can be applied.\r
25 \r
26     ***************************************************************************\r
27     ***************************************************************************\r
28     *                                                                         *\r
29     * Get the FreeRTOS eBook!  See http://www.FreeRTOS.org/Documentation      *\r
30         *                                                                         *\r
31         * This is a concise, step by step, 'hands on' guide that describes both   *\r
32         * general multitasking concepts and FreeRTOS specifics. It presents and   *\r
33         * explains numerous examples that are written using the FreeRTOS API.     *\r
34         * Full source code for all the examples is provided in an accompanying    *\r
35         * .zip file.                                                              *\r
36     *                                                                         *\r
37     ***************************************************************************\r
38     ***************************************************************************\r
39 \r
40         Please ensure to read the configuration and relevant port sections of the\r
41         online documentation.\r
42 \r
43         http://www.FreeRTOS.org - Documentation, latest information, license and \r
44         contact details.\r
45 \r
46         http://www.SafeRTOS.com - A version that is certified for use in safety \r
47         critical systems.\r
48 \r
49         http://www.OpenRTOS.com - Commercial support, development, porting, \r
50         licensing and training services.\r
51 */\r
52 \r
53 #ifndef INC_FREERTOS_H\r
54 #define INC_FREERTOS_H\r
55 \r
56 \r
57 /*\r
58  * Include the generic headers required for the FreeRTOS port being used.\r
59  */\r
60 #include <stddef.h>\r
61 \r
62 /* Basic FreeRTOS definitions. */\r
63 #include "projdefs.h"\r
64 \r
65 /* Application specific configuration options. */\r
66 #include "FreeRTOSConfig.h"\r
67 \r
68 /* Definitions specific to the port being used. */\r
69 #include "portable.h"\r
70 \r
71 \r
72 /* Defines the prototype to which the application task hook function must\r
73 conform. */\r
74 typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );\r
75 \r
76 \r
77 \r
78 \r
79 \r
80 /*\r
81  * Check all the required application specific macros have been defined.\r
82  * These macros are application specific and (as downloaded) are defined\r
83  * within FreeRTOSConfig.h.\r
84  */\r
85 \r
86 #ifndef configUSE_PREEMPTION\r
87         #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.\r
88 #endif\r
89 \r
90 #ifndef configUSE_IDLE_HOOK\r
91         #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.\r
92 #endif\r
93 \r
94 #ifndef configUSE_TICK_HOOK\r
95         #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.\r
96 #endif\r
97 \r
98 #ifndef configUSE_CO_ROUTINES\r
99         #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.\r
100 #endif\r
101 \r
102 #ifndef INCLUDE_vTaskPrioritySet\r
103         #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.\r
104 #endif\r
105 \r
106 #ifndef INCLUDE_uxTaskPriorityGet\r
107         #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.\r
108 #endif\r
109 \r
110 #ifndef INCLUDE_vTaskDelete             \r
111         #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.\r
112 #endif\r
113 \r
114 #ifndef INCLUDE_vTaskCleanUpResources\r
115         #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.\r
116 #endif\r
117 \r
118 #ifndef INCLUDE_vTaskSuspend    \r
119         #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.\r
120 #endif\r
121 \r
122 #ifndef INCLUDE_vTaskDelayUntil\r
123         #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.\r
124 #endif\r
125 \r
126 #ifndef INCLUDE_vTaskDelay\r
127         #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.\r
128 #endif\r
129 \r
130 #ifndef configUSE_16_BIT_TICKS\r
131         #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.\r
132 #endif\r
133 \r
134 #ifndef configUSE_APPLICATION_TASK_TAG\r
135         #define configUSE_APPLICATION_TASK_TAG 0\r
136 #endif\r
137 \r
138 #ifndef INCLUDE_uxTaskGetStackHighWaterMark\r
139         #define INCLUDE_uxTaskGetStackHighWaterMark 0\r
140 #endif\r
141 \r
142 #ifndef configUSE_RECURSIVE_MUTEXES\r
143         #define configUSE_RECURSIVE_MUTEXES 0\r
144 #endif\r
145 \r
146 #ifndef configUSE_MUTEXES\r
147         #define configUSE_MUTEXES 0\r
148 #endif\r
149 \r
150 #ifndef configUSE_COUNTING_SEMAPHORES\r
151         #define configUSE_COUNTING_SEMAPHORES 0\r
152 #endif\r
153 \r
154 #ifndef configUSE_ALTERNATIVE_API\r
155         #define configUSE_ALTERNATIVE_API 0\r
156 #endif\r
157 \r
158 #ifndef portCRITICAL_NESTING_IN_TCB\r
159         #define portCRITICAL_NESTING_IN_TCB 0\r
160 #endif\r
161 \r
162 #ifndef configMAX_TASK_NAME_LEN\r
163         #define configMAX_TASK_NAME_LEN 16\r
164 #endif\r
165 \r
166 #ifndef configIDLE_SHOULD_YIELD\r
167         #define configIDLE_SHOULD_YIELD         1\r
168 #endif\r
169 \r
170 #if configMAX_TASK_NAME_LEN < 1\r
171         #undef configMAX_TASK_NAME_LEN\r
172         #define configMAX_TASK_NAME_LEN 1\r
173 #endif\r
174 \r
175 #ifndef INCLUDE_xTaskResumeFromISR\r
176         #define INCLUDE_xTaskResumeFromISR 1\r
177 #endif\r
178 \r
179 #ifndef INCLUDE_xTaskGetSchedulerState\r
180         #define INCLUDE_xTaskGetSchedulerState 0\r
181 #endif\r
182 \r
183 #if ( configUSE_MUTEXES == 1 )\r
184         /* xTaskGetCurrentTaskHandle is used by the priority inheritance mechanism\r
185         within the mutex implementation so must be available if mutexes are used. */\r
186         #undef INCLUDE_xTaskGetCurrentTaskHandle\r
187         #define INCLUDE_xTaskGetCurrentTaskHandle 1\r
188 #else\r
189         #ifndef INCLUDE_xTaskGetCurrentTaskHandle\r
190                 #define INCLUDE_xTaskGetCurrentTaskHandle 0\r
191         #endif\r
192 #endif\r
193 \r
194 \r
195 #ifndef portSET_INTERRUPT_MASK_FROM_ISR\r
196         #define portSET_INTERRUPT_MASK_FROM_ISR() 0\r
197 #endif\r
198 \r
199 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR\r
200         #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue\r
201 #endif\r
202 \r
203 \r
204 #ifndef configQUEUE_REGISTRY_SIZE\r
205         #define configQUEUE_REGISTRY_SIZE 0\r
206 #endif\r
207 \r
208 #if configQUEUE_REGISTRY_SIZE < 1\r
209         #define configQUEUE_REGISTRY_SIZE 0\r
210         #define vQueueAddToRegistry( xQueue, pcName )\r
211         #define vQueueUnregisterQueue( xQueue )\r
212 #endif\r
213 \r
214 \r
215 /* Remove any unused trace macros. */\r
216 #ifndef traceSTART\r
217         /* Used to perform any necessary initialisation - for example, open a file\r
218         into which trace is to be written. */\r
219         #define traceSTART()\r
220 #endif\r
221 \r
222 #ifndef traceEND\r
223         /* Use to close a trace, for example close a file into which trace has been\r
224         written. */\r
225         #define traceEND()\r
226 #endif\r
227 \r
228 #ifndef traceTASK_SWITCHED_IN\r
229         /* Called after a task has been selected to run.  pxCurrentTCB holds a pointer\r
230         to the task control block of the selected task. */\r
231         #define traceTASK_SWITCHED_IN()\r
232 #endif\r
233 \r
234 #ifndef traceTASK_SWITCHED_OUT\r
235         /* Called before a task has been selected to run.  pxCurrentTCB holds a pointer\r
236         to the task control block of the task being switched out. */\r
237         #define traceTASK_SWITCHED_OUT()\r
238 #endif\r
239 \r
240 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE\r
241         /* Task is about to block because it cannot read from a \r
242         queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore\r
243         upon which the read was attempted.  pxCurrentTCB points to the TCB of the \r
244         task that attempted the read. */\r
245         #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )\r
246 #endif\r
247 \r
248 #ifndef traceBLOCKING_ON_QUEUE_SEND\r
249         /* Task is about to block because it cannot write to a \r
250         queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore\r
251         upon which the write was attempted.  pxCurrentTCB points to the TCB of the \r
252         task that attempted the write. */\r
253         #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )\r
254 #endif\r
255 \r
256 #ifndef configCHECK_FOR_STACK_OVERFLOW\r
257         #define configCHECK_FOR_STACK_OVERFLOW 0\r
258 #endif\r
259 \r
260 /* The following event macros are embedded in the kernel API calls. */\r
261 \r
262 #ifndef traceQUEUE_CREATE       \r
263         #define traceQUEUE_CREATE( pxNewQueue )\r
264 #endif\r
265 \r
266 #ifndef traceQUEUE_CREATE_FAILED\r
267         #define traceQUEUE_CREATE_FAILED()\r
268 #endif\r
269 \r
270 #ifndef traceCREATE_MUTEX\r
271         #define traceCREATE_MUTEX( pxNewQueue )\r
272 #endif\r
273 \r
274 #ifndef traceCREATE_MUTEX_FAILED\r
275         #define traceCREATE_MUTEX_FAILED()\r
276 #endif\r
277 \r
278 #ifndef traceGIVE_MUTEX_RECURSIVE\r
279         #define traceGIVE_MUTEX_RECURSIVE( pxMutex )\r
280 #endif\r
281 \r
282 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED\r
283         #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )\r
284 #endif\r
285 \r
286 #ifndef traceTAKE_MUTEX_RECURSIVE\r
287         #define traceTAKE_MUTEX_RECURSIVE( pxMutex )\r
288 #endif\r
289 \r
290 #ifndef traceCREATE_COUNTING_SEMAPHORE\r
291         #define traceCREATE_COUNTING_SEMAPHORE()\r
292 #endif\r
293 \r
294 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED\r
295         #define traceCREATE_COUNTING_SEMAPHORE_FAILED()\r
296 #endif\r
297 \r
298 #ifndef traceQUEUE_SEND\r
299         #define traceQUEUE_SEND( pxQueue )\r
300 #endif\r
301 \r
302 #ifndef traceQUEUE_SEND_FAILED\r
303         #define traceQUEUE_SEND_FAILED( pxQueue )\r
304 #endif\r
305 \r
306 #ifndef traceQUEUE_RECEIVE\r
307         #define traceQUEUE_RECEIVE( pxQueue )\r
308 #endif\r
309 \r
310 #ifndef traceQUEUE_PEEK\r
311         #define traceQUEUE_PEEK( pxQueue )\r
312 #endif\r
313 \r
314 #ifndef traceQUEUE_RECEIVE_FAILED\r
315         #define traceQUEUE_RECEIVE_FAILED( pxQueue )\r
316 #endif\r
317 \r
318 #ifndef traceQUEUE_SEND_FROM_ISR\r
319         #define traceQUEUE_SEND_FROM_ISR( pxQueue )\r
320 #endif\r
321 \r
322 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED\r
323         #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )\r
324 #endif\r
325 \r
326 #ifndef traceQUEUE_RECEIVE_FROM_ISR\r
327         #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )\r
328 #endif\r
329 \r
330 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED\r
331         #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )\r
332 #endif\r
333 \r
334 #ifndef traceQUEUE_DELETE\r
335         #define traceQUEUE_DELETE( pxQueue )\r
336 #endif\r
337 \r
338 #ifndef traceTASK_CREATE\r
339         #define traceTASK_CREATE( pxNewTCB )\r
340 #endif\r
341 \r
342 #ifndef traceTASK_CREATE_FAILED\r
343         #define traceTASK_CREATE_FAILED( pxNewTCB )\r
344 #endif\r
345 \r
346 #ifndef traceTASK_DELETE\r
347         #define traceTASK_DELETE( pxTaskToDelete )\r
348 #endif\r
349 \r
350 #ifndef traceTASK_DELAY_UNTIL\r
351         #define traceTASK_DELAY_UNTIL()\r
352 #endif\r
353 \r
354 #ifndef traceTASK_DELAY\r
355         #define traceTASK_DELAY()\r
356 #endif\r
357 \r
358 #ifndef traceTASK_PRIORITY_SET\r
359         #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )\r
360 #endif\r
361 \r
362 #ifndef traceTASK_SUSPEND\r
363         #define traceTASK_SUSPEND( pxTaskToSuspend )\r
364 #endif\r
365 \r
366 #ifndef traceTASK_RESUME\r
367         #define traceTASK_RESUME( pxTaskToResume )\r
368 #endif\r
369 \r
370 #ifndef traceTASK_RESUME_FROM_ISR\r
371         #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )\r
372 #endif\r
373 \r
374 #ifndef traceTASK_INCREMENT_TICK\r
375         #define traceTASK_INCREMENT_TICK( xTickCount )\r
376 #endif\r
377 \r
378 #endif /* INC_FREERTOS_H */\r
379 \r