drivers: serial: b91: fifo_fill API update to check fifo size

Updated fifo_fill API to check TX/RX data registers size

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
This commit is contained in:
Yuriy Vynnychek 2021-12-06 13:51:21 +02:00 committed by Maureen Helm
parent ba7e70e0bc
commit a696a55e3b

View file

@ -29,6 +29,9 @@
/* UART TX buffer count max value */
#define UART_TX_BUF_CNT ((uint8_t)8u)
/* UART TX/RX data registers size */
#define UART_DATA_SIZE ((uint8_t)4u)
/* Parity type */
#define UART_PARITY_NONE ((uint8_t)0u)
#define UART_PARITY_EVEN ((uint8_t)1u)
@ -42,7 +45,7 @@
/* B91 UART registers structure */
struct uart_b91_t {
uint8_t data_buf[4];
uint8_t data_buf[UART_DATA_SIZE];
uint16_t clk_div;
uint8_t ctrl0;
uint8_t ctrl1;
@ -374,6 +377,10 @@ static int uart_b91_fifo_fill(const struct device *dev,
int i = 0;
volatile struct uart_b91_t *uart = GET_UART(dev);
if (size > UART_DATA_SIZE) {
size = UART_DATA_SIZE;
}
for (i = 0; i < size; i++) {
if (uart_b91_get_rx_bufcnt(uart) != 0) {
break;