2 FreeRTOS.org V5.2.0 - Copyright (C) 2003-2009 Richard Barry.
\r
4 This file is part of the FreeRTOS.org distribution.
\r
6 FreeRTOS.org is free software; you can redistribute it and/or modify it
\r
7 under the terms of the GNU General Public License (version 2) as published
\r
8 by the Free Software Foundation and modified by the FreeRTOS exception.
\r
10 FreeRTOS.org is distributed in the hope that it will be useful, but WITHOUT
\r
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
\r
15 You should have received a copy of the GNU General Public License along
\r
16 with FreeRTOS.org; if not, write to the Free Software Foundation, Inc., 59
\r
17 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\r
19 A special exception to the GPL is included to allow you to distribute a
\r
20 combined work that includes FreeRTOS.org without being obliged to provide
\r
21 the source code for any proprietary components. See the licensing section
\r
22 of http://www.FreeRTOS.org for full details.
\r
25 ***************************************************************************
\r
27 * Get the FreeRTOS eBook! See http://www.FreeRTOS.org/Documentation *
\r
29 * This is a concise, step by step, 'hands on' guide that describes both *
\r
30 * general multitasking concepts and FreeRTOS specifics. It presents and *
\r
31 * explains numerous examples that are written using the FreeRTOS API. *
\r
32 * Full source code for all the examples is provided in an accompanying *
\r
35 ***************************************************************************
\r
39 Please ensure to read the configuration and relevant port sections of the
\r
40 online documentation.
\r
42 http://www.FreeRTOS.org - Documentation, latest information, license and
\r
45 http://www.SafeRTOS.com - A version that is certified for use in safety
\r
48 http://www.OpenRTOS.com - Commercial support, development, porting,
\r
49 licensing and training services.
\r
52 #ifndef INC_FREERTOS_H
\r
53 #define INC_FREERTOS_H
\r
57 * Include the generic headers required for the FreeRTOS port being used.
\r
61 /* Basic FreeRTOS definitions. */
\r
62 #include "projdefs.h"
\r
64 /* Application specific configuration options. */
\r
65 #include "FreeRTOSConfig.h"
\r
67 /* Definitions specific to the port being used. */
\r
68 #include "portable.h"
\r
71 /* Defines the prototype to which the application task hook function must
\r
73 typedef portBASE_TYPE (*pdTASK_HOOK_CODE)( void * );
\r
80 * Check all the required application specific macros have been defined.
\r
81 * These macros are application specific and (as downloaded) are defined
\r
82 * within FreeRTOSConfig.h.
\r
85 #ifndef configUSE_PREEMPTION
\r
86 #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
89 #ifndef configUSE_IDLE_HOOK
\r
90 #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
93 #ifndef configUSE_TICK_HOOK
\r
94 #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
97 #ifndef configUSE_CO_ROUTINES
\r
98 #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
101 #ifndef INCLUDE_vTaskPrioritySet
\r
102 #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
105 #ifndef INCLUDE_uxTaskPriorityGet
\r
106 #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
109 #ifndef INCLUDE_vTaskDelete
\r
110 #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
113 #ifndef INCLUDE_vTaskCleanUpResources
\r
114 #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
117 #ifndef INCLUDE_vTaskSuspend
\r
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.
\r
121 #ifndef INCLUDE_vTaskDelayUntil
\r
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.
\r
125 #ifndef INCLUDE_vTaskDelay
\r
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.
\r
129 #ifndef configUSE_16_BIT_TICKS
\r
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.
\r
133 #ifndef configUSE_APPLICATION_TASK_TAG
\r
134 #define configUSE_APPLICATION_TASK_TAG 0
\r
137 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
\r
138 #define INCLUDE_uxTaskGetStackHighWaterMark 0
\r
141 #ifndef configUSE_RECURSIVE_MUTEXES
\r
142 #define configUSE_RECURSIVE_MUTEXES 0
\r
145 #ifndef configUSE_MUTEXES
\r
146 #define configUSE_MUTEXES 0
\r
149 #ifndef configUSE_COUNTING_SEMAPHORES
\r
150 #define configUSE_COUNTING_SEMAPHORES 0
\r
153 #ifndef configUSE_ALTERNATIVE_API
\r
154 #define configUSE_ALTERNATIVE_API 0
\r
157 #ifndef portCRITICAL_NESTING_IN_TCB
\r
158 #define portCRITICAL_NESTING_IN_TCB 0
\r
161 #ifndef configMAX_TASK_NAME_LEN
\r
162 #define configMAX_TASK_NAME_LEN 16
\r
165 #ifndef configIDLE_SHOULD_YIELD
\r
166 #define configIDLE_SHOULD_YIELD 1
\r
169 #if configMAX_TASK_NAME_LEN < 1
\r
170 #undef configMAX_TASK_NAME_LEN
\r
171 #define configMAX_TASK_NAME_LEN 1
\r
174 #ifndef INCLUDE_xTaskResumeFromISR
\r
175 #define INCLUDE_xTaskResumeFromISR 1
\r
178 #ifndef INCLUDE_xTaskGetSchedulerState
\r
179 #define INCLUDE_xTaskGetSchedulerState 0
\r
182 #if ( configUSE_MUTEXES == 1 )
\r
183 /* xTaskGetCurrentTaskHandle is used by the priority inheritance mechanism
\r
184 within the mutex implementation so must be available if mutexes are used. */
\r
185 #undef INCLUDE_xTaskGetCurrentTaskHandle
\r
186 #define INCLUDE_xTaskGetCurrentTaskHandle 1
\r
188 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
\r
189 #define INCLUDE_xTaskGetCurrentTaskHandle 0
\r
194 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
\r
195 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
\r
198 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
\r
199 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
\r
203 #ifndef configQUEUE_REGISTRY_SIZE
\r
204 #define configQUEUE_REGISTRY_SIZE 0
\r
207 #if configQUEUE_REGISTRY_SIZE < 1
\r
208 #define configQUEUE_REGISTRY_SIZE 0
\r
209 #define vQueueAddToRegistry( xQueue, pcName )
\r
210 #define vQueueUnregisterQueue( xQueue )
\r
214 /* Remove any unused trace macros. */
\r
216 /* Used to perform any necessary initialisation - for example, open a file
\r
217 into which trace is to be written. */
\r
218 #define traceSTART()
\r
222 /* Use to close a trace, for example close a file into which trace has been
\r
227 #ifndef traceTASK_SWITCHED_IN
\r
228 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
\r
229 to the task control block of the selected task. */
\r
230 #define traceTASK_SWITCHED_IN()
\r
233 #ifndef traceTASK_SWITCHED_OUT
\r
234 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
\r
235 to the task control block of the task being switched out. */
\r
236 #define traceTASK_SWITCHED_OUT()
\r
239 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
\r
240 /* Task is about to block because it cannot read from a
\r
241 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
\r
242 upon which the read was attempted. pxCurrentTCB points to the TCB of the
\r
243 task that attempted the read. */
\r
244 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
\r
247 #ifndef traceBLOCKING_ON_QUEUE_SEND
\r
248 /* Task is about to block because it cannot write to a
\r
249 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
\r
250 upon which the write was attempted. pxCurrentTCB points to the TCB of the
\r
251 task that attempted the write. */
\r
252 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
\r
255 #ifndef configCHECK_FOR_STACK_OVERFLOW
\r
256 #define configCHECK_FOR_STACK_OVERFLOW 0
\r
259 /* The following event macros are embedded in the kernel API calls. */
\r
261 #ifndef traceQUEUE_CREATE
\r
262 #define traceQUEUE_CREATE( pxNewQueue )
\r
265 #ifndef traceQUEUE_CREATE_FAILED
\r
266 #define traceQUEUE_CREATE_FAILED()
\r
269 #ifndef traceCREATE_MUTEX
\r
270 #define traceCREATE_MUTEX( pxNewQueue )
\r
273 #ifndef traceCREATE_MUTEX_FAILED
\r
274 #define traceCREATE_MUTEX_FAILED()
\r
277 #ifndef traceGIVE_MUTEX_RECURSIVE
\r
278 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
\r
281 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
\r
282 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
\r
285 #ifndef traceTAKE_MUTEX_RECURSIVE
\r
286 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
\r
289 #ifndef traceCREATE_COUNTING_SEMAPHORE
\r
290 #define traceCREATE_COUNTING_SEMAPHORE()
\r
293 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
\r
294 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
\r
297 #ifndef traceQUEUE_SEND
\r
298 #define traceQUEUE_SEND( pxQueue )
\r
301 #ifndef traceQUEUE_SEND_FAILED
\r
302 #define traceQUEUE_SEND_FAILED( pxQueue )
\r
305 #ifndef traceQUEUE_RECEIVE
\r
306 #define traceQUEUE_RECEIVE( pxQueue )
\r
309 #ifndef traceQUEUE_PEEK
\r
310 #define traceQUEUE_PEEK( pxQueue )
\r
313 #ifndef traceQUEUE_RECEIVE_FAILED
\r
314 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
\r
317 #ifndef traceQUEUE_SEND_FROM_ISR
\r
318 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
\r
321 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
\r
322 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
\r
325 #ifndef traceQUEUE_RECEIVE_FROM_ISR
\r
326 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
\r
329 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
\r
330 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
\r
333 #ifndef traceQUEUE_DELETE
\r
334 #define traceQUEUE_DELETE( pxQueue )
\r
337 #ifndef traceTASK_CREATE
\r
338 #define traceTASK_CREATE( pxNewTCB )
\r
341 #ifndef traceTASK_CREATE_FAILED
\r
342 #define traceTASK_CREATE_FAILED( pxNewTCB )
\r
345 #ifndef traceTASK_DELETE
\r
346 #define traceTASK_DELETE( pxTaskToDelete )
\r
349 #ifndef traceTASK_DELAY_UNTIL
\r
350 #define traceTASK_DELAY_UNTIL()
\r
353 #ifndef traceTASK_DELAY
\r
354 #define traceTASK_DELAY()
\r
357 #ifndef traceTASK_PRIORITY_SET
\r
358 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
\r
361 #ifndef traceTASK_SUSPEND
\r
362 #define traceTASK_SUSPEND( pxTaskToSuspend )
\r
365 #ifndef traceTASK_RESUME
\r
366 #define traceTASK_RESUME( pxTaskToResume )
\r
369 #ifndef traceTASK_RESUME_FROM_ISR
\r
370 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
\r
373 #ifndef traceTASK_INCREMENT_TICK
\r
374 #define traceTASK_INCREMENT_TICK( xTickCount )
\r
377 #ifndef configGENERATE_RUN_TIME_STATS
\r
378 #define configGENERATE_RUN_TIME_STATS 0
\r
381 #if ( configGENERATE_RUN_TIME_STATS == 1 )
\r
383 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
\r
384 #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.
\r
385 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
\r
387 #ifndef portGET_RUN_TIME_COUNTER_VALUE
\r
388 #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.
\r
389 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
\r
391 #endif /* configGENERATE_RUN_TIME_STATS */
\r
393 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
\r
394 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
\r
397 #endif /* INC_FREERTOS_H */
\r