Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
stm32l4xx_ll_rng.h
00001 /** 00002 ****************************************************************************** 00003 * @file stm32l4xx_ll_rng.h 00004 * @author MCD Application Team 00005 * @version V1.5.1 00006 * @date 31-May-2016 00007 * @brief Header file of RNG LL module. 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> 00012 * 00013 * Redistribution and use in source and binary forms, with or without modification, 00014 * are permitted provided that the following conditions are met: 00015 * 1. Redistributions of source code must retain the above copyright notice, 00016 * this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above copyright notice, 00018 * this list of conditions and the following disclaimer in the documentation 00019 * and/or other materials provided with the distribution. 00020 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00021 * may be used to endorse or promote products derived from this software 00022 * without specific prior written permission. 00023 * 00024 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00025 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00026 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00027 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00028 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00029 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00030 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00031 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00032 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 ****************************************************************************** 00036 */ 00037 00038 /* Define to prevent recursive inclusion -------------------------------------*/ 00039 #ifndef __STM32L4xx_LL_RNG_H 00040 #define __STM32L4xx_LL_RNG_H 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 /* Includes ------------------------------------------------------------------*/ 00047 #include "stm32l4xx.h" 00048 00049 /** @addtogroup STM32L4xx_LL_Driver 00050 * @{ 00051 */ 00052 00053 #if defined(RNG) 00054 00055 /** @defgroup RNG_LL RNG 00056 * @{ 00057 */ 00058 00059 /* Private types -------------------------------------------------------------*/ 00060 /* Private variables ---------------------------------------------------------*/ 00061 /* Private constants ---------------------------------------------------------*/ 00062 /* Private macros ------------------------------------------------------------*/ 00063 00064 /* Exported types ------------------------------------------------------------*/ 00065 /* Exported constants --------------------------------------------------------*/ 00066 /** @defgroup RNG_LL_Exported_Constants RNG Exported Constants 00067 * @{ 00068 */ 00069 00070 /** @defgroup RNG_LL_EC_GET_FLAG Get Flags Defines 00071 * @brief Flags defines which can be used with LL_RNG_ReadReg function 00072 * @{ 00073 */ 00074 #define LL_RNG_SR_DRDY RNG_SR_DRDY /*!< Register contains valid random data */ 00075 #define LL_RNG_SR_CECS RNG_SR_CECS /*!< Clock error current status */ 00076 #define LL_RNG_SR_SECS RNG_SR_SECS /*!< Seed error current status */ 00077 #define LL_RNG_SR_CEIS RNG_SR_CEIS /*!< Clock error interrupt status */ 00078 #define LL_RNG_SR_SEIS RNG_SR_SEIS /*!< Seed error interrupt status */ 00079 /** 00080 * @} 00081 */ 00082 00083 /** @defgroup RNG_LL_EC_IT IT Defines 00084 * @brief IT defines which can be used with LL_RNG_ReadReg and LL_RNG_WriteReg macros 00085 * @{ 00086 */ 00087 #define LL_RNG_CR_IE RNG_CR_IE /*!< RNG Interrupt enable */ 00088 /** 00089 * @} 00090 */ 00091 00092 /** 00093 * @} 00094 */ 00095 00096 /* Exported macro ------------------------------------------------------------*/ 00097 /** @defgroup RNG_LL_Exported_Macros RNG Exported Macros 00098 * @{ 00099 */ 00100 00101 /** @defgroup RNG_LL_EM_WRITE_READ Common Write and read registers Macros 00102 * @{ 00103 */ 00104 00105 /** 00106 * @brief Write a value in RNG register 00107 * @param __INSTANCE__ RNG Instance 00108 * @param __REG__ Register to be written 00109 * @param __VALUE__ Value to be written in the register 00110 * @retval None 00111 */ 00112 #define LL_RNG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) 00113 00114 /** 00115 * @brief Read a value in RNG register 00116 * @param __INSTANCE__ RNG Instance 00117 * @param __REG__ Register to be read 00118 * @retval Register value 00119 */ 00120 #define LL_RNG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) 00121 /** 00122 * @} 00123 */ 00124 00125 /** 00126 * @} 00127 */ 00128 00129 00130 /* Exported functions --------------------------------------------------------*/ 00131 /** @defgroup RNG_LL_Exported_Functions RNG Exported Functions 00132 * @{ 00133 */ 00134 /** @defgroup RNG_LL_EF_Configuration RNG Configuration functions 00135 * @{ 00136 */ 00137 00138 /** 00139 * @brief Enable Random Number Generation 00140 * @rmtoll CR RNGEN LL_RNG_Enable 00141 * @param RNGx RNG Instance 00142 * @retval None 00143 */ 00144 __STATIC_INLINE void LL_RNG_Enable(RNG_TypeDef *RNGx) 00145 { 00146 SET_BIT(RNGx->CR, RNG_CR_RNGEN); 00147 } 00148 00149 /** 00150 * @brief Disable Random Number Generation 00151 * @rmtoll CR RNGEN LL_RNG_Disable 00152 * @param RNGx RNG Instance 00153 * @retval None 00154 */ 00155 __STATIC_INLINE void LL_RNG_Disable(RNG_TypeDef *RNGx) 00156 { 00157 CLEAR_BIT(RNGx->CR, RNG_CR_RNGEN); 00158 } 00159 00160 /** 00161 * @brief Check if Random Number Generator is enabled 00162 * @rmtoll CR RNGEN LL_RNG_IsEnabled 00163 * @param RNGx RNG Instance 00164 * @retval State of bit (1 or 0). 00165 */ 00166 __STATIC_INLINE uint32_t LL_RNG_IsEnabled(RNG_TypeDef *RNGx) 00167 { 00168 return (READ_BIT(RNGx->CR, RNG_CR_RNGEN) == (RNG_CR_RNGEN)); 00169 } 00170 00171 /** 00172 * @} 00173 */ 00174 00175 /** @defgroup RNG_LL_EF_FLAG_Management FLAG Management 00176 * @{ 00177 */ 00178 00179 /** 00180 * @brief Indicate if the RNG Data ready Flag is set or not 00181 * @rmtoll SR DRDY LL_RNG_IsActiveFlag_DRDY 00182 * @param RNGx RNG Instance 00183 * @retval State of bit (1 or 0). 00184 */ 00185 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_DRDY(RNG_TypeDef *RNGx) 00186 { 00187 return (READ_BIT(RNGx->SR, RNG_SR_DRDY) == (RNG_SR_DRDY)); 00188 } 00189 00190 /** 00191 * @brief Indicate if the Clock Error Current Status Flag is set or not 00192 * @rmtoll SR CECS LL_RNG_IsActiveFlag_CECS 00193 * @param RNGx RNG Instance 00194 * @retval State of bit (1 or 0). 00195 */ 00196 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CECS(RNG_TypeDef *RNGx) 00197 { 00198 return (READ_BIT(RNGx->SR, RNG_SR_CECS) == (RNG_SR_CECS)); 00199 } 00200 00201 /** 00202 * @brief Indicate if the Seed Error Current Status Flag is set or not 00203 * @rmtoll SR SECS LL_RNG_IsActiveFlag_SECS 00204 * @param RNGx RNG Instance 00205 * @retval State of bit (1 or 0). 00206 */ 00207 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SECS(RNG_TypeDef *RNGx) 00208 { 00209 return (READ_BIT(RNGx->SR, RNG_SR_SECS) == (RNG_SR_SECS)); 00210 } 00211 00212 /** 00213 * @brief Indicate if the Clock Error Interrupt Status Flag is set or not 00214 * @rmtoll SR CEIS LL_RNG_IsActiveFlag_CEIS 00215 * @param RNGx RNG Instance 00216 * @retval State of bit (1 or 0). 00217 */ 00218 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CEIS(RNG_TypeDef *RNGx) 00219 { 00220 return (READ_BIT(RNGx->SR, RNG_SR_CEIS) == (RNG_SR_CEIS)); 00221 } 00222 00223 /** 00224 * @brief Indicate if the Seed Error Interrupt Status Flag is set or not 00225 * @rmtoll SR SEIS LL_RNG_IsActiveFlag_SEIS 00226 * @param RNGx RNG Instance 00227 * @retval State of bit (1 or 0). 00228 */ 00229 __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SEIS(RNG_TypeDef *RNGx) 00230 { 00231 return (READ_BIT(RNGx->SR, RNG_SR_SEIS) == (RNG_SR_SEIS)); 00232 } 00233 00234 /** 00235 * @brief Clear Clock Error interrupt Status (CEIS) Flag 00236 * @rmtoll SR CEIS LL_RNG_ClearFlag_CEIS 00237 * @param RNGx RNG Instance 00238 * @retval None 00239 */ 00240 __STATIC_INLINE void LL_RNG_ClearFlag_CEIS(RNG_TypeDef *RNGx) 00241 { 00242 WRITE_REG(RNGx->SR, ~RNG_SR_CEIS); 00243 } 00244 00245 /** 00246 * @brief Clear Seed Error interrupt Status (SEIS) Flag 00247 * @rmtoll SR SEIS LL_RNG_ClearFlag_SEIS 00248 * @param RNGx RNG Instance 00249 * @retval None 00250 */ 00251 __STATIC_INLINE void LL_RNG_ClearFlag_SEIS(RNG_TypeDef *RNGx) 00252 { 00253 WRITE_REG(RNGx->SR, ~RNG_SR_SEIS); 00254 } 00255 00256 /** 00257 * @} 00258 */ 00259 00260 /** @defgroup RNG_LL_EF_IT_Management IT Management 00261 * @{ 00262 */ 00263 00264 /** 00265 * @brief Enable Random Number Generator Interrupt 00266 * (applies for either Seed error, Clock Error or Data ready interrupts) 00267 * @rmtoll CR IE LL_RNG_EnableIT 00268 * @param RNGx RNG Instance 00269 * @retval None 00270 */ 00271 __STATIC_INLINE void LL_RNG_EnableIT(RNG_TypeDef *RNGx) 00272 { 00273 SET_BIT(RNGx->CR, RNG_CR_IE); 00274 } 00275 00276 /** 00277 * @brief Disable Random Number Generator Interrupt 00278 * (applies for either Seed error, Clock Error or Data ready interrupts) 00279 * @rmtoll CR IE LL_RNG_DisableIT 00280 * @param RNGx RNG Instance 00281 * @retval None 00282 */ 00283 __STATIC_INLINE void LL_RNG_DisableIT(RNG_TypeDef *RNGx) 00284 { 00285 CLEAR_BIT(RNGx->CR, RNG_CR_IE); 00286 } 00287 00288 /** 00289 * @brief Check if Random Number Generator Interrupt is enabled 00290 * (applies for either Seed error, Clock Error or Data ready interrupts) 00291 * @rmtoll CR IE LL_RNG_IsEnabledIT 00292 * @param RNGx RNG Instance 00293 * @retval State of bit (1 or 0). 00294 */ 00295 __STATIC_INLINE uint32_t LL_RNG_IsEnabledIT(RNG_TypeDef *RNGx) 00296 { 00297 return (READ_BIT(RNGx->CR, RNG_CR_IE) == (RNG_CR_IE)); 00298 } 00299 00300 /** 00301 * @} 00302 */ 00303 00304 /** @defgroup RNG_LL_EF_Data_Management Data Management 00305 * @{ 00306 */ 00307 00308 /** 00309 * @brief Return32-bit Random Number value 00310 * @rmtoll DR RNDATA LL_RNG_ReadRandData32 00311 * @param RNGx RNG Instance 00312 * @retval Generated 32-bit random value 00313 */ 00314 __STATIC_INLINE uint32_t LL_RNG_ReadRandData32(RNG_TypeDef *RNGx) 00315 { 00316 return (uint32_t)(READ_REG(RNGx->DR)); 00317 } 00318 00319 /** 00320 * @} 00321 */ 00322 00323 #if defined(USE_FULL_LL_DRIVER) 00324 /** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions 00325 * @{ 00326 */ 00327 00328 ErrorStatus LL_RNG_DeInit(RNG_TypeDef *RNGx); 00329 00330 /** 00331 * @} 00332 */ 00333 #endif /* USE_FULL_LL_DRIVER */ 00334 00335 /** 00336 * @} 00337 */ 00338 00339 /** 00340 * @} 00341 */ 00342 00343 #endif /* defined(RNG) */ 00344 00345 /** 00346 * @} 00347 */ 00348 00349 #ifdef __cplusplus 00350 } 00351 #endif 00352 00353 #endif /* __STM32L4xx_LL_RNG_H */ 00354 00355 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
Generated on Tue Jul 12 2022 11:00:00 by
