FreeRTOS.h 41 KB

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