blob: 12233626c98fc73826b5b72d3621dc60b2eeff52 (
plain)
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
|
#pragma once
#include <mmio/mmio.h>
#include "rcc_enums.h"
struct RCC_reg_f0_t {
volatile uint32_t CR;
volatile uint32_t CFGR;
volatile uint32_t CIR;
volatile uint32_t APB2RSTR;
volatile uint32_t APB1RSTR;
volatile uint32_t AHBENR;
volatile uint32_t APB2ENR;
volatile uint32_t APB1ENR;
volatile uint32_t BDCR;
volatile uint32_t CSR;
volatile uint32_t AHBRSTR;
volatile uint32_t CFGR2;
volatile uint32_t CFGR3;
volatile uint32_t CR2;
};
struct RCC_reg_f1_t {
volatile uint32_t CR;
volatile uint32_t CFGR;
volatile uint32_t CIR;
volatile uint32_t APB2RSTR;
volatile uint32_t APB1RSTR;
volatile uint32_t AHBENR;
volatile uint32_t APB2ENR;
volatile uint32_t APB1ENR;
volatile uint32_t BDCR;
volatile uint32_t CSR;
};
struct RCC_reg_f3_t {
volatile uint32_t CR;
volatile uint32_t CFGR;
volatile uint32_t CIR;
volatile uint32_t APB2RSTR;
volatile uint32_t APB1RSTR;
volatile uint32_t AHBENR;
volatile uint32_t APB2ENR;
volatile uint32_t APB1ENR;
volatile uint32_t BDCR;
volatile uint32_t CSR;
volatile uint32_t AHBRSTR;
volatile uint32_t CFGR2;
volatile uint32_t CFGR3;
};
struct RCC_reg_f4_t {
volatile uint32_t CR;
volatile uint32_t PLLCFGR;
volatile uint32_t CFGR;
volatile uint32_t CIR;
volatile uint32_t AHB1RSTR;
volatile uint32_t AHB2RSTR;
volatile uint32_t AHB3RSTR;
volatile uint32_t AHB4RSTR; // Reserved
volatile uint32_t APB1RSTR;
volatile uint32_t APB2RSTR;
volatile uint32_t APB3RSTR; // Reserved
volatile uint32_t APB4RSTR; // Reserved
volatile uint32_t AHB1ENR;
volatile uint32_t AHB2ENR;
volatile uint32_t AHB3ENR;
volatile uint32_t AHB4ENR; // Reserved
volatile uint32_t APB1ENR;
volatile uint32_t APB2ENR;
volatile uint32_t APB3ENR; // Reserved
volatile uint32_t APB4ENR; // Reserved
volatile uint32_t AHB1LPENR;
volatile uint32_t AHB2LPENR;
volatile uint32_t AHB3LPENR;
volatile uint32_t AHB4LPENR; // Reserved
volatile uint32_t APB1LPENR;
volatile uint32_t APB2LPENR;
volatile uint32_t APB3LPENR; // Reserved
volatile uint32_t APB4LPENR; // Reserved
volatile uint32_t BDCR;
volatile uint32_t CSR;
volatile uint32_t _1;
volatile uint32_t _2;
volatile uint32_t SSCGR;
volatile uint32_t PLLI2SCFGR;
volatile uint32_t PLLSAICFGR;
volatile uint32_t DCKCFGR1;
volatile uint32_t DCKCFGR2;
};
struct RCC_reg_l0_t {
volatile uint32_t CR;
volatile uint32_t ICSCR;
volatile uint32_t CRRCR;
volatile uint32_t CFGR;
volatile uint32_t CIER;
volatile uint32_t CIFR;
volatile uint32_t CICR;
volatile uint32_t IOPRSTR;
volatile uint32_t AHBRSTR;
volatile uint32_t APB2RSTR;
volatile uint32_t APB1RSTR;
volatile uint32_t IOPENR;
volatile uint32_t AHBENR;
volatile uint32_t APB2ENR;
volatile uint32_t APB1ENR;
volatile uint32_t IOPSMENR;
volatile uint32_t AHBSMENR;
volatile uint32_t APB2SMENR;
volatile uint32_t APB1SMENR;
volatile uint32_t CCIPR;
volatile uint32_t CSR;
};
struct RCC_reg_l1_t {
volatile uint32_t CR;
volatile uint32_t ICSCR;
volatile uint32_t CFGR;
volatile uint32_t CIR;
volatile uint32_t AHBRSTR;
volatile uint32_t APB2RSTR;
volatile uint32_t APB1RSTR;
volatile uint32_t AHBENR;
volatile uint32_t APB2ENR;
volatile uint32_t APB1ENR;
// Use "standard" _SM_ names, not _LP_ as in Refman.
volatile uint32_t AHBSMENR;
volatile uint32_t APB2SMENR;
volatile uint32_t APB1SMENR;
volatile uint32_t CSR;
};
struct RCC_reg_l4_t {
volatile uint32_t CR;
volatile uint32_t ICSCR;
volatile uint32_t CFGR;
volatile uint32_t PLLCFGR;
volatile uint32_t PLLSAI1CFGR;
volatile uint32_t PLLSAI2CFGR;
volatile uint32_t CIER;
volatile uint32_t CIFR;
volatile uint32_t CICR;
uint32_t _1; // reserved 0x24
volatile uint32_t AHB1RSTR;
volatile uint32_t AHB2RSTR;
volatile uint32_t AHB3RSTR;
uint32_t _2; // reserved 0x34
volatile uint32_t APB1RSTR1;
volatile uint32_t APB1RSTR2;
volatile uint32_t APB2RSTR;
volatile uint32_t APB3RSTR;
volatile uint32_t AHB1ENR;
volatile uint32_t AHB2ENR;
volatile uint32_t AHB3ENR;
uint32_t _3; // reserved 0x54
volatile uint32_t APB1ENR1;
volatile uint32_t APB1ENR2;
volatile uint32_t APB2ENR;
uint32_t _4; // reserved 0x64
volatile uint32_t AHB1SMENR;
volatile uint32_t AHB2SMENR;
volatile uint32_t AHB3SMENR;
uint32_t _5; // reserved 0x74
volatile uint32_t APB1SMENR1;
volatile uint32_t APB1SMENR2;
volatile uint32_t APB2SMENR;
uint32_t _6; // reserved 0x84
volatile uint32_t CCIPR;
uint32_t _7; // reserved 0x8c
volatile uint32_t BDCR;
volatile uint32_t CSR;
volatile uint32_t CRRCR;
volatile uint32_t CCIPR2;
};
struct RCC_reg_wb_t {
volatile uint32_t CR;
volatile uint32_t ICSCR;
volatile uint32_t CFGR;
volatile uint32_t PLLCFGR;
volatile uint32_t PLLSAI1CFGR;
uint32_t _1; // reserved 0x14
volatile uint32_t CIER;
volatile uint32_t CIFR;
volatile uint32_t CICR;
volatile uint32_t SMPSCR;
volatile uint32_t AHB1RSTR;
volatile uint32_t AHB2RSTR;
volatile uint32_t AHB3RSTR;
uint32_t _2; // reserved 0x34
volatile uint32_t APB1RSTR1;
volatile uint32_t APB1RSTR2;
volatile uint32_t APB2RSTR;
volatile uint32_t APB3RSTR;
volatile uint32_t AHB1ENR;
volatile uint32_t AHB2ENR;
volatile uint32_t AHB3ENR;
uint32_t _3; // reserved 0x54
volatile uint32_t APB1ENR1;
volatile uint32_t APB1ENR2;
volatile uint32_t APB2ENR;
uint32_t _4; // reserved 0x64
volatile uint32_t AHB1SMENR;
volatile uint32_t AHB2SMENR;
volatile uint32_t AHB3SMENR;
uint32_t _5; // reserved 0x74
volatile uint32_t APB1SMENR1;
volatile uint32_t APB1SMENR2;
volatile uint32_t APB2SMENR;
uint32_t _6; // reserved 0x84
volatile uint32_t CCIPR;
uint32_t _7; // reserved 0x8c
volatile uint32_t BDCR;
volatile uint32_t CSR;
volatile uint32_t CRRCR;
volatile uint32_t HSECR;
uint32_t _8[26];
volatile uint32_t EXTCFGR;
uint32_t _9[15];
volatile uint32_t C2AHB1ENR;
volatile uint32_t C2AHB2ENR;
volatile uint32_t C2AHB3ENR;
uint32_t _10;
volatile uint32_t C2APB1ENR1;
volatile uint32_t C2APB1ENR2;
volatile uint32_t C2APB2ENR;
volatile uint32_t C2APB3ENR;
volatile uint32_t C2AHB1SMENR;
volatile uint32_t C2AHB2SMENR;
volatile uint32_t C2AHB3SMENR;
uint32_t _11;
volatile uint32_t C2APB1SMENR1;
volatile uint32_t C2APB1SMENR2;
volatile uint32_t C2APB2SMENR;
volatile uint32_t C2APB3SMENR;
};
template <typename T>
class RCC_t : public mmio_ptr<T> {
public:
using mmio_ptr<T>::ptr;
template <typename Bus>
void enable(Bus dev) const {
rcc::enable(*this, dev);
}
template <typename Bus>
void disable(Bus dev) const {
rcc::disable(*this, dev);
}
};
|