STM32 RTOS
0.2.3
Bare-metal preemptive RTOS for STM32F446RE
Toggle main menu visibility
Loading...
Searching...
No Matches
bsp.h
Go to the documentation of this file.
1
26
#ifndef BSP_H
27
#define BSP_H
28
29
#include "
driver_status.h
"
30
#include "
flash.h
"
31
#include "
pwr.h
"
32
#include "
rcc.h
"
33
38
41
#define BSP_HSE_HZ (8000000U)
42
#define BSP_PLL_M (8U)
43
#define BSP_PLL_N (360U)
44
#define BSP_PLL_P_DIV (2U)
46
#define BSP_FLASH_LATENCY (5U)
48
53
#define BSP_SYSCLK_HZ ((BSP_HSE_HZ / BSP_PLL_M) * BSP_PLL_N / BSP_PLL_P_DIV)
54
#define BSP_HCLK_HZ (BSP_SYSCLK_HZ)
55
#define BSP_PCLK1_HZ (BSP_HCLK_HZ / 4U)
56
#define BSP_PCLK2_HZ (BSP_HCLK_HZ / 2U)
58
59
/* Chip limits for this configuration (RM0390): VCO input 1-2 MHz, VCO output
60
* 100-432 MHz, SYSCLK <= 180 MHz, APB1 <= 45 MHz, APB2 <= 90 MHz. Checked here
61
* because rccPllConfig() does not know its source frequency. */
62
_Static_assert
(((
BSP_HSE_HZ
/
BSP_PLL_M
) >= 1000000U) && ((
BSP_HSE_HZ
/
BSP_PLL_M
) <= 2000000U),
63
"PLL VCO input must be 1-2 MHz"
);
64
_Static_assert
((((
BSP_HSE_HZ
/
BSP_PLL_M
) *
BSP_PLL_N
) >= 100000000U)
65
&& (((
BSP_HSE_HZ
/
BSP_PLL_M
) *
BSP_PLL_N
) <= 432000000U),
66
"PLL VCO output must be 100-432 MHz"
);
67
_Static_assert
(
BSP_SYSCLK_HZ
<= 180000000U,
"SYSCLK must not exceed 180 MHz"
);
68
_Static_assert
(
BSP_PCLK1_HZ
<= 45000000U,
"APB1 must not exceed 45 MHz"
);
69
_Static_assert
(
BSP_PCLK2_HZ
<= 90000000U,
"APB2 must not exceed 90 MHz"
);
70
93
DRIVER_MUST_CHECK
DriverStatus_e
bspClockInit
(
RccRegisters_t
*rcc,
PwrRegisters_t
*pwr,
94
FlashRegisters_t
*flash);
95
97
98
#endif
/* BSP_H */
driver_status.h
The status every fallible driver function returns.
flash.h
Flash driver: access latency (wait states), prefetch and caches.
BSP_PLL_N
#define BSP_PLL_N
PLL N: VCO output = 1 MHz x N = 360 MHz.
Definition
bsp.h:43
bspClockInit
DRIVER_MUST_CHECK DriverStatus_e bspClockInit(RccRegisters_t *rcc, PwrRegisters_t *pwr, FlashRegisters_t *flash)
Bring SYSCLK from the 16 MHz HSI reset state to 180 MHz.
Definition
bsp.c:12
BSP_PCLK1_HZ
#define BSP_PCLK1_HZ
APB1 (/4): USART2, PWR.
Definition
bsp.h:55
BSP_PLL_M
#define BSP_PLL_M
PLL M: VCO input = HSE / M = 1 MHz.
Definition
bsp.h:42
BSP_SYSCLK_HZ
#define BSP_SYSCLK_HZ
SYSCLK: HSE / M x N / P.
Definition
bsp.h:53
BSP_PCLK2_HZ
#define BSP_PCLK2_HZ
APB2 (/2): SYSCFG.
Definition
bsp.h:56
BSP_HSE_HZ
#define BSP_HSE_HZ
HSE input from the ST-LINK MCO, in bypass mode.
Definition
bsp.h:41
DriverStatus_e
DriverStatus_e
Outcome of a driver call: a category for control flow, not a diagnosis.
Definition
driver_status.h:32
DRIVER_MUST_CHECK
#define DRIVER_MUST_CHECK
Make ignoring a function's result a compile error (with -Werror).
Definition
driver_status.h:22
pwr.h
PWR driver: regulator voltage scale and over-drive.
rcc.h
RCC driver: peripheral clock gating, HSI/HSE-to-PLL SYSCLK bring-up and the reset cause.
FlashRegisters_t
Flash interface register block.
Definition
flash_reg.h:26
PwrRegisters_t
PWR register block.
Definition
pwr_reg.h:23
RccRegisters_t
RCC register block.
Definition
rcc_reg.h:24
board
nucleo-f446re
inc
bsp.h
Generated by
1.18.0