STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
rcc.c
Go to the documentation of this file.
1
5#include "rcc.h"
6
7#include "flash.h"
8
13
16#define RCC_CLOCK_READY_TIMEOUT_ITERATIONS (100000U)
17
25static DriverStatus_e rccGpioClockBit(const GpioRegisters_t *port, uint32_t *bit)
26{
28
29 if (port == GPIOA)
30 {
32 }
33 else if (port == GPIOB)
34 {
36 }
37 else if (port == GPIOC)
38 {
40 }
41 else if (port == GPIOD)
42 {
44 }
45 else if (port == GPIOE)
46 {
48 }
49 else if (port == GPIOF)
50 {
52 }
53 else if (port == GPIOG)
54 {
56 }
57 else if (port == GPIOH)
58 {
60 }
61 else
62 {
64 }
65
66 return status;
67}
68
70{
71 uint32_t bit = 0U;
72 DriverStatus_e status = rccGpioClockBit(port, &bit);
73
74 if (status == DRIVER_STATUS_OK)
75 {
76 rcc->AHB1ENR |= bit;
77 (void)rcc->AHB1ENR; /* read back: the clock is running before first use */
78 }
79
80 return status;
81}
82
84{
85 uint32_t bit = 0U;
86 DriverStatus_e status = rccGpioClockBit(port, &bit);
87
88 if (status == DRIVER_STATUS_OK)
89 {
90 rcc->AHB1ENR &= ~bit;
91 }
92
93 return status;
94}
95
97{
99 (void)rcc->APB1ENR; /* read back: the clock is running before first use */
100}
101
106
108{
110 (void)rcc->APB1ENR; /* read back: the clock is running before first use */
111}
112
117
119{
121 (void)rcc->APB2ENR; /* read back: the clock is running before first use */
122}
123
128
130{
132 (void)rcc->APB1ENR; /* read back: the clock is running before first use */
133}
134
139
140uint32_t rccResetFlags(const RccRegisters_t *rcc)
141{
142 return rcc->CSR & RCC_RESET_FLAGS_Msk;
143}
144
146{
147 rcc->CSR |= RCC_CSR_RMVF;
148}
149
155static uint32_t rccActiveSysclkSource(const RccRegisters_t *rcc)
156{
157 return (rcc->CFGR & RCC_CFGR_SWS_Msk) >> RCC_CFGR_SWS_Pos;
158}
159
172static DriverStatus_e rccOscillatorDisableGuard(const RccRegisters_t *rcc, uint32_t sysclk_value,
173 uint32_t pllsrc_value)
174{
176 uint32_t active = rccActiveSysclkSource(rcc);
177 uint32_t pll_input = rcc->PLLCFGR & RCC_PLLCFGR_PLLSRC;
178
179 if (active == sysclk_value)
180 {
181 status = DRIVER_STATUS_ERR_BUSY;
182 }
183 else if ((active == RCC_CFGR_SYSCLK_PLL) && (pll_input == pllsrc_value))
184 {
185 status = DRIVER_STATUS_ERR_BUSY;
186 }
187 else
188 {
189 /* Not feeding SYSCLK - safe to disable. */
190 }
191
192 return status;
193}
194
207static DriverStatus_e rccWaitCrFlag(const RccRegisters_t *rcc, uint32_t ready_bit,
208 uint32_t expected)
209{
211 uint32_t timeout = RCC_CLOCK_READY_TIMEOUT_ITERATIONS;
212
213 while (((rcc->CR & ready_bit) != expected) && (timeout > 0U))
214 {
215 timeout--;
216 }
217
218 if ((rcc->CR & ready_bit) != expected)
219 {
221 }
222
223 return status;
224}
225
232
234{
235 DriverStatus_e status =
237
238 if (status == DRIVER_STATUS_OK)
239 {
240 rcc->CR &= ~RCC_CR_HSION;
241 status = rccWaitCrFlag(rcc, RCC_CR_HSIRDY, 0U);
242 }
243
244 return status;
245}
246
248{
250
251 if ((bypass != 0U) && (bypass != RCC_CR_HSEBYP))
252 {
254 }
255 else if ((rcc->CR & RCC_CR_HSEON) != 0U)
256 {
257 status = DRIVER_STATUS_ERR_BUSY;
258 }
259 else
260 {
261 /* HSEBYP is writable only while HSEON is clear, which the guard ensures. */
262 rcc->CR = (rcc->CR & ~RCC_CR_HSEBYP) | bypass;
263 rcc->CR |= RCC_CR_HSEON;
264
266 }
267
268 return status;
269}
270
272{
273 uint32_t pllsrc_hse = RCC_PLLCFGR_PLLSRC_HSE;
275
276 if (status == DRIVER_STATUS_OK)
277 {
278 rcc->CR &= ~RCC_CR_HSEON;
279 status = rccWaitCrFlag(rcc, RCC_CR_HSERDY, 0U);
280 }
281
282 return status;
283}
284
285DriverStatus_e rccPllConfig(RccRegisters_t *rcc, uint32_t source, uint32_t m, uint32_t n,
286 uint32_t p)
287{
289
290 if ((source != RCC_PLLCFGR_PLLSRC_HSI) && (source != RCC_PLLCFGR_PLLSRC_HSE))
291 {
293 }
294 else if ((m < 2U) || (m > 63U))
295 {
297 }
298 else if ((n < 50U) || (n > 432U))
299 {
301 }
303 {
305 }
306 else if ((rcc->CR & RCC_CR_PLLON) != 0U)
307 {
308 status = DRIVER_STATUS_ERR_BUSY;
309 }
310 else
311 {
312 uint32_t mask =
314
315 /* PLLQ and reserved bits are preserved. */
316 rcc->PLLCFGR = (rcc->PLLCFGR & ~mask) | (m << RCC_PLLCFGR_PLLM_Pos)
317 | (n << RCC_PLLCFGR_PLLN_Pos) | (p << RCC_PLLCFGR_PLLP_Pos) | source;
318 }
319
320 return status;
321}
322
329
331{
333
335 {
336 status = DRIVER_STATUS_ERR_BUSY;
337 }
338 else
339 {
340 rcc->CR &= ~RCC_CR_PLLON;
341 status = rccWaitCrFlag(rcc, RCC_CR_PLLRDY, 0U);
342 }
343
344 return status;
345}
346
353static DriverStatus_e rccValidateHpre(uint32_t hpre)
354{
356
357 if ((hpre != RCC_CFGR_HPRE_DIV1) && (hpre != RCC_CFGR_HPRE_DIV2) && (hpre != RCC_CFGR_HPRE_DIV4)
358 && (hpre != RCC_CFGR_HPRE_DIV8) && (hpre != RCC_CFGR_HPRE_DIV16)
359 && (hpre != RCC_CFGR_HPRE_DIV64) && (hpre != RCC_CFGR_HPRE_DIV128)
360 && (hpre != RCC_CFGR_HPRE_DIV256) && (hpre != RCC_CFGR_HPRE_DIV512))
361 {
363 }
364
365 return status;
366}
367
374static DriverStatus_e rccValidatePpre(uint32_t ppre)
375{
377
378 if ((ppre != RCC_CFGR_PPRE_DIV1) && (ppre != RCC_CFGR_PPRE_DIV2) && (ppre != RCC_CFGR_PPRE_DIV4)
379 && (ppre != RCC_CFGR_PPRE_DIV8) && (ppre != RCC_CFGR_PPRE_DIV16))
380 {
382 }
383
384 return status;
385}
386
387DriverStatus_e rccBusPrescalerConfig(RccRegisters_t *rcc, uint32_t hpre, uint32_t ppre1,
388 uint32_t ppre2)
389{
390 DriverStatus_e status = rccValidateHpre(hpre);
391
392 if (status == DRIVER_STATUS_OK)
393 {
394 status = rccValidatePpre(ppre1);
395 }
396
397 if (status == DRIVER_STATUS_OK)
398 {
399 status = rccValidatePpre(ppre2);
400 }
401
402 if (status == DRIVER_STATUS_OK)
403 {
405
406 rcc->CFGR = (rcc->CFGR & ~mask) | (hpre << RCC_CFGR_HPRE_Pos)
407 | (ppre1 << RCC_CFGR_PPRE1_Pos) | (ppre2 << RCC_CFGR_PPRE2_Pos);
408 }
409
410 return status;
411}
412
414 uint32_t latency)
415{
417 uint32_t current_latency = (flash->ACR & FLASH_ACR_LATENCY_Msk) >> FLASH_ACR_LATENCY_Pos;
418
419 if ((source != RCC_CFGR_SYSCLK_HSI) && (source != RCC_CFGR_SYSCLK_HSE)
420 && (source != RCC_CFGR_SYSCLK_PLL))
421 {
423 }
424
425 /* A higher latency goes in before the switch. An out-of-range value is
426 * always higher than the 4-bit current one, so flashSetLatency() rejects it
427 * here and the lowering call below never sees it. */
428 if ((status == DRIVER_STATUS_OK) && (latency > current_latency))
429 {
430 status = flashSetLatency(flash, latency);
431 }
432
433 if (status == DRIVER_STATUS_OK)
434 {
435 uint32_t ready_bit;
436
437 if (source == RCC_CFGR_SYSCLK_HSI)
438 {
439 ready_bit = RCC_CR_HSIRDY;
440 }
441 else if (source == RCC_CFGR_SYSCLK_HSE)
442 {
443 ready_bit = RCC_CR_HSERDY;
444 }
445 else
446 {
447 ready_bit = RCC_CR_PLLRDY;
448 }
449
450 if ((rcc->CR & ready_bit) == 0U)
451 {
453 }
454 }
455
456 if (status == DRIVER_STATUS_OK)
457 {
458 uint32_t timeout = RCC_CLOCK_READY_TIMEOUT_ITERATIONS;
459
460 rcc->CFGR = (rcc->CFGR & ~RCC_CFGR_SW_Msk) | (source << RCC_CFGR_SW_Pos);
461
462 while ((rccActiveSysclkSource(rcc) != source) && (timeout > 0U))
463 {
464 timeout--;
465 }
466
467 /* Re-read SWS rather than test the counter (see rccWaitCrFlag()). */
468 if (rccActiveSysclkSource(rcc) != source)
469 {
471 }
472 }
473
474 /* A lower latency only once the switch has completed. */
475 if ((status == DRIVER_STATUS_OK) && (latency <= current_latency))
476 {
477 status = flashSetLatency(flash, latency);
478 }
479
480 return status;
481}
482
Flash driver: access latency (wait states), prefetch and caches.
DriverStatus_e
Outcome of a driver call: a category for control flow, not a diagnosis.
@ DRIVER_STATUS_ERR_NOT_INITIALIZED
The peripheral or clock source was used before it was enabled or ready.
@ DRIVER_STATUS_OK
Succeeded.
@ DRIVER_STATUS_ERR_BUSY
The hardware is in a state that makes the request unsafe, such as a running PLL.
@ DRIVER_STATUS_ERR_INVALID_PARAM
A parameter is outside its valid domain.
@ DRIVER_STATUS_ERR_TIMEOUT
A bounded wait for a hardware flag ran out.
DRIVER_MUST_CHECK DriverStatus_e flashSetLatency(FlashRegisters_t *flash, uint32_t latency)
Set the flash access latency and confirm it by reading it back.
Definition flash.c:12
#define FLASH_ACR_LATENCY_Msk
<span class="regaccess">rw</span> Wait states (0-15).
Definition flash_reg.h:42
#define FLASH_ACR_LATENCY_Pos
Bits 3:0.
Definition flash_reg.h:40
#define GPIOG
Port G.
Definition gpio_reg.h:54
#define GPIOC
Port C.
Definition gpio_reg.h:50
#define GPIOF
Port F.
Definition gpio_reg.h:53
#define GPIOB
Port B.
Definition gpio_reg.h:49
#define GPIOD
Port D.
Definition gpio_reg.h:51
#define GPIOA
Port A.
Definition gpio_reg.h:48
#define GPIOH
Port H.
Definition gpio_reg.h:55
#define GPIOE
Port E.
Definition gpio_reg.h:52
DRIVER_MUST_CHECK DriverStatus_e rccSysclkSwitch(RccRegisters_t *rcc, FlashRegisters_t *flash, uint32_t source, uint32_t latency)
Switch SYSCLK to a ready source and set the flash latency it needs.
Definition rcc.c:413
static DriverStatus_e rccWaitCrFlag(const RccRegisters_t *rcc, uint32_t ready_bit, uint32_t expected)
Poll a CR ready flag until it reaches expected or the budget runs out.
Definition rcc.c:207
void rccWwdgClockEnable(RccRegisters_t *rcc)
Enable the WWDG's clock; needed before any WWDG access.
Definition rcc.c:107
DRIVER_MUST_CHECK DriverStatus_e rccHseEnable(RccRegisters_t *rcc, uint32_t bypass)
Turn on the external oscillator (HSE) and wait until ready.
Definition rcc.c:247
void rccWwdgClockDisable(RccRegisters_t *rcc)
Disable the WWDG's clock.
Definition rcc.c:113
static DriverStatus_e rccValidatePpre(uint32_t ppre)
Check that ppre is one of the five RCC_CFGR_PPRE_DIV* values.
Definition rcc.c:374
DRIVER_MUST_CHECK DriverStatus_e rccPllDisable(RccRegisters_t *rcc)
Turn off the PLL and wait until PLLRDY clears.
Definition rcc.c:330
DRIVER_MUST_CHECK DriverStatus_e rccGpioClockDisable(RccRegisters_t *rcc, const GpioRegisters_t *port)
Disable a GPIO port's clock.
Definition rcc.c:83
DRIVER_MUST_CHECK DriverStatus_e rccBusPrescalerConfig(RccRegisters_t *rcc, uint32_t hpre, uint32_t ppre1, uint32_t ppre2)
Set the AHB, APB1 and APB2 prescalers.
Definition rcc.c:387
DRIVER_MUST_CHECK DriverStatus_e rccHsiEnable(RccRegisters_t *rcc)
Turn on the 16 MHz internal oscillator (HSI) and wait until ready.
Definition rcc.c:226
static DriverStatus_e rccOscillatorDisableGuard(const RccRegisters_t *rcc, uint32_t sysclk_value, uint32_t pllsrc_value)
Report whether an oscillator feeds SYSCLK, directly or through the PLL.
Definition rcc.c:172
DRIVER_MUST_CHECK DriverStatus_e rccPllEnable(RccRegisters_t *rcc)
Turn on the PLL and wait for lock.
Definition rcc.c:323
DRIVER_MUST_CHECK DriverStatus_e rccHseDisable(RccRegisters_t *rcc)
Turn off HSE and wait until HSERDY clears.
Definition rcc.c:271
uint32_t rccResetFlags(const RccRegisters_t *rcc)
The reset-cause flags set since they were last cleared.
Definition rcc.c:140
void rccPwrClockDisable(RccRegisters_t *rcc)
Disable PWR's clock.
Definition rcc.c:135
void rccUsart2ClockEnable(RccRegisters_t *rcc)
Enable USART2's clock.
Definition rcc.c:96
void rccUsart2ClockDisable(RccRegisters_t *rcc)
Disable USART2's clock.
Definition rcc.c:102
DRIVER_MUST_CHECK DriverStatus_e rccGpioClockEnable(RccRegisters_t *rcc, const GpioRegisters_t *port)
Enable a GPIO port's clock.
Definition rcc.c:69
void rccSyscfgClockEnable(RccRegisters_t *rcc)
Enable SYSCFG's clock; needed before any SYSCFG access (e.g.
Definition rcc.c:118
#define RCC_CLOCK_READY_TIMEOUT_ITERATIONS
Polls allowed for each oscillator, PLL or SWS wait (see Poll-count timeouts).
Definition rcc.c:16
void rccSyscfgClockDisable(RccRegisters_t *rcc)
Disable SYSCFG's clock.
Definition rcc.c:124
void rccClearResetFlags(RccRegisters_t *rcc)
Clear every reset-cause flag (CSR.RMVF).
Definition rcc.c:145
void rccPwrClockEnable(RccRegisters_t *rcc)
Enable PWR's clock; needed before any PWR access.
Definition rcc.c:129
static DriverStatus_e rccGpioClockBit(const GpioRegisters_t *port, uint32_t *bit)
Map a GPIO port to its AHB1ENR bit.
Definition rcc.c:25
static DriverStatus_e rccValidateHpre(uint32_t hpre)
Check that hpre is one of the nine RCC_CFGR_HPRE_DIV* values.
Definition rcc.c:353
static uint32_t rccActiveSysclkSource(const RccRegisters_t *rcc)
The SYSCLK source in use, from CFGR.SWS (not the requested CFGR.SW).
Definition rcc.c:155
DRIVER_MUST_CHECK DriverStatus_e rccHsiDisable(RccRegisters_t *rcc)
Turn off HSI and wait until HSIRDY clears.
Definition rcc.c:233
#define RCC_RESET_FLAGS_Msk
Every CSR reset-cause flag; rccResetFlags() returns a subset of these.
Definition rcc.h:108
DRIVER_MUST_CHECK DriverStatus_e rccPllConfig(RccRegisters_t *rcc, uint32_t source, uint32_t m, uint32_t n, uint32_t p)
Set the PLL's input source and M, N and P.
Definition rcc.c:285
#define RCC_PLLCFGR_PLLM_Msk
Input divider M (2-63): VCO input = source / M, 1-2 MHz.
Definition rcc_reg.h:96
#define RCC_CFGR_SW_Msk
<span class="regaccess">rw</span> SYSCLK source requested; values below.
Definition rcc_reg.h:127
#define RCC_CFGR_HPRE_DIV256
SYSCLK / 256.
Definition rcc_reg.h:160
#define RCC_CFGR_SW_Pos
Bits 1:0.
Definition rcc_reg.h:125
#define RCC_CFGR_HPRE_DIV64
SYSCLK / 64.
Definition rcc_reg.h:158
#define RCC_CFGR_HPRE_Pos
Bits 7:4.
Definition rcc_reg.h:131
#define RCC_CFGR_HPRE_DIV128
SYSCLK / 128.
Definition rcc_reg.h:159
#define RCC_CFGR_PPRE_DIV2
HCLK / 2.
Definition rcc_reg.h:168
#define RCC_CFGR_SYSCLK_HSI
HSI.
Definition rcc_reg.h:145
#define RCC_CFGR_HPRE_DIV1
SYSCLK / 1.
Definition rcc_reg.h:153
#define RCC_CFGR_HPRE_DIV16
SYSCLK / 16.
Definition rcc_reg.h:157
#define RCC_CFGR_PPRE1_Msk
<span class="regaccess">rw</span> APB1 prescaler; APB1 must stay at or below 45 MHz.
Definition rcc_reg.h:136
#define RCC_CFGR_PPRE2_Msk
<span class="regaccess">rw</span> APB2 prescaler; APB2 must stay at or below 90 MHz.
Definition rcc_reg.h:139
#define RCC_AHB1ENR_GPIOGEN
GPIOG clock.
Definition rcc_reg.h:222
#define RCC_CFGR_PPRE2_Pos
Bits 15:13.
Definition rcc_reg.h:137
#define RCC_APB1ENR_PWREN
PWR clock; required before any PWR register access.
Definition rcc_reg.h:248
#define RCC_CFGR_HPRE_Msk
<span class="regaccess">rw</span> AHB prescaler; values below.
Definition rcc_reg.h:133
#define RCC_AHB1ENR_GPIOEEN
GPIOE clock.
Definition rcc_reg.h:218
#define RCC_PLLCFGR_PLLM_Pos
Bits 5:0.
Definition rcc_reg.h:94
#define RCC_AHB1ENR_GPIOAEN
GPIOA clock.
Definition rcc_reg.h:210
#define RCC_PLLCFGR_PLLN_Pos
Bits 14:6.
Definition rcc_reg.h:97
#define RCC_APB2ENR_SYSCFGEN
<span class="regaccess">rw</span> SYSCFG clock; required before any SYSCFG register access.
Definition rcc_reg.h:262
#define RCC_CFGR_PPRE_DIV16
HCLK / 16.
Definition rcc_reg.h:171
#define RCC_CR_HSERDY
<span class="regaccess">ro</span> HSE ready.
Definition rcc_reg.h:76
#define RCC_CFGR_SYSCLK_HSE
HSE.
Definition rcc_reg.h:146
#define RCC_PLLCFGR_PLLSRC
PLL input: 0 = HSI, 1 = HSE.
Definition rcc_reg.h:105
#define RCC_PLLCFGR_PLLP_Msk
Output divider P for SYSCLK; values below.
Definition rcc_reg.h:102
#define RCC_CFGR_PPRE_DIV1
HCLK / 1.
Definition rcc_reg.h:167
#define RCC_CR_HSIRDY
<span class="regaccess">ro</span> HSI ready.
Definition rcc_reg.h:70
#define RCC_CR_HSEBYP
<span class="regaccess">rw</span> HSE bypass: external clock on OSC_IN.
Definition rcc_reg.h:79
#define RCC_PLLCFGR_PLLP_Pos
Bits 17:16.
Definition rcc_reg.h:100
#define RCC_CFGR_SYSCLK_PLL
Main PLL (P output).
Definition rcc_reg.h:147
#define RCC_CFGR_HPRE_DIV2
SYSCLK / 2.
Definition rcc_reg.h:154
#define RCC_CFGR_PPRE_DIV4
HCLK / 4.
Definition rcc_reg.h:169
#define RCC_CFGR_SWS_Pos
Bits 3:2.
Definition rcc_reg.h:128
#define RCC_APB1ENR_USART2EN
USART2 clock.
Definition rcc_reg.h:245
#define RCC_CFGR_HPRE_DIV8
SYSCLK / 8.
Definition rcc_reg.h:156
#define RCC_CR_PLLON
<span class="regaccess">rw</span> Main PLL on.
Definition rcc_reg.h:85
#define RCC_AHB1ENR_GPIOBEN
GPIOB clock.
Definition rcc_reg.h:212
#define RCC_AHB1ENR_GPIOHEN
GPIOH clock.
Definition rcc_reg.h:224
#define RCC_CR_HSEON
<span class="regaccess">rw</span> HSE on.
Definition rcc_reg.h:73
#define RCC_PLLCFGR_PLLSRC_HSI
HSI feeds the PLL.
Definition rcc_reg.h:111
#define RCC_PLLCFGR_PLLSRC_HSE
HSE feeds the PLL.
Definition rcc_reg.h:112
#define RCC_CFGR_HPRE_DIV512
SYSCLK / 512.
Definition rcc_reg.h:161
#define RCC_AHB1ENR_GPIOCEN
GPIOC clock.
Definition rcc_reg.h:214
#define RCC_AHB1ENR_GPIODEN
GPIOD clock.
Definition rcc_reg.h:216
#define RCC_CFGR_SWS_Msk
<span class="regaccess">ro</span> SYSCLK source in use, reported once a switch completes.
Definition rcc_reg.h:130
#define RCC_AHB1ENR_GPIOFEN
GPIOF clock.
Definition rcc_reg.h:220
#define RCC_CFGR_PPRE1_Pos
Bits 12:10.
Definition rcc_reg.h:134
#define RCC_CFGR_PPRE_DIV8
HCLK / 8.
Definition rcc_reg.h:170
#define RCC_CR_HSION
<span class="regaccess">rw</span> HSI on.
Definition rcc_reg.h:67
#define RCC_APB1ENR_WWDGEN
WWDG clock; required before any WWDG register access.
Definition rcc_reg.h:242
#define RCC_CR_PLLRDY
<span class="regaccess">ro</span> Main PLL locked.
Definition rcc_reg.h:88
#define RCC_CSR_RMVF
<span class="regaccess">rw</span> Write 1 to clear every reset flag below.
Definition rcc_reg.h:276
#define RCC_PLLCFGR_PLLN_Msk
Multiplier N (50-432): VCO output = VCO input x N, 100-432 MHz.
Definition rcc_reg.h:99
#define RCC_CFGR_HPRE_DIV4
SYSCLK / 4.
Definition rcc_reg.h:155
RCC driver: peripheral clock gating, HSI/HSE-to-PLL SYSCLK bring-up and the reset cause.
Flash interface register block.
Definition flash_reg.h:26
volatile uint32_t ACR
0x00: access control
Definition flash_reg.h:27
GPIO port register block.
Definition gpio_reg.h:33
RCC register block.
Definition rcc_reg.h:24
volatile uint32_t CFGR
0x08: clock configuration
Definition rcc_reg.h:27
volatile uint32_t APB2ENR
0x44: APB2 clock enable
Definition rcc_reg.h:41
volatile uint32_t CR
0x00: clock control
Definition rcc_reg.h:25
volatile uint32_t AHB1ENR
0x30: AHB1 clock enable
Definition rcc_reg.h:36
volatile uint32_t PLLCFGR
0x04: PLL configuration
Definition rcc_reg.h:26
volatile uint32_t CSR
0x74: clock control and status
Definition rcc_reg.h:51
volatile uint32_t APB1ENR
0x40: APB1 clock enable
Definition rcc_reg.h:40