FreeRTOS.h 44 KB

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