/* Read a character through UART in a blocking call. */
static int32_t usr_uart_read_block(struct uart_desc *desc, uint8_t *data)
/* Read a character through UART in a blocking call. */
static int32_t usr_uart_read_block(struct uart_desc *desc, uint8_t *data)
{
	const uint32_t buf_size = 1;
	uint32_t error;
	if(!desc->has_callback) {
		if(uart_ping_flag == 0 && uart_pong_flag == 0)
			adi_uart_SubmitRxBuffer((ADI_UART_HANDLE const)h_uart_device,
						data, buf_size, DMA_NOT_USE);
		return adi_uart_GetRxBuffer((ADI_UART_HANDLE const)h_uart_device,
					    (void **)&data, &error);
	} else {
		while(uart_ping_flag != 2 && uart_pong_flag != 2);
		if(uart_ping_flag == 2) {
			*data = *ping_ptr;
			uart_ping_flag = 0;
		}
		if(uart_pong_flag == 2) {
			*data = *pong_ptr;
			uart_pong_flag = 0;
		}
		return 0;
	}
}