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

hardcoded pointer with extern struct with padding for mmio #4

Open
justinbalexander opened this issue Mar 4, 2020 · 0 comments
Open

Comments

@justinbalexander
Copy link
Owner

Suggested by @markfirmware.

Pending on whether volatile keyword is removed in ziglang/zig#4284

pub fn mmio(address: u32, comptime mmio_type: type) *volatile mmio_type {
    return @intToPtr(*volatile mmio_type, address);
}

pub const Wdt = mmio(0x40010500, extern struct {
  start: u32,
  padding0: [(0x40010504 - 0x40010004) / 4]u32,
  counter_reset_value: u32,
  reload_request_enable: u32,
  padding1: [(0x40010600 - 0x400105C0) / 4]u32,
  reload_request: [8]u32,
});
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

No branches or pull requests

1 participant