FreeRTOS.h 45 KB

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