1.1.9.4.14 DRV_USART_ReadAbort Function

C

bool DRV_USART_ReadAbort(const DRV_HANDLE handle)

Summary

Aborts an on-going read request

Description

This function aborts an on-going read transfer. No callback is given for the on-going request being aborted. When USART is configured for non-dma transfers, application may call the DRV_USART_BufferCompletedBytesGet() API (before calling the DRV_USART_ReadAbort API)to find out how many bytes have been received for the on-going read request.

Precondition

DRV_USART_Open must have been called to obtain a valid opened device handle.

Parameters

ParamDescription
handleHandle of the communication channel as return by the DRV_USART_Open function.

Returns

true - operation was successful

false - error in running the API

Example

// myUSARTHandle is the handle returned
// by the DRV_USART_Open function.

// For non-DMA based transfers DRV_USART_BufferCompletedBytesGet() can be
// called to find out the number of bytes received before aborting the
// request.

uint32_t processedBytes;

processedBytes= DRV_USART_BufferCompletedBytesGet(bufferHandle);

DRV_USART_ReadAbort(myUSARTHandle);

Remarks

This function is thread safe in a RTOS application. Calling this function does not have any impact on the read/write requests that may be pending in the transfer queue. To purge the read/write request queues call the DRV_USART_ReadQueuePurge() and DRV_USART_WriteQueuePurge() APIs.