FreeRTOS.h 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  1. /*
  2. * FreeRTOS Kernel V10.4.6
  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. #include <rtthread.h>
  54. #include <rthw.h>
  55. /* Application specific configuration options. */
  56. #include "FreeRTOSConfig.h"
  57. /* Basic FreeRTOS definitions. */
  58. #include "projdefs.h"
  59. /* Definitions specific to the port being used. */
  60. #include "portable.h"
  61. /* Read only */
  62. #define configUSE_NEWLIB_REENTRANT 0
  63. /*
  64. * Check all the required application specific macros have been defined.
  65. * These macros are application specific and (as downloaded) are defined
  66. * within FreeRTOSConfig.h.
  67. */
  68. #ifndef configMINIMAL_STACK_SIZE
  69. #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.
  70. #endif
  71. #ifndef configMAX_PRIORITIES
  72. #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
  73. #endif
  74. #if configMAX_PRIORITIES < 1
  75. #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
  76. #endif
  77. #ifndef configUSE_PREEMPTION
  78. #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.
  79. #endif
  80. #ifndef configUSE_IDLE_HOOK
  81. #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.
  82. #endif
  83. #ifndef configUSE_TICK_HOOK
  84. #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.
  85. #endif
  86. #ifndef configUSE_16_BIT_TICKS
  87. #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.
  88. #endif
  89. #ifndef configUSE_CO_ROUTINES
  90. #define configUSE_CO_ROUTINES 0
  91. #endif
  92. #ifndef INCLUDE_vTaskPrioritySet
  93. #define INCLUDE_vTaskPrioritySet 0
  94. #endif
  95. #ifndef INCLUDE_uxTaskPriorityGet
  96. #define INCLUDE_uxTaskPriorityGet 0
  97. #endif
  98. #ifndef INCLUDE_vTaskDelete
  99. #define INCLUDE_vTaskDelete 0
  100. #endif
  101. #ifndef INCLUDE_vTaskSuspend
  102. #define INCLUDE_vTaskSuspend 0
  103. #endif
  104. #ifdef INCLUDE_xTaskDelayUntil
  105. #ifdef INCLUDE_vTaskDelayUntil
  106. /* INCLUDE_vTaskDelayUntil was replaced by INCLUDE_xTaskDelayUntil. Backward
  107. * compatibility is maintained if only one or the other is defined, but
  108. * there is a conflict if both are defined. */
  109. #error INCLUDE_vTaskDelayUntil and INCLUDE_xTaskDelayUntil are both defined. INCLUDE_vTaskDelayUntil is no longer required and should be removed
  110. #endif
  111. #endif
  112. #ifndef INCLUDE_xTaskDelayUntil
  113. #ifdef INCLUDE_vTaskDelayUntil
  114. /* If INCLUDE_vTaskDelayUntil is set but INCLUDE_xTaskDelayUntil is not then
  115. * the project's FreeRTOSConfig.h probably pre-dates the introduction of
  116. * xTaskDelayUntil and setting INCLUDE_xTaskDelayUntil to whatever
  117. * INCLUDE_vTaskDelayUntil is set to will ensure backward compatibility.
  118. */
  119. #define INCLUDE_xTaskDelayUntil INCLUDE_vTaskDelayUntil
  120. #endif
  121. #endif
  122. #ifndef INCLUDE_xTaskDelayUntil
  123. #define INCLUDE_xTaskDelayUntil 0
  124. #endif
  125. #ifndef INCLUDE_vTaskDelay
  126. #define INCLUDE_vTaskDelay 0
  127. #endif
  128. #ifndef INCLUDE_xTaskGetIdleTaskHandle
  129. #define INCLUDE_xTaskGetIdleTaskHandle 0
  130. #endif
  131. #ifndef INCLUDE_xTaskAbortDelay
  132. #define INCLUDE_xTaskAbortDelay 0
  133. #endif
  134. #ifndef INCLUDE_xQueueGetMutexHolder
  135. #define INCLUDE_xQueueGetMutexHolder 0
  136. #endif
  137. #ifndef INCLUDE_xSemaphoreGetMutexHolder
  138. #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
  139. #endif
  140. #ifndef INCLUDE_xTaskGetHandle
  141. #define INCLUDE_xTaskGetHandle 0
  142. #endif
  143. #ifndef INCLUDE_uxTaskGetStackHighWaterMark
  144. #define INCLUDE_uxTaskGetStackHighWaterMark 0
  145. #endif
  146. #ifndef INCLUDE_uxTaskGetStackHighWaterMark2
  147. #define INCLUDE_uxTaskGetStackHighWaterMark2 0
  148. #endif
  149. #ifndef INCLUDE_eTaskGetState
  150. #define INCLUDE_eTaskGetState 0
  151. #endif
  152. #ifndef INCLUDE_xTaskResumeFromISR
  153. #define INCLUDE_xTaskResumeFromISR 1
  154. #endif
  155. #ifndef INCLUDE_xTimerPendFunctionCall
  156. #define INCLUDE_xTimerPendFunctionCall 0
  157. #endif
  158. #ifndef INCLUDE_xTaskGetSchedulerState
  159. #define INCLUDE_xTaskGetSchedulerState 0
  160. #endif
  161. #ifndef INCLUDE_xTaskGetCurrentTaskHandle
  162. #define INCLUDE_xTaskGetCurrentTaskHandle 0
  163. #endif
  164. #if configUSE_CO_ROUTINES != 0
  165. #ifndef configMAX_CO_ROUTINE_PRIORITIES
  166. #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
  167. #endif
  168. #endif
  169. #ifndef configUSE_DAEMON_TASK_STARTUP_HOOK
  170. #define configUSE_DAEMON_TASK_STARTUP_HOOK 0
  171. #endif
  172. #ifndef configUSE_APPLICATION_TASK_TAG
  173. #define configUSE_APPLICATION_TASK_TAG 0
  174. #endif
  175. #ifndef configNUM_THREAD_LOCAL_STORAGE_POINTERS
  176. #define configNUM_THREAD_LOCAL_STORAGE_POINTERS 0
  177. #endif
  178. #ifndef configUSE_RECURSIVE_MUTEXES
  179. #define configUSE_RECURSIVE_MUTEXES 0
  180. #endif
  181. #ifndef configUSE_MUTEXES
  182. #define configUSE_MUTEXES 0
  183. #endif
  184. #ifndef configUSE_TIMERS
  185. #define configUSE_TIMERS 0
  186. #endif
  187. #ifndef configUSE_COUNTING_SEMAPHORES
  188. #define configUSE_COUNTING_SEMAPHORES 0
  189. #endif
  190. #ifndef configUSE_ALTERNATIVE_API
  191. #define configUSE_ALTERNATIVE_API 0
  192. #endif
  193. #ifndef portCRITICAL_NESTING_IN_TCB
  194. #define portCRITICAL_NESTING_IN_TCB 0
  195. #endif
  196. #ifndef configMAX_TASK_NAME_LEN
  197. #define configMAX_TASK_NAME_LEN 16
  198. #endif
  199. #ifndef configIDLE_SHOULD_YIELD
  200. #define configIDLE_SHOULD_YIELD 1
  201. #endif
  202. #if configMAX_TASK_NAME_LEN < 1
  203. #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
  204. #endif
  205. #ifndef configASSERT
  206. #define configASSERT( x )
  207. #define configASSERT_DEFINED 0
  208. #else
  209. #define configASSERT_DEFINED 1
  210. #endif
  211. /* configPRECONDITION should be defined as configASSERT.
  212. * The CBMC proofs need a way to track assumptions and assertions.
  213. * A configPRECONDITION statement should express an implicit invariant or
  214. * assumption made. A configASSERT statement should express an invariant that must
  215. * hold explicit before calling the code. */
  216. #ifndef configPRECONDITION
  217. #define configPRECONDITION( X ) configASSERT( X )
  218. #define configPRECONDITION_DEFINED 0
  219. #else
  220. #define configPRECONDITION_DEFINED 1
  221. #endif
  222. #ifndef portMEMORY_BARRIER
  223. #define portMEMORY_BARRIER()
  224. #endif
  225. #ifndef portSOFTWARE_BARRIER
  226. #define portSOFTWARE_BARRIER()
  227. #endif
  228. /* The timers module relies on xTaskGetSchedulerState(). */
  229. #if configUSE_TIMERS == 1
  230. #ifndef configTIMER_TASK_PRIORITY
  231. #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
  232. #endif /* configTIMER_TASK_PRIORITY */
  233. #ifndef configTIMER_QUEUE_LENGTH
  234. #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
  235. #endif /* configTIMER_QUEUE_LENGTH */
  236. #ifndef configTIMER_TASK_STACK_DEPTH
  237. #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
  238. #endif /* configTIMER_TASK_STACK_DEPTH */
  239. #endif /* configUSE_TIMERS */
  240. #ifndef portSET_INTERRUPT_MASK_FROM_ISR
  241. #define portSET_INTERRUPT_MASK_FROM_ISR() 0
  242. #endif
  243. #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
  244. #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
  245. #endif
  246. #ifndef portCLEAN_UP_TCB
  247. #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
  248. #endif
  249. #ifndef portPRE_TASK_DELETE_HOOK
  250. #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
  251. #endif
  252. #ifndef portSETUP_TCB
  253. #define portSETUP_TCB( pxTCB ) ( void ) pxTCB
  254. #endif
  255. #ifndef configQUEUE_REGISTRY_SIZE
  256. #define configQUEUE_REGISTRY_SIZE 0U
  257. #endif
  258. #if ( configQUEUE_REGISTRY_SIZE < 1 )
  259. #define vQueueAddToRegistry( xQueue, pcName )
  260. #define vQueueUnregisterQueue( xQueue )
  261. #define pcQueueGetName( xQueue )
  262. #endif
  263. #ifndef portPOINTER_SIZE_TYPE
  264. #define portPOINTER_SIZE_TYPE uint32_t
  265. #endif
  266. /* Remove any unused trace macros. */
  267. #ifndef traceSTART
  268. /* Used to perform any necessary initialisation - for example, open a file
  269. * into which trace is to be written. */
  270. #define traceSTART()
  271. #endif
  272. #ifndef traceEND
  273. /* Use to close a trace, for example close a file into which trace has been
  274. * written. */
  275. #define traceEND()
  276. #endif
  277. #ifndef traceTASK_SWITCHED_IN
  278. /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
  279. * to the task control block of the selected task. */
  280. #define traceTASK_SWITCHED_IN()
  281. #endif
  282. #ifndef traceINCREASE_TICK_COUNT
  283. /* Called before stepping the tick count after waking from tickless idle
  284. * sleep. */
  285. #define traceINCREASE_TICK_COUNT( x )
  286. #endif
  287. #ifndef traceLOW_POWER_IDLE_BEGIN
  288. /* Called immediately before entering tickless idle. */
  289. #define traceLOW_POWER_IDLE_BEGIN()
  290. #endif
  291. #ifndef traceLOW_POWER_IDLE_END
  292. /* Called when returning to the Idle task after a tickless idle. */
  293. #define traceLOW_POWER_IDLE_END()
  294. #endif
  295. #ifndef traceTASK_SWITCHED_OUT
  296. /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
  297. * to the task control block of the task being switched out. */
  298. #define traceTASK_SWITCHED_OUT()
  299. #endif
  300. #ifndef traceTASK_PRIORITY_INHERIT
  301. /* Called when a task attempts to take a mutex that is already held by a
  302. * lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
  303. * that holds the mutex. uxInheritedPriority is the priority the mutex holder
  304. * will inherit (the priority of the task that is attempting to obtain the
  305. * muted. */
  306. #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
  307. #endif
  308. #ifndef traceTASK_PRIORITY_DISINHERIT
  309. /* Called when a task releases a mutex, the holding of which had resulted in
  310. * the task inheriting the priority of a higher priority task.
  311. * pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
  312. * mutex. uxOriginalPriority is the task's configured (base) priority. */
  313. #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
  314. #endif
  315. #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
  316. /* Task is about to block because it cannot read from a
  317. * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
  318. * upon which the read was attempted. pxCurrentTCB points to the TCB of the
  319. * task that attempted the read. */
  320. #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
  321. #endif
  322. #ifndef traceBLOCKING_ON_QUEUE_PEEK
  323. /* Task is about to block because it cannot read from a
  324. * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
  325. * upon which the read was attempted. pxCurrentTCB points to the TCB of the
  326. * task that attempted the read. */
  327. #define traceBLOCKING_ON_QUEUE_PEEK( pxQueue )
  328. #endif
  329. #ifndef traceBLOCKING_ON_QUEUE_SEND
  330. /* Task is about to block because it cannot write to a
  331. * queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
  332. * upon which the write was attempted. pxCurrentTCB points to the TCB of the
  333. * task that attempted the write. */
  334. #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
  335. #endif
  336. #ifndef configCHECK_FOR_STACK_OVERFLOW
  337. #define configCHECK_FOR_STACK_OVERFLOW 0
  338. #endif
  339. #ifndef configRECORD_STACK_HIGH_ADDRESS
  340. #define configRECORD_STACK_HIGH_ADDRESS 0
  341. #endif
  342. #ifndef configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H
  343. #define configINCLUDE_FREERTOS_TASK_C_ADDITIONS_H 0
  344. #endif
  345. /* The following event macros are embedded in the kernel API calls. */
  346. #ifndef traceMOVED_TASK_TO_READY_STATE
  347. #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
  348. #endif
  349. #ifndef tracePOST_MOVED_TASK_TO_READY_STATE
  350. #define tracePOST_MOVED_TASK_TO_READY_STATE( pxTCB )
  351. #endif
  352. #ifndef traceQUEUE_CREATE
  353. #define traceQUEUE_CREATE( pxNewQueue )
  354. #endif
  355. #ifndef traceQUEUE_CREATE_FAILED
  356. #define traceQUEUE_CREATE_FAILED( ucQueueType )
  357. #endif
  358. #ifndef traceCREATE_MUTEX
  359. #define traceCREATE_MUTEX( pxNewQueue )
  360. #endif
  361. #ifndef traceCREATE_MUTEX_FAILED
  362. #define traceCREATE_MUTEX_FAILED()
  363. #endif
  364. #ifndef traceGIVE_MUTEX_RECURSIVE
  365. #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
  366. #endif
  367. #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
  368. #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
  369. #endif
  370. #ifndef traceTAKE_MUTEX_RECURSIVE
  371. #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
  372. #endif
  373. #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
  374. #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
  375. #endif
  376. #ifndef traceCREATE_COUNTING_SEMAPHORE
  377. #define traceCREATE_COUNTING_SEMAPHORE()
  378. #endif
  379. #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
  380. #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
  381. #endif
  382. #ifndef traceQUEUE_SET_SEND
  383. #define traceQUEUE_SET_SEND traceQUEUE_SEND
  384. #endif
  385. #ifndef traceQUEUE_SEND
  386. #define traceQUEUE_SEND( pxQueue )
  387. #endif
  388. #ifndef traceQUEUE_SEND_FAILED
  389. #define traceQUEUE_SEND_FAILED( pxQueue )
  390. #endif
  391. #ifndef traceQUEUE_RECEIVE
  392. #define traceQUEUE_RECEIVE( pxQueue )
  393. #endif
  394. #ifndef traceQUEUE_PEEK
  395. #define traceQUEUE_PEEK( pxQueue )
  396. #endif
  397. #ifndef traceQUEUE_PEEK_FAILED
  398. #define traceQUEUE_PEEK_FAILED( pxQueue )
  399. #endif
  400. #ifndef traceQUEUE_PEEK_FROM_ISR
  401. #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
  402. #endif
  403. #ifndef traceQUEUE_RECEIVE_FAILED
  404. #define traceQUEUE_RECEIVE_FAILED( pxQueue )
  405. #endif
  406. #ifndef traceQUEUE_SEND_FROM_ISR
  407. #define traceQUEUE_SEND_FROM_ISR( pxQueue )
  408. #endif
  409. #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
  410. #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
  411. #endif
  412. #ifndef traceQUEUE_RECEIVE_FROM_ISR
  413. #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
  414. #endif
  415. #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
  416. #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
  417. #endif
  418. #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
  419. #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
  420. #endif
  421. #ifndef traceQUEUE_DELETE
  422. #define traceQUEUE_DELETE( pxQueue )
  423. #endif
  424. #ifndef traceTASK_CREATE
  425. #define traceTASK_CREATE( pxNewTCB )
  426. #endif
  427. #ifndef traceTASK_CREATE_FAILED
  428. #define traceTASK_CREATE_FAILED()
  429. #endif
  430. #ifndef traceTASK_DELETE
  431. #define traceTASK_DELETE( pxTaskToDelete )
  432. #endif
  433. #ifndef traceTASK_DELAY_UNTIL
  434. #define traceTASK_DELAY_UNTIL( x )
  435. #endif
  436. #ifndef traceTASK_DELAY
  437. #define traceTASK_DELAY()
  438. #endif
  439. #ifndef traceTASK_PRIORITY_SET
  440. #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
  441. #endif
  442. #ifndef traceTASK_SUSPEND
  443. #define traceTASK_SUSPEND( pxTaskToSuspend )
  444. #endif
  445. #ifndef traceTASK_RESUME
  446. #define traceTASK_RESUME( pxTaskToResume )
  447. #endif
  448. #ifndef traceTASK_RESUME_FROM_ISR
  449. #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
  450. #endif
  451. #ifndef traceTASK_INCREMENT_TICK
  452. #define traceTASK_INCREMENT_TICK( xTickCount )
  453. #endif
  454. #ifndef traceTIMER_CREATE
  455. #define traceTIMER_CREATE( pxNewTimer )
  456. #endif
  457. #ifndef traceTIMER_CREATE_FAILED
  458. #define traceTIMER_CREATE_FAILED()
  459. #endif
  460. #ifndef traceTIMER_COMMAND_SEND
  461. #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
  462. #endif
  463. #ifndef traceTIMER_EXPIRED
  464. #define traceTIMER_EXPIRED( pxTimer )
  465. #endif
  466. #ifndef traceTIMER_COMMAND_RECEIVED
  467. #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
  468. #endif
  469. #ifndef traceMALLOC
  470. #define traceMALLOC( pvAddress, uiSize )
  471. #endif
  472. #ifndef traceFREE
  473. #define traceFREE( pvAddress, uiSize )
  474. #endif
  475. #ifndef traceEVENT_GROUP_CREATE
  476. #define traceEVENT_GROUP_CREATE( xEventGroup )
  477. #endif
  478. #ifndef traceEVENT_GROUP_CREATE_FAILED
  479. #define traceEVENT_GROUP_CREATE_FAILED()
  480. #endif
  481. #ifndef traceEVENT_GROUP_SYNC_BLOCK
  482. #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
  483. #endif
  484. #ifndef traceEVENT_GROUP_SYNC_END
  485. #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
  486. #endif
  487. #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
  488. #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
  489. #endif
  490. #ifndef traceEVENT_GROUP_WAIT_BITS_END
  491. #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
  492. #endif
  493. #ifndef traceEVENT_GROUP_CLEAR_BITS
  494. #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
  495. #endif
  496. #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
  497. #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
  498. #endif
  499. #ifndef traceEVENT_GROUP_SET_BITS
  500. #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
  501. #endif
  502. #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
  503. #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
  504. #endif
  505. #ifndef traceEVENT_GROUP_DELETE
  506. #define traceEVENT_GROUP_DELETE( xEventGroup )
  507. #endif
  508. #ifndef tracePEND_FUNC_CALL
  509. #define tracePEND_FUNC_CALL( xFunctionToPend, pvParameter1, ulParameter2, ret )
  510. #endif
  511. #ifndef tracePEND_FUNC_CALL_FROM_ISR
  512. #define tracePEND_FUNC_CALL_FROM_ISR( xFunctionToPend, pvParameter1, ulParameter2, ret )
  513. #endif
  514. #ifndef traceQUEUE_REGISTRY_ADD
  515. #define traceQUEUE_REGISTRY_ADD( xQueue, pcQueueName )
  516. #endif
  517. #ifndef traceTASK_NOTIFY_TAKE_BLOCK
  518. #define traceTASK_NOTIFY_TAKE_BLOCK( uxIndexToWait )
  519. #endif
  520. #ifndef traceTASK_NOTIFY_TAKE
  521. #define traceTASK_NOTIFY_TAKE( uxIndexToWait )
  522. #endif
  523. #ifndef traceTASK_NOTIFY_WAIT_BLOCK
  524. #define traceTASK_NOTIFY_WAIT_BLOCK( uxIndexToWait )
  525. #endif
  526. #ifndef traceTASK_NOTIFY_WAIT
  527. #define traceTASK_NOTIFY_WAIT( uxIndexToWait )
  528. #endif
  529. #ifndef traceTASK_NOTIFY
  530. #define traceTASK_NOTIFY( uxIndexToNotify )
  531. #endif
  532. #ifndef traceTASK_NOTIFY_FROM_ISR
  533. #define traceTASK_NOTIFY_FROM_ISR( uxIndexToNotify )
  534. #endif
  535. #ifndef traceTASK_NOTIFY_GIVE_FROM_ISR
  536. #define traceTASK_NOTIFY_GIVE_FROM_ISR( uxIndexToNotify )
  537. #endif
  538. #ifndef traceSTREAM_BUFFER_CREATE_FAILED
  539. #define traceSTREAM_BUFFER_CREATE_FAILED( xIsMessageBuffer )
  540. #endif
  541. #ifndef traceSTREAM_BUFFER_CREATE_STATIC_FAILED
  542. #define traceSTREAM_BUFFER_CREATE_STATIC_FAILED( xReturn, xIsMessageBuffer )
  543. #endif
  544. #ifndef traceSTREAM_BUFFER_CREATE
  545. #define traceSTREAM_BUFFER_CREATE( pxStreamBuffer, xIsMessageBuffer )
  546. #endif
  547. #ifndef traceSTREAM_BUFFER_DELETE
  548. #define traceSTREAM_BUFFER_DELETE( xStreamBuffer )
  549. #endif
  550. #ifndef traceSTREAM_BUFFER_RESET
  551. #define traceSTREAM_BUFFER_RESET( xStreamBuffer )
  552. #endif
  553. #ifndef traceBLOCKING_ON_STREAM_BUFFER_SEND
  554. #define traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer )
  555. #endif
  556. #ifndef traceSTREAM_BUFFER_SEND
  557. #define traceSTREAM_BUFFER_SEND( xStreamBuffer, xBytesSent )
  558. #endif
  559. #ifndef traceSTREAM_BUFFER_SEND_FAILED
  560. #define traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer )
  561. #endif
  562. #ifndef traceSTREAM_BUFFER_SEND_FROM_ISR
  563. #define traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xBytesSent )
  564. #endif
  565. #ifndef traceBLOCKING_ON_STREAM_BUFFER_RECEIVE
  566. #define traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer )
  567. #endif
  568. #ifndef traceSTREAM_BUFFER_RECEIVE
  569. #define traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength )
  570. #endif
  571. #ifndef traceSTREAM_BUFFER_RECEIVE_FAILED
  572. #define traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer )
  573. #endif
  574. #ifndef traceSTREAM_BUFFER_RECEIVE_FROM_ISR
  575. #define traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength )
  576. #endif
  577. #ifndef configGENERATE_RUN_TIME_STATS
  578. #define configGENERATE_RUN_TIME_STATS 0
  579. #endif
  580. #if ( configGENERATE_RUN_TIME_STATS == 1 )
  581. #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
  582. #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.
  583. #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
  584. #ifndef portGET_RUN_TIME_COUNTER_VALUE
  585. #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
  586. #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.
  587. #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
  588. #endif /* portGET_RUN_TIME_COUNTER_VALUE */
  589. #endif /* configGENERATE_RUN_TIME_STATS */
  590. #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
  591. #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
  592. #endif
  593. #ifndef configUSE_MALLOC_FAILED_HOOK
  594. #define configUSE_MALLOC_FAILED_HOOK 0
  595. #endif
  596. #ifndef portPRIVILEGE_BIT
  597. #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
  598. #endif
  599. #ifndef portYIELD_WITHIN_API
  600. #define portYIELD_WITHIN_API portYIELD
  601. #endif
  602. #ifndef portSUPPRESS_TICKS_AND_SLEEP
  603. #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
  604. #endif
  605. #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
  606. #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
  607. #endif
  608. #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
  609. #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
  610. #endif
  611. #ifndef configUSE_TICKLESS_IDLE
  612. #define configUSE_TICKLESS_IDLE 0
  613. #endif
  614. #ifndef configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING
  615. #define configPRE_SUPPRESS_TICKS_AND_SLEEP_PROCESSING( x )
  616. #endif
  617. #ifndef configPRE_SLEEP_PROCESSING
  618. #define configPRE_SLEEP_PROCESSING( x )
  619. #endif
  620. #ifndef configPOST_SLEEP_PROCESSING
  621. #define configPOST_SLEEP_PROCESSING( x )
  622. #endif
  623. #ifndef configUSE_QUEUE_SETS
  624. #define configUSE_QUEUE_SETS 0
  625. #endif
  626. #ifndef portTASK_USES_FLOATING_POINT
  627. #define portTASK_USES_FLOATING_POINT()
  628. #endif
  629. #ifndef portALLOCATE_SECURE_CONTEXT
  630. #define portALLOCATE_SECURE_CONTEXT( ulSecureStackSize )
  631. #endif
  632. #ifndef portDONT_DISCARD
  633. #define portDONT_DISCARD
  634. #endif
  635. #ifndef configUSE_TIME_SLICING
  636. #define configUSE_TIME_SLICING 1
  637. #endif
  638. #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
  639. #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
  640. #endif
  641. #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
  642. #define configUSE_STATS_FORMATTING_FUNCTIONS 0
  643. #endif
  644. #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
  645. #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
  646. #endif
  647. #ifndef configUSE_TRACE_FACILITY
  648. #define configUSE_TRACE_FACILITY 0
  649. #endif
  650. #ifndef mtCOVERAGE_TEST_MARKER
  651. #define mtCOVERAGE_TEST_MARKER()
  652. #endif
  653. #ifndef mtCOVERAGE_TEST_DELAY
  654. #define mtCOVERAGE_TEST_DELAY()
  655. #endif
  656. #ifndef portASSERT_IF_IN_ISR
  657. #define portASSERT_IF_IN_ISR()
  658. #endif
  659. #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
  660. #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
  661. #endif
  662. #ifndef configAPPLICATION_ALLOCATED_HEAP
  663. #define configAPPLICATION_ALLOCATED_HEAP 0
  664. #endif
  665. #ifndef configUSE_TASK_NOTIFICATIONS
  666. #define configUSE_TASK_NOTIFICATIONS 1
  667. #endif
  668. #ifndef configTASK_NOTIFICATION_ARRAY_ENTRIES
  669. #define configTASK_NOTIFICATION_ARRAY_ENTRIES 1
  670. #endif
  671. #if configTASK_NOTIFICATION_ARRAY_ENTRIES < 1
  672. #error configTASK_NOTIFICATION_ARRAY_ENTRIES must be at least 1
  673. #endif
  674. #ifndef configUSE_POSIX_ERRNO
  675. #define configUSE_POSIX_ERRNO 0
  676. #endif
  677. #ifndef portTICK_TYPE_IS_ATOMIC
  678. #define portTICK_TYPE_IS_ATOMIC 0
  679. #endif
  680. #ifndef configSUPPORT_STATIC_ALLOCATION
  681. /* Defaults to 0 for backward compatibility. */
  682. #define configSUPPORT_STATIC_ALLOCATION 0
  683. #endif
  684. #ifndef configSUPPORT_DYNAMIC_ALLOCATION
  685. /* Defaults to 1 for backward compatibility. */
  686. #define configSUPPORT_DYNAMIC_ALLOCATION 1
  687. #endif
  688. #ifndef configSTACK_DEPTH_TYPE
  689. /* Defaults to uint16_t for backward compatibility, but can be overridden
  690. * in FreeRTOSConfig.h if uint16_t is too restrictive. */
  691. #define configSTACK_DEPTH_TYPE uint16_t
  692. #endif
  693. #ifndef configRUN_TIME_COUNTER_TYPE
  694. /* Defaults to uint32_t for backward compatibility, but can be overridden in
  695. * FreeRTOSConfig.h if uint32_t is too restrictive. */
  696. #define configRUN_TIME_COUNTER_TYPE uint32_t
  697. #endif
  698. #ifndef configMESSAGE_BUFFER_LENGTH_TYPE
  699. /* Defaults to size_t for backward compatibility, but can be overridden
  700. * in FreeRTOSConfig.h if lengths will always be less than the number of bytes
  701. * in a size_t. */
  702. #define configMESSAGE_BUFFER_LENGTH_TYPE size_t
  703. #endif
  704. /* Sanity check the configuration. */
  705. #if ( configUSE_TICKLESS_IDLE != 0 )
  706. #if ( INCLUDE_vTaskSuspend != 1 )
  707. #error INCLUDE_vTaskSuspend must be set to 1 if configUSE_TICKLESS_IDLE is not set to 0
  708. #endif /* INCLUDE_vTaskSuspend */
  709. #endif /* configUSE_TICKLESS_IDLE */
  710. #if ( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
  711. #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
  712. #endif
  713. #if ( ( configUSE_RECURSIVE_MUTEXES == 1 ) && ( configUSE_MUTEXES != 1 ) )
  714. #error configUSE_MUTEXES must be set to 1 to use recursive mutexes
  715. #endif
  716. #ifndef configINITIAL_TICK_COUNT
  717. #define configINITIAL_TICK_COUNT 0
  718. #endif
  719. #if ( portTICK_TYPE_IS_ATOMIC == 0 )
  720. /* Either variables of tick type cannot be read atomically, or
  721. * portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
  722. * the tick count is returned to the standard critical section macros. */
  723. #define portTICK_TYPE_ENTER_CRITICAL() portENTER_CRITICAL()
  724. #define portTICK_TYPE_EXIT_CRITICAL() portEXIT_CRITICAL()
  725. #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
  726. #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
  727. #else
  728. /* The tick type can be read atomically, so critical sections used when the
  729. * tick count is returned can be defined away. */
  730. #define portTICK_TYPE_ENTER_CRITICAL()
  731. #define portTICK_TYPE_EXIT_CRITICAL()
  732. #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
  733. #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) x
  734. #endif /* if ( portTICK_TYPE_IS_ATOMIC == 0 ) */
  735. /* Definitions to allow backward compatibility with FreeRTOS versions prior to
  736. * V8 if desired. */
  737. #ifndef configENABLE_BACKWARD_COMPATIBILITY
  738. #define configENABLE_BACKWARD_COMPATIBILITY 1
  739. #endif
  740. #ifndef configPRINTF
  741. /* configPRINTF() was not defined, so define it away to nothing. To use
  742. * configPRINTF() then define it as follows (where MyPrintFunction() is
  743. * provided by the application writer):
  744. *
  745. * void MyPrintFunction(const char *pcFormat, ... );
  746. #define configPRINTF( X ) MyPrintFunction X
  747. *
  748. * Then call like a standard printf() function, but placing brackets around
  749. * all parameters so they are passed as a single parameter. For example:
  750. * configPRINTF( ("Value = %d", MyVariable) ); */
  751. #define configPRINTF( X )
  752. #endif
  753. #ifndef configMAX
  754. /* The application writer has not provided their own MAX macro, so define
  755. * the following generic implementation. */
  756. #define configMAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) )
  757. #endif
  758. #ifndef configMIN
  759. /* The application writer has not provided their own MIN macro, so define
  760. * the following generic implementation. */
  761. #define configMIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) )
  762. #endif
  763. #if configENABLE_BACKWARD_COMPATIBILITY == 1
  764. #define eTaskStateGet eTaskGetState
  765. #define portTickType TickType_t
  766. #define xTaskHandle TaskHandle_t
  767. #define xQueueHandle QueueHandle_t
  768. #define xSemaphoreHandle SemaphoreHandle_t
  769. #define xQueueSetHandle QueueSetHandle_t
  770. #define xQueueSetMemberHandle QueueSetMemberHandle_t
  771. #define xTimeOutType TimeOut_t
  772. #define xMemoryRegion MemoryRegion_t
  773. #define xTaskParameters TaskParameters_t
  774. #define xTaskStatusType TaskStatus_t
  775. #define xTimerHandle TimerHandle_t
  776. #define xCoRoutineHandle CoRoutineHandle_t
  777. #define pdTASK_HOOK_CODE TaskHookFunction_t
  778. #define portTICK_RATE_MS portTICK_PERIOD_MS
  779. #define pcTaskGetTaskName pcTaskGetName
  780. #define pcTimerGetTimerName pcTimerGetName
  781. #define pcQueueGetQueueName pcQueueGetName
  782. #define vTaskGetTaskInfo vTaskGetInfo
  783. #define xTaskGetIdleRunTimeCounter ulTaskGetIdleRunTimeCounter
  784. /* Backward compatibility within the scheduler code only - these definitions
  785. * are not really required but are included for completeness. */
  786. #define tmrTIMER_CALLBACK TimerCallbackFunction_t
  787. #define pdTASK_CODE TaskFunction_t
  788. #define xListItem ListItem_t
  789. #define xList List_t
  790. /* For libraries that break the list data hiding, and access list structure
  791. * members directly (which is not supposed to be done). */
  792. #define pxContainer pvContainer
  793. #endif /* configENABLE_BACKWARD_COMPATIBILITY */
  794. #if ( configUSE_ALTERNATIVE_API != 0 )
  795. #error The alternative API was deprecated some time ago, and was removed in FreeRTOS V9.0 0
  796. #endif
  797. /* Set configUSE_TASK_FPU_SUPPORT to 0 to omit floating point support even
  798. * if floating point hardware is otherwise supported by the FreeRTOS port in use.
  799. * This constant is not supported by all FreeRTOS ports that include floating
  800. * point support. */
  801. #ifndef configUSE_TASK_FPU_SUPPORT
  802. #define configUSE_TASK_FPU_SUPPORT 1
  803. #endif
  804. /* Set configENABLE_MPU to 1 to enable MPU support and 0 to disable it. This is
  805. * currently used in ARMv8M ports. */
  806. #ifndef configENABLE_MPU
  807. #define configENABLE_MPU 0
  808. #endif
  809. /* Set configENABLE_FPU to 1 to enable FPU support and 0 to disable it. This is
  810. * currently used in ARMv8M ports. */
  811. #ifndef configENABLE_FPU
  812. #define configENABLE_FPU 1
  813. #endif
  814. /* Set configENABLE_TRUSTZONE to 1 enable TrustZone support and 0 to disable it.
  815. * This is currently used in ARMv8M ports. */
  816. #ifndef configENABLE_TRUSTZONE
  817. #define configENABLE_TRUSTZONE 1
  818. #endif
  819. /* Set configRUN_FREERTOS_SECURE_ONLY to 1 to run the FreeRTOS ARMv8M port on
  820. * the Secure Side only. */
  821. #ifndef configRUN_FREERTOS_SECURE_ONLY
  822. #define configRUN_FREERTOS_SECURE_ONLY 0
  823. #endif
  824. #ifndef configRUN_ADDITIONAL_TESTS
  825. #define configRUN_ADDITIONAL_TESTS 0
  826. #endif
  827. /* Sometimes the FreeRTOSConfig.h settings only allow a task to be created using
  828. * dynamically allocated RAM, in which case when any task is deleted it is known
  829. * that both the task's stack and TCB need to be freed. Sometimes the
  830. * FreeRTOSConfig.h settings only allow a task to be created using statically
  831. * allocated RAM, in which case when any task is deleted it is known that neither
  832. * the task's stack or TCB should be freed. Sometimes the FreeRTOSConfig.h
  833. * settings allow a task to be created using either statically or dynamically
  834. * allocated RAM, in which case a member of the TCB is used to record whether the
  835. * stack and/or TCB were allocated statically or dynamically, so when a task is
  836. * deleted the RAM that was allocated dynamically is freed again and no attempt is
  837. * made to free the RAM that was allocated statically.
  838. * tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE is only true if it is possible for a
  839. * task to be created using either statically or dynamically allocated RAM. Note
  840. * that if portUSING_MPU_WRAPPERS is 1 then a protected task can be created with
  841. * a statically allocated stack and a dynamically allocated TCB.
  842. *
  843. * The following table lists various combinations of portUSING_MPU_WRAPPERS,
  844. * configSUPPORT_DYNAMIC_ALLOCATION and configSUPPORT_STATIC_ALLOCATION and
  845. * when it is possible to have both static and dynamic allocation:
  846. * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
  847. * | MPU | Dynamic | Static | Available Functions | Possible Allocations | Both Dynamic and | Need Free |
  848. * | | | | | | Static Possible | |
  849. * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
  850. * | 0 | 0 | 1 | xTaskCreateStatic | TCB - Static, Stack - Static | No | No |
  851. * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
  852. * | 0 | 1 | 0 | xTaskCreate | TCB - Dynamic, Stack - Dynamic | No | Yes |
  853. * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
  854. * | 0 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
  855. * | | | | xTaskCreateStatic | 2. TCB - Static, Stack - Static | | |
  856. * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
  857. * | 1 | 0 | 1 | xTaskCreateStatic, | TCB - Static, Stack - Static | No | No |
  858. * | | | | xTaskCreateRestrictedStatic | | | |
  859. * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
  860. * | 1 | 1 | 0 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
  861. * | | | | xTaskCreateRestricted | 2. TCB - Dynamic, Stack - Static | | |
  862. * +-----|---------|--------|-----------------------------|-----------------------------------|------------------|-----------|
  863. * | 1 | 1 | 1 | xTaskCreate, | 1. TCB - Dynamic, Stack - Dynamic | Yes | Yes |
  864. * | | | | xTaskCreateStatic, | 2. TCB - Dynamic, Stack - Static | | |
  865. * | | | | xTaskCreateRestricted, | 3. TCB - Static, Stack - Static | | |
  866. * | | | | xTaskCreateRestrictedStatic | | | |
  867. * +-----+---------+--------+-----------------------------+-----------------------------------+------------------+-----------+
  868. */
  869. #define tskSTATIC_AND_DYNAMIC_ALLOCATION_POSSIBLE \
  870. ( ( ( portUSING_MPU_WRAPPERS == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) && ( configSUPPORT_STATIC_ALLOCATION == 1 ) ) || \
  871. ( ( portUSING_MPU_WRAPPERS == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) )
  872. /*
  873. * In line with software engineering best practice, especially when supplying a
  874. * library that is likely to change in future versions, FreeRTOS implements a
  875. * strict data hiding policy. This means the Task structure used internally by
  876. * FreeRTOS is not accessible to application code. However, if the application
  877. * writer wants to statically allocate the memory required to create a task then
  878. * the size of the task object needs to be known. The StaticTask_t structure
  879. * below is provided for this purpose. Its sizes and alignment requirements are
  880. * guaranteed to match those of the genuine structure, no matter which
  881. * architecture is being used, and no matter how the values in FreeRTOSConfig.h
  882. * are set. Its contents are somewhat obfuscated in the hope users will
  883. * recognise that it would be unwise to make direct use of the structure members.
  884. */
  885. typedef struct xSTATIC_TCB
  886. {
  887. struct rt_thread thread;
  888. #if ( configUSE_APPLICATION_TASK_TAG == 1 )
  889. void * pxTaskTag;
  890. #endif
  891. #if ( configUSE_TASK_NOTIFICATIONS == 1 )
  892. uint32_t ulNotifiedValue[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
  893. uint8_t ucNotifyState[ configTASK_NOTIFICATION_ARRAY_ENTRIES ];
  894. #endif
  895. #if ( INCLUDE_xTaskAbortDelay == 1 )
  896. uint8_t ucDelayAborted;
  897. #endif
  898. } StaticTask_t;
  899. typedef struct
  900. {
  901. struct rt_ipc_object *rt_ipc;
  902. struct rt_messagequeue ipc_obj;
  903. } StaticQueue_t;
  904. typedef struct
  905. {
  906. struct rt_ipc_object *rt_ipc;
  907. union
  908. {
  909. struct rt_semaphore_wrapper semaphore;
  910. struct rt_mutex mutex;
  911. } ipc_obj;
  912. } StaticSemaphore_t;
  913. typedef struct xSTATIC_EVENT_GROUP
  914. {
  915. struct rt_event event;
  916. } StaticEventGroup_t;
  917. typedef struct xSTATIC_TIMER
  918. {
  919. struct rt_timer timer;
  920. void * pvTimerID;
  921. } StaticTimer_t;
  922. /* *INDENT-OFF* */
  923. #ifdef __cplusplus
  924. }
  925. #endif
  926. /* *INDENT-ON* */
  927. #endif /* INC_FREERTOS_H */