From 40932b20589b66407578a84eb573dd0bfc5395cd Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sun, 7 Oct 2018 09:22:10 +0000 Subject: Enabled TRNG on L4+. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12344 110e8d01-0319-4d1e-a829-52ad28d1bb01 --- os/hal/ports/STM32/STM32L4xx+/hal_lld.h | 5 +++++ os/hal/ports/STM32/STM32L4xx+/platform.mk | 1 + os/hal/ports/STM32/STM32L4xx+/stm32_rcc.h | 28 ++++++++++++++++++++++++++ os/hal/ports/STM32/STM32L4xx+/stm32_registry.h | 3 +++ 4 files changed, 37 insertions(+) (limited to 'os/hal') diff --git a/os/hal/ports/STM32/STM32L4xx+/hal_lld.h b/os/hal/ports/STM32/STM32L4xx+/hal_lld.h index df8515aa8..23723d822 100644 --- a/os/hal/ports/STM32/STM32L4xx+/hal_lld.h +++ b/os/hal/ports/STM32/STM32L4xx+/hal_lld.h @@ -2137,6 +2137,11 @@ */ #define STM32_USBCLK STM32_48CLK +/** + * @brief RNG clock point. + */ +#define STM32_RNGCLK STM32_48CLK + /** * @brief ADC clock frequency. */ diff --git a/os/hal/ports/STM32/STM32L4xx+/platform.mk b/os/hal/ports/STM32/STM32L4xx+/platform.mk index d4b905ea0..aaf6b7910 100644 --- a/os/hal/ports/STM32/STM32L4xx+/platform.mk +++ b/os/hal/ports/STM32/STM32L4xx+/platform.mk @@ -27,6 +27,7 @@ include $(CHIBIOS)/os/hal/ports/STM32/LLD/DACv1/driver.mk include $(CHIBIOS)/os/hal/ports/STM32/LLD/DMAv1/driver.mk include $(CHIBIOS)/os/hal/ports/STM32/LLD/GPIOv3/driver.mk include $(CHIBIOS)/os/hal/ports/STM32/LLD/I2Cv3/driver.mk +include $(CHIBIOS)/os/hal/ports/STM32/LLD/RNGv1/driver.mk include $(CHIBIOS)/os/hal/ports/STM32/LLD/RTCv2/driver.mk include $(CHIBIOS)/os/hal/ports/STM32/LLD/SPIv2/driver.mk include $(CHIBIOS)/os/hal/ports/STM32/LLD/TIMv1/driver.mk diff --git a/os/hal/ports/STM32/STM32L4xx+/stm32_rcc.h b/os/hal/ports/STM32/STM32L4xx+/stm32_rcc.h index b72ee0f29..56c261c76 100644 --- a/os/hal/ports/STM32/STM32L4xx+/stm32_rcc.h +++ b/os/hal/ports/STM32/STM32L4xx+/stm32_rcc.h @@ -625,6 +625,34 @@ #define rccResetQUADSPI1() rccResetAHB3(RCC_AHB3RSTR_QSPIRST) /** @} */ +/** + * @name RNG peripherals specific RCC operations + * @{ + */ +/** + * @brief Enables the RNG peripheral clock. + * + * @param[in] lp low power enable flag + * + * @api + */ +#define rccEnableRNG(lp) rccEnableAHB2(RCC_AHB2ENR_RNGEN, lp) + +/** + * @brief Disables the RNG peripheral clock. + * + * @api + */ +#define rccDisableRNG() rccDisableAHB2(RCC_AHB2ENR_RNGEN) + +/** + * @brief Resets the RNG peripheral. + * + * @api + */ +#define rccResetRNG() rccResetAHB3(RCC_AHB2RSTR_RNGRST) +/** @} */ + /** * @name SDMMC peripheral specific RCC operations * @{ diff --git a/os/hal/ports/STM32/STM32L4xx+/stm32_registry.h b/os/hal/ports/STM32/STM32L4xx+/stm32_registry.h index f31872e86..c6b4432a9 100644 --- a/os/hal/ports/STM32/STM32L4xx+/stm32_registry.h +++ b/os/hal/ports/STM32/STM32L4xx+/stm32_registry.h @@ -194,6 +194,9 @@ /* QUADSPI attributes.*/ #define STM32_HAS_QUADSPI1 FALSE +/* RNG attributes.*/ +#define STM32_HAS_RNG1 TRUE + /* RTC attributes.*/ #define STM32_HAS_RTC TRUE #define STM32_RTC_HAS_SUBSECONDS TRUE -- cgit v1.2.3