1.1.9.4.12 DRV_USART_WriteQueuePurge Function
C
bool DRV_USART_WriteQueuePurge( const DRV_HANDLE handle )
Summary
Removes all write requests from the queue for the given client. This API does not abort the on-going write transfer.
Description
This function removes all the buffer requests from the queue. The client can use this function to purge the queue on timeout or to remove unwanted stalled buffer requests or in any other use case.
Precondition
DRV_USART_Open must have been called to obtain a valid opened device handle.
Parameters
Param | Description |
---|---|
handle | Handle of the communication channel as returned by the DRV_USART_Open function. |
Returns
true - Write queue purge is successful.
false - Write queue purge has failed.
Example
// myUSARTHandle is the handle returned by the DRV_USART_Open function.
// Use DRV_USART_WriteBufferAdd to queue write requests
// Application timeout function, where remove queued buffers.
void APP_TimeOut(void)
{
if(DRV_USART_WriteQueuePurge(myUSARThandle) == false)
{
//Couldn't purge the write queue, try again.
}
else
{
//Queue purge successful.
}
}
Remarks
This function is thread safe when used in an RTOS environment. Avoid this function call from within the callback. This function does not abort the on-going write transfer.