STM32 RTOS 0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Loading...
Searching...
No Matches
rcc.h
Go to the documentation of this file.
1
32#ifndef RCC_H
33#define RCC_H
34
35#include "driver_status.h"
36#include "flash_reg.h"
37#include "gpio_reg.h"
38#include "rcc_reg.h"
39
40#include <stdint.h>
41
46
49
58 const GpioRegisters_t *port);
59
68 const GpioRegisters_t *port);
69
73
77
81
85
89
93
97
101
103
106
108#define RCC_RESET_FLAGS_Msk \
109 (RCC_CSR_BORRSTF | RCC_CSR_PINRSTF | RCC_CSR_PORRSTF | RCC_CSR_SFTRSTF | RCC_CSR_IWDGRSTF \
110 | RCC_CSR_WWDGRSTF | RCC_CSR_LPWRRSTF)
111
122uint32_t rccResetFlags(const RccRegisters_t *rcc);
123
133
135
138
149
159
171
182
184
187
203DRIVER_MUST_CHECK DriverStatus_e rccPllConfig(RccRegisters_t *rcc, uint32_t source, uint32_t m,
204 uint32_t n, uint32_t p);
205
215
224
226
229
244 uint32_t ppre1, uint32_t ppre2);
245
268 uint32_t source, uint32_t latency);
269
271
273
274#endif /* RCC_H */
The status every fallible driver function returns.
Flash interface registers: access latency, prefetch and caches (RM0390 section 3.8).
GPIO registers for ports A to H (RM0390 section 7.4).
DriverStatus_e
Outcome of a driver call: a category for control flow, not a diagnosis.
#define DRIVER_MUST_CHECK
Make ignoring a function's result a compile error (with -Werror).
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
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
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
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
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
DRIVER_MUST_CHECK DriverStatus_e rccHsiDisable(RccRegisters_t *rcc)
Turn off HSI and wait until HSIRDY clears.
Definition rcc.c:233
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
RCC registers: oscillators, PLL, bus clocks, peripheral clock gating and reset flags (RM0390 section ...
Flash interface register block.
Definition flash_reg.h:26
GPIO port register block.
Definition gpio_reg.h:33
RCC register block.
Definition rcc_reg.h:24