[riot-notifications] [RIOT-OS/RIOT] How to handle shared UART ISR for STM32F0 (#11119)

MrKevinWeiss notifications at github.com
Thu Mar 7 12:11:07 CET 2019


I don't think that is a bad solution.
When there is multiple things that can cause an interrupt you need some way of distinguishing between.

The only thing that I would do is try to make change the actual uart definitions (in this case 3 and 6) to the dev number (in this case 1 and 2)

so in the board periph config file you would have
```
#define UART_0_ISR          (isr_usart1)
#define UART_1_2_ISR        (isr_usart3_6)
```

and in the cpu common file
```
#ifdef UART_1_2_ISR
void UART_1_2_ISR(void)
{
    if (dev(UART_DEV(1))->ISR & (USART_ISR_RXNE | USART_ISR_ORE)) {
        irq_handler(UART_DEV(1));
    } else  {
        irq_handler(UART_DEV(2));
    }
}
#endif
```

The only downside is that if we want to support every combination it should add up (so if the uarts are not ordered in a nice way we could have `UART_1_2_ISR` and `UART_1_3_ISR` and `UART_0_2_ISR`).  Since they are #ifdef it shouldn't take up any extra space though.


On the other side  maybe have some generic function `UART_ISR` that iterates through each device to see if there is an interrupt that occured, that wouldn't be that fast though and would be a pain to coordinate (you have check both the int_flags and if they are enabled and bla bla bla).  I don't think that would be viable.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/issues/11119#issuecomment-470485895
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20190307/c9df764a/attachment.html>


More information about the notifications mailing list