samples: hci_uart: fix UART IRQ API usage
uart_irq_update() should always be called in IRQ processing callback. From API documentation: "This function should be called the first thing in the ISR. Calling uart_irq_rx_ready(), uart_irq_tx_ready(), uart_irq_tx_complete() allowed only after this." Signed-off-by: Johann Fischer <johann.fischer@nordicsemi.no>
This commit is contained in:
parent
8f44b86bd2
commit
9911bd07e0
1 changed files with 11 additions and 9 deletions
|
@ -232,17 +232,19 @@ static void bt_uart_isr(const struct device *unused, void *user_data)
|
|||
ARG_UNUSED(unused);
|
||||
ARG_UNUSED(user_data);
|
||||
|
||||
if (!(uart_irq_rx_ready(hci_uart_dev) ||
|
||||
uart_irq_tx_ready(hci_uart_dev))) {
|
||||
LOG_DBG("spurious interrupt");
|
||||
}
|
||||
while (uart_irq_update(hci_uart_dev) && uart_irq_is_pending(hci_uart_dev)) {
|
||||
if (!(uart_irq_rx_ready(hci_uart_dev) ||
|
||||
uart_irq_tx_ready(hci_uart_dev))) {
|
||||
LOG_DBG("spurious interrupt");
|
||||
}
|
||||
|
||||
if (uart_irq_tx_ready(hci_uart_dev)) {
|
||||
tx_isr();
|
||||
}
|
||||
if (uart_irq_tx_ready(hci_uart_dev)) {
|
||||
tx_isr();
|
||||
}
|
||||
|
||||
if (uart_irq_rx_ready(hci_uart_dev)) {
|
||||
rx_isr();
|
||||
if (uart_irq_rx_ready(hci_uart_dev)) {
|
||||
rx_isr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue