FreeRTOS Real Time Operating System, Modified from Kenji Arai's initial port. See freertos.org for full documentation.
Fork of FreeRTOS_on_mbed_v1 by
queue.h
00001 /* 00002 FreeRTOS V6.0.3 - Copyright (C) 2010 Real Time Engineers Ltd. 00003 00004 *************************************************************************** 00005 * * 00006 * If you are: * 00007 * * 00008 * + New to FreeRTOS, * 00009 * + Wanting to learn FreeRTOS or multitasking in general quickly * 00010 * + Looking for basic training, * 00011 * + Wanting to improve your FreeRTOS skills and productivity * 00012 * * 00013 * then take a look at the FreeRTOS eBook * 00014 * * 00015 * "Using the FreeRTOS Real Time Kernel - a Practical Guide" * 00016 * http://www.FreeRTOS.org/Documentation * 00017 * * 00018 * A pdf reference manual is also available. Both are usually delivered * 00019 * to your inbox within 20 minutes to two hours when purchased between 8am * 00020 * and 8pm GMT (although please allow up to 24 hours in case of * 00021 * exceptional circumstances). Thank you for your support! * 00022 * * 00023 *************************************************************************** 00024 00025 This file is part of the FreeRTOS distribution. 00026 00027 FreeRTOS is free software; you can redistribute it and/or modify it under 00028 the terms of the GNU General Public License (version 2) as published by the 00029 Free Software Foundation AND MODIFIED BY the FreeRTOS exception. 00030 ***NOTE*** The exception to the GPL is included to allow you to distribute 00031 a combined work that includes FreeRTOS without being obliged to provide the 00032 source code for proprietary components outside of the FreeRTOS kernel. 00033 FreeRTOS is distributed in the hope that it will be useful, but WITHOUT 00034 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00035 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 00036 more details. You should have received a copy of the GNU General Public 00037 License and the FreeRTOS license exception along with FreeRTOS; if not it 00038 can be viewed here: http://www.freertos.org/a00114.html and also obtained 00039 by writing to Richard Barry, contact details for whom are available on the 00040 FreeRTOS WEB site. 00041 00042 1 tab == 4 spaces! 00043 00044 http://www.FreeRTOS.org - Documentation, latest information, license and 00045 contact details. 00046 00047 http://www.SafeRTOS.com - A version that is certified for use in safety 00048 critical systems. 00049 00050 http://www.OpenRTOS.com - Commercial support, development, porting, 00051 licensing and training services. 00052 */ 00053 00054 #ifndef INC_FREERTOS_H 00055 #error "#include FreeRTOS.h" must appear in source files before "#include queue.h" 00056 #endif 00057 00058 00059 00060 00061 #ifndef QUEUE_H 00062 #define QUEUE_H 00063 00064 #ifdef __cplusplus 00065 extern "C" { 00066 #endif 00067 00068 #include "mpu_wrappers.h" 00069 00070 typedef void * xQueueHandle; 00071 00072 00073 /* For internal use only. */ 00074 #define queueSEND_TO_BACK ( 0 ) 00075 #define queueSEND_TO_FRONT ( 1 ) 00076 00077 00078 /** 00079 * queue. h 00080 * <pre> 00081 xQueueHandle xQueueCreate( 00082 unsigned portBASE_TYPE uxQueueLength, 00083 unsigned portBASE_TYPE uxItemSize 00084 ); 00085 * </pre> 00086 * 00087 * Creates a new queue instance. This allocates the storage required by the 00088 * new queue and returns a handle for the queue. 00089 * 00090 * @param uxQueueLength The maximum number of items that the queue can contain. 00091 * 00092 * @param uxItemSize The number of bytes each item in the queue will require. 00093 * Items are queued by copy, not by reference, so this is the number of bytes 00094 * that will be copied for each posted item. Each item on the queue must be 00095 * the same size. 00096 * 00097 * @return If the queue is successfully create then a handle to the newly 00098 * created queue is returned. If the queue cannot be created then 0 is 00099 * returned. 00100 * 00101 * Example usage: 00102 <pre> 00103 struct AMessage 00104 { 00105 char ucMessageID; 00106 char ucData[ 20 ]; 00107 }; 00108 00109 void vATask( void *pvParameters ) 00110 { 00111 xQueueHandle xQueue1, xQueue2; 00112 00113 // Create a queue capable of containing 10 unsigned long values. 00114 xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); 00115 if( xQueue1 == 0 ) 00116 { 00117 // Queue was not created and must not be used. 00118 } 00119 00120 // Create a queue capable of containing 10 pointers to AMessage structures. 00121 // These should be passed by pointer as they contain a lot of data. 00122 xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) ); 00123 if( xQueue2 == 0 ) 00124 { 00125 // Queue was not created and must not be used. 00126 } 00127 00128 // ... Rest of task code. 00129 } 00130 </pre> 00131 * \defgroup xQueueCreate xQueueCreate 00132 * \ingroup QueueManagement 00133 */ 00134 xQueueHandle xQueueCreate( unsigned portBASE_TYPE uxQueueLength, unsigned portBASE_TYPE uxItemSize ); 00135 00136 /** 00137 * queue. h 00138 * <pre> 00139 portBASE_TYPE xQueueSendToToFront( 00140 xQueueHandle xQueue, 00141 const void * pvItemToQueue, 00142 portTickType xTicksToWait 00143 ); 00144 * </pre> 00145 * 00146 * This is a macro that calls xQueueGenericSend(). 00147 * 00148 * Post an item to the front of a queue. The item is queued by copy, not by 00149 * reference. This function must not be called from an interrupt service 00150 * routine. See xQueueSendFromISR () for an alternative which may be used 00151 * in an ISR. 00152 * 00153 * @param xQueue The handle to the queue on which the item is to be posted. 00154 * 00155 * @param pvItemToQueue A pointer to the item that is to be placed on the 00156 * queue. The size of the items the queue will hold was defined when the 00157 * queue was created, so this many bytes will be copied from pvItemToQueue 00158 * into the queue storage area. 00159 * 00160 * @param xTicksToWait The maximum amount of time the task should block 00161 * waiting for space to become available on the queue, should it already 00162 * be full. The call will return immediately if this is set to 0 and the 00163 * queue is full. The time is defined in tick periods so the constant 00164 * portTICK_RATE_MS should be used to convert to real time if this is required. 00165 * 00166 * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. 00167 * 00168 * Example usage: 00169 <pre> 00170 struct AMessage 00171 { 00172 char ucMessageID; 00173 char ucData[ 20 ]; 00174 } xMessage; 00175 00176 unsigned long ulVar = 10UL; 00177 00178 void vATask( void *pvParameters ) 00179 { 00180 xQueueHandle xQueue1, xQueue2; 00181 struct AMessage *pxMessage; 00182 00183 // Create a queue capable of containing 10 unsigned long values. 00184 xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); 00185 00186 // Create a queue capable of containing 10 pointers to AMessage structures. 00187 // These should be passed by pointer as they contain a lot of data. 00188 xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) ); 00189 00190 // ... 00191 00192 if( xQueue1 != 0 ) 00193 { 00194 // Send an unsigned long. Wait for 10 ticks for space to become 00195 // available if necessary. 00196 if( xQueueSendToFront( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS ) 00197 { 00198 // Failed to post the message, even after 10 ticks. 00199 } 00200 } 00201 00202 if( xQueue2 != 0 ) 00203 { 00204 // Send a pointer to a struct AMessage object. Don't block if the 00205 // queue is already full. 00206 pxMessage = & xMessage; 00207 xQueueSendToFront( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 ); 00208 } 00209 00210 // ... Rest of task code. 00211 } 00212 </pre> 00213 * \defgroup xQueueSend xQueueSend 00214 * \ingroup QueueManagement 00215 */ 00216 #define xQueueSendToFront( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, queueSEND_TO_FRONT ) 00217 00218 /** 00219 * queue. h 00220 * <pre> 00221 portBASE_TYPE xQueueSendToBack( 00222 xQueueHandle xQueue, 00223 const void * pvItemToQueue, 00224 portTickType xTicksToWait 00225 ); 00226 * </pre> 00227 * 00228 * This is a macro that calls xQueueGenericSend(). 00229 * 00230 * Post an item to the back of a queue. The item is queued by copy, not by 00231 * reference. This function must not be called from an interrupt service 00232 * routine. See xQueueSendFromISR () for an alternative which may be used 00233 * in an ISR. 00234 * 00235 * @param xQueue The handle to the queue on which the item is to be posted. 00236 * 00237 * @param pvItemToQueue A pointer to the item that is to be placed on the 00238 * queue. The size of the items the queue will hold was defined when the 00239 * queue was created, so this many bytes will be copied from pvItemToQueue 00240 * into the queue storage area. 00241 * 00242 * @param xTicksToWait The maximum amount of time the task should block 00243 * waiting for space to become available on the queue, should it already 00244 * be full. The call will return immediately if this is set to 0 and the queue 00245 * is full. The time is defined in tick periods so the constant 00246 * portTICK_RATE_MS should be used to convert to real time if this is required. 00247 * 00248 * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. 00249 * 00250 * Example usage: 00251 <pre> 00252 struct AMessage 00253 { 00254 char ucMessageID; 00255 char ucData[ 20 ]; 00256 } xMessage; 00257 00258 unsigned long ulVar = 10UL; 00259 00260 void vATask( void *pvParameters ) 00261 { 00262 xQueueHandle xQueue1, xQueue2; 00263 struct AMessage *pxMessage; 00264 00265 // Create a queue capable of containing 10 unsigned long values. 00266 xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); 00267 00268 // Create a queue capable of containing 10 pointers to AMessage structures. 00269 // These should be passed by pointer as they contain a lot of data. 00270 xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) ); 00271 00272 // ... 00273 00274 if( xQueue1 != 0 ) 00275 { 00276 // Send an unsigned long. Wait for 10 ticks for space to become 00277 // available if necessary. 00278 if( xQueueSendToBack( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS ) 00279 { 00280 // Failed to post the message, even after 10 ticks. 00281 } 00282 } 00283 00284 if( xQueue2 != 0 ) 00285 { 00286 // Send a pointer to a struct AMessage object. Don't block if the 00287 // queue is already full. 00288 pxMessage = & xMessage; 00289 xQueueSendToBack( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 ); 00290 } 00291 00292 // ... Rest of task code. 00293 } 00294 </pre> 00295 * \defgroup xQueueSend xQueueSend 00296 * \ingroup QueueManagement 00297 */ 00298 #define xQueueSendToBack( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, queueSEND_TO_BACK ) 00299 00300 /** 00301 * queue. h 00302 * <pre> 00303 portBASE_TYPE xQueueSend( 00304 xQueueHandle xQueue, 00305 const void * pvItemToQueue, 00306 portTickType xTicksToWait 00307 ); 00308 * </pre> 00309 * 00310 * This is a macro that calls xQueueGenericSend(). It is included for 00311 * backward compatibility with versions of FreeRTOS.org that did not 00312 * include the xQueueSendToFront() and xQueueSendToBack() macros. It is 00313 * equivalent to xQueueSendToBack(). 00314 * 00315 * Post an item on a queue. The item is queued by copy, not by reference. 00316 * This function must not be called from an interrupt service routine. 00317 * See xQueueSendFromISR () for an alternative which may be used in an ISR. 00318 * 00319 * @param xQueue The handle to the queue on which the item is to be posted. 00320 * 00321 * @param pvItemToQueue A pointer to the item that is to be placed on the 00322 * queue. The size of the items the queue will hold was defined when the 00323 * queue was created, so this many bytes will be copied from pvItemToQueue 00324 * into the queue storage area. 00325 * 00326 * @param xTicksToWait The maximum amount of time the task should block 00327 * waiting for space to become available on the queue, should it already 00328 * be full. The call will return immediately if this is set to 0 and the 00329 * queue is full. The time is defined in tick periods so the constant 00330 * portTICK_RATE_MS should be used to convert to real time if this is required. 00331 * 00332 * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. 00333 * 00334 * Example usage: 00335 <pre> 00336 struct AMessage 00337 { 00338 char ucMessageID; 00339 char ucData[ 20 ]; 00340 } xMessage; 00341 00342 unsigned long ulVar = 10UL; 00343 00344 void vATask( void *pvParameters ) 00345 { 00346 xQueueHandle xQueue1, xQueue2; 00347 struct AMessage *pxMessage; 00348 00349 // Create a queue capable of containing 10 unsigned long values. 00350 xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); 00351 00352 // Create a queue capable of containing 10 pointers to AMessage structures. 00353 // These should be passed by pointer as they contain a lot of data. 00354 xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) ); 00355 00356 // ... 00357 00358 if( xQueue1 != 0 ) 00359 { 00360 // Send an unsigned long. Wait for 10 ticks for space to become 00361 // available if necessary. 00362 if( xQueueSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10 ) != pdPASS ) 00363 { 00364 // Failed to post the message, even after 10 ticks. 00365 } 00366 } 00367 00368 if( xQueue2 != 0 ) 00369 { 00370 // Send a pointer to a struct AMessage object. Don't block if the 00371 // queue is already full. 00372 pxMessage = & xMessage; 00373 xQueueSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0 ); 00374 } 00375 00376 // ... Rest of task code. 00377 } 00378 </pre> 00379 * \defgroup xQueueSend xQueueSend 00380 * \ingroup QueueManagement 00381 */ 00382 #define xQueueSend( xQueue, pvItemToQueue, xTicksToWait ) xQueueGenericSend( xQueue, pvItemToQueue, xTicksToWait, queueSEND_TO_BACK ) 00383 00384 00385 /** 00386 * queue. h 00387 * <pre> 00388 portBASE_TYPE xQueueGenericSend( 00389 xQueueHandle xQueue, 00390 const void * pvItemToQueue, 00391 portTickType xTicksToWait 00392 portBASE_TYPE xCopyPosition 00393 ); 00394 * </pre> 00395 * 00396 * It is preferred that the macros xQueueSend(), xQueueSendToFront() and 00397 * xQueueSendToBack() are used in place of calling this function directly. 00398 * 00399 * Post an item on a queue. The item is queued by copy, not by reference. 00400 * This function must not be called from an interrupt service routine. 00401 * See xQueueSendFromISR () for an alternative which may be used in an ISR. 00402 * 00403 * @param xQueue The handle to the queue on which the item is to be posted. 00404 * 00405 * @param pvItemToQueue A pointer to the item that is to be placed on the 00406 * queue. The size of the items the queue will hold was defined when the 00407 * queue was created, so this many bytes will be copied from pvItemToQueue 00408 * into the queue storage area. 00409 * 00410 * @param xTicksToWait The maximum amount of time the task should block 00411 * waiting for space to become available on the queue, should it already 00412 * be full. The call will return immediately if this is set to 0 and the 00413 * queue is full. The time is defined in tick periods so the constant 00414 * portTICK_RATE_MS should be used to convert to real time if this is required. 00415 * 00416 * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the 00417 * item at the back of the queue, or queueSEND_TO_FRONT to place the item 00418 * at the front of the queue (for high priority messages). 00419 * 00420 * @return pdTRUE if the item was successfully posted, otherwise errQUEUE_FULL. 00421 * 00422 * Example usage: 00423 <pre> 00424 struct AMessage 00425 { 00426 char ucMessageID; 00427 char ucData[ 20 ]; 00428 } xMessage; 00429 00430 unsigned long ulVar = 10UL; 00431 00432 void vATask( void *pvParameters ) 00433 { 00434 xQueueHandle xQueue1, xQueue2; 00435 struct AMessage *pxMessage; 00436 00437 // Create a queue capable of containing 10 unsigned long values. 00438 xQueue1 = xQueueCreate( 10, sizeof( unsigned long ) ); 00439 00440 // Create a queue capable of containing 10 pointers to AMessage structures. 00441 // These should be passed by pointer as they contain a lot of data. 00442 xQueue2 = xQueueCreate( 10, sizeof( struct AMessage * ) ); 00443 00444 // ... 00445 00446 if( xQueue1 != 0 ) 00447 { 00448 // Send an unsigned long. Wait for 10 ticks for space to become 00449 // available if necessary. 00450 if( xQueueGenericSend( xQueue1, ( void * ) &ulVar, ( portTickType ) 10, queueSEND_TO_BACK ) != pdPASS ) 00451 { 00452 // Failed to post the message, even after 10 ticks. 00453 } 00454 } 00455 00456 if( xQueue2 != 0 ) 00457 { 00458 // Send a pointer to a struct AMessage object. Don't block if the 00459 // queue is already full. 00460 pxMessage = & xMessage; 00461 xQueueGenericSend( xQueue2, ( void * ) &pxMessage, ( portTickType ) 0, queueSEND_TO_BACK ); 00462 } 00463 00464 // ... Rest of task code. 00465 } 00466 </pre> 00467 * \defgroup xQueueSend xQueueSend 00468 * \ingroup QueueManagement 00469 */ 00470 signed portBASE_TYPE xQueueGenericSend( xQueueHandle xQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ); 00471 00472 /** 00473 * queue. h 00474 * <pre> 00475 portBASE_TYPE xQueuePeek( 00476 xQueueHandle xQueue, 00477 void *pvBuffer, 00478 portTickType xTicksToWait 00479 );</pre> 00480 * 00481 * This is a macro that calls the xQueueGenericReceive() function. 00482 * 00483 * Receive an item from a queue without removing the item from the queue. 00484 * The item is received by copy so a buffer of adequate size must be 00485 * provided. The number of bytes copied into the buffer was defined when 00486 * the queue was created. 00487 * 00488 * Successfully received items remain on the queue so will be returned again 00489 * by the next call, or a call to xQueueReceive(). 00490 * 00491 * This macro must not be used in an interrupt service routine. 00492 * 00493 * @param pxQueue The handle to the queue from which the item is to be 00494 * received. 00495 * 00496 * @param pvBuffer Pointer to the buffer into which the received item will 00497 * be copied. 00498 * 00499 * @param xTicksToWait The maximum amount of time the task should block 00500 * waiting for an item to receive should the queue be empty at the time 00501 * of the call. The time is defined in tick periods so the constant 00502 * portTICK_RATE_MS should be used to convert to real time if this is required. 00503 * xQueuePeek() will return immediately if xTicksToWait is 0 and the queue 00504 * is empty. 00505 * 00506 * @return pdTRUE if an item was successfully received from the queue, 00507 * otherwise pdFALSE. 00508 * 00509 * Example usage: 00510 <pre> 00511 struct AMessage 00512 { 00513 char ucMessageID; 00514 char ucData[ 20 ]; 00515 } xMessage; 00516 00517 xQueueHandle xQueue; 00518 00519 // Task to create a queue and post a value. 00520 void vATask( void *pvParameters ) 00521 { 00522 struct AMessage *pxMessage; 00523 00524 // Create a queue capable of containing 10 pointers to AMessage structures. 00525 // These should be passed by pointer as they contain a lot of data. 00526 xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) ); 00527 if( xQueue == 0 ) 00528 { 00529 // Failed to create the queue. 00530 } 00531 00532 // ... 00533 00534 // Send a pointer to a struct AMessage object. Don't block if the 00535 // queue is already full. 00536 pxMessage = & xMessage; 00537 xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 ); 00538 00539 // ... Rest of task code. 00540 } 00541 00542 // Task to peek the data from the queue. 00543 void vADifferentTask( void *pvParameters ) 00544 { 00545 struct AMessage *pxRxedMessage; 00546 00547 if( xQueue != 0 ) 00548 { 00549 // Peek a message on the created queue. Block for 10 ticks if a 00550 // message is not immediately available. 00551 if( xQueuePeek( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) ) 00552 { 00553 // pcRxedMessage now points to the struct AMessage variable posted 00554 // by vATask, but the item still remains on the queue. 00555 } 00556 } 00557 00558 // ... Rest of task code. 00559 } 00560 </pre> 00561 * \defgroup xQueueReceive xQueueReceive 00562 * \ingroup QueueManagement 00563 */ 00564 #define xQueuePeek( xQueue, pvBuffer, xTicksToWait ) xQueueGenericReceive( xQueue, pvBuffer, xTicksToWait, pdTRUE ) 00565 00566 /** 00567 * queue. h 00568 * <pre> 00569 portBASE_TYPE xQueueReceive( 00570 xQueueHandle xQueue, 00571 void *pvBuffer, 00572 portTickType xTicksToWait 00573 );</pre> 00574 * 00575 * This is a macro that calls the xQueueGenericReceive() function. 00576 * 00577 * Receive an item from a queue. The item is received by copy so a buffer of 00578 * adequate size must be provided. The number of bytes copied into the buffer 00579 * was defined when the queue was created. 00580 * 00581 * Successfully received items are removed from the queue. 00582 * 00583 * This function must not be used in an interrupt service routine. See 00584 * xQueueReceiveFromISR for an alternative that can. 00585 * 00586 * @param pxQueue The handle to the queue from which the item is to be 00587 * received. 00588 * 00589 * @param pvBuffer Pointer to the buffer into which the received item will 00590 * be copied. 00591 * 00592 * @param xTicksToWait The maximum amount of time the task should block 00593 * waiting for an item to receive should the queue be empty at the time 00594 * of the call. xQueueReceive() will return immediately if xTicksToWait 00595 * is zero and the queue is empty. The time is defined in tick periods so the 00596 * constant portTICK_RATE_MS should be used to convert to real time if this is 00597 * required. 00598 * 00599 * @return pdTRUE if an item was successfully received from the queue, 00600 * otherwise pdFALSE. 00601 * 00602 * Example usage: 00603 <pre> 00604 struct AMessage 00605 { 00606 char ucMessageID; 00607 char ucData[ 20 ]; 00608 } xMessage; 00609 00610 xQueueHandle xQueue; 00611 00612 // Task to create a queue and post a value. 00613 void vATask( void *pvParameters ) 00614 { 00615 struct AMessage *pxMessage; 00616 00617 // Create a queue capable of containing 10 pointers to AMessage structures. 00618 // These should be passed by pointer as they contain a lot of data. 00619 xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) ); 00620 if( xQueue == 0 ) 00621 { 00622 // Failed to create the queue. 00623 } 00624 00625 // ... 00626 00627 // Send a pointer to a struct AMessage object. Don't block if the 00628 // queue is already full. 00629 pxMessage = & xMessage; 00630 xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 ); 00631 00632 // ... Rest of task code. 00633 } 00634 00635 // Task to receive from the queue. 00636 void vADifferentTask( void *pvParameters ) 00637 { 00638 struct AMessage *pxRxedMessage; 00639 00640 if( xQueue != 0 ) 00641 { 00642 // Receive a message on the created queue. Block for 10 ticks if a 00643 // message is not immediately available. 00644 if( xQueueReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) ) 00645 { 00646 // pcRxedMessage now points to the struct AMessage variable posted 00647 // by vATask. 00648 } 00649 } 00650 00651 // ... Rest of task code. 00652 } 00653 </pre> 00654 * \defgroup xQueueReceive xQueueReceive 00655 * \ingroup QueueManagement 00656 */ 00657 #define xQueueReceive( xQueue, pvBuffer, xTicksToWait ) xQueueGenericReceive( xQueue, pvBuffer, xTicksToWait, pdFALSE ) 00658 00659 00660 /** 00661 * queue. h 00662 * <pre> 00663 portBASE_TYPE xQueueGenericReceive( 00664 xQueueHandle xQueue, 00665 void *pvBuffer, 00666 portTickType xTicksToWait 00667 portBASE_TYPE xJustPeek 00668 );</pre> 00669 * 00670 * It is preferred that the macro xQueueReceive() be used rather than calling 00671 * this function directly. 00672 * 00673 * Receive an item from a queue. The item is received by copy so a buffer of 00674 * adequate size must be provided. The number of bytes copied into the buffer 00675 * was defined when the queue was created. 00676 * 00677 * This function must not be used in an interrupt service routine. See 00678 * xQueueReceiveFromISR for an alternative that can. 00679 * 00680 * @param pxQueue The handle to the queue from which the item is to be 00681 * received. 00682 * 00683 * @param pvBuffer Pointer to the buffer into which the received item will 00684 * be copied. 00685 * 00686 * @param xTicksToWait The maximum amount of time the task should block 00687 * waiting for an item to receive should the queue be empty at the time 00688 * of the call. The time is defined in tick periods so the constant 00689 * portTICK_RATE_MS should be used to convert to real time if this is required. 00690 * xQueueGenericReceive() will return immediately if the queue is empty and 00691 * xTicksToWait is 0. 00692 * 00693 * @param xJustPeek When set to true, the item received from the queue is not 00694 * actually removed from the queue - meaning a subsequent call to 00695 * xQueueReceive() will return the same item. When set to false, the item 00696 * being received from the queue is also removed from the queue. 00697 * 00698 * @return pdTRUE if an item was successfully received from the queue, 00699 * otherwise pdFALSE. 00700 * 00701 * Example usage: 00702 <pre> 00703 struct AMessage 00704 { 00705 char ucMessageID; 00706 char ucData[ 20 ]; 00707 } xMessage; 00708 00709 xQueueHandle xQueue; 00710 00711 // Task to create a queue and post a value. 00712 void vATask( void *pvParameters ) 00713 { 00714 struct AMessage *pxMessage; 00715 00716 // Create a queue capable of containing 10 pointers to AMessage structures. 00717 // These should be passed by pointer as they contain a lot of data. 00718 xQueue = xQueueCreate( 10, sizeof( struct AMessage * ) ); 00719 if( xQueue == 0 ) 00720 { 00721 // Failed to create the queue. 00722 } 00723 00724 // ... 00725 00726 // Send a pointer to a struct AMessage object. Don't block if the 00727 // queue is already full. 00728 pxMessage = & xMessage; 00729 xQueueSend( xQueue, ( void * ) &pxMessage, ( portTickType ) 0 ); 00730 00731 // ... Rest of task code. 00732 } 00733 00734 // Task to receive from the queue. 00735 void vADifferentTask( void *pvParameters ) 00736 { 00737 struct AMessage *pxRxedMessage; 00738 00739 if( xQueue != 0 ) 00740 { 00741 // Receive a message on the created queue. Block for 10 ticks if a 00742 // message is not immediately available. 00743 if( xQueueGenericReceive( xQueue, &( pxRxedMessage ), ( portTickType ) 10 ) ) 00744 { 00745 // pcRxedMessage now points to the struct AMessage variable posted 00746 // by vATask. 00747 } 00748 } 00749 00750 // ... Rest of task code. 00751 } 00752 </pre> 00753 * \defgroup xQueueReceive xQueueReceive 00754 * \ingroup QueueManagement 00755 */ 00756 signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeek ); 00757 00758 /** 00759 * queue. h 00760 * <pre>unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue );</pre> 00761 * 00762 * Return the number of messages stored in a queue. 00763 * 00764 * @param xQueue A handle to the queue being queried. 00765 * 00766 * @return The number of messages available in the queue. 00767 * 00768 * \page uxQueueMessagesWaiting uxQueueMessagesWaiting 00769 * \ingroup QueueManagement 00770 */ 00771 unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ); 00772 00773 /** 00774 * queue. h 00775 * <pre>void vQueueDelete( xQueueHandle xQueue );</pre> 00776 * 00777 * Delete a queue - freeing all the memory allocated for storing of items 00778 * placed on the queue. 00779 * 00780 * @param xQueue A handle to the queue to be deleted. 00781 * 00782 * \page vQueueDelete vQueueDelete 00783 * \ingroup QueueManagement 00784 */ 00785 void vQueueDelete( xQueueHandle xQueue ); 00786 00787 /** 00788 * queue. h 00789 * <pre> 00790 portBASE_TYPE xQueueSendToFrontFromISR( 00791 xQueueHandle pxQueue, 00792 const void *pvItemToQueue, 00793 portBASE_TYPE *pxHigherPriorityTaskWoken 00794 ); 00795 </pre> 00796 * 00797 * This is a macro that calls xQueueGenericSendFromISR(). 00798 * 00799 * Post an item to the front of a queue. It is safe to use this macro from 00800 * within an interrupt service routine. 00801 * 00802 * Items are queued by copy not reference so it is preferable to only 00803 * queue small items, especially when called from an ISR. In most cases 00804 * it would be preferable to store a pointer to the item being queued. 00805 * 00806 * @param xQueue The handle to the queue on which the item is to be posted. 00807 * 00808 * @param pvItemToQueue A pointer to the item that is to be placed on the 00809 * queue. The size of the items the queue will hold was defined when the 00810 * queue was created, so this many bytes will be copied from pvItemToQueue 00811 * into the queue storage area. 00812 * 00813 * @param pxHigherPriorityTaskWoken xQueueSendToFrontFromISR() will set 00814 * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task 00815 * to unblock, and the unblocked task has a priority higher than the currently 00816 * running task. If xQueueSendToFromFromISR() sets this value to pdTRUE then 00817 * a context switch should be requested before the interrupt is exited. 00818 * 00819 * @return pdTRUE if the data was successfully sent to the queue, otherwise 00820 * errQUEUE_FULL. 00821 * 00822 * Example usage for buffered IO (where the ISR can obtain more than one value 00823 * per call): 00824 <pre> 00825 void vBufferISR( void ) 00826 { 00827 char cIn; 00828 portBASE_TYPE xHigherPrioritTaskWoken; 00829 00830 // We have not woken a task at the start of the ISR. 00831 xHigherPriorityTaskWoken = pdFALSE; 00832 00833 // Loop until the buffer is empty. 00834 do 00835 { 00836 // Obtain a byte from the buffer. 00837 cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); 00838 00839 // Post the byte. 00840 xQueueSendToFrontFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); 00841 00842 } while( portINPUT_BYTE( BUFFER_COUNT ) ); 00843 00844 // Now the buffer is empty we can switch context if necessary. 00845 if( xHigherPriorityTaskWoken ) 00846 { 00847 taskYIELD (); 00848 } 00849 } 00850 </pre> 00851 * 00852 * \defgroup xQueueSendFromISR xQueueSendFromISR 00853 * \ingroup QueueManagement 00854 */ 00855 #define xQueueSendToFrontFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_FRONT ) 00856 00857 00858 /** 00859 * queue. h 00860 * <pre> 00861 portBASE_TYPE xQueueSendToBackFromISR( 00862 xQueueHandle pxQueue, 00863 const void *pvItemToQueue, 00864 portBASE_TYPE *pxHigherPriorityTaskWoken 00865 ); 00866 </pre> 00867 * 00868 * This is a macro that calls xQueueGenericSendFromISR(). 00869 * 00870 * Post an item to the back of a queue. It is safe to use this macro from 00871 * within an interrupt service routine. 00872 * 00873 * Items are queued by copy not reference so it is preferable to only 00874 * queue small items, especially when called from an ISR. In most cases 00875 * it would be preferable to store a pointer to the item being queued. 00876 * 00877 * @param xQueue The handle to the queue on which the item is to be posted. 00878 * 00879 * @param pvItemToQueue A pointer to the item that is to be placed on the 00880 * queue. The size of the items the queue will hold was defined when the 00881 * queue was created, so this many bytes will be copied from pvItemToQueue 00882 * into the queue storage area. 00883 * 00884 * @param pxHigherPriorityTaskWoken xQueueSendToBackFromISR() will set 00885 * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task 00886 * to unblock, and the unblocked task has a priority higher than the currently 00887 * running task. If xQueueSendToBackFromISR() sets this value to pdTRUE then 00888 * a context switch should be requested before the interrupt is exited. 00889 * 00890 * @return pdTRUE if the data was successfully sent to the queue, otherwise 00891 * errQUEUE_FULL. 00892 * 00893 * Example usage for buffered IO (where the ISR can obtain more than one value 00894 * per call): 00895 <pre> 00896 void vBufferISR( void ) 00897 { 00898 char cIn; 00899 portBASE_TYPE xHigherPriorityTaskWoken; 00900 00901 // We have not woken a task at the start of the ISR. 00902 xHigherPriorityTaskWoken = pdFALSE; 00903 00904 // Loop until the buffer is empty. 00905 do 00906 { 00907 // Obtain a byte from the buffer. 00908 cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); 00909 00910 // Post the byte. 00911 xQueueSendToBackFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); 00912 00913 } while( portINPUT_BYTE( BUFFER_COUNT ) ); 00914 00915 // Now the buffer is empty we can switch context if necessary. 00916 if( xHigherPriorityTaskWoken ) 00917 { 00918 taskYIELD (); 00919 } 00920 } 00921 </pre> 00922 * 00923 * \defgroup xQueueSendFromISR xQueueSendFromISR 00924 * \ingroup QueueManagement 00925 */ 00926 #define xQueueSendToBackFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_BACK ) 00927 00928 /** 00929 * queue. h 00930 * <pre> 00931 portBASE_TYPE xQueueSendFromISR( 00932 xQueueHandle pxQueue, 00933 const void *pvItemToQueue, 00934 portBASE_TYPE *pxHigherPriorityTaskWoken 00935 ); 00936 </pre> 00937 * 00938 * This is a macro that calls xQueueGenericSendFromISR(). It is included 00939 * for backward compatibility with versions of FreeRTOS.org that did not 00940 * include the xQueueSendToBackFromISR() and xQueueSendToFrontFromISR() 00941 * macros. 00942 * 00943 * Post an item to the back of a queue. It is safe to use this function from 00944 * within an interrupt service routine. 00945 * 00946 * Items are queued by copy not reference so it is preferable to only 00947 * queue small items, especially when called from an ISR. In most cases 00948 * it would be preferable to store a pointer to the item being queued. 00949 * 00950 * @param xQueue The handle to the queue on which the item is to be posted. 00951 * 00952 * @param pvItemToQueue A pointer to the item that is to be placed on the 00953 * queue. The size of the items the queue will hold was defined when the 00954 * queue was created, so this many bytes will be copied from pvItemToQueue 00955 * into the queue storage area. 00956 * 00957 * @param pxHigherPriorityTaskWoken xQueueSendFromISR() will set 00958 * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task 00959 * to unblock, and the unblocked task has a priority higher than the currently 00960 * running task. If xQueueSendFromISR() sets this value to pdTRUE then 00961 * a context switch should be requested before the interrupt is exited. 00962 * 00963 * @return pdTRUE if the data was successfully sent to the queue, otherwise 00964 * errQUEUE_FULL. 00965 * 00966 * Example usage for buffered IO (where the ISR can obtain more than one value 00967 * per call): 00968 <pre> 00969 void vBufferISR( void ) 00970 { 00971 char cIn; 00972 portBASE_TYPE xHigherPriorityTaskWoken; 00973 00974 // We have not woken a task at the start of the ISR. 00975 xHigherPriorityTaskWoken = pdFALSE; 00976 00977 // Loop until the buffer is empty. 00978 do 00979 { 00980 // Obtain a byte from the buffer. 00981 cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); 00982 00983 // Post the byte. 00984 xQueueSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWoken ); 00985 00986 } while( portINPUT_BYTE( BUFFER_COUNT ) ); 00987 00988 // Now the buffer is empty we can switch context if necessary. 00989 if( xHigherPriorityTaskWoken ) 00990 { 00991 // Actual macro used here is port specific. 00992 taskYIELD_FROM_ISR (); 00993 } 00994 } 00995 </pre> 00996 * 00997 * \defgroup xQueueSendFromISR xQueueSendFromISR 00998 * \ingroup QueueManagement 00999 */ 01000 #define xQueueSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken ) xQueueGenericSendFromISR( pxQueue, pvItemToQueue, pxHigherPriorityTaskWoken, queueSEND_TO_BACK ) 01001 01002 /** 01003 * queue. h 01004 * <pre> 01005 portBASE_TYPE xQueueGenericSendFromISR( 01006 xQueueHandle pxQueue, 01007 const void *pvItemToQueue, 01008 portBASE_TYPE *pxHigherPriorityTaskWoken, 01009 portBASE_TYPE xCopyPosition 01010 ); 01011 </pre> 01012 * 01013 * It is preferred that the macros xQueueSendFromISR(), 01014 * xQueueSendToFrontFromISR() and xQueueSendToBackFromISR() be used in place 01015 * of calling this function directly. 01016 * 01017 * Post an item on a queue. It is safe to use this function from within an 01018 * interrupt service routine. 01019 * 01020 * Items are queued by copy not reference so it is preferable to only 01021 * queue small items, especially when called from an ISR. In most cases 01022 * it would be preferable to store a pointer to the item being queued. 01023 * 01024 * @param xQueue The handle to the queue on which the item is to be posted. 01025 * 01026 * @param pvItemToQueue A pointer to the item that is to be placed on the 01027 * queue. The size of the items the queue will hold was defined when the 01028 * queue was created, so this many bytes will be copied from pvItemToQueue 01029 * into the queue storage area. 01030 * 01031 * @param pxHigherPriorityTaskWoken xQueueGenericSendFromISR() will set 01032 * *pxHigherPriorityTaskWoken to pdTRUE if sending to the queue caused a task 01033 * to unblock, and the unblocked task has a priority higher than the currently 01034 * running task. If xQueueGenericSendFromISR() sets this value to pdTRUE then 01035 * a context switch should be requested before the interrupt is exited. 01036 * 01037 * @param xCopyPosition Can take the value queueSEND_TO_BACK to place the 01038 * item at the back of the queue, or queueSEND_TO_FRONT to place the item 01039 * at the front of the queue (for high priority messages). 01040 * 01041 * @return pdTRUE if the data was successfully sent to the queue, otherwise 01042 * errQUEUE_FULL. 01043 * 01044 * Example usage for buffered IO (where the ISR can obtain more than one value 01045 * per call): 01046 <pre> 01047 void vBufferISR( void ) 01048 { 01049 char cIn; 01050 portBASE_TYPE xHigherPriorityTaskWokenByPost; 01051 01052 // We have not woken a task at the start of the ISR. 01053 xHigherPriorityTaskWokenByPost = pdFALSE; 01054 01055 // Loop until the buffer is empty. 01056 do 01057 { 01058 // Obtain a byte from the buffer. 01059 cIn = portINPUT_BYTE( RX_REGISTER_ADDRESS ); 01060 01061 // Post each byte. 01062 xQueueGenericSendFromISR( xRxQueue, &cIn, &xHigherPriorityTaskWokenByPost, queueSEND_TO_BACK ); 01063 01064 } while( portINPUT_BYTE( BUFFER_COUNT ) ); 01065 01066 // Now the buffer is empty we can switch context if necessary. Note that the 01067 // name of the yield function required is port specific. 01068 if( xHigherPriorityTaskWokenByPost ) 01069 { 01070 taskYIELD_YIELD_FROM_ISR(); 01071 } 01072 } 01073 </pre> 01074 * 01075 * \defgroup xQueueSendFromISR xQueueSendFromISR 01076 * \ingroup QueueManagement 01077 */ 01078 signed portBASE_TYPE xQueueGenericSendFromISR( xQueueHandle pxQueue, const void * const pvItemToQueue, signed portBASE_TYPE *pxHigherPriorityTaskWoken, portBASE_TYPE xCopyPosition ); 01079 01080 /** 01081 * queue. h 01082 * <pre> 01083 portBASE_TYPE xQueueReceiveFromISR( 01084 xQueueHandle pxQueue, 01085 void *pvBuffer, 01086 portBASE_TYPE *pxTaskWoken 01087 ); 01088 * </pre> 01089 * 01090 * Receive an item from a queue. It is safe to use this function from within an 01091 * interrupt service routine. 01092 * 01093 * @param pxQueue The handle to the queue from which the item is to be 01094 * received. 01095 * 01096 * @param pvBuffer Pointer to the buffer into which the received item will 01097 * be copied. 01098 * 01099 * @param pxTaskWoken A task may be blocked waiting for space to become 01100 * available on the queue. If xQueueReceiveFromISR causes such a task to 01101 * unblock *pxTaskWoken will get set to pdTRUE, otherwise *pxTaskWoken will 01102 * remain unchanged. 01103 * 01104 * @return pdTRUE if an item was successfully received from the queue, 01105 * otherwise pdFALSE. 01106 * 01107 * Example usage: 01108 <pre> 01109 01110 xQueueHandle xQueue; 01111 01112 // Function to create a queue and post some values. 01113 void vAFunction( void *pvParameters ) 01114 { 01115 char cValueToPost; 01116 const portTickType xBlockTime = ( portTickType )0xff; 01117 01118 // Create a queue capable of containing 10 characters. 01119 xQueue = xQueueCreate( 10, sizeof( char ) ); 01120 if( xQueue == 0 ) 01121 { 01122 // Failed to create the queue. 01123 } 01124 01125 // ... 01126 01127 // Post some characters that will be used within an ISR. If the queue 01128 // is full then this task will block for xBlockTime ticks. 01129 cValueToPost = 'a'; 01130 xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); 01131 cValueToPost = 'b'; 01132 xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); 01133 01134 // ... keep posting characters ... this task may block when the queue 01135 // becomes full. 01136 01137 cValueToPost = 'c'; 01138 xQueueSend( xQueue, ( void * ) &cValueToPost, xBlockTime ); 01139 } 01140 01141 // ISR that outputs all the characters received on the queue. 01142 void vISR_Routine( void ) 01143 { 01144 portBASE_TYPE xTaskWokenByReceive = pdFALSE; 01145 char cRxedChar; 01146 01147 while( xQueueReceiveFromISR( xQueue, ( void * ) &cRxedChar, &xTaskWokenByReceive) ) 01148 { 01149 // A character was received. Output the character now. 01150 vOutputCharacter( cRxedChar ); 01151 01152 // If removing the character from the queue woke the task that was 01153 // posting onto the queue cTaskWokenByReceive will have been set to 01154 // pdTRUE. No matter how many times this loop iterates only one 01155 // task will be woken. 01156 } 01157 01158 if( cTaskWokenByPost != ( char ) pdFALSE; 01159 { 01160 taskYIELD (); 01161 } 01162 } 01163 </pre> 01164 * \defgroup xQueueReceiveFromISR xQueueReceiveFromISR 01165 * \ingroup QueueManagement 01166 */ 01167 signed portBASE_TYPE xQueueReceiveFromISR( xQueueHandle pxQueue, void * const pvBuffer, signed portBASE_TYPE *pxTaskWoken ); 01168 01169 /* 01170 * Utilities to query queue that are safe to use from an ISR. These utilities 01171 * should be used only from witin an ISR, or within a critical section. 01172 */ 01173 signed portBASE_TYPE xQueueIsQueueEmptyFromISR( const xQueueHandle pxQueue ); 01174 signed portBASE_TYPE xQueueIsQueueFullFromISR( const xQueueHandle pxQueue ); 01175 unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle pxQueue ); 01176 01177 01178 /* 01179 * xQueueAltGenericSend() is an alternative version of xQueueGenericSend(). 01180 * Likewise xQueueAltGenericReceive() is an alternative version of 01181 * xQueueGenericReceive(). 01182 * 01183 * The source code that implements the alternative (Alt) API is much 01184 * simpler because it executes everything from within a critical section. 01185 * This is the approach taken by many other RTOSes, but FreeRTOS.org has the 01186 * preferred fully featured API too. The fully featured API has more 01187 * complex code that takes longer to execute, but makes much less use of 01188 * critical sections. Therefore the alternative API sacrifices interrupt 01189 * responsiveness to gain execution speed, whereas the fully featured API 01190 * sacrifices execution speed to ensure better interrupt responsiveness. 01191 */ 01192 signed portBASE_TYPE xQueueAltGenericSend( xQueueHandle pxQueue, const void * const pvItemToQueue, portTickType xTicksToWait, portBASE_TYPE xCopyPosition ); 01193 signed portBASE_TYPE xQueueAltGenericReceive( xQueueHandle pxQueue, void * const pvBuffer, portTickType xTicksToWait, portBASE_TYPE xJustPeeking ); 01194 #define xQueueAltSendToFront( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( xQueue, pvItemToQueue, xTicksToWait, queueSEND_TO_FRONT ) 01195 #define xQueueAltSendToBack( xQueue, pvItemToQueue, xTicksToWait ) xQueueAltGenericSend( xQueue, pvItemToQueue, xTicksToWait, queueSEND_TO_BACK ) 01196 #define xQueueAltReceive( xQueue, pvBuffer, xTicksToWait ) xQueueAltGenericReceive( xQueue, pvBuffer, xTicksToWait, pdFALSE ) 01197 #define xQueueAltPeek( xQueue, pvBuffer, xTicksToWait ) xQueueAltGenericReceive( xQueue, pvBuffer, xTicksToWait, pdTRUE ) 01198 01199 /* 01200 * The functions defined above are for passing data to and from tasks. The 01201 * functions below are the equivalents for passing data to and from 01202 * co-routines. 01203 * 01204 * These functions are called from the co-routine macro implementation and 01205 * should not be called directly from application code. Instead use the macro 01206 * wrappers defined within croutine.h. 01207 */ 01208 signed portBASE_TYPE xQueueCRSendFromISR( xQueueHandle pxQueue, const void *pvItemToQueue, signed portBASE_TYPE xCoRoutinePreviouslyWoken ); 01209 signed portBASE_TYPE xQueueCRReceiveFromISR( xQueueHandle pxQueue, void *pvBuffer, signed portBASE_TYPE *pxTaskWoken ); 01210 signed portBASE_TYPE xQueueCRSend( xQueueHandle pxQueue, const void *pvItemToQueue, portTickType xTicksToWait ); 01211 signed portBASE_TYPE xQueueCRReceive( xQueueHandle pxQueue, void *pvBuffer, portTickType xTicksToWait ); 01212 01213 /* 01214 * For internal use only. Use xSemaphoreCreateMutex() or 01215 * xSemaphoreCreateCounting() instead of calling these functions directly. 01216 */ 01217 xQueueHandle xQueueCreateMutex( void ); 01218 xQueueHandle xQueueCreateCountingSemaphore( unsigned portBASE_TYPE uxCountValue, unsigned portBASE_TYPE uxInitialCount ); 01219 01220 /* 01221 * For internal use only. Use xSemaphoreTakeMutexRecursive() or 01222 * xSemaphoreGiveMutexRecursive() instead of calling these functions directly. 01223 */ 01224 portBASE_TYPE xQueueTakeMutexRecursive( xQueueHandle xMutex, portTickType xBlockTime ); 01225 portBASE_TYPE xQueueGiveMutexRecursive( xQueueHandle xMutex ); 01226 01227 /* 01228 * The registry is provided as a means for kernel aware debuggers to 01229 * locate queues, semaphores and mutexes. Call vQueueAddToRegistry() add 01230 * a queue, semaphore or mutex handle to the registry if you want the handle 01231 * to be available to a kernel aware debugger. If you are not using a kernel 01232 * aware debugger then this function can be ignored. 01233 * 01234 * configQUEUE_REGISTRY_SIZE defines the maximum number of handles the 01235 * registry can hold. configQUEUE_REGISTRY_SIZE must be greater than 0 01236 * within FreeRTOSConfig.h for the registry to be available. Its value 01237 * does not effect the number of queues, semaphores and mutexes that can be 01238 * created - just the number that the registry can hold. 01239 * 01240 * @param xQueue The handle of the queue being added to the registry. This 01241 * is the handle returned by a call to xQueueCreate(). Semaphore and mutex 01242 * handles can also be passed in here. 01243 * 01244 * @param pcName The name to be associated with the handle. This is the 01245 * name that the kernel aware debugger will display. 01246 */ 01247 //#if configQUEUE_REGISTRY_SIZE > 0 01248 void vQueueAddToRegistry( xQueueHandle xQueue, signed char *pcName ); 01249 //#endif 01250 01251 01252 01253 01254 #ifdef __cplusplus 01255 } 01256 #endif 01257 01258 #endif /* QUEUE_H */ 01259
Generated on Fri Jul 15 2022 10:21:25 by
1.7.2
