20#ifndef STM32H7xx_LL_RNG_H
21#define STM32H7xx_LL_RNG_H
48#define LL_RNG_HTCFG 0x17590ABCU
57#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
69 uint32_t ClockErrorDetection;
89#define LL_RNG_CED_ENABLE 0x00000000U
90#define LL_RNG_CED_DISABLE RNG_CR_CED
95#if defined(RNG_CR_CONDRST)
101#define LL_RNG_CLKDIV_BY_1 (0x00000000UL)
102#define LL_RNG_CLKDIV_BY_2 (RNG_CR_CLKDIV_0)
103#define LL_RNG_CLKDIV_BY_4 (RNG_CR_CLKDIV_1)
104#define LL_RNG_CLKDIV_BY_8 (RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0)
105#define LL_RNG_CLKDIV_BY_16 (RNG_CR_CLKDIV_2)
106#define LL_RNG_CLKDIV_BY_32 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0)
107#define LL_RNG_CLKDIV_BY_64 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1)
108#define LL_RNG_CLKDIV_BY_128 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0)
109#define LL_RNG_CLKDIV_BY_256 (RNG_CR_CLKDIV_3)
110#define LL_RNG_CLKDIV_BY_512 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_0)
111#define LL_RNG_CLKDIV_BY_1024 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1)
112#define LL_RNG_CLKDIV_BY_2048 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0)
113#define LL_RNG_CLKDIV_BY_4096 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2)
114#define LL_RNG_CLKDIV_BY_8192 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0)
115#define LL_RNG_CLKDIV_BY_16384 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1)
116#define LL_RNG_CLKDIV_BY_32768 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0)
125#define LL_RNG_NIST_COMPLIANT (0x00000000UL)
126#define LL_RNG_CUSTOM_NIST (RNG_CR_NISTC)
138#define LL_RNG_SR_DRDY RNG_SR_DRDY
139#define LL_RNG_SR_CECS RNG_SR_CECS
140#define LL_RNG_SR_SECS RNG_SR_SECS
141#define LL_RNG_SR_CEIS RNG_SR_CEIS
142#define LL_RNG_SR_SEIS RNG_SR_SEIS
152#define LL_RNG_CR_IE RNG_CR_IE
179#define LL_RNG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
187#define LL_RNG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
213__STATIC_INLINE
void LL_RNG_Enable(
RNG_TypeDef *RNGx)
215 SET_BIT(RNGx->
CR, RNG_CR_RNGEN);
224__STATIC_INLINE
void LL_RNG_Disable(
RNG_TypeDef *RNGx)
226 CLEAR_BIT(RNGx->
CR, RNG_CR_RNGEN);
235__STATIC_INLINE uint32_t LL_RNG_IsEnabled(
const RNG_TypeDef *RNGx)
237 return ((READ_BIT(RNGx->
CR, RNG_CR_RNGEN) == (RNG_CR_RNGEN)) ? 1UL : 0UL);
246__STATIC_INLINE
void LL_RNG_EnableClkErrorDetect(
RNG_TypeDef *RNGx)
248#if defined(RNG_CR_CONDRST)
249 MODIFY_REG(RNGx->
CR, RNG_CR_CED | RNG_CR_CONDRST, LL_RNG_CED_ENABLE | RNG_CR_CONDRST);
250 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
252 CLEAR_BIT(RNGx->
CR, RNG_CR_CED);
262__STATIC_INLINE
void LL_RNG_DisableClkErrorDetect(
RNG_TypeDef *RNGx)
264#if defined(RNG_CR_CONDRST)
265 MODIFY_REG(RNGx->
CR, RNG_CR_CED | RNG_CR_CONDRST, LL_RNG_CED_DISABLE | RNG_CR_CONDRST);
266 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
268 SET_BIT(RNGx->
CR, RNG_CR_CED);
278__STATIC_INLINE uint32_t LL_RNG_IsEnabledClkErrorDetect(
const RNG_TypeDef *RNGx)
280 return ((READ_BIT(RNGx->
CR, RNG_CR_CED) != (RNG_CR_CED)) ? 1UL : 0UL);
283#if defined(RNG_CR_CONDRST)
290__STATIC_INLINE
void LL_RNG_EnableCondReset(
RNG_TypeDef *RNGx)
292 SET_BIT(RNGx->
CR, RNG_CR_CONDRST);
301__STATIC_INLINE
void LL_RNG_DisableCondReset(
RNG_TypeDef *RNGx)
303 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
312__STATIC_INLINE uint32_t LL_RNG_IsEnabledCondReset(
const RNG_TypeDef *RNGx)
314 return ((READ_BIT(RNGx->
CR, RNG_CR_CONDRST) == (RNG_CR_CONDRST)) ? 1UL : 0UL);
323__STATIC_INLINE
void LL_RNG_ConfigLock(
RNG_TypeDef *RNGx)
325 SET_BIT(RNGx->
CR, RNG_CR_CONFIGLOCK);
334__STATIC_INLINE uint32_t LL_RNG_IsConfigLocked(
const RNG_TypeDef *RNGx)
336 return ((READ_BIT(RNGx->
CR, RNG_CR_CONFIGLOCK) == (RNG_CR_CONFIGLOCK)) ? 1UL : 0UL);
345__STATIC_INLINE
void LL_RNG_EnableNistCompliance(
RNG_TypeDef *RNGx)
347 MODIFY_REG(RNGx->
CR, RNG_CR_NISTC | RNG_CR_CONDRST, LL_RNG_NIST_COMPLIANT | RNG_CR_CONDRST);
348 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
357__STATIC_INLINE
void LL_RNG_DisableNistCompliance(
RNG_TypeDef *RNGx)
359 MODIFY_REG(RNGx->
CR, RNG_CR_NISTC | RNG_CR_CONDRST, LL_RNG_CUSTOM_NIST | RNG_CR_CONDRST);
360 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
369__STATIC_INLINE uint32_t LL_RNG_IsEnabledNistCompliance(
const RNG_TypeDef *RNGx)
371 return ((READ_BIT(RNGx->
CR, RNG_CR_NISTC) != (RNG_CR_NISTC)) ? 1UL : 0UL);
381__STATIC_INLINE
void LL_RNG_SetConfig1(
RNG_TypeDef *RNGx, uint32_t Config1)
383 MODIFY_REG(RNGx->
CR, RNG_CR_RNG_CONFIG1 | RNG_CR_CONDRST, (Config1 << RNG_CR_RNG_CONFIG1_Pos) | RNG_CR_CONDRST);
384 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
393__STATIC_INLINE uint32_t LL_RNG_GetConfig1(
const RNG_TypeDef *RNGx)
395 return (uint32_t)(READ_BIT(RNGx->
CR, RNG_CR_RNG_CONFIG1) >> RNG_CR_RNG_CONFIG1_Pos);
405__STATIC_INLINE
void LL_RNG_SetConfig2(
RNG_TypeDef *RNGx, uint32_t Config2)
407 MODIFY_REG(RNGx->
CR, RNG_CR_RNG_CONFIG2 | RNG_CR_CONDRST, (Config2 << RNG_CR_RNG_CONFIG2_Pos) | RNG_CR_CONDRST);
408 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
417__STATIC_INLINE uint32_t LL_RNG_GetConfig2(
const RNG_TypeDef *RNGx)
419 return (uint32_t)(READ_BIT(RNGx->
CR, RNG_CR_RNG_CONFIG2) >> RNG_CR_RNG_CONFIG2_Pos);
429__STATIC_INLINE
void LL_RNG_SetConfig3(
RNG_TypeDef *RNGx, uint32_t Config3)
431 MODIFY_REG(RNGx->
CR, RNG_CR_RNG_CONFIG3 | RNG_CR_CONDRST, (Config3 << RNG_CR_RNG_CONFIG3_Pos) | RNG_CR_CONDRST);
432 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
441__STATIC_INLINE uint32_t LL_RNG_GetConfig3(
const RNG_TypeDef *RNGx)
443 return (uint32_t)(READ_BIT(RNGx->
CR, RNG_CR_RNG_CONFIG3) >> RNG_CR_RNG_CONFIG3_Pos);
469__STATIC_INLINE
void LL_RNG_SetClockDivider(
RNG_TypeDef *RNGx, uint32_t Divider)
471 MODIFY_REG(RNGx->
CR, RNG_CR_CLKDIV | RNG_CR_CONDRST, Divider | RNG_CR_CONDRST);
472 CLEAR_BIT(RNGx->
CR, RNG_CR_CONDRST);
497__STATIC_INLINE uint32_t LL_RNG_GetClockDivider(
const RNG_TypeDef *RNGx)
499 return (uint32_t)READ_BIT(RNGx->
CR, RNG_CR_CLKDIV);
517__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_DRDY(
const RNG_TypeDef *RNGx)
519 return ((READ_BIT(RNGx->
SR, RNG_SR_DRDY) == (RNG_SR_DRDY)) ? 1UL : 0UL);
528__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CECS(
const RNG_TypeDef *RNGx)
530 return ((READ_BIT(RNGx->
SR, RNG_SR_CECS) == (RNG_SR_CECS)) ? 1UL : 0UL);
539__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SECS(
const RNG_TypeDef *RNGx)
541 return ((READ_BIT(RNGx->
SR, RNG_SR_SECS) == (RNG_SR_SECS)) ? 1UL : 0UL);
550__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CEIS(
const RNG_TypeDef *RNGx)
552 return ((READ_BIT(RNGx->
SR, RNG_SR_CEIS) == (RNG_SR_CEIS)) ? 1UL : 0UL);
561__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SEIS(
const RNG_TypeDef *RNGx)
563 return ((READ_BIT(RNGx->
SR, RNG_SR_SEIS) == (RNG_SR_SEIS)) ? 1UL : 0UL);
572__STATIC_INLINE
void LL_RNG_ClearFlag_CEIS(
RNG_TypeDef *RNGx)
574 WRITE_REG(RNGx->
SR, ~RNG_SR_CEIS);
583__STATIC_INLINE
void LL_RNG_ClearFlag_SEIS(
RNG_TypeDef *RNGx)
585 WRITE_REG(RNGx->
SR, ~RNG_SR_SEIS);
604__STATIC_INLINE
void LL_RNG_EnableIT(
RNG_TypeDef *RNGx)
606 SET_BIT(RNGx->
CR, RNG_CR_IE);
616__STATIC_INLINE
void LL_RNG_DisableIT(
RNG_TypeDef *RNGx)
618 CLEAR_BIT(RNGx->
CR, RNG_CR_IE);
628__STATIC_INLINE uint32_t LL_RNG_IsEnabledIT(
const RNG_TypeDef *RNGx)
630 return ((READ_BIT(RNGx->
CR, RNG_CR_IE) == (RNG_CR_IE)) ? 1UL : 0UL);
648__STATIC_INLINE uint32_t LL_RNG_ReadRandData32(
const RNG_TypeDef *RNGx)
650 return (uint32_t)(READ_REG(RNGx->
DR));
657#if defined(RNG_VER_3_2) || defined(RNG_VER_3_1) || defined(RNG_VER_3_0)
670__STATIC_INLINE
void LL_RNG_SetHealthConfig(
RNG_TypeDef *RNGx, uint32_t HTCFG)
673 WRITE_REG(RNGx->
HTCR, LL_RNG_HTCFG);
675 WRITE_REG(RNGx->
HTCR, HTCFG);
684__STATIC_INLINE uint32_t LL_RNG_GetHealthConfig(
RNG_TypeDef *RNGx)
687 WRITE_REG(RNGx->
HTCR, LL_RNG_HTCFG);
689 return (uint32_t)READ_REG(RNGx->
HTCR);
696#if defined(USE_FULL_LL_DRIVER) || defined(__rtems__)
701ErrorStatus LL_RNG_Init(
RNG_TypeDef *RNGx, LL_RNG_InitTypeDef *RNG_InitStruct);
702void LL_RNG_StructInit(LL_RNG_InitTypeDef *RNG_InitStruct);
CMSIS STM32H7xx Device Peripheral Access Layer Header File.
RNG.
Definition: stm32h723xx.h:1668
__IO uint32_t SR
Definition: stm32h723xx.h:1670
__IO uint32_t DR
Definition: stm32h723xx.h:1671
__IO uint32_t HTCR
Definition: stm32h723xx.h:1673
__IO uint32_t CR
Definition: stm32h723xx.h:1669