Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tact1m4n3
Copy link
Contributor

  • interrupts
  • interrupts on hazard3 (rp2350 riscv)
  • regz interrupt list

#355

Copy link
Contributor

@Grazfather Grazfather left a 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);
Copy link
Contributor

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);
Copy link
Contributor

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)) {
Copy link
Contributor

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
Copy link
Contributor

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)
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants