/* Get the length of received data in RX ring buffer.  */
static size_t UART_TransferGetRxRingBufferLength(uart_handle_t *handle)
/* Get the length of received data in RX ring buffer.  */
static size_t UART_TransferGetRxRingBufferLength(uart_handle_t *handle)
{
    size_t size;
    if (handle->rxRingBufferTail > handle->rxRingBufferHead)
    {
        size = (size_t)(handle->rxRingBufferHead + handle->rxRingBufferSize - handle->rxRingBufferTail);
    }
    else
    {
        size = (size_t)(handle->rxRingBufferHead - handle->rxRingBufferTail);
    }
    return size;
}