2 FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd.
5 VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
7 This file is part of the FreeRTOS distribution.
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.
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 ***************************************************************************
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
25 ***************************************************************************
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. *
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 *
37 ***************************************************************************
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()?
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.
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.
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.
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.
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.
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.
70 #ifndef INC_FREERTOS_H
71 #define INC_FREERTOS_H
74 * Include the generic headers required for the FreeRTOS port being used.
77 #include "sys/reent.h"
80 * If stdint.h cannot be located then:
81 * + If using GCC ensure the -nostdint options is *not* being used.
82 * + Ensure the project's include path includes the directory in which your
83 * compiler stores stdint.h.
84 * + Set any compiler options necessary for it to support C99, as technically
85 * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
87 * + The FreeRTOS download includes a simple stdint.h definition that can be
88 * used in cases where none is provided by the compiler. The files only
89 * contains the typedefs required to build FreeRTOS. Read the instructions
90 * in FreeRTOS/source/stdint.readme for more information.
92 #include <stdint.h> /* READ COMMENT ABOVE. */
98 /* Application specific configuration options. */
99 #include "FreeRTOSConfig.h"
101 /* Basic FreeRTOS definitions. */
102 #include "projdefs.h"
104 /* Definitions specific to the port being used. */
105 #include "portable.h"
108 * Check all the required application specific macros have been defined.
109 * These macros are application specific and (as downloaded) are defined
110 * within FreeRTOSConfig.h.
113 #ifndef configMINIMAL_STACK_SIZE
114 #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.
117 #ifndef configMAX_PRIORITIES
118 #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
121 #ifndef configUSE_PREEMPTION
122 #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.
125 #ifndef configUSE_IDLE_HOOK
126 #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.
129 #ifndef configUSE_TICK_HOOK
130 #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.
133 #ifndef configUSE_CO_ROUTINES
134 #error Missing definition: configUSE_CO_ROUTINES must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
137 #ifndef INCLUDE_vTaskPrioritySet
138 #error Missing definition: INCLUDE_vTaskPrioritySet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
141 #ifndef INCLUDE_uxTaskPriorityGet
142 #error Missing definition: INCLUDE_uxTaskPriorityGet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
145 #ifndef INCLUDE_vTaskDelete
146 #error Missing definition: INCLUDE_vTaskDelete must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
149 #ifndef INCLUDE_vTaskSuspend
150 #error Missing definition: INCLUDE_vTaskSuspend must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
153 #ifndef INCLUDE_vTaskDelayUntil
154 #error Missing definition: INCLUDE_vTaskDelayUntil must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
157 #ifndef INCLUDE_vTaskDelay
158 #error Missing definition: INCLUDE_vTaskDelay must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
161 #ifndef configUSE_16_BIT_TICKS
162 #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.
165 #if configUSE_CO_ROUTINES != 0
166 #ifndef configMAX_CO_ROUTINE_PRIORITIES
167 #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
171 #ifndef configMAX_PRIORITIES
172 #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
175 #ifndef INCLUDE_xTaskGetIdleTaskHandle
176 #define INCLUDE_xTaskGetIdleTaskHandle 0
179 #ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle
180 #define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
183 #ifndef INCLUDE_xQueueGetMutexHolder
184 #define INCLUDE_xQueueGetMutexHolder 0
187 #ifndef INCLUDE_xSemaphoreGetMutexHolder
188 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
191 #ifndef INCLUDE_pcTaskGetTaskName
192 #define INCLUDE_pcTaskGetTaskName 1
195 #ifndef configUSE_APPLICATION_TASK_TAG
196 #define configUSE_APPLICATION_TASK_TAG 0
199 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
200 #define INCLUDE_uxTaskGetStackHighWaterMark 0
203 #ifndef INCLUDE_pxTaskGetStackStart
204 #define INCLUDE_pxTaskGetStackStart 0
207 #ifndef INCLUDE_eTaskGetState
208 #define INCLUDE_eTaskGetState 0
211 #ifndef configUSE_RECURSIVE_MUTEXES
212 #define configUSE_RECURSIVE_MUTEXES 0
215 #ifndef configUSE_MUTEXES
216 #define configUSE_MUTEXES 0
219 #ifndef configUSE_TIMERS
220 #define configUSE_TIMERS 0
223 #ifndef configUSE_COUNTING_SEMAPHORES
224 #define configUSE_COUNTING_SEMAPHORES 0
227 #ifndef configUSE_ALTERNATIVE_API
228 #define configUSE_ALTERNATIVE_API 0
231 #ifndef portCRITICAL_NESTING_IN_TCB
232 #define portCRITICAL_NESTING_IN_TCB 0
235 #ifndef configMAX_TASK_NAME_LEN
236 #define configMAX_TASK_NAME_LEN 16
239 #ifndef configIDLE_SHOULD_YIELD
240 #define configIDLE_SHOULD_YIELD 1
243 #if configMAX_TASK_NAME_LEN < 1
244 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
247 #ifndef INCLUDE_xTaskResumeFromISR
248 #define INCLUDE_xTaskResumeFromISR 1
251 #ifndef INCLUDE_xEventGroupSetBitFromISR
252 #define INCLUDE_xEventGroupSetBitFromISR 0
255 #ifndef INCLUDE_xTimerPendFunctionCall
256 #define INCLUDE_xTimerPendFunctionCall 0
260 #define configASSERT( x )
261 #define configASSERT_DEFINED 0
263 #define configASSERT_DEFINED 1
266 /* The timers module relies on xTaskGetSchedulerState(). */
267 #if configUSE_TIMERS == 1
269 #ifndef configTIMER_TASK_PRIORITY
270 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
271 #endif /* configTIMER_TASK_PRIORITY */
273 #ifndef configTIMER_QUEUE_LENGTH
274 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
275 #endif /* configTIMER_QUEUE_LENGTH */
277 #ifndef configTIMER_TASK_STACK_DEPTH
278 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
279 #endif /* configTIMER_TASK_STACK_DEPTH */
281 #endif /* configUSE_TIMERS */
283 #ifndef INCLUDE_xTaskGetSchedulerState
284 #define INCLUDE_xTaskGetSchedulerState 0
287 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
288 #define INCLUDE_xTaskGetCurrentTaskHandle 0
292 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
293 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
296 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
297 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
300 #ifndef portCLEAN_UP_TCB
301 #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
304 #ifndef portPRE_TASK_DELETE_HOOK
305 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
308 #ifndef portSETUP_TCB
309 #define portSETUP_TCB( pxTCB ) ( void ) pxTCB
312 #ifndef configQUEUE_REGISTRY_SIZE
313 #define configQUEUE_REGISTRY_SIZE 0U
316 #if ( configQUEUE_REGISTRY_SIZE < 1 )
317 #define vQueueAddToRegistry( xQueue, pcName )
318 #define vQueueUnregisterQueue( xQueue )
321 #ifndef portPOINTER_SIZE_TYPE
322 #define portPOINTER_SIZE_TYPE uint32_t
325 /* Remove any unused trace macros. */
327 /* Used to perform any necessary initialisation - for example, open a file
328 into which trace is to be written. */
333 /* Use to close a trace, for example close a file into which trace has been
338 #ifndef traceTASK_SWITCHED_IN
339 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
340 to the task control block of the selected task. */
341 #define traceTASK_SWITCHED_IN()
344 #ifndef traceINCREASE_TICK_COUNT
345 /* Called before stepping the tick count after waking from tickless idle
347 #define traceINCREASE_TICK_COUNT( x )
350 #ifndef traceLOW_POWER_IDLE_BEGIN
351 /* Called immediately before entering tickless idle. */
352 #define traceLOW_POWER_IDLE_BEGIN()
355 #ifndef traceLOW_POWER_IDLE_END
356 /* Called when returning to the Idle task after a tickless idle. */
357 #define traceLOW_POWER_IDLE_END()
360 #ifndef traceTASK_SWITCHED_OUT
361 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
362 to the task control block of the task being switched out. */
363 #define traceTASK_SWITCHED_OUT()
366 #ifndef traceTASK_PRIORITY_INHERIT
367 /* Called when a task attempts to take a mutex that is already held by a
368 lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
369 that holds the mutex. uxInheritedPriority is the priority the mutex holder
370 will inherit (the priority of the task that is attempting to obtain the
372 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
375 #ifndef traceTASK_PRIORITY_DISINHERIT
376 /* Called when a task releases a mutex, the holding of which had resulted in
377 the task inheriting the priority of a higher priority task.
378 pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
379 mutex. uxOriginalPriority is the task's configured (base) priority. */
380 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
383 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
384 /* Task is about to block because it cannot read from a
385 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
386 upon which the read was attempted. pxCurrentTCB points to the TCB of the
387 task that attempted the read. */
388 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
391 #ifndef traceBLOCKING_ON_QUEUE_SEND
392 /* Task is about to block because it cannot write to a
393 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
394 upon which the write was attempted. pxCurrentTCB points to the TCB of the
395 task that attempted the write. */
396 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
399 #ifndef configCHECK_FOR_STACK_OVERFLOW
400 #define configCHECK_FOR_STACK_OVERFLOW 0
403 /* The following event macros are embedded in the kernel API calls. */
405 #ifndef traceMOVED_TASK_TO_READY_STATE
406 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
409 #ifndef traceREADDED_TASK_TO_READY_STATE
410 #define traceREADDED_TASK_TO_READY_STATE( pxTCB ) traceMOVED_TASK_TO_READY_STATE( pxTCB )
413 #ifndef traceMOVED_TASK_TO_DELAYED_LIST
414 #define traceMOVED_TASK_TO_DELAYED_LIST()
417 #ifndef traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST
418 #define traceMOVED_TASK_TO_OVERFLOW_DELAYED_LIST()
421 #ifndef traceMOVED_TASK_TO_SUSPENDED_LIST
422 #define traceMOVED_TASK_TO_SUSPENDED_LIST( pxTCB )
425 #ifndef traceQUEUE_CREATE
426 #define traceQUEUE_CREATE( pxNewQueue )
429 #ifndef traceQUEUE_CREATE_FAILED
430 #define traceQUEUE_CREATE_FAILED( ucQueueType )
433 #ifndef traceCREATE_MUTEX
434 #define traceCREATE_MUTEX( pxNewQueue )
437 #ifndef traceCREATE_MUTEX_FAILED
438 #define traceCREATE_MUTEX_FAILED()
441 #ifndef traceGIVE_MUTEX_RECURSIVE
442 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
445 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
446 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
449 #ifndef traceTAKE_MUTEX_RECURSIVE
450 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
453 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
454 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
457 #ifndef traceCREATE_COUNTING_SEMAPHORE
458 #define traceCREATE_COUNTING_SEMAPHORE()
461 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
462 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
465 #ifndef traceQUEUE_SEND
466 #define traceQUEUE_SEND( pxQueue )
469 #ifndef traceQUEUE_SEND_FAILED
470 #define traceQUEUE_SEND_FAILED( pxQueue )
473 #ifndef traceQUEUE_RECEIVE
474 #define traceQUEUE_RECEIVE( pxQueue )
477 #ifndef traceQUEUE_PEEK
478 #define traceQUEUE_PEEK( pxQueue )
481 #ifndef traceQUEUE_PEEK_FROM_ISR
482 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
485 #ifndef traceQUEUE_RECEIVE_FAILED
486 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
489 #ifndef traceQUEUE_SEND_FROM_ISR
490 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
493 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
494 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
497 #ifndef traceQUEUE_RECEIVE_FROM_ISR
498 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
501 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
502 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
505 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
506 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
509 #ifndef traceQUEUE_DELETE
510 #define traceQUEUE_DELETE( pxQueue )
513 #ifndef traceTASK_CREATE
514 #define traceTASK_CREATE( pxNewTCB )
517 #ifndef traceTASK_CREATE_FAILED
518 #define traceTASK_CREATE_FAILED()
521 #ifndef traceTASK_DELETE
522 #define traceTASK_DELETE( pxTaskToDelete )
525 #ifndef traceTASK_DELAY_UNTIL
526 #define traceTASK_DELAY_UNTIL()
529 #ifndef traceTASK_DELAY
530 #define traceTASK_DELAY()
533 #ifndef traceTASK_PRIORITY_SET
534 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
537 #ifndef traceTASK_SUSPEND
538 #define traceTASK_SUSPEND( pxTaskToSuspend )
541 #ifndef traceTASK_RESUME
542 #define traceTASK_RESUME( pxTaskToResume )
545 #ifndef traceTASK_RESUME_FROM_ISR
546 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
549 #ifndef traceTASK_INCREMENT_TICK
550 #define traceTASK_INCREMENT_TICK( xTickCount )
553 #ifndef traceTIMER_CREATE
554 #define traceTIMER_CREATE( pxNewTimer )
557 #ifndef traceTIMER_CREATE_FAILED
558 #define traceTIMER_CREATE_FAILED()
561 #ifndef traceTIMER_COMMAND_SEND
562 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
565 #ifndef traceTIMER_EXPIRED
566 #define traceTIMER_EXPIRED( pxTimer )
569 #ifndef traceTIMER_COMMAND_RECEIVED
570 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
574 #define traceMALLOC( pvAddress, uiSize )
578 #define traceFREE( pvAddress, uiSize )
581 #ifndef traceEVENT_GROUP_CREATE
582 #define traceEVENT_GROUP_CREATE( xEventGroup )
585 #ifndef traceEVENT_GROUP_CREATE_FAILED
586 #define traceEVENT_GROUP_CREATE_FAILED()
589 #ifndef traceEVENT_GROUP_SYNC_BLOCK
590 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
593 #ifndef traceEVENT_GROUP_SYNC_END
594 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
597 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
598 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
601 #ifndef traceEVENT_GROUP_WAIT_BITS_END
602 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
605 #ifndef traceEVENT_GROUP_CLEAR_BITS
606 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
609 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
610 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
613 #ifndef traceEVENT_GROUP_SET_BITS
614 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
617 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
618 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
621 #ifndef traceEVENT_GROUP_DELETE
622 #define traceEVENT_GROUP_DELETE( xEventGroup )
625 #ifndef tracePEND_FUNC_CALL
626 #define tracePEND_FUNC_CALL(xFunctionToPend, pvParameter1, ulParameter2, ret)
629 #ifndef tracePEND_FUNC_CALL_FROM_ISR
630 #define tracePEND_FUNC_CALL_FROM_ISR(xFunctionToPend, pvParameter1, ulParameter2, ret)
633 #ifndef traceQUEUE_REGISTRY_ADD
634 #define traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName)
637 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
638 #define traceTASK_NOTIFY_GIVE_FROM_ISR()
641 #ifndef traceISR_EXIT_TO_SCHEDULER
642 #define traceISR_EXIT_TO_SCHEDULER()
645 #ifndef traceISR_EXIT
646 #define traceISR_EXIT()
649 #ifndef traceISR_ENTER
650 #define traceISR_ENTER(_n_)
653 #ifndef configGENERATE_RUN_TIME_STATS
654 #define configGENERATE_RUN_TIME_STATS 0
657 #if ( configGENERATE_RUN_TIME_STATS == 1 )
659 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
660 #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.
661 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
663 #ifndef portGET_RUN_TIME_COUNTER_VALUE
664 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
665 #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.
666 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
667 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
669 #endif /* configGENERATE_RUN_TIME_STATS */
671 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
672 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
675 #ifndef configUSE_MALLOC_FAILED_HOOK
676 #define configUSE_MALLOC_FAILED_HOOK 0
679 #ifndef portPRIVILEGE_BIT
680 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
683 #ifndef portYIELD_WITHIN_API
684 #define portYIELD_WITHIN_API portYIELD
687 #ifndef pvPortMallocAligned
688 #define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
691 #ifndef vPortFreeAligned
692 #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
695 #ifndef portSUPPRESS_TICKS_AND_SLEEP
696 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
699 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
700 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
703 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
704 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
707 #ifndef configUSE_TICKLESS_IDLE
708 #define configUSE_TICKLESS_IDLE 0
711 #ifndef configPRE_SLEEP_PROCESSING
712 #define configPRE_SLEEP_PROCESSING( x )
715 #ifndef configPOST_SLEEP_PROCESSING
716 #define configPOST_SLEEP_PROCESSING( x )
719 #ifndef configUSE_QUEUE_SETS
720 #define configUSE_QUEUE_SETS 0
723 #ifndef portTASK_USES_FLOATING_POINT
724 #define portTASK_USES_FLOATING_POINT()
727 #ifndef configUSE_TIME_SLICING
728 #define configUSE_TIME_SLICING 1
731 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
732 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
735 #ifndef configUSE_NEWLIB_REENTRANT
736 #define configUSE_NEWLIB_REENTRANT 0
739 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
740 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
743 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
744 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
747 #ifndef configUSE_TRACE_FACILITY
748 #define configUSE_TRACE_FACILITY 0
751 #ifndef mtCOVERAGE_TEST_MARKER
752 #define mtCOVERAGE_TEST_MARKER()
755 #ifndef portASSERT_IF_IN_ISR
756 #define portASSERT_IF_IN_ISR()
759 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
760 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
763 #ifndef configAPPLICATION_ALLOCATED_HEAP
764 #define configAPPLICATION_ALLOCATED_HEAP 0
767 #ifndef configUSE_TASK_NOTIFICATIONS
768 #define configUSE_TASK_NOTIFICATIONS 1
771 #ifndef portTICK_TYPE_IS_ATOMIC
772 #define portTICK_TYPE_IS_ATOMIC 0
775 #ifndef configSUPPORT_STATIC_ALLOCATION
776 /* Defaults to 0 for backward compatibility. */
777 #define configSUPPORT_STATIC_ALLOCATION 0
780 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
781 /* Defaults to 1 for backward compatibility. */
782 #define configSUPPORT_DYNAMIC_ALLOCATION 1
785 #if( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
786 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
789 #if( portTICK_TYPE_IS_ATOMIC == 0 )
790 /* Either variables of tick type cannot be read atomically, or
791 portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
792 the tick count is returned to the standard critical section macros. */
793 #define portTICK_TYPE_ENTER_CRITICAL(mux) portENTER_CRITICAL(mux)
794 #define portTICK_TYPE_EXIT_CRITICAL(mux) portEXIT_CRITICAL(mux)
795 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
796 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
798 /* The tick type can be read atomically, so critical sections used when the
799 tick count is returned can be defined away. */
800 #define portTICK_TYPE_ENTER_CRITICAL()
801 #define portTICK_TYPE_EXIT_CRITICAL()
802 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
803 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) x
806 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
808 #ifndef configENABLE_BACKWARD_COMPATIBILITY
809 #define configENABLE_BACKWARD_COMPATIBILITY 1
812 #if configENABLE_BACKWARD_COMPATIBILITY == 1
813 #define eTaskStateGet eTaskGetState
814 #define portTickType TickType_t
815 #define xTaskHandle TaskHandle_t
816 #define xQueueHandle QueueHandle_t
817 #define xSemaphoreHandle SemaphoreHandle_t
818 #define xQueueSetHandle QueueSetHandle_t
819 #define xQueueSetMemberHandle QueueSetMemberHandle_t
820 #define xTimeOutType TimeOut_t
821 #define xMemoryRegion MemoryRegion_t
822 #define xTaskParameters TaskParameters_t
823 #define xTaskStatusType TaskStatus_t
824 #define xTimerHandle TimerHandle_t
825 #define xCoRoutineHandle CoRoutineHandle_t
826 #define pdTASK_HOOK_CODE TaskHookFunction_t
827 #define portTICK_RATE_MS portTICK_PERIOD_MS
829 /* Backward compatibility within the scheduler code only - these definitions
830 are not really required but are included for completeness. */
831 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
832 #define pdTASK_CODE TaskFunction_t
833 #define xListItem ListItem_t
835 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
837 #ifndef configESP32_PER_TASK_DATA
838 #define configESP32_PER_TASK_DATA 1
842 * In line with software engineering best practice, FreeRTOS implements a strict
843 * data hiding policy, so the real structures used by FreeRTOS to maintain the
844 * state of tasks, queues, semaphores, etc. are not accessible to the application
845 * code. However, if the application writer wants to statically allocate such
846 * an object then the size of the object needs to be know. Dummy structures
847 * that are guaranteed to have the same size and alignment requirements of the
848 * real objects are used for this purpose. The dummy list and list item
849 * structures below are used for inclusion in such a dummy structure.
851 struct xSTATIC_LIST_ITEM
856 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
858 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
859 struct xSTATIC_MINI_LIST_ITEM
864 typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
866 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
867 typedef struct xSTATIC_LIST
869 UBaseType_t uxDummy1;
871 StaticMiniListItem_t xDummy3;
875 * In line with software engineering best practice, especially when supplying a
876 * library that is likely to change in future versions, FreeRTOS implements a
877 * strict data hiding policy. This means the Task structure used internally by
878 * FreeRTOS is not accessible to application code. However, if the application
879 * writer wants to statically allocate the memory required to create a task then
880 * the size of the task object needs to be know. The StaticTask_t structure
881 * below is provided for this purpose. Its sizes and alignment requirements are
882 * guaranteed to match those of the genuine structure, no matter which
883 * architecture is being used, and no matter how the values in FreeRTOSConfig.h
884 * are set. Its contents are somewhat obfuscated in the hope users will
885 * recognise that it would be unwise to make direct use of the structure members.
887 typedef struct xSTATIC_TCB
890 #if ( portUSING_MPU_WRAPPERS == 1 )
891 xMPU_SETTINGS xDummy2;
893 StaticListItem_t xDummy3[ 2 ];
894 UBaseType_t uxDummy5;
896 uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
897 UBaseType_t uxDummyCoreId;
898 #if ( portSTACK_GROWTH > 0 || configENABLE_TASK_SNAPSHOT == 1 )
901 #if ( portCRITICAL_NESTING_IN_TCB == 1 )
902 UBaseType_t uxDummy9;
903 uint32_t OldInterruptState;
905 #if ( configUSE_TRACE_FACILITY == 1 )
906 UBaseType_t uxDummy10[ 2 ];
908 #if ( configUSE_MUTEXES == 1 )
909 UBaseType_t uxDummy12[ 2 ];
911 #if ( configUSE_APPLICATION_TASK_TAG == 1 )
914 #if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
915 void *pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
916 #if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
917 void *pvDummyLocalStorageCallBack[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
920 #if ( configGENERATE_RUN_TIME_STATS == 1 )
923 #if ( configUSE_NEWLIB_REENTRANT == 1 )
924 struct _reent xDummy17;
926 #if ( configUSE_TASK_NOTIFICATIONS == 1 )
930 #if( ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) \
931 || ( portUSING_MPU_WRAPPERS == 1 ) )
938 * In line with software engineering best practice, especially when supplying a
939 * library that is likely to change in future versions, FreeRTOS implements a
940 * strict data hiding policy. This means the Queue structure used internally by
941 * FreeRTOS is not accessible to application code. However, if the application
942 * writer wants to statically allocate the memory required to create a queue
943 * then the size of the queue object needs to be know. The StaticQueue_t
944 * structure below is provided for this purpose. Its sizes and alignment
945 * requirements are guaranteed to match those of the genuine structure, no
946 * matter which architecture is being used, and no matter how the values in
947 * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
948 * users will recognise that it would be unwise to make direct use of the
951 typedef struct xSTATIC_QUEUE
958 UBaseType_t uxDummy2;
961 StaticList_t xDummy3[ 2 ];
962 UBaseType_t uxDummy4[ 3 ];
964 #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
968 #if ( configUSE_QUEUE_SETS == 1 )
972 #if ( configUSE_TRACE_FACILITY == 1 )
973 UBaseType_t uxDummy8;
978 volatile uint32_t ucDummy10;
980 #ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
982 UBaseType_t uxDummy12;
987 typedef StaticQueue_t StaticSemaphore_t;
993 #endif /* INC_FREERTOS_H */