1.26.4.17 DBGU_ReadCountGet Function
C
/* Non-blocking and ring buffer mode */
size_t DBGU_ReadCountGet( void )
Summary
Non-blocking mode
Gets the byte count of processed bytes for a given DBGU read operation
Ring buffer mode
Returns the number of bytes available in the internal receive buffer of the PLIB
Description
Non-blocking mode
This function gets the count of processed bytes for an on-going or last completed DBGU Read operation. This function can be used to track the progress of the non-blocking read operation. In case of an error, this function can be used to track the number of bytes that were received before the error occurred.
Ring buffer mode
This function returns the number of bytes available in the receive buffer
Precondition
DBGU_Initialize must have been called for the associated DBGU instance.
Parameters
None.
Returns
Non-blocking mode
Returns count of bytes completed/processed to the current Receive buffer.
Ring buffer mode
The API returns the number of bytes pending to be read out from the receive buffer.
Example
Non-blocking mode
size_t count; count = DBGU_ReadCountGet(); if(count < COUNT_EXPECTED) { //More bytes are expected, wait }
Ring buffer mode
uint8_t rxBuffer[100]; uint32_t nBytesAvailable; nBytesAvailable = DBGU_ReadCountGet(); if (nBytesAvailable != 0) { DBGU_Read((uint8_t*)rxBuffer, nBytesAvailable) }
Remarks
None