From db257ce84ec43f4ba4c6aef420dfae55b618de15 Mon Sep 17 00:00:00 2001 From: Giovanni Di Sirio Date: Sat, 9 Nov 2019 10:25:08 +0000 Subject: [PATCH] Changed check in RNGv1 driver. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@13168 27425a3e-05d8-49a3-a47f-9c15f0e5edd8 --- os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c | 2 +- os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c b/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c index b4a780d90..c81e433f6 100644 --- a/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c +++ b/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.c @@ -45,7 +45,7 @@ TRNGDriver TRNGD1; /* Driver local variables and types. */ /*===========================================================================*/ -static const TRNGConfig default_cfg = {0}; +static const TRNGConfig default_cfg = {.cr = 0}; /*===========================================================================*/ /* Driver local functions. */ diff --git a/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h b/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h index c537b84fd..2a1e9ba46 100644 --- a/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h +++ b/os/hal/ports/STM32/LLD/RNGv1/hal_trng_lld.h @@ -85,8 +85,12 @@ #error "STM32_RNGCLK not defined in this HAL" #endif -#if STM32_RNGCLK != 48000000 -#error "STM32_RNGCLK is not exactly 48000000" +#if ((STM32_RNGCLK < 47000000) || (STM32_RNGCLK > 49000000)) && \ + ((STM32_RNGCLK < 3500000) || (STM32_RNGCLK > 4500000)) +#if !defined(STM32_DISABLE_RNG_CLOCK_CHECK) +#error "STM32_RNGCLK is not within a tested clock range" +#error "define STM32_DISABLE_RNG_CLOCK_CHECK to override this check" +#endif #endif /*===========================================================================*/ @@ -101,8 +105,8 @@ * @brief Low level fields of the TRNG configuration structure. */ #define trng_lld_config_fields \ - /* Dummy configuration, it is not needed.*/ \ - uint32_t dummy + /* CR register initialization value.*/ \ + uint32_t cr /** * @brief Low level fields of the TRNG driver structure.