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
use tock_registers::{register_bitfields, register_structs, registers::ReadWrite};
use crate::Vpa;
pub const BASE_BSC0: Vpa = Vpa(0x4_7e20_5000);
pub const BASE_BSC1: Vpa = Vpa(0x4_7e80_4000);
pub const BASE_BSC3: Vpa = Vpa(0x4_7e20_5600);
pub const BASE_BSC4: Vpa = Vpa(0x4_7e20_5800);
pub const BASE_BSC5: Vpa = Vpa(0x4_7e20_5a80);
pub const BASE_BSC6: Vpa = Vpa(0x4_7e20_5c00);
register_structs! {
pub Registers {
(0x00 => pub c: ReadWrite<u32, C::Register>),
(0x04 => pub s: ReadWrite<u32, S::Register>),
(0x08 => pub dlen: ReadWrite<u32, DLEN::Register>),
(0x0c => pub a: ReadWrite<u32, A::Register>),
(0x10 => pub fifo: ReadWrite<u32, FIFO::Register>),
(0x14 => pub div: ReadWrite<u32, DIV::Register>),
(0x18 => pub del: ReadWrite<u32, DEL::Register>),
(0x1c => pub clkt: ReadWrite<u32, CLKT::Register>),
(0x20 => @END),
}
}
register_bitfields! {u32,
pub C [
READ OFFSET(0) NUMBITS(1) [
Write = 0,
Read = 1,
],
CLEAR OFFSET(4) NUMBITS(2) [
NoAction = 0b00,
Clear = 0b01,
],
ST OFFSET(7) NUMBITS(1) [
NoAction = 0,
StartNewTransfer = 1,
],
INTD OFFSET(8) NUMBITS(1) [],
INTT OFFSET(9) NUMBITS(1) [],
INTR OFFSET(10) NUMBITS(1) [],
I2CEN OFFSET(15) NUMBITS(1) [],
]
}
register_bitfields! {u32,
pub S [
TA OFFSET(0) NUMBITS(1) [],
DONE OFFSET(1) NUMBITS(1) [],
TXW OFFSET(2) NUMBITS(1) [],
RXR OFFSET(3) NUMBITS(1) [],
TXD OFFSET(4) NUMBITS(1) [],
RXD OFFSET(5) NUMBITS(1) [],
TXE OFFSET(6) NUMBITS(1) [],
RXF OFFSET(7) NUMBITS(1) [],
ERR OFFSET(8) NUMBITS(1) [],
CLKT OFFSET(9) NUMBITS(1) [],
]
}
register_bitfields! {u32,
pub DLEN [
DLEN OFFSET(0) NUMBITS(16) [],
]
}
register_bitfields! {u32,
pub A [
ADDR OFFSET(0) NUMBITS(7) [],
]
}
register_bitfields! {u32,
pub FIFO [
DATA OFFSET(0) NUMBITS(8) [],
]
}
register_bitfields! {u32,
pub DIV [
CDIV OFFSET(0) NUMBITS(16) [],
]
}
register_bitfields! {u32,
pub DEL [
REDL OFFSET(0) NUMBITS(16) [],
FEDL OFFSET(16) NUMBITS(16) [],
]
}
register_bitfields! {u32,
pub CLKT [
TOUT OFFSET(0) NUMBITS(16) [],
]
}