STM32H735xx HAL User Manual
|
00001 /** 00002 ****************************************************************************** 00003 * @file stm32h7xx_ll_rng.h 00004 * @author MCD Application Team 00005 * @brief Header file of RNG LL module. 00006 ****************************************************************************** 00007 * @attention 00008 * 00009 * Copyright (c) 2017 STMicroelectronics. 00010 * All rights reserved. 00011 * 00012 * This software is licensed under terms that can be found in the LICENSE file 00013 * in the root directory of this software component. 00014 * If no LICENSE file comes with this software, it is provided AS-IS. 00015 * 00016 ****************************************************************************** 00017 */ 00018 00019 /* Define to prevent recursive inclusion -------------------------------------*/ 00020 #ifndef STM32H7xx_LL_RNG_H 00021 #define STM32H7xx_LL_RNG_H 00022 00023 #ifdef __cplusplus 00024 extern "C" { 00025 #endif 00026 00027 /* Includes ------------------------------------------------------------------*/ 00028 #include "stm32h7xx.h" 00029 00030 /** @addtogroup STM32H7xx_LL_Driver 00031 * @{ 00032 */ 00033 00034 #if defined (RNG) 00035 00036 /** @defgroup RNG_LL RNG 00037 * @{ 00038 */ 00039 00040 /* Private types -------------------------------------------------------------*/ 00041 /* Private variables ---------------------------------------------------------*/ 00042 /* Private constants ---------------------------------------------------------*/ 00043 /* Private macros ------------------------------------------------------------*/ 00044 00045 /* Exported types ------------------------------------------------------------*/ 00046 #if defined(USE_FULL_LL_DRIVER) 00047 /** @defgroup RNG_LL_ES_Init_Struct RNG Exported Init structures 00048 * @{ 00049 */ 00050 00051 00052 /** 00053 * @brief LL RNG Init Structure Definition 00054 */ 00055 typedef struct 00056 { 00057 uint32_t ClockErrorDetection; /*!< Clock error detection. 00058 This parameter can be one value of @ref RNG_LL_CED. 00059 This parameter can be modified using unitary 00060 functions @ref LL_RNG_EnableClkErrorDetect(). */ 00061 } LL_RNG_InitTypeDef; 00062 00063 /** 00064 * @} 00065 */ 00066 #endif /* USE_FULL_LL_DRIVER */ 00067 /* Exported constants --------------------------------------------------------*/ 00068 /** @defgroup RNG_LL_Exported_Constants RNG Exported Constants 00069 * @{ 00070 */ 00071 00072 /** @defgroup RNG_LL_CED Clock Error Detection 00073 * @{ 00074 */ 00075 #define LL_RNG_CED_ENABLE 0x00000000U /*!< Clock error detection enabled */ 00076 #define LL_RNG_CED_DISABLE RNG_CR_CED /*!< Clock error detection disabled */ 00077 /** 00078 * @} 00079 */ 00080 00081 #if defined(RNG_CR_CONDRST) 00082 /** @defgroup RNG_LL_Clock_Divider_Factor Value used to configure an internal 00083 * programmable divider acting on the incoming RNG clock 00084 * @{ 00085 */ 00086 #define LL_RNG_CLKDIV_BY_1 (0x00000000UL) /*!< No clock division */ 00087 #define LL_RNG_CLKDIV_BY_2 (RNG_CR_CLKDIV_0) /*!< 2 RNG clock cycles per internal RNG clock */ 00088 #define LL_RNG_CLKDIV_BY_4 (RNG_CR_CLKDIV_1) /*!< 4 RNG clock cycles per internal RNG clock */ 00089 #define LL_RNG_CLKDIV_BY_8 (RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) /*!< 8 RNG clock cycles per internal RNG clock */ 00090 #define LL_RNG_CLKDIV_BY_16 (RNG_CR_CLKDIV_2) /*!< 16 RNG clock cycles per internal RNG clock */ 00091 #define LL_RNG_CLKDIV_BY_32 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0) /*!< 32 RNG clock cycles per internal RNG clock */ 00092 #define LL_RNG_CLKDIV_BY_64 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1) /*!< 64 RNG clock cycles per internal RNG clock */ 00093 #define LL_RNG_CLKDIV_BY_128 (RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) /*!< 128 RNG clock cycles per internal RNG clock */ 00094 #define LL_RNG_CLKDIV_BY_256 (RNG_CR_CLKDIV_3) /*!< 256 RNG clock cycles per internal RNG clock */ 00095 #define LL_RNG_CLKDIV_BY_512 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_0) /*!< 512 RNG clock cycles per internal RNG clock */ 00096 #define LL_RNG_CLKDIV_BY_1024 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1) /*!< 1024 RNG clock cycles per internal RNG clock */ 00097 #define LL_RNG_CLKDIV_BY_2048 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) /*!< 2048 RNG clock cycles per internal RNG clock */ 00098 #define LL_RNG_CLKDIV_BY_4096 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2) /*!< 4096 RNG clock cycles per internal RNG clock */ 00099 #define LL_RNG_CLKDIV_BY_8192 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_0) /*!< 8192 RNG clock cycles per internal RNG clock */ 00100 #define LL_RNG_CLKDIV_BY_16384 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1) /*!< 16384 RNG clock cycles per internal RNG clock */ 00101 #define LL_RNG_CLKDIV_BY_32768 (RNG_CR_CLKDIV_3 | RNG_CR_CLKDIV_2 | RNG_CR_CLKDIV_1 | RNG_CR_CLKDIV_0) /*!< 32768 RNG clock cycles per internal RNG clock */ 00102 /** 00103 * @} 00104 */ 00105 00106 /** @defgroup RNG_LL_NIST_Compliance NIST Compliance configuration 00107 * @{ 00108 */ 00109 #define LL_RNG_NIST_COMPLIANT (0x00000000UL) /*!< Default NIST compliant configuration*/ 00110 #define LL_RNG_CUSTOM_NIST (RNG_CR_NISTC) /*!< Custom NIST configuration */ 00111 00112 /** 00113 * @} 00114 */ 00115 00116 #endif /* RNG_CR_CONDRST */ 00117 /** @defgroup RNG_LL_EC_GET_FLAG Get Flags Defines 00118 * @brief Flags defines which can be used with LL_RNG_ReadReg function 00119 * @{ 00120 */ 00121 #define LL_RNG_SR_DRDY RNG_SR_DRDY /*!< Register contains valid random data */ 00122 #define LL_RNG_SR_CECS RNG_SR_CECS /*!< Clock error current status */ 00123 #define LL_RNG_SR_SECS RNG_SR_SECS /*!< Seed error current status */ 00124 #define LL_RNG_SR_CEIS RNG_SR_CEIS /*!< Clock error interrupt status */ 00125 #define LL_RNG_SR_SEIS RNG_SR_SEIS /*!< Seed error interrupt status */ 00126 /** 00127 * @} 00128 */ 00129 00130 /** @defgroup RNG_LL_EC_IT IT Defines 00131 * @brief IT defines which can be used with LL_RNG_ReadReg and LL_RNG_WriteReg macros 00132 * @{ 00133 */ 00134 #define LL_RNG_CR_IE RNG_CR_IE /*!< RNG Interrupt enable */ 00135 /** 00136 * @} 00137 */ 00138 00139 /** 00140 * @} 00141 */ 00142 00143 /* Exported macro ------------------------------------------------------------*/ 00144 /** @defgroup RNG_LL_Exported_Macros RNG Exported Macros 00145 * @{ 00146 */ 00147 00148 /** @defgroup RNG_LL_EM_WRITE_READ Common Write and read registers Macros 00149 * @{ 00150 */ 00151 00152 /** 00153 * @brief Write a value in RNG register 00154 * @param __INSTANCE__ RNG Instance 00155 * @param __REG__ Register to be written 00156 * @param __VALUE__ Value to be written in the register 00157 * @retval None 00158 */ 00159 #define LL_RNG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00160 00161 /** 00162 * @brief Read a value in RNG register 00163 * @param __INSTANCE__ RNG Instance 00164 * @param __REG__ Register to be read 00165 * @retval Register value 00166 */ 00167 #define LL_RNG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00168 /** 00169 * @} 00170 */ 00171 00172 /** 00173 * @} 00174 */ 00175 00176 00177 /* Exported functions --------------------------------------------------------*/ 00178 /** @defgroup RNG_LL_Exported_Functions RNG Exported Functions 00179 * @{ 00180 */ 00181 /** @defgroup RNG_LL_EF_Configuration RNG Configuration functions 00182 * @{ 00183 */ 00184 00185 /** 00186 * @brief Enable Random Number Generation 00187 * @rmtoll CR RNGEN LL_RNG_Enable 00188 * @param RNGx RNG Instance 00189 * @retval None 00190 */ 00191 __STATIC_INLINE void LL_RNG_Enable(RNG_TypeDef *RNGx) 00192 { 00193 SET_BIT(RNGx->CR, RNG_CR_RNGEN); 00194 } 00195 00196 /** 00197 * @brief Disable Random Number Generation 00198 * @rmtoll CR RNGEN LL_RNG_Disable 00199 * @param RNGx RNG Instance 00200 * @retval None 00201 */ 00202 __STATIC_INLINE void LL_RNG_Disable(RNG_TypeDef *RNGx) 00203 { 00204 CLEAR_BIT(RNGx->CR, RNG_CR_RNGEN); 00205 } 00206 00207 /** 00208 * @brief Check if Random Number Generator is enabled 00209 * @rmtoll CR RNGEN LL_RNG_IsEnabled 00210 * @param RNGx RNG Instance 00211 * @retval State of bit (1 or 0). 00212 */ 00213 __STATIC_INLINE uint32_t LL_RNG_IsEnabled(RNG_TypeDef *RNGx) 00214 { 00215 return ((READ_BIT(RNGx->CR, RNG_CR_RNGEN) == (RNG_CR_RNGEN)) ? 1UL : 0UL); 00216 } 00217 00218 /** 00219 * @brief Enable Clock Error Detection 00220 * @rmtoll CR CED LL_RNG_EnableClkErrorDetect 00221 * @param RNGx RNG Instance 00222 * @retval None 00223 */ 00224 __STATIC_INLINE void LL_RNG_EnableClkErrorDetect(RNG_TypeDef *RNGx) 00225 { 00226 CLEAR_BIT(RNGx->CR, RNG_CR_CED); 00227 } 00228 00229 /** 00230 * @brief Disable RNG Clock Error Detection 00231 * @rmtoll CR CED LL_RNG_DisableClkErrorDetect 00232 * @param RNGx RNG Instance 00233 * @retval None 00234 */ 00235 __STATIC_INLINE void LL_RNG_DisableClkErrorDetect(RNG_TypeDef *RNGx) 00236 { 00237 SET_BIT(RNGx->CR, RNG_CR_CED); 00238 } 00239 00240 /** 00241 * @brief Check if RNG Clock Error Detection is enabled 00242 * @rmtoll CR CED LL_RNG_IsEnabledClkErrorDetect 00243 * @param RNGx RNG Instance 00244 * @retval State of bit (1 or 0). 00245 */ 00246 __STATIC_INLINE uint32_t LL_RNG_IsEnabledClkErrorDetect(RNG_TypeDef *RNGx) 00247 { 00248 return ((READ_BIT(RNGx->CR, RNG_CR_CED) != (RNG_CR_CED)) ? 1UL : 0UL); 00249 } 00250 00251 #if defined(RNG_CR_CONDRST) 00252 /** 00253 * @brief Set RNG Conditioning Soft Reset bit 00254 * @rmtoll CR CONDRST LL_RNG_EnableCondReset 00255 * @param RNGx RNG Instance 00256 * @retval None 00257 */ 00258 __STATIC_INLINE void LL_RNG_EnableCondReset(RNG_TypeDef *RNGx) 00259 { 00260 SET_BIT(RNGx->CR, RNG_CR_CONDRST); 00261 } 00262 00263 /** 00264 * @brief Reset RNG Conditioning Soft Reset bit 00265 * @rmtoll CR CONDRST LL_RNG_DisableCondReset 00266 * @param RNGx RNG Instance 00267 * @retval None 00268 */ 00269 __STATIC_INLINE void LL_RNG_DisableCondReset(RNG_TypeDef *RNGx) 00270 { 00271 CLEAR_BIT(RNGx->CR, RNG_CR_CONDRST); 00272 } 00273 00274 /** 00275 * @brief Check if RNG Conditioning Soft Reset bit is set 00276 * @rmtoll CR CONDRST LL_RNG_IsEnabledCondReset 00277 * @param RNGx RNG Instance 00278 * @retval State of bit (1 or 0). 00279 */ 00280 __STATIC_INLINE uint32_t LL_RNG_IsEnabledCondReset(RNG_TypeDef *RNGx) 00281 { 00282 return ((READ_BIT(RNGx->CR, RNG_CR_CONDRST) == (RNG_CR_CONDRST)) ? 1UL : 0UL); 00283 } 00284 00285 /** 00286 * @brief Enable RNG Config Lock 00287 * @rmtoll CR CONFIGLOCK LL_RNG_ConfigLock 00288 * @param RNGx RNG Instance 00289 * @retval None 00290 */ 00291 __STATIC_INLINE void LL_RNG_ConfigLock(RNG_TypeDef *RNGx) 00292 { 00293 SET_BIT(RNGx->CR, RNG_CR_CONFIGLOCK); 00294 } 00295 00296 /** 00297 * @brief Check if RNG Config Lock is enabled 00298 * @rmtoll CR CONFIGLOCK LL_RNG_IsConfigLocked 00299 * @param RNGx RNG Instance 00300 * @retval State of bit (1 or 0). 00301 */ 00302 __STATIC_INLINE uint32_t LL_RNG_IsConfigLocked(RNG_TypeDef *RNGx) 00303 { 00304 return ((READ_BIT(RNGx->CR, RNG_CR_CONFIGLOCK) == (RNG_CR_CONFIGLOCK)) ? 1UL : 0UL); 00305 } 00306 00307 /** 00308 * @brief Enable NIST Compliance 00309 * @rmtoll CR NISTC LL_RNG_EnableNistCompliance 00310 * @param RNGx RNG Instance 00311 * @retval None 00312 */ 00313 __STATIC_INLINE void LL_RNG_EnableNistCompliance(RNG_TypeDef *RNGx) 00314 { 00315 CLEAR_BIT(RNGx->CR, RNG_CR_NISTC); 00316 } 00317 00318 /** 00319 * @brief Disable NIST Compliance 00320 * @rmtoll CR NISTC LL_RNG_DisableNistCompliance 00321 * @param RNGx RNG Instance 00322 * @retval None 00323 */ 00324 __STATIC_INLINE void LL_RNG_DisableNistCompliance(RNG_TypeDef *RNGx) 00325 { 00326 SET_BIT(RNGx->CR, RNG_CR_NISTC); 00327 } 00328 00329 /** 00330 * @brief Check if NIST Compliance is enabled 00331 * @rmtoll CR NISTC LL_RNG_IsEnabledNistCompliance 00332 * @param RNGx RNG Instance 00333 * @retval State of bit (1 or 0). 00334 */ 00335 __STATIC_INLINE uint32_t LL_RNG_IsEnabledNistCompliance(RNG_TypeDef *RNGx) 00336 { 00337 return ((READ_BIT(RNGx->CR, RNG_CR_NISTC) != (RNG_CR_NISTC)) ? 1UL : 0UL); 00338 } 00339 00340 /** 00341 * @brief Set RNG Config1 Configuration field value 00342 * @rmtoll CR RNG_CONFIG1 LL_RNG_SetConfig1 00343 * @param RNGx RNG Instance 00344 * @param Config1 Value between 0 and 0x3F 00345 * @retval None 00346 */ 00347 __STATIC_INLINE void LL_RNG_SetConfig1(RNG_TypeDef *RNGx, uint32_t Config1) 00348 { 00349 MODIFY_REG(RNGx->CR, RNG_CR_RNG_CONFIG1, Config1 << RNG_CR_RNG_CONFIG1_Pos); 00350 } 00351 00352 /** 00353 * @brief Get RNG Config1 Configuration field value 00354 * @rmtoll CR RNG_CONFIG1 LL_RNG_GetConfig1 00355 * @param RNGx RNG Instance 00356 * @retval Returned Value expressed on 6 bits : Value between 0 and 0x3F 00357 */ 00358 __STATIC_INLINE uint32_t LL_RNG_GetConfig1(RNG_TypeDef *RNGx) 00359 { 00360 return (uint32_t)(READ_BIT(RNGx->CR, RNG_CR_RNG_CONFIG1) >> RNG_CR_RNG_CONFIG1_Pos); 00361 } 00362 00363 /** 00364 * @brief Set RNG Config2 Configuration field value 00365 * @rmtoll CR RNG_CONFIG2 LL_RNG_SetConfig2 00366 * @param RNGx RNG Instance 00367 * @param Config2 Value between 0 and 0x7 00368 * @retval None 00369 */ 00370 __STATIC_INLINE void LL_RNG_SetConfig2(RNG_TypeDef *RNGx, uint32_t Config2) 00371 { 00372 MODIFY_REG(RNGx->CR, RNG_CR_RNG_CONFIG2, Config2 << RNG_CR_RNG_CONFIG2_Pos); 00373 } 00374 00375 /** 00376 * @brief Get RNG Config2 Configuration field value 00377 * @rmtoll CR RNG_CONFIG2 LL_RNG_GetConfig2 00378 * @param RNGx RNG Instance 00379 * @retval Returned Value expressed on 3 bits : Value between 0 and 0x7 00380 */ 00381 __STATIC_INLINE uint32_t LL_RNG_GetConfig2(RNG_TypeDef *RNGx) 00382 { 00383 return (uint32_t)(READ_BIT(RNGx->CR, RNG_CR_RNG_CONFIG2) >> RNG_CR_RNG_CONFIG2_Pos); 00384 } 00385 00386 /** 00387 * @brief Set RNG Config3 Configuration field value 00388 * @rmtoll CR RNG_CONFIG3 LL_RNG_SetConfig3 00389 * @param RNGx RNG Instance 00390 * @param Config3 Value between 0 and 0xF 00391 * @retval None 00392 */ 00393 __STATIC_INLINE void LL_RNG_SetConfig3(RNG_TypeDef *RNGx, uint32_t Config3) 00394 { 00395 MODIFY_REG(RNGx->CR, RNG_CR_RNG_CONFIG3, Config3 << RNG_CR_RNG_CONFIG3_Pos); 00396 } 00397 00398 /** 00399 * @brief Get RNG Config3 Configuration field value 00400 * @rmtoll CR RNG_CONFIG3 LL_RNG_GetConfig3 00401 * @param RNGx RNG Instance 00402 * @retval Returned Value expressed on 4 bits : Value between 0 and 0xF 00403 */ 00404 __STATIC_INLINE uint32_t LL_RNG_GetConfig3(RNG_TypeDef *RNGx) 00405 { 00406 return (uint32_t)(READ_BIT(RNGx->CR, RNG_CR_RNG_CONFIG3) >> RNG_CR_RNG_CONFIG3_Pos); 00407 } 00408 00409 /** 00410 * @brief Set RNG Clock divider factor 00411 * @rmtoll CR CLKDIV LL_RNG_SetClockDivider 00412 * @param RNGx RNG Instance 00413 * @param Divider can be one of the following values: 00414 * @arg @ref LL_RNG_CLKDIV_BY_1 00415 * @arg @ref LL_RNG_CLKDIV_BY_2 00416 * @arg @ref LL_RNG_CLKDIV_BY_4 00417 * @arg @ref LL_RNG_CLKDIV_BY_8 00418 * @arg @ref LL_RNG_CLKDIV_BY_16 00419 * @arg @ref LL_RNG_CLKDIV_BY_32 00420 * @arg @ref LL_RNG_CLKDIV_BY_64 00421 * @arg @ref LL_RNG_CLKDIV_BY_128 00422 * @arg @ref LL_RNG_CLKDIV_BY_256 00423 * @arg @ref LL_RNG_CLKDIV_BY_512 00424 * @arg @ref LL_RNG_CLKDIV_BY_1024 00425 * @arg @ref LL_RNG_CLKDIV_BY_2048 00426 * @arg @ref LL_RNG_CLKDIV_BY_4096 00427 * @arg @ref LL_RNG_CLKDIV_BY_8192 00428 * @arg @ref LL_RNG_CLKDIV_BY_16384 00429 * @arg @ref LL_RNG_CLKDIV_BY_32768 00430 * @retval None 00431 */ 00432 __STATIC_INLINE void LL_RNG_SetClockDivider(RNG_TypeDef *RNGx, uint32_t Divider) 00433 { 00434 MODIFY_REG(RNGx->CR, RNG_CR_CLKDIV, Divider << RNG_CR_CLKDIV_Pos); 00435 } 00436 00437 /** 00438 * @brief Get RNG Clock divider factor 00439 * @rmtoll CR CLKDIV LL_RNG_GetClockDivider 00440 * @param RNGx RNG Instance 00441 * @retval Returned value can be one of the following values: 00442 * @arg @ref LL_RNG_CLKDIV_BY_1 00443 * @arg @ref LL_RNG_CLKDIV_BY_2 00444 * @arg @ref LL_RNG_CLKDIV_BY_4 00445 * @arg @ref LL_RNG_CLKDIV_BY_8 00446 * @arg @ref LL_RNG_CLKDIV_BY_16 00447 * @arg @ref LL_RNG_CLKDIV_BY_32 00448 * @arg @ref LL_RNG_CLKDIV_BY_64 00449 * @arg @ref LL_RNG_CLKDIV_BY_128 00450 * @arg @ref LL_RNG_CLKDIV_BY_256 00451 * @arg @ref LL_RNG_CLKDIV_BY_512 00452 * @arg @ref LL_RNG_CLKDIV_BY_1024 00453 * @arg @ref LL_RNG_CLKDIV_BY_2048 00454 * @arg @ref LL_RNG_CLKDIV_BY_4096 00455 * @arg @ref LL_RNG_CLKDIV_BY_8192 00456 * @arg @ref LL_RNG_CLKDIV_BY_16384 00457 * @arg @ref LL_RNG_CLKDIV_BY_32768 00458 */ 00459 __STATIC_INLINE uint32_t LL_RNG_GetClockDivider(RNG_TypeDef *RNGx) 00460 { 00461 return (uint32_t)READ_BIT(RNGx->CR, RNG_CR_CLKDIV); 00462 } 00463 #endif /* RNG_CR_CONDRST */ 00464 /** 00465 * @} 00466 */ 00467 00468 /** @defgroup RNG_LL_EF_FLAG_Management FLAG Management 00469 * @{ 00470 */ 00471 00472 /** 00473 * @brief Indicate if the RNG Data ready Flag is set or not 00474 * @rmtoll SR DRDY LL_RNG_IsActiveFlag_DRDY 00475 * @param RNGx RNG Instance 00476 * @retval State of bit (1 or 0). 00477 */ 00478 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_DRDY(RNG_TypeDef *RNGx) 00479 { 00480 return ((READ_BIT(RNGx->SR, RNG_SR_DRDY) == (RNG_SR_DRDY)) ? 1UL : 0UL); 00481 } 00482 00483 /** 00484 * @brief Indicate if the Clock Error Current Status Flag is set or not 00485 * @rmtoll SR CECS LL_RNG_IsActiveFlag_CECS 00486 * @param RNGx RNG Instance 00487 * @retval State of bit (1 or 0). 00488 */ 00489 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CECS(RNG_TypeDef *RNGx) 00490 { 00491 return ((READ_BIT(RNGx->SR, RNG_SR_CECS) == (RNG_SR_CECS)) ? 1UL : 0UL); 00492 } 00493 00494 /** 00495 * @brief Indicate if the Seed Error Current Status Flag is set or not 00496 * @rmtoll SR SECS LL_RNG_IsActiveFlag_SECS 00497 * @param RNGx RNG Instance 00498 * @retval State of bit (1 or 0). 00499 */ 00500 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SECS(RNG_TypeDef *RNGx) 00501 { 00502 return ((READ_BIT(RNGx->SR, RNG_SR_SECS) == (RNG_SR_SECS)) ? 1UL : 0UL); 00503 } 00504 00505 /** 00506 * @brief Indicate if the Clock Error Interrupt Status Flag is set or not 00507 * @rmtoll SR CEIS LL_RNG_IsActiveFlag_CEIS 00508 * @param RNGx RNG Instance 00509 * @retval State of bit (1 or 0). 00510 */ 00511 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CEIS(RNG_TypeDef *RNGx) 00512 { 00513 return ((READ_BIT(RNGx->SR, RNG_SR_CEIS) == (RNG_SR_CEIS)) ? 1UL : 0UL); 00514 } 00515 00516 /** 00517 * @brief Indicate if the Seed Error Interrupt Status Flag is set or not 00518 * @rmtoll SR SEIS LL_RNG_IsActiveFlag_SEIS 00519 * @param RNGx RNG Instance 00520 * @retval State of bit (1 or 0). 00521 */ 00522 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SEIS(RNG_TypeDef *RNGx) 00523 { 00524 return ((READ_BIT(RNGx->SR, RNG_SR_SEIS) == (RNG_SR_SEIS)) ? 1UL : 0UL); 00525 } 00526 00527 /** 00528 * @brief Clear Clock Error interrupt Status (CEIS) Flag 00529 * @rmtoll SR CEIS LL_RNG_ClearFlag_CEIS 00530 * @param RNGx RNG Instance 00531 * @retval None 00532 */ 00533 __STATIC_INLINE void LL_RNG_ClearFlag_CEIS(RNG_TypeDef *RNGx) 00534 { 00535 WRITE_REG(RNGx->SR, ~RNG_SR_CEIS); 00536 } 00537 00538 /** 00539 * @brief Clear Seed Error interrupt Status (SEIS) Flag 00540 * @rmtoll SR SEIS LL_RNG_ClearFlag_SEIS 00541 * @param RNGx RNG Instance 00542 * @retval None 00543 */ 00544 __STATIC_INLINE void LL_RNG_ClearFlag_SEIS(RNG_TypeDef *RNGx) 00545 { 00546 WRITE_REG(RNGx->SR, ~RNG_SR_SEIS); 00547 } 00548 00549 /** 00550 * @} 00551 */ 00552 00553 /** @defgroup RNG_LL_EF_IT_Management IT Management 00554 * @{ 00555 */ 00556 00557 /** 00558 * @brief Enable Random Number Generator Interrupt 00559 * (applies for either Seed error, Clock Error or Data ready interrupts) 00560 * @rmtoll CR IE LL_RNG_EnableIT 00561 * @param RNGx RNG Instance 00562 * @retval None 00563 */ 00564 __STATIC_INLINE void LL_RNG_EnableIT(RNG_TypeDef *RNGx) 00565 { 00566 SET_BIT(RNGx->CR, RNG_CR_IE); 00567 } 00568 00569 /** 00570 * @brief Disable Random Number Generator Interrupt 00571 * (applies for either Seed error, Clock Error or Data ready interrupts) 00572 * @rmtoll CR IE LL_RNG_DisableIT 00573 * @param RNGx RNG Instance 00574 * @retval None 00575 */ 00576 __STATIC_INLINE void LL_RNG_DisableIT(RNG_TypeDef *RNGx) 00577 { 00578 CLEAR_BIT(RNGx->CR, RNG_CR_IE); 00579 } 00580 00581 /** 00582 * @brief Check if Random Number Generator Interrupt is enabled 00583 * (applies for either Seed error, Clock Error or Data ready interrupts) 00584 * @rmtoll CR IE LL_RNG_IsEnabledIT 00585 * @param RNGx RNG Instance 00586 * @retval State of bit (1 or 0). 00587 */ 00588 __STATIC_INLINE uint32_t LL_RNG_IsEnabledIT(RNG_TypeDef *RNGx) 00589 { 00590 return ((READ_BIT(RNGx->CR, RNG_CR_IE) == (RNG_CR_IE)) ? 1UL : 0UL); 00591 } 00592 00593 /** 00594 * @} 00595 */ 00596 00597 /** @defgroup RNG_LL_EF_Data_Management Data Management 00598 * @{ 00599 */ 00600 00601 /** 00602 * @brief Return32-bit Random Number value 00603 * @rmtoll DR RNDATA LL_RNG_ReadRandData32 00604 * @param RNGx RNG Instance 00605 * @retval Generated 32-bit random value 00606 */ 00607 __STATIC_INLINE uint32_t LL_RNG_ReadRandData32(RNG_TypeDef *RNGx) 00608 { 00609 return (uint32_t)(READ_REG(RNGx->DR)); 00610 } 00611 00612 /** 00613 * @} 00614 */ 00615 00616 #if defined(RNG_VER_3_2) || defined(RNG_VER_3_1) || defined(RNG_VER_3_0) 00617 /** @defgroup RNG_LL_EF_Health_Test_Control Health Test Control 00618 * @{ 00619 */ 00620 00621 /** 00622 * @brief Set RNG Health Test Control 00623 * @rmtoll HTCR HTCFG LL_RNG_SetHealthConfig 00624 * @param RNGx RNG Instance 00625 * @param HTCFG can be values of 32 bits 00626 * @retval None 00627 */ 00628 __STATIC_INLINE void LL_RNG_SetHealthConfig(RNG_TypeDef *RNGx, uint32_t HTCFG) 00629 { 00630 WRITE_REG(RNGx->HTCR, HTCFG); 00631 } 00632 00633 /** 00634 * @brief Get RNG Health Test Control 00635 * @rmtoll HTCR HTCFG LL_RNG_GetHealthConfig 00636 * @param RNGx RNG Instance 00637 * @retval Return 32-bit RNG Health Test configuration 00638 */ 00639 __STATIC_INLINE uint32_t LL_RNG_GetHealthConfig(RNG_TypeDef *RNGx) 00640 { 00641 return (uint32_t)READ_REG(RNGx->HTCR); 00642 } 00643 00644 /** 00645 * @} 00646 */ 00647 #endif /* RNG_VER_3_2, RNG_VER_3_1 or RNG_VER_3_0 */ 00648 #if defined(USE_FULL_LL_DRIVER) 00649 /** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions 00650 * @{ 00651 */ 00652 ErrorStatus LL_RNG_Init(RNG_TypeDef *RNGx, LL_RNG_InitTypeDef *RNG_InitStruct); 00653 void LL_RNG_StructInit(LL_RNG_InitTypeDef *RNG_InitStruct); 00654 ErrorStatus LL_RNG_DeInit(RNG_TypeDef *RNGx); 00655 00656 /** 00657 * @} 00658 */ 00659 #endif /* USE_FULL_LL_DRIVER */ 00660 00661 /** 00662 * @} 00663 */ 00664 00665 /** 00666 * @} 00667 */ 00668 00669 #endif /* RNG */ 00670 00671 /** 00672 * @} 00673 */ 00674 00675 #ifdef __cplusplus 00676 } 00677 #endif 00678 00679 #endif /* __STM32H7xx_LL_RNG_H */ 00680