FreeRTOS.h 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961
  1. /*
  2. FreeRTOS V8.2.0 - Copyright (C) 2015 Real Time Engineers Ltd.
  3. All rights reserved
  4. VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
  5. This file is part of the FreeRTOS distribution.
  6. FreeRTOS is free software; you can redistribute it and/or modify it under
  7. the terms of the GNU General Public License (version 2) as published by the
  8. Free Software Foundation >>!AND MODIFIED BY!<< the FreeRTOS exception.
  9. ***************************************************************************
  10. >>! NOTE: The modification to the GPL is included to allow you to !<<
  11. >>! distribute a combined work that includes FreeRTOS without being !<<
  12. >>! obliged to provide the source code for proprietary components !<<
  13. >>! outside of the FreeRTOS kernel. !<<
  14. ***************************************************************************
  15. FreeRTOS is distributed in the hope that it will be useful, but WITHOUT ANY
  16. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17. FOR A PARTICULAR PURPOSE. Full license text is available on the following
  18. link: http://www.freertos.org/a00114.html
  19. ***************************************************************************
  20. * *
  21. * FreeRTOS provides completely free yet professionally developed, *
  22. * robust, strictly quality controlled, supported, and cross *
  23. * platform software that is more than just the market leader, it *
  24. * is the industry's de facto standard. *
  25. * *
  26. * Help yourself get started quickly while simultaneously helping *
  27. * to support the FreeRTOS project by purchasing a FreeRTOS *
  28. * tutorial book, reference manual, or both: *
  29. * http://www.FreeRTOS.org/Documentation *
  30. * *
  31. ***************************************************************************
  32. http://www.FreeRTOS.org/FAQHelp.html - Having a problem? Start by reading
  33. the FAQ page "My application does not run, what could be wrong?". Have you
  34. defined configASSERT()?
  35. http://www.FreeRTOS.org/support - In return for receiving this top quality
  36. embedded software for free we request you assist our global community by
  37. participating in the support forum.
  38. http://www.FreeRTOS.org/training - Investing in training allows your team to
  39. be as productive as possible as early as possible. Now you can receive
  40. FreeRTOS training directly from Richard Barry, CEO of Real Time Engineers
  41. Ltd, and the world's leading authority on the world's leading RTOS.
  42. http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
  43. including FreeRTOS+Trace - an indispensable productivity tool, a DOS
  44. compatible FAT file system, and our tiny thread aware UDP/IP stack.
  45. http://www.FreeRTOS.org/labs - Where new FreeRTOS products go to incubate.
  46. Come and try FreeRTOS+TCP, our new open source TCP/IP stack for FreeRTOS.
  47. http://www.OpenRTOS.com - Real Time Engineers ltd. license FreeRTOS to High
  48. Integrity Systems ltd. to sell under the OpenRTOS brand. Low cost OpenRTOS
  49. licenses offer ticketed support, indemnification and commercial middleware.
  50. http://www.SafeRTOS.com - High Integrity Systems also provide a safety
  51. engineered and independently SIL3 certified version for use in safety and
  52. mission critical applications that require provable dependability.
  53. 1 tab == 4 spaces!
  54. */
  55. #ifndef INC_FREERTOS_H
  56. #define INC_FREERTOS_H
  57. /*
  58. * Include the generic headers required for the FreeRTOS port being used.
  59. */
  60. #include <stddef.h>
  61. #include "sys/reent.h"
  62. /*
  63. * If stdint.h cannot be located then:
  64. * + If using GCC ensure the -nostdint options is *not* being used.
  65. * + Ensure the project's include path includes the directory in which your
  66. * compiler stores stdint.h.
  67. * + Set any compiler options necessary for it to support C99, as technically
  68. * stdint.h is only mandatory with C99 (FreeRTOS does not require C99 in any
  69. * other way).
  70. * + The FreeRTOS download includes a simple stdint.h definition that can be
  71. * used in cases where none is provided by the compiler. The files only
  72. * contains the typedefs required to build FreeRTOS. Read the instructions
  73. * in FreeRTOS/source/stdint.readme for more information.
  74. */
  75. #include <stdint.h> /* READ COMMENT ABOVE. */
  76. #ifdef __cplusplus
  77. extern "C" {
  78. #endif
  79. /* Application specific configuration options. */
  80. #include "FreeRTOSConfig.h"
  81. /* Basic FreeRTOS definitions. */
  82. #include "projdefs.h"
  83. /* Definitions specific to the port being used. */
  84. #include "portable.h"
  85. /*
  86. * Check all the required application specific macros have been defined.
  87. * These macros are application specific and (as downloaded) are defined
  88. * within FreeRTOSConfig.h.
  89. */
  90. #ifndef configMINIMAL_STACK_SIZE
  91. #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.
  92. #endif
  93. #ifndef configMAX_PRIORITIES
  94. #error Missing definition: configMAX_PRIORITIES must be defined in FreeRTOSConfig.h. See the Configuration section of the FreeRTOS API documentation for details.
  95. #endif
  96. #ifndef configUSE_PREEMPTION
  97. #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.
  98. #endif
  99. #ifndef configUSE_IDLE_HOOK
  100. #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.
  101. #endif
  102. #ifndef configUSE_TICK_HOOK
  103. #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.
  104. #endif
  105. #ifndef configUSE_CO_ROUTINES
  106. #error Missing definition: configUSE_CO_ROUTINES must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
  107. #endif
  108. #ifndef INCLUDE_vTaskPrioritySet
  109. #error Missing definition: INCLUDE_vTaskPrioritySet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
  110. #endif
  111. #ifndef INCLUDE_uxTaskPriorityGet
  112. #error Missing definition: INCLUDE_uxTaskPriorityGet must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
  113. #endif
  114. #ifndef INCLUDE_vTaskDelete
  115. #error Missing definition: INCLUDE_vTaskDelete must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
  116. #endif
  117. #ifndef INCLUDE_vTaskSuspend
  118. #error Missing definition: INCLUDE_vTaskSuspend must be defined in FreeRTOSConfig.h as either 1 or 0. See the Configuration section of the FreeRTOS API documentation for details.
  119. #endif
  120. #ifndef INCLUDE_vTaskDelayUntil
  121. #error Missing definition: INCLUDE_vTaskDelayUntil 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 INCLUDE_vTaskDelay
  124. #error Missing definition: INCLUDE_vTaskDelay 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_16_BIT_TICKS
  127. #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.
  128. #endif
  129. #if configUSE_CO_ROUTINES != 0
  130. #ifndef configMAX_CO_ROUTINE_PRIORITIES
  131. #error configMAX_CO_ROUTINE_PRIORITIES must be greater than or equal to 1.
  132. #endif
  133. #endif
  134. #ifndef configMAX_PRIORITIES
  135. #error configMAX_PRIORITIES must be defined to be greater than or equal to 1.
  136. #endif
  137. #ifndef INCLUDE_xTaskGetIdleTaskHandle
  138. #define INCLUDE_xTaskGetIdleTaskHandle 0
  139. #endif
  140. #ifndef INCLUDE_xTimerGetTimerDaemonTaskHandle
  141. #define INCLUDE_xTimerGetTimerDaemonTaskHandle 0
  142. #endif
  143. #ifndef INCLUDE_xQueueGetMutexHolder
  144. #define INCLUDE_xQueueGetMutexHolder 0
  145. #endif
  146. #ifndef INCLUDE_xSemaphoreGetMutexHolder
  147. #define INCLUDE_xSemaphoreGetMutexHolder INCLUDE_xQueueGetMutexHolder
  148. #endif
  149. #ifndef INCLUDE_pcTaskGetTaskName
  150. #if ( configENABLE_MEMORY_DEBUG == 1)
  151. #define INCLUDE_pcTaskGetTaskName 1
  152. #else
  153. #define INCLUDE_pcTaskGetTaskName 0
  154. #endif
  155. #endif
  156. #ifndef configUSE_APPLICATION_TASK_TAG
  157. #define configUSE_APPLICATION_TASK_TAG 0
  158. #endif
  159. #ifndef INCLUDE_uxTaskGetStackHighWaterMark
  160. #define INCLUDE_uxTaskGetStackHighWaterMark 0
  161. #endif
  162. #ifndef INCLUDE_eTaskGetState
  163. #define INCLUDE_eTaskGetState 0
  164. #endif
  165. #ifndef configUSE_RECURSIVE_MUTEXES
  166. #define configUSE_RECURSIVE_MUTEXES 0
  167. #endif
  168. #ifndef configUSE_MUTEXES
  169. #define configUSE_MUTEXES 0
  170. #endif
  171. #ifndef configUSE_TIMERS
  172. #define configUSE_TIMERS 0
  173. #endif
  174. #ifndef configUSE_COUNTING_SEMAPHORES
  175. #define configUSE_COUNTING_SEMAPHORES 0
  176. #endif
  177. #ifndef configUSE_ALTERNATIVE_API
  178. #define configUSE_ALTERNATIVE_API 0
  179. #endif
  180. #ifndef portCRITICAL_NESTING_IN_TCB
  181. #define portCRITICAL_NESTING_IN_TCB 0
  182. #endif
  183. #ifndef configMAX_TASK_NAME_LEN
  184. #define configMAX_TASK_NAME_LEN 16
  185. #endif
  186. #ifndef configIDLE_SHOULD_YIELD
  187. #define configIDLE_SHOULD_YIELD 1
  188. #endif
  189. #if configMAX_TASK_NAME_LEN < 1
  190. #error configMAX_TASK_NAME_LEN must be set to a minimum of 1 in FreeRTOSConfig.h
  191. #endif
  192. #ifndef INCLUDE_xTaskResumeFromISR
  193. #define INCLUDE_xTaskResumeFromISR 1
  194. #endif
  195. #ifndef INCLUDE_xEventGroupSetBitFromISR
  196. #define INCLUDE_xEventGroupSetBitFromISR 0
  197. #endif
  198. #ifndef INCLUDE_xTimerPendFunctionCall
  199. #define INCLUDE_xTimerPendFunctionCall 0
  200. #endif
  201. #ifndef configASSERT
  202. #define configASSERT( x )
  203. #define configASSERT_DEFINED 0
  204. #else
  205. #define configASSERT_DEFINED 1
  206. #endif
  207. /* The timers module relies on xTaskGetSchedulerState(). */
  208. #if configUSE_TIMERS == 1
  209. #ifndef configTIMER_TASK_PRIORITY
  210. #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_PRIORITY must also be defined.
  211. #endif /* configTIMER_TASK_PRIORITY */
  212. #ifndef configTIMER_QUEUE_LENGTH
  213. #error If configUSE_TIMERS is set to 1 then configTIMER_QUEUE_LENGTH must also be defined.
  214. #endif /* configTIMER_QUEUE_LENGTH */
  215. #ifndef configTIMER_TASK_STACK_DEPTH
  216. #error If configUSE_TIMERS is set to 1 then configTIMER_TASK_STACK_DEPTH must also be defined.
  217. #endif /* configTIMER_TASK_STACK_DEPTH */
  218. #endif /* configUSE_TIMERS */
  219. #ifndef INCLUDE_xTaskGetSchedulerState
  220. #define INCLUDE_xTaskGetSchedulerState 0
  221. #endif
  222. #ifndef INCLUDE_xTaskGetCurrentTaskHandle
  223. #define INCLUDE_xTaskGetCurrentTaskHandle 0
  224. #endif
  225. #ifndef portSET_INTERRUPT_MASK_FROM_ISR
  226. #define portSET_INTERRUPT_MASK_FROM_ISR() 0
  227. #endif
  228. #ifndef portCLEAR_INTERRUPT_MASK_FROM_ISR
  229. #define portCLEAR_INTERRUPT_MASK_FROM_ISR( uxSavedStatusValue ) ( void ) uxSavedStatusValue
  230. #endif
  231. #ifndef portCLEAN_UP_TCB
  232. #define portCLEAN_UP_TCB( pxTCB ) ( void ) pxTCB
  233. #endif
  234. #ifndef portPRE_TASK_DELETE_HOOK
  235. #define portPRE_TASK_DELETE_HOOK( pvTaskToDelete, pxYieldPending )
  236. #endif
  237. #ifndef portSETUP_TCB
  238. #define portSETUP_TCB( pxTCB ) ( void ) pxTCB
  239. #endif
  240. #ifndef configQUEUE_REGISTRY_SIZE
  241. #define configQUEUE_REGISTRY_SIZE 0U
  242. #endif
  243. #if ( configQUEUE_REGISTRY_SIZE < 1 )
  244. #define vQueueAddToRegistry( xQueue, pcName )
  245. #define vQueueUnregisterQueue( xQueue )
  246. #endif
  247. #ifndef portPOINTER_SIZE_TYPE
  248. #define portPOINTER_SIZE_TYPE uint32_t
  249. #endif
  250. /* Remove any unused trace macros. */
  251. #ifndef traceSTART
  252. /* Used to perform any necessary initialisation - for example, open a file
  253. into which trace is to be written. */
  254. #define traceSTART()
  255. #endif
  256. #ifndef traceEND
  257. /* Use to close a trace, for example close a file into which trace has been
  258. written. */
  259. #define traceEND()
  260. #endif
  261. #ifndef traceTASK_SWITCHED_IN
  262. /* Called after a task has been selected to run. pxCurrentTCB holds a pointer
  263. to the task control block of the selected task. */
  264. #define traceTASK_SWITCHED_IN()
  265. #endif
  266. #ifndef traceINCREASE_TICK_COUNT
  267. /* Called before stepping the tick count after waking from tickless idle
  268. sleep. */
  269. #define traceINCREASE_TICK_COUNT( x )
  270. #endif
  271. #ifndef traceLOW_POWER_IDLE_BEGIN
  272. /* Called immediately before entering tickless idle. */
  273. #define traceLOW_POWER_IDLE_BEGIN()
  274. #endif
  275. #ifndef traceLOW_POWER_IDLE_END
  276. /* Called when returning to the Idle task after a tickless idle. */
  277. #define traceLOW_POWER_IDLE_END()
  278. #endif
  279. #ifndef traceTASK_SWITCHED_OUT
  280. /* Called before a task has been selected to run. pxCurrentTCB holds a pointer
  281. to the task control block of the task being switched out. */
  282. #define traceTASK_SWITCHED_OUT()
  283. #endif
  284. #ifndef traceTASK_PRIORITY_INHERIT
  285. /* Called when a task attempts to take a mutex that is already held by a
  286. lower priority task. pxTCBOfMutexHolder is a pointer to the TCB of the task
  287. that holds the mutex. uxInheritedPriority is the priority the mutex holder
  288. will inherit (the priority of the task that is attempting to obtain the
  289. muted. */
  290. #define traceTASK_PRIORITY_INHERIT( pxTCBOfMutexHolder, uxInheritedPriority )
  291. #endif
  292. #ifndef traceTASK_PRIORITY_DISINHERIT
  293. /* Called when a task releases a mutex, the holding of which had resulted in
  294. the task inheriting the priority of a higher priority task.
  295. pxTCBOfMutexHolder is a pointer to the TCB of the task that is releasing the
  296. mutex. uxOriginalPriority is the task's configured (base) priority. */
  297. #define traceTASK_PRIORITY_DISINHERIT( pxTCBOfMutexHolder, uxOriginalPriority )
  298. #endif
  299. #ifndef traceBLOCKING_ON_QUEUE_RECEIVE
  300. /* Task is about to block because it cannot read from a
  301. queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
  302. upon which the read was attempted. pxCurrentTCB points to the TCB of the
  303. task that attempted the read. */
  304. #define traceBLOCKING_ON_QUEUE_RECEIVE( pxQueue )
  305. #endif
  306. #ifndef traceBLOCKING_ON_QUEUE_SEND
  307. /* Task is about to block because it cannot write to a
  308. queue/mutex/semaphore. pxQueue is a pointer to the queue/mutex/semaphore
  309. upon which the write was attempted. pxCurrentTCB points to the TCB of the
  310. task that attempted the write. */
  311. #define traceBLOCKING_ON_QUEUE_SEND( pxQueue )
  312. #endif
  313. #ifndef configCHECK_FOR_STACK_OVERFLOW
  314. #define configCHECK_FOR_STACK_OVERFLOW 0
  315. #endif
  316. /* The following event macros are embedded in the kernel API calls. */
  317. #ifndef traceMOVED_TASK_TO_READY_STATE
  318. #define traceMOVED_TASK_TO_READY_STATE( pxTCB )
  319. #endif
  320. #ifndef traceQUEUE_CREATE
  321. #define traceQUEUE_CREATE( pxNewQueue )
  322. #endif
  323. #ifndef traceQUEUE_CREATE_FAILED
  324. #define traceQUEUE_CREATE_FAILED( ucQueueType )
  325. #endif
  326. #ifndef traceCREATE_MUTEX
  327. #define traceCREATE_MUTEX( pxNewQueue )
  328. #endif
  329. #ifndef traceCREATE_MUTEX_FAILED
  330. #define traceCREATE_MUTEX_FAILED()
  331. #endif
  332. #ifndef traceGIVE_MUTEX_RECURSIVE
  333. #define traceGIVE_MUTEX_RECURSIVE( pxMutex )
  334. #endif
  335. #ifndef traceGIVE_MUTEX_RECURSIVE_FAILED
  336. #define traceGIVE_MUTEX_RECURSIVE_FAILED( pxMutex )
  337. #endif
  338. #ifndef traceTAKE_MUTEX_RECURSIVE
  339. #define traceTAKE_MUTEX_RECURSIVE( pxMutex )
  340. #endif
  341. #ifndef traceTAKE_MUTEX_RECURSIVE_FAILED
  342. #define traceTAKE_MUTEX_RECURSIVE_FAILED( pxMutex )
  343. #endif
  344. #ifndef traceCREATE_COUNTING_SEMAPHORE
  345. #define traceCREATE_COUNTING_SEMAPHORE()
  346. #endif
  347. #ifndef traceCREATE_COUNTING_SEMAPHORE_FAILED
  348. #define traceCREATE_COUNTING_SEMAPHORE_FAILED()
  349. #endif
  350. #ifndef traceQUEUE_SEND
  351. #define traceQUEUE_SEND( pxQueue )
  352. #endif
  353. #ifndef traceQUEUE_SEND_FAILED
  354. #define traceQUEUE_SEND_FAILED( pxQueue )
  355. #endif
  356. #ifndef traceQUEUE_RECEIVE
  357. #define traceQUEUE_RECEIVE( pxQueue )
  358. #endif
  359. #ifndef traceQUEUE_PEEK
  360. #define traceQUEUE_PEEK( pxQueue )
  361. #endif
  362. #ifndef traceQUEUE_PEEK_FROM_ISR
  363. #define traceQUEUE_PEEK_FROM_ISR( pxQueue )
  364. #endif
  365. #ifndef traceQUEUE_RECEIVE_FAILED
  366. #define traceQUEUE_RECEIVE_FAILED( pxQueue )
  367. #endif
  368. #ifndef traceQUEUE_SEND_FROM_ISR
  369. #define traceQUEUE_SEND_FROM_ISR( pxQueue )
  370. #endif
  371. #ifndef traceQUEUE_SEND_FROM_ISR_FAILED
  372. #define traceQUEUE_SEND_FROM_ISR_FAILED( pxQueue )
  373. #endif
  374. #ifndef traceQUEUE_RECEIVE_FROM_ISR
  375. #define traceQUEUE_RECEIVE_FROM_ISR( pxQueue )
  376. #endif
  377. #ifndef traceQUEUE_RECEIVE_FROM_ISR_FAILED
  378. #define traceQUEUE_RECEIVE_FROM_ISR_FAILED( pxQueue )
  379. #endif
  380. #ifndef traceQUEUE_PEEK_FROM_ISR_FAILED
  381. #define traceQUEUE_PEEK_FROM_ISR_FAILED( pxQueue )
  382. #endif
  383. #ifndef traceQUEUE_DELETE
  384. #define traceQUEUE_DELETE( pxQueue )
  385. #endif
  386. #ifndef traceTASK_CREATE
  387. #define traceTASK_CREATE( pxNewTCB )
  388. #endif
  389. #ifndef traceTASK_CREATE_FAILED
  390. #define traceTASK_CREATE_FAILED()
  391. #endif
  392. #ifndef traceTASK_DELETE
  393. #define traceTASK_DELETE( pxTaskToDelete )
  394. #endif
  395. #ifndef traceTASK_DELAY_UNTIL
  396. #define traceTASK_DELAY_UNTIL()
  397. #endif
  398. #ifndef traceTASK_DELAY
  399. #define traceTASK_DELAY()
  400. #endif
  401. #ifndef traceTASK_PRIORITY_SET
  402. #define traceTASK_PRIORITY_SET( pxTask, uxNewPriority )
  403. #endif
  404. #ifndef traceTASK_SUSPEND
  405. #define traceTASK_SUSPEND( pxTaskToSuspend )
  406. #endif
  407. #ifndef traceTASK_RESUME
  408. #define traceTASK_RESUME( pxTaskToResume )
  409. #endif
  410. #ifndef traceTASK_RESUME_FROM_ISR
  411. #define traceTASK_RESUME_FROM_ISR( pxTaskToResume )
  412. #endif
  413. #ifndef traceTASK_INCREMENT_TICK
  414. #define traceTASK_INCREMENT_TICK( xTickCount )
  415. #endif
  416. #ifndef traceTIMER_CREATE
  417. #define traceTIMER_CREATE( pxNewTimer )
  418. #endif
  419. #ifndef traceTIMER_CREATE_FAILED
  420. #define traceTIMER_CREATE_FAILED()
  421. #endif
  422. #ifndef traceTIMER_COMMAND_SEND
  423. #define traceTIMER_COMMAND_SEND( xTimer, xMessageID, xMessageValueValue, xReturn )
  424. #endif
  425. #ifndef traceTIMER_EXPIRED
  426. #define traceTIMER_EXPIRED( pxTimer )
  427. #endif
  428. #ifndef traceTIMER_COMMAND_RECEIVED
  429. #define traceTIMER_COMMAND_RECEIVED( pxTimer, xMessageID, xMessageValue )
  430. #endif
  431. #ifndef traceMALLOC
  432. #define traceMALLOC( pvAddress, uiSize )
  433. #endif
  434. #ifndef traceFREE
  435. #define traceFREE( pvAddress, uiSize )
  436. #endif
  437. #ifndef traceEVENT_GROUP_CREATE
  438. #define traceEVENT_GROUP_CREATE( xEventGroup )
  439. #endif
  440. #ifndef traceEVENT_GROUP_CREATE_FAILED
  441. #define traceEVENT_GROUP_CREATE_FAILED()
  442. #endif
  443. #ifndef traceEVENT_GROUP_SYNC_BLOCK
  444. #define traceEVENT_GROUP_SYNC_BLOCK( xEventGroup, uxBitsToSet, uxBitsToWaitFor )
  445. #endif
  446. #ifndef traceEVENT_GROUP_SYNC_END
  447. #define traceEVENT_GROUP_SYNC_END( xEventGroup, uxBitsToSet, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
  448. #endif
  449. #ifndef traceEVENT_GROUP_WAIT_BITS_BLOCK
  450. #define traceEVENT_GROUP_WAIT_BITS_BLOCK( xEventGroup, uxBitsToWaitFor )
  451. #endif
  452. #ifndef traceEVENT_GROUP_WAIT_BITS_END
  453. #define traceEVENT_GROUP_WAIT_BITS_END( xEventGroup, uxBitsToWaitFor, xTimeoutOccurred ) ( void ) xTimeoutOccurred
  454. #endif
  455. #ifndef traceEVENT_GROUP_CLEAR_BITS
  456. #define traceEVENT_GROUP_CLEAR_BITS( xEventGroup, uxBitsToClear )
  457. #endif
  458. #ifndef traceEVENT_GROUP_CLEAR_BITS_FROM_ISR
  459. #define traceEVENT_GROUP_CLEAR_BITS_FROM_ISR( xEventGroup, uxBitsToClear )
  460. #endif
  461. #ifndef traceEVENT_GROUP_SET_BITS
  462. #define traceEVENT_GROUP_SET_BITS( xEventGroup, uxBitsToSet )
  463. #endif
  464. #ifndef traceEVENT_GROUP_SET_BITS_FROM_ISR
  465. #define traceEVENT_GROUP_SET_BITS_FROM_ISR( xEventGroup, uxBitsToSet )
  466. #endif
  467. #ifndef traceEVENT_GROUP_DELETE
  468. #define traceEVENT_GROUP_DELETE( xEventGroup )
  469. #endif
  470. #ifndef tracePEND_FUNC_CALL
  471. #define tracePEND_FUNC_CALL(xFunctionToPend, pvParameter1, ulParameter2, ret)
  472. #endif
  473. #ifndef tracePEND_FUNC_CALL_FROM_ISR
  474. #define tracePEND_FUNC_CALL_FROM_ISR(xFunctionToPend, pvParameter1, ulParameter2, ret)
  475. #endif
  476. #ifndef traceQUEUE_REGISTRY_ADD
  477. #define traceQUEUE_REGISTRY_ADD(xQueue, pcQueueName)
  478. #endif
  479. #ifndef configGENERATE_RUN_TIME_STATS
  480. #define configGENERATE_RUN_TIME_STATS 0
  481. #endif
  482. #if ( configGENERATE_RUN_TIME_STATS == 1 )
  483. #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
  484. #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.
  485. #endif /* portCONFIGURE_TIMER_FOR_RUN_TIME_STATS */
  486. #ifndef portGET_RUN_TIME_COUNTER_VALUE
  487. #ifndef portALT_GET_RUN_TIME_COUNTER_VALUE
  488. #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.
  489. #endif /* portALT_GET_RUN_TIME_COUNTER_VALUE */
  490. #endif /* portGET_RUN_TIME_COUNTER_VALUE */
  491. #endif /* configGENERATE_RUN_TIME_STATS */
  492. #ifndef portCONFIGURE_TIMER_FOR_RUN_TIME_STATS
  493. #define portCONFIGURE_TIMER_FOR_RUN_TIME_STATS()
  494. #endif
  495. #ifndef configUSE_MALLOC_FAILED_HOOK
  496. #define configUSE_MALLOC_FAILED_HOOK 0
  497. #endif
  498. #ifndef portPRIVILEGE_BIT
  499. #define portPRIVILEGE_BIT ( ( UBaseType_t ) 0x00 )
  500. #endif
  501. #ifndef portYIELD_WITHIN_API
  502. #define portYIELD_WITHIN_API portYIELD
  503. #endif
  504. #ifndef pvPortMallocAligned
  505. #define pvPortMallocAligned( x, puxStackBuffer ) ( ( ( puxStackBuffer ) == NULL ) ? ( pvPortMalloc( ( x ) ) ) : ( puxStackBuffer ) )
  506. #endif
  507. #ifndef vPortFreeAligned
  508. #define vPortFreeAligned( pvBlockToFree ) vPortFree( pvBlockToFree )
  509. #endif
  510. #ifndef portSUPPRESS_TICKS_AND_SLEEP
  511. #define portSUPPRESS_TICKS_AND_SLEEP( xExpectedIdleTime )
  512. #endif
  513. #ifndef configEXPECTED_IDLE_TIME_BEFORE_SLEEP
  514. #define configEXPECTED_IDLE_TIME_BEFORE_SLEEP 2
  515. #endif
  516. #if configEXPECTED_IDLE_TIME_BEFORE_SLEEP < 2
  517. #error configEXPECTED_IDLE_TIME_BEFORE_SLEEP must not be less than 2
  518. #endif
  519. #ifndef configUSE_TICKLESS_IDLE
  520. #define configUSE_TICKLESS_IDLE 0
  521. #endif
  522. #ifndef configPRE_SLEEP_PROCESSING
  523. #define configPRE_SLEEP_PROCESSING( x )
  524. #endif
  525. #ifndef configPOST_SLEEP_PROCESSING
  526. #define configPOST_SLEEP_PROCESSING( x )
  527. #endif
  528. #ifndef configUSE_QUEUE_SETS
  529. #define configUSE_QUEUE_SETS 0
  530. #endif
  531. #ifndef portTASK_USES_FLOATING_POINT
  532. #define portTASK_USES_FLOATING_POINT()
  533. #endif
  534. #ifndef configUSE_TIME_SLICING
  535. #define configUSE_TIME_SLICING 1
  536. #endif
  537. #ifndef configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS
  538. #define configINCLUDE_APPLICATION_DEFINED_PRIVILEGED_FUNCTIONS 0
  539. #endif
  540. #ifndef configUSE_NEWLIB_REENTRANT
  541. #define configUSE_NEWLIB_REENTRANT 0
  542. #endif
  543. #ifndef configUSE_STATS_FORMATTING_FUNCTIONS
  544. #define configUSE_STATS_FORMATTING_FUNCTIONS 0
  545. #endif
  546. #ifndef portASSERT_IF_INTERRUPT_PRIORITY_INVALID
  547. #define portASSERT_IF_INTERRUPT_PRIORITY_INVALID()
  548. #endif
  549. #ifndef configUSE_TRACE_FACILITY
  550. #define configUSE_TRACE_FACILITY 0
  551. #endif
  552. #ifndef mtCOVERAGE_TEST_MARKER
  553. #define mtCOVERAGE_TEST_MARKER()
  554. #endif
  555. #ifndef portASSERT_IF_IN_ISR
  556. #define portASSERT_IF_IN_ISR()
  557. #endif
  558. #ifndef configUSE_PORT_OPTIMISED_TASK_SELECTION
  559. #define configUSE_PORT_OPTIMISED_TASK_SELECTION 0
  560. #endif
  561. #ifndef configAPPLICATION_ALLOCATED_HEAP
  562. #define configAPPLICATION_ALLOCATED_HEAP 0
  563. #endif
  564. #ifndef configUSE_TASK_NOTIFICATIONS
  565. #define configUSE_TASK_NOTIFICATIONS 1
  566. #endif
  567. #ifndef portTICK_TYPE_IS_ATOMIC
  568. #define portTICK_TYPE_IS_ATOMIC 0
  569. #endif
  570. #ifndef configSUPPORT_STATIC_ALLOCATION
  571. /* Defaults to 0 for backward compatibility. */
  572. #define configSUPPORT_STATIC_ALLOCATION 0
  573. #endif
  574. #ifndef configSUPPORT_DYNAMIC_ALLOCATION
  575. /* Defaults to 1 for backward compatibility. */
  576. #define configSUPPORT_DYNAMIC_ALLOCATION 1
  577. #endif
  578. #if( ( configSUPPORT_STATIC_ALLOCATION == 0 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 0 ) )
  579. #error configSUPPORT_STATIC_ALLOCATION and configSUPPORT_DYNAMIC_ALLOCATION cannot both be 0, but can both be 1.
  580. #endif
  581. #if( portTICK_TYPE_IS_ATOMIC == 0 )
  582. /* Either variables of tick type cannot be read atomically, or
  583. portTICK_TYPE_IS_ATOMIC was not set - map the critical sections used when
  584. the tick count is returned to the standard critical section macros. */
  585. #define portTICK_TYPE_ENTER_CRITICAL(mux) portENTER_CRITICAL(mux)
  586. #define portTICK_TYPE_EXIT_CRITICAL(mux) portEXIT_CRITICAL(mux)
  587. #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() portSET_INTERRUPT_MASK_FROM_ISR()
  588. #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) portCLEAR_INTERRUPT_MASK_FROM_ISR( ( x ) )
  589. #else
  590. /* The tick type can be read atomically, so critical sections used when the
  591. tick count is returned can be defined away. */
  592. #define portTICK_TYPE_ENTER_CRITICAL()
  593. #define portTICK_TYPE_EXIT_CRITICAL()
  594. #define portTICK_TYPE_SET_INTERRUPT_MASK_FROM_ISR() 0
  595. #define portTICK_TYPE_CLEAR_INTERRUPT_MASK_FROM_ISR( x ) ( void ) x
  596. #endif
  597. /* Definitions to allow backward compatibility with FreeRTOS versions prior to
  598. V8 if desired. */
  599. #ifndef configENABLE_BACKWARD_COMPATIBILITY
  600. #define configENABLE_BACKWARD_COMPATIBILITY 1
  601. #endif
  602. #if configENABLE_BACKWARD_COMPATIBILITY == 1
  603. #define eTaskStateGet eTaskGetState
  604. #define portTickType TickType_t
  605. #define xTaskHandle TaskHandle_t
  606. #define xQueueHandle QueueHandle_t
  607. #define xSemaphoreHandle SemaphoreHandle_t
  608. #define xQueueSetHandle QueueSetHandle_t
  609. #define xQueueSetMemberHandle QueueSetMemberHandle_t
  610. #define xTimeOutType TimeOut_t
  611. #define xMemoryRegion MemoryRegion_t
  612. #define xTaskParameters TaskParameters_t
  613. #define xTaskStatusType TaskStatus_t
  614. #define xTimerHandle TimerHandle_t
  615. #define xCoRoutineHandle CoRoutineHandle_t
  616. #define pdTASK_HOOK_CODE TaskHookFunction_t
  617. #define portTICK_RATE_MS portTICK_PERIOD_MS
  618. /* Backward compatibility within the scheduler code only - these definitions
  619. are not really required but are included for completeness. */
  620. #define tmrTIMER_CALLBACK TimerCallbackFunction_t
  621. #define pdTASK_CODE TaskFunction_t
  622. #define xListItem ListItem_t
  623. #define xList List_t
  624. #endif /* configENABLE_BACKWARD_COMPATIBILITY */
  625. #ifndef configESP32_PER_TASK_DATA
  626. #define configESP32_PER_TASK_DATA 1
  627. #endif
  628. /*
  629. * In line with software engineering best practice, FreeRTOS implements a strict
  630. * data hiding policy, so the real structures used by FreeRTOS to maintain the
  631. * state of tasks, queues, semaphores, etc. are not accessible to the application
  632. * code. However, if the application writer wants to statically allocate such
  633. * an object then the size of the object needs to be know. Dummy structures
  634. * that are guaranteed to have the same size and alignment requirements of the
  635. * real objects are used for this purpose. The dummy list and list item
  636. * structures below are used for inclusion in such a dummy structure.
  637. */
  638. struct xSTATIC_LIST_ITEM
  639. {
  640. TickType_t xDummy1;
  641. void *pvDummy2[ 4 ];
  642. };
  643. typedef struct xSTATIC_LIST_ITEM StaticListItem_t;
  644. /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
  645. struct xSTATIC_MINI_LIST_ITEM
  646. {
  647. TickType_t xDummy1;
  648. void *pvDummy2[ 2 ];
  649. };
  650. typedef struct xSTATIC_MINI_LIST_ITEM StaticMiniListItem_t;
  651. /* See the comments above the struct xSTATIC_LIST_ITEM definition. */
  652. typedef struct xSTATIC_LIST
  653. {
  654. UBaseType_t uxDummy1;
  655. void *pvDummy2;
  656. StaticMiniListItem_t xDummy3;
  657. } StaticList_t;
  658. /*
  659. * In line with software engineering best practice, especially when supplying a
  660. * library that is likely to change in future versions, FreeRTOS implements a
  661. * strict data hiding policy. This means the Task structure used internally by
  662. * FreeRTOS is not accessible to application code. However, if the application
  663. * writer wants to statically allocate the memory required to create a task then
  664. * the size of the task object needs to be know. The StaticTask_t structure
  665. * below is provided for this purpose. Its sizes and alignment requirements are
  666. * guaranteed to match those of the genuine structure, no matter which
  667. * architecture is being used, and no matter how the values in FreeRTOSConfig.h
  668. * are set. Its contents are somewhat obfuscated in the hope users will
  669. * recognise that it would be unwise to make direct use of the structure members.
  670. */
  671. typedef struct xSTATIC_TCB
  672. {
  673. void *pxDummy1;
  674. #if ( portUSING_MPU_WRAPPERS == 1 )
  675. xMPU_SETTINGS xDummy2;
  676. #endif
  677. StaticListItem_t xDummy3[ 2 ];
  678. UBaseType_t uxDummy5;
  679. void *pxDummy6;
  680. uint8_t ucDummy7[ configMAX_TASK_NAME_LEN ];
  681. UBaseType_t uxDummyCoreId;
  682. #if ( portSTACK_GROWTH > 0 )
  683. void *pxDummy8;
  684. #endif
  685. #if ( portCRITICAL_NESTING_IN_TCB == 1 )
  686. UBaseType_t uxDummy9;
  687. uint32_t OldInterruptState;
  688. #endif
  689. #if ( configUSE_TRACE_FACILITY == 1 )
  690. UBaseType_t uxDummy10[ 2 ];
  691. #endif
  692. #if ( configUSE_MUTEXES == 1 )
  693. UBaseType_t uxDummy12[ 2 ];
  694. #endif
  695. #if ( configUSE_APPLICATION_TASK_TAG == 1 )
  696. void *pxDummy14;
  697. #endif
  698. #if( configNUM_THREAD_LOCAL_STORAGE_POINTERS > 0 )
  699. void *pvDummy15[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
  700. #if ( configTHREAD_LOCAL_STORAGE_DELETE_CALLBACKS )
  701. void *pvDummyLocalStorageCallBack[ configNUM_THREAD_LOCAL_STORAGE_POINTERS ];
  702. #endif
  703. #endif
  704. #if ( configGENERATE_RUN_TIME_STATS == 1 )
  705. uint32_t ulDummy16;
  706. #endif
  707. #if ( configUSE_NEWLIB_REENTRANT == 1 )
  708. struct _reent xDummy17;
  709. #endif
  710. #if ( configUSE_TASK_NOTIFICATIONS == 1 )
  711. uint32_t ulDummy18;
  712. uint32_t ucDummy19;
  713. #endif
  714. #if( ( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) ) \
  715. || ( portUSING_MPU_WRAPPERS == 1 ) )
  716. uint8_t uxDummy20;
  717. #endif
  718. } StaticTask_t;
  719. /*
  720. * In line with software engineering best practice, especially when supplying a
  721. * library that is likely to change in future versions, FreeRTOS implements a
  722. * strict data hiding policy. This means the Queue structure used internally by
  723. * FreeRTOS is not accessible to application code. However, if the application
  724. * writer wants to statically allocate the memory required to create a queue
  725. * then the size of the queue object needs to be know. The StaticQueue_t
  726. * structure below is provided for this purpose. Its sizes and alignment
  727. * requirements are guaranteed to match those of the genuine structure, no
  728. * matter which architecture is being used, and no matter how the values in
  729. * FreeRTOSConfig.h are set. Its contents are somewhat obfuscated in the hope
  730. * users will recognise that it would be unwise to make direct use of the
  731. * structure members.
  732. */
  733. typedef struct xSTATIC_QUEUE
  734. {
  735. void *pvDummy1[ 3 ];
  736. union
  737. {
  738. void *pvDummy2;
  739. UBaseType_t uxDummy2;
  740. } u;
  741. StaticList_t xDummy3[ 2 ];
  742. UBaseType_t uxDummy4[ 3 ];
  743. #if( ( configSUPPORT_STATIC_ALLOCATION == 1 ) && ( configSUPPORT_DYNAMIC_ALLOCATION == 1 ) )
  744. uint8_t ucDummy6;
  745. #endif
  746. #if ( configUSE_QUEUE_SETS == 1 )
  747. void *pvDummy7;
  748. #endif
  749. #if ( configUSE_TRACE_FACILITY == 1 )
  750. UBaseType_t uxDummy8;
  751. uint8_t ucDummy9;
  752. #endif
  753. struct {
  754. volatile uint32_t ucDummy10;
  755. #ifdef CONFIG_FREERTOS_PORTMUX_DEBUG
  756. void *pvDummy8;
  757. UBaseType_t uxDummy11;
  758. #endif
  759. } sDummy12;
  760. } StaticQueue_t;
  761. typedef StaticQueue_t StaticSemaphore_t;
  762. #ifdef __cplusplus
  763. }
  764. #endif
  765. #endif /* INC_FREERTOS_H */