]> git.sur5r.net Git - freertos/blob - Source/include/FreeRTOS.h
Ensure the first task starts with interrupts enabled.
[freertos] / Source / include / FreeRTOS.h
1 /*\r
2         FreeRTOS.org V4.8.0 - Copyright (C) 2003-2008 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     * SAVE TIME AND MONEY!  We can port FreeRTOS.org to your own hardware,    *\r
30     * and even write all or part of your application on your behalf.          *\r
31     * See http://www.OpenRTOS.com for details of the services we provide to   *\r
32     * expedite your project.                                                  *\r
33     *                                                                         *\r
34     ***************************************************************************\r
35     ***************************************************************************\r
36 \r
37         Please ensure to read the configuration and relevant port sections of the\r
38         online documentation.\r
39 \r
40         http://www.FreeRTOS.org - Documentation, latest information, license and \r
41         contact details.\r
42 \r
43         http://www.SafeRTOS.com - A version that is certified for use in safety \r
44         critical systems.\r
45 \r
46         http://www.OpenRTOS.com - Commercial support, development, porting, \r
47         licensing and training services.\r
48 */\r
49 \r
50 #ifndef INC_FREERTOS_H\r
51 #define INC_FREERTOS_H\r
52 \r
53 \r
54 /*\r
55  * Include the generic headers required for the FreeRTOS port being used.\r
56  */\r
57 #include <stddef.h>\r
58 \r
59 /* Basic FreeRTOS definitions. */\r
60 #include "projdefs.h"\r
61 \r
62 /* Application specific configuration options. */\r
63 #include "FreeRTOSConfig.h"\r
64 \r
65 /* Definitions specific to the port being used. */\r
66 #include "portable.h"\r
67 \r
68 \r
69 \r
70 \r
71 \r
72 \r
73 \r
74 /*\r
75  * Check all the required application specific macros have been defined.\r
76  * These macros are application specific and (as downloaded) are defined\r
77  * within FreeRTOSConfig.h.\r
78  */\r
79 \r
80 #ifndef configUSE_PREEMPTION\r
81         #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
82 #endif\r
83 \r
84 #ifndef configUSE_IDLE_HOOK\r
85         #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
86 #endif\r
87 \r
88 #ifndef configUSE_TICK_HOOK\r
89         #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
90 #endif\r
91 \r
92 #ifndef configUSE_CO_ROUTINES\r
93         #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
94 #endif\r
95 \r
96 #ifndef INCLUDE_vTaskPrioritySet\r
97         #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
98 #endif\r
99 \r
100 #ifndef INCLUDE_uxTaskPriorityGet\r
101         #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
102 #endif\r
103 \r
104 #ifndef INCLUDE_vTaskDelete             \r
105         #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
106 #endif\r
107 \r
108 #ifndef INCLUDE_vTaskCleanUpResources\r
109         #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
110 #endif\r
111 \r
112 #ifndef INCLUDE_vTaskSuspend    \r
113         #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
114 #endif\r
115 \r
116 #ifndef INCLUDE_vTaskDelayUntil\r
117         #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
118 #endif\r
119 \r
120 #ifndef INCLUDE_vTaskDelay\r
121         #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
122 #endif\r
123 \r
124 #ifndef configUSE_16_BIT_TICKS\r
125         #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
126 #endif\r
127 \r
128 #ifndef INCLUDE_uxTaskGetStackHighWaterMark\r
129         #define INCLUDE_uxTaskGetStackHighWaterMark 0\r
130 #endif\r
131 \r
132 #ifndef configUSE_RECURSIVE_MUTEXES\r
133         #define configUSE_RECURSIVE_MUTEXES 0\r
134 #endif\r
135 \r
136 #ifndef configUSE_MUTEXES\r
137         #define configUSE_MUTEXES 0\r
138 #endif\r
139 \r
140 #ifndef configUSE_COUNTING_SEMAPHORES\r
141         #define configUSE_COUNTING_SEMAPHORES 0\r
142 #endif\r
143 \r
144 #ifndef configUSE_ALTERNATIVE_API\r
145         #define configUSE_ALTERNATIVE_API 0\r
146 #endif\r
147 \r
148 #ifndef portCRITICAL_NESTING_IN_TCB\r
149         #define portCRITICAL_NESTING_IN_TCB 0\r
150 #endif\r
151 \r
152 #if ( configUSE_MUTEXES == 1 )\r
153         /* xTaskGetCurrentTaskHandle is used by the priority inheritance mechanism\r
154         within the mutex implementation so must be available if mutexes are used. */\r
155         #undef INCLUDE_xTaskGetCurrentTaskHandle\r
156         #define INCLUDE_xTaskGetCurrentTaskHandle 1\r
157 #else\r
158         #ifndef INCLUDE_xTaskGetCurrentTaskHandle\r
159                 #define INCLUDE_xTaskGetCurrentTaskHandle 0\r
160         #endif\r
161 #endif\r
162 \r
163 \r
164 /* Remove any unused trace macros. */\r
165 #ifndef traceSTART\r
166         /* Used to perform any necessary initialisation - for example, open a file\r
167         into which trace is to be written. */\r
168         #define traceSTART()\r
169 #endif\r
170 \r
171 #ifndef traceEND\r
172         /* Use to close a trace, for example close a file into which trace has been\r
173         written. */\r
174         #define traceEND()\r
175 #endif\r
176 \r
177 #ifndef traceTASK_SWITCHED_IN\r
178         /* Called after a task has been selected to run.  pxCurrentTCB holds a pointer\r
179         to the task control block of the selected task. */\r
180         #define traceTASK_SWITCHED_IN()\r
181 #endif\r
182 \r
183 #ifndef traceTASK_SWITCHED_OUT\r
184         /* Called before a task has been selected to run.  pxCurrentTCB holds a pointer\r
185         to the task control block of the task being switched out. */\r
186         #define traceTASK_SWITCHED_OUT()\r
187 #endif\r
188 \r
189 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE\r
190         /* Task is about to block because it cannot read from a \r
191         queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore\r
192         upon which the read was attempted.  pxCurrentTCB points to the TCB of the \r
193         task that attempted the read. */\r
194         #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )\r
195 #endif\r
196 \r
197 #ifndef traceBLOCKING_ON_QUEUE_SEND\r
198         /* Task is about to block because it cannot write to a \r
199         queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore\r
200         upon which the write was attempted.  pxCurrentTCB points to the TCB of the \r
201         task that attempted the write. */\r
202         #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )\r
203 #endif\r
204 \r
205 #ifndef configCHECK_FOR_STACK_OVERFLOW\r
206         #define configCHECK_FOR_STACK_OVERFLOW 0\r
207 #endif\r
208 \r
209 /* The following event macros are embedded in the kernel API calls. */\r
210 \r
211 #ifndef traceQUEUE_CREATE       \r
212         #define traceQUEUE_CREATE( pxNewQueue )\r
213 #endif\r
214 \r
215 #ifndef traceQUEUE_CREATE_FAILED\r
216         #define traceQUEUE_CREATE_FAILED()\r
217 #endif\r
218 \r
219 #ifndef traceCREATE_MUTEX\r
220         #define traceCREATE_MUTEX( pxNewQueue )\r
221 #endif\r
222 \r
223 #ifndef traceCREATE_MUTEX_FAILED\r
224         #define traceCREATE_MUTEX_FAILED()\r
225 #endif\r
226 \r
227 #ifndef traceGIVE_MUTEX_RECURSIVE\r
228         #define traceGIVE_MUTEX_RECURSIVE( pxMutex )\r
229 #endif\r
230 \r
231 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED\r
232         #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )\r
233 #endif\r
234 \r
235 #ifndef traceTAKE_MUTEX_RECURSIVE\r
236         #define traceTAKE_MUTEX_RECURSIVE( pxMutex )\r
237 #endif\r
238 \r
239 #ifndef traceCREATE_COUNTING_SEMAPHORE\r
240         #define traceCREATE_COUNTING_SEMAPHORE()\r
241 #endif\r
242 \r
243 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED\r
244         #define traceCREATE_COUNTING_SEMAPHORE_FAILED()\r
245 #endif\r
246 \r
247 #ifndef traceQUEUE_SEND\r
248         #define traceQUEUE_SEND( pxQueue )\r
249 #endif\r
250 \r
251 #ifndef traceQUEUE_SEND_FAILED\r
252         #define traceQUEUE_SEND_FAILED( pxQueue )\r
253 #endif\r
254 \r
255 #ifndef traceQUEUE_RECEIVE\r
256         #define traceQUEUE_RECEIVE( pxQueue )\r
257 #endif\r
258 \r
259 #ifndef traceQUEUE_PEEK\r
260         #define traceQUEUE_PEEK( pxQueue )\r
261 #endif\r
262 \r
263 #ifndef traceQUEUE_RECEIVE_FAILED\r
264         #define traceQUEUE_RECEIVE_FAILED( pxQueue )\r
265 #endif\r
266 \r
267 #ifndef traceQUEUE_SEND_FROM_ISR\r
268         #define traceQUEUE_SEND_FROM_ISR( pxQueue )\r
269 #endif\r
270 \r
271 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED\r
272         #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )\r
273 #endif\r
274 \r
275 #ifndef traceQUEUE_RECEIVE_FROM_ISR\r
276         #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )\r
277 #endif\r
278 \r
279 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED\r
280         #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )\r
281 #endif\r
282 \r
283 #ifndef traceQUEUE_DELETE\r
284         #define traceQUEUE_DELETE( pxQueue )\r
285 #endif\r
286 \r
287 #ifndef traceTASK_CREATE\r
288         #define traceTASK_CREATE( pxNewTCB )\r
289 #endif\r
290 \r
291 #ifndef traceTASK_CREATE_FAILED\r
292         #define traceTASK_CREATE_FAILED( pxNewTCB )\r
293 #endif\r
294 \r
295 #ifndef traceTASK_DELETE\r
296         #define traceTASK_DELETE( pxTaskToDelete )\r
297 #endif\r
298 \r
299 #ifndef traceTASK_DELAY_UNTIL\r
300         #define traceTASK_DELAY_UNTIL()\r
301 #endif\r
302 \r
303 #ifndef traceTASK_DELAY\r
304         #define traceTASK_DELAY()\r
305 #endif\r
306 \r
307 #ifndef traceTASK_PRIORITY_SET\r
308         #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )\r
309 #endif\r
310 \r
311 #ifndef traceTASK_SUSPEND\r
312         #define traceTASK_SUSPEND( pxTaskToSuspend )\r
313 #endif\r
314 \r
315 #ifndef traceTASK_RESUME\r
316         #define traceTASK_RESUME( pxTaskToResume )\r
317 #endif\r
318 \r
319 #ifndef traceTASK_RESUME_FROM_ISR\r
320         #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )\r
321 #endif\r
322 \r
323 #ifndef traceTASK_INCREMENT_TICK\r
324         #define traceTASK_INCREMENT_TICK( xTickCount )\r
325 #endif\r
326 \r
327 #endif /* INC_FREERTOS_H */\r
328 \r