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