stm32: rcc: Standardize prescaler define names
We did have * _HPRE_SYSCLK_DIVN (3 parts) * _HPRE_DIVN (5 parts) * _HPRE_DIV_N (4 parts) Unify all on _HPRE_DIVN. Provide deprecated definitions to not break everything at once. Also, standardize on "NODIV" instead of DIVNONE.
This commit is contained in:
@@ -137,29 +137,35 @@
|
||||
#define RCC_CFGR_RTCPRE_SHIFT 16
|
||||
#define RCC_CFGR_RTCPRE_MASK 0x1f
|
||||
|
||||
/* PPRE1/2: APB high-speed prescalers */
|
||||
#define RCC_CFGR_PPRE2_SHIFT 13
|
||||
#define RCC_CFGR_PPRE2_MASK 0x7
|
||||
#define RCC_CFGR_PPRE1_SHIFT 10
|
||||
#define RCC_CFGR_PPRE1_MASK 0x7
|
||||
#define RCC_CFGR_PPRE_DIV_NONE 0x0
|
||||
#define RCC_CFGR_PPRE_DIV_2 0x4
|
||||
#define RCC_CFGR_PPRE_DIV_4 0x5
|
||||
#define RCC_CFGR_PPRE_DIV_8 0x6
|
||||
#define RCC_CFGR_PPRE_DIV_16 0x7
|
||||
/** @defgroup rcc_cfgr_apbxpre RCC_CFGR APBx prescale factors
|
||||
* These can be used for both APB1 and APB2 prescaling
|
||||
* @{
|
||||
*/
|
||||
#define RCC_CFGR_PPRE_NODIV 0x0
|
||||
#define RCC_CFGR_PPRE_DIV2 0x4
|
||||
#define RCC_CFGR_PPRE_DIV4 0x5
|
||||
#define RCC_CFGR_PPRE_DIV8 0x6
|
||||
#define RCC_CFGR_PPRE_DIV16 0x7
|
||||
/**@}*/
|
||||
|
||||
/* HPRE: AHB high-speed prescaler */
|
||||
#define RCC_CFGR_HPRE_SHIFT 4
|
||||
#define RCC_CFGR_HPRE_MASK 0xf
|
||||
#define RCC_CFGR_HPRE_DIV_NONE 0x0
|
||||
#define RCC_CFGR_HPRE_DIV_2 (0x8 + 0)
|
||||
#define RCC_CFGR_HPRE_DIV_4 (0x8 + 1)
|
||||
#define RCC_CFGR_HPRE_DIV_8 (0x8 + 2)
|
||||
#define RCC_CFGR_HPRE_DIV_16 (0x8 + 3)
|
||||
#define RCC_CFGR_HPRE_DIV_64 (0x8 + 4)
|
||||
#define RCC_CFGR_HPRE_DIV_128 (0x8 + 5)
|
||||
#define RCC_CFGR_HPRE_DIV_256 (0x8 + 6)
|
||||
#define RCC_CFGR_HPRE_DIV_512 (0x8 + 7)
|
||||
/** @defgroup rcc_cfgr_ahbpre RCC_CFGR AHB prescale factors
|
||||
@{*/
|
||||
#define RCC_CFGR_HPRE_NODIV 0x0
|
||||
#define RCC_CFGR_HPRE_DIV2 (0x8 + 0)
|
||||
#define RCC_CFGR_HPRE_DIV4 (0x8 + 1)
|
||||
#define RCC_CFGR_HPRE_DIV8 (0x8 + 2)
|
||||
#define RCC_CFGR_HPRE_DIV16 (0x8 + 3)
|
||||
#define RCC_CFGR_HPRE_DIV64 (0x8 + 4)
|
||||
#define RCC_CFGR_HPRE_DIV128 (0x8 + 5)
|
||||
#define RCC_CFGR_HPRE_DIV256 (0x8 + 6)
|
||||
#define RCC_CFGR_HPRE_DIV512 (0x8 + 7)
|
||||
/**@}*/
|
||||
|
||||
/* SWS: System clock switch status */
|
||||
#define RCC_CFGR_SWS_SHIFT 2
|
||||
@@ -175,6 +181,28 @@
|
||||
#define RCC_CFGR_SW_HSE 0x1
|
||||
#define RCC_CFGR_SW_PLL 0x2
|
||||
|
||||
/** Older compatible definitions to ease migration
|
||||
* @defgroup rcc_cfgr_deprecated RCC_CFGR Deprecated dividers
|
||||
* @deprecated Use _CFGR_xPRE_DIVn form instead, across all families
|
||||
* @{
|
||||
*/
|
||||
#define RCC_CFGR_PPRE_DIV_NONE 0x0
|
||||
#define RCC_CFGR_PPRE_DIV_2 0x4
|
||||
#define RCC_CFGR_PPRE_DIV_4 0x5
|
||||
#define RCC_CFGR_PPRE_DIV_8 0x6
|
||||
#define RCC_CFGR_PPRE_DIV_16 0x7
|
||||
|
||||
#define RCC_CFGR_HPRE_DIV_NONE 0x0
|
||||
#define RCC_CFGR_HPRE_DIV_2 (0x8 + 0)
|
||||
#define RCC_CFGR_HPRE_DIV_4 (0x8 + 1)
|
||||
#define RCC_CFGR_HPRE_DIV_8 (0x8 + 2)
|
||||
#define RCC_CFGR_HPRE_DIV_16 (0x8 + 3)
|
||||
#define RCC_CFGR_HPRE_DIV_64 (0x8 + 4)
|
||||
#define RCC_CFGR_HPRE_DIV_128 (0x8 + 5)
|
||||
#define RCC_CFGR_HPRE_DIV_256 (0x8 + 6)
|
||||
#define RCC_CFGR_HPRE_DIV_512 (0x8 + 7)
|
||||
/**@}*/
|
||||
|
||||
/* --- RCC_CIR values ------------------------------------------------------ */
|
||||
|
||||
/* Clock security system interrupt clear bit */
|
||||
|
||||
Reference in New Issue
Block a user