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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
use tock_registers::{
register_bitfields, register_structs,
registers::{ReadWrite, WriteOnly},
};
use crate::Vpa;
pub const BASE_PWM0: Vpa = Vpa(0x4_7e20_c000);
pub const BASE_PWM1: Vpa = Vpa(0x4_7e20_c800);
register_structs! {
pub Registers {
(0x00 => pub ctl: ReadWrite<u32, CTL::Register>),
(0x04 => pub sta: ReadWrite<u32, STA::Register>),
(0x08 => pub dmac: ReadWrite<u32, DMAC::Register>),
(0x0c => _pad0),
(0x10 => pub rng1: ReadWrite<u32>),
(0x14 => pub dat1: ReadWrite<u32>),
(0x18 => pub fif1: WriteOnly<u32>),
(0x1c => _pad1),
(0x20 => pub rng2: ReadWrite<u32>),
(0x24 => pub dat2: ReadWrite<u32>),
(0x28 => @END),
}
}
register_bitfields! {u32,
pub CTL [
PWEN1 OFFSET(0) NUMBITS(1) [],
MODE1 OFFSET(1) NUMBITS(1) [
Pwm = 0,
Serialiser = 1,
],
RPTL1 OFFSET(2) NUMBITS(1) [],
SBIT1 OFFSET(3) NUMBITS(1) [],
POLA1 OFFSET(4) NUMBITS(1) [
ActiveHigh = 1,
ActiveLow = 0,
],
USEF1 OFFSET(5) NUMBITS(1) [],
CLRF OFFSET(6) NUMBITS(1) [],
MSEN1 OFFSET(7) NUMBITS(1) [
Pwm = 0,
Ms = 1,
],
PWEN2 OFFSET(8) NUMBITS(1) [],
MODE2 OFFSET(9) NUMBITS(1) [
Pwm = 0,
Serialiser = 1,
],
RPTL2 OFFSET(10) NUMBITS(1) [],
SBIT2 OFFSET(11) NUMBITS(1) [],
POLA2 OFFSET(12) NUMBITS(1) [
ActiveHigh = 1,
ActiveLow = 0,
],
USEF2 OFFSET(13) NUMBITS(1) [],
MSEN2 OFFSET(15) NUMBITS(1) [
Pwm = 0,
Ms = 1,
],
]
}
register_bitfields! {u32,
pub STA [
FULL1 OFFSET(0) NUMBITS(1) [],
EMPT1 OFFSET(1) NUMBITS(1) [],
WERR1 OFFSET(2) NUMBITS(1) [],
RERR1 OFFSET(3) NUMBITS(1) [],
GAPO1 OFFSET(4) NUMBITS(1) [],
GAPO2 OFFSET(5) NUMBITS(1) [],
BERR OFFSET(8) NUMBITS(1) [],
STA1 OFFSET(9) NUMBITS(1) [],
STA2 OFFSET(10) NUMBITS(1) [],
]
}
register_bitfields! {u32,
pub DMAC [
DREQ OFFSET(0) NUMBITS(8) [],
PANIC OFFSET(8) NUMBITS(8) [],
ENAB OFFSET(31) NUMBITS(1) [],
]
}