]> begriffs open source - cmsis-freertos/blob - Source/include/FreeRTOS.h
Corrected osKernelGetSysTimerCount not to call __disable_irq if interrupts are alread...
[cmsis-freertos] / Source / include / FreeRTOS.h
1 /*
2  * FreeRTOS Kernel V10.5.1
3  * Copyright (C) 2021 Amazon.com, Inc. or its affiliates.  All Rights Reserved.
4  *
5  * SPDX-License-Identifier: MIT
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy of
8  * this software and associated documentation files (the "Software"), to deal in
9  * the Software without restriction, including without limitation the rights to
10  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
11  * the Software, and to permit persons to whom the Software is furnished to do so,
12  * subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in all
15  * copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
19  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
21  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  *
24  * https://www.FreeRTOS.org
25  * https://github.com/FreeRTOS
26  *
27  */
28
29 #ifndef INC_FREERTOS_H
30 #define INC_FREERTOS_H
31
32 /*
33  * Include the generic headers required for the FreeRTOS port being used.
34  */
35 #include <stddef.h>
36
37 /*
38  * If stdint.h cannot be located then:
39  *   + If using GCC ensure the -nostdint options is *not* being used.
40  *   + Ensure the project's include path includes the directory in which your
41  *     compiler stores stdint.h.
42  *   + Set any compiler options necessary for it to support C99, as technically
43  *     stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
44  *     other way).
45  *   + The FreeRTOS download includes a simple stdint.h definition that can be
46  *     used in cases where none is provided by the compiler.  The files only
47  *     contains the typedefs required to build FreeRTOS.  Read the instructions
48  *     in FreeRTOS/source/stdint.readme for more information.
49  */
50 #include <stdint.h> /* READ COMMENT ABOVE. */
51
52 /* *INDENT-OFF* */
53 #ifdef __cplusplus
54     extern "C" {
55 #endif
56 /* *INDENT-ON* */
57
58 /* Application specific configuration options. */
59 #include "FreeRTOSConfig.h"
60
61 /* Basic FreeRTOS definitions. */
62 #include "projdefs.h"
63
64 /* Definitions specific to the port being used. */
65 #include "portable.h"
66
67 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
68 #ifndef configUSE_NEWLIB_REENTRANT
69     #define configUSE_NEWLIB_REENTRANT    0
70 #endif
71
72 /* Required if struct _reent is used. */
73 #if ( configUSE_NEWLIB_REENTRANT == 1 )
74
75 /* Note Newlib support has been included by popular demand, but is not
76  * used by the FreeRTOS maintainers themselves.  FreeRTOS is not
77  * responsible for resulting newlib operation.  User must be familiar with
78  * newlib and must provide system-wide implementations of the necessary
79  * stubs. Be warned that (at the time of writing) the current newlib design
80  * implements a system-wide malloc() that must be provided with locks.
81  *
82  * See the third party link http://www.nadler.com/embedded/newlibAndFreeRTOS.html
83  * for additional information. */
84     #include <reent.h>
85
86     #define configUSE_C_RUNTIME_TLS_SUPPORT    1
87
88     #ifndef configTLS_BLOCK_TYPE
89         #define configTLS_BLOCK_TYPE           struct _reent
90     #endif
91
92     #ifndef configINIT_TLS_BLOCK
93         #define configINIT_TLS_BLOCK( xTLSBlock )    _REENT_INIT_PTR( &( xTLSBlock ) )
94     #endif
95
96     #ifndef configSET_TLS_BLOCK
97         #define configSET_TLS_BLOCK( xTLSBlock )    _impure_ptr = &( xTLSBlock )
98     #endif
99
100     #ifndef configDEINIT_TLS_BLOCK
101         #define configDEINIT_TLS_BLOCK( xTLSBlock )    _reclaim_reent( &( xTLSBlock ) )
102     #endif
103 #endif /* if ( configUSE_NEWLIB_REENTRANT == 1 ) */
104
105 #ifndef configUSE_C_RUNTIME_TLS_SUPPORT
106     #define configUSE_C_RUNTIME_TLS_SUPPORT    0
107 #endif
108
109 #if ( ( configUSE_NEWLIB_REENTRANT == 0 ) && ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) )
110
111     #ifndef configTLS_BLOCK_TYPE
112         #error Missing definition:  configTLS_BLOCK_TYPE must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
113     #endif
114
115     #ifndef configINIT_TLS_BLOCK
116         #error Missing definition:  configINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
117     #endif
118
119     #ifndef configSET_TLS_BLOCK
120         #error Missing definition:  configSET_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
121     #endif
122
123     #ifndef configDEINIT_TLS_BLOCK
124         #error Missing definition:  configDEINIT_TLS_BLOCK must be defined in FreeRTOSConfig.h when configUSE_C_RUNTIME_TLS_SUPPORT is set to 1.
125     #endif
126 #endif /* if ( ( configUSE_NEWLIB_REENTRANT == 0 ) && ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) ) */
127
128 /*
129  * Check all the required application specific macros have been defined.
130  * These macros are application specific and (as downloaded) are defined
131  * within FreeRTOSConfig.h.
132  */
133
134 #ifndef configMINIMAL_STACK_SIZE
135     #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.
136 #endif
137
138 #ifndef configMAX_PRIORITIES
139     #error Missing definition:  configMAX_PRIORITIES must be defined in FreeRTOSConfig.h.  See the Configuration section of the FreeRTOS API documentation for details.
140 #endif
141
142 #if configMAX_PRIORITIES < 1
143     #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
144 #endif
145
146 #ifndef configUSE_PREEMPTION
147     #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.
148 #endif
149
150 #ifndef configUSE_IDLE_HOOK
151     #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.
152 #endif
153
154 #ifndef configUSE_TICK_HOOK
155     #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.
156 #endif
157
158 #ifndef configUSE_16_BIT_TICKS
159     #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.
160 #endif
161
162 #ifndef configUSE_CO_ROUTINES
163     #define configUSE_CO_ROUTINES    0
164 #endif
165
166 #ifndef INCLUDE_vTaskPrioritySet
167     #define INCLUDE_vTaskPrioritySet    0
168 #endif
169
170 #ifndef INCLUDE_uxTaskPriorityGet
171     #define INCLUDE_uxTaskPriorityGet    0
172 #endif
173
174 #ifndef INCLUDE_vTaskDelete
175     #define INCLUDE_vTaskDelete    0
176 #endif
177
178 #ifndef INCLUDE_vTaskSuspend
179     #define INCLUDE_vTaskSuspend    0
180 #endif
181
182 #ifdef INCLUDE_xTaskDelayUntil
183     #ifdef INCLUDE_vTaskDelayUntil
184
185 /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil.  Backward
186  * compatibility is maintained if only one or the other is defined, but
187  * there is a conflict if both are defined. */
188         #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined.  INCLUDE_vTaskDelayUntil is no longer required and should be removed
189     #endif
190 #endif
191
192 #ifndef INCLUDE_xTaskDelayUntil
193     #ifdef INCLUDE_vTaskDelayUntil
194
195 /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
196  * the project's FreeRTOSConfig.h probably pre-dates the introduction of
197  * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
198  * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
199  */
200         #define INCLUDE_xTaskDelayUntil    INCLUDE_vTaskDelayUntil
201     #endif
202 #endif
203
204 #ifndef INCLUDE_xTaskDelayUntil
205     #define INCLUDE_xTaskDelayUntil    0
206 #endif
207
208 #ifndef INCLUDE_vTaskDelay
209     #define INCLUDE_vTaskDelay    0
210 #endif
211
212 #ifndef INCLUDE_xTaskGetIdleTaskHandle
213     #define INCLUDE_xTaskGetIdleTaskHandle    0
214 #endif
215
216 #ifndef INCLUDE_xTaskAbortDelay
217     #define INCLUDE_xTaskAbortDelay    0
218 #endif
219
220 #ifndef INCLUDE_xQueueGetMutexHolder
221     #define INCLUDE_xQueueGetMutexHolder    0
222 #endif
223
224 #ifndef INCLUDE_xSemaphoreGetMutexHolder
225     #define INCLUDE_xSemaphoreGetMutexHolder    INCLUDE_xQueueGetMutexHolder
226 #endif
227
228 #ifndef INCLUDE_xTaskGetHandle
229     #define INCLUDE_xTaskGetHandle    0
230 #endif
231
232 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
233     #define INCLUDE_uxTaskGetStackHighWaterMark    0
234 #endif
235
236 #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
237     #define INCLUDE_uxTaskGetStackHighWaterMark2    0
238 #endif
239
240 #ifndef INCLUDE_eTaskGetState
241     #define INCLUDE_eTaskGetState    0
242 #endif
243
244 #ifndef INCLUDE_xTaskResumeFromISR
245     #define INCLUDE_xTaskResumeFromISR    1
246 #endif
247
248 #ifndef INCLUDE_xTimerPendFunctionCall
249     #define INCLUDE_xTimerPendFunctionCall    0
250 #endif
251
252 #ifndef INCLUDE_xTaskGetSchedulerState
253     #define INCLUDE_xTaskGetSchedulerState    0
254 #endif
255
256 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
257     #define INCLUDE_xTaskGetCurrentTaskHandle    1
258 #endif
259
260 #if configUSE_CO_ROUTINES != 0
261     #ifndef configMAX_CO_ROUTINE_PRIORITIES
262         #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
263     #endif
264 #endif
265
266 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
267     #define configUSE_DAEMON_TASK_STARTUP_HOOK    0
268 #endif
269
270 #ifndef configUSE_APPLICATION_TASK_TAG
271     #define configUSE_APPLICATION_TASK_TAG    0
272 #endif
273
274 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
275     #define configNUM_THREAD_LOCAL_STORAGE_POINTERS    0
276 #endif
277
278 #ifndef configUSE_RECURSIVE_MUTEXES
279     #define configUSE_RECURSIVE_MUTEXES    0
280 #endif
281
282 #ifndef configUSE_MUTEXES
283     #define configUSE_MUTEXES    0
284 #endif
285
286 #ifndef configUSE_TIMERS
287     #define configUSE_TIMERS    0
288 #endif
289
290 #ifndef configUSE_COUNTING_SEMAPHORES
291     #define configUSE_COUNTING_SEMAPHORES    0
292 #endif
293
294 #ifndef configUSE_ALTERNATIVE_API
295     #define configUSE_ALTERNATIVE_API    0
296 #endif
297
298 #ifndef portCRITICAL_NESTING_IN_TCB
299     #define portCRITICAL_NESTING_IN_TCB    0
300 #endif
301
302 #ifndef configMAX_TASK_NAME_LEN
303     #define configMAX_TASK_NAME_LEN    16
304 #endif
305
306 #ifndef configIDLE_SHOULD_YIELD
307     #define configIDLE_SHOULD_YIELD    1
308 #endif
309
310 #if configMAX_TASK_NAME_LEN < 1
311     #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
312 #endif
313
314 #ifndef configASSERT
315     #define configASSERT( x )
316     #define configASSERT_DEFINED    0
317 #else
318     #define configASSERT_DEFINED    1
319 #endif
320
321 /* configPRECONDITION should be defined as configASSERT.
322  * The CBMC proofs need a way to track assumptions and assertions.
323  * A configPRECONDITION statement should express an implicit invariant or
324  * assumption made.  A configASSERT statement should express an invariant that must
325  * hold explicit before calling the code. */
326 #ifndef configPRECONDITION
327     #define configPRECONDITION( X )    configASSERT( X )
328     #define configPRECONDITION_DEFINED    0
329 #else
330     #define configPRECONDITION_DEFINED    1
331 #endif
332
333 #ifndef portMEMORY_BARRIER
334     #define portMEMORY_BARRIER()
335 #endif
336
337 #ifndef portSOFTWARE_BARRIER
338     #define portSOFTWARE_BARRIER()
339 #endif
340
341 /* The timers module relies on xTaskGetSchedulerState(). */
342 #if configUSE_TIMERS == 1
343
344     #ifndef configTIMER_TASK_PRIORITY
345         #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
346     #endif /* configTIMER_TASK_PRIORITY */
347
348     #ifndef configTIMER_QUEUE_LENGTH
349         #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
350     #endif /* configTIMER_QUEUE_LENGTH */
351
352     #ifndef configTIMER_TASK_STACK_DEPTH
353         #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
354     #endif /* configTIMER_TASK_STACK_DEPTH */
355
356 #endif /* configUSE_TIMERS */
357
358 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
359     #define portSET_INTERRUPT_MASK_FROM_ISR()    0
360 #endif
361
362 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
363     #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue )    ( void ) ( uxSavedStatusValue )
364 #endif
365
366 #ifndef portCLEAN_UP_TCB
367     #define portCLEAN_UP_TCB( pxTCB )    ( void ) ( pxTCB )
368 #endif
369
370 #ifndef portPRE_TASK_DELETE_HOOK
371     #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
372 #endif
373
374 #ifndef portSETUP_TCB
375     #define portSETUP_TCB( pxTCB )    ( void ) ( pxTCB )
376 #endif
377
378 #ifndef configQUEUE_REGISTRY_SIZE
379     #define configQUEUE_REGISTRY_SIZE    0U
380 #endif
381
382 #if ( configQUEUE_REGISTRY_SIZE < 1 )
383     #define vQueueAddToRegistry( xQueue, pcName )
384     #define vQueueUnregisterQueue( xQueue )
385     #define pcQueueGetName( xQueue )
386 #endif
387
388 #ifndef configUSE_MINI_LIST_ITEM
389     #define configUSE_MINI_LIST_ITEM    1
390 #endif
391
392 #ifndef portPOINTER_SIZE_TYPE
393     #define portPOINTER_SIZE_TYPE    uint32_t
394 #endif
395
396 /* Remove any unused trace macros. */
397 #ifndef traceSTART
398
399 /* Used to perform any necessary initialisation - for example, open a file
400  * into which trace is to be written. */
401     #define traceSTART()
402 #endif
403
404 #ifndef traceEND
405
406 /* Use to close a trace, for example close a file into which trace has been
407  * written. */
408     #define traceEND()
409 #endif
410
411 #ifndef traceTASK_SWITCHED_IN
412
413 /* Called after a task has been selected to run.  pxCurrentTCB holds a pointer
414  * to the task control block of the selected task. */
415     #define traceTASK_SWITCHED_IN()
416 #endif
417
418 #ifndef traceINCREASE_TICK_COUNT
419
420 /* Called before stepping the tick count after waking from tickless idle
421  * sleep. */
422     #define traceINCREASE_TICK_COUNT( x )
423 #endif
424
425 #ifndef traceLOW_POWER_IDLE_BEGIN
426     /* Called immediately before entering tickless idle. */
427     #define traceLOW_POWER_IDLE_BEGIN()
428 #endif
429
430 #ifndef traceLOW_POWER_IDLE_END
431     /* Called when returning to the Idle task after a tickless idle. */
432     #define traceLOW_POWER_IDLE_END()
433 #endif
434
435 #ifndef traceTASK_SWITCHED_OUT
436
437 /* Called before a task has been selected to run.  pxCurrentTCB holds a pointer
438  * to the task control block of the task being switched out. */
439     #define traceTASK_SWITCHED_OUT()
440 #endif
441
442 #ifndef traceTASK_PRIORITY_INHERIT
443
444 /* Called when a task attempts to take a mutex that is already held by a
445  * lower priority task.  pxTCBOfMutexHolder is a pointer to the TCB of the task
446  * that holds the mutex.  uxInheritedPriority is the priority the mutex holder
447  * will inherit (the priority of the task that is attempting to obtain the
448  * muted. */
449     #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
450 #endif
451
452 #ifndef traceTASK_PRIORITY_DISINHERIT
453
454 /* Called when a task releases a mutex, the holding of which had resulted in
455  * the task inheriting the priority of a higher priority task.
456  * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
457  * mutex.  uxOriginalPriority is the task's configured (base) priority. */
458     #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
459 #endif
460
461 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
462
463 /* Task is about to block because it cannot read from a
464  * queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore
465  * upon which the read was attempted.  pxCurrentTCB points to the TCB of the
466  * task that attempted the read. */
467     #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
468 #endif
469
470 #ifndef traceBLOCKING_ON_QUEUE_PEEK
471
472 /* Task is about to block because it cannot read from a
473  * queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore
474  * upon which the read was attempted.  pxCurrentTCB points to the TCB of the
475  * task that attempted the read. */
476     #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
477 #endif
478
479 #ifndef traceBLOCKING_ON_QUEUE_SEND
480
481 /* Task is about to block because it cannot write to a
482  * queue/mutex/semaphore.  pxQueue is a pointer to the queue/mutex/semaphore
483  * upon which the write was attempted.  pxCurrentTCB points to the TCB of the
484  * task that attempted the write. */
485     #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
486 #endif
487
488 #ifndef configCHECK_FOR_STACK_OVERFLOW
489     #define configCHECK_FOR_STACK_OVERFLOW    0
490 #endif
491
492 #ifndef configRECORD_STACK_HIGH_ADDRESS
493     #define configRECORD_STACK_HIGH_ADDRESS    0
494 #endif
495
496 #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
497     #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H    0
498 #endif
499
500 /* The following event macros are embedded in the kernel API calls. */
501
502 #ifndef traceMOVED_TASK_TO_READY_STATE
503     #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
504 #endif
505
506 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
507     #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
508 #endif
509
510 #ifndef traceQUEUE_CREATE
511     #define traceQUEUE_CREATE( pxNewQueue )
512 #endif
513
514 #ifndef traceQUEUE_CREATE_FAILED
515     #define traceQUEUE_CREATE_FAILED( ucQueueType )
516 #endif
517
518 #ifndef traceCREATE_MUTEX
519     #define traceCREATE_MUTEX( pxNewQueue )
520 #endif
521
522 #ifndef traceCREATE_MUTEX_FAILED
523     #define traceCREATE_MUTEX_FAILED()
524 #endif
525
526 #ifndef traceGIVE_MUTEX_RECURSIVE
527     #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
528 #endif
529
530 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
531     #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
532 #endif
533
534 #ifndef traceTAKE_MUTEX_RECURSIVE
535     #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
536 #endif
537
538 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
539     #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
540 #endif
541
542 #ifndef traceCREATE_COUNTING_SEMAPHORE
543     #define traceCREATE_COUNTING_SEMAPHORE()
544 #endif
545
546 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
547     #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
548 #endif
549
550 #ifndef traceQUEUE_SET_SEND
551     #define traceQUEUE_SET_SEND    traceQUEUE_SEND
552 #endif
553
554 #ifndef traceQUEUE_SEND
555     #define traceQUEUE_SEND( pxQueue )
556 #endif
557
558 #ifndef traceQUEUE_SEND_FAILED
559     #define traceQUEUE_SEND_FAILED( pxQueue )
560 #endif
561
562 #ifndef traceQUEUE_RECEIVE
563     #define traceQUEUE_RECEIVE( pxQueue )
564 #endif
565
566 #ifndef traceQUEUE_PEEK
567     #define traceQUEUE_PEEK( pxQueue )
568 #endif
569
570 #ifndef traceQUEUE_PEEK_FAILED
571     #define traceQUEUE_PEEK_FAILED( pxQueue )
572 #endif
573
574 #ifndef traceQUEUE_PEEK_FROM_ISR
575     #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
576 #endif
577
578 #ifndef traceQUEUE_RECEIVE_FAILED
579     #define traceQUEUE_RECEIVE_FAILED( pxQueue )
580 #endif
581
582 #ifndef traceQUEUE_SEND_FROM_ISR
583     #define traceQUEUE_SEND_FROM_ISR( pxQueue )
584 #endif
585
586 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
587     #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
588 #endif
589
590 #ifndef traceQUEUE_RECEIVE_FROM_ISR
591     #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
592 #endif
593
594 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
595     #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
596 #endif
597
598 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
599     #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
600 #endif
601
602 #ifndef traceQUEUE_DELETE
603     #define traceQUEUE_DELETE( pxQueue )
604 #endif
605
606 #ifndef traceTASK_CREATE
607     #define traceTASK_CREATE( pxNewTCB )
608 #endif
609
610 #ifndef traceTASK_CREATE_FAILED
611     #define traceTASK_CREATE_FAILED()
612 #endif
613
614 #ifndef traceTASK_DELETE
615     #define traceTASK_DELETE( pxTaskToDelete )
616 #endif
617
618 #ifndef traceTASK_DELAY_UNTIL
619     #define traceTASK_DELAY_UNTIL( x )
620 #endif
621
622 #ifndef traceTASK_DELAY
623     #define traceTASK_DELAY()
624 #endif
625
626 #ifndef traceTASK_PRIORITY_SET
627     #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
628 #endif
629
630 #ifndef traceTASK_SUSPEND
631     #define traceTASK_SUSPEND( pxTaskToSuspend )
632 #endif
633
634 #ifndef traceTASK_RESUME
635     #define traceTASK_RESUME( pxTaskToResume )
636 #endif
637
638 #ifndef traceTASK_RESUME_FROM_ISR
639     #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
640 #endif
641
642 #ifndef traceTASK_INCREMENT_TICK
643     #define traceTASK_INCREMENT_TICK( xTickCount )
644 #endif
645
646 #ifndef traceTIMER_CREATE
647     #define traceTIMER_CREATE( pxNewTimer )
648 #endif
649
650 #ifndef traceTIMER_CREATE_FAILED
651     #define traceTIMER_CREATE_FAILED()
652 #endif
653
654 #ifndef traceTIMER_COMMAND_SEND
655     #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
656 #endif
657
658 #ifndef traceTIMER_EXPIRED
659     #define traceTIMER_EXPIRED( pxTimer )
660 #endif
661
662 #ifndef traceTIMER_COMMAND_RECEIVED
663     #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
664 #endif
665
666 #ifndef traceMALLOC
667     #define traceMALLOC( pvAddress, uiSize )
668 #endif
669
670 #ifndef traceFREE
671     #define traceFREE( pvAddress, uiSize )
672 #endif
673
674 #ifndef traceEVENT_GROUP_CREATE
675     #define traceEVENT_GROUP_CREATE( xEventGroup )
676 #endif
677
678 #ifndef traceEVENT_GROUP_CREATE_FAILED
679     #define traceEVENT_GROUP_CREATE_FAILED()
680 #endif
681
682 #ifndef traceEVENT_GROUP_SYNC_BLOCK
683     #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
684 #endif
685
686 #ifndef traceEVENT_GROUP_SYNC_END
687     #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred )    ( void ) ( xTimeoutOccurred )
688 #endif
689
690 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
691     #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
692 #endif
693
694 #ifndef traceEVENT_GROUP_WAIT_BITS_END
695     #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred )    ( void ) ( xTimeoutOccurred )
696 #endif
697
698 #ifndef traceEVENT_GROUP_CLEAR_BITS
699     #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
700 #endif
701
702 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
703     #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
704 #endif
705
706 #ifndef traceEVENT_GROUP_SET_BITS
707     #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
708 #endif
709
710 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
711     #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
712 #endif
713
714 #ifndef traceEVENT_GROUP_DELETE
715     #define traceEVENT_GROUP_DELETE( xEventGroup )
716 #endif
717
718 #ifndef tracePEND_FUNC_CALL
719     #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
720 #endif
721
722 #ifndef tracePEND_FUNC_CALL_FROM_ISR
723     #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
724 #endif
725
726 #ifndef traceQUEUE_REGISTRY_ADD
727     #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
728 #endif
729
730 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
731     #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
732 #endif
733
734 #ifndef traceTASK_NOTIFY_TAKE
735     #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
736 #endif
737
738 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
739     #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
740 #endif
741
742 #ifndef traceTASK_NOTIFY_WAIT
743     #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
744 #endif
745
746 #ifndef traceTASK_NOTIFY
747     #define traceTASK_NOTIFY( uxIndexToNotify )
748 #endif
749
750 #ifndef traceTASK_NOTIFY_FROM_ISR
751     #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
752 #endif
753
754 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
755     #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
756 #endif
757
758 #ifndef traceSTREAM_BUFFER_CREATE_FAILED
759     #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
760 #endif
761
762 #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
763     #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
764 #endif
765
766 #ifndef traceSTREAM_BUFFER_CREATE
767     #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
768 #endif
769
770 #ifndef traceSTREAM_BUFFER_DELETE
771     #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
772 #endif
773
774 #ifndef traceSTREAM_BUFFER_RESET
775     #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
776 #endif
777
778 #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
779     #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
780 #endif
781
782 #ifndef traceSTREAM_BUFFER_SEND
783     #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
784 #endif
785
786 #ifndef traceSTREAM_BUFFER_SEND_FAILED
787     #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
788 #endif
789
790 #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
791     #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
792 #endif
793
794 #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
795     #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
796 #endif
797
798 #ifndef traceSTREAM_BUFFER_RECEIVE
799     #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
800 #endif
801
802 #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
803     #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
804 #endif
805
806 #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
807     #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
808 #endif
809
810 #ifndef configGENERATE_RUN_TIME_STATS
811     #define configGENERATE_RUN_TIME_STATS    0
812 #endif
813
814 #if ( configGENERATE_RUN_TIME_STATS == 1 )
815
816     #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
817         #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.
818     #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
819
820     #ifndef portGET_RUN_TIME_COUNTER_VALUE
821         #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
822             #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.
823         #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
824     #endif /* portGET_RUN_TIME_COUNTER_VALUE */
825
826 #endif /* configGENERATE_RUN_TIME_STATS */
827
828 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
829     #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
830 #endif
831
832 #ifndef configUSE_MALLOC_FAILED_HOOK
833     #define configUSE_MALLOC_FAILED_HOOK    0
834 #endif
835
836 #ifndef portPRIVILEGE_BIT
837     #define portPRIVILEGE_BIT    ( ( UBaseType_t ) 0x00 )
838 #endif
839
840 #ifndef portYIELD_WITHIN_API
841     #define portYIELD_WITHIN_API    portYIELD
842 #endif
843
844 #ifndef portSUPPRESS_TICKS_AND_SLEEP
845     #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
846 #endif
847
848 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
849     #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP    2
850 #endif
851
852 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
853     #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
854 #endif
855
856 #ifndef configUSE_TICKLESS_IDLE
857     #define configUSE_TICKLESS_IDLE    0
858 #endif
859
860 #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
861     #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
862 #endif
863
864 #ifndef configPRE_SLEEP_PROCESSING
865     #define configPRE_SLEEP_PROCESSING( x )
866 #endif
867
868 #ifndef configPOST_SLEEP_PROCESSING
869     #define configPOST_SLEEP_PROCESSING( x )
870 #endif
871
872 #ifndef configUSE_QUEUE_SETS
873     #define configUSE_QUEUE_SETS    0
874 #endif
875
876 #ifndef portTASK_USES_FLOATING_POINT
877     #define portTASK_USES_FLOATING_POINT()
878 #endif
879
880 #ifndef portALLOCATE_SECURE_CONTEXT
881     #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
882 #endif
883
884 #ifndef portDONT_DISCARD
885     #define portDONT_DISCARD
886 #endif
887
888 #ifndef configUSE_TIME_SLICING
889     #define configUSE_TIME_SLICING    1
890 #endif
891
892 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
893     #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS    0
894 #endif
895
896 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
897     #define configUSE_STATS_FORMATTING_FUNCTIONS    0
898 #endif
899
900 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
901     #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
902 #endif
903
904 #ifndef configUSE_TRACE_FACILITY
905     #define configUSE_TRACE_FACILITY    0
906 #endif
907
908 #ifndef mtCOVERAGE_TEST_MARKER
909     #define mtCOVERAGE_TEST_MARKER()
910 #endif
911
912 #ifndef mtCOVERAGE_TEST_DELAY
913     #define mtCOVERAGE_TEST_DELAY()
914 #endif
915
916 #ifndef portASSERT_IF_IN_ISR
917     #define portASSERT_IF_IN_ISR()
918 #endif
919
920 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
921     #define configUSE_PORT_OPTIMISED_TASK_SELECTION    0
922 #endif
923
924 #ifndef configAPPLICATION_ALLOCATED_HEAP
925     #define configAPPLICATION_ALLOCATED_HEAP    0
926 #endif
927
928 #ifndef configUSE_TASK_NOTIFICATIONS
929     #define configUSE_TASK_NOTIFICATIONS    1
930 #endif
931
932 #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
933     #define configTASK_NOTIFICATION_ARRAY_ENTRIES    1
934 #endif
935
936 #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
937     #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
938 #endif
939
940 #ifndef configUSE_POSIX_ERRNO
941     #define configUSE_POSIX_ERRNO    0
942 #endif
943
944 #ifndef configUSE_SB_COMPLETED_CALLBACK
945
946 /* By default per-instance callbacks are not enabled for stream buffer or message buffer. */
947     #define configUSE_SB_COMPLETED_CALLBACK    0
948 #endif
949
950 #ifndef portTICK_TYPE_IS_ATOMIC
951     #define portTICK_TYPE_IS_ATOMIC    0
952 #endif
953
954 #ifndef configSUPPORT_STATIC_ALLOCATION
955     /* Defaults to 0 for backward compatibility. */
956     #define configSUPPORT_STATIC_ALLOCATION    0
957 #endif
958
959 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
960     /* Defaults to 1 for backward compatibility. */
961     #define configSUPPORT_DYNAMIC_ALLOCATION    1
962 #endif
963
964 #if ( ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION != 1 ) )
965     #error configUSE_STATS_FORMATTING_FUNCTIONS cannot be used without dynamic allocation, but configSUPPORT_DYNAMIC_ALLOCATION is not set to 1.
966 #endif
967
968 #if ( configUSE_STATS_FORMATTING_FUNCTIONS > 0 )
969     #if ( ( configUSE_TRACE_FACILITY != 1 ) && ( configGENERATE_RUN_TIME_STATS != 1 ) )
970         #error configUSE_STATS_FORMATTING_FUNCTIONS is 1 but the functions it enables are not used because neither configUSE_TRACE_FACILITY or configGENERATE_RUN_TIME_STATS are 1.  Set configUSE_STATS_FORMATTING_FUNCTIONS to 0 in FreeRTOSConfig.h.
971     #endif
972 #endif
973
974 #ifndef configSTACK_DEPTH_TYPE
975
976 /* Defaults to uint16_t for backward compatibility, but can be overridden
977  * in FreeRTOSConfig.h if uint16_t is too restrictive. */
978     #define configSTACK_DEPTH_TYPE    uint16_t
979 #endif
980
981 #ifndef configRUN_TIME_COUNTER_TYPE
982
983 /* Defaults to uint32_t for backward compatibility, but can be overridden in
984  * FreeRTOSConfig.h if uint32_t is too restrictive. */
985
986     #define configRUN_TIME_COUNTER_TYPE    uint32_t
987 #endif
988
989 #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
990
991 /* Defaults to size_t for backward compatibility, but can be overridden
992  * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
993  * in a size_t. */
994     #define configMESSAGE_BUFFER_LENGTH_TYPE    size_t
995 #endif
996
997 /* Sanity check the configuration. */
998 #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
999     #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
1000 #endif
1001
1002 #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
1003     #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
1004 #endif
1005
1006 #ifndef configINITIAL_TICK_COUNT
1007     #define configINITIAL_TICK_COUNT    0
1008 #endif
1009
1010 #if ( portTICK_TYPE_IS_ATOMIC == 0 )
1011
1012 /* Either variables of tick type cannot be read atomically, or
1013  * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
1014  * the tick count is returned to the standard critical section macros. */
1015     #define portTICK_TYPE_ENTER_CRITICAL()                      portENTER_CRITICAL()
1016     #define portTICK_TYPE_EXIT_CRITICAL()                       portEXIT_CRITICAL()
1017     #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR()         portSET_INTERRUPT_MASK_FROM_ISR()
1018     #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x )    portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
1019 #else
1020
1021 /* The tick type can be read atomically, so critical sections used when the
1022  * tick count is returned can be defined away. */
1023     #define portTICK_TYPE_ENTER_CRITICAL()
1024     #define portTICK_TYPE_EXIT_CRITICAL()
1025     #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR()         0
1026     #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x )    ( void ) ( x )
1027 #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
1028
1029 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
1030  * V8 if desired. */
1031 #ifndef configENABLE_BACKWARD_COMPATIBILITY
1032     #define configENABLE_BACKWARD_COMPATIBILITY    1
1033 #endif
1034
1035 #ifndef configPRINTF
1036
1037 /* configPRINTF() was not defined, so define it away to nothing.  To use
1038  * configPRINTF() then define it as follows (where MyPrintFunction() is
1039  * provided by the application writer):
1040  *
1041  * void MyPrintFunction(const char *pcFormat, ... );
1042  #define configPRINTF( X )   MyPrintFunction X
1043  *
1044  * Then call like a standard printf() function, but placing brackets around
1045  * all parameters so they are passed as a single parameter.  For example:
1046  * configPRINTF( ("Value = %d", MyVariable) ); */
1047     #define configPRINTF( X )
1048 #endif
1049
1050 #ifndef configMAX
1051
1052 /* The application writer has not provided their own MAX macro, so define
1053  * the following generic implementation. */
1054     #define configMAX( a, b )    ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
1055 #endif
1056
1057 #ifndef configMIN
1058
1059 /* The application writer has not provided their own MIN macro, so define
1060  * the following generic implementation. */
1061     #define configMIN( a, b )    ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
1062 #endif
1063
1064 #if configENABLE_BACKWARD_COMPATIBILITY == 1
1065     #define eTaskStateGet                 eTaskGetState
1066     #define portTickType                  TickType_t
1067     #define xTaskHandle                   TaskHandle_t
1068     #define xQueueHandle                  QueueHandle_t
1069     #define xSemaphoreHandle              SemaphoreHandle_t
1070     #define xQueueSetHandle               QueueSetHandle_t
1071     #define xQueueSetMemberHandle         QueueSetMemberHandle_t
1072     #define xTimeOutType                  TimeOut_t
1073     #define xMemoryRegion                 MemoryRegion_t
1074     #define xTaskParameters               TaskParameters_t
1075     #define xTaskStatusType               TaskStatus_t
1076     #define xTimerHandle                  TimerHandle_t
1077     #define xCoRoutineHandle              CoRoutineHandle_t
1078     #define pdTASK_HOOK_CODE              TaskHookFunction_t
1079     #define portTICK_RATE_MS              portTICK_PERIOD_MS
1080     #define pcTaskGetTaskName             pcTaskGetName
1081     #define pcTimerGetTimerName           pcTimerGetName
1082     #define pcQueueGetQueueName           pcQueueGetName
1083     #define vTaskGetTaskInfo              vTaskGetInfo
1084     #define xTaskGetIdleRunTimeCounter    ulTaskGetIdleRunTimeCounter
1085
1086 /* Backward compatibility within the scheduler code only - these definitions
1087  * are not really required but are included for completeness. */
1088     #define tmrTIMER_CALLBACK             TimerCallbackFunction_t
1089     #define pdTASK_CODE                   TaskFunction_t
1090     #define xListItem                     ListItem_t
1091     #define xList                         List_t
1092
1093 /* For libraries that break the list data hiding, and access list structure
1094  * members directly (which is not supposed to be done). */
1095     #define pxContainer                   pvContainer
1096 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
1097
1098 #if ( configUSE_ALTERNATIVE_API != 0 )
1099     #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
1100 #endif
1101
1102 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
1103  * if floating point hardware is otherwise supported by the FreeRTOS port in use.
1104  * This constant is not supported by all FreeRTOS ports that include floating
1105  * point support. */
1106 #ifndef configUSE_TASK_FPU_SUPPORT
1107     #define configUSE_TASK_FPU_SUPPORT    1
1108 #endif
1109
1110 /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
1111  * currently used in ARMv8M ports. */
1112 #ifndef configENABLE_MPU
1113     #define configENABLE_MPU    0
1114 #endif
1115
1116 /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
1117  * currently used in ARMv8M ports. */
1118 #ifndef configENABLE_FPU
1119     #define configENABLE_FPU    1
1120 #endif
1121
1122 /* Set configENABLE_MVE to 1 to enable MVE support and 0 to disable it. This is
1123  * currently used in ARMv8M ports. */
1124 #ifndef configENABLE_MVE
1125     #define configENABLE_MVE    0
1126 #endif
1127
1128 /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
1129  * This is currently used in ARMv8M ports. */
1130 #ifndef configENABLE_TRUSTZONE
1131     #define configENABLE_TRUSTZONE    1
1132 #endif
1133
1134 /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
1135  * the Secure Side only. */
1136 #ifndef configRUN_FREERTOS_SECURE_ONLY
1137     #define configRUN_FREERTOS_SECURE_ONLY    0
1138 #endif
1139
1140 #ifndef configRUN_ADDITIONAL_TESTS
1141     #define configRUN_ADDITIONAL_TESTS    0
1142 #endif
1143
1144
1145 /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
1146  * dynamically allocated RAM, in which case when any task is deleted it is known
1147  * that both the task's stack and TCB need to be freed.  Sometimes the
1148  * FreeRTOSConfig.h settings only allow a task to be created using statically
1149  * allocated RAM, in which case when any task is deleted it is known that neither
1150  * the task's stack or TCB should be freed.  Sometimes the FreeRTOSConfig.h
1151  * settings allow a task to be created using either statically or dynamically
1152  * allocated RAM, in which case a member of the TCB is used to record whether the
1153  * stack and/or TCB were allocated statically or dynamically, so when a task is
1154  * deleted the RAM that was allocated dynamically is freed again and no attempt is
1155  * made to free the RAM that was allocated statically.
1156  * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
1157  * task to be created using either statically or dynamically allocated RAM.  Note
1158  * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
1159  * a statically allocated stack and a dynamically allocated TCB.
1160  *
1161  * The following table lists various combinations of portUSING_MPU_WRAPPERS,
1162  * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
1163  * when it is possible to have both static and dynamic allocation:
1164  *  +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1165  * | MPU | Dynamic | Static |     Available Functions     |       Possible Allocations        | Both Dynamic and | Need Free |
1166  * |     |         |        |                             |                                   | Static Possible  |           |
1167  * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1168  * | 0   | 0       | 1      | xTaskCreateStatic           | TCB - Static, Stack - Static      | No               | No        |
1169  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1170  * | 0   | 1       | 0      | xTaskCreate                 | TCB - Dynamic, Stack - Dynamic    | No               | Yes       |
1171  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1172  * | 0   | 1       | 1      | xTaskCreate,                | 1. TCB - Dynamic, Stack - Dynamic | Yes              | Yes       |
1173  * |     |         |        | xTaskCreateStatic           | 2. TCB - Static, Stack - Static   |                  |           |
1174  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1175  * | 1   | 0       | 1      | xTaskCreateStatic,          | TCB - Static, Stack - Static      | No               | No        |
1176  * |     |         |        | xTaskCreateRestrictedStatic |                                   |                  |           |
1177  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1178  * | 1   | 1       | 0      | xTaskCreate,                | 1. TCB - Dynamic, Stack - Dynamic | Yes              | Yes       |
1179  * |     |         |        | xTaskCreateRestricted       | 2. TCB - Dynamic, Stack - Static  |                  |           |
1180  * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
1181  * | 1   | 1       | 1      | xTaskCreate,                | 1. TCB - Dynamic, Stack - Dynamic | Yes              | Yes       |
1182  * |     |         |        | xTaskCreateStatic,          | 2. TCB - Dynamic, Stack - Static  |                  |           |
1183  * |     |         |        | xTaskCreateRestricted,      | 3. TCB - Static, Stack - Static   |                  |           |
1184  * |     |         |        | xTaskCreateRestrictedStatic |                                   |                  |           |
1185  * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
1186  */
1187 #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE                                                                                     \
1188     ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
1189       ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
1190
1191 /*
1192  * In line with software engineering best practice, FreeRTOS implements a strict
1193  * data hiding policy, so the real structures used by FreeRTOS to maintain the
1194  * state of tasks, queues, semaphores, etc. are not accessible to the application
1195  * code.  However, if the application writer wants to statically allocate such
1196  * an object then the size of the object needs to be known.  Dummy structures
1197  * that are guaranteed to have the same size and alignment requirements of the
1198  * real objects are used for this purpose.  The dummy list and list item
1199  * structures below are used for inclusion in such a dummy structure.
1200  */
1201 struct xSTATIC_LIST_ITEM
1202 {
1203     #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1204         TickType_t xDummy1;
1205     #endif
1206     TickType_t xDummy2;
1207     void * pvDummy3[ 4 ];
1208     #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1209         TickType_t xDummy4;
1210     #endif
1211 };
1212 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
1213
1214 #if ( configUSE_MINI_LIST_ITEM == 1 )
1215     /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1216     struct xSTATIC_MINI_LIST_ITEM
1217     {
1218         #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1219             TickType_t xDummy1;
1220         #endif
1221         TickType_t xDummy2;
1222         void * pvDummy3[ 2 ];
1223     };
1224     typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
1225 #else /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1226     typedef struct xSTATIC_LIST_ITEM      StaticMiniListItem_t;
1227 #endif /* if ( configUSE_MINI_LIST_ITEM == 1 ) */
1228
1229 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
1230 typedef struct xSTATIC_LIST
1231 {
1232     #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1233         TickType_t xDummy1;
1234     #endif
1235     UBaseType_t uxDummy2;
1236     void * pvDummy3;
1237     StaticMiniListItem_t xDummy4;
1238     #if ( configUSE_LIST_DATA_INTEGRITY_CHECK_BYTES == 1 )
1239         TickType_t xDummy5;
1240     #endif
1241 } StaticList_t;
1242
1243 /*
1244  * In line with software engineering best practice, especially when supplying a
1245  * library that is likely to change in future versions, FreeRTOS implements a
1246  * strict data hiding policy.  This means the Task structure used internally by
1247  * FreeRTOS is not accessible to application code.  However, if the application
1248  * writer wants to statically allocate the memory required to create a task then
1249  * the size of the task object needs to be known.  The StaticTask_t structure
1250  * below is provided for this purpose.  Its sizes and alignment requirements are
1251  * guaranteed to match those of the genuine structure, no matter which
1252  * architecture is being used, and no matter how the values in FreeRTOSConfig.h
1253  * are set.  Its contents are somewhat obfuscated in the hope users will
1254  * recognise that it would be unwise to make direct use of the structure members.
1255  */
1256 typedef struct xSTATIC_TCB
1257 {
1258     void * pxDummy1;
1259     #if ( portUSING_MPU_WRAPPERS == 1 )
1260         xMPU_SETTINGS xDummy2;
1261     #endif
1262     StaticListItem_t xDummy3[ 2 ];
1263     UBaseType_t uxDummy5;
1264     void * pxDummy6;
1265     uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
1266     #if ( ( portSTACK_GROWTH > 0 ) || ( configRECORD_STACK_HIGH_ADDRESS == 1 ) )
1267         void * pxDummy8;
1268     #endif
1269     #if ( portCRITICAL_NESTING_IN_TCB == 1 )
1270         UBaseType_t uxDummy9;
1271     #endif
1272     #if ( configUSE_TRACE_FACILITY == 1 )
1273         UBaseType_t uxDummy10[ 2 ];
1274     #endif
1275     #if ( configUSE_MUTEXES == 1 )
1276         UBaseType_t uxDummy12[ 2 ];
1277     #endif
1278     #if ( configUSE_APPLICATION_TASK_TAG == 1 )
1279         void * pxDummy14;
1280     #endif
1281     #if ( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
1282         void * pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
1283     #endif
1284     #if ( configGENERATE_RUN_TIME_STATS == 1 )
1285         configRUN_TIME_COUNTER_TYPE ulDummy16;
1286     #endif
1287     #if ( ( configUSE_NEWLIB_REENTRANT == 1 ) || ( configUSE_C_RUNTIME_TLS_SUPPORT == 1 ) )
1288         configTLS_BLOCK_TYPE xDummy17;
1289     #endif
1290     #if ( configUSE_TASK_NOTIFICATIONS == 1 )
1291         uint32_t ulDummy18[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1292         uint8_t ucDummy19[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
1293     #endif
1294     #if ( tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE != 0 )
1295         uint8_t uxDummy20;
1296     #endif
1297
1298     #if ( INCLUDE_xTaskAbortDelay == 1 )
1299         uint8_t ucDummy21;
1300     #endif
1301     #if ( configUSE_POSIX_ERRNO == 1 )
1302         int iDummy22;
1303     #endif
1304 } StaticTask_t;
1305
1306 /*
1307  * In line with software engineering best practice, especially when supplying a
1308  * library that is likely to change in future versions, FreeRTOS implements a
1309  * strict data hiding policy.  This means the Queue structure used internally by
1310  * FreeRTOS is not accessible to application code.  However, if the application
1311  * writer wants to statically allocate the memory required to create a queue
1312  * then the size of the queue object needs to be known.  The StaticQueue_t
1313  * structure below is provided for this purpose.  Its sizes and alignment
1314  * requirements are guaranteed to match those of the genuine structure, no
1315  * matter which architecture is being used, and no matter how the values in
1316  * FreeRTOSConfig.h are set.  Its contents are somewhat obfuscated in the hope
1317  * users will recognise that it would be unwise to make direct use of the
1318  * structure members.
1319  */
1320 typedef struct xSTATIC_QUEUE
1321 {
1322     void * pvDummy1[ 3 ];
1323
1324     union
1325     {
1326         void * pvDummy2;
1327         UBaseType_t uxDummy2;
1328     } u;
1329
1330     StaticList_t xDummy3[ 2 ];
1331     UBaseType_t uxDummy4[ 3 ];
1332     uint8_t ucDummy5[ 2 ];
1333
1334     #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1335         uint8_t ucDummy6;
1336     #endif
1337
1338     #if ( configUSE_QUEUE_SETS == 1 )
1339         void * pvDummy7;
1340     #endif
1341
1342     #if ( configUSE_TRACE_FACILITY == 1 )
1343         UBaseType_t uxDummy8;
1344         uint8_t ucDummy9;
1345     #endif
1346 } StaticQueue_t;
1347 typedef StaticQueue_t StaticSemaphore_t;
1348
1349 /*
1350  * In line with software engineering best practice, especially when supplying a
1351  * library that is likely to change in future versions, FreeRTOS implements a
1352  * strict data hiding policy.  This means the event group structure used
1353  * internally by FreeRTOS is not accessible to application code.  However, if
1354  * the application writer wants to statically allocate the memory required to
1355  * create an event group then the size of the event group object needs to be
1356  * know.  The StaticEventGroup_t structure below is provided for this purpose.
1357  * Its sizes and alignment requirements are guaranteed to match those of the
1358  * genuine structure, no matter which architecture is being used, and no matter
1359  * how the values in FreeRTOSConfig.h are set.  Its contents are somewhat
1360  * obfuscated in the hope users will recognise that it would be unwise to make
1361  * direct use of the structure members.
1362  */
1363 typedef struct xSTATIC_EVENT_GROUP
1364 {
1365     TickType_t xDummy1;
1366     StaticList_t xDummy2;
1367
1368     #if ( configUSE_TRACE_FACILITY == 1 )
1369         UBaseType_t uxDummy3;
1370     #endif
1371
1372     #if ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1373         uint8_t ucDummy4;
1374     #endif
1375 } StaticEventGroup_t;
1376
1377 /*
1378  * In line with software engineering best practice, especially when supplying a
1379  * library that is likely to change in future versions, FreeRTOS implements a
1380  * strict data hiding policy.  This means the software timer structure used
1381  * internally by FreeRTOS is not accessible to application code.  However, if
1382  * the application writer wants to statically allocate the memory required to
1383  * create a software timer then the size of the queue object needs to be known.
1384  * The StaticTimer_t structure below is provided for this purpose.  Its sizes
1385  * and alignment requirements are guaranteed to match those of the genuine
1386  * structure, no matter which architecture is being used, and no matter how the
1387  * values in FreeRTOSConfig.h are set.  Its contents are somewhat obfuscated in
1388  * the hope users will recognise that it would be unwise to make direct use of
1389  * the structure members.
1390  */
1391 typedef struct xSTATIC_TIMER
1392 {
1393     void * pvDummy1;
1394     StaticListItem_t xDummy2;
1395     TickType_t xDummy3;
1396     void * pvDummy5;
1397     TaskFunction_t pvDummy6;
1398     #if ( configUSE_TRACE_FACILITY == 1 )
1399         UBaseType_t uxDummy7;
1400     #endif
1401     uint8_t ucDummy8;
1402 } StaticTimer_t;
1403
1404 /*
1405  * In line with software engineering best practice, especially when supplying a
1406  * library that is likely to change in future versions, FreeRTOS implements a
1407  * strict data hiding policy.  This means the stream buffer structure used
1408  * internally by FreeRTOS is not accessible to application code.  However, if
1409  * the application writer wants to statically allocate the memory required to
1410  * create a stream buffer then the size of the stream buffer object needs to be
1411  * known.  The StaticStreamBuffer_t structure below is provided for this
1412  * purpose.  Its size and alignment requirements are guaranteed to match those
1413  * of the genuine structure, no matter which architecture is being used, and
1414  * no matter how the values in FreeRTOSConfig.h are set.  Its contents are
1415  * somewhat obfuscated in the hope users will recognise that it would be unwise
1416  * to make direct use of the structure members.
1417  */
1418 typedef struct xSTATIC_STREAM_BUFFER
1419 {
1420     size_t uxDummy1[ 4 ];
1421     void * pvDummy2[ 3 ];
1422     uint8_t ucDummy3;
1423     #if ( configUSE_TRACE_FACILITY == 1 )
1424         UBaseType_t uxDummy4;
1425     #endif
1426     #if ( configUSE_SB_COMPLETED_CALLBACK == 1 )
1427         void * pvDummy5[ 2 ];
1428     #endif
1429 } StaticStreamBuffer_t;
1430
1431 /* Message buffers are built on stream buffers. */
1432 typedef StaticStreamBuffer_t StaticMessageBuffer_t;
1433
1434 /* *INDENT-OFF* */
1435 #ifdef __cplusplus
1436     }
1437 #endif
1438 /* *INDENT-ON* */
1439
1440 #endif /* INC_FREERTOS_H */