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
use crate::reg::prelude::*;
use drone_core::reg;

reg! {
    /// SysTick control and status register.
    pub STK CTRL => {
        address => 0xE000_E010;
        size => 0x20;
        reset => 0x0000_0000;
        traits => { RReg WReg };
        fields => {
            /// Returns `true` if timer counted to `0` since last time this was read.
            COUNTFLAG => { offset => 16; width => 1; traits => { RRRegField WWRegField } };
            /// Clock source selection.
            CLKSOURCE => { offset => 2; width => 1; traits => { RRRegField WWRegField } };
            /// SysTick exception request enable.
            TICKINT => { offset => 1; width => 1; traits => { RRRegField WWRegField } };
            /// Counter enable.
            ENABLE => { offset => 0; width => 1; traits => { RRRegField WWRegField } };
        };
    };
}

reg! {
    /// SysTick reload value register.
    pub STK LOAD => {
        address => 0xE000_E014;
        size => 0x20;
        reset => 0x0000_0000;
        traits => { RReg WReg };
        fields => {
            /// RELOAD value.
            RELOAD => { offset => 0; width => 24; traits => { RRRegField WWRegField } };
        };
    };
}

reg! {
    /// SysTick current value register.
    pub STK VAL => {
        address => 0xE000_E018;
        size => 0x20;
        reset => 0x0000_0000;
        traits => { RReg WReg };
        fields => {
            /// Current counter value.
            CURRENT => { offset => 0; width => 24; traits => { RRRegField WWRegField } };
        };
    };
}

reg! {
    /// SysTick calibration value register.
    pub STK CALIB => {
        address => 0xE000_E01C;
        size => 0x20;
        reset => 0x0000_0000;
        traits => { RReg RoReg };
        fields => {
            /// NOREF flag.
            NOREF => { offset => 31; width => 1; traits => { RRRegField RoRRegField } };
            /// SKEW flag.
            SKEW => { offset => 30; width => 1; traits => { RRRegField RoRRegField } };
            /// Calibration value.
            TENMS => { offset => 0; width => 24; traits => { RRRegField RoRRegField } };
        };
    };
}