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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
use tock_registers::{register_bitfields, register_structs, registers::ReadWrite};
use crate::Vpa;
pub const BASE: Vpa = Vpa(0x4_7e20_3000);
register_structs! {
pub Registers {
(0x00 => pub cs_a: ReadWrite<u32, CS_A::Register>),
(0x04 => pub fifo_a: ReadWrite<u32, FIFO_A::Register>),
(0x08 => pub mode_a: ReadWrite<u32, MODE_A::Register>),
(0x0c => pub rxc_a: ReadWrite<u32, RXC_A::Register>),
(0x10 => pub txc_a: ReadWrite<u32, TXC_A::Register>),
(0x14 => pub dreq_a: ReadWrite<u32, DREQ_A::Register>),
(0x18 => pub inten_a: ReadWrite<u32, INTEN_A::Register>),
(0x1c => pub intstc_a: ReadWrite<u32, INTSTC_A::Register>),
(0x20 => pub gray: ReadWrite<u32, GRAY::Register>),
(0x24 => @END),
}
}
register_bitfields! {u32,
pub CS_A [
EN OFFSET(0) NUMBITS(1) [],
RXON OFFSET(1) NUMBITS(1) [],
TXON OFFSET(2) NUMBITS(1) [],
TXCLR OFFSET(3) NUMBITS(1) [],
RXCLR OFFSET(4) NUMBITS(1) [],
TXTHR OFFSET(5) NUMBITS(2) [
Empty = 0b00,
OneQuarterFull = 0b01,
ThreeQuartersFull = 0b10,
FullButOneSample = 0b11,
],
RXTHR OFFSET(7) NUMBITS(2) [
OneSample = 0b00,
OneQuarterFull = 0b01,
ThreeQuartersFull = 0b10,
Full = 0b11,
],
DMAEN OFFSET(9) NUMBITS(1) [],
TXSYNC OFFSET(13) NUMBITS(1) [],
RXSYNC OFFSET(14) NUMBITS(1) [],
TXERR OFFSET(15) NUMBITS(1) [],
RXERR OFFSET(16) NUMBITS(1) [],
TXW OFFSET(17) NUMBITS(1) [],
RXR OFFSET(18) NUMBITS(1) [],
TXD OFFSET(19) NUMBITS(1) [],
RXD OFFSET(20) NUMBITS(1) [],
TXE OFFSET(21) NUMBITS(1) [],
RXF OFFSET(22) NUMBITS(1) [],
RXSEX OFFSET(23) NUMBITS(1) [],
SYNC OFFSET(24) NUMBITS(1) [],
]
}
register_bitfields! {u32,
pub FIFO_A [
FIFO OFFSET(0) NUMBITS(32) [],
]
}
register_bitfields! {u32,
pub MODE_A [
FSLEN OFFSET(0) NUMBITS(10) [],
FLEN OFFSET(10) NUMBITS(10) [],
FSI OFFSET(20) NUMBITS(1) [],
FSM OFFSET(21) NUMBITS(1) [
Master = 0,
Slave = 1,
],
CLKI OFFSET(22) NUMBITS(1) [],
CLKM OFFSET(23) NUMBITS(1) [
Master = 0,
Slave = 1,
],
FTXP OFFSET(24) NUMBITS(1) [
Unpacked = 0,
Packed16x2 = 1,
],
FRXP OFFSET(25) NUMBITS(1) [
Unpacked = 0,
Packed16x2 = 1,
],
PDME OFFSET(26) NUMBITS(1) [
Pcm = 0,
Pdm = 1,
],
PDMN OFFSET(27) NUMBITS(1) [
Sixteen = 0,
ThirtyTwo = 1,
],
CLK_DIS OFFSET(28) NUMBITS(1) [],
]
}
register_bitfields! {u32,
pub RXC_A [
CH2WID OFFSET(0) NUMBITS(4) [],
CH2POS OFFSET(4) NUMBITS(10) [],
CH2EN OFFSET(14) NUMBITS(1) [],
CH2WEX OFFSET(15) NUMBITS(1) [],
CH1WID OFFSET(16) NUMBITS(4) [],
CH1POS OFFSET(20) NUMBITS(10) [],
CH1EN OFFSET(30) NUMBITS(1) [],
CH1WEX OFFSET(31) NUMBITS(1) [],
]
}
pub use RXC_A as TXC_A;
register_bitfields! {u32,
pub DREQ_A [
RX_REQ OFFSET(0) NUMBITS(7) [],
TX_REQ OFFSET(8) NUMBITS(7) [],
RX_PANIC OFFSET(16) NUMBITS(7) [],
TX_PANIC OFFSET(24) NUMBITS(7) [],
]
}
register_bitfields! {u32,
pub INTEN_A [
TXW OFFSET(0) NUMBITS(1) [],
RXR OFFSET(1) NUMBITS(1) [],
TXERR OFFSET(2) NUMBITS(1) [],
RXERR OFFSET(3) NUMBITS(1) [],
]
}
pub use INTEN_A as INTSTC_A;
register_bitfields! {u32,
pub GRAY [
CLR OFFSET(1) NUMBITS(1) [],
FLUSH OFFSET(2) NUMBITS(1) [],
RXLEVEL OFFSET(4) NUMBITS(6) [],
FLUSHED OFFSET(10) NUMBITS(6) [],
RXFIFOLEVEL OFFSET(16) NUMBITS(6) [],
]
}