FreeRTOS.h 49 KB

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