FreeRTOS.h 39 KB

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