FreeRTOS.h
Go to the documentation of this file.
1 /*
2  FreeRTOS V9.0.0rc2 - Copyright (C) 2016 Real Time Engineers Ltd.
3  All rights reserved
4 
5  VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
6 
7  This file is part of the FreeRTOS distribution.
8 
9  FreeRTOS is free software; you can redistribute it and/or modify it under
10  the terms of the GNU General Public License (version 2) as published by the
11  Free Software Foundation >>>> AND MODIFIED BY <<<< the FreeRTOS exception.
12 
13  ***************************************************************************
14  >>! NOTE: The modification to the GPL is included to allow you to !<<
15  >>! distribute a combined work that includes FreeRTOS without being !<<
16  >>! obliged to provide the source code for proprietary components !<<
17  >>! outside of the FreeRTOS kernel. !<<
18  ***************************************************************************
19 
20  FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
21  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
22  FOR A PARTICULAR PURPOSE. Full license text is available on the following
23  link: http://www.freertos.org/a00114.html
24 
25  ***************************************************************************
26  * *
27  * FreeRTOS provides completely free yet professionally developed, *
28  * robust, strictly quality controlled, supported, and cross *
29  * platform software that is more than just the market leader, it *
30  * is the industry's de facto standard. *
31  * *
32  * Help yourself get started quickly while simultaneously helping *
33  * to support the FreeRTOS project by purchasing a FreeRTOS *
34  * tutorial book, reference manual, or both: *
35  * http://www.FreeRTOS.org/Documentation *
36  * *
37  ***************************************************************************
38 
39  http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
40  the FAQ page "My application does not run, what could be wrong?". Have you
41  defined configASSERT()?
42 
43  http://www.FreeRTOS.org/support - In return for receiving this top quality
44  embedded software for free we request you assist our global community by
45  participating in the support forum.
46 
47  http://www.FreeRTOS.org/training - Investing in training allows your team to
48  be as productive as possible as early as possible. Now you can receive
49  FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
50  Ltd, and the world's leading authority on the world's leading RTOS.
51 
52  http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
53  including FreeRTOS+Trace - an indispensable productivity tool, a DOS
54  compatible FAT file system, and our tiny thread aware UDP/IP stack.
55 
56  http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
57  Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
58 
59  http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
60  Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
61  licenses offer ticketed support, indemnification and commercial middleware.
62 
63  http://www.SafeRTOS.com - High Integrity Systems also provide a safety
64  engineered and independently SIL3 certified version for use in safety and
65  mission critical applications that require provable dependability.
66 
67  1 tab == 4 spaces!
68 */
69 
70 #ifndef INC_FREERTOS_H
71 #define INC_FREERTOS_H
72 
73 /*
74  * Include the generic headers required for the FreeRTOS port being used.
75  */
76 #include <stddef.h>
77 
78 /*
79  * If stdint.h cannot be located then:
80  * + If using GCC ensure the -nostdint options is *not* being used.
81  * + Ensure the project's include path includes the directory in which your
82  * compiler stores stdint.h.
83  * + Set any compiler options necessary for it to support C99, as technically
84  * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
85  * other way).
86  * + The FreeRTOS download includes a simple stdint.h definition that can be
87  * used in cases where none is provided by the compiler. The files only
88  * contains the typedefs required to build FreeRTOS. Read the instructions
89  * in FreeRTOS/source/stdint.readme for more information.
90  */
91 #include <stdint.h> /* READ COMMENT ABOVE. */
92 
93 #ifdef __cplusplus
94 extern "C" {
95 #endif
96 
97 /* Application specific configuration options. */
98 #include "FreeRTOSConfig.h"
99 
100 /* Basic FreeRTOS definitions. */
101 #include "projdefs.h"
102 
103 /* Definitions specific to the port being used. */
104 #include "portable.h"
105 
106 /*
107  * Check all the required application specific macros have been defined.
108  * These macros are application specific and (as downloaded) are defined
109  * within FreeRTOSConfig.h.
110  */
111 
112 #ifndef configMINIMAL_STACK_SIZE
113  #error Missing definition: configMINIMAL_STACK_SIZE must be defined in FreeRTOSConfig.h. configMINIMAL_STACK_SIZE defines the size (in words) of the stack allocated to the idle task. Refer to the demo project provided for your port for a suitable value.
114 #endif
115 
116 #ifndef configMAX_PRIORITIES
117  #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
118 #endif
119 
120 #ifndef configUSE_PREEMPTION
121  #error Missing definition: configUSE_PREEMPTION must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
122 #endif
123 
124 #ifndef configUSE_IDLE_HOOK
125  #error Missing definition: configUSE_IDLE_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
126 #endif
127 
128 #ifndef configUSE_TICK_HOOK
129  #error Missing definition: configUSE_TICK_HOOK must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
130 #endif
131 
132 #ifndef configUSE_16_BIT_TICKS
133  #error Missing definition: configUSE_16_BIT_TICKS must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
134 #endif
135 
136 #ifndef configMAX_PRIORITIES
137  #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
138 #endif
139 
140 #ifndef configUSE_CO_ROUTINES
141  #define configUSE_CO_ROUTINES 0
142 #endif
143 
144 #ifndef INCLUDE_vTaskPrioritySet
145  #define INCLUDE_vTaskPrioritySet 0
146 #endif
147 
148 #ifndef INCLUDE_uxTaskPriorityGet
149  #define INCLUDE_uxTaskPriorityGet 0
150 #endif
151 
152 #ifndef INCLUDE_vTaskDelete
153  #define INCLUDE_vTaskDelete 0
154 #endif
155 
156 #ifndef INCLUDE_vTaskSuspend
157  #define INCLUDE_vTaskSuspend 0
158 #endif
159 
160 #ifndef INCLUDE_vTaskDelayUntil
161  #define INCLUDE_vTaskDelayUntil 0
162 #endif
163 
164 #ifndef INCLUDE_vTaskDelay
165  #define INCLUDE_vTaskDelay 0
166 #endif
167 
168 #ifndef INCLUDE_xTaskGetIdleTaskHandle
169  #define INCLUDE_xTaskGetIdleTaskHandle 0
170 #endif
171 
172 #ifndef INCLUDE_xTaskAbortDelay
173  #define INCLUDE_xTaskAbortDelay 0
174 #endif
175 
176 #ifndef INCLUDE_xQueueGetMutexHolder
177  #define INCLUDE_xQueueGetMutexHolder 0
178 #endif
179 
180 #ifndef INCLUDE_xSemaphoreGetMutexHolder
181  #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
182 #endif
183 
184 #ifndef INCLUDE_xTaskGetTaskHandle
185  #define INCLUDE_xTaskGetTaskHandle 0
186 #endif
187 
188 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
189  #define INCLUDE_uxTaskGetStackHighWaterMark 0
190 #endif
191 
192 #ifndef INCLUDE_eTaskGetState
193  #define INCLUDE_eTaskGetState 0
194 #endif
195 
196 #ifndef INCLUDE_xTaskResumeFromISR
197  #define INCLUDE_xTaskResumeFromISR 1
198 #endif
199 
200 #ifndef INCLUDE_xTimerPendFunctionCall
201  #define INCLUDE_xTimerPendFunctionCall 0
202 #endif
203 
204 #ifndef INCLUDE_xTaskGetSchedulerState
205  #define INCLUDE_xTaskGetSchedulerState 0
206 #endif
207 
208 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
209  #define INCLUDE_xTaskGetCurrentTaskHandle 0
210 #endif
211 
212 #if configUSE_CO_ROUTINES != 0
213  #ifndef configMAX_CO_ROUTINE_PRIORITIES
214  #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
215  #endif
216 #endif
217 
218 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
219  #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
220 #endif
221 
222 #ifndef configUSE_APPLICATION_TASK_TAG
223  #define configUSE_APPLICATION_TASK_TAG 0
224 #endif
225 
226 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
227  #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
228 #endif
229 
230 #ifndef configUSE_RECURSIVE_MUTEXES
231  #define configUSE_RECURSIVE_MUTEXES 0
232 #endif
233 
234 #ifndef configUSE_MUTEXES
235  #define configUSE_MUTEXES 0
236 #endif
237 
238 #ifndef configUSE_TIMERS
239  #define configUSE_TIMERS 0
240 #endif
241 
242 #ifndef configUSE_COUNTING_SEMAPHORES
243  #define configUSE_COUNTING_SEMAPHORES 0
244 #endif
245 
246 #ifndef configUSE_ALTERNATIVE_API
247  #define configUSE_ALTERNATIVE_API 0
248 #endif
249 
250 #ifndef portCRITICAL_NESTING_IN_TCB
251  #define portCRITICAL_NESTING_IN_TCB 0
252 #endif
253 
254 #ifndef configMAX_TASK_NAME_LEN
255  #define configMAX_TASK_NAME_LEN 16
256 #endif
257 
258 #ifndef configIDLE_SHOULD_YIELD
259  #define configIDLE_SHOULD_YIELD 1
260 #endif
261 
262 #if configMAX_TASK_NAME_LEN < 1
263  #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
264 #endif
265 
266 #ifndef configASSERT
267  #define configASSERT( x )
268  #define configASSERT_DEFINED 0
269 #else
270  #define configASSERT_DEFINED 1
271 #endif
272 
273 /* The timers module relies on xTaskGetSchedulerState(). */
274 #if configUSE_TIMERS == 1
275 
276  #ifndef configTIMER_TASK_PRIORITY
277  #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
278  #endif /* configTIMER_TASK_PRIORITY */
279 
280  #ifndef configTIMER_QUEUE_LENGTH
281  #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
282  #endif /* configTIMER_QUEUE_LENGTH */
283 
284  #ifndef configTIMER_TASK_STACK_DEPTH
285  #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
286  #endif /* configTIMER_TASK_STACK_DEPTH */
287 
288 #endif /* configUSE_TIMERS */
289 
290 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
291  #define portSET_INTERRUPT_MASK_FROM_ISR() 0
292 #endif
293 
294 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
295  #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
296 #endif
297 
298 #ifndef portCLEAN_UP_TCB
299  #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
300 #endif
301 
302 #ifndef portPRE_TASK_DELETE_HOOK
303  #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
304 #endif
305 
306 #ifndef portSETUP_TCB
307  #define portSETUP_TCB( pxTCB ) ( void ) pxTCB
308 #endif
309 
310 #ifndef configQUEUE_REGISTRY_SIZE
311  #define configQUEUE_REGISTRY_SIZE 0U
312 #endif
313 
314 #if ( configQUEUE_REGISTRY_SIZE < 1 )
315  #define vQueueAddToRegistry( xQueue, pcName )
316  #define vQueueUnregisterQueue( xQueue )
317  #define pcQueueGetName( xQueue )
318 #endif
319 
320 #ifndef portPOINTER_SIZE_TYPE
321  #define portPOINTER_SIZE_TYPE uint32_t
322 #endif
323 
324 /* Remove any unused trace macros. */
325 #ifndef traceSTART
326  /* Used to perform any necessary initialisation - for example, open a file
327  into which trace is to be written. */
328  #define traceSTART()
329 #endif
330 
331 #ifndef traceEND
332  /* Use to close a trace, for example close a file into which trace has been
333  written. */
334  #define traceEND()
335 #endif
336 
337 #ifndef traceTASK_SWITCHED_IN
338  /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
339  to the task control block of the selected task. */
340  #define traceTASK_SWITCHED_IN()
341 #endif
342 
343 #ifndef traceINCREASE_TICK_COUNT
344  /* Called before stepping the tick count after waking from tickless idle
345  sleep. */
346  #define traceINCREASE_TICK_COUNT( x )
347 #endif
348 
349 #ifndef traceLOW_POWER_IDLE_BEGIN
350  /* Called immediately before entering tickless idle. */
351  #define traceLOW_POWER_IDLE_BEGIN()
352 #endif
353 
354 #ifndef traceLOW_POWER_IDLE_END
355  /* Called when returning to the Idle task after a tickless idle. */
356  #define traceLOW_POWER_IDLE_END()
357 #endif
358 
359 #ifndef traceTASK_SWITCHED_OUT
360  /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
361  to the task control block of the task being switched out. */
362  #define traceTASK_SWITCHED_OUT()
363 #endif
364 
365 #ifndef traceTASK_PRIORITY_INHERIT
366  /* Called when a task attempts to take a mutex that is already held by a
367  lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
368  that holds the mutex. uxInheritedPriority is the priority the mutex holder
369  will inherit (the priority of the task that is attempting to obtain the
370  muted. */
371  #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
372 #endif
373 
374 #ifndef traceTASK_PRIORITY_DISINHERIT
375  /* Called when a task releases a mutex, the holding of which had resulted in
376  the task inheriting the priority of a higher priority task.
377  pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
378  mutex. uxOriginalPriority is the task's configured (base) priority. */
379  #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
380 #endif
381 
382 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
383  /* Task is about to block because it cannot read from a
384  queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
385  upon which the read was attempted. pxCurrentTCB points to the TCB of the
386  task that attempted the read. */
387  #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
388 #endif
389 
390 #ifndef traceBLOCKING_ON_QUEUE_SEND
391  /* Task is about to block because it cannot write to a
392  queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
393  upon which the write was attempted. pxCurrentTCB points to the TCB of the
394  task that attempted the write. */
395  #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
396 #endif
397 
398 #ifndef configCHECK_FOR_STACK_OVERFLOW
399  #define configCHECK_FOR_STACK_OVERFLOW 0
400 #endif
401 
402 /* The following event macros are embedded in the kernel API calls. */
403 
404 #ifndef traceMOVED_TASK_TO_READY_STATE
405  #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
406 #endif
407 
408 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
409  #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
410 #endif
411 
412 #ifndef traceQUEUE_CREATE
413  #define traceQUEUE_CREATE( pxNewQueue )
414 #endif
415 
416 #ifndef traceQUEUE_CREATE_FAILED
417  #define traceQUEUE_CREATE_FAILED( ucQueueType )
418 #endif
419 
420 #ifndef traceCREATE_MUTEX
421  #define traceCREATE_MUTEX( pxNewQueue )
422 #endif
423 
424 #ifndef traceCREATE_MUTEX_FAILED
425  #define traceCREATE_MUTEX_FAILED()
426 #endif
427 
428 #ifndef traceGIVE_MUTEX_RECURSIVE
429  #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
430 #endif
431 
432 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
433  #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
434 #endif
435 
436 #ifndef traceTAKE_MUTEX_RECURSIVE
437  #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
438 #endif
439 
440 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
441  #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
442 #endif
443 
444 #ifndef traceCREATE_COUNTING_SEMAPHORE
445  #define traceCREATE_COUNTING_SEMAPHORE()
446 #endif
447 
448 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
449  #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
450 #endif
451 
452 #ifndef traceQUEUE_SEND
453  #define traceQUEUE_SEND( pxQueue )
454 #endif
455 
456 #ifndef traceQUEUE_SEND_FAILED
457  #define traceQUEUE_SEND_FAILED( pxQueue )
458 #endif
459 
460 #ifndef traceQUEUE_RECEIVE
461  #define traceQUEUE_RECEIVE( pxQueue )
462 #endif
463 
464 #ifndef traceQUEUE_PEEK
465  #define traceQUEUE_PEEK( pxQueue )
466 #endif
467 
468 #ifndef traceQUEUE_PEEK_FROM_ISR
469  #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
470 #endif
471 
472 #ifndef traceQUEUE_RECEIVE_FAILED
473  #define traceQUEUE_RECEIVE_FAILED( pxQueue )
474 #endif
475 
476 #ifndef traceQUEUE_SEND_FROM_ISR
477  #define traceQUEUE_SEND_FROM_ISR( pxQueue )
478 #endif
479 
480 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
481  #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
482 #endif
483 
484 #ifndef traceQUEUE_RECEIVE_FROM_ISR
485  #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
486 #endif
487 
488 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
489  #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
490 #endif
491 
492 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
493  #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
494 #endif
495 
496 #ifndef traceQUEUE_DELETE
497  #define traceQUEUE_DELETE( pxQueue )
498 #endif
499 
500 #ifndef traceTASK_CREATE
501  #define traceTASK_CREATE( pxNewTCB )
502 #endif
503 
504 #ifndef traceTASK_CREATE_FAILED
505  #define traceTASK_CREATE_FAILED()
506 #endif
507 
508 #ifndef traceTASK_DELETE
509  #define traceTASK_DELETE( pxTaskToDelete )
510 #endif
511 
512 #ifndef traceTASK_DELAY_UNTIL
513  #define traceTASK_DELAY_UNTIL( x )
514 #endif
515 
516 #ifndef traceTASK_DELAY
517  #define traceTASK_DELAY()
518 #endif
519 
520 #ifndef traceTASK_PRIORITY_SET
521  #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
522 #endif
523 
524 #ifndef traceTASK_SUSPEND
525  #define traceTASK_SUSPEND( pxTaskToSuspend )
526 #endif
527 
528 #ifndef traceTASK_RESUME
529  #define traceTASK_RESUME( pxTaskToResume )
530 #endif
531 
532 #ifndef traceTASK_RESUME_FROM_ISR
533  #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
534 #endif
535 
536 #ifndef traceTASK_INCREMENT_TICK
537  #define traceTASK_INCREMENT_TICK( xTickCount )
538 #endif
539 
540 #ifndef traceTIMER_CREATE
541  #define traceTIMER_CREATE( pxNewTimer )
542 #endif
543 
544 #ifndef traceTIMER_CREATE_FAILED
545  #define traceTIMER_CREATE_FAILED()
546 #endif
547 
548 #ifndef traceTIMER_COMMAND_SEND
549  #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
550 #endif
551 
552 #ifndef traceTIMER_EXPIRED
553  #define traceTIMER_EXPIRED( pxTimer )
554 #endif
555 
556 #ifndef traceTIMER_COMMAND_RECEIVED
557  #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
558 #endif
559 
560 #ifndef traceMALLOC
561  #define traceMALLOC( pvAddress, uiSize )
562 #endif
563 
564 #ifndef traceFREE
565  #define traceFREE( pvAddress, uiSize )
566 #endif
567 
568 #ifndef traceEVENT_GROUP_CREATE
569  #define traceEVENT_GROUP_CREATE( xEventGroup )
570 #endif
571 
572 #ifndef traceEVENT_GROUP_CREATE_FAILED
573  #define traceEVENT_GROUP_CREATE_FAILED()
574 #endif
575 
576 #ifndef traceEVENT_GROUP_SYNC_BLOCK
577  #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
578 #endif
579 
580 #ifndef traceEVENT_GROUP_SYNC_END
581  #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
582 #endif
583 
584 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
585  #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
586 #endif
587 
588 #ifndef traceEVENT_GROUP_WAIT_BITS_END
589  #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
590 #endif
591 
592 #ifndef traceEVENT_GROUP_CLEAR_BITS
593  #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
594 #endif
595 
596 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
597  #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
598 #endif
599 
600 #ifndef traceEVENT_GROUP_SET_BITS
601  #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
602 #endif
603 
604 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
605  #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
606 #endif
607 
608 #ifndef traceEVENT_GROUP_DELETE
609  #define traceEVENT_GROUP_DELETE( xEventGroup )
610 #endif
611 
612 #ifndef tracePEND_FUNC_CALL
613  #define tracePEND_FUNC_CALL(xFunctionToPend, pvParameter1, ulParameter2, ret)
614 #endif
615 
616 #ifndef tracePEND_FUNC_CALL_FROM_ISR
617  #define tracePEND_FUNC_CALL_FROM_ISR(xFunctionToPend, pvParameter1, ulParameter2, ret)
618 #endif
619 
620 #ifndef traceQUEUE_REGISTRY_ADD
621  #define traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName)
622 #endif
623 
624 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
625  #define traceTASK_NOTIFY_TAKE_BLOCK()
626 #endif
627 
628 #ifndef traceTASK_NOTIFY_TAKE
629  #define traceTASK_NOTIFY_TAKE()
630 #endif
631 
632 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
633  #define traceTASK_NOTIFY_WAIT_BLOCK()
634 #endif
635 
636 #ifndef traceTASK_NOTIFY_WAIT
637  #define traceTASK_NOTIFY_WAIT()
638 #endif
639 
640 #ifndef traceTASK_NOTIFY
641  #define traceTASK_NOTIFY()
642 #endif
643 
644 #ifndef traceTASK_NOTIFY_FROM_ISR
645  #define traceTASK_NOTIFY_FROM_ISR()
646 #endif
647 
648 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
649  #define traceTASK_NOTIFY_GIVE_FROM_ISR()
650 #endif
651 
652 #ifndef configGENERATE_RUN_TIME_STATS
653  #define configGENERATE_RUN_TIME_STATS 0
654 #endif
655 
656 #if ( configGENERATE_RUN_TIME_STATS == 1 )
657 
658  #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
659  #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.
660  #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
661 
662  #ifndef portGET_RUN_TIME_COUNTER_VALUE
663  #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
664  #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.
665  #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
666  #endif /* portGET_RUN_TIME_COUNTER_VALUE */
667 
668 #endif /* configGENERATE_RUN_TIME_STATS */
669 
670 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
671  #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
672 #endif
673 
674 #ifndef configUSE_MALLOC_FAILED_HOOK
675  #define configUSE_MALLOC_FAILED_HOOK 0
676 #endif
677 
678 #ifndef portPRIVILEGE_BIT
679  #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
680 #endif
681 
682 #ifndef portYIELD_WITHIN_API
683  #define portYIELD_WITHIN_API portYIELD
684 #endif
685 
686 #ifndef portSUPPRESS_TICKS_AND_SLEEP
687  #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
688 #endif
689 
690 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
691  #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
692 #endif
693 
694 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
695  #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
696 #endif
697 
698 #ifndef configUSE_TICKLESS_IDLE
699  #define configUSE_TICKLESS_IDLE 0
700 #endif
701 
702 #ifndef configPRE_SLEEP_PROCESSING
703  #define configPRE_SLEEP_PROCESSING( x )
704 #endif
705 
706 #ifndef configPOST_SLEEP_PROCESSING
707  #define configPOST_SLEEP_PROCESSING( x )
708 #endif
709 
710 #ifndef configUSE_QUEUE_SETS
711  #define configUSE_QUEUE_SETS 0
712 #endif
713 
714 #ifndef portTASK_USES_FLOATING_POINT
715  #define portTASK_USES_FLOATING_POINT()
716 #endif
717 
718 #ifndef configUSE_TIME_SLICING
719  #define configUSE_TIME_SLICING 1
720 #endif
721 
722 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
723  #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
724 #endif
725 
726 #ifndef configUSE_NEWLIB_REENTRANT
727  #define configUSE_NEWLIB_REENTRANT 0
728 #endif
729 
730 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
731  #define configUSE_STATS_FORMATTING_FUNCTIONS 0
732 #endif
733 
734 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
735  #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
736 #endif
737 
738 #ifndef configUSE_TRACE_FACILITY
739  #define configUSE_TRACE_FACILITY 0
740 #endif
741 
742 #ifndef mtCOVERAGE_TEST_MARKER
743  #define mtCOVERAGE_TEST_MARKER()
744 #endif
745 
746 #ifndef mtCOVERAGE_TEST_DELAY
747  #define mtCOVERAGE_TEST_DELAY()
748 #endif
749 
750 #ifndef portASSERT_IF_IN_ISR
751  #define portASSERT_IF_IN_ISR()
752 #endif
753 
754 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
755  #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
756 #endif
757 
758 #ifndef configAPPLICATION_ALLOCATED_HEAP
759  #define configAPPLICATION_ALLOCATED_HEAP 0
760 #endif
761 
762 #ifndef configUSE_TASK_NOTIFICATIONS
763  #define configUSE_TASK_NOTIFICATIONS 1
764 #endif
765 
766 #ifndef portTICK_TYPE_IS_ATOMIC
767  #define portTICK_TYPE_IS_ATOMIC 0
768 #endif
769 
770 #ifndef configSUPPORT_STATIC_ALLOCATION
771  /* Defaults to 0 for backward compatibility. */
772  #define configSUPPORT_STATIC_ALLOCATION 0
773 #endif
774 
775 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
776  /* Defaults to 1 for backward compatibility. */
777  #define configSUPPORT_DYNAMIC_ALLOCATION 1
778 #endif
779 
780 /* Sanity check the configuration. */
781 #if( configUSE_TICKLESS_IDLE != 0 )
782  #if( INCLUDE_vTaskSuspend != 1 )
783  #error INCLUDE_vTaskSuspend must be set to 1 if configUSE_TICKLESS_IDLE is not set to 0
784  #endif /* INCLUDE_vTaskSuspend */
785 #endif /* configUSE_TICKLESS_IDLE */
786 
787 #if( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_STATIC_ALLOCATION != 1 ) )
788  #error configSUPPORT_STATIC_ALLOCATION must be set to 1 in FreeRTOSConfig.h when the MPU is used.
789 #endif
790 
791 #if( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
792  #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
793 #endif
794 
795 #if( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
796  #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
797 #endif
798 
799 #if( portTICK_TYPE_IS_ATOMIC == 0 )
800  /* Either variables of tick type cannot be read atomically, or
801  portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
802  the tick count is returned to the standard critical section macros. */
803  #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
804  #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
805  #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
806  #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
807 #else
808  /* The tick type can be read atomically, so critical sections used when the
809  tick count is returned can be defined away. */
810  #define portTICK_TYPE_ENTER_CRITICAL()
811  #define portTICK_TYPE_EXIT_CRITICAL()
812  #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
813  #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) x
814 #endif
815 
816 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
817 V8 if desired. */
818 #ifndef configENABLE_BACKWARD_COMPATIBILITY
819  #define configENABLE_BACKWARD_COMPATIBILITY 1
820 #endif
821 
822 #if configENABLE_BACKWARD_COMPATIBILITY == 1
823  #define eTaskStateGet eTaskGetState
824  #define portTickType TickType_t
825  #define xTaskHandle TaskHandle_t
826  #define xQueueHandle QueueHandle_t
827  #define xSemaphoreHandle SemaphoreHandle_t
828  #define xQueueSetHandle QueueSetHandle_t
829  #define xQueueSetMemberHandle QueueSetMemberHandle_t
830  #define xTimeOutType TimeOut_t
831  #define xMemoryRegion MemoryRegion_t
832  #define xTaskParameters TaskParameters_t
833  #define xTaskStatusType TaskStatus_t
834  #define xTimerHandle TimerHandle_t
835  #define xCoRoutineHandle CoRoutineHandle_t
836  #define pdTASK_HOOK_CODE TaskHookFunction_t
837  #define portTICK_RATE_MS portTICK_PERIOD_MS
838  #define pcTaskGetTaskName pcTaskGetName
839  #define pcTimerGetTimerName pcTimerGetName
840 
841  /* Backward compatibility within the scheduler code only - these definitions
842  are not really required but are included for completeness. */
843  #define tmrTIMER_CALLBACK TimerCallbackFunction_t
844  #define pdTASK_CODE TaskFunction_t
845  #define xListItem ListItem_t
846  #define xList List_t
847 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
848 
849 #if( configUSE_ALTERNATIVE_API != 0 )
850  #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
851 #endif
852 
853 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
854 if floating point hardware is otherwise supported by the FreeRTOS port in use.
855 This constant is not supported by all FreeRTOS ports that include floating
856 point support. */
857 #ifndef configUSE_TASK_FPU_SUPPORT
858  #define configUSE_TASK_FPU_SUPPORT 1
859 #endif
860 
861 /*
862  * In line with software engineering best practice, FreeRTOS implements a strict
863  * data hiding policy, so the real structures used by FreeRTOS to maintain the
864  * state of tasks, queues, semaphores, etc. are not accessible to the application
865  * code. However, if the application writer wants to statically allocate such
866  * an object then the size of the object needs to be know. Dummy structures
867  * that are guaranteed to have the same size and alignment requirements of the
868  * real objects are used for this purpose. The dummy list and list item
869  * structures below are used for inclusion in such a dummy structure.
870  */
872 {
873  TickType_t xDummy1;
874  void *pvDummy2[ 4 ];
875 };
877 
878 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
880 {
881  TickType_t xDummy1;
882  void *pvDummy2[ 2 ];
883 };
885 
886 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
887 typedef struct xSTATIC_LIST
888 {
889  UBaseType_t uxDummy1;
890  void *pvDummy2;
892 } StaticList_t;
893 
894 /*
895  * In line with software engineering best practice, especially when supplying a
896  * library that is likely to change in future versions, FreeRTOS implements a
897  * strict data hiding policy. This means the Task structure used internally by
898  * FreeRTOS is not accessible to application code. However, if the application
899  * writer wants to statically allocate the memory required to create a task then
900  * the size of the task object needs to be know. The StaticTask_t structure
901  * below is provided for this purpose. Its sizes and alignment requirements are
902  * guaranteed to match those of the genuine structure, no matter which
903  * architecture is being used, and no matter how the values in FreeRTOSConfig.h
904  * are set. Its contents are somewhat obfuscated in the hope users will
905  * recognise that it would be unwise to make direct use of the structure members.
906  */
907 typedef struct xSTATIC_TCB
908 {
909  void *pxDummy1;
910  #if ( portUSING_MPU_WRAPPERS == 1 )
911  xMPU_SETTINGS xDummy2;
912  #endif
913  StaticListItem_t xDummy3[ 2 ];
914  UBaseType_t uxDummy5;
915  void *pxDummy6;
916  uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
917  #if ( portSTACK_GROWTH > 0 )
918  void *pxDummy8;
919  #endif
920  #if ( portCRITICAL_NESTING_IN_TCB == 1 )
921  UBaseType_t uxDummy9;
922  #endif
923  #if ( configUSE_TRACE_FACILITY == 1 )
924  UBaseType_t uxDummy10[ 2 ];
925  #endif
926  #if ( configUSE_MUTEXES == 1 )
927  UBaseType_t uxDummy12[ 2 ];
928  #endif
929  #if ( configUSE_APPLICATION_TASK_TAG == 1 )
930  void *pxDummy14;
931  #endif
932  #if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
933  void *pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
934  #endif
935  #if ( configGENERATE_RUN_TIME_STATS == 1 )
936  uint32_t ulDummy16;
937  #endif
938  #if ( configUSE_NEWLIB_REENTRANT == 1 )
939  struct _reent xDummy17;
940  #endif
941  #if ( configUSE_TASK_NOTIFICATIONS == 1 )
942  uint32_t ulDummy18;
943  uint8_t ucDummy19;
944  #endif
945  #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
946  uint8_t uxDummy20;
947  #endif
948 
949 } StaticTask_t;
950 
951 /*
952  * In line with software engineering best practice, especially when supplying a
953  * library that is likely to change in future versions, FreeRTOS implements a
954  * strict data hiding policy. This means the Queue structure used internally by
955  * FreeRTOS is not accessible to application code. However, if the application
956  * writer wants to statically allocate the memory required to create a queue
957  * then the size of the queue object needs to be know. The StaticQueue_t
958  * structure below is provided for this purpose. Its sizes and alignment
959  * requirements are guaranteed to match those of the genuine structure, no
960  * matter which architecture is being used, and no matter how the values in
961  * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
962  * users will recognise that it would be unwise to make direct use of the
963  * structure members.
964  */
965 typedef struct xSTATIC_QUEUE
966 {
967  void *pvDummy1[ 3 ];
968 
969  union
970  {
971  void *pvDummy2;
972  UBaseType_t uxDummy2;
973  } u;
974 
975  StaticList_t xDummy3[ 2 ];
976  UBaseType_t uxDummy4[ 3 ];
977  uint8_t ucDummy5[ 2 ];
978 
979  #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
980  uint8_t ucDummy6;
981  #endif
982 
983  #if ( configUSE_QUEUE_SETS == 1 )
984  void *pvDummy7;
985  #endif
986 
987  #if ( configUSE_TRACE_FACILITY == 1 )
988  UBaseType_t uxDummy8;
989  uint8_t ucDummy9;
990  #endif
991 
992 } StaticQueue_t;
994 
995 /*
996  * In line with software engineering best practice, especially when supplying a
997  * library that is likely to change in future versions, FreeRTOS implements a
998  * strict data hiding policy. This means the event group structure used
999  * internally by FreeRTOS is not accessible to application code. However, if
1000  * the application writer wants to statically allocate the memory required to
1001  * create an event group then the size of the event group object needs to be
1002  * know. The StaticEventGroup_t structure below is provided for this purpose.
1003  * Its sizes and alignment requirements are guaranteed to match those of the
1004  * genuine structure, no matter which architecture is being used, and no matter
1005  * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1006  * obfuscated in the hope users will recognise that it would be unwise to make
1007  * direct use of the structure members.
1008  */
1009 typedef struct xSTATIC_EVENT_GROUP
1010 {
1011  TickType_t xDummy1;
1013 
1014  #if( configUSE_TRACE_FACILITY == 1 )
1015  UBaseType_t uxDummy3;
1016  #endif
1017 
1018  #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1019  uint8_t ucDummy4;
1020  #endif
1021 
1023 
1024 /*
1025  * In line with software engineering best practice, especially when supplying a
1026  * library that is likely to change in future versions, FreeRTOS implements a
1027  * strict data hiding policy. This means the software timer structure used
1028  * internally by FreeRTOS is not accessible to application code. However, if
1029  * the application writer wants to statically allocate the memory required to
1030  * create a software timer then the size of the queue object needs to be know.
1031  * The StaticTimer_t structure below is provided for this purpose. Its sizes
1032  * and alignment requirements are guaranteed to match those of the genuine
1033  * structure, no matter which architecture is being used, and no matter how the
1034  * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1035  * the hope users will recognise that it would be unwise to make direct use of
1036  * the structure members.
1037  */
1038 typedef struct xSTATIC_TIMER
1039 {
1040  void *pvDummy1;
1042  TickType_t xDummy3;
1043  UBaseType_t uxDummy4;
1044  void *pvDummy5[ 2 ];
1045  #if( configUSE_TRACE_FACILITY == 1 )
1046  UBaseType_t uxDummy6;
1047  #endif
1048 
1049  #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1050  uint8_t ucDummy7;
1051  #endif
1052 
1053 } StaticTimer_t;
1054 
1055 #ifdef __cplusplus
1056 }
1057 #endif
1058 
1059 #endif /* INC_FREERTOS_H */
1060 
uint32_t ulDummy18
Definition: FreeRTOS.h:942
Definition: FreeRTOS.h:871
void * pvDummy1
Definition: FreeRTOS.h:1040
#define configNUM_THREAD_LOCAL_STORAGE_POINTERS
Definition: FreeRTOS.h:227
StaticQueue_t StaticSemaphore_t
Definition: FreeRTOS.h:993
UBaseType_t uxDummy2
Definition: FreeRTOS.h:972
UBaseType_t uxDummy4
Definition: FreeRTOS.h:1043
TickType_t xDummy3
Definition: FreeRTOS.h:1042
UBaseType_t uxDummy1
Definition: FreeRTOS.h:889
TickType_t xDummy1
Definition: FreeRTOS.h:873
TickType_t xDummy1
Definition: FreeRTOS.h:1011
Definition: FreeRTOS.h:907
struct xSTATIC_TCB StaticTask_t
void * pvDummy2
Definition: FreeRTOS.h:890
void * pxDummy1
Definition: FreeRTOS.h:909
TickType_t xDummy1
Definition: FreeRTOS.h:881
void * pvDummy2
Definition: FreeRTOS.h:971
StaticList_t xDummy2
Definition: FreeRTOS.h:1012
struct xSTATIC_LIST StaticList_t
Definition: FreeRTOS.h:887
struct xSTATIC_EVENT_GROUP StaticEventGroup_t
Definition: FreeRTOS.h:879
void * pvDummy2[4]
Definition: FreeRTOS.h:874
struct xSTATIC_TIMER StaticTimer_t
uint8_t ucDummy19
Definition: FreeRTOS.h:943
UBaseType_t uxDummy5
Definition: FreeRTOS.h:914
StaticListItem_t xDummy2
Definition: FreeRTOS.h:1041
Definition: FreeRTOS.h:1009
struct xSTATIC_QUEUE StaticQueue_t
#define configMAX_TASK_NAME_LEN
Definition: FreeRTOS.h:255
StaticMiniListItem_t xDummy3
Definition: FreeRTOS.h:891
void * pxDummy6
Definition: FreeRTOS.h:915
Definition: FreeRTOS.h:965
Definition: FreeRTOS.h:1038