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