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:
parent
34baec32ce
commit
8592d43191
1 changed files with 16 additions and 15 deletions
|
@ -970,21 +970,6 @@ static int uart_sam0_rx_disable(struct device *dev)
|
||||||
regs->INTENCLR.reg = SERCOM_USART_INTENCLR_RXC;
|
regs->INTENCLR.reg = SERCOM_USART_INTENCLR_RXC;
|
||||||
dma_stop(dev_data->dma, cfg->rx_dma_channel);
|
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,
|
if (dma_get_status(dev_data->dma, cfg->rx_dma_channel,
|
||||||
&st) == 0 && st.pending_length != 0U) {
|
&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);
|
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;
|
evt.type = UART_RX_DISABLED;
|
||||||
if (dev_data->async_cb) {
|
if (dev_data->async_cb) {
|
||||||
dev_data->async_cb(&evt, dev_data->async_cb_data);
|
dev_data->async_cb(&evt, dev_data->async_cb_data);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue