]> git.sur5r.net Git - freertos/blob - Source/include/queue.h
Update to V4.6.1 - including PIC32MX port.
[freertos] / Source / include / queue.h
1 /*\r
2         FreeRTOS.org V4.6.1 - Copyright (C) 2003-2007 Richard Barry.\r
3 \r
4         This file is part of the FreeRTOS.org distribution.\r
5 \r
6         FreeRTOS.org is free software; you can redistribute it and/or modify\r
7         it under the terms of the GNU General Public License as published by\r
8         the Free Software Foundation; either version 2 of the License, or\r
9         (at your option) any later version.\r
10 \r
11         FreeRTOS.org is distributed in the hope that it will be useful,\r
12         but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14         GNU General Public License for more details.\r
15 \r
16         You should have received a copy of the GNU General Public License\r
17         along with FreeRTOS.org; if not, write to the Free Software\r
18         Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19 \r
20         A special exception to the GPL can be applied should you wish to distribute\r
21         a combined work that includes FreeRTOS.org, without being obliged to provide\r
22         the source code for any proprietary components.  See the licensing section\r
23         of http://www.FreeRTOS.org for full details of how and when the exception\r
24         can be applied.\r
25 \r
26         ***************************************************************************\r
27         See http://www.FreeRTOS.org for documentation, latest information, license\r
28         and contact details.  Please ensure to read the configuration and relevant\r
29         port sections of the online documentation.\r
30 \r
31         Also see http://www.SafeRTOS.com a version that has been certified for use\r
32         in safety critical systems, plus commercial licensing, development and\r
33         support options.\r
34         ***************************************************************************\r
35 */\r
36 \r
37 #ifndef QUEUE_H\r
38 #define QUEUE_H\r
39 \r
40 #ifdef __cplusplus\r
41 extern "C" {\r
42 #endif\r
43 typedef void * xQueueHandle;\r
44 \r
45 /* For internal use only. */\r
46 #define queueSEND_TO_BACK       ( 0 )\r
47 #define queueSEND_TO_FRONT      ( 1 )\r
48 \r
49 \r
50 /**\r
51  * queue. h\r
52  * <pre>\r
53  xQueueHandle xQueueCreate(\r
54                               unsigned portBASE_TYPE uxQueueLength,\r
55                               unsigned portBASE_TYPE uxItemSize\r
56                           );\r
57  * </pre>\r
58  *\r
59  * Creates a new queue instance.  This allocates the storage required by the\r
60  * new queue and returns a handle for the queue.\r
61  *\r
62  * @param uxQueueLength The maximum number of items that the queue can contain.\r
63  *\r
64  * @param uxItemSize The number of bytes each item in the queue will require.\r
65  * Items are queued by copy, not by reference, so this is the number of bytes\r
66  * that will be copied for each posted item.  Each item on the queue must be\r
67  * the same size.\r
68  *\r
69  * @return If the queue is successfully create then a handle to the newly\r
70  * created queue is returned.  If the queue cannot be created then 0 is\r
71  * returned.\r
72  *\r
73  * Example usage:\r
74    <pre>\r
75  struct AMessage\r
76  {\r
77     portCHAR ucMessageID;\r
78     portCHAR ucData[ 20 ];\r
79  };\r
80 \r
81  void vATask( void *pvParameters )\r
82  {\r
83  xQueueHandle xQueue1, xQueue2;\r
84 \r
85     // Create a queue capable of containing 10 unsigned long values.\r
86     xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );\r
87     if( xQueue1 == 0 )\r
88     {\r
89         // Queue was not created and must not be used.\r
90     }\r
91 \r
92     // Create a queue capable of containing 10 pointers to AMessage structures.\r
93     // These should be passed by pointer as they contain a lot of data.\r
94     xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
95     if( xQueue2 == 0 )\r
96     {\r
97         // Queue was not created and must not be used.\r
98     }\r
99 \r
100     // ... Rest of task code.\r
101  }\r
102  </pre>\r
103  * \defgroup xQueueCreate xQueueCreate\r
104  * \ingroup QueueManagement\r
105  */\r
106 xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize );\r
107 \r
108 /**\r
109  * queue. h\r
110  * <pre>\r
111  portBASE_TYPE xQueueSendToToFront(\r
112                                    xQueueHandle xQueue,\r
113                                    const void * pvItemToQueue,\r
114                                    portTickType xTicksToWait\r
115                                );\r
116  * </pre>\r
117  *\r
118  * This is a macro that calls xQueueGenericSend().\r
119  *\r
120  * Post an item to the front of a queue.  The item is queued by copy, not by\r
121  * reference.  This function must not be called from an interrupt service\r
122  * routine.  See xQueueSendFromISR () for an alternative which may be used\r
123  * in an ISR.\r
124  *\r
125  * @param xQueue The handle to the queue on which the item is to be posted.\r
126  *\r
127  * @param pvItemToQueue A pointer to the item that is to be placed on the\r
128  * queue.  The size of the items the queue will hold was defined when the\r
129  * queue was created, so this many bytes will be copied from pvItemToQueue\r
130  * into the queue storage area.\r
131  *\r
132  * @param xTicksToWait The maximum amount of time the task should block\r
133  * waiting for space to become available on the queue, should it already\r
134  * be full.  The call will return immediately if this is set to 0.  The\r
135  * time is defined in tick periods so the constant portTICK_RATE_MS\r
136  * should be used to convert to real time if this is required.\r
137  *\r
138  * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.\r
139  *\r
140  * Example usage:\r
141    <pre>\r
142  struct AMessage\r
143  {\r
144     portCHAR ucMessageID;\r
145     portCHAR ucData[ 20 ];\r
146  } xMessage;\r
147 \r
148  unsigned portLONG ulVar = 10UL;\r
149 \r
150  void vATask( void *pvParameters )\r
151  {\r
152  xQueueHandle xQueue1, xQueue2;\r
153  struct AMessage *pxMessage;\r
154 \r
155     // Create a queue capable of containing 10 unsigned long values.\r
156     xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );\r
157 \r
158     // Create a queue capable of containing 10 pointers to AMessage structures.\r
159     // These should be passed by pointer as they contain a lot of data.\r
160     xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
161 \r
162     // ...\r
163 \r
164     if( xQueue1 != 0 )\r
165     {\r
166         // Send an unsigned long.  Wait for 10 ticks for space to become\r
167         // available if necessary.\r
168         if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )\r
169         {\r
170             // Failed to post the message, even after 10 ticks.\r
171         }\r
172     }\r
173 \r
174     if( xQueue2 != 0 )\r
175     {\r
176         // Send a pointer to a struct AMessage object.  Don't block if the\r
177         // queue is already full.\r
178         pxMessage = & xMessage;\r
179         xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );\r
180     }\r
181 \r
182         // ... Rest of task code.\r
183  }\r
184  </pre>\r
185  * \defgroup xQueueSend xQueueSend\r
186  * \ingroup QueueManagement\r
187  */\r
188 #define xQueueSendToFront( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, queueSEND_TO_FRONT )\r
189 \r
190 /**\r
191  * queue. h\r
192  * <pre>\r
193  portBASE_TYPE xQueueSendToBack(\r
194                                    xQueueHandle xQueue,\r
195                                    const void * pvItemToQueue,\r
196                                    portTickType xTicksToWait\r
197                                );\r
198  * </pre>\r
199  *\r
200  * This is a macro that calls xQueueGenericSend().\r
201  *\r
202  * Post an item to the back of a queue.  The item is queued by copy, not by\r
203  * reference.  This function must not be called from an interrupt service\r
204  * routine.  See xQueueSendFromISR () for an alternative which may be used\r
205  * in an ISR.\r
206  *\r
207  * @param xQueue The handle to the queue on which the item is to be posted.\r
208  *\r
209  * @param pvItemToQueue A pointer to the item that is to be placed on the\r
210  * queue.  The size of the items the queue will hold was defined when the\r
211  * queue was created, so this many bytes will be copied from pvItemToQueue\r
212  * into the queue storage area.\r
213  *\r
214  * @param xTicksToWait The maximum amount of time the task should block\r
215  * waiting for space to become available on the queue, should it already\r
216  * be full.  The call will return immediately if this is set to 0.  The\r
217  * time is defined in tick periods so the constant portTICK_RATE_MS\r
218  * should be used to convert to real time if this is required.\r
219  *\r
220  * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.\r
221  *\r
222  * Example usage:\r
223    <pre>\r
224  struct AMessage\r
225  {\r
226     portCHAR ucMessageID;\r
227     portCHAR ucData[ 20 ];\r
228  } xMessage;\r
229 \r
230  unsigned portLONG ulVar = 10UL;\r
231 \r
232  void vATask( void *pvParameters )\r
233  {\r
234  xQueueHandle xQueue1, xQueue2;\r
235  struct AMessage *pxMessage;\r
236 \r
237     // Create a queue capable of containing 10 unsigned long values.\r
238     xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );\r
239 \r
240     // Create a queue capable of containing 10 pointers to AMessage structures.\r
241     // These should be passed by pointer as they contain a lot of data.\r
242     xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
243 \r
244     // ...\r
245 \r
246     if( xQueue1 != 0 )\r
247     {\r
248         // Send an unsigned long.  Wait for 10 ticks for space to become\r
249         // available if necessary.\r
250         if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )\r
251         {\r
252             // Failed to post the message, even after 10 ticks.\r
253         }\r
254     }\r
255 \r
256     if( xQueue2 != 0 )\r
257     {\r
258         // Send a pointer to a struct AMessage object.  Don't block if the\r
259         // queue is already full.\r
260         pxMessage = & xMessage;\r
261         xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );\r
262     }\r
263 \r
264         // ... Rest of task code.\r
265  }\r
266  </pre>\r
267  * \defgroup xQueueSend xQueueSend\r
268  * \ingroup QueueManagement\r
269  */\r
270 #define xQueueSendToBack( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, queueSEND_TO_BACK )\r
271 \r
272 /**\r
273  * queue. h\r
274  * <pre>\r
275  portBASE_TYPE xQueueSend(\r
276                               xQueueHandle xQueue,\r
277                               const void * pvItemToQueue,\r
278                               portTickType xTicksToWait\r
279                          );\r
280  * </pre>\r
281  *\r
282  * This is a macro that calls xQueueGenericSend().  It is included for\r
283  * backward compatibility with versions of FreeRTOS.org that did not\r
284  * include the xQueueSendToFront() and xQueueSendToBack() macros.  It is\r
285  * equivalent to xQueueSendToBack().\r
286  *\r
287  * Post an item on a queue.  The item is queued by copy, not by reference.\r
288  * This function must not be called from an interrupt service routine.\r
289  * See xQueueSendFromISR () for an alternative which may be used in an ISR.\r
290  *\r
291  * @param xQueue The handle to the queue on which the item is to be posted.\r
292  *\r
293  * @param pvItemToQueue A pointer to the item that is to be placed on the\r
294  * queue.  The size of the items the queue will hold was defined when the\r
295  * queue was created, so this many bytes will be copied from pvItemToQueue\r
296  * into the queue storage area.\r
297  *\r
298  * @param xTicksToWait The maximum amount of time the task should block\r
299  * waiting for space to become available on the queue, should it already\r
300  * be full.  The call will return immediately if this is set to 0.  The\r
301  * time is defined in tick periods so the constant portTICK_RATE_MS\r
302  * should be used to convert to real time if this is required.\r
303  *\r
304  * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.\r
305  *\r
306  * Example usage:\r
307    <pre>\r
308  struct AMessage\r
309  {\r
310     portCHAR ucMessageID;\r
311     portCHAR ucData[ 20 ];\r
312  } xMessage;\r
313 \r
314  unsigned portLONG ulVar = 10UL;\r
315 \r
316  void vATask( void *pvParameters )\r
317  {\r
318  xQueueHandle xQueue1, xQueue2;\r
319  struct AMessage *pxMessage;\r
320 \r
321     // Create a queue capable of containing 10 unsigned long values.\r
322     xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );\r
323 \r
324     // Create a queue capable of containing 10 pointers to AMessage structures.\r
325     // These should be passed by pointer as they contain a lot of data.\r
326     xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
327 \r
328     // ...\r
329 \r
330     if( xQueue1 != 0 )\r
331     {\r
332         // Send an unsigned long.  Wait for 10 ticks for space to become\r
333         // available if necessary.\r
334         if( xQueueSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS )\r
335         {\r
336             // Failed to post the message, even after 10 ticks.\r
337         }\r
338     }\r
339 \r
340     if( xQueue2 != 0 )\r
341     {\r
342         // Send a pointer to a struct AMessage object.  Don't block if the\r
343         // queue is already full.\r
344         pxMessage = & xMessage;\r
345         xQueueSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 );\r
346     }\r
347 \r
348         // ... Rest of task code.\r
349  }\r
350  </pre>\r
351  * \defgroup xQueueSend xQueueSend\r
352  * \ingroup QueueManagement\r
353  */\r
354 #define xQueueSend( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, queueSEND_TO_BACK )\r
355 \r
356 \r
357 /**\r
358  * queue. h\r
359  * <pre>\r
360  portBASE_TYPE xQueueGenericSend(\r
361                                                                         xQueueHandle xQueue,\r
362                                                                         const void * pvItemToQueue,\r
363                                                                         portTickType xTicksToWait\r
364                                                                         portBASE_TYPE xCopyPosition\r
365                                                                 );\r
366  * </pre>\r
367  *\r
368  * It is preferred that the macros xQueueSend(), xQueueSendToFront() and\r
369  * xQueueSendToBack() are used in place of calling this function directly.\r
370  *\r
371  * Post an item on a queue.  The item is queued by copy, not by reference.\r
372  * This function must not be called from an interrupt service routine.\r
373  * See xQueueSendFromISR () for an alternative which may be used in an ISR.\r
374  *\r
375  * @param xQueue The handle to the queue on which the item is to be posted.\r
376  *\r
377  * @param pvItemToQueue A pointer to the item that is to be placed on the\r
378  * queue.  The size of the items the queue will hold was defined when the\r
379  * queue was created, so this many bytes will be copied from pvItemToQueue\r
380  * into the queue storage area.\r
381  *\r
382  * @param xTicksToWait The maximum amount of time the task should block\r
383  * waiting for space to become available on the queue, should it already\r
384  * be full.  The call will return immediately if this is set to 0.  The\r
385  * time is defined in tick periods so the constant portTICK_RATE_MS\r
386  * should be used to convert to real time if this is required.\r
387  *\r
388  * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the\r
389  * item at the back of the queue, or queueSEND_TO_FRONT to place the item\r
390  * at the front of the queue (for high priority messages).\r
391  *\r
392  * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL.\r
393  *\r
394  * Example usage:\r
395    <pre>\r
396  struct AMessage\r
397  {\r
398     portCHAR ucMessageID;\r
399     portCHAR ucData[ 20 ];\r
400  } xMessage;\r
401 \r
402  unsigned portLONG ulVar = 10UL;\r
403 \r
404  void vATask( void *pvParameters )\r
405  {\r
406  xQueueHandle xQueue1, xQueue2;\r
407  struct AMessage *pxMessage;\r
408 \r
409     // Create a queue capable of containing 10 unsigned long values.\r
410     xQueue1 = xQueueCreate( 10, sizeof( unsigned portLONG ) );\r
411 \r
412     // Create a queue capable of containing 10 pointers to AMessage structures.\r
413     // These should be passed by pointer as they contain a lot of data.\r
414     xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
415 \r
416     // ...\r
417 \r
418     if( xQueue1 != 0 )\r
419     {\r
420         // Send an unsigned long.  Wait for 10 ticks for space to become\r
421         // available if necessary.\r
422         if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10, queueSEND_TO_BACK ) != pdPASS )\r
423         {\r
424             // Failed to post the message, even after 10 ticks.\r
425         }\r
426     }\r
427 \r
428     if( xQueue2 != 0 )\r
429     {\r
430         // Send a pointer to a struct AMessage object.  Don't block if the\r
431         // queue is already full.\r
432         pxMessage = & xMessage;\r
433         xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0, queueSEND_TO_BACK );\r
434     }\r
435 \r
436         // ... Rest of task code.\r
437  }\r
438  </pre>\r
439  * \defgroup xQueueSend xQueueSend\r
440  * \ingroup QueueManagement\r
441  */\r
442 signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition );\r
443 \r
444 /**\r
445  * queue. h\r
446  * <pre>\r
447  portBASE_TYPE xQueuePeek(\r
448                              xQueueHandle xQueue,\r
449                              void *pvBuffer,\r
450                              portTickType xTicksToWait\r
451                          );</pre>\r
452  *\r
453  * This is a macro that calls the xQueueGenericReceive() function.\r
454  *\r
455  * Receive an item from a queue without removing the item from the queue.\r
456  * The item is received by copy so a buffer of adequate size must be\r
457  * provided.  The number of bytes copied into the buffer was defined when\r
458  * the queue was created.\r
459  *\r
460  * Successfully received items remain on the queue so will be returned again\r
461  * by the next call, or a call to xQueueReceive().\r
462  *\r
463  * This macro must not be used in an interrupt service routine.\r
464  *\r
465  * @param pxQueue The handle to the queue from which the item is to be\r
466  * received.\r
467  *\r
468  * @param pvBuffer Pointer to the buffer into which the received item will\r
469  * be copied.\r
470  *\r
471  * @param xTicksToWait The maximum amount of time the task should block\r
472  * waiting for an item to receive should the queue be empty at the time\r
473  * of the call.    The time is defined in tick periods so the constant\r
474  * portTICK_RATE_MS should be used to convert to real time if this is required.\r
475  *\r
476  * @return pdTRUE if an item was successfully received from the queue,\r
477  * otherwise pdFALSE.\r
478  *\r
479  * Example usage:\r
480    <pre>\r
481  struct AMessage\r
482  {\r
483     portCHAR ucMessageID;\r
484     portCHAR ucData[ 20 ];\r
485  } xMessage;\r
486 \r
487  xQueueHandle xQueue;\r
488 \r
489  // Task to create a queue and post a value.\r
490  void vATask( void *pvParameters )\r
491  {\r
492  struct AMessage *pxMessage;\r
493 \r
494     // Create a queue capable of containing 10 pointers to AMessage structures.\r
495     // These should be passed by pointer as they contain a lot of data.\r
496     xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
497     if( xQueue == 0 )\r
498     {\r
499         // Failed to create the queue.\r
500     }\r
501 \r
502     // ...\r
503 \r
504     // Send a pointer to a struct AMessage object.  Don't block if the\r
505     // queue is already full.\r
506     pxMessage = & xMessage;\r
507     xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );\r
508 \r
509         // ... Rest of task code.\r
510  }\r
511 \r
512  // Task to peek the data from the queue.\r
513  void vADifferentTask( void *pvParameters )\r
514  {\r
515  struct AMessage *pxRxedMessage;\r
516 \r
517     if( xQueue != 0 )\r
518     {\r
519         // Peek a message on the created queue.  Block for 10 ticks if a\r
520         // message is not immediately available.\r
521         if( xQueuePeek( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )\r
522         {\r
523             // pcRxedMessage now points to the struct AMessage variable posted\r
524             // by vATask, but the item still remains on the queue.\r
525         }\r
526     }\r
527 \r
528         // ... Rest of task code.\r
529  }\r
530  </pre>\r
531  * \defgroup xQueueReceive xQueueReceive\r
532  * \ingroup QueueManagement\r
533  */\r
534 #define xQueuePeek( xQueue, pvBuffer, xTicksToWait ) xQueueGenericReceive( xQueue, pvBuffer, xTicksToWait, pdTRUE )\r
535 \r
536 /**\r
537  * queue. h\r
538  * <pre>\r
539  portBASE_TYPE xQueueReceive(\r
540                                  xQueueHandle xQueue,\r
541                                  void *pvBuffer,\r
542                                  portTickType xTicksToWait\r
543                             );</pre>\r
544  *\r
545  * This is a macro that calls the xQueueGenericReceive() function.\r
546  *\r
547  * Receive an item from a queue.  The item is received by copy so a buffer of\r
548  * adequate size must be provided.  The number of bytes copied into the buffer\r
549  * was defined when the queue was created.\r
550  *\r
551  * Successfully received items are removed from the queue.\r
552  *\r
553  * This function must not be used in an interrupt service routine.  See\r
554  * xQueueReceiveFromISR for an alternative that can.\r
555  *\r
556  * @param pxQueue The handle to the queue from which the item is to be\r
557  * received.\r
558  *\r
559  * @param pvBuffer Pointer to the buffer into which the received item will\r
560  * be copied.\r
561  *\r
562  * @param xTicksToWait The maximum amount of time the task should block\r
563  * waiting for an item to receive should the queue be empty at the time\r
564  * of the call.    The time is defined in tick periods so the constant\r
565  * portTICK_RATE_MS should be used to convert to real time if this is required.\r
566  *\r
567  * @return pdTRUE if an item was successfully received from the queue,\r
568  * otherwise pdFALSE.\r
569  *\r
570  * Example usage:\r
571    <pre>\r
572  struct AMessage\r
573  {\r
574     portCHAR ucMessageID;\r
575     portCHAR ucData[ 20 ];\r
576  } xMessage;\r
577 \r
578  xQueueHandle xQueue;\r
579 \r
580  // Task to create a queue and post a value.\r
581  void vATask( void *pvParameters )\r
582  {\r
583  struct AMessage *pxMessage;\r
584 \r
585     // Create a queue capable of containing 10 pointers to AMessage structures.\r
586     // These should be passed by pointer as they contain a lot of data.\r
587     xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
588     if( xQueue == 0 )\r
589     {\r
590         // Failed to create the queue.\r
591     }\r
592 \r
593     // ...\r
594 \r
595     // Send a pointer to a struct AMessage object.  Don't block if the\r
596     // queue is already full.\r
597     pxMessage = & xMessage;\r
598     xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );\r
599 \r
600         // ... Rest of task code.\r
601  }\r
602 \r
603  // Task to receive from the queue.\r
604  void vADifferentTask( void *pvParameters )\r
605  {\r
606  struct AMessage *pxRxedMessage;\r
607 \r
608     if( xQueue != 0 )\r
609     {\r
610         // Receive a message on the created queue.  Block for 10 ticks if a\r
611         // message is not immediately available.\r
612         if( xQueueReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )\r
613         {\r
614             // pcRxedMessage now points to the struct AMessage variable posted\r
615             // by vATask.\r
616         }\r
617     }\r
618 \r
619         // ... Rest of task code.\r
620  }\r
621  </pre>\r
622  * \defgroup xQueueReceive xQueueReceive\r
623  * \ingroup QueueManagement\r
624  */\r
625 #define xQueueReceive( xQueue, pvBuffer, xTicksToWait ) xQueueGenericReceive( xQueue, pvBuffer, xTicksToWait, pdFALSE )\r
626 \r
627 \r
628 /**\r
629  * queue. h\r
630  * <pre>\r
631  portBASE_TYPE xQueueGenericReceive(\r
632                                        xQueueHandle xQueue,\r
633                                        void *pvBuffer,\r
634                                        portTickType xTicksToWait\r
635                                        portBASE_TYPE xJustPeek\r
636                                     );</pre>\r
637  *\r
638  * It is preferred that the macro xQueueReceive() be used rather than calling\r
639  * this function directly.\r
640  *\r
641  * Receive an item from a queue.  The item is received by copy so a buffer of\r
642  * adequate size must be provided.  The number of bytes copied into the buffer\r
643  * was defined when the queue was created.\r
644  *\r
645  * This function must not be used in an interrupt service routine.  See\r
646  * xQueueReceiveFromISR for an alternative that can.\r
647  *\r
648  * @param pxQueue The handle to the queue from which the item is to be\r
649  * received.\r
650  *\r
651  * @param pvBuffer Pointer to the buffer into which the received item will\r
652  * be copied.\r
653  *\r
654  * @param xTicksToWait The maximum amount of time the task should block\r
655  * waiting for an item to receive should the queue be empty at the time\r
656  * of the call.    The time is defined in tick periods so the constant\r
657  * portTICK_RATE_MS should be used to convert to real time if this is required.\r
658  *\r
659  * @param xJustPeek When set to true, the item received from the queue is not\r
660  * actually removed from the queue - meaning a subsequent call to\r
661  * xQueueReceive() will return the same item.  When set to false, the item\r
662  * being received from the queue is also removed from the queue.\r
663  *\r
664  * @return pdTRUE if an item was successfully received from the queue,\r
665  * otherwise pdFALSE.\r
666  *\r
667  * Example usage:\r
668    <pre>\r
669  struct AMessage\r
670  {\r
671     portCHAR ucMessageID;\r
672     portCHAR ucData[ 20 ];\r
673  } xMessage;\r
674 \r
675  xQueueHandle xQueue;\r
676 \r
677  // Task to create a queue and post a value.\r
678  void vATask( void *pvParameters )\r
679  {\r
680  struct AMessage *pxMessage;\r
681 \r
682     // Create a queue capable of containing 10 pointers to AMessage structures.\r
683     // These should be passed by pointer as they contain a lot of data.\r
684     xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) );\r
685     if( xQueue == 0 )\r
686     {\r
687         // Failed to create the queue.\r
688     }\r
689 \r
690     // ...\r
691 \r
692     // Send a pointer to a struct AMessage object.  Don't block if the\r
693     // queue is already full.\r
694     pxMessage = & xMessage;\r
695     xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 );\r
696 \r
697         // ... Rest of task code.\r
698  }\r
699 \r
700  // Task to receive from the queue.\r
701  void vADifferentTask( void *pvParameters )\r
702  {\r
703  struct AMessage *pxRxedMessage;\r
704 \r
705     if( xQueue != 0 )\r
706     {\r
707         // Receive a message on the created queue.  Block for 10 ticks if a\r
708         // message is not immediately available.\r
709         if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) )\r
710         {\r
711             // pcRxedMessage now points to the struct AMessage variable posted\r
712             // by vATask.\r
713         }\r
714     }\r
715 \r
716         // ... Rest of task code.\r
717  }\r
718  </pre>\r
719  * \defgroup xQueueReceive xQueueReceive\r
720  * \ingroup QueueManagement\r
721  */\r
722 signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, const void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeek );\r
723 \r
724 /**\r
725  * queue. h\r
726  * <pre>unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );</pre>\r
727  *\r
728  * Return the number of messages stored in a queue.\r
729  *\r
730  * @param xQueue A handle to the queue being queried.\r
731  *\r
732  * @return The number of messages available in the queue.\r
733  *\r
734  * \page uxQueueMessagesWaiting uxQueueMessagesWaiting\r
735  * \ingroup QueueManagement\r
736  */\r
737 unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );\r
738 \r
739 /**\r
740  * queue. h\r
741  * <pre>void vQueueDelete( xQueueHandle xQueue );</pre>\r
742  *\r
743  * Delete a queue - freeing all the memory allocated for storing of items\r
744  * placed on the queue.\r
745  *\r
746  * @param xQueue A handle to the queue to be deleted.\r
747  *\r
748  * \page vQueueDelete vQueueDelete\r
749  * \ingroup QueueManagement\r
750  */\r
751 void vQueueDelete( xQueueHandle xQueue );\r
752 \r
753 /**\r
754  * queue. h\r
755  * <pre>\r
756  portBASE_TYPE xQueueSendToFrontFromISR(\r
757                                          xQueueHandle pxQueue,\r
758                                          const void *pvItemToQueue,\r
759                                          portBASE_TYPE xTaskPreviouslyWoken\r
760                                       );\r
761  </pre>\r
762  *\r
763  * This is a macro that calls xQueueGenericSendFromISR().\r
764  *\r
765  * Post an item to the front of a queue.  It is safe to use this macro from\r
766  * within an interrupt service routine.\r
767  *\r
768  * Items are queued by copy not reference so it is preferable to only\r
769  * queue small items, especially when called from an ISR.  In most cases\r
770  * it would be preferable to store a pointer to the item being queued.\r
771  *\r
772  * @param xQueue The handle to the queue on which the item is to be posted.\r
773  *\r
774  * @param pvItemToQueue A pointer to the item that is to be placed on the\r
775  * queue.  The size of the items the queue will hold was defined when the\r
776  * queue was created, so this many bytes will be copied from pvItemToQueue\r
777  * into the queue storage area.\r
778  *\r
779  * @param cTaskPreviouslyWoken This is included so an ISR can post onto\r
780  * the same queue multiple times from a single interrupt.  The first call\r
781  * should always pass in pdFALSE.  Subsequent calls should pass in\r
782  * the value returned from the previous call.  See the file serial .c in the\r
783  * PC port for a good example of this mechanism.\r
784  *\r
785  * @return pdTRUE if a task was woken by posting onto the queue.  This is\r
786  * used by the ISR to determine if a context switch may be required following\r
787  * the ISR.\r
788  *\r
789  * Example usage for buffered IO (where the ISR can obtain more than one value\r
790  * per call):\r
791    <pre>\r
792  void vBufferISR( void )\r
793  {\r
794  portCHAR cIn;\r
795  portBASE_TYPE xTaskWokenByPost;\r
796 \r
797     // We have not woken a task at the start of the ISR.\r
798     cTaskWokenByPost = pdFALSE;\r
799 \r
800     // Loop until the buffer is empty.\r
801     do\r
802     {\r
803         // Obtain a byte from the buffer.\r
804         cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );                                            \r
805 \r
806         // Post the byte.  The first time round the loop cTaskWokenByPost\r
807         // will be pdFALSE.  If the queue send causes a task to wake we do\r
808         // not want the task to run until we have finished the ISR, so\r
809         // xQueueSendFromISR does not cause a context switch.  Also we\r
810         // don't want subsequent posts to wake any other tasks, so we store\r
811         // the return value back into cTaskWokenByPost so xQueueSendFromISR\r
812         // knows not to wake any task the next iteration of the loop.\r
813         xTaskWokenByPost = xQueueSendToFrontFromISR( xRxQueue, &cIn, cTaskWokenByPost );\r
814 \r
815     } while( portINPUT_BYTE( BUFFER_COUNT ) );\r
816 \r
817     // Now the buffer is empty we can switch context if necessary.\r
818     if( cTaskWokenByPost )\r
819     {\r
820         taskYIELD ();\r
821     }\r
822  }\r
823  </pre>\r
824  *\r
825  * \defgroup xQueueSendFromISR xQueueSendFromISR\r
826  * \ingroup QueueManagement\r
827  */\r
828 #define xQueueSendToFrontFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_FRONT )\r
829 \r
830 \r
831 /**\r
832  * queue. h\r
833  * <pre>\r
834  portBASE_TYPE xQueueSendToBackFromISR(\r
835                                          xQueueHandle pxQueue,\r
836                                          const void *pvItemToQueue,\r
837                                          portBASE_TYPE xTaskPreviouslyWoken\r
838                                       );\r
839  </pre>\r
840  *\r
841  * This is a macro that calls xQueueGenericSendFromISR().\r
842  *\r
843  * Post an item to the back of a queue.  It is safe to use this macro from\r
844  * within an interrupt service routine.\r
845  *\r
846  * Items are queued by copy not reference so it is preferable to only\r
847  * queue small items, especially when called from an ISR.  In most cases\r
848  * it would be preferable to store a pointer to the item being queued.\r
849  *\r
850  * @param xQueue The handle to the queue on which the item is to be posted.\r
851  *\r
852  * @param pvItemToQueue A pointer to the item that is to be placed on the\r
853  * queue.  The size of the items the queue will hold was defined when the\r
854  * queue was created, so this many bytes will be copied from pvItemToQueue\r
855  * into the queue storage area.\r
856  *\r
857  * @param cTaskPreviouslyWoken This is included so an ISR can post onto\r
858  * the same queue multiple times from a single interrupt.  The first call\r
859  * should always pass in pdFALSE.  Subsequent calls should pass in\r
860  * the value returned from the previous call.  See the file serial .c in the\r
861  * PC port for a good example of this mechanism.\r
862  *\r
863  * @return pdTRUE if a task was woken by posting onto the queue.  This is\r
864  * used by the ISR to determine if a context switch may be required following\r
865  * the ISR.\r
866  *\r
867  * Example usage for buffered IO (where the ISR can obtain more than one value\r
868  * per call):\r
869    <pre>\r
870  void vBufferISR( void )\r
871  {\r
872  portCHAR cIn;\r
873  portBASE_TYPE xTaskWokenByPost;\r
874 \r
875     // We have not woken a task at the start of the ISR.\r
876     cTaskWokenByPost = pdFALSE;\r
877 \r
878     // Loop until the buffer is empty.\r
879     do\r
880     {\r
881         // Obtain a byte from the buffer.\r
882         cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );                                            \r
883 \r
884         // Post the byte.  The first time round the loop cTaskWokenByPost\r
885         // will be pdFALSE.  If the queue send causes a task to wake we do\r
886         // not want the task to run until we have finished the ISR, so\r
887         // xQueueSendFromISR does not cause a context switch.  Also we\r
888         // don't want subsequent posts to wake any other tasks, so we store\r
889         // the return value back into cTaskWokenByPost so xQueueSendFromISR\r
890         // knows not to wake any task the next iteration of the loop.\r
891         xTaskWokenByPost = xQueueSendToBackFromISR( xRxQueue, &cIn, cTaskWokenByPost );\r
892 \r
893     } while( portINPUT_BYTE( BUFFER_COUNT ) );\r
894 \r
895     // Now the buffer is empty we can switch context if necessary.\r
896     if( cTaskWokenByPost )\r
897     {\r
898         taskYIELD ();\r
899     }\r
900  }\r
901  </pre>\r
902  *\r
903  * \defgroup xQueueSendFromISR xQueueSendFromISR\r
904  * \ingroup QueueManagement\r
905  */\r
906 #define xQueueSendToBackFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_BACK )\r
907 \r
908 \r
909 /**\r
910  * queue. h\r
911  * <pre>\r
912  portBASE_TYPE xQueueSendFromISR(\r
913                                      xQueueHandle pxQueue,\r
914                                      const void *pvItemToQueue,\r
915                                      portBASE_TYPE xTaskPreviouslyWoken\r
916                                 );\r
917  </pre>\r
918  *\r
919  * This is a macro that calls xQueueGenericSendFromISR().  It is included\r
920  * for backward compatibility with versions of FreeRTOS.org that did not\r
921  * include the xQueueSendToBackFromISR() and xQueueSendToFrontFromISR()\r
922  * macros.\r
923  *\r
924  * Post an item to the back of a queue.  It is safe to use this function from\r
925  * within an interrupt service routine.\r
926  *\r
927  * Items are queued by copy not reference so it is preferable to only\r
928  * queue small items, especially when called from an ISR.  In most cases\r
929  * it would be preferable to store a pointer to the item being queued.\r
930  *\r
931  * @param xQueue The handle to the queue on which the item is to be posted.\r
932  *\r
933  * @param pvItemToQueue A pointer to the item that is to be placed on the\r
934  * queue.  The size of the items the queue will hold was defined when the\r
935  * queue was created, so this many bytes will be copied from pvItemToQueue\r
936  * into the queue storage area.\r
937  *\r
938  * @param cTaskPreviouslyWoken This is included so an ISR can post onto\r
939  * the same queue multiple times from a single interrupt.  The first call\r
940  * should always pass in pdFALSE.  Subsequent calls should pass in\r
941  * the value returned from the previous call.  See the file serial .c in the\r
942  * PC port for a good example of this mechanism.\r
943  *\r
944  * @return pdTRUE if a task was woken by posting onto the queue.  This is\r
945  * used by the ISR to determine if a context switch may be required following\r
946  * the ISR.\r
947  *\r
948  * Example usage for buffered IO (where the ISR can obtain more than one value\r
949  * per call):\r
950    <pre>\r
951  void vBufferISR( void )\r
952  {\r
953  portCHAR cIn;\r
954  portBASE_TYPE xTaskWokenByPost;\r
955 \r
956     // We have not woken a task at the start of the ISR.\r
957     cTaskWokenByPost = pdFALSE;\r
958 \r
959     // Loop until the buffer is empty.\r
960     do\r
961     {\r
962         // Obtain a byte from the buffer.\r
963         cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );                                            \r
964 \r
965         // Post the byte.  The first time round the loop cTaskWokenByPost\r
966         // will be pdFALSE.  If the queue send causes a task to wake we do\r
967         // not want the task to run until we have finished the ISR, so\r
968         // xQueueSendFromISR does not cause a context switch.  Also we\r
969         // don't want subsequent posts to wake any other tasks, so we store\r
970         // the return value back into cTaskWokenByPost so xQueueSendFromISR\r
971         // knows not to wake any task the next iteration of the loop.\r
972         xTaskWokenByPost = xQueueSendFromISR( xRxQueue, &cIn, cTaskWokenByPost );\r
973 \r
974     } while( portINPUT_BYTE( BUFFER_COUNT ) );\r
975 \r
976     // Now the buffer is empty we can switch context if necessary.\r
977     if( cTaskWokenByPost )\r
978     {\r
979         taskYIELD ();\r
980     }\r
981  }\r
982  </pre>\r
983  *\r
984  * \defgroup xQueueSendFromISR xQueueSendFromISR\r
985  * \ingroup QueueManagement\r
986  */\r
987 #define xQueueSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, xTaskPreviouslyWoken, queueSEND_TO_BACK )\r
988 \r
989 /**\r
990  * queue. h\r
991  * <pre>\r
992  portBASE_TYPE xQueueGenericSendFromISR(\r
993                                            xQueueHandle pxQueue,\r
994                                            const void *pvItemToQueue,\r
995                                            portBASE_TYPE xTaskPreviouslyWoken\r
996                                                                                    portBASE_TYPE xCopyPosition\r
997                                        );\r
998  </pre>\r
999  *\r
1000  * It is preferred that the macros xQueueSendFromISR(),\r
1001  * xQueueSendToFrontFromISR() and xQueueSendToBackFromISR() be used in place\r
1002  * of calling this function directly.\r
1003  *\r
1004  * Post an item on a queue.  It is safe to use this function from within an\r
1005  * interrupt service routine.\r
1006  *\r
1007  * Items are queued by copy not reference so it is preferable to only\r
1008  * queue small items, especially when called from an ISR.  In most cases\r
1009  * it would be preferable to store a pointer to the item being queued.\r
1010  *\r
1011  * @param xQueue The handle to the queue on which the item is to be posted.\r
1012  *\r
1013  * @param pvItemToQueue A pointer to the item that is to be placed on the\r
1014  * queue.  The size of the items the queue will hold was defined when the\r
1015  * queue was created, so this many bytes will be copied from pvItemToQueue\r
1016  * into the queue storage area.\r
1017  *\r
1018  * @param cTaskPreviouslyWoken This is included so an ISR can post onto\r
1019  * the same queue multiple times from a single interrupt.  The first call\r
1020  * should always pass in pdFALSE.  Subsequent calls should pass in\r
1021  * the value returned from the previous call.  See the file serial .c in the\r
1022  * PC port for a good example of this mechanism.\r
1023  *\r
1024  * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the\r
1025  * item at the back of the queue, or queueSEND_TO_FRONT to place the item\r
1026  * at the front of the queue (for high priority messages).\r
1027  *\r
1028  * @return pdTRUE if a task was woken by posting onto the queue.  This is\r
1029  * used by the ISR to determine if a context switch may be required following\r
1030  * the ISR.\r
1031  *\r
1032  * Example usage for buffered IO (where the ISR can obtain more than one value\r
1033  * per call):\r
1034    <pre>\r
1035  void vBufferISR( void )\r
1036  {\r
1037  portCHAR cIn;\r
1038  portBASE_TYPE xTaskWokenByPost;\r
1039 \r
1040     // We have not woken a task at the start of the ISR.\r
1041     cTaskWokenByPost = pdFALSE;\r
1042 \r
1043     // Loop until the buffer is empty.\r
1044     do\r
1045     {\r
1046         // Obtain a byte from the buffer.\r
1047         cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS );                                            \r
1048 \r
1049         // Post the byte.  The first time round the loop cTaskWokenByPost\r
1050         // will be pdFALSE.  If the queue send causes a task to wake we do\r
1051         // not want the task to run until we have finished the ISR, so\r
1052         // xQueueSendFromISR does not cause a context switch.  Also we\r
1053         // don't want subsequent posts to wake any other tasks, so we store\r
1054         // the return value back into cTaskWokenByPost so xQueueSendFromISR\r
1055         // knows not to wake any task the next iteration of the loop.\r
1056         xTaskWokenByPost = xQueueGenericSendFromISR( xRxQueue, &cIn, cTaskWokenByPost, queueSEND_TO_BACK );\r
1057 \r
1058     } while( portINPUT_BYTE( BUFFER_COUNT ) );\r
1059 \r
1060     // Now the buffer is empty we can switch context if necessary.\r
1061     if( cTaskWokenByPost )\r
1062     {\r
1063         taskYIELD ();\r
1064     }\r
1065  }\r
1066  </pre>\r
1067  *\r
1068  * \defgroup xQueueSendFromISR xQueueSendFromISR\r
1069  * \ingroup QueueManagement\r
1070  */\r
1071 signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE xTaskPreviouslyWoken, portBASE_TYPE xCopyPosition );\r
1072 \r
1073 /**\r
1074  * queue. h\r
1075  * <pre>\r
1076  portBASE_TYPE xQueueReceiveFromISR(\r
1077                                        xQueueHandle pxQueue,\r
1078                                        void *pvBuffer,\r
1079                                        portBASE_TYPE *pxTaskWoken\r
1080                                    );\r
1081  * </pre>\r
1082  *\r
1083  * Receive an item from a queue.  It is safe to use this function from within an\r
1084  * interrupt service routine.\r
1085  *\r
1086  * @param pxQueue The handle to the queue from which the item is to be\r
1087  * received.\r
1088  *\r
1089  * @param pvBuffer Pointer to the buffer into which the received item will\r
1090  * be copied.\r
1091  *\r
1092  * @param pxTaskWoken A task may be blocked waiting for space to become\r
1093  * available on the queue.  If xQueueReceiveFromISR causes such a task to\r
1094  * unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will\r
1095  * remain unchanged.\r
1096  *\r
1097  * @return pdTRUE if an item was successfully received from the queue,\r
1098  * otherwise pdFALSE.\r
1099  *\r
1100  * Example usage:\r
1101    <pre>\r
1102 \r
1103  xQueueHandle xQueue;\r
1104 \r
1105  // Function to create a queue and post some values.\r
1106  void vAFunction( void *pvParameters )\r
1107  {\r
1108  portCHAR cValueToPost;\r
1109  const portTickType xBlockTime = ( portTickType )0xff;\r
1110 \r
1111     // Create a queue capable of containing 10 characters.\r
1112     xQueue = xQueueCreate( 10, sizeof( portCHAR ) );\r
1113     if( xQueue == 0 )\r
1114     {\r
1115         // Failed to create the queue.\r
1116     }\r
1117 \r
1118     // ...\r
1119 \r
1120     // Post some characters that will be used within an ISR.  If the queue\r
1121     // is full then this task will block for xBlockTime ticks.\r
1122     cValueToPost = 'a';\r
1123     xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime );\r
1124     cValueToPost = 'b';\r
1125     xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime );\r
1126 \r
1127     // ... keep posting characters ... this task may block when the queue\r
1128     // becomes full.\r
1129 \r
1130     cValueToPost = 'c';\r
1131     xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime );\r
1132  }\r
1133 \r
1134  // ISR that outputs all the characters received on the queue.\r
1135  void vISR_Routine( void )\r
1136  {\r
1137  portBASE_TYPE xTaskWokenByReceive = pdFALSE;\r
1138  portCHAR cRxedChar;\r
1139 \r
1140     while( xQueueReceiveFromISR( xQueue, ( void * ) &cRxedChar, &xTaskWokenByReceive) )\r
1141     {\r
1142         // A character was received.  Output the character now.\r
1143         vOutputCharacter( cRxedChar );\r
1144 \r
1145         // If removing the character from the queue woke the task that was\r
1146         // posting onto the queue cTaskWokenByReceive will have been set to\r
1147         // pdTRUE.  No matter how many times this loop iterates only one\r
1148         // task will be woken.\r
1149     }\r
1150 \r
1151     if( cTaskWokenByPost != ( portCHAR ) pdFALSE;\r
1152     {\r
1153         taskYIELD ();\r
1154     }\r
1155  }\r
1156  </pre>\r
1157  * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR\r
1158  * \ingroup QueueManagement\r
1159  */\r
1160 signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, const void * const pvBuffer, signed portBASE_TYPE *pxTaskWoken );\r
1161 \r
1162 \r
1163 /*\r
1164  * The functions defined above are for passing data to and from tasks.  The\r
1165  * functions below are the equivalents for passing data to and from\r
1166  * co-routines.\r
1167  *\r
1168  * These functions are called from the co-routine macro implementation and\r
1169  * should not be called directly from application code.  Instead use the macro\r
1170  * wrappers defined within croutine.h.\r
1171  */\r
1172 signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle pxQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken );\r
1173 signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle pxQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken );\r
1174 signed portBASE_TYPE xQueueCRSend( xQueueHandle pxQueue, const void *pvItemToQueue, portTickType xTicksToWait );\r
1175 signed portBASE_TYPE xQueueCRReceive( xQueueHandle pxQueue, void *pvBuffer, portTickType xTicksToWait );\r
1176 \r
1177 /*\r
1178  * For internal use only.  Use xSemaphoreCreateMutex() instead of calling\r
1179  * this function directly.\r
1180  */\r
1181 xQueueHandle xQueueCreateMutex( void );\r
1182 \r
1183 #ifdef __cplusplus\r
1184 }\r
1185 #endif\r
1186 \r
1187 #endif /* QUEUE_H */\r
1188 \r