$($fields:tt)*
}
) => {
- register!(@common $name @ $offset $(, $comment)?);
+ register!(@common $name $(, $comment)?);
register!(@field_accessors $name { $($fields)* });
register!(@io $name @ $offset);
};
$($fields:tt)*
}
) => {
- register!(@common $name @ $alias::OFFSET $(, $comment)?);
+ register!(@common $name $(, $comment)?);
register!(@field_accessors $name { $($fields)* });
register!(@io $name @ $alias::OFFSET);
};
$($fields:tt)*
}
) => {
- register!(@common $name @ $offset $(, $comment)?);
+ register!(@common $name $(, $comment)?);
register!(@field_accessors $name { $($fields)* });
register!(@io $name @ + $offset);
};
$($fields:tt)*
}
) => {
- register!(@common $name @ $alias::OFFSET $(, $comment)?);
+ register!(@common $name $(, $comment)?);
register!(@field_accessors $name { $($fields)* });
register!(@io $name @ + $alias::OFFSET);
};
// Defines the wrapper `$name` type, as well as its relevant implementations (`Debug`, `BitOr`,
// and conversion to regular `u32`).
- (@common $name:ident @ $offset:expr $(, $comment:literal)?) => {
+ (@common $name:ident $(, $comment:literal)?) => {
$(
#[doc=$comment]
)?
#[derive(Clone, Copy, Default)]
pub(crate) struct $name(u32);
- #[allow(dead_code)]
- impl $name {
- pub(crate) const OFFSET: usize = $offset;
- }
-
// TODO[REGA]: display the raw hex value, then the value of all the fields. This requires
// matching the fields, which will complexify the syntax considerably...
impl ::core::fmt::Debug for $name {
(@io $name:ident @ $offset:expr) => {
#[allow(dead_code)]
impl $name {
+ pub(crate) const OFFSET: usize = $offset;
+
#[inline]
pub(crate) fn read<const SIZE: usize, T>(io: &T) -> Self where
T: ::core::ops::Deref<Target = ::kernel::io::Io<SIZE>>,
(@io $name:ident @ + $offset:literal) => {
#[allow(dead_code)]
impl $name {
+ pub(crate) const OFFSET: usize = $offset;
+
#[inline]
pub(crate) fn read<const SIZE: usize, T>(
io: &T,