1.1.10.4.14 DRV_USART_ReadAbort Function

1.1.10.4.14 C

bool DRV_USART_ReadAbort(const DRV_HANDLE handle)

1.1.10.4.14 Summary

Aborts an on-going read request.

1.1.10.4.14 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.

1.1.10.4.14 Precondition

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

1.1.10.4.14 Parameters

ParametersDescription
handleHandle of the communication channel as return by the DRV_USART_Open function

1.1.10.4.14 Returns

True - Operation was successful.

False - Error in running the API.

1.1.10.4.14 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);

1.1.10.4.14 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.