72 #define MPU_WRAPPERS_INCLUDED_FROM_API_FILE
78 #if ( configUSE_CO_ROUTINES == 1 )
86 #undef MPU_WRAPPERS_INCLUDED_FROM_API_FILE
90 #define queueUNLOCKED ( ( signed portBASE_TYPE ) -1 )
91 #define queueLOCKED_UNMODIFIED ( ( signed portBASE_TYPE ) 0 )
104 #define pxMutexHolder pcTail
105 #define uxQueueType pcHead
106 #define queueQUEUE_IS_MUTEX NULL
110 #define queueSEMAPHORE_QUEUE_ITEM_LENGTH ( ( unsigned portBASE_TYPE ) 0 )
111 #define queueMUTEX_GIVE_BLOCK_TIME ( ( portTickType ) 0U )
141 #if ( configUSE_TRACE_FACILITY == 1 )
142 unsigned char ucQueueNumber;
143 unsigned char ucQueueType;
146 #if ( configUSE_QUEUE_SETS == 1 )
157 #if ( configQUEUE_REGISTRY_SIZE > 0 )
162 typedef struct QUEUE_REGISTRY_ITEM
164 signed char *pcQueueName;
166 } xQueueRegistryItem;
210 #if ( configUSE_QUEUE_SETS == 1 )
224 #define prvLockQueue( pxQueue ) \
225 taskENTER_CRITICAL(); \
227 if( ( pxQueue )->xRxLock == queueUNLOCKED ) \
229 ( pxQueue )->xRxLock = queueLOCKED_UNMODIFIED; \
231 if( ( pxQueue )->xTxLock == queueUNLOCKED ) \
233 ( pxQueue )->xTxLock = queueLOCKED_UNMODIFIED; \
287 size_t xQueueSizeInBytes;
292 ( void ) ucQueueType;
298 if( pxNewQueue !=
NULL )
302 xQueueSizeInBytes = ( size_t ) ( uxQueueLength * uxItemSize ) + ( size_t ) 1;
309 pxNewQueue->
uxLength = uxQueueLength;
313 #if ( configUSE_TRACE_FACILITY == 1 )
315 pxNewQueue->ucQueueType = ucQueueType;
319 #if( configUSE_QUEUE_SETS == 1 )
321 pxNewQueue->pxQueueSetContainer =
NULL;
326 xReturn = pxNewQueue;
342 #if ( configUSE_MUTEXES == 1 )
350 ( void ) ucQueueType;
354 if( pxNewQueue !=
NULL )
357 pxNewQueue->pxMutexHolder =
NULL;
374 #if ( configUSE_TRACE_FACILITY == 1 )
376 pxNewQueue->ucQueueType = ucQueueType;
380 #if ( configUSE_QUEUE_SETS == 1 )
382 pxNewQueue->pxQueueSetContainer =
NULL;
407 #if ( ( configUSE_MUTEXES == 1 ) && ( INCLUDE_xSemaphoreGetMutexHolder == 1 ) )
437 #if ( configUSE_RECURSIVE_MUTEXES == 1 )
487 #if ( configUSE_RECURSIVE_MUTEXES == 1 )
528 #if ( configUSE_COUNTING_SEMAPHORES == 1 )
536 if( xHandle !=
NULL )
538 ( (
xQUEUE * ) xHandle )->uxMessagesWaiting = uxInitialCount;
578 prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
580 #if ( configUSE_QUEUE_SETS == 1 )
582 if( pxQueue->pxQueueSetContainer !=
NULL )
584 if( prvNotifyQueueSetContainer( pxQueue, xCopyPosition ) ==
pdTRUE )
646 else if( xEntryTimeSet ==
pdFALSE )
670 if( prvIsQueueFull( pxQueue ) !=
pdFALSE )
680 prvUnlockQueue( pxQueue );
695 prvUnlockQueue( pxQueue );
702 prvUnlockQueue( pxQueue );
714 #if ( configUSE_ALTERNATIVE_API == 1 )
734 prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
758 else if( xEntryTimeSet ==
pdFALSE )
771 if( prvIsQueueFull( pxQueue ) !=
pdFALSE )
792 #if ( configUSE_ALTERNATIVE_API == 1 )
798 signed char *pcOriginalReadPosition;
813 prvCopyDataFromQueue( pxQueue, pvBuffer );
822 #if ( configUSE_MUTEXES == 1 )
875 else if( xEntryTimeSet ==
pdFALSE )
888 if( prvIsQueueEmpty( pxQueue ) !=
pdFALSE )
892 #if ( configUSE_MUTEXES == 1 )
926 signed portBASE_TYPE xReturn;
927 unsigned portBASE_TYPE uxSavedInterruptStatus;
961 prvCopyDataToQueue( pxQueue, pvItemToQueue, xCopyPosition );
967 #if ( configUSE_QUEUE_SETS == 1 )
969 if( pxQueue->pxQueueSetContainer !=
NULL )
971 if( prvNotifyQueueSetContainer( pxQueue, xCopyPosition ) ==
pdTRUE )
976 if( pxHigherPriorityTaskWoken !=
NULL )
978 *pxHigherPriorityTaskWoken =
pdTRUE;
990 if( pxHigherPriorityTaskWoken !=
NULL )
992 *pxHigherPriorityTaskWoken =
pdTRUE;
1006 if( pxHigherPriorityTaskWoken !=
NULL )
1008 *pxHigherPriorityTaskWoken =
pdTRUE;
1038 signed portBASE_TYPE xEntryTimeSet =
pdFALSE;
1040 signed char *pcOriginalReadPosition;
1062 prvCopyDataFromQueue( pxQueue, pvBuffer );
1071 #if ( configUSE_MUTEXES == 1 )
1125 else if( xEntryTimeSet ==
pdFALSE )
1149 if( prvIsQueueEmpty( pxQueue ) !=
pdFALSE )
1153 #if ( configUSE_MUTEXES == 1 )
1167 prvUnlockQueue( pxQueue );
1176 prvUnlockQueue( pxQueue );
1182 prvUnlockQueue( pxQueue );
1193 signed portBASE_TYPE xReturn;
1194 unsigned portBASE_TYPE uxSavedInterruptStatus;
1223 prvCopyDataFromQueue( pxQueue, pvBuffer );
1238 if( pxHigherPriorityTaskWoken !=
NULL )
1240 *pxHigherPriorityTaskWoken =
pdTRUE;
1268 signed portBASE_TYPE xReturn;
1269 unsigned portBASE_TYPE uxSavedInterruptStatus;
1270 signed char *pcOriginalReadPosition;
1302 prvCopyDataFromQueue( pxQueue, pvBuffer );
1321 unsigned portBASE_TYPE uxReturn;
1326 uxReturn = ( (
xQUEUE * ) xQueue )->uxMessagesWaiting;
1335 unsigned portBASE_TYPE uxReturn;
1338 pxQueue = (
xQUEUE * ) xQueue;
1351 unsigned portBASE_TYPE uxReturn;
1355 uxReturn = ( (
xQUEUE * ) xQueue )->uxMessagesWaiting;
1368 #if ( configQUEUE_REGISTRY_SIZE > 0 )
1378 #if ( configUSE_TRACE_FACILITY == 1 )
1382 return ( (
xQUEUE * ) xQueue )->ucQueueNumber;
1388 #if ( configUSE_TRACE_FACILITY == 1 )
1392 ( (
xQUEUE * ) xQueue )->ucQueueNumber = ucQueueNumber;
1398 #if ( configUSE_TRACE_FACILITY == 1 )
1402 return ( (
xQUEUE * ) xQueue )->ucQueueType;
1408 static void prvCopyDataToQueue(
xQUEUE *pxQueue,
const void *pvItemToQueue, portBASE_TYPE xPosition )
1410 if( pxQueue->
uxItemSize == (
unsigned portBASE_TYPE ) 0 )
1412 #if ( configUSE_MUTEXES == 1 )
1418 pxQueue->pxMutexHolder =
NULL;
1425 ( void ) memcpy( (
void * ) pxQueue->
pcWriteTo, pvItemToQueue, ( size_t ) pxQueue->
uxItemSize );
1458 static void prvCopyDataFromQueue(
xQUEUE *
const pxQueue,
const void *
const pvBuffer )
1467 ( void ) memcpy( (
void * ) pvBuffer, (
void * ) pxQueue->
u.
pcReadFrom, (
size_t ) pxQueue->
uxItemSize );
1472 static void prvUnlockQueue(
xQUEUE *pxQueue )
1487 #if ( configUSE_QUEUE_SETS == 1 )
1489 if( pxQueue->pxQueueSetContainer !=
NULL )
1571 static signed portBASE_TYPE prvIsQueueEmpty(
const xQUEUE *pxQueue )
1573 signed portBASE_TYPE xReturn;
1594 signed portBASE_TYPE xReturn;
1597 if( ( (
xQUEUE * ) xQueue )->uxMessagesWaiting == (
unsigned portBASE_TYPE ) 0 )
1610 static signed portBASE_TYPE prvIsQueueFull(
const xQUEUE *pxQueue )
1612 signed portBASE_TYPE xReturn;
1633 signed portBASE_TYPE xReturn;
1636 if( ( (
xQUEUE * ) xQueue )->uxMessagesWaiting == ( (
xQUEUE * ) xQueue )->uxLength )
1649 #if ( configUSE_CO_ROUTINES == 1 )
1653 signed portBASE_TYPE xReturn;
1661 if( prvIsQueueFull( pxQueue ) !=
pdFALSE )
1718 #if ( configUSE_CO_ROUTINES == 1 )
1722 signed portBASE_TYPE xReturn;
1762 ( void ) memcpy( (
void * ) pvBuffer, (
void * ) pxQueue->
u.
pcReadFrom, (
unsigned ) pxQueue->
uxItemSize );
1792 #if ( configUSE_CO_ROUTINES == 1 )
1806 if( xCoRoutinePreviouslyWoken ==
pdFALSE )
1818 return xCoRoutinePreviouslyWoken;
1824 #if ( configUSE_CO_ROUTINES == 1 )
1828 signed portBASE_TYPE xReturn;
1842 ( void ) memcpy( (
void * ) pvBuffer, (
void * ) pxQueue->
u.
pcReadFrom, (
unsigned ) pxQueue->
uxItemSize );
1844 if( ( *pxCoRoutineWoken ) ==
pdFALSE )
1850 *pxCoRoutineWoken =
pdTRUE;
1868 #if ( configQUEUE_REGISTRY_SIZE > 0 )
1872 unsigned portBASE_TYPE ux;
1878 if( xQueueRegistry[ ux ].pcQueueName ==
NULL )
1881 xQueueRegistry[ ux ].pcQueueName = pcQueueName;
1882 xQueueRegistry[ ux ].xHandle = xQueue;
1891 #if ( configQUEUE_REGISTRY_SIZE > 0 )
1895 unsigned portBASE_TYPE ux;
1901 if( xQueueRegistry[ ux ].xHandle == xQueue )
1904 xQueueRegistry[ ux ].pcQueueName =
NULL;
1914 #if ( configUSE_TIMERS == 1 )
1940 prvUnlockQueue( pxQueue );
1946 #if ( configUSE_QUEUE_SETS == 1 )
1960 #if ( configUSE_QUEUE_SETS == 1 )
1964 portBASE_TYPE xReturn;
1966 if( ( (
xQUEUE * ) xQueueOrSemaphore )->pxQueueSetContainer !=
NULL )
1971 else if( ( (
xQUEUE * ) xQueueOrSemaphore )->uxMessagesWaiting != (
unsigned portBASE_TYPE ) 0 )
1981 ( (
xQUEUE * ) xQueueOrSemaphore )->pxQueueSetContainer = xQueueSet;
1993 #if ( configUSE_QUEUE_SETS == 1 )
1997 portBASE_TYPE xReturn;
1998 xQUEUE *
const pxQueueOrSemaphore = (
xQUEUE * ) xQueueOrSemaphore;
2000 if( pxQueueOrSemaphore->pxQueueSetContainer != xQueueSet )
2005 else if( pxQueueOrSemaphore->
uxMessagesWaiting != (
unsigned portBASE_TYPE ) 0 )
2017 pxQueueOrSemaphore->pxQueueSetContainer =
NULL;
2029 #if ( configUSE_QUEUE_SETS == 1 )
2042 #if ( configUSE_QUEUE_SETS == 1 )
2055 #if ( configUSE_QUEUE_SETS == 1 )
2057 static portBASE_TYPE prvNotifyQueueSetContainer(
const xQUEUE *
const pxQueue, portBASE_TYPE xCopyPosition )
2059 xQUEUE *pxQueueSetContainer = pxQueue->pxQueueSetContainer;
2060 portBASE_TYPE xReturn =
pdFALSE;
2069 prvCopyDataToQueue( pxQueueSetContainer, &pxQueue, xCopyPosition );