drivers: serial: uart_stm32: fix for async_rx_buf_rsp
uart_stm32_async_rx_buf_rsp() does not return the necessary errors when rx_next_buffer is already set & when async uart rx is disabled. This patch was submitted by @mkaranki Signed-off-by: Abderrahmane Jarmouni <abderrahmane.jarmouni-ext@st.com>
This commit is contained in:
parent
1a3bb3fd5c
commit
4affeaab20
|
@ -1684,12 +1684,25 @@ static int uart_stm32_async_rx_buf_rsp(const struct device *dev, uint8_t *buf,
|
||||||
size_t len)
|
size_t len)
|
||||||
{
|
{
|
||||||
struct uart_stm32_data *data = dev->data;
|
struct uart_stm32_data *data = dev->data;
|
||||||
|
unsigned int key;
|
||||||
|
int err = 0;
|
||||||
|
|
||||||
LOG_DBG("replace buffer (%d)", len);
|
LOG_DBG("replace buffer (%d)", len);
|
||||||
|
|
||||||
|
key = irq_lock();
|
||||||
|
|
||||||
|
if (data->rx_next_buffer != NULL) {
|
||||||
|
err = -EBUSY;
|
||||||
|
} else if (!data->dma_rx.enabled) {
|
||||||
|
err = -EACCES;
|
||||||
|
} else {
|
||||||
data->rx_next_buffer = buf;
|
data->rx_next_buffer = buf;
|
||||||
data->rx_next_buffer_len = len;
|
data->rx_next_buffer_len = len;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
irq_unlock(key);
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int uart_stm32_async_init(const struct device *dev)
|
static int uart_stm32_async_init(const struct device *dev)
|
||||||
|
|
Loading…
Reference in a new issue