]> rtime.felk.cvut.cz Git - pes-rpp/rpp-lib.git/blob - os/7.0.2/include/os/FreeRTOS.h
Remove the name of the platform from the OS folder name
[pes-rpp/rpp-lib.git] / os / 7.0.2 / include / os / FreeRTOS.h
1 /*
2     FreeRTOS V7.0.2 - Copyright (C) 2011 Real Time Engineers Ltd.
3
4
5     ***************************************************************************
6      *                                                                       *
7      *    FreeRTOS tutorial books are available in pdf and paperback.        *
8      *    Complete, revised, and edited pdf reference manuals are also       *
9      *    available.                                                         *
10      *                                                                       *
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!                  *
17      *                                                                       *
18      *    >>> See http://www.FreeRTOS.org/Documentation for details. <<<     *
19      *                                                                       *
20      *    Thank you for using FreeRTOS, and thank you for your support!      *
21      *                                                                       *
22     ***************************************************************************
23
24
25     This file is part of the FreeRTOS distribution.
26
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
40     FreeRTOS WEB site.
41
42     1 tab == 4 spaces!
43
44     http://www.FreeRTOS.org - Documentation, latest information, license and
45     contact details.
46
47     http://www.SafeRTOS.com - A version that is certified for use in safety
48     critical systems.
49
50     http://www.OpenRTOS.com - Commercial support, development, porting,
51     licensing and training services.
52 */
53
54 #ifndef INC_FREERTOS_H
55 #define INC_FREERTOS_H
56
57
58 /*
59  * Include the generic headers required for the FreeRTOS port being used.
60  */
61 #include <stddef.h>
62
63 /* Basic FreeRTOS definitions. */
64 #include "os/projdefs.h"
65
66 /* Application specific configuration options. */
67 #include "os/FreeRTOSConfig.h"
68
69 /* Definitions specific to the port being used. */
70 #include "os/portable.h"
71
72 /* Definitions specific R4 core. */
73 #include "sys/sys_core.h"
74
75 /* Defines the prototype to which the application task hook function must
76 conform. */
77 typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
78
79
80
81
82
83 /*
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.
87  */
88
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.
91 #endif
92
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.
95 #endif
96
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.
99 #endif
100
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.
103 #endif
104
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.
107 #endif
108
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.
111 #endif
112
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.
115 #endif
116
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.
119 #endif
120
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.
123 #endif
124
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.
127 #endif
128
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.
131 #endif
132
133 #ifndef INCLUDE_xTaskGetIdleTaskHandle
134     #define INCLUDE_xTaskGetIdleTaskHandle 0
135 #endif
136
137 #ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle
138     #define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
139 #endif
140
141 #ifndef INCLUDE_pcTaskGetTaskName
142     #define INCLUDE_pcTaskGetTaskName 0
143 #endif
144
145 #ifndef configUSE_APPLICATION_TASK_TAG
146     #define configUSE_APPLICATION_TASK_TAG 0
147 #endif
148
149 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
150     #define INCLUDE_uxTaskGetStackHighWaterMark 0
151 #endif
152
153 #ifndef configUSE_RECURSIVE_MUTEXES
154     #define configUSE_RECURSIVE_MUTEXES 0
155 #endif
156
157 #ifndef configUSE_MUTEXES
158     #define configUSE_MUTEXES 0
159 #endif
160
161 #ifndef configUSE_TIMERS
162     #define configUSE_TIMERS 0
163 #endif
164
165 #ifndef configUSE_COUNTING_SEMAPHORES
166     #define configUSE_COUNTING_SEMAPHORES 0
167 #endif
168
169 #ifndef configUSE_ALTERNATIVE_API
170     #define configUSE_ALTERNATIVE_API 0
171 #endif
172
173 #ifndef portCRITICAL_NESTING_IN_TCB
174     #define portCRITICAL_NESTING_IN_TCB 0
175 #endif
176
177 #ifndef configMAX_TASK_NAME_LEN
178     #define configMAX_TASK_NAME_LEN 16
179 #endif
180
181 #ifndef configIDLE_SHOULD_YIELD
182     #define configIDLE_SHOULD_YIELD     1
183 #endif
184
185 #if configMAX_TASK_NAME_LEN < 1
186     #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
187 #endif
188
189 #ifndef INCLUDE_xTaskResumeFromISR
190     #define INCLUDE_xTaskResumeFromISR 1
191 #endif
192
193 #ifndef configASSERT
194     #define configASSERT( x )
195 #endif
196
197 /* The timers module relies on xTaskGetSchedulerState(). */
198 #if configUSE_TIMERS == 1
199
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 */
203
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 */
207
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 */
211
212 #endif /* configUSE_TIMERS */
213
214 #ifndef INCLUDE_xTaskGetSchedulerState
215     #define INCLUDE_xTaskGetSchedulerState 0
216 #endif
217
218 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
219     #define INCLUDE_xTaskGetCurrentTaskHandle 0
220 #endif
221
222
223 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
224     #define portSET_INTERRUPT_MASK_FROM_ISR() 0
225 #endif
226
227 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
228     #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
229 #endif
230
231
232 #ifndef configQUEUE_REGISTRY_SIZE
233     #define configQUEUE_REGISTRY_SIZE 0U
234 #endif
235
236 #if ( configQUEUE_REGISTRY_SIZE < 1 )
237     #define vQueueAddToRegistry( xQueue, pcName )
238     #define vQueueUnregisterQueue( xQueue )
239 #endif
240
241 #ifndef portPOINTER_SIZE_TYPE
242     #define portPOINTER_SIZE_TYPE unsigned long
243 #endif
244
245 /* Remove any unused trace macros. */
246 #ifndef traceSTART
247     /* Used to perform any necessary initialisation - for example, open a file
248     into which trace is to be written. */
249     #define traceSTART()
250 #endif
251
252 #ifndef traceEND
253     /* Use to close a trace, for example close a file into which trace has been
254     written. */
255     #define traceEND()
256 #endif
257
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()
262 #endif
263
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()
268 #endif
269
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 )
276 #endif
277
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 )
284 #endif
285
286 #ifndef configCHECK_FOR_STACK_OVERFLOW
287     #define configCHECK_FOR_STACK_OVERFLOW 0
288 #endif
289
290 /* The following event macros are embedded in the kernel API calls. */
291
292 #ifndef traceQUEUE_CREATE
293     #define traceQUEUE_CREATE( pxNewQueue )
294 #endif
295
296 #ifndef traceQUEUE_CREATE_FAILED
297     #define traceQUEUE_CREATE_FAILED()
298 #endif
299
300 #ifndef traceCREATE_MUTEX
301     #define traceCREATE_MUTEX( pxNewQueue )
302 #endif
303
304 #ifndef traceCREATE_MUTEX_FAILED
305     #define traceCREATE_MUTEX_FAILED()
306 #endif
307
308 #ifndef traceGIVE_MUTEX_RECURSIVE
309     #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
310 #endif
311
312 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
313     #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
314 #endif
315
316 #ifndef traceTAKE_MUTEX_RECURSIVE
317     #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
318 #endif
319
320 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
321     #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
322 #endif
323
324 #ifndef traceCREATE_COUNTING_SEMAPHORE
325     #define traceCREATE_COUNTING_SEMAPHORE()
326 #endif
327
328 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
329     #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
330 #endif
331
332 #ifndef traceQUEUE_SEND
333     #define traceQUEUE_SEND( pxQueue )
334 #endif
335
336 #ifndef traceQUEUE_SEND_FAILED
337     #define traceQUEUE_SEND_FAILED( pxQueue )
338 #endif
339
340 #ifndef traceQUEUE_RECEIVE
341     #define traceQUEUE_RECEIVE( pxQueue )
342 #endif
343
344 #ifndef traceQUEUE_PEEK
345     #define traceQUEUE_PEEK( pxQueue )
346 #endif
347
348 #ifndef traceQUEUE_RECEIVE_FAILED
349     #define traceQUEUE_RECEIVE_FAILED( pxQueue )
350 #endif
351
352 #ifndef traceQUEUE_SEND_FROM_ISR
353     #define traceQUEUE_SEND_FROM_ISR( pxQueue )
354 #endif
355
356 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
357     #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
358 #endif
359
360 #ifndef traceQUEUE_RECEIVE_FROM_ISR
361     #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
362 #endif
363
364 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
365     #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
366 #endif
367
368 #ifndef traceQUEUE_DELETE
369     #define traceQUEUE_DELETE( pxQueue )
370 #endif
371
372 #ifndef traceTASK_CREATE
373     #define traceTASK_CREATE( pxNewTCB )
374 #endif
375
376 #ifndef traceTASK_CREATE_FAILED
377     #define traceTASK_CREATE_FAILED()
378 #endif
379
380 #ifndef traceTASK_DELETE
381     #define traceTASK_DELETE( pxTaskToDelete )
382 #endif
383
384 #ifndef traceTASK_DELAY_UNTIL
385     #define traceTASK_DELAY_UNTIL()
386 #endif
387
388 #ifndef traceTASK_DELAY
389     #define traceTASK_DELAY()
390 #endif
391
392 #ifndef traceTASK_PRIORITY_SET
393     #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
394 #endif
395
396 #ifndef traceTASK_SUSPEND
397     #define traceTASK_SUSPEND( pxTaskToSuspend )
398 #endif
399
400 #ifndef traceTASK_RESUME
401     #define traceTASK_RESUME( pxTaskToResume )
402 #endif
403
404 #ifndef traceTASK_RESUME_FROM_ISR
405     #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
406 #endif
407
408 #ifndef traceTASK_INCREMENT_TICK
409     #define traceTASK_INCREMENT_TICK( xTickCount )
410 #endif
411
412 #ifndef traceTIMER_CREATE
413     #define traceTIMER_CREATE( pxNewTimer )
414 #endif
415
416 #ifndef traceTIMER_CREATE_FAILED
417     #define traceTIMER_CREATE_FAILED()
418 #endif
419
420 #ifndef traceTIMER_COMMAND_SEND
421     #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
422 #endif
423
424 #ifndef traceTIMER_EXPIRED
425     #define traceTIMER_EXPIRED( pxTimer )
426 #endif
427
428 #ifndef traceTIMER_COMMAND_RECEIVED
429     #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
430 #endif
431
432 #ifndef configGENERATE_RUN_TIME_STATS
433     #define configGENERATE_RUN_TIME_STATS 0
434 #endif
435
436 #if ( configGENERATE_RUN_TIME_STATS == 1 )
437
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 */
441
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 */
447
448 #endif /* configGENERATE_RUN_TIME_STATS */
449
450 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
451     #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
452 #endif
453
454 #ifndef configUSE_MALLOC_FAILED_HOOK
455     #define configUSE_MALLOC_FAILED_HOOK 0
456 #endif
457
458 #ifndef portPRIVILEGE_BIT
459     #define portPRIVILEGE_BIT ( ( unsigned portBASE_TYPE ) 0x00 )
460 #endif
461
462 #ifndef portYIELD_WITHIN_API
463     #define portYIELD_WITHIN_API portYIELD
464 #endif
465
466 #ifndef pvPortMallocAligned
467     #define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
468 #endif
469
470 #ifndef vPortFreeAligned
471     #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
472 #endif
473
474 #endif /* INC_FREERTOS_H */
475