FreeRTOS.h 45 KB

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