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
//! Core ARM Cortex-M register mappings.

#[path = "."]
mod inner {
    mod dwt;
    mod fpu;
    mod itm;
    mod mpu;
    mod scb;
    mod stk;
    mod tpiu;

    pub use self::{dwt::*, fpu::*, itm::*, mpu::*, scb::*, stk::*, tpiu::*};
}

use drone_core::reg;

reg::tokens! {
    #[doc(hidden)]
    pub macro cortex_m_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.
    pub mod FPU {
        CPACR; FPCCR; FPCAR; FPDSCR;
    }

    /// 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! cortex_m_reg_tokens {
    ($($tt:tt)*) => {
        use $crate::cortex_m_reg_tokens_inner;
        cortex_m_reg_tokens_inner!($($tt)*);
    };
}