drivers: uart: sam0: Reorder events on rx_disable

Modified order of reported events on rx disable to match API
description: first RX_RDY and then RX_BUF_RELEASED.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
Krzysztof Chruscinski 2020-06-05 10:41:05 +02:00 committed by Carles Cufí
commit 8592d43191

View file

@ -970,21 +970,6 @@ static int uart_sam0_rx_disable(struct device *dev)
regs->INTENCLR.reg = SERCOM_USART_INTENCLR_RXC;
dma_stop(dev_data->dma, cfg->rx_dma_channel);
if (dev_data->rx_next_len) {
struct uart_event evt = {
.type = UART_RX_BUF_RELEASED,
.data.rx_buf = {
.buf = dev_data->rx_next_buf,
},
};
dev_data->rx_next_buf = NULL;
dev_data->rx_next_len = 0U;
if (dev_data->async_cb) {
dev_data->async_cb(&evt, dev_data->async_cb_data);
}
}
if (dma_get_status(dev_data->dma, cfg->rx_dma_channel,
&st) == 0 && st.pending_length != 0U) {
@ -1007,6 +992,22 @@ static int uart_sam0_rx_disable(struct device *dev)
dev_data->async_cb(&evt, dev_data->async_cb_data);
}
if (dev_data->rx_next_len) {
struct uart_event evt = {
.type = UART_RX_BUF_RELEASED,
.data.rx_buf = {
.buf = dev_data->rx_next_buf,
},
};
dev_data->rx_next_buf = NULL;
dev_data->rx_next_len = 0U;
if (dev_data->async_cb) {
dev_data->async_cb(&evt, dev_data->async_cb_data);
}
}
evt.type = UART_RX_DISABLED;
if (dev_data->async_cb) {
dev_data->async_cb(&evt, dev_data->async_cb_data);