macro_rules! define_ap_register {
    (
        type: $port_type:ident,
        $(#[$outer:meta])*
        name: $name:ident,
        address: $address:expr,
        fields: [$($(#[$inner:meta])*$field:ident: $type:ty$(,)?)*],
        from: $from_param:ident => $from:expr,
        to: $to_param:ident => $to:expr
    ) => { ... };
}
Expand description

Defines a new typed access port register for a specific access port. Takes

  • type: The type of the port.
  • name: The name of the constructed type for the register. Also accepts a doc comment to be added to the type.
  • address: The address relative to the base address of the access port.
  • fields: A list of fields of the register type.
  • from: a closure to transform from an u32 to the typed register.
  • to: A closure to transform from they typed register to an u32.