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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
use tock_registers::{
register_bitfields, register_structs,
registers::{ReadOnly, ReadWrite, WriteOnly},
};
use crate::Vpa;
pub const BASE: Vpa = Vpa(0x4_7e00_b400);
register_structs! {
pub Registers {
(0x00 => pub load: ReadWrite<u32>),
(0x04 => pub value: ReadOnly<u32>),
(0x08 => pub control: ReadWrite<u32, CONTROL::Register>),
(0x0c => pub irqcntl: WriteOnly<u32, IRQCNTL::Register>),
(0x10 => pub rawirq: ReadOnly<u32, RAWIRQ::Register>),
(0x14 => pub mskirq: ReadOnly<u32, MSKIRQ::Register>),
(0x18 => pub reload: ReadWrite<u32>),
(0x1c => pub prediv: ReadWrite<u32, PREDIV::Register>),
(0x20 => pub freecnt: ReadOnly<u32>),
(0x24 => @END),
}
}
register_bitfields! {u32,
pub CONTROL [
_32BIT OFFSET(1) NUMBITS(1) [
SixteenBitCounters = 0,
ThirtyTwoBitCounter = 1,
],
DIV OFFSET(2) NUMBITS(2) [
DivideBy1 = 0b00,
DivideBy16 = 0b01,
DivideBy256 = 0b10,
],
IE OFFSET(5) NUMBITS(1) [
Disable = 0,
Enable = 1,
],
ENABLE OFFSET(7) NUMBITS(1) [
Disable = 0,
Enable = 1,
],
DBGHALT OFFSET(8) NUMBITS(1) [
KeepRunning = 0,
Halt = 1,
],
ENAFREE OFFSET(9) NUMBITS(1) [
Disable = 0,
Enable = 1,
],
FREEDIV OFFSET(16) NUMBITS(8) [],
]
}
register_bitfields! {u32,
pub IRQCNTL [
INT OFFSET(0) NUMBITS(1) [
Clear = 1,
]
]
}
register_bitfields! {u32,
pub RAWIRQ [
INT OFFSET(0) NUMBITS(1) []
]
}
register_bitfields! {u32,
pub MSKIRQ [
INT OFFSET(0) NUMBITS(1) []
]
}
register_bitfields! {u32,
pub PREDIV [
PREDIV OFFSET(0) NUMBITS(10) []
]
}