queue.h 40 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124
  1. /*
  2. * FreeRTOS Kernel V10.4.6
  3. * Copyright (C) 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
  4. *
  5. * SPDX-License-Identifier: MIT
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy of
  8. * this software and associated documentation files (the "Software"), to deal in
  9. * the Software without restriction, including without limitation the rights to
  10. * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  11. * the Software, and to permit persons to whom the Software is furnished to do so,
  12. * subject to the following conditions:
  13. *
  14. * The above copyright notice and this permission notice shall be included in all
  15. * copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  19. * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  20. * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  21. * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  22. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  23. *
  24. * https://www.FreeRTOS.org
  25. * https://github.com/FreeRTOS
  26. *
  27. */
  28. #ifndef QUEUE_H
  29. #define QUEUE_H
  30. /* *INDENT-OFF* */
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34. /* *INDENT-ON* */
  35. /**
  36. * Type by which queues are referenced. For example, a call to xQueueCreate()
  37. * returns an QueueHandle_t variable that can then be used as a parameter to
  38. * xQueueSend(), xQueueReceive(), etc.
  39. */
  40. struct QueueDefinition; /* Using old naming convention so as not to break kernel aware debuggers. */
  41. typedef struct QueueDefinition * QueueHandle_t;
  42. /* For internal use only. */
  43. #define queueSEND_TO_BACK ( ( BaseType_t ) 0 )
  44. #define queueSEND_TO_FRONT ( ( BaseType_t ) 1 )
  45. #define queueOVERWRITE ( ( BaseType_t ) 2 )
  46. /* For internal use only. These definitions *must* match those in queue.c. */
  47. #define queueQUEUE_TYPE_BASE ( ( uint8_t ) 0U )
  48. #define queueQUEUE_TYPE_SET ( ( uint8_t ) 0U )
  49. #define queueQUEUE_TYPE_MUTEX ( ( uint8_t ) 1U )
  50. #define queueQUEUE_TYPE_COUNTING_SEMAPHORE ( ( uint8_t ) 2U )
  51. #define queueQUEUE_TYPE_BINARY_SEMAPHORE ( ( uint8_t ) 3U )
  52. #define queueQUEUE_TYPE_RECURSIVE_MUTEX ( ( uint8_t ) 4U )
  53. /**
  54. * queue. h
  55. * @code{c}
  56. * QueueHandle_t xQueueCreate(
  57. * UBaseType_t uxQueueLength,
  58. * UBaseType_t uxItemSize
  59. * );
  60. * @endcode
  61. *
  62. * Creates a new queue instance, and returns a handle by which the new queue
  63. * can be referenced.
  64. *
  65. * Internally, within the FreeRTOS implementation, queues use two blocks of
  66. * memory. The first block is used to hold the queue's data structures. The
  67. * second block is used to hold items placed into the queue. If a queue is
  68. * created using xQueueCreate() then both blocks of memory are automatically
  69. * dynamically allocated inside the xQueueCreate() function. (see
  70. * https://www.FreeRTOS.org/a00111.html). If a queue is created using
  71. * xQueueCreateStatic() then the application writer must provide the memory that
  72. * will get used by the queue. xQueueCreateStatic() therefore allows a queue to
  73. * be created without using any dynamic memory allocation.
  74. *
  75. * https://www.FreeRTOS.org/Embedded-RTOS-Queues.html
  76. *
  77. * @param uxQueueLength The maximum number of items that the queue can contain.
  78. *
  79. * @param uxItemSize The number of bytes each item in the queue will require.
  80. * Items are queued by copy, not by reference, so this is the number of bytes
  81. * that will be copied for each posted item. Each item on the queue must be
  82. * the same size.
  83. *
  84. * @return If the queue is successfully create then a handle to the newly
  85. * created queue is returned. If the queue cannot be created then 0 is
  86. * returned.
  87. *
  88. * Example usage:
  89. * @code{c}
  90. * struct AMessage
  91. * {
  92. * char ucMessageID;
  93. * char ucData[ 20 ];
  94. * };
  95. *
  96. * void vATask( void *pvParameters )
  97. * {
  98. * QueueHandle_t xQueue1, xQueue2;
  99. *
  100. * // Create a queue capable of containing 10 uint32_t values.
  101. * xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
  102. * if( xQueue1 == 0 )
  103. * {
  104. * // Queue was not created and must not be used.
  105. * }
  106. *
  107. * // Create a queue capable of containing 10 pointers to AMessage structures.
  108. * // These should be passed by pointer as they contain a lot of data.
  109. * xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
  110. * if( xQueue2 == 0 )
  111. * {
  112. * // Queue was not created and must not be used.
  113. * }
  114. *
  115. * // ... Rest of task code.
  116. * }
  117. * @endcode
  118. * \defgroup xQueueCreate xQueueCreate
  119. * \ingroup QueueManagement
  120. */
  121. #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  122. #define xQueueCreate( uxQueueLength, uxItemSize ) xQueueGenericCreate( ( uxQueueLength ), ( uxItemSize ), ( queueQUEUE_TYPE_BASE ) )
  123. #endif
  124. /**
  125. * queue. h
  126. * @code{c}
  127. * QueueHandle_t xQueueCreateStatic(
  128. * UBaseType_t uxQueueLength,
  129. * UBaseType_t uxItemSize,
  130. * uint8_t *pucQueueStorage,
  131. * StaticQueue_t *pxQueueBuffer
  132. * );
  133. * @endcode
  134. *
  135. * Creates a new queue instance, and returns a handle by which the new queue
  136. * can be referenced.
  137. *
  138. * Internally, within the FreeRTOS implementation, queues use two blocks of
  139. * memory. The first block is used to hold the queue's data structures. The
  140. * second block is used to hold items placed into the queue. If a queue is
  141. * created using xQueueCreate() then both blocks of memory are automatically
  142. * dynamically allocated inside the xQueueCreate() function. (see
  143. * https://www.FreeRTOS.org/a00111.html). If a queue is created using
  144. * xQueueCreateStatic() then the application writer must provide the memory that
  145. * will get used by the queue. xQueueCreateStatic() therefore allows a queue to
  146. * be created without using any dynamic memory allocation.
  147. *
  148. * https://www.FreeRTOS.org/Embedded-RTOS-Queues.html
  149. *
  150. * @param uxQueueLength The maximum number of items that the queue can contain.
  151. *
  152. * @param uxItemSize The number of bytes each item in the queue will require.
  153. * Items are queued by copy, not by reference, so this is the number of bytes
  154. * that will be copied for each posted item. Each item on the queue must be
  155. * the same size.
  156. *
  157. * @param pucQueueStorage If uxItemSize is not zero then
  158. * pucQueueStorage must point to a uint8_t array that is at least large
  159. * enough to hold the maximum number of items that can be in the queue at any
  160. * one time - which is ( uxQueueLength * uxItemsSize ) bytes. If uxItemSize is
  161. * zero then pucQueueStorage can be NULL.
  162. *
  163. * @param pxQueueBuffer Must point to a variable of type StaticQueue_t, which
  164. * will be used to hold the queue's data structure.
  165. *
  166. * @return If the queue is created then a handle to the created queue is
  167. * returned. If pxQueueBuffer is NULL then NULL is returned.
  168. *
  169. * Example usage:
  170. * @code{c}
  171. * struct AMessage
  172. * {
  173. * char ucMessageID;
  174. * char ucData[ 20 ];
  175. * };
  176. *
  177. #define QUEUE_LENGTH 10
  178. #define ITEM_SIZE sizeof( uint32_t )
  179. *
  180. * // xQueueBuffer will hold the queue structure.
  181. * StaticQueue_t xQueueBuffer;
  182. *
  183. * // ucQueueStorage will hold the items posted to the queue. Must be at least
  184. * // [(queue length) * ( queue item size)] bytes long.
  185. * uint8_t ucQueueStorage[ QUEUE_LENGTH * ITEM_SIZE ];
  186. *
  187. * void vATask( void *pvParameters )
  188. * {
  189. * QueueHandle_t xQueue1;
  190. *
  191. * // Create a queue capable of containing 10 uint32_t values.
  192. * xQueue1 = xQueueCreate( QUEUE_LENGTH, // The number of items the queue can hold.
  193. * ITEM_SIZE // The size of each item in the queue
  194. * &( ucQueueStorage[ 0 ] ), // The buffer that will hold the items in the queue.
  195. * &xQueueBuffer ); // The buffer that will hold the queue structure.
  196. *
  197. * // The queue is guaranteed to be created successfully as no dynamic memory
  198. * // allocation is used. Therefore xQueue1 is now a handle to a valid queue.
  199. *
  200. * // ... Rest of task code.
  201. * }
  202. * @endcode
  203. * \defgroup xQueueCreateStatic xQueueCreateStatic
  204. * \ingroup QueueManagement
  205. */
  206. #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
  207. #define xQueueCreateStatic( uxQueueLength, uxItemSize, pucQueueStorage, pxQueueBuffer ) xQueueGenericCreateStatic( ( uxQueueLength ), ( uxItemSize ), ( pucQueueStorage ), ( pxQueueBuffer ), ( queueQUEUE_TYPE_BASE ) )
  208. #endif /* configSUPPORT_STATIC_ALLOCATION */
  209. /**
  210. * queue. h
  211. * @code{c}
  212. * BaseType_t xQueueSendToToFront(
  213. * QueueHandle_t xQueue,
  214. * const void *pvItemToQueue,
  215. * TickType_t xTicksToWait
  216. * );
  217. * @endcode
  218. *
  219. * Post an item to the front of a queue. The item is queued by copy, not by
  220. * reference. This function must not be called from an interrupt service
  221. * routine. See xQueueSendFromISR () for an alternative which may be used
  222. * in an ISR.
  223. *
  224. * @param xQueue The handle to the queue on which the item is to be posted.
  225. *
  226. * @param pvItemToQueue A pointer to the item that is to be placed on the
  227. * queue. The size of the items the queue will hold was defined when the
  228. * queue was created, so this many bytes will be copied from pvItemToQueue
  229. * into the queue storage area.
  230. *
  231. * @param xTicksToWait The maximum amount of time the task should block
  232. * waiting for space to become available on the queue, should it already
  233. * be full. The call will return immediately if this is set to 0 and the
  234. * queue is full. The time is defined in tick periods so the constant
  235. * portTICK_PERIOD_MS should be used to convert to real time if this is required.
  236. *
  237. * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
  238. *
  239. * Example usage:
  240. * @code{c}
  241. * struct AMessage
  242. * {
  243. * char ucMessageID;
  244. * char ucData[ 20 ];
  245. * } xMessage;
  246. *
  247. * uint32_t ulVar = 10UL;
  248. *
  249. * void vATask( void *pvParameters )
  250. * {
  251. * QueueHandle_t xQueue1, xQueue2;
  252. * struct AMessage *pxMessage;
  253. *
  254. * // Create a queue capable of containing 10 uint32_t values.
  255. * xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
  256. *
  257. * // Create a queue capable of containing 10 pointers to AMessage structures.
  258. * // These should be passed by pointer as they contain a lot of data.
  259. * xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
  260. *
  261. * // ...
  262. *
  263. * if( xQueue1 != 0 )
  264. * {
  265. * // Send an uint32_t. Wait for 10 ticks for space to become
  266. * // available if necessary.
  267. * if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )
  268. * {
  269. * // Failed to post the message, even after 10 ticks.
  270. * }
  271. * }
  272. *
  273. * if( xQueue2 != 0 )
  274. * {
  275. * // Send a pointer to a struct AMessage object. Don't block if the
  276. * // queue is already full.
  277. * pxMessage = & xMessage;
  278. * xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );
  279. * }
  280. *
  281. * // ... Rest of task code.
  282. * }
  283. * @endcode
  284. * \defgroup xQueueSend xQueueSend
  285. * \ingroup QueueManagement
  286. */
  287. #define xQueueSendToFront( xQueue, pvItemToQueue, xTicksToWait ) \
  288. xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_FRONT )
  289. /**
  290. * queue. h
  291. * @code{c}
  292. * BaseType_t xQueueSendToBack(
  293. * QueueHandle_t xQueue,
  294. * const void *pvItemToQueue,
  295. * TickType_t xTicksToWait
  296. * );
  297. * @endcode
  298. *
  299. * This is a macro that calls xQueueGenericSend().
  300. *
  301. * Post an item to the back of a queue. The item is queued by copy, not by
  302. * reference. This function must not be called from an interrupt service
  303. * routine. See xQueueSendFromISR () for an alternative which may be used
  304. * in an ISR.
  305. *
  306. * @param xQueue The handle to the queue on which the item is to be posted.
  307. *
  308. * @param pvItemToQueue A pointer to the item that is to be placed on the
  309. * queue. The size of the items the queue will hold was defined when the
  310. * queue was created, so this many bytes will be copied from pvItemToQueue
  311. * into the queue storage area.
  312. *
  313. * @param xTicksToWait The maximum amount of time the task should block
  314. * waiting for space to become available on the queue, should it already
  315. * be full. The call will return immediately if this is set to 0 and the queue
  316. * is full. The time is defined in tick periods so the constant
  317. * portTICK_PERIOD_MS should be used to convert to real time if this is required.
  318. *
  319. * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
  320. *
  321. * Example usage:
  322. * @code{c}
  323. * struct AMessage
  324. * {
  325. * char ucMessageID;
  326. * char ucData[ 20 ];
  327. * } xMessage;
  328. *
  329. * uint32_t ulVar = 10UL;
  330. *
  331. * void vATask( void *pvParameters )
  332. * {
  333. * QueueHandle_t xQueue1, xQueue2;
  334. * struct AMessage *pxMessage;
  335. *
  336. * // Create a queue capable of containing 10 uint32_t values.
  337. * xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
  338. *
  339. * // Create a queue capable of containing 10 pointers to AMessage structures.
  340. * // These should be passed by pointer as they contain a lot of data.
  341. * xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
  342. *
  343. * // ...
  344. *
  345. * if( xQueue1 != 0 )
  346. * {
  347. * // Send an uint32_t. Wait for 10 ticks for space to become
  348. * // available if necessary.
  349. * if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )
  350. * {
  351. * // Failed to post the message, even after 10 ticks.
  352. * }
  353. * }
  354. *
  355. * if( xQueue2 != 0 )
  356. * {
  357. * // Send a pointer to a struct AMessage object. Don't block if the
  358. * // queue is already full.
  359. * pxMessage = & xMessage;
  360. * xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );
  361. * }
  362. *
  363. * // ... Rest of task code.
  364. * }
  365. * @endcode
  366. * \defgroup xQueueSend xQueueSend
  367. * \ingroup QueueManagement
  368. */
  369. #define xQueueSendToBack( xQueue, pvItemToQueue, xTicksToWait ) \
  370. xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )
  371. /**
  372. * queue. h
  373. * @code{c}
  374. * BaseType_t xQueueSend(
  375. * QueueHandle_t xQueue,
  376. * const void * pvItemToQueue,
  377. * TickType_t xTicksToWait
  378. * );
  379. * @endcode
  380. *
  381. * This is a macro that calls xQueueGenericSend(). It is included for
  382. * backward compatibility with versions of FreeRTOS.org that did not
  383. * include the xQueueSendToFront() and xQueueSendToBack() macros. It is
  384. * equivalent to xQueueSendToBack().
  385. *
  386. * Post an item on a queue. The item is queued by copy, not by reference.
  387. * This function must not be called from an interrupt service routine.
  388. * See xQueueSendFromISR () for an alternative which may be used in an ISR.
  389. *
  390. * @param xQueue The handle to the queue on which the item is to be posted.
  391. *
  392. * @param pvItemToQueue A pointer to the item that is to be placed on the
  393. * queue. The size of the items the queue will hold was defined when the
  394. * queue was created, so this many bytes will be copied from pvItemToQueue
  395. * into the queue storage area.
  396. *
  397. * @param xTicksToWait The maximum amount of time the task should block
  398. * waiting for space to become available on the queue, should it already
  399. * be full. The call will return immediately if this is set to 0 and the
  400. * queue is full. The time is defined in tick periods so the constant
  401. * portTICK_PERIOD_MS should be used to convert to real time if this is required.
  402. *
  403. * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
  404. *
  405. * Example usage:
  406. * @code{c}
  407. * struct AMessage
  408. * {
  409. * char ucMessageID;
  410. * char ucData[ 20 ];
  411. * } xMessage;
  412. *
  413. * uint32_t ulVar = 10UL;
  414. *
  415. * void vATask( void *pvParameters )
  416. * {
  417. * QueueHandle_t xQueue1, xQueue2;
  418. * struct AMessage *pxMessage;
  419. *
  420. * // Create a queue capable of containing 10 uint32_t values.
  421. * xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
  422. *
  423. * // Create a queue capable of containing 10 pointers to AMessage structures.
  424. * // These should be passed by pointer as they contain a lot of data.
  425. * xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
  426. *
  427. * // ...
  428. *
  429. * if( xQueue1 != 0 )
  430. * {
  431. * // Send an uint32_t. Wait for 10 ticks for space to become
  432. * // available if necessary.
  433. * if( xQueueSend( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10 ) != pdPASS )
  434. * {
  435. * // Failed to post the message, even after 10 ticks.
  436. * }
  437. * }
  438. *
  439. * if( xQueue2 != 0 )
  440. * {
  441. * // Send a pointer to a struct AMessage object. Don't block if the
  442. * // queue is already full.
  443. * pxMessage = & xMessage;
  444. * xQueueSend( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0 );
  445. * }
  446. *
  447. * // ... Rest of task code.
  448. * }
  449. * @endcode
  450. * \defgroup xQueueSend xQueueSend
  451. * \ingroup QueueManagement
  452. */
  453. #define xQueueSend( xQueue, pvItemToQueue, xTicksToWait ) \
  454. xQueueGenericSend( ( xQueue ), ( pvItemToQueue ), ( xTicksToWait ), queueSEND_TO_BACK )
  455. /**
  456. * queue. h
  457. * @code{c}
  458. * BaseType_t xQueueGenericSend(
  459. * QueueHandle_t xQueue,
  460. * const void * pvItemToQueue,
  461. * TickType_t xTicksToWait
  462. * BaseType_t xCopyPosition
  463. * );
  464. * @endcode
  465. *
  466. * It is preferred that the macros xQueueSend(), xQueueSendToFront() and
  467. * xQueueSendToBack() are used in place of calling this function directly.
  468. *
  469. * Post an item on a queue. The item is queued by copy, not by reference.
  470. * This function must not be called from an interrupt service routine.
  471. * See xQueueSendFromISR () for an alternative which may be used in an ISR.
  472. *
  473. * @param xQueue The handle to the queue on which the item is to be posted.
  474. *
  475. * @param pvItemToQueue A pointer to the item that is to be placed on the
  476. * queue. The size of the items the queue will hold was defined when the
  477. * queue was created, so this many bytes will be copied from pvItemToQueue
  478. * into the queue storage area.
  479. *
  480. * @param xTicksToWait The maximum amount of time the task should block
  481. * waiting for space to become available on the queue, should it already
  482. * be full. The call will return immediately if this is set to 0 and the
  483. * queue is full. The time is defined in tick periods so the constant
  484. * portTICK_PERIOD_MS should be used to convert to real time if this is required.
  485. *
  486. * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the
  487. * item at the back of the queue, or queueSEND_TO_FRONT to place the item
  488. * at the front of the queue (for high priority messages).
  489. *
  490. * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.
  491. *
  492. * Example usage:
  493. * @code{c}
  494. * struct AMessage
  495. * {
  496. * char ucMessageID;
  497. * char ucData[ 20 ];
  498. * } xMessage;
  499. *
  500. * uint32_t ulVar = 10UL;
  501. *
  502. * void vATask( void *pvParameters )
  503. * {
  504. * QueueHandle_t xQueue1, xQueue2;
  505. * struct AMessage *pxMessage;
  506. *
  507. * // Create a queue capable of containing 10 uint32_t values.
  508. * xQueue1 = xQueueCreate( 10, sizeof( uint32_t ) );
  509. *
  510. * // Create a queue capable of containing 10 pointers to AMessage structures.
  511. * // These should be passed by pointer as they contain a lot of data.
  512. * xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );
  513. *
  514. * // ...
  515. *
  516. * if( xQueue1 != 0 )
  517. * {
  518. * // Send an uint32_t. Wait for 10 ticks for space to become
  519. * // available if necessary.
  520. * if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( TickType_t ) 10, queueSEND_TO_BACK ) != pdPASS )
  521. * {
  522. * // Failed to post the message, even after 10 ticks.
  523. * }
  524. * }
  525. *
  526. * if( xQueue2 != 0 )
  527. * {
  528. * // Send a pointer to a struct AMessage object. Don't block if the
  529. * // queue is already full.
  530. * pxMessage = & xMessage;
  531. * xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( TickType_t ) 0, queueSEND_TO_BACK );
  532. * }
  533. *
  534. * // ... Rest of task code.
  535. * }
  536. * @endcode
  537. * \defgroup xQueueSend xQueueSend
  538. * \ingroup QueueManagement
  539. */
  540. BaseType_t xQueueGenericSend( QueueHandle_t xQueue,
  541. const void * const pvItemToQueue,
  542. TickType_t xTicksToWait,
  543. const BaseType_t xCopyPosition );
  544. /**
  545. * queue. h
  546. * @code{c}
  547. * BaseType_t xQueueReceive(
  548. * QueueHandle_t xQueue,
  549. * void *pvBuffer,
  550. * TickType_t xTicksToWait
  551. * );
  552. * @endcode
  553. *
  554. * Receive an item from a queue. The item is received by copy so a buffer of
  555. * adequate size must be provided. The number of bytes copied into the buffer
  556. * was defined when the queue was created.
  557. *
  558. * Successfully received items are removed from the queue.
  559. *
  560. * This function must not be used in an interrupt service routine. See
  561. * xQueueReceiveFromISR for an alternative that can.
  562. *
  563. * @param xQueue The handle to the queue from which the item is to be
  564. * received.
  565. *
  566. * @param pvBuffer Pointer to the buffer into which the received item will
  567. * be copied.
  568. *
  569. * @param xTicksToWait The maximum amount of time the task should block
  570. * waiting for an item to receive should the queue be empty at the time
  571. * of the call. xQueueReceive() will return immediately if xTicksToWait
  572. * is zero and the queue is empty. The time is defined in tick periods so the
  573. * constant portTICK_PERIOD_MS should be used to convert to real time if this is
  574. * required.
  575. *
  576. * @return pdTRUE if an item was successfully received from the queue,
  577. * otherwise pdFALSE.
  578. *
  579. * Example usage:
  580. * @code{c}
  581. * struct AMessage
  582. * {
  583. * char ucMessageID;
  584. * char ucData[ 20 ];
  585. * } xMessage;
  586. *
  587. * QueueHandle_t xQueue;
  588. *
  589. * // Task to create a queue and post a value.
  590. * void vATask( void *pvParameters )
  591. * {
  592. * struct AMessage *pxMessage;
  593. *
  594. * // Create a queue capable of containing 10 pointers to AMessage structures.
  595. * // These should be passed by pointer as they contain a lot of data.
  596. * xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );
  597. * if( xQueue == 0 )
  598. * {
  599. * // Failed to create the queue.
  600. * }
  601. *
  602. * // ...
  603. *
  604. * // Send a pointer to a struct AMessage object. Don't block if the
  605. * // queue is already full.
  606. * pxMessage = & xMessage;
  607. * xQueueSend( xQueue, ( void * ) &pxMessage, ( TickType_t ) 0 );
  608. *
  609. * // ... Rest of task code.
  610. * }
  611. *
  612. * // Task to receive from the queue.
  613. * void vADifferentTask( void *pvParameters )
  614. * {
  615. * struct AMessage *pxRxedMessage;
  616. *
  617. * if( xQueue != 0 )
  618. * {
  619. * // Receive a message on the created queue. Block for 10 ticks if a
  620. * // message is not immediately available.
  621. * if( xQueueReceive( xQueue, &( pxRxedMessage ), ( TickType_t ) 10 ) )
  622. * {
  623. * // pcRxedMessage now points to the struct AMessage variable posted
  624. * // by vATask.
  625. * }
  626. * }
  627. *
  628. * // ... Rest of task code.
  629. * }
  630. * @endcode
  631. * \defgroup xQueueReceive xQueueReceive
  632. * \ingroup QueueManagement
  633. */
  634. BaseType_t xQueueReceive( QueueHandle_t xQueue,
  635. void * const pvBuffer,
  636. TickType_t xTicksToWait );
  637. /**
  638. * queue. h
  639. * @code{c}
  640. * void vQueueDelete( QueueHandle_t xQueue );
  641. * @endcode
  642. *
  643. * Delete a queue - freeing all the memory allocated for storing of items
  644. * placed on the queue.
  645. *
  646. * @param xQueue A handle to the queue to be deleted.
  647. *
  648. * \defgroup vQueueDelete vQueueDelete
  649. * \ingroup QueueManagement
  650. */
  651. void vQueueDelete( QueueHandle_t xQueue );
  652. /**
  653. * queue. h
  654. * @code{c}
  655. * BaseType_t xQueueSendToFrontFromISR(
  656. * QueueHandle_t xQueue,
  657. * const void *pvItemToQueue,
  658. * BaseType_t *pxHigherPriorityTaskWoken
  659. * );
  660. * @endcode
  661. *
  662. * This is a macro that calls xQueueGenericSendFromISR().
  663. *
  664. * Post an item to the front of a queue. It is safe to use this macro from
  665. * within an interrupt service routine.
  666. *
  667. * Items are queued by copy not reference so it is preferable to only
  668. * queue small items, especially when called from an ISR. In most cases
  669. * it would be preferable to store a pointer to the item being queued.
  670. *
  671. * @param xQueue The handle to the queue on which the item is to be posted.
  672. *
  673. * @param pvItemToQueue A pointer to the item that is to be placed on the
  674. * queue. The size of the items the queue will hold was defined when the
  675. * queue was created, so this many bytes will be copied from pvItemToQueue
  676. * into the queue storage area.
  677. *
  678. * @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set
  679. * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
  680. * to unblock, and the unblocked task has a priority higher than the currently
  681. * running task. If xQueueSendToFromFromISR() sets this value to pdTRUE then
  682. * a context switch should be requested before the interrupt is exited.
  683. *
  684. * @return pdTRUE if the data was successfully sent to the queue, otherwise
  685. * errQUEUE_FULL.
  686. *
  687. * Example usage for buffered IO (where the ISR can obtain more than one value
  688. * per call):
  689. * @code{c}
  690. * void vBufferISR( void )
  691. * {
  692. * char cIn;
  693. * BaseType_t xHigherPrioritTaskWoken;
  694. *
  695. * // We have not woken a task at the start of the ISR.
  696. * xHigherPriorityTaskWoken = pdFALSE;
  697. *
  698. * // Loop until the buffer is empty.
  699. * do
  700. * {
  701. * // Obtain a byte from the buffer.
  702. * cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
  703. *
  704. * // Post the byte.
  705. * xQueueSendToFrontFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
  706. *
  707. * } while( portINPUT_BYTE( BUFFER_COUNT ) );
  708. *
  709. * // Now the buffer is empty we can switch context if necessary.
  710. * if( xHigherPriorityTaskWoken )
  711. * {
  712. * taskYIELD ();
  713. * }
  714. * }
  715. * @endcode
  716. *
  717. * \defgroup xQueueSendFromISR xQueueSendFromISR
  718. * \ingroup QueueManagement
  719. */
  720. #define xQueueSendToFrontFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \
  721. xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_FRONT )
  722. /**
  723. * queue. h
  724. * @code{c}
  725. * BaseType_t xQueueSendToBackFromISR(
  726. * QueueHandle_t xQueue,
  727. * const void *pvItemToQueue,
  728. * BaseType_t *pxHigherPriorityTaskWoken
  729. * );
  730. * @endcode
  731. *
  732. * This is a macro that calls xQueueGenericSendFromISR().
  733. *
  734. * Post an item to the back of a queue. It is safe to use this macro from
  735. * within an interrupt service routine.
  736. *
  737. * Items are queued by copy not reference so it is preferable to only
  738. * queue small items, especially when called from an ISR. In most cases
  739. * it would be preferable to store a pointer to the item being queued.
  740. *
  741. * @param xQueue The handle to the queue on which the item is to be posted.
  742. *
  743. * @param pvItemToQueue A pointer to the item that is to be placed on the
  744. * queue. The size of the items the queue will hold was defined when the
  745. * queue was created, so this many bytes will be copied from pvItemToQueue
  746. * into the queue storage area.
  747. *
  748. * @param pxHigherPriorityTaskWoken xQueueSendToBackFromISR() will set
  749. * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
  750. * to unblock, and the unblocked task has a priority higher than the currently
  751. * running task. If xQueueSendToBackFromISR() sets this value to pdTRUE then
  752. * a context switch should be requested before the interrupt is exited.
  753. *
  754. * @return pdTRUE if the data was successfully sent to the queue, otherwise
  755. * errQUEUE_FULL.
  756. *
  757. * Example usage for buffered IO (where the ISR can obtain more than one value
  758. * per call):
  759. * @code{c}
  760. * void vBufferISR( void )
  761. * {
  762. * char cIn;
  763. * BaseType_t xHigherPriorityTaskWoken;
  764. *
  765. * // We have not woken a task at the start of the ISR.
  766. * xHigherPriorityTaskWoken = pdFALSE;
  767. *
  768. * // Loop until the buffer is empty.
  769. * do
  770. * {
  771. * // Obtain a byte from the buffer.
  772. * cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
  773. *
  774. * // Post the byte.
  775. * xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
  776. *
  777. * } while( portINPUT_BYTE( BUFFER_COUNT ) );
  778. *
  779. * // Now the buffer is empty we can switch context if necessary.
  780. * if( xHigherPriorityTaskWoken )
  781. * {
  782. * taskYIELD ();
  783. * }
  784. * }
  785. * @endcode
  786. *
  787. * \defgroup xQueueSendFromISR xQueueSendFromISR
  788. * \ingroup QueueManagement
  789. */
  790. #define xQueueSendToBackFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \
  791. xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
  792. /**
  793. * queue. h
  794. * @code{c}
  795. * BaseType_t xQueueSendFromISR(
  796. * QueueHandle_t xQueue,
  797. * const void *pvItemToQueue,
  798. * BaseType_t *pxHigherPriorityTaskWoken
  799. * );
  800. * @endcode
  801. *
  802. * This is a macro that calls xQueueGenericSendFromISR(). It is included
  803. * for backward compatibility with versions of FreeRTOS.org that did not
  804. * include the xQueueSendToBackFromISR() and xQueueSendToFrontFromISR()
  805. * macros.
  806. *
  807. * Post an item to the back of a queue. It is safe to use this function from
  808. * within an interrupt service routine.
  809. *
  810. * Items are queued by copy not reference so it is preferable to only
  811. * queue small items, especially when called from an ISR. In most cases
  812. * it would be preferable to store a pointer to the item being queued.
  813. *
  814. * @param xQueue The handle to the queue on which the item is to be posted.
  815. *
  816. * @param pvItemToQueue A pointer to the item that is to be placed on the
  817. * queue. The size of the items the queue will hold was defined when the
  818. * queue was created, so this many bytes will be copied from pvItemToQueue
  819. * into the queue storage area.
  820. *
  821. * @param pxHigherPriorityTaskWoken xQueueSendFromISR() will set
  822. * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
  823. * to unblock, and the unblocked task has a priority higher than the currently
  824. * running task. If xQueueSendFromISR() sets this value to pdTRUE then
  825. * a context switch should be requested before the interrupt is exited.
  826. *
  827. * @return pdTRUE if the data was successfully sent to the queue, otherwise
  828. * errQUEUE_FULL.
  829. *
  830. * Example usage for buffered IO (where the ISR can obtain more than one value
  831. * per call):
  832. * @code{c}
  833. * void vBufferISR( void )
  834. * {
  835. * char cIn;
  836. * BaseType_t xHigherPriorityTaskWoken;
  837. *
  838. * // We have not woken a task at the start of the ISR.
  839. * xHigherPriorityTaskWoken = pdFALSE;
  840. *
  841. * // Loop until the buffer is empty.
  842. * do
  843. * {
  844. * // Obtain a byte from the buffer.
  845. * cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
  846. *
  847. * // Post the byte.
  848. * xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken );
  849. *
  850. * } while( portINPUT_BYTE( BUFFER_COUNT ) );
  851. *
  852. * // Now the buffer is empty we can switch context if necessary.
  853. * if( xHigherPriorityTaskWoken )
  854. * {
  855. * // Actual macro used here is port specific.
  856. * portYIELD_FROM_ISR ();
  857. * }
  858. * }
  859. * @endcode
  860. *
  861. * \defgroup xQueueSendFromISR xQueueSendFromISR
  862. * \ingroup QueueManagement
  863. */
  864. #define xQueueSendFromISR( xQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) \
  865. xQueueGenericSendFromISR( ( xQueue ), ( pvItemToQueue ), ( pxHigherPriorityTaskWoken ), queueSEND_TO_BACK )
  866. /**
  867. * queue. h
  868. * @code{c}
  869. * BaseType_t xQueueGenericSendFromISR(
  870. * QueueHandle_t xQueue,
  871. * const void *pvItemToQueue,
  872. * BaseType_t *pxHigherPriorityTaskWoken,
  873. * BaseType_t xCopyPosition
  874. * );
  875. * @endcode
  876. *
  877. * It is preferred that the macros xQueueSendFromISR(),
  878. * xQueueSendToFrontFromISR() and xQueueSendToBackFromISR() be used in place
  879. * of calling this function directly. xQueueGiveFromISR() is an
  880. * equivalent for use by semaphores that don't actually copy any data.
  881. *
  882. * Post an item on a queue. It is safe to use this function from within an
  883. * interrupt service routine.
  884. *
  885. * Items are queued by copy not reference so it is preferable to only
  886. * queue small items, especially when called from an ISR. In most cases
  887. * it would be preferable to store a pointer to the item being queued.
  888. *
  889. * @param xQueue The handle to the queue on which the item is to be posted.
  890. *
  891. * @param pvItemToQueue A pointer to the item that is to be placed on the
  892. * queue. The size of the items the queue will hold was defined when the
  893. * queue was created, so this many bytes will be copied from pvItemToQueue
  894. * into the queue storage area.
  895. *
  896. * @param pxHigherPriorityTaskWoken xQueueGenericSendFromISR() will set
  897. * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task
  898. * to unblock, and the unblocked task has a priority higher than the currently
  899. * running task. If xQueueGenericSendFromISR() sets this value to pdTRUE then
  900. * a context switch should be requested before the interrupt is exited.
  901. *
  902. * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the
  903. * item at the back of the queue, or queueSEND_TO_FRONT to place the item
  904. * at the front of the queue (for high priority messages).
  905. *
  906. * @return pdTRUE if the data was successfully sent to the queue, otherwise
  907. * errQUEUE_FULL.
  908. *
  909. * Example usage for buffered IO (where the ISR can obtain more than one value
  910. * per call):
  911. * @code{c}
  912. * void vBufferISR( void )
  913. * {
  914. * char cIn;
  915. * BaseType_t xHigherPriorityTaskWokenByPost;
  916. *
  917. * // We have not woken a task at the start of the ISR.
  918. * xHigherPriorityTaskWokenByPost = pdFALSE;
  919. *
  920. * // Loop until the buffer is empty.
  921. * do
  922. * {
  923. * // Obtain a byte from the buffer.
  924. * cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );
  925. *
  926. * // Post each byte.
  927. * xQueueGenericSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWokenByPost, queueSEND_TO_BACK );
  928. *
  929. * } while( portINPUT_BYTE( BUFFER_COUNT ) );
  930. *
  931. * // Now the buffer is empty we can switch context if necessary. Note that the
  932. * // name of the yield function required is port specific.
  933. * if( xHigherPriorityTaskWokenByPost )
  934. * {
  935. * portYIELD_FROM_ISR();
  936. * }
  937. * }
  938. * @endcode
  939. *
  940. * \defgroup xQueueSendFromISR xQueueSendFromISR
  941. * \ingroup QueueManagement
  942. */
  943. BaseType_t xQueueGenericSendFromISR( QueueHandle_t xQueue,
  944. const void * const pvItemToQueue,
  945. BaseType_t * const pxHigherPriorityTaskWoken,
  946. const BaseType_t xCopyPosition );
  947. BaseType_t xQueueGiveFromISR( QueueHandle_t xQueue,
  948. BaseType_t * const pxHigherPriorityTaskWoken );
  949. /**
  950. * queue. h
  951. * @code{c}
  952. * BaseType_t xQueueReceiveFromISR(
  953. * QueueHandle_t xQueue,
  954. * void *pvBuffer,
  955. * BaseType_t *pxTaskWoken
  956. * );
  957. * @endcode
  958. *
  959. * Receive an item from a queue. It is safe to use this function from within an
  960. * interrupt service routine.
  961. *
  962. * @param xQueue The handle to the queue from which the item is to be
  963. * received.
  964. *
  965. * @param pvBuffer Pointer to the buffer into which the received item will
  966. * be copied.
  967. *
  968. * @param pxTaskWoken A task may be blocked waiting for space to become
  969. * available on the queue. If xQueueReceiveFromISR causes such a task to
  970. * unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will
  971. * remain unchanged.
  972. *
  973. * @return pdTRUE if an item was successfully received from the queue,
  974. * otherwise pdFALSE.
  975. *
  976. * Example usage:
  977. * @code{c}
  978. *
  979. * QueueHandle_t xQueue;
  980. *
  981. * // Function to create a queue and post some values.
  982. * void vAFunction( void *pvParameters )
  983. * {
  984. * char cValueToPost;
  985. * const TickType_t xTicksToWait = ( TickType_t )0xff;
  986. *
  987. * // Create a queue capable of containing 10 characters.
  988. * xQueue = xQueueCreate( 10, sizeof( char ) );
  989. * if( xQueue == 0 )
  990. * {
  991. * // Failed to create the queue.
  992. * }
  993. *
  994. * // ...
  995. *
  996. * // Post some characters that will be used within an ISR. If the queue
  997. * // is full then this task will block for xTicksToWait ticks.
  998. * cValueToPost = 'a';
  999. * xQueueSend( xQueue, ( void * ) &cValueToPost, xTicksToWait );
  1000. * cValueToPost = 'b';
  1001. * xQueueSend( xQueue, ( void * ) &cValueToPost, xTicksToWait );
  1002. *
  1003. * // ... keep posting characters ... this task may block when the queue
  1004. * // becomes full.
  1005. *
  1006. * cValueToPost = 'c';
  1007. * xQueueSend( xQueue, ( void * ) &cValueToPost, xTicksToWait );
  1008. * }
  1009. *
  1010. * // ISR that outputs all the characters received on the queue.
  1011. * void vISR_Routine( void )
  1012. * {
  1013. * BaseType_t xTaskWokenByReceive = pdFALSE;
  1014. * char cRxedChar;
  1015. *
  1016. * while( xQueueReceiveFromISR( xQueue, ( void * ) &cRxedChar, &xTaskWokenByReceive) )
  1017. * {
  1018. * // A character was received. Output the character now.
  1019. * vOutputCharacter( cRxedChar );
  1020. *
  1021. * // If removing the character from the queue woke the task that was
  1022. * // posting onto the queue cTaskWokenByReceive will have been set to
  1023. * // pdTRUE. No matter how many times this loop iterates only one
  1024. * // task will be woken.
  1025. * }
  1026. *
  1027. * if( cTaskWokenByPost != ( char ) pdFALSE;
  1028. * {
  1029. * taskYIELD ();
  1030. * }
  1031. * }
  1032. * @endcode
  1033. * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR
  1034. * \ingroup QueueManagement
  1035. */
  1036. BaseType_t xQueueReceiveFromISR( QueueHandle_t xQueue,
  1037. void * const pvBuffer,
  1038. BaseType_t * const pxHigherPriorityTaskWoken );
  1039. /*
  1040. * For internal use only. Use xSemaphoreCreateMutex(),
  1041. * xSemaphoreCreateCounting() or xSemaphoreGetMutexHolder() instead of calling
  1042. * these functions directly.
  1043. */
  1044. QueueHandle_t xQueueCreateMutex( const uint8_t ucQueueType );
  1045. QueueHandle_t xQueueCreateMutexStatic( const uint8_t ucQueueType,
  1046. StaticQueue_t * pxStaticQueue );
  1047. QueueHandle_t xQueueCreateCountingSemaphore( const UBaseType_t uxMaxCount,
  1048. const UBaseType_t uxInitialCount );
  1049. QueueHandle_t xQueueCreateCountingSemaphoreStatic( const UBaseType_t uxMaxCount,
  1050. const UBaseType_t uxInitialCount,
  1051. StaticQueue_t * pxStaticQueue );
  1052. BaseType_t xQueueSemaphoreTake( QueueHandle_t xQueue,
  1053. TickType_t xTicksToWait );
  1054. /*
  1055. * For internal use only. Use xSemaphoreTakeMutexRecursive() or
  1056. * xSemaphoreGiveMutexRecursive() instead of calling these functions directly.
  1057. */
  1058. BaseType_t xQueueTakeMutexRecursive( QueueHandle_t xMutex,
  1059. TickType_t xTicksToWait );
  1060. BaseType_t xQueueGiveMutexRecursive( QueueHandle_t xMutex );
  1061. /*
  1062. * Reset a queue back to its original empty state. The return value is now
  1063. * obsolete and is always set to pdPASS.
  1064. */
  1065. #define xQueueReset( xQueue ) xQueueGenericReset( xQueue, pdFALSE )
  1066. /*
  1067. * Generic version of the function used to create a queue using dynamic memory
  1068. * allocation. This is called by other functions and macros that create other
  1069. * RTOS objects that use the queue structure as their base.
  1070. */
  1071. #if ( configSUPPORT_DYNAMIC_ALLOCATION == 1 )
  1072. QueueHandle_t xQueueGenericCreate( const UBaseType_t uxQueueLength,
  1073. const UBaseType_t uxItemSize,
  1074. const uint8_t ucQueueType );
  1075. #endif
  1076. /*
  1077. * Generic version of the function used to create a queue using dynamic memory
  1078. * allocation. This is called by other functions and macros that create other
  1079. * RTOS objects that use the queue structure as their base.
  1080. */
  1081. #if ( configSUPPORT_STATIC_ALLOCATION == 1 )
  1082. QueueHandle_t xQueueGenericCreateStatic( const UBaseType_t uxQueueLength,
  1083. const UBaseType_t uxItemSize,
  1084. uint8_t * pucQueueStorage,
  1085. StaticQueue_t * pxStaticQueue,
  1086. const uint8_t ucQueueType );
  1087. #endif
  1088. /* Not public API functions. */
  1089. BaseType_t xQueueGenericReset( QueueHandle_t xQueue,
  1090. BaseType_t xNewQueue );
  1091. /* *INDENT-OFF* */
  1092. #ifdef __cplusplus
  1093. }
  1094. #endif
  1095. /* *INDENT-ON* */
  1096. #endif /* QUEUE_H */