OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [include/] [queue.h] - Blame information for rev 828

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.