mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-04-20 05:21:59 -04:00
Add the uxQueueSpacesAvailable() API function.
Move a configASSERT() call in timers.c to prevent a "condition is always true" compiler warning.
This commit is contained in:
parent
dd3fdfa9ff
commit
1902d2b64a
|
@ -922,6 +922,23 @@ signed portBASE_TYPE xQueueGenericReceive( xQueueHandle xQueue, const void * con
|
||||||
*/
|
*/
|
||||||
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
unsigned portBASE_TYPE uxQueueMessagesWaiting( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* queue. h
|
||||||
|
* <pre>unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue );</pre>
|
||||||
|
*
|
||||||
|
* Return the number of free spaces available in a queue. This is equal to the
|
||||||
|
* number of items that can be sent to the queue before the queue becomes full
|
||||||
|
* if no items are removed.
|
||||||
|
*
|
||||||
|
* @param xQueue A handle to the queue being queried.
|
||||||
|
*
|
||||||
|
* @return The number of spaces available in the queue.
|
||||||
|
*
|
||||||
|
* \defgroup uxQueueMessagesWaiting uxQueueMessagesWaiting
|
||||||
|
* \ingroup QueueManagement
|
||||||
|
*/
|
||||||
|
unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue ) PRIVILEGED_FUNCTION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* queue. h
|
* queue. h
|
||||||
* <pre>void vQueueDelete( xQueueHandle xQueue );</pre>
|
* <pre>void vQueueDelete( xQueueHandle xQueue );</pre>
|
||||||
|
|
|
@ -1329,6 +1329,22 @@ unsigned portBASE_TYPE uxReturn;
|
||||||
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
|
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
|
unsigned portBASE_TYPE uxQueueSpacesAvailable( const xQueueHandle xQueue )
|
||||||
|
{
|
||||||
|
unsigned portBASE_TYPE uxReturn;
|
||||||
|
xQUEUE *pxQueue;
|
||||||
|
|
||||||
|
pxQueue = ( xQUEUE * ) xQueue;
|
||||||
|
configASSERT( pxQueue );
|
||||||
|
|
||||||
|
taskENTER_CRITICAL();
|
||||||
|
uxReturn = pxQueue->uxLength - pxQueue->uxMessagesWaiting;
|
||||||
|
taskEXIT_CRITICAL();
|
||||||
|
|
||||||
|
return uxReturn;
|
||||||
|
} /*lint !e818 Pointer cannot be declared const as xQueue is a typedef not pointer. */
|
||||||
|
/*-----------------------------------------------------------*/
|
||||||
|
|
||||||
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )
|
unsigned portBASE_TYPE uxQueueMessagesWaitingFromISR( const xQueueHandle xQueue )
|
||||||
{
|
{
|
||||||
unsigned portBASE_TYPE uxReturn;
|
unsigned portBASE_TYPE uxReturn;
|
||||||
|
|
|
@ -233,7 +233,6 @@ xTIMER *pxNewTimer;
|
||||||
if( xTimerPeriodInTicks == ( portTickType ) 0U )
|
if( xTimerPeriodInTicks == ( portTickType ) 0U )
|
||||||
{
|
{
|
||||||
pxNewTimer = NULL;
|
pxNewTimer = NULL;
|
||||||
configASSERT( ( xTimerPeriodInTicks > 0 ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -260,6 +259,9 @@ xTIMER *pxNewTimer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 0 is not a valid value for xTimerPeriodInTicks. */
|
||||||
|
configASSERT( ( xTimerPeriodInTicks > 0 ) );
|
||||||
|
|
||||||
return ( xTimerHandle ) pxNewTimer;
|
return ( xTimerHandle ) pxNewTimer;
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------*/
|
/*-----------------------------------------------------------*/
|
||||||
|
|
Loading…
Reference in a new issue