tests: drivers: stm32 clock control for stm32l0 and stm32l1

Fix build error for stm32 devices which have no function
to get the PLL ON bit from the RCC_CR register
Use the register access instead.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
Francois Ramu 2022-03-01 17:34:39 +01:00 committed by Maureen Helm
commit 47933bf808

View file

@ -70,10 +70,22 @@ static void test_pll_src(void)
zassert_equal(RCC_PLLSOURCE_MSI, pll_src, zassert_equal(RCC_PLLSOURCE_MSI, pll_src,
"Expected PLL src: MSI (%d). Actual PLL src: %d", "Expected PLL src: MSI (%d). Actual PLL src: %d",
RCC_PLLSOURCE_MSI, pll_src); RCC_PLLSOURCE_MSI, pll_src);
#else #else /* --> RCC_PLLSOURCE_NONE */
#if defined(CONFIG_SOC_SERIES_STM32L0X) || defined(CONFIG_SOC_SERIES_STM32L1X)
#define RCC_PLLSOURCE_NONE 0
/* check RCC_CR_PLLON bit to enable/disable the PLL, but no status function exist */
if (READ_BIT(RCC->CR, RCC_CR_PLLON) == RCC_CR_PLLON) {
/* should not happen : PLL must be disabled when not used */
pll_src = 0xFFFF; /* error code */
} else {
pll_src = RCC_PLLSOURCE_NONE;
}
#endif /* RCC_CR_PLLON */
zassert_equal(RCC_PLLSOURCE_NONE, pll_src, zassert_equal(RCC_PLLSOURCE_NONE, pll_src,
"Expected PLL src: none (%d). Actual PLL src: %d", "Expected PLL src: none (%d). Actual PLL src: %d",
RCC_PLLSOURCE_NONE, pll_src); RCC_PLLSOURCE_NONE, pll_src);
#endif #endif
} }