FreeRTOS.h 43 KB

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