regs_macros/lib.rs
1use proc_macro::TokenStream;
2use syn::parse_macro_input;
3
4mod spec;
5
6/// Defines the layout and access rules to a memory-mapped register.
7///
8/// This macros does not define the memory-mapped register itself.
9/// It generates type definitions for its layout and access rules.
10/// Use the [`reg`] macro to define memory-mapped registers based on type definitions.
11///
12/// # Examples
13/// ```
14/// use regs_macros::*;
15///
16/// regspec!(CR as u32, bits {
17/// EN[31],
18/// RYD[24, ro],
19/// STAT[16;2],
20/// });
21/// ```
22#[proc_macro]
23pub fn regspec(input: TokenStream) -> TokenStream {
24 let input = parse_macro_input!(input as spec::RegSpec);
25 input.into_token_stream()
26}