MCPcopy Create free account
hub / github.com/FreeRTOS/FreeRTOS-Kernel / prvInitialiseNewQueue

Function prvInitialiseNewQueue

queue.c:446–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444/*-----------------------------------------------------------*/
445
446static void prvInitialiseNewQueue( const UBaseType_t uxQueueLength,
447 const UBaseType_t uxItemSize,
448 uint8_t * pucQueueStorage,
449 const uint8_t ucQueueType,
450 Queue_t * pxNewQueue )
451{
452 /* Remove compiler warnings about unused parameters should
453 * configUSE_TRACE_FACILITY not be set to 1. */
454 ( void ) ucQueueType;
455
456 if( uxItemSize == ( UBaseType_t ) 0 )
457 {
458 /* No RAM was allocated for the queue storage area, but PC head cannot
459 * be set to NULL because NULL is used as a key to say the queue is used as
460 * a mutex. Therefore just set pcHead to point to the queue as a benign
461 * value that is known to be within the memory map. */
462 pxNewQueue->pcHead = ( int8_t * ) pxNewQueue;
463 }
464 else
465 {
466 /* Set the head to the start of the queue storage area. */
467 pxNewQueue->pcHead = ( int8_t * ) pucQueueStorage;
468 }
469
470 /* Initialise the queue members as described where the queue type is
471 * defined. */
472 pxNewQueue->uxLength = uxQueueLength;
473 pxNewQueue->uxItemSize = uxItemSize;
474 ( void ) xQueueGenericReset( pxNewQueue, pdTRUE );
475
476 #if ( configUSE_TRACE_FACILITY == 1 )
477 {
478 pxNewQueue->ucQueueType = ucQueueType;
479 }
480 #endif /* configUSE_TRACE_FACILITY */
481
482 #if ( configUSE_QUEUE_SETS == 1 )
483 {
484 pxNewQueue->pxQueueSetContainer = NULL;
485 }
486 #endif /* configUSE_QUEUE_SETS */
487
488 traceQUEUE_CREATE( pxNewQueue );
489}
490/*-----------------------------------------------------------*/
491
492#if ( configUSE_MUTEXES == 1 )

Callers 2

xQueueGenericCreateFunction · 0.85

Calls 1

xQueueGenericResetFunction · 0.85

Tested by

no test coverage detected