-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
arch/risc-v/bl808: Add courier system driver #12542
Conversation
This change implements a system for allowing the D0 core (which runs NuttX) to receive forwarded interrupts from the M0 core. This makes it possible for drivers that rely on interrupts to work with peripherals attached to the M0 core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is super exciting, thank you so much! :-)
Thanks for the feedback! I've changed the comments in irq.h. I also realized that the numbers for NR_IRQs and for the if statements in bl808_irq.c were wrong, so I defined everything in terms of constants instead, which also makes things more readable. |
@henryrov FYI there's a comment, I'm not sure if it might be relevant: https://x.com/madushan1000/status/1805123950495600675
|
That's interesting, I couldn't find any documentation about this anywhere else. I'll try to implement this once the serial driver is ready, since it shouldn't affect any of the code for that. |
Summary
This change implements a system for allowing the D0 core (which runs NuttX) to receive forwarded interrupts from the M0 core (the peripheral / wireless core). This is implemented using the IPC interrupt: when the M0 core receives an interrupt, it sends an IPC notification to the D0 core containing the IRQ number. This triggers an ISR on D0, which takes the message and dispatches the appropriate ISR using virtual interrupt identifiers within NuttX.
Note: Currently, the boot system for NuttX on the BL808 depends on a piece of firmware originally meant for Linux support, named m0_lowload. The system described in this PR requires a somewhat modified version of this firmware to be flashed, which is available here.
Impact
This system makes it possible to implement BL808 peripheral drivers that depend on interrupts (e.g. UART, SPI, I2C) for peripherals that are attached to the M0 core, instead of being restricted to ones attached to D0 (e.g. UART3). As implemented, the courier should also be mostly transparent to these drivers, outside of applying the virtual IRQ number offset when defining constants for M0 IRQs (as done for BL808_IRQ_UART0, 1 and 2 in this PR).
Testing
I have been working on modifying the existing BL808 serial driver to add support for UARTs 0-2 , which depends on the courier system. The modified driver is currently functional, and successfully receives interrupts from UARTs attached to M0 via the courier, and responds to them using the same ISR as UART3. Further testing can be done by enabling logging when building m0_lowload_nuttx and monitoring UART0 (logging is disabled in the release build to free up UART0 for use in NuttX).