stm32: rcc: extract osc_bypass functions

rcc_osc_bypass_enable and rcc_osc_bypass_disable have been copy/pasted
around for the last time!  There's a compile bit to check for L0/L1, but
otherwise this is just code duplication for no gain.
This commit is contained in:
Karl Palsson
2017-05-01 22:56:28 +00:00
parent 2547bf66d9
commit 29c712326f
20 changed files with 62 additions and 382 deletions

View File

@@ -335,42 +335,6 @@ void rcc_css_disable(void)
RCC_CR &= ~RCC_CR_CSSON;
}
void rcc_osc_bypass_enable(enum rcc_osc osc)
{
switch (osc) {
case RCC_HSE:
RCC_CR |= RCC_CR_HSEBYP;
break;
case RCC_LSE:
RCC_CSR |= RCC_CSR_LSEBYP;
break;
case RCC_PLL:
case RCC_HSI:
case RCC_LSI:
case RCC_MSI:
/* Do nothing, only HSE/LSE allowed here. */
break;
}
}
void rcc_osc_bypass_disable(enum rcc_osc osc)
{
switch (osc) {
case RCC_HSE:
RCC_CR &= ~RCC_CR_HSEBYP;
break;
case RCC_LSE:
RCC_CSR &= ~RCC_CSR_LSEBYP;
break;
case RCC_PLL:
case RCC_HSI:
case RCC_LSI:
case RCC_MSI:
/* Do nothing, only HSE/LSE allowed here. */
break;
}
}
/**
* Set the range of the MSI oscillator
* @param range desired range @ref rcc_icscr_msirange