mbed library sources. Supersedes mbed-src.
Dependents: Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more
targets/TARGET_STM/TARGET_STM32L0/device/stm32l0xx_ll_rng.h@189:f392fc9709a3, 2019-02-20 (annotated)
- Committer:
- AnnaBridge
- Date:
- Wed Feb 20 22:31:08 2019 +0000
- Revision:
- 189:f392fc9709a3
- Parent:
- 186:707f6e361f3e
mbed library release version 165
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 158:b23ee177fd68 | 1 | /** |
Kojto | 158:b23ee177fd68 | 2 | ****************************************************************************** |
Kojto | 158:b23ee177fd68 | 3 | * @file stm32l0xx_ll_rng.h |
Kojto | 158:b23ee177fd68 | 4 | * @author MCD Application Team |
Kojto | 158:b23ee177fd68 | 5 | * @brief Header file of RNG LL module. |
Kojto | 158:b23ee177fd68 | 6 | ****************************************************************************** |
Kojto | 158:b23ee177fd68 | 7 | * @attention |
Kojto | 158:b23ee177fd68 | 8 | * |
Kojto | 158:b23ee177fd68 | 9 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
Kojto | 158:b23ee177fd68 | 10 | * |
Kojto | 158:b23ee177fd68 | 11 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 158:b23ee177fd68 | 12 | * are permitted provided that the following conditions are met: |
Kojto | 158:b23ee177fd68 | 13 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 158:b23ee177fd68 | 14 | * this list of conditions and the following disclaimer. |
Kojto | 158:b23ee177fd68 | 15 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 158:b23ee177fd68 | 16 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 158:b23ee177fd68 | 17 | * and/or other materials provided with the distribution. |
Kojto | 158:b23ee177fd68 | 18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 158:b23ee177fd68 | 19 | * may be used to endorse or promote products derived from this software |
Kojto | 158:b23ee177fd68 | 20 | * without specific prior written permission. |
Kojto | 158:b23ee177fd68 | 21 | * |
Kojto | 158:b23ee177fd68 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 158:b23ee177fd68 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 158:b23ee177fd68 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 158:b23ee177fd68 | 25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 158:b23ee177fd68 | 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 158:b23ee177fd68 | 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 158:b23ee177fd68 | 28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 158:b23ee177fd68 | 29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 158:b23ee177fd68 | 30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 158:b23ee177fd68 | 31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 158:b23ee177fd68 | 32 | * |
Kojto | 158:b23ee177fd68 | 33 | ****************************************************************************** |
Kojto | 158:b23ee177fd68 | 34 | */ |
Kojto | 158:b23ee177fd68 | 35 | |
Kojto | 158:b23ee177fd68 | 36 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 37 | #ifndef __STM32L0xx_LL_RNG_H |
Kojto | 158:b23ee177fd68 | 38 | #define __STM32L0xx_LL_RNG_H |
Kojto | 158:b23ee177fd68 | 39 | |
Kojto | 158:b23ee177fd68 | 40 | #ifdef __cplusplus |
Kojto | 158:b23ee177fd68 | 41 | extern "C" { |
Kojto | 158:b23ee177fd68 | 42 | #endif |
Kojto | 158:b23ee177fd68 | 43 | |
Kojto | 158:b23ee177fd68 | 44 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 45 | #include "stm32l0xx.h" |
Kojto | 158:b23ee177fd68 | 46 | |
Kojto | 158:b23ee177fd68 | 47 | /** @addtogroup STM32L0xx_LL_Driver |
Kojto | 158:b23ee177fd68 | 48 | * @{ |
Kojto | 158:b23ee177fd68 | 49 | */ |
Kojto | 158:b23ee177fd68 | 50 | |
Kojto | 158:b23ee177fd68 | 51 | #if defined(RNG) |
Kojto | 158:b23ee177fd68 | 52 | |
Kojto | 158:b23ee177fd68 | 53 | /** @defgroup RNG_LL RNG |
Kojto | 158:b23ee177fd68 | 54 | * @{ |
Kojto | 158:b23ee177fd68 | 55 | */ |
Kojto | 158:b23ee177fd68 | 56 | |
Kojto | 158:b23ee177fd68 | 57 | /* Private types -------------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 58 | /* Private variables ---------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 59 | /* Private constants ---------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 60 | /* Private macros ------------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 61 | |
Kojto | 158:b23ee177fd68 | 62 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 63 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 64 | /** @defgroup RNG_LL_Exported_Constants RNG Exported Constants |
Kojto | 158:b23ee177fd68 | 65 | * @{ |
Kojto | 158:b23ee177fd68 | 66 | */ |
Kojto | 158:b23ee177fd68 | 67 | |
Kojto | 158:b23ee177fd68 | 68 | /** @defgroup RNG_LL_EC_GET_FLAG Get Flags Defines |
Kojto | 158:b23ee177fd68 | 69 | * @brief Flags defines which can be used with LL_RNG_ReadReg function |
Kojto | 158:b23ee177fd68 | 70 | * @{ |
Kojto | 158:b23ee177fd68 | 71 | */ |
Kojto | 158:b23ee177fd68 | 72 | #define LL_RNG_SR_DRDY RNG_SR_DRDY /*!< Register contains valid random data */ |
Kojto | 158:b23ee177fd68 | 73 | #define LL_RNG_SR_CECS RNG_SR_CECS /*!< Clock error current status */ |
Kojto | 158:b23ee177fd68 | 74 | #define LL_RNG_SR_SECS RNG_SR_SECS /*!< Seed error current status */ |
Kojto | 158:b23ee177fd68 | 75 | #define LL_RNG_SR_CEIS RNG_SR_CEIS /*!< Clock error interrupt status */ |
Kojto | 158:b23ee177fd68 | 76 | #define LL_RNG_SR_SEIS RNG_SR_SEIS /*!< Seed error interrupt status */ |
Kojto | 158:b23ee177fd68 | 77 | /** |
Kojto | 158:b23ee177fd68 | 78 | * @} |
Kojto | 158:b23ee177fd68 | 79 | */ |
Kojto | 158:b23ee177fd68 | 80 | |
Kojto | 158:b23ee177fd68 | 81 | /** @defgroup RNG_LL_EC_IT IT Defines |
Kojto | 158:b23ee177fd68 | 82 | * @brief IT defines which can be used with LL_RNG_ReadReg and LL_RNG_WriteReg macros |
Kojto | 158:b23ee177fd68 | 83 | * @{ |
Kojto | 158:b23ee177fd68 | 84 | */ |
Kojto | 158:b23ee177fd68 | 85 | #define LL_RNG_CR_IE RNG_CR_IE /*!< RNG Interrupt enable */ |
Kojto | 158:b23ee177fd68 | 86 | /** |
Kojto | 158:b23ee177fd68 | 87 | * @} |
Kojto | 158:b23ee177fd68 | 88 | */ |
Kojto | 158:b23ee177fd68 | 89 | |
Kojto | 158:b23ee177fd68 | 90 | /** |
Kojto | 158:b23ee177fd68 | 91 | * @} |
Kojto | 158:b23ee177fd68 | 92 | */ |
Kojto | 158:b23ee177fd68 | 93 | |
Kojto | 158:b23ee177fd68 | 94 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 95 | /** @defgroup RNG_LL_Exported_Macros RNG Exported Macros |
Kojto | 158:b23ee177fd68 | 96 | * @{ |
Kojto | 158:b23ee177fd68 | 97 | */ |
Kojto | 158:b23ee177fd68 | 98 | |
Kojto | 158:b23ee177fd68 | 99 | /** @defgroup RNG_LL_EM_WRITE_READ Common Write and read registers Macros |
Kojto | 158:b23ee177fd68 | 100 | * @{ |
Kojto | 158:b23ee177fd68 | 101 | */ |
Kojto | 158:b23ee177fd68 | 102 | |
Kojto | 158:b23ee177fd68 | 103 | /** |
Kojto | 158:b23ee177fd68 | 104 | * @brief Write a value in RNG register |
Kojto | 158:b23ee177fd68 | 105 | * @param __INSTANCE__ RNG Instance |
Kojto | 158:b23ee177fd68 | 106 | * @param __REG__ Register to be written |
Kojto | 158:b23ee177fd68 | 107 | * @param __VALUE__ Value to be written in the register |
Kojto | 158:b23ee177fd68 | 108 | * @retval None |
Kojto | 158:b23ee177fd68 | 109 | */ |
Kojto | 158:b23ee177fd68 | 110 | #define LL_RNG_WriteReg(__INSTANCE__, __REG__, __VALUE__) WRITE_REG(__INSTANCE__->__REG__, (__VALUE__)) |
Kojto | 158:b23ee177fd68 | 111 | |
Kojto | 158:b23ee177fd68 | 112 | /** |
Kojto | 158:b23ee177fd68 | 113 | * @brief Read a value in RNG register |
Kojto | 158:b23ee177fd68 | 114 | * @param __INSTANCE__ RNG Instance |
Kojto | 158:b23ee177fd68 | 115 | * @param __REG__ Register to be read |
Kojto | 158:b23ee177fd68 | 116 | * @retval Register value |
Kojto | 158:b23ee177fd68 | 117 | */ |
Kojto | 158:b23ee177fd68 | 118 | #define LL_RNG_ReadReg(__INSTANCE__, __REG__) READ_REG(__INSTANCE__->__REG__) |
Kojto | 158:b23ee177fd68 | 119 | /** |
Kojto | 158:b23ee177fd68 | 120 | * @} |
Kojto | 158:b23ee177fd68 | 121 | */ |
Kojto | 158:b23ee177fd68 | 122 | |
Kojto | 158:b23ee177fd68 | 123 | /** |
Kojto | 158:b23ee177fd68 | 124 | * @} |
Kojto | 158:b23ee177fd68 | 125 | */ |
Kojto | 158:b23ee177fd68 | 126 | |
Kojto | 158:b23ee177fd68 | 127 | |
Kojto | 158:b23ee177fd68 | 128 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 158:b23ee177fd68 | 129 | /** @defgroup RNG_LL_Exported_Functions RNG Exported Functions |
Kojto | 158:b23ee177fd68 | 130 | * @{ |
Kojto | 158:b23ee177fd68 | 131 | */ |
Kojto | 158:b23ee177fd68 | 132 | /** @defgroup RNG_LL_EF_Configuration RNG Configuration functions |
Kojto | 158:b23ee177fd68 | 133 | * @{ |
Kojto | 158:b23ee177fd68 | 134 | */ |
Kojto | 158:b23ee177fd68 | 135 | |
Kojto | 158:b23ee177fd68 | 136 | /** |
Kojto | 158:b23ee177fd68 | 137 | * @brief Enable Random Number Generation |
Kojto | 158:b23ee177fd68 | 138 | * @rmtoll CR RNGEN LL_RNG_Enable |
Kojto | 158:b23ee177fd68 | 139 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 140 | * @retval None |
Kojto | 158:b23ee177fd68 | 141 | */ |
Kojto | 158:b23ee177fd68 | 142 | __STATIC_INLINE void LL_RNG_Enable(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 143 | { |
Kojto | 158:b23ee177fd68 | 144 | SET_BIT(RNGx->CR, RNG_CR_RNGEN); |
Kojto | 158:b23ee177fd68 | 145 | } |
Kojto | 158:b23ee177fd68 | 146 | |
Kojto | 158:b23ee177fd68 | 147 | /** |
Kojto | 158:b23ee177fd68 | 148 | * @brief Disable Random Number Generation |
Kojto | 158:b23ee177fd68 | 149 | * @rmtoll CR RNGEN LL_RNG_Disable |
Kojto | 158:b23ee177fd68 | 150 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 151 | * @retval None |
Kojto | 158:b23ee177fd68 | 152 | */ |
Kojto | 158:b23ee177fd68 | 153 | __STATIC_INLINE void LL_RNG_Disable(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 154 | { |
Kojto | 158:b23ee177fd68 | 155 | CLEAR_BIT(RNGx->CR, RNG_CR_RNGEN); |
Kojto | 158:b23ee177fd68 | 156 | } |
Kojto | 158:b23ee177fd68 | 157 | |
Kojto | 158:b23ee177fd68 | 158 | /** |
Kojto | 158:b23ee177fd68 | 159 | * @brief Check if Random Number Generator is enabled |
Kojto | 158:b23ee177fd68 | 160 | * @rmtoll CR RNGEN LL_RNG_IsEnabled |
Kojto | 158:b23ee177fd68 | 161 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 162 | * @retval State of bit (1 or 0). |
Kojto | 158:b23ee177fd68 | 163 | */ |
Kojto | 158:b23ee177fd68 | 164 | __STATIC_INLINE uint32_t LL_RNG_IsEnabled(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 165 | { |
Kojto | 158:b23ee177fd68 | 166 | return (READ_BIT(RNGx->CR, RNG_CR_RNGEN) == (RNG_CR_RNGEN)); |
Kojto | 158:b23ee177fd68 | 167 | } |
Kojto | 158:b23ee177fd68 | 168 | |
Kojto | 158:b23ee177fd68 | 169 | /** |
Kojto | 158:b23ee177fd68 | 170 | * @} |
Kojto | 158:b23ee177fd68 | 171 | */ |
Kojto | 158:b23ee177fd68 | 172 | |
Kojto | 158:b23ee177fd68 | 173 | /** @defgroup RNG_LL_EF_FLAG_Management FLAG Management |
Kojto | 158:b23ee177fd68 | 174 | * @{ |
Kojto | 158:b23ee177fd68 | 175 | */ |
Kojto | 158:b23ee177fd68 | 176 | |
Kojto | 158:b23ee177fd68 | 177 | /** |
Kojto | 158:b23ee177fd68 | 178 | * @brief Indicate if the RNG Data ready Flag is set or not |
Kojto | 158:b23ee177fd68 | 179 | * @rmtoll SR DRDY LL_RNG_IsActiveFlag_DRDY |
Kojto | 158:b23ee177fd68 | 180 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 181 | * @retval State of bit (1 or 0). |
Kojto | 158:b23ee177fd68 | 182 | */ |
Kojto | 158:b23ee177fd68 | 183 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_DRDY(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 184 | { |
Kojto | 158:b23ee177fd68 | 185 | return (READ_BIT(RNGx->SR, RNG_SR_DRDY) == (RNG_SR_DRDY)); |
Kojto | 158:b23ee177fd68 | 186 | } |
Kojto | 158:b23ee177fd68 | 187 | |
Kojto | 158:b23ee177fd68 | 188 | /** |
Kojto | 158:b23ee177fd68 | 189 | * @brief Indicate if the Clock Error Current Status Flag is set or not |
Kojto | 158:b23ee177fd68 | 190 | * @rmtoll SR CECS LL_RNG_IsActiveFlag_CECS |
Kojto | 158:b23ee177fd68 | 191 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 192 | * @retval State of bit (1 or 0). |
Kojto | 158:b23ee177fd68 | 193 | */ |
Kojto | 158:b23ee177fd68 | 194 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CECS(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 195 | { |
Kojto | 158:b23ee177fd68 | 196 | return (READ_BIT(RNGx->SR, RNG_SR_CECS) == (RNG_SR_CECS)); |
Kojto | 158:b23ee177fd68 | 197 | } |
Kojto | 158:b23ee177fd68 | 198 | |
Kojto | 158:b23ee177fd68 | 199 | /** |
Kojto | 158:b23ee177fd68 | 200 | * @brief Indicate if the Seed Error Current Status Flag is set or not |
Kojto | 158:b23ee177fd68 | 201 | * @rmtoll SR SECS LL_RNG_IsActiveFlag_SECS |
Kojto | 158:b23ee177fd68 | 202 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 203 | * @retval State of bit (1 or 0). |
Kojto | 158:b23ee177fd68 | 204 | */ |
Kojto | 158:b23ee177fd68 | 205 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SECS(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 206 | { |
Kojto | 158:b23ee177fd68 | 207 | return (READ_BIT(RNGx->SR, RNG_SR_SECS) == (RNG_SR_SECS)); |
Kojto | 158:b23ee177fd68 | 208 | } |
Kojto | 158:b23ee177fd68 | 209 | |
Kojto | 158:b23ee177fd68 | 210 | /** |
Kojto | 158:b23ee177fd68 | 211 | * @brief Indicate if the Clock Error Interrupt Status Flag is set or not |
Kojto | 158:b23ee177fd68 | 212 | * @rmtoll SR CEIS LL_RNG_IsActiveFlag_CEIS |
Kojto | 158:b23ee177fd68 | 213 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 214 | * @retval State of bit (1 or 0). |
Kojto | 158:b23ee177fd68 | 215 | */ |
Kojto | 158:b23ee177fd68 | 216 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_CEIS(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 217 | { |
Kojto | 158:b23ee177fd68 | 218 | return (READ_BIT(RNGx->SR, RNG_SR_CEIS) == (RNG_SR_CEIS)); |
Kojto | 158:b23ee177fd68 | 219 | } |
Kojto | 158:b23ee177fd68 | 220 | |
Kojto | 158:b23ee177fd68 | 221 | /** |
Kojto | 158:b23ee177fd68 | 222 | * @brief Indicate if the Seed Error Interrupt Status Flag is set or not |
Kojto | 158:b23ee177fd68 | 223 | * @rmtoll SR SEIS LL_RNG_IsActiveFlag_SEIS |
Kojto | 158:b23ee177fd68 | 224 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 225 | * @retval State of bit (1 or 0). |
Kojto | 158:b23ee177fd68 | 226 | */ |
Kojto | 158:b23ee177fd68 | 227 | __STATIC_INLINE uint32_t LL_RNG_IsActiveFlag_SEIS(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 228 | { |
Kojto | 158:b23ee177fd68 | 229 | return (READ_BIT(RNGx->SR, RNG_SR_SEIS) == (RNG_SR_SEIS)); |
Kojto | 158:b23ee177fd68 | 230 | } |
Kojto | 158:b23ee177fd68 | 231 | |
Kojto | 158:b23ee177fd68 | 232 | /** |
Kojto | 158:b23ee177fd68 | 233 | * @brief Clear Clock Error interrupt Status (CEIS) Flag |
Kojto | 158:b23ee177fd68 | 234 | * @rmtoll SR CEIS LL_RNG_ClearFlag_CEIS |
Kojto | 158:b23ee177fd68 | 235 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 236 | * @retval None |
Kojto | 158:b23ee177fd68 | 237 | */ |
Kojto | 158:b23ee177fd68 | 238 | __STATIC_INLINE void LL_RNG_ClearFlag_CEIS(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 239 | { |
Kojto | 158:b23ee177fd68 | 240 | WRITE_REG(RNGx->SR, ~RNG_SR_CEIS); |
Kojto | 158:b23ee177fd68 | 241 | } |
Kojto | 158:b23ee177fd68 | 242 | |
Kojto | 158:b23ee177fd68 | 243 | /** |
Kojto | 158:b23ee177fd68 | 244 | * @brief Clear Seed Error interrupt Status (SEIS) Flag |
Kojto | 158:b23ee177fd68 | 245 | * @rmtoll SR SEIS LL_RNG_ClearFlag_SEIS |
Kojto | 158:b23ee177fd68 | 246 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 247 | * @retval None |
Kojto | 158:b23ee177fd68 | 248 | */ |
Kojto | 158:b23ee177fd68 | 249 | __STATIC_INLINE void LL_RNG_ClearFlag_SEIS(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 250 | { |
Kojto | 158:b23ee177fd68 | 251 | WRITE_REG(RNGx->SR, ~RNG_SR_SEIS); |
Kojto | 158:b23ee177fd68 | 252 | } |
Kojto | 158:b23ee177fd68 | 253 | |
Kojto | 158:b23ee177fd68 | 254 | /** |
Kojto | 158:b23ee177fd68 | 255 | * @} |
Kojto | 158:b23ee177fd68 | 256 | */ |
Kojto | 158:b23ee177fd68 | 257 | |
Kojto | 158:b23ee177fd68 | 258 | /** @defgroup RNG_LL_EF_IT_Management IT Management |
Kojto | 158:b23ee177fd68 | 259 | * @{ |
Kojto | 158:b23ee177fd68 | 260 | */ |
Kojto | 158:b23ee177fd68 | 261 | |
Kojto | 158:b23ee177fd68 | 262 | /** |
Kojto | 158:b23ee177fd68 | 263 | * @brief Enable Random Number Generator Interrupt |
Kojto | 158:b23ee177fd68 | 264 | * (applies for either Seed error, Clock Error or Data ready interrupts) |
Kojto | 158:b23ee177fd68 | 265 | * @rmtoll CR IE LL_RNG_EnableIT |
Kojto | 158:b23ee177fd68 | 266 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 267 | * @retval None |
Kojto | 158:b23ee177fd68 | 268 | */ |
Kojto | 158:b23ee177fd68 | 269 | __STATIC_INLINE void LL_RNG_EnableIT(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 270 | { |
Kojto | 158:b23ee177fd68 | 271 | SET_BIT(RNGx->CR, RNG_CR_IE); |
Kojto | 158:b23ee177fd68 | 272 | } |
Kojto | 158:b23ee177fd68 | 273 | |
Kojto | 158:b23ee177fd68 | 274 | /** |
Kojto | 158:b23ee177fd68 | 275 | * @brief Disable Random Number Generator Interrupt |
Kojto | 158:b23ee177fd68 | 276 | * (applies for either Seed error, Clock Error or Data ready interrupts) |
Kojto | 158:b23ee177fd68 | 277 | * @rmtoll CR IE LL_RNG_DisableIT |
Kojto | 158:b23ee177fd68 | 278 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 279 | * @retval None |
Kojto | 158:b23ee177fd68 | 280 | */ |
Kojto | 158:b23ee177fd68 | 281 | __STATIC_INLINE void LL_RNG_DisableIT(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 282 | { |
Kojto | 158:b23ee177fd68 | 283 | CLEAR_BIT(RNGx->CR, RNG_CR_IE); |
Kojto | 158:b23ee177fd68 | 284 | } |
Kojto | 158:b23ee177fd68 | 285 | |
Kojto | 158:b23ee177fd68 | 286 | /** |
Kojto | 158:b23ee177fd68 | 287 | * @brief Check if Random Number Generator Interrupt is enabled |
Kojto | 158:b23ee177fd68 | 288 | * (applies for either Seed error, Clock Error or Data ready interrupts) |
Kojto | 158:b23ee177fd68 | 289 | * @rmtoll CR IE LL_RNG_IsEnabledIT |
Kojto | 158:b23ee177fd68 | 290 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 291 | * @retval State of bit (1 or 0). |
Kojto | 158:b23ee177fd68 | 292 | */ |
Kojto | 158:b23ee177fd68 | 293 | __STATIC_INLINE uint32_t LL_RNG_IsEnabledIT(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 294 | { |
Kojto | 158:b23ee177fd68 | 295 | return (READ_BIT(RNGx->CR, RNG_CR_IE) == (RNG_CR_IE)); |
Kojto | 158:b23ee177fd68 | 296 | } |
Kojto | 158:b23ee177fd68 | 297 | |
Kojto | 158:b23ee177fd68 | 298 | /** |
Kojto | 158:b23ee177fd68 | 299 | * @} |
Kojto | 158:b23ee177fd68 | 300 | */ |
Kojto | 158:b23ee177fd68 | 301 | |
Kojto | 158:b23ee177fd68 | 302 | /** @defgroup RNG_LL_EF_Data_Management Data Management |
Kojto | 158:b23ee177fd68 | 303 | * @{ |
Kojto | 158:b23ee177fd68 | 304 | */ |
Kojto | 158:b23ee177fd68 | 305 | |
Kojto | 158:b23ee177fd68 | 306 | /** |
Kojto | 158:b23ee177fd68 | 307 | * @brief Return32-bit Random Number value |
Kojto | 158:b23ee177fd68 | 308 | * @rmtoll DR RNDATA LL_RNG_ReadRandData32 |
Kojto | 158:b23ee177fd68 | 309 | * @param RNGx RNG Instance |
Kojto | 158:b23ee177fd68 | 310 | * @retval Generated 32-bit random value |
Kojto | 158:b23ee177fd68 | 311 | */ |
Kojto | 158:b23ee177fd68 | 312 | __STATIC_INLINE uint32_t LL_RNG_ReadRandData32(RNG_TypeDef *RNGx) |
Kojto | 158:b23ee177fd68 | 313 | { |
Kojto | 158:b23ee177fd68 | 314 | return (uint32_t)(READ_REG(RNGx->DR)); |
Kojto | 158:b23ee177fd68 | 315 | } |
Kojto | 158:b23ee177fd68 | 316 | |
Kojto | 158:b23ee177fd68 | 317 | /** |
Kojto | 158:b23ee177fd68 | 318 | * @} |
Kojto | 158:b23ee177fd68 | 319 | */ |
Kojto | 158:b23ee177fd68 | 320 | |
Kojto | 158:b23ee177fd68 | 321 | #if defined(USE_FULL_LL_DRIVER) |
Kojto | 158:b23ee177fd68 | 322 | /** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions |
Kojto | 158:b23ee177fd68 | 323 | * @{ |
Kojto | 158:b23ee177fd68 | 324 | */ |
Kojto | 158:b23ee177fd68 | 325 | |
Kojto | 158:b23ee177fd68 | 326 | ErrorStatus LL_RNG_DeInit(RNG_TypeDef *RNGx); |
Kojto | 158:b23ee177fd68 | 327 | |
Kojto | 158:b23ee177fd68 | 328 | /** |
Kojto | 158:b23ee177fd68 | 329 | * @} |
Kojto | 158:b23ee177fd68 | 330 | */ |
Kojto | 158:b23ee177fd68 | 331 | #endif /* USE_FULL_LL_DRIVER */ |
Kojto | 158:b23ee177fd68 | 332 | |
Kojto | 158:b23ee177fd68 | 333 | /** |
Kojto | 158:b23ee177fd68 | 334 | * @} |
Kojto | 158:b23ee177fd68 | 335 | */ |
Kojto | 158:b23ee177fd68 | 336 | |
Kojto | 158:b23ee177fd68 | 337 | /** |
Kojto | 158:b23ee177fd68 | 338 | * @} |
Kojto | 158:b23ee177fd68 | 339 | */ |
Kojto | 158:b23ee177fd68 | 340 | |
Kojto | 158:b23ee177fd68 | 341 | #endif /* defined(RNG) */ |
Kojto | 158:b23ee177fd68 | 342 | |
Kojto | 158:b23ee177fd68 | 343 | /** |
Kojto | 158:b23ee177fd68 | 344 | * @} |
Kojto | 158:b23ee177fd68 | 345 | */ |
Kojto | 158:b23ee177fd68 | 346 | |
Kojto | 158:b23ee177fd68 | 347 | #ifdef __cplusplus |
Kojto | 158:b23ee177fd68 | 348 | } |
Kojto | 158:b23ee177fd68 | 349 | #endif |
Kojto | 158:b23ee177fd68 | 350 | |
Kojto | 158:b23ee177fd68 | 351 | #endif /* __STM32L0xx_LL_RNG_H */ |
Kojto | 158:b23ee177fd68 | 352 | |
Kojto | 158:b23ee177fd68 | 353 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |