forked from M-Labs/zynq-rs
libregister: allow rustdoc for register! macro
This commit is contained in:
parent
975202a653
commit
a62ca507d0
|
@ -30,8 +30,9 @@ pub trait RegisterRW: RegisterR + RegisterW {
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! register_common {
|
macro_rules! register_common {
|
||||||
($mod_name: ident, $struct_name: ident, $access: ty, $inner: ty) => (
|
($mod_name: ident, $(#[$outer:meta])* $struct_name: ident, $access: ty, $inner: ty) => (
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
|
$(#[$outer])*
|
||||||
pub struct $struct_name {
|
pub struct $struct_name {
|
||||||
inner: $access,
|
inner: $access,
|
||||||
}
|
}
|
||||||
|
@ -157,34 +158,34 @@ macro_rules! register_vcell {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! register {
|
macro_rules! register {
|
||||||
// Define read-only register
|
// Define read-only register
|
||||||
($mod_name: ident, $struct_name: ident, RO, $inner: ty) => (
|
($mod_name: ident, $(#[$outer:meta])* $struct_name: ident, RO, $inner: ty) => (
|
||||||
$crate::register_common!($mod_name, $struct_name, $crate::RO<$inner>, $inner);
|
$crate::register_common!($mod_name, $(#[$outer])* $struct_name, $crate::RO<$inner>, $inner);
|
||||||
$crate::register_r!($mod_name, $struct_name);
|
$crate::register_r!($mod_name, $struct_name);
|
||||||
);
|
);
|
||||||
|
|
||||||
// Define write-only register
|
// Define write-only register
|
||||||
($mod_name: ident, $struct_name: ident, WO, $inner: ty) => (
|
($mod_name: ident, $(#[$outer:meta])* $struct_name: ident, WO, $inner: ty) => (
|
||||||
$crate::register_common!($mod_name, $struct_name, volatile_register::WO<$inner>, $inner);
|
$crate::register_common!($mod_name, $(#[$outer])* $struct_name, volatile_register::WO<$inner>, $inner);
|
||||||
$crate::register_w!($mod_name, $struct_name);
|
$crate::register_w!($mod_name, $struct_name);
|
||||||
);
|
);
|
||||||
|
|
||||||
// Define read-write register
|
// Define read-write register
|
||||||
($mod_name: ident, $struct_name: ident, RW, $inner: ty) => (
|
($mod_name: ident, $(#[$outer:meta])* $struct_name: ident, RW, $inner: ty) => (
|
||||||
$crate::register_common!($mod_name, $struct_name, volatile_register::RW<$inner>, $inner);
|
$crate::register_common!($mod_name, $(#[$outer])* $struct_name, volatile_register::RW<$inner>, $inner);
|
||||||
$crate::register_r!($mod_name, $struct_name);
|
$crate::register_r!($mod_name, $struct_name);
|
||||||
$crate::register_w!($mod_name, $struct_name);
|
$crate::register_w!($mod_name, $struct_name);
|
||||||
$crate::register_rw!($mod_name, $struct_name);
|
$crate::register_rw!($mod_name, $struct_name);
|
||||||
);
|
);
|
||||||
|
|
||||||
// Define read-write register
|
// Define read-write register
|
||||||
($mod_name: ident, $struct_name: ident, VolatileCell, $inner: ty) => (
|
($mod_name: ident, $(#[$outer:meta])* $struct_name: ident, VolatileCell, $inner: ty) => (
|
||||||
$crate::register_common!($mod_name, $struct_name, VolatileCell<$inner>, $inner);
|
$crate::register_common!($mod_name, $(#[$outer])* $struct_name, VolatileCell<$inner>, $inner);
|
||||||
$crate::register_vcell!($mod_name, $struct_name);
|
$crate::register_vcell!($mod_name, $struct_name);
|
||||||
);
|
);
|
||||||
|
|
||||||
// Define read-write register with mask on write (for WTC mixed access.)
|
// Define read-write register with mask on write (for WTC mixed access.)
|
||||||
($mod_name: ident, $struct_name: ident, RW, $inner: ty, $mask: expr) => (
|
($mod_name: ident, $(#[$outer:meta])* $struct_name: ident, RW, $inner: ty, $mask: expr) => (
|
||||||
$crate::register_common!($mod_name, $struct_name, volatile_register::RW<$inner>, $inner);
|
$crate::register_common!($mod_name, $(#[$outer])* $struct_name, volatile_register::RW<$inner>, $inner);
|
||||||
$crate::register_r!($mod_name, $struct_name);
|
$crate::register_r!($mod_name, $struct_name);
|
||||||
$crate::register_w!($mod_name, $struct_name);
|
$crate::register_w!($mod_name, $struct_name);
|
||||||
$crate::register_rw!($mod_name, $struct_name, $mask);
|
$crate::register_rw!($mod_name, $struct_name, $mask);
|
||||||
|
|
Loading…
Reference in New Issue