1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Core ARM Cortex-M register mappings.

#[path = "."]
mod inner {
    mod dwt;
    #[cfg(feature = "floating-point-unit")]
    mod fpu;
    mod itm;
    #[cfg(feature = "memory-protection-unit")]
    mod mpu;
    mod scb;
    mod stk;
    mod tpiu;

    #[cfg(feature = "floating-point-unit")]
    pub use self::fpu::*;
    #[cfg(feature = "memory-protection-unit")]
    pub use self::mpu::*;
    pub use self::{dwt::*, itm::*, scb::*, stk::*, tpiu::*};
}

use drone_core::reg;

reg::tokens! {
    #[doc(hidden)]
    pub macro cortexm_reg_tokens_inner;
    super::inner;
    crate::map::reg;

    /// Data watchpoint and trace.
    pub mod DWT {
        CYCCNT;
    }

    /// Instrumentation trace macrocell.
    pub mod ITM {
        TPR; TCR; LAR;
    }

    /// System control block.
    pub mod SCB {
        CPUID; ICSR; VTOR; AIRCR; SCR; CCR; SHPR1; SHPR2; SHPR3; SHCSR; MMFSR;
        BFSR; UFSR; HFSR; DFSR; MMFAR; BFAR; AFSR; DEMCR;
    }

    /// SysTick timer.
    pub mod STK {
        CTRL; LOAD; VAL; CALIB;
    }

    /// Floating point unit.
    #[cfg(feature = "floating-point-unit")]
    pub mod FPU {
        CPACR; FPCCR; FPCAR; FPDSCR;
    }

    /// Memory protection unit.
    #[cfg(feature = "memory-protection-unit")]
    pub mod MPU {
        TYPE; CTRL; RNR; RBAR; RASR;
    }

    /// Trace port interface unit.
    pub mod TPIU {
        ACPR; SPPR; FFCR;
    }
}

// Workaround the `macro_expanded_macro_exports_accessed_by_absolute_paths`
// error.
#[doc(hidden)]
#[macro_export]
macro_rules! cortexm_reg_tokens {
    ($($tt:tt)*) => {
        use $crate::cortexm_reg_tokens_inner;
        cortexm_reg_tokens_inner!($($tt)*);
    };
}