@@ -29,14 +29,23 @@ static inline void ll_rng_enable_it(RNG_TypeDef *RNGx)
2929 /* Silence "unused" warning on IRQ-less hardware*/
3030 ARG_UNUSED (RNGx );
3131#if !IRQLESS_TRNG
32- LL_RNG_EnableIT (RNGx );
32+ # if defined(CONFIG_SOC_STM32WB09XX )
33+ LL_RNG_EnableEnErrorIrq (RNGx );
34+ LL_RNG_EnableEnFfFullIrq (RNGx );
35+ # else
36+ LL_RNG_EnableIT (RNGx );
37+ # endif
3338#endif /* !IRQLESS_TRNG */
3439}
3540
3641static inline uint32_t ll_rng_is_active_seis (RNG_TypeDef * RNGx )
3742{
3843#if defined(CONFIG_SOC_SERIES_STM32WB0X )
39- return LL_RNG_IsActiveFlag_FAULT (RNGx );
44+ # if defined(CONFIG_SOC_STM32WB09XX )
45+ return LL_RNG_IsActiveFlag_ENTROPY_ERR (RNGx );
46+ # else
47+ return LL_RNG_IsActiveFlag_FAULT (RNGx );
48+ # endif
4049#else
4150 return LL_RNG_IsActiveFlag_SEIS (RNGx );
4251#endif /* CONFIG_SOC_SERIES_STM32WB0X */
@@ -45,7 +54,11 @@ static inline uint32_t ll_rng_is_active_seis(RNG_TypeDef *RNGx)
4554static inline void ll_rng_clear_seis (RNG_TypeDef * RNGx )
4655{
4756#if defined(CONFIG_SOC_SERIES_STM32WB0X )
48- LL_RNG_ClearFlag_FAULT (RNGx );
57+ # if defined(CONFIG_SOC_STM32WB09XX )
58+ LL_RNG_SetResetHealthErrorFlags (RNGx , 1 );
59+ # else
60+ LL_RNG_ClearFlag_FAULT (RNGx );
61+ # endif
4962#else
5063 LL_RNG_ClearFlag_SEIS (RNGx );
5164#endif /* CONFIG_SOC_SERIES_STM32WB0X */
@@ -68,7 +81,11 @@ static inline uint32_t ll_rng_is_active_secs(RNG_TypeDef *RNGx)
6881static inline uint32_t ll_rng_is_active_drdy (RNG_TypeDef * RNGx )
6982{
7083#if defined(CONFIG_SOC_SERIES_STM32WB0X )
71- return LL_RNG_IsActiveFlag_RNGRDY (RNGx );
84+ # if defined(CONFIG_SOC_STM32WB09XX )
85+ return LL_RNG_IsActiveFlag_VAL_READY (RNGx );
86+ # else
87+ return LL_RNG_IsActiveFlag_RNGRDY (RNGx );
88+ # endif
7289#else
7390 return LL_RNG_IsActiveFlag_DRDY (RNGx );
7491#endif /* CONFIG_SOC_SERIES_STM32WB0X */
@@ -77,7 +94,11 @@ static inline uint32_t ll_rng_is_active_drdy(RNG_TypeDef *RNGx)
7794static inline uint16_t ll_rng_read_rand_data (RNG_TypeDef * RNGx )
7895{
7996#if defined(CONFIG_SOC_SERIES_STM32WB0X )
80- return LL_RNG_ReadRandData16 (RNGx );
97+ # if defined(CONFIG_SOC_STM32WB09XX )
98+ return (uint16_t )LL_RNG_GetRndVal (RNGx );
99+ # else
100+ return LL_RNG_ReadRandData16 (RNGx );
101+ # endif
81102#else
82103 return (uint16_t )LL_RNG_ReadRandData32 (RNGx );
83104#endif /* CONFIG_SOC_SERIES_STM32WB0X */
0 commit comments