STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_ll_rng.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef __STM32L4xx_LL_RNG_H
22 #define __STM32L4xx_LL_RNG_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32l4xx.h"
30 
35 #if defined(RNG)
36 
41 /* Private types -------------------------------------------------------------*/
42 /* Private variables ---------------------------------------------------------*/
43 /* Private constants ---------------------------------------------------------*/
44 /* Private macros ------------------------------------------------------------*/
45 
46 /* Exported types ------------------------------------------------------------*/
47 #if defined(USE_FULL_LL_DRIVER)
48 
53 #if defined(RNG_CR_CED)
54 
57 typedef struct
58 {
64 #endif /* defined(RNG_CR_CED) */
65 
69 #endif /* USE_FULL_LL_DRIVER */
70 
71 /* Exported constants --------------------------------------------------------*/
76 #if defined(RNG_CR_CED)
77 
80 #define LL_RNG_CED_ENABLE 0x00000000U
81 #define LL_RNG_CED_DISABLE RNG_CR_CED
85 #endif /* defined(RNG_CR_CED) */
86 
87 
92 #define LL_RNG_SR_DRDY RNG_SR_DRDY
93 #define LL_RNG_SR_CECS RNG_SR_CECS
94 #define LL_RNG_SR_SECS RNG_SR_SECS
95 #define LL_RNG_SR_CEIS RNG_SR_CEIS
96 #define LL_RNG_SR_SEIS RNG_SR_SEIS
105 #define LL_RNG_CR_IE RNG_CR_IE
114 /* Exported macro ------------------------------------------------------------*/
115 
130 #define LL_RNG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__))
131 
138 #define LL_RNG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__)
139 
148 /* Exported functions --------------------------------------------------------*/
162 __STATIC_INLINE void LL_RNG_Enable(RNG_TypeDef *RNGx)
163 {
164  SET_BIT(RNGx->CR, RNG_CR_RNGEN);
165 }
166 
173 __STATIC_INLINE void LL_RNG_Disable(RNG_TypeDef *RNGx)
174 {
175  CLEAR_BIT(RNGx->CR, RNG_CR_RNGEN);
176 }
177 
184 __STATIC_INLINE uint32_t LL_RNG_IsEnabled(RNG_TypeDef *RNGx)
185 {
186  return (READ_BIT(RNGx->CR, RNG_CR_RNGEN) == (RNG_CR_RNGEN));
187 }
188 
189 #if defined(RNG_CR_CED)
190 
196 __STATIC_INLINE void LL_RNG_EnableClkErrorDetect(RNG_TypeDef *RNGx)
197 {
198  CLEAR_BIT(RNGx->CR, RNG_CR_CED);
199 }
200 
207 __STATIC_INLINE void LL_RNG_DisableClkErrorDetect(RNG_TypeDef *RNGx)
208 {
209  SET_BIT(RNGx->CR, RNG_CR_CED);
210 }
211 
218 __STATIC_INLINE uint32_t LL_RNG_IsEnabledClkErrorDetect(RNG_TypeDef *RNGx)
219 {
220  return (!(READ_BIT(RNGx->CR, RNG_CR_CED) == (RNG_CR_CED)));
221 }
222 #endif /* defined(RNG_CR_CED) */
223 
224 
239 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_DRDY(RNG_TypeDef *RNGx)
240 {
241  return (READ_BIT(RNGx->SR, RNG_SR_DRDY) == (RNG_SR_DRDY));
242 }
243 
250 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CECS(RNG_TypeDef *RNGx)
251 {
252  return (READ_BIT(RNGx->SR, RNG_SR_CECS) == (RNG_SR_CECS));
253 }
254 
261 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SECS(RNG_TypeDef *RNGx)
262 {
263  return (READ_BIT(RNGx->SR, RNG_SR_SECS) == (RNG_SR_SECS));
264 }
265 
272 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CEIS(RNG_TypeDef *RNGx)
273 {
274  return (READ_BIT(RNGx->SR, RNG_SR_CEIS) == (RNG_SR_CEIS));
275 }
276 
283 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SEIS(RNG_TypeDef *RNGx)
284 {
285  return (READ_BIT(RNGx->SR, RNG_SR_SEIS) == (RNG_SR_SEIS));
286 }
287 
294 __STATIC_INLINE void LL_RNG_ClearFlag_CEIS(RNG_TypeDef *RNGx)
295 {
296  WRITE_REG(RNGx->SR, ~RNG_SR_CEIS);
297 }
298 
305 __STATIC_INLINE void LL_RNG_ClearFlag_SEIS(RNG_TypeDef *RNGx)
306 {
307  WRITE_REG(RNGx->SR, ~RNG_SR_SEIS);
308 }
309 
325 __STATIC_INLINE void LL_RNG_EnableIT(RNG_TypeDef *RNGx)
326 {
327  SET_BIT(RNGx->CR, RNG_CR_IE);
328 }
329 
337 __STATIC_INLINE void LL_RNG_DisableIT(RNG_TypeDef *RNGx)
338 {
339  CLEAR_BIT(RNGx->CR, RNG_CR_IE);
340 }
341 
349 __STATIC_INLINE uint32_t LL_RNG_IsEnabledIT(RNG_TypeDef *RNGx)
350 {
351  return (READ_BIT(RNGx->CR, RNG_CR_IE) == (RNG_CR_IE));
352 }
353 
368 __STATIC_INLINE uint32_t LL_RNG_ReadRandData32(RNG_TypeDef *RNGx)
369 {
370  return (uint32_t)(READ_REG(RNGx->DR));
371 }
372 
377 #if defined(USE_FULL_LL_DRIVER)
378 
381 #if defined(RNG_CR_CED)
382 ErrorStatus LL_RNG_Init(RNG_TypeDef *RNGx, LL_RNG_InitTypeDef *RNG_InitStruct);
383 void LL_RNG_StructInit(LL_RNG_InitTypeDef *RNG_InitStruct);
384 #endif /* defined(RNG_CR_CED) */
385 ErrorStatus LL_RNG_DeInit(RNG_TypeDef *RNGx);
386 
390 #endif /* USE_FULL_LL_DRIVER */
391 
400 #endif /* defined(RNG) */
401 
406 #ifdef __cplusplus
407 }
408 #endif
409 
410 #endif /* __STM32L4xx_LL_RNG_H */
411 
412 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
__STATIC_INLINE void LL_RNG_Disable(RNG_TypeDef *RNGx)
Disable Random Number Generation CR RNGEN LL_RNG_Disable.
__STATIC_INLINE uint32_t LL_RNG_IsEnabledClkErrorDetect(RNG_TypeDef *RNGx)
Check if RNG Clock Error Detection is enabled CR CED LL_RNG_IsEnabledClkErrorDetect.
ErrorStatus LL_RNG_Init(RNG_TypeDef *RNGx, LL_RNG_InitTypeDef *RNG_InitStruct)
Initialize RNG registers according to the specified parameters in RNG_InitStruct. ...
__STATIC_INLINE void LL_RNG_EnableClkErrorDetect(RNG_TypeDef *RNGx)
Enable RNG Clock Error Detection CR CED LL_RNG_EnableClkErrorDetect.
__STATIC_INLINE void LL_RNG_Enable(RNG_TypeDef *RNGx)
Enable Random Number Generation CR RNGEN LL_RNG_Enable.
uint32_t ClockErrorDetection
__STATIC_INLINE void LL_RNG_ClearFlag_CEIS(RNG_TypeDef *RNGx)
Clear Clock Error interrupt Status (CEIS) Flag SR CEIS LL_RNG_ClearFlag_CEIS.
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
__STATIC_INLINE void LL_RNG_DisableIT(RNG_TypeDef *RNGx)
Disable Random Number Generator Interrupt (applies for either Seed error, Clock Error or Data ready i...
void LL_RNG_StructInit(LL_RNG_InitTypeDef *RNG_InitStruct)
Set each LL_RNG_InitTypeDef field to default value.
__STATIC_INLINE void LL_RNG_DisableClkErrorDetect(RNG_TypeDef *RNGx)
Disable RNG Clock Error Detection CR CED LL_RNG_DisableClkErrorDetect.
__STATIC_INLINE void LL_RNG_EnableIT(RNG_TypeDef *RNGx)
Enable Random Number Generator Interrupt (applies for either Seed error, Clock Error or Data ready in...
__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SEIS(RNG_TypeDef *RNGx)
Indicate if the Seed Error Interrupt Status Flag is set or not SR SEIS LL_RNG_IsActiveFlag_SEIS.
__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CECS(RNG_TypeDef *RNGx)
Indicate if the Clock Error Current Status Flag is set or not SR CECS LL_RNG_IsActiveFlag_CECS.
__STATIC_INLINE void LL_RNG_ClearFlag_SEIS(RNG_TypeDef *RNGx)
Clear Seed Error interrupt Status (SEIS) Flag SR SEIS LL_RNG_ClearFlag_SEIS.
ErrorStatus LL_RNG_DeInit(RNG_TypeDef *RNGx)
De-initialize RNG registers (Registers restored to their default values).
__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SECS(RNG_TypeDef *RNGx)
Indicate if the Seed Error Current Status Flag is set or not SR SECS LL_RNG_IsActiveFlag_SECS.
__STATIC_INLINE uint32_t LL_RNG_ReadRandData32(RNG_TypeDef *RNGx)
Return32-bit Random Number value DR RNDATA LL_RNG_ReadRandData32.
__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CEIS(RNG_TypeDef *RNGx)
Indicate if the Clock Error Interrupt Status Flag is set or not SR CEIS LL_RNG_IsActiveFlag_CEIS.
LL RNG Init Structure Definition.
__STATIC_INLINE uint32_t LL_RNG_IsEnabledIT(RNG_TypeDef *RNGx)
Check if Random Number Generator Interrupt is enabled (applies for either Seed error, Clock Error or Data ready interrupts) CR IE LL_RNG_IsEnabledIT.
__STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_DRDY(RNG_TypeDef *RNGx)
Indicate if the RNG Data ready Flag is set or not SR DRDY LL_RNG_IsActiveFlag_DRDY.
__STATIC_INLINE uint32_t LL_RNG_IsEnabled(RNG_TypeDef *RNGx)
Check if Random Number Generator is enabled CR RNGEN LL_RNG_IsEnabled.