-
Notifications
You must be signed in to change notification settings - Fork 119
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
Interrupt refactor #369
base: main
Are you sure you want to change the base?
Interrupt refactor #369
Conversation
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.
I just read this over to see if I understood it. It looks good. I don't know riscv or hazard3 very well. Added a few comments/questions.
const uart = rp2xxx.uart.instance.num(0); | ||
const baud_rate = 115200; | ||
const uart_tx_pin = rp2xxx.gpio.num(12); | ||
const uart_rx_pin = rp2xxx.gpio.num(13); |
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.
We don't see this since we are just using the uart for logging
pub fn main() !void { | ||
// init uart logging | ||
inline for (&.{ uart_tx_pin, uart_rx_pin }) |pin| { | ||
pin.set_function(.uart_first); |
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.
Isn't this enum RP2350 only?
|
||
pub fn disable(comptime interrupt: anytype) void { | ||
const interrupt_name = @tagName(interrupt); | ||
if (@hasField(Interrupt, interrupt_name)) { |
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.
could probably abstract these checks out to some sort of 'interrupt is valid' comptime function to reduce duplicated logic.
Naked: *const fn () callconv(.Naked) void, | ||
// Interrupt is not supported on arm | ||
}; | ||
// TODO: remove this once the vector table uses it's own implementation |
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.
typo it's
-> its
// TODO: maybe this should be relocated somewhere else | ||
pub fn CSR(addr: u24, T: type) type { | ||
const size = @bitSizeOf(T); | ||
if (size != 32) |
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.
Why do we have this? Are there cases where it might be e.g. i32?
#355