FreeRTOS Tetris
FreeRTOS.h
1 /*
2  FreeRTOS V9.0.0 - 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 /* Must be defaulted before configUSE_NEWLIB_REENTRANT is used below. */
107 #ifndef configUSE_NEWLIB_REENTRANT
108 #define configUSE_NEWLIB_REENTRANT 0
109 #endif
110 
111 /* Required if struct _reent is used. */
112 #if ( configUSE_NEWLIB_REENTRANT == 1 )
113 #include <reent.h>
114 #endif
115 /*
116  * Check all the required application specific macros have been defined.
117  * These macros are application specific and (as downloaded) are defined
118  * within FreeRTOSConfig.h.
119  */
120 
121 #ifndef configMINIMAL_STACK_SIZE
122 #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.
123 #endif
124 
125 #ifndef configMAX_PRIORITIES
126 #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
127 #endif
128 
129 #ifndef configUSE_PREEMPTION
130 #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.
131 #endif
132 
133 #ifndef configUSE_IDLE_HOOK
134 #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.
135 #endif
136 
137 #ifndef configUSE_TICK_HOOK
138 #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.
139 #endif
140 
141 #ifndef configUSE_16_BIT_TICKS
142 #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.
143 #endif
144 
145 #ifndef configMAX_PRIORITIES
146 #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
147 #endif
148 
149 #ifndef configUSE_CO_ROUTINES
150 #define configUSE_CO_ROUTINES 0
151 #endif
152 
153 #ifndef INCLUDE_vTaskPrioritySet
154 #define INCLUDE_vTaskPrioritySet 0
155 #endif
156 
157 #ifndef INCLUDE_uxTaskPriorityGet
158 #define INCLUDE_uxTaskPriorityGet 0
159 #endif
160 
161 #ifndef INCLUDE_vTaskDelete
162 #define INCLUDE_vTaskDelete 0
163 #endif
164 
165 #ifndef INCLUDE_vTaskSuspend
166 #define INCLUDE_vTaskSuspend 0
167 #endif
168 
169 #ifndef INCLUDE_vTaskDelayUntil
170 #define INCLUDE_vTaskDelayUntil 0
171 #endif
172 
173 #ifndef INCLUDE_vTaskDelay
174 #define INCLUDE_vTaskDelay 0
175 #endif
176 
177 #ifndef INCLUDE_xTaskGetIdleTaskHandle
178 #define INCLUDE_xTaskGetIdleTaskHandle 0
179 #endif
180 
181 #ifndef INCLUDE_xTaskAbortDelay
182 #define INCLUDE_xTaskAbortDelay 1
183 #endif
184 
185 #ifndef INCLUDE_xQueueGetMutexHolder
186 #define INCLUDE_xQueueGetMutexHolder 0
187 #endif
188 
189 #ifndef INCLUDE_xSemaphoreGetMutexHolder
190 #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
191 #endif
192 
193 #ifndef INCLUDE_xTaskGetHandle
194 #define INCLUDE_xTaskGetHandle 0
195 #endif
196 
197 #ifndef INCLUDE_uxTaskGetStackHighWaterMark
198 #define INCLUDE_uxTaskGetStackHighWaterMark 0
199 #endif
200 
201 #ifndef INCLUDE_eTaskGetState
202 #define INCLUDE_eTaskGetState 0
203 #endif
204 
205 #ifndef INCLUDE_xTaskResumeFromISR
206 #define INCLUDE_xTaskResumeFromISR 1
207 #endif
208 
209 #ifndef INCLUDE_xTimerPendFunctionCall
210 #define INCLUDE_xTimerPendFunctionCall 0
211 #endif
212 
213 #ifndef INCLUDE_xTaskGetSchedulerState
214 #define INCLUDE_xTaskGetSchedulerState 0
215 #endif
216 
217 #ifndef INCLUDE_xTaskGetCurrentTaskHandle
218 #define INCLUDE_xTaskGetCurrentTaskHandle 0
219 #endif
220 
221 #if configUSE_CO_ROUTINES != 0
222 #ifndef configMAX_CO_ROUTINE_PRIORITIES
223 #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
224 #endif
225 #endif
226 
227 #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
228 #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
229 #endif
230 
231 #ifndef configUSE_APPLICATION_TASK_TAG
232 #define configUSE_APPLICATION_TASK_TAG 0
233 #endif
234 
235 #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
236 #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
237 #endif
238 
239 #ifndef configUSE_RECURSIVE_MUTEXES
240 #define configUSE_RECURSIVE_MUTEXES 0
241 #endif
242 
243 #ifndef configUSE_MUTEXES
244 #define configUSE_MUTEXES 0
245 #endif
246 
247 #ifndef configUSE_TIMERS
248 #define configUSE_TIMERS 1
249 #endif
250 
251 #ifndef configUSE_COUNTING_SEMAPHORES
252 #define configUSE_COUNTING_SEMAPHORES 0
253 #endif
254 
255 #ifndef configUSE_ALTERNATIVE_API
256 #define configUSE_ALTERNATIVE_API 0
257 #endif
258 
259 #ifndef portCRITICAL_NESTING_IN_TCB
260 #define portCRITICAL_NESTING_IN_TCB 0
261 #endif
262 
263 #ifndef configMAX_TASK_NAME_LEN
264 #define configMAX_TASK_NAME_LEN 16
265 #endif
266 
267 #ifndef configIDLE_SHOULD_YIELD
268 #define configIDLE_SHOULD_YIELD 1
269 #endif
270 
271 #if configMAX_TASK_NAME_LEN < 1
272 #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
273 #endif
274 
275 #ifndef configASSERT
276 #define configASSERT( x )
277 #define configASSERT_DEFINED 0
278 #else
279 #define configASSERT_DEFINED 1
280 #endif
281 
282 /* The timers module relies on xTaskGetSchedulerState(). */
283 #if configUSE_TIMERS == 1
284 
285 #ifndef configTIMER_TASK_PRIORITY
286 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
287 #endif /* configTIMER_TASK_PRIORITY */
288 
289 #ifndef configTIMER_QUEUE_LENGTH
290 #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
291 #endif /* configTIMER_QUEUE_LENGTH */
292 
293 #ifndef configTIMER_TASK_STACK_DEPTH
294 #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
295 #endif /* configTIMER_TASK_STACK_DEPTH */
296 
297 #endif /* configUSE_TIMERS */
298 
299 #ifndef portSET_INTERRUPT_MASK_FROM_ISR
300 #define portSET_INTERRUPT_MASK_FROM_ISR() 0
301 #endif
302 
303 #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
304 #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
305 #endif
306 
307 #ifndef portCLEAN_UP_TCB
308 #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
309 #endif
310 
311 #ifndef portPRE_TASK_DELETE_HOOK
312 #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
313 #endif
314 
315 #ifndef portSETUP_TCB
316 #define portSETUP_TCB( pxTCB ) ( void ) pxTCB
317 #endif
318 
319 #ifndef configQUEUE_REGISTRY_SIZE
320 #define configQUEUE_REGISTRY_SIZE 0U
321 #endif
322 
323 #if ( configQUEUE_REGISTRY_SIZE < 1 )
324 #define vQueueAddToRegistry( xQueue, pcName )
325 #define vQueueUnregisterQueue( xQueue )
326 #define pcQueueGetName( xQueue )
327 #endif
328 
329 #ifndef portPOINTER_SIZE_TYPE
330 #define portPOINTER_SIZE_TYPE uint32_t
331 #endif
332 
333 /* Remove any unused trace macros. */
334 #ifndef traceSTART
335 /* Used to perform any necessary initialisation - for example, open a file
336 into which trace is to be written. */
337 #define traceSTART()
338 #endif
339 
340 #ifndef traceEND
341 /* Use to close a trace, for example close a file into which trace has been
342 written. */
343 #define traceEND()
344 #endif
345 
346 #ifndef traceTASK_SWITCHED_IN
347 /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
348 to the task control block of the selected task. */
349 #define traceTASK_SWITCHED_IN()
350 #endif
351 
352 #ifndef traceINCREASE_TICK_COUNT
353 /* Called before stepping the tick count after waking from tickless idle
354 sleep. */
355 #define traceINCREASE_TICK_COUNT( x )
356 #endif
357 
358 #ifndef traceLOW_POWER_IDLE_BEGIN
359 /* Called immediately before entering tickless idle. */
360 #define traceLOW_POWER_IDLE_BEGIN()
361 #endif
362 
363 #ifndef traceLOW_POWER_IDLE_END
364 /* Called when returning to the Idle task after a tickless idle. */
365 #define traceLOW_POWER_IDLE_END()
366 #endif
367 
368 #ifndef traceTASK_SWITCHED_OUT
369 /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
370 to the task control block of the task being switched out. */
371 #define traceTASK_SWITCHED_OUT()
372 #endif
373 
374 #ifndef traceTASK_PRIORITY_INHERIT
375 /* Called when a task attempts to take a mutex that is already held by a
376 lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
377 that holds the mutex. uxInheritedPriority is the priority the mutex holder
378 will inherit (the priority of the task that is attempting to obtain the
379 muted. */
380 #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
381 #endif
382 
383 #ifndef traceTASK_PRIORITY_DISINHERIT
384 /* Called when a task releases a mutex, the holding of which had resulted in
385 the task inheriting the priority of a higher priority task.
386 pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
387 mutex. uxOriginalPriority is the task's configured (base) priority. */
388 #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
389 #endif
390 
391 #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
392 /* Task is about to block because it cannot read from a
393 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
394 upon which the read was attempted. pxCurrentTCB points to the TCB of the
395 task that attempted the read. */
396 #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
397 #endif
398 
399 #ifndef traceBLOCKING_ON_QUEUE_SEND
400 /* Task is about to block because it cannot write to a
401 queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
402 upon which the write was attempted. pxCurrentTCB points to the TCB of the
403 task that attempted the write. */
404 #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
405 #endif
406 
407 #ifndef configCHECK_FOR_STACK_OVERFLOW
408 #define configCHECK_FOR_STACK_OVERFLOW 0
409 #endif
410 
411 /* The following event macros are embedded in the kernel API calls. */
412 
413 #ifndef traceMOVED_TASK_TO_READY_STATE
414 #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
415 #endif
416 
417 #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
418 #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
419 #endif
420 
421 #ifndef traceQUEUE_CREATE
422 #define traceQUEUE_CREATE( pxNewQueue )
423 #endif
424 
425 #ifndef traceQUEUE_CREATE_FAILED
426 #define traceQUEUE_CREATE_FAILED( ucQueueType )
427 #endif
428 
429 #ifndef traceCREATE_MUTEX
430 #define traceCREATE_MUTEX( pxNewQueue )
431 #endif
432 
433 #ifndef traceCREATE_MUTEX_FAILED
434 #define traceCREATE_MUTEX_FAILED()
435 #endif
436 
437 #ifndef traceGIVE_MUTEX_RECURSIVE
438 #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
439 #endif
440 
441 #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
442 #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
443 #endif
444 
445 #ifndef traceTAKE_MUTEX_RECURSIVE
446 #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
447 #endif
448 
449 #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
450 #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
451 #endif
452 
453 #ifndef traceCREATE_COUNTING_SEMAPHORE
454 #define traceCREATE_COUNTING_SEMAPHORE()
455 #endif
456 
457 #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
458 #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
459 #endif
460 
461 #ifndef traceQUEUE_SEND
462 #define traceQUEUE_SEND( pxQueue )
463 #endif
464 
465 #ifndef traceQUEUE_SEND_FAILED
466 #define traceQUEUE_SEND_FAILED( pxQueue )
467 #endif
468 
469 #ifndef traceQUEUE_RECEIVE
470 #define traceQUEUE_RECEIVE( pxQueue )
471 #endif
472 
473 #ifndef traceQUEUE_PEEK
474 #define traceQUEUE_PEEK( pxQueue )
475 #endif
476 
477 #ifndef traceQUEUE_PEEK_FROM_ISR
478 #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
479 #endif
480 
481 #ifndef traceQUEUE_RECEIVE_FAILED
482 #define traceQUEUE_RECEIVE_FAILED( pxQueue )
483 #endif
484 
485 #ifndef traceQUEUE_SEND_FROM_ISR
486 #define traceQUEUE_SEND_FROM_ISR( pxQueue )
487 #endif
488 
489 #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
490 #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
491 #endif
492 
493 #ifndef traceQUEUE_RECEIVE_FROM_ISR
494 #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
495 #endif
496 
497 #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
498 #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
499 #endif
500 
501 #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
502 #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
503 #endif
504 
505 #ifndef traceQUEUE_DELETE
506 #define traceQUEUE_DELETE( pxQueue )
507 #endif
508 
509 #ifndef traceTASK_CREATE
510 #define traceTASK_CREATE( pxNewTCB )
511 #endif
512 
513 #ifndef traceTASK_CREATE_FAILED
514 #define traceTASK_CREATE_FAILED()
515 #endif
516 
517 #ifndef traceTASK_DELETE
518 #define traceTASK_DELETE( pxTaskToDelete )
519 #endif
520 
521 #ifndef traceTASK_DELAY_UNTIL
522 #define traceTASK_DELAY_UNTIL( x )
523 #endif
524 
525 #ifndef traceTASK_DELAY
526 #define traceTASK_DELAY()
527 #endif
528 
529 #ifndef traceTASK_PRIORITY_SET
530 #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
531 #endif
532 
533 #ifndef traceTASK_SUSPEND
534 #define traceTASK_SUSPEND( pxTaskToSuspend )
535 #endif
536 
537 #ifndef traceTASK_RESUME
538 #define traceTASK_RESUME( pxTaskToResume )
539 #endif
540 
541 #ifndef traceTASK_RESUME_FROM_ISR
542 #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
543 #endif
544 
545 #ifndef traceTASK_INCREMENT_TICK
546 #define traceTASK_INCREMENT_TICK( xTickCount )
547 #endif
548 
549 #ifndef traceTIMER_CREATE
550 #define traceTIMER_CREATE( pxNewTimer )
551 #endif
552 
553 #ifndef traceTIMER_CREATE_FAILED
554 #define traceTIMER_CREATE_FAILED()
555 #endif
556 
557 #ifndef traceTIMER_COMMAND_SEND
558 #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
559 #endif
560 
561 #ifndef traceTIMER_EXPIRED
562 #define traceTIMER_EXPIRED( pxTimer )
563 #endif
564 
565 #ifndef traceTIMER_COMMAND_RECEIVED
566 #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
567 #endif
568 
569 #ifndef traceMALLOC
570 #define traceMALLOC( pvAddress, uiSize )
571 #endif
572 
573 #ifndef traceFREE
574 #define traceFREE( pvAddress, uiSize )
575 #endif
576 
577 #ifndef traceEVENT_GROUP_CREATE
578 #define traceEVENT_GROUP_CREATE( xEventGroup )
579 #endif
580 
581 #ifndef traceEVENT_GROUP_CREATE_FAILED
582 #define traceEVENT_GROUP_CREATE_FAILED()
583 #endif
584 
585 #ifndef traceEVENT_GROUP_SYNC_BLOCK
586 #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
587 #endif
588 
589 #ifndef traceEVENT_GROUP_SYNC_END
590 #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
591 #endif
592 
593 #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
594 #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
595 #endif
596 
597 #ifndef traceEVENT_GROUP_WAIT_BITS_END
598 #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
599 #endif
600 
601 #ifndef traceEVENT_GROUP_CLEAR_BITS
602 #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
603 #endif
604 
605 #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
606 #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
607 #endif
608 
609 #ifndef traceEVENT_GROUP_SET_BITS
610 #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
611 #endif
612 
613 #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
614 #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
615 #endif
616 
617 #ifndef traceEVENT_GROUP_DELETE
618 #define traceEVENT_GROUP_DELETE( xEventGroup )
619 #endif
620 
621 #ifndef tracePEND_FUNC_CALL
622 #define tracePEND_FUNC_CALL(xFunctionToPend, pvParameter1, ulParameter2, ret)
623 #endif
624 
625 #ifndef tracePEND_FUNC_CALL_FROM_ISR
626 #define tracePEND_FUNC_CALL_FROM_ISR(xFunctionToPend, pvParameter1, ulParameter2, ret)
627 #endif
628 
629 #ifndef traceQUEUE_REGISTRY_ADD
630 #define traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName)
631 #endif
632 
633 #ifndef traceTASK_NOTIFY_TAKE_BLOCK
634 #define traceTASK_NOTIFY_TAKE_BLOCK()
635 #endif
636 
637 #ifndef traceTASK_NOTIFY_TAKE
638 #define traceTASK_NOTIFY_TAKE()
639 #endif
640 
641 #ifndef traceTASK_NOTIFY_WAIT_BLOCK
642 #define traceTASK_NOTIFY_WAIT_BLOCK()
643 #endif
644 
645 #ifndef traceTASK_NOTIFY_WAIT
646 #define traceTASK_NOTIFY_WAIT()
647 #endif
648 
649 #ifndef traceTASK_NOTIFY
650 #define traceTASK_NOTIFY()
651 #endif
652 
653 #ifndef traceTASK_NOTIFY_FROM_ISR
654 #define traceTASK_NOTIFY_FROM_ISR()
655 #endif
656 
657 #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
658 #define traceTASK_NOTIFY_GIVE_FROM_ISR()
659 #endif
660 
661 #ifndef configGENERATE_RUN_TIME_STATS
662 #define configGENERATE_RUN_TIME_STATS 0
663 #endif
664 
665 #if ( configGENERATE_RUN_TIME_STATS == 1 )
666 
667 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
668 #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.
669 #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
670 
671 #ifndef portGET_RUN_TIME_COUNTER_VALUE
672 #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
673 #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.
674 #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
675 #endif /* portGET_RUN_TIME_COUNTER_VALUE */
676 
677 #endif /* configGENERATE_RUN_TIME_STATS */
678 
679 #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
680 #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
681 #endif
682 
683 #ifndef configUSE_MALLOC_FAILED_HOOK
684 #define configUSE_MALLOC_FAILED_HOOK 0
685 #endif
686 
687 #ifndef portPRIVILEGE_BIT
688 #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
689 #endif
690 
691 #ifndef portYIELD_WITHIN_API
692 #define portYIELD_WITHIN_API portYIELD
693 #endif
694 
695 #ifndef portSUPPRESS_TICKS_AND_SLEEP
696 #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
697 #endif
698 
699 #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
700 #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
701 #endif
702 
703 #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
704 #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
705 #endif
706 
707 #ifndef configUSE_TICKLESS_IDLE
708 #define configUSE_TICKLESS_IDLE 0
709 #endif
710 
711 #ifndef configPRE_SLEEP_PROCESSING
712 #define configPRE_SLEEP_PROCESSING( x )
713 #endif
714 
715 #ifndef configPOST_SLEEP_PROCESSING
716 #define configPOST_SLEEP_PROCESSING( x )
717 #endif
718 
719 #ifndef configUSE_QUEUE_SETS
720 #define configUSE_QUEUE_SETS 0
721 #endif
722 
723 #ifndef portTASK_USES_FLOATING_POINT
724 #define portTASK_USES_FLOATING_POINT()
725 #endif
726 
727 #ifndef configUSE_TIME_SLICING
728 #define configUSE_TIME_SLICING 1
729 #endif
730 
731 #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
732 #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
733 #endif
734 
735 #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
736 #define configUSE_STATS_FORMATTING_FUNCTIONS 0
737 #endif
738 
739 #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
740 #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
741 #endif
742 
743 #ifndef configUSE_TRACE_FACILITY
744 #define configUSE_TRACE_FACILITY 0
745 #endif
746 
747 #ifndef mtCOVERAGE_TEST_MARKER
748 #define mtCOVERAGE_TEST_MARKER()
749 #endif
750 
751 #ifndef mtCOVERAGE_TEST_DELAY
752 #define mtCOVERAGE_TEST_DELAY()
753 #endif
754 
755 #ifndef portASSERT_IF_IN_ISR
756 #define portASSERT_IF_IN_ISR()
757 #endif
758 
759 #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
760 #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
761 #endif
762 
763 #ifndef configAPPLICATION_ALLOCATED_HEAP
764 #define configAPPLICATION_ALLOCATED_HEAP 0
765 #endif
766 
767 #ifndef configUSE_TASK_NOTIFICATIONS
768 #define configUSE_TASK_NOTIFICATIONS 1
769 #endif
770 
771 #ifndef portTICK_TYPE_IS_ATOMIC
772 #define portTICK_TYPE_IS_ATOMIC 0
773 #endif
774 
775 #ifndef configSUPPORT_STATIC_ALLOCATION
776 /* Defaults to 0 for backward compatibility. */
777 #define configSUPPORT_STATIC_ALLOCATION 1
778 #endif
779 
780 #ifndef configSUPPORT_DYNAMIC_ALLOCATION
781 /* Defaults to 1 for backward compatibility. */
782 #define configSUPPORT_DYNAMIC_ALLOCATION 1
783 #endif
784 
785 /* Sanity check the configuration. */
786 #if( configUSE_TICKLESS_IDLE != 0 )
787 #if( INCLUDE_vTaskSuspend != 1 )
788 #error INCLUDE_vTaskSuspend must be set to 1 if configUSE_TICKLESS_IDLE is not set to 0
789 #endif /* INCLUDE_vTaskSuspend */
790 #endif /* configUSE_TICKLESS_IDLE */
791 
792 #if( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
793 #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
794 #endif
795 
796 #if( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
797 #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
798 #endif
799 
800 #if( portTICK_TYPE_IS_ATOMIC == 0 )
801 /* Either variables of tick type cannot be read atomically, or
802 portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
803 the tick count is returned to the standard critical section macros. */
804 #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
805 #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
806 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
807 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
808 #else
809 /* The tick type can be read atomically, so critical sections used when the
810 tick count is returned can be defined away. */
811 #define portTICK_TYPE_ENTER_CRITICAL()
812 #define portTICK_TYPE_EXIT_CRITICAL()
813 #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
814 #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) x
815 #endif
816 
817 /* Definitions to allow backward compatibility with FreeRTOS versions prior to
818 V8 if desired. */
819 #ifndef configENABLE_BACKWARD_COMPATIBILITY
820 #define configENABLE_BACKWARD_COMPATIBILITY 1
821 #endif
822 
823 #if configENABLE_BACKWARD_COMPATIBILITY == 1
824 #define eTaskStateGet eTaskGetState
825 #define portTickType TickType_t
826 #define xTaskHandle TaskHandle_t
827 #define xQueueHandle QueueHandle_t
828 #define xSemaphoreHandle SemaphoreHandle_t
829 #define xQueueSetHandle QueueSetHandle_t
830 #define xQueueSetMemberHandle QueueSetMemberHandle_t
831 #define xTimeOutType TimeOut_t
832 #define xMemoryRegion MemoryRegion_t
833 #define xTaskParameters TaskParameters_t
834 #define xTaskStatusType TaskStatus_t
835 #define xTimerHandle TimerHandle_t
836 #define xCoRoutineHandle CoRoutineHandle_t
837 #define pdTASK_HOOK_CODE TaskHookFunction_t
838 #define portTICK_RATE_MS portTICK_PERIOD_MS
839 #define portTICK_RATE_MICROSECONDS portTICK_PERIOD_MICROSECONDS
840 #define pcTaskGetTaskName pcTaskGetName
841 #define pcTimerGetTimerName pcTimerGetName
842 #define pcQueueGetQueueName pcQueueGetName
843 #define vTaskGetTaskInfo vTaskGetInfo
844 
845 /* Backward compatibility within the scheduler code only - these definitions
846 are not really required but are included for completeness. */
847 #define tmrTIMER_CALLBACK TimerCallbackFunction_t
848 #define pdTASK_CODE TaskFunction_t
849 #define xListItem ListItem_t
850 #define xList List_t
851 #endif /* configENABLE_BACKWARD_COMPATIBILITY */
852 
853 #if( configUSE_ALTERNATIVE_API != 0 )
854 #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
855 #endif
856 
857 /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
858 if floating point hardware is otherwise supported by the FreeRTOS port in use.
859 This constant is not supported by all FreeRTOS ports that include floating
860 point support. */
861 #ifndef configUSE_TASK_FPU_SUPPORT
862 #define configUSE_TASK_FPU_SUPPORT 1
863 #endif
864 
865 /*
866  * In line with software engineering best practice, FreeRTOS implements a strict
867  * data hiding policy, so the real structures used by FreeRTOS to maintain the
868  * state of tasks, queues, semaphores, etc. are not accessible to the application
869  * code. However, if the application writer wants to statically allocate such
870  * an object then the size of the object needs to be know. Dummy structures
871  * that are guaranteed to have the same size and alignment requirements of the
872  * real objects are used for this purpose. The dummy list and list item
873  * structures below are used for inclusion in such a dummy structure.
874  */
876  TickType_t xDummy1;
877  void *pvDummy2[ 4 ];
878 };
879 typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
880 
881 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
883  TickType_t xDummy1;
884  void *pvDummy2[ 2 ];
885 };
887 
888 /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
889 typedef struct xSTATIC_LIST {
890  UBaseType_t uxDummy1;
891  void *pvDummy2;
892  StaticMiniListItem_t xDummy3;
893 } StaticList_t;
894 
895 /*
896  * In line with software engineering best practice, especially when supplying a
897  * library that is likely to change in future versions, FreeRTOS implements a
898  * strict data hiding policy. This means the Task structure used internally by
899  * FreeRTOS is not accessible to application code. However, if the application
900  * writer wants to statically allocate the memory required to create a task then
901  * the size of the task object needs to be know. The StaticTask_t structure
902  * below is provided for this purpose. Its sizes and alignment requirements are
903  * guaranteed to match those of the genuine structure, no matter which
904  * architecture is being used, and no matter how the values in FreeRTOSConfig.h
905  * are set. Its contents are somewhat obfuscated in the hope users will
906  * recognise that it would be unwise to make direct use of the structure members.
907  */
908 typedef struct xSTATIC_TCB {
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  void *pvDummy1[ 3 ];
967 
968  union {
969  void *pvDummy2;
970  UBaseType_t uxDummy2;
971  } u;
972 
973  StaticList_t xDummy3[ 2 ];
974  UBaseType_t uxDummy4[ 3 ];
975  uint8_t ucDummy5[ 2 ];
976 
977 #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
978  uint8_t ucDummy6;
979 #endif
980 
981 #if ( configUSE_QUEUE_SETS == 1 )
982  void *pvDummy7;
983 #endif
984 
985 #if ( configUSE_TRACE_FACILITY == 1 )
986  UBaseType_t uxDummy8;
987  uint8_t ucDummy9;
988 #endif
989 
990 } StaticQueue_t;
992 
993 /*
994  * In line with software engineering best practice, especially when supplying a
995  * library that is likely to change in future versions, FreeRTOS implements a
996  * strict data hiding policy. This means the event group structure used
997  * internally by FreeRTOS is not accessible to application code. However, if
998  * the application writer wants to statically allocate the memory required to
999  * create an event group then the size of the event group object needs to be
1000  * know. The StaticEventGroup_t structure below is provided for this purpose.
1001  * Its sizes and alignment requirements are guaranteed to match those of the
1002  * genuine structure, no matter which architecture is being used, and no matter
1003  * how the values in FreeRTOSConfig.h are set. Its contents are somewhat
1004  * obfuscated in the hope users will recognise that it would be unwise to make
1005  * direct use of the structure members.
1006  */
1007 typedef struct xSTATIC_EVENT_GROUP {
1008  TickType_t xDummy1;
1009  StaticList_t xDummy2;
1010 
1011 #if( configUSE_TRACE_FACILITY == 1 )
1012  UBaseType_t uxDummy3;
1013 #endif
1014 
1015 #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1016  uint8_t ucDummy4;
1017 #endif
1018 
1020 
1021 /*
1022  * In line with software engineering best practice, especially when supplying a
1023  * library that is likely to change in future versions, FreeRTOS implements a
1024  * strict data hiding policy. This means the software timer structure used
1025  * internally by FreeRTOS is not accessible to application code. However, if
1026  * the application writer wants to statically allocate the memory required to
1027  * create a software timer then the size of the queue object needs to be know.
1028  * The StaticTimer_t structure below is provided for this purpose. Its sizes
1029  * and alignment requirements are guaranteed to match those of the genuine
1030  * structure, no matter which architecture is being used, and no matter how the
1031  * values in FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in
1032  * the hope users will recognise that it would be unwise to make direct use of
1033  * the structure members.
1034  */
1035 typedef struct xSTATIC_TIMER {
1036  void *pvDummy1;
1037  StaticListItem_t xDummy2;
1038  TickType_t xDummy3;
1039  UBaseType_t uxDummy4;
1040  void *pvDummy5[ 2 ];
1041 #if( configUSE_TRACE_FACILITY == 1 )
1042  UBaseType_t uxDummy6;
1043 #endif
1044 
1045 #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
1046  uint8_t ucDummy7;
1047 #endif
1048 
1049 } StaticTimer_t;
1050 
1051 #ifdef __cplusplus
1052 }
1053 #endif
1054 
1055 #endif /* INC_FREERTOS_H */
1056 
xSTATIC_LIST_ITEM
Definition: FreeRTOS.h:875
xSTATIC_QUEUE
Definition: FreeRTOS.h:965
configMAX_TASK_NAME_LEN
#define configMAX_TASK_NAME_LEN
The maximum length of a task name.
Definition: FreeRTOSConfig.h:82
xSTATIC_TIMER
Definition: FreeRTOS.h:1035
TickType_t
uint32_t TickType_t
FreeRTOS definition for a single tick.
Definition: portmacro.h:98
UBaseType_t
unsigned long UBaseType_t
FreeRTOS definition for unsigned long ints.
Definition: portmacro.h:92
xSTATIC_MINI_LIST_ITEM
Definition: FreeRTOS.h:882
xSTATIC_TCB
Definition: FreeRTOS.h:908
xSTATIC_EVENT_GROUP
Definition: FreeRTOS.h:1007
xSTATIC_LIST
Definition: FreeRTOS.h:889