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