FreeRTOS.h 49 KB

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