FreeRTOS.h 46 KB

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