/* Submit reading buffer to the UART driver. 
Buffer is used until bytes_number bytes are read.  */
int32_t uart_read_nonblocking(struct uart_desc *desc, uint8_t *data, uint32_t bytes_number)
/* Submit reading buffer to the UART driver. 
Buffer is used until bytes_number bytes are read.  */
int32_t uart_read_nonblocking(struct uart_desc *desc, uint8_t *data, uint32_t bytes_number)
{
	struct aducm_uart_desc	*extra;
	uint32_t		to_read;
	if (!desc || !data || !bytes_number)
		return FAILURE;
	extra = desc->extra;
	if (extra->read_desc.is_nonblocking)
		return FAILURE;
	extra->read_desc.is_nonblocking = true;
	to_read = min(bytes_number, MAX_BYTES);
	extra->read_desc.pending = bytes_number - to_read;
	extra->read_desc.buff = data + to_read;
	adi_uart_SubmitRxBuffer(
		(ADI_UART_HANDLE const)extra->uart_handler,
		(void *const)data,
		(uint32_t const)to_read,
		to_read > 4 ? true : false);
	return SUCCESS;
}