gr533x_ll_rng.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr533x_ll_rng.h
5 * @author BLE Driver Team
6 * @brief Header file containing functions prototypes of RNG LL library.
7 *
8 ****************************************************************************************
9 * @attention
10 #####Copyright (c) 2019 GOODIX
11 All rights reserved.
12
13 Redistribution and use in source and binary forms, with or without
14 modification, are permitted provided that the following conditions are met:
15 * Redistributions of source code must retain the above copyright
16 notice, this list of conditions and the following disclaimer.
17 * Redistributions in binary form must reproduce the above copyright
18 notice, this list of conditions and the following disclaimer in the
19 documentation and/or other materials provided with the distribution.
20 * Neither the name of GOODIX nor the names of its contributors may be used
21 to endorse or promote products derived from this software without
22 specific prior written permission.
23
24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
28 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 POSSIBILITY OF SUCH DAMAGE.
35 ****************************************************************************************
36 */
37
38 /** @addtogroup PERIPHERAL Peripheral Driver
39 * @{
40 */
41
42 /** @addtogroup LL_DRIVER LL Driver
43 * @{
44 */
45
46 /** @defgroup LL_RNG RNG
47 * @brief RNG LL module driver.
48 * @{
49 */
50
51 /* Define to prevent recursive inclusion -------------------------------------*/
52 #ifndef __GR533X_LL_RNG_H__
53 #define __GR533X_LL_RNG_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr533x.h"
61
62 #if defined (RNG)
63
64 /** @defgroup RNG_LL_STRUCTURES Structures
65 * @{
66 */
67
68 /* Exported types ------------------------------------------------------------*/
69 /** @defgroup RNG_LL_ES_INIT RNG Exported Init structures
70 * @{
71 */
72
73 /**
74 * @brief LL RNG Init Structure definition
75 */
76 typedef struct _ll_rng_init
77 {
78 uint32_t seed; /**< Specifies the seed source for the LFSR.
79 This parameter can be a value of @ref RNG_LL_EC_SEED_SOURCE */
80
81 uint32_t lfsr_mode; /**< Specifies the configuration mode for the LFSR.
82 This parameter can be a value of @ref RNG_LL_EC_LFSR_MODE */
83
84 uint32_t out_mode; /**< Specifies the Output mode for the RNG.
85 This parameter can be a value of @ref RNG_LL_EC_OUTPUT_MODE */
86
87 uint32_t post_mode; /**< Specifies post-process configuration for the RNG.
88 This parameter can be a value of @ref RNG_LL_EC_POST_PRO */
89
90 uint32_t interrupt; /**< Specifies interrupt configuration for the RNG.
91 This parameter can be a value of @ref RNG_LL_EC_IT */
92
93 } ll_rng_init_t;
94
95 /** @} */
96
97 /** @} */
98
99 /* Exported constants --------------------------------------------------------*/
100 /** @defgroup RNG_LL_Exported_Constants RNG Exported Constants
101 * @{
102 */
103
104 /** @defgroup RNG_LL_EC_SEED_SOURCE LFSR seed source
105 * @{
106 */
107 #define LL_RNG_SEED_FR0_S0 (4UL << RNG_CONFIG_LFSR_SEED_SEL_Pos) /**< LFSR seed is from the switching oscillator s0. */
108 #define LL_RNG_SEED_USER (6UL << RNG_CONFIG_LFSR_SEED_SEL_Pos) /**< LFSR seed is configured by users. */
109 /** @} */
110
111
112 /** @defgroup RNG_LL_EC_LFSR_MODE LFSR configuration mode
113 * @{
114 */
115 #define LL_RNG_LFSR_MODE_59BIT (0x00000000UL) /**< 59 bit LFSR. */
116 #define LL_RNG_LFSR_MODE_128BIT (1UL << RNG_CONFIG_LFSR_MODE_Pos) /**< 128 bit LFSR. */
117 /** @} */
118
119 /** @defgroup RNG_LL_EC_POST_PRO Post-process mode
120 * @{
121 */
122 #define LL_RNG_POST_PRO_NOT (0x00000000UL) /**< No post process. */
123 #define LL_RNG_POST_PRO_SKIPPING (1UL << RNG_CONFIG_POST_MODE_Pos) /**< bit skipping. */
124 #define LL_RNG_POST_PRO_COUNTING (2UL << RNG_CONFIG_POST_MODE_Pos) /**< bit counting. */
125 #define LL_RNG_POST_PRO_NEUMANN (3UL << RNG_CONFIG_POST_MODE_Pos) /**< Von-Neumann. */
126 /** @} */
127
128 /** @defgroup RNG_LL_EC_IT RNG hardware interrupt enable.
129 * @{
130 */
131 #define LL_RNG_IT_DISABLE (0x00000000UL) /**< Disable RNG interrupt. */
132 #define LL_RNG_IT_ENABLE (1UL << RNG_CONFIG_IRQ_EN_Pos) /**< Enable RNG interrupt. */
133 /** @} */
134
135 /** @defgroup RNG_LL_EC_OUTPUT_MODE RNG Output mode
136 * @{
137 */
138 #define LL_RNG_OUTPUT_FR0_S0 (4UL << RNG_CONFIG_OUT_MODE_Pos) /**< Digital RNG direct output, ring oscillator s0. */
139 #define LL_RNG_OUTPUT_CYCLIC_PARITY (6UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR and RNG cyclic sampling and parity generation. */
140 #define LL_RNG_OUTPUT_CYCLIC (7UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR and RNG cyclic sampling. */
141 #define LL_RNG_OUTPUT_LFSR_RNG (8UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR ⊕ RNG. */
142 #define LL_RNG_OUTPUT_LFSR (9UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR direct output. */
143 /** @} */
144
145 /** @} */
146
147 /* Exported macro ------------------------------------------------------------*/
148 /** @defgroup RNG_LL_Exported_Macros RNG Exported Macros
149 * @{
150 */
151
152 /** @defgroup RNG_LL_EM_WRITE_READ Common Write and read registers Macros
153 * @{
154 */
155
156 /**
157 * @brief Write a value in RNG register
158 * @param __instance__ RNG instance
159 * @param __REG__ Register to be written
160 * @param __VALUE__ Value to be written in the register
161 * @retval None.
162 */
163 #define LL_RNG_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__))
164
165 /**
166 * @brief Read a value in RNG register
167 * @param __instance__ RNG instance
168 * @param __REG__ Register to be read
169 * @retval Register value
170 */
171 #define LL_RNG_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__)
172 /** @} */
173
174 /** @} */
175
176 /* Exported functions --------------------------------------------------------*/
177 /** @defgroup RNG_LL_Exported_Functions RNG Exported Functions
178 * @{
179 */
180
181 /** @defgroup RNG_LL_EF_Configuration RNG Configuration functions
182 * @{
183 */
184
185 /**
186 * @brief Enable Random Number Generation.
187 *
188 * Register|BitsName
189 * --------|--------
190 * CTRL | RNG_RUN
191 *
192 * @param RNGx RNG instance.
193 * @retval None
194 */
195 __STATIC_INLINE void ll_rng_enable(rng_regs_t *RNGx)
196 {
197 SET_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN);
198 }
199
200 /**
201 * @brief Disable Random Number Generation.
202 *
203 * Register|BitsName
204 * --------|--------
205 * CTRL | RNG_RUN
206 *
207 * @param RNGx RNG instance.
208 * @retval None
209 */
210 __STATIC_INLINE void ll_rng_disable(rng_regs_t *RNGx)
211 {
212 CLEAR_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN);
213 }
214
215 /**
216 * @brief Check if Random Number Generator is enabled.
217 *
218 * Register|BitsName
219 * --------|--------
220 * CTRL | RNG_RUN
221 *
222 * @param RNGx RNG instance.
223 * @retval State of bit (1 or 0).
224 */
225 __STATIC_INLINE uint32_t ll_rng_is_enabled(rng_regs_t *RNGx)
226 {
227 return (READ_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN) == (RNG_CTRL_RUN_EN));
228 }
229
230 /**
231 * @brief Enable Ring oscillator TRNG enabled signal.
232 *
233 * Register|BitsName
234 * --------|--------
235 * CONFIG | RNG_FRO_EN
236 *
237 * @param RNGx RNG instance.
238 * @retval None
239 */
240 __STATIC_INLINE void ll_rng_enable_fro(rng_regs_t *RNGx)
241 {
242 SET_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN);
243 }
244
245 /**
246 * @brief Disable Ring oscillator TRNG enabled signal.
247 *
248 * Register|BitsName
249 * --------|--------
250 * CTRL | RNG_RUN
251 *
252 * @param RNGx RNG instance.
253 * @retval None
254 */
255 __STATIC_INLINE void ll_rng_disable_fro(rng_regs_t *RNGx)
256 {
257 CLEAR_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN);
258 }
259
260 /**
261 * @brief Check if Ring oscillator TRNG enabled signal is enabled.
262 *
263 * Register|BitsName
264 * --------|--------
265 * CTRL | RNG_RUN
266 *
267 * @param RNGx RNG instance.
268 * @retval State of bit (1 or 0).
269 */
270 __STATIC_INLINE uint32_t ll_rng_fro_is_enabled(rng_regs_t *RNGx)
271 {
272 return (READ_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN) == (RNG_CONFIG_FRO_EN));
273 }
274
275 /**
276 * @brief Set source of LFSR seed.
277 *
278 * Register|BitsName
279 * --------|--------
280 * CONFIG | RNG_LFSR_SEED_SEL
281 *
282 * @param RNGx RNG instance.
283 * @param seed This parameter can be one of the following values:
284 * @arg @ref LL_RNG_SEED_FR0_S0
285 * @arg @ref LL_RNG_SEED_USER
286 * @retval None
287 */
288 __STATIC_INLINE void ll_rng_set_lfsr_seed(rng_regs_t *RNGx, uint32_t seed)
289 {
290 MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_LFSR_SEED_SEL, seed);
291 }
292
293 /**
294 * @brief Get source of LFSR seed.
295 *
296 * Register|BitsName
297 * --------|--------
298 * CONFIG | RNG_LFSR_SEED_SEL
299 *
300 * @param RNGx RNG instance.
301 * @retval Returned value can be one of the following values:
302 * @arg @ref LL_RNG_SEED_FR0_S0
303 * @arg @ref LL_RNG_SEED_USER
304 */
305 __STATIC_INLINE uint32_t ll_rng_get_lfsr_seed(rng_regs_t *RNGx)
306 {
307 return READ_BITS(RNGx->CONFIG, RNG_CONFIG_LFSR_SEED_SEL);
308 }
309
310 /**
311 * @brief Set LFSR configuration mode.
312 *
313 * Register|BitsName
314 * --------|--------
315 * CONFIG | RNG_LFSR_MODE
316 *
317 * @param RNGx RNG instance.
318 * @param mode This parameter can be one of the following values:
319 * @arg @ref LL_RNG_LFSR_MODE_59BIT
320 * @arg @ref LL_RNG_LFSR_MODE_128BIT
321 * @retval None
322 */
323 __STATIC_INLINE void ll_rng_set_lfsr_mode(rng_regs_t *RNGx, uint32_t mode)
324 {
325 MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_LFSR_MODE, mode);
326 }
327
328 /**
329 * @brief Get LFSR configuration mode.
330 *
331 * Register|BitsName
332 * --------|--------
333 * CONFIG | RNG_LFSR_MODE
334 *
335 * @param RNGx RNG instance.
336 * @retval Returned value can be one of the following values:
337 * @arg @ref LL_RNG_LFSR_MODE_59BIT
338 * @arg @ref LL_RNG_LFSR_MODE_128BIT
339 */
340 __STATIC_INLINE uint32_t ll_rng_get_lfsr_mode(rng_regs_t *RNGx)
341 {
342 return READ_BITS(RNGx->CONFIG, RNG_CONFIG_LFSR_MODE);
343 }
344
345 /**
346 * @brief Set RNG post-process configuration.
347 *
348 * Register|BitsName
349 * --------|--------
350 * CONFIG | RNG_POST_MODE
351 *
352 * @param RNGx RNG instance.
353 * @param post This parameter can be one of the following values:
354 * @arg @ref LL_RNG_POST_PRO_NOT
355 * @arg @ref LL_RNG_POST_PRO_SKIPPING
356 * @arg @ref LL_RNG_POST_PRO_COUNTING
357 * @arg @ref LL_RNG_POST_PRO_NEUMANN
358 * @retval None
359 */
360 __STATIC_INLINE void ll_rng_set_post_mode(rng_regs_t *RNGx, uint32_t post)
361 {
362 MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_POST_MODE, post);
363 }
364
365 /**
366 * @brief Get RNG post-process configuration.
367 *
368 * Register|BitsName
369 * --------|--------
370 * CONFIG | RNG_POST_MODE
371 *
372 * @param RNGx RNG instance.
373 * @retval Returned value can be one of the following values:
374 * @arg @ref LL_RNG_POST_PRO_NOT
375 * @arg @ref LL_RNG_POST_PRO_SKIPPING
376 * @arg @ref LL_RNG_POST_PRO_COUNTING
377 * @arg @ref LL_RNG_POST_PRO_NEUMANN
378 */
379 __STATIC_INLINE uint32_t ll_rng_get_post_mode(rng_regs_t *RNGx)
380 {
381 return READ_BITS(RNGx->CONFIG, RNG_CONFIG_POST_MODE);
382 }
383
384 /**
385 * @brief set RNG output mode.
386 *
387 * Register|BitsName
388 * --------|--------
389 * CONFIG | RNG_OUT_MODE
390 *
391 * @param RNGx RNG instance.
392 * @param mode This parameter can be one of the following values:
393 * @arg @ref LL_RNG_OUTPUT_FR0_S0
394 * @arg @ref LL_RNG_OUTPUT_CYCLIC_PARITY
395 * @arg @ref LL_RNG_OUTPUT_CYCLIC
396 * @arg @ref LL_RNG_OUTPUT_LFSR_RNG
397 * @arg @ref LL_RNG_OUTPUT_LFSR
398 * @retval None
399 */
400 __STATIC_INLINE void ll_rng_set_output_mode(rng_regs_t *RNGx, uint32_t mode)
401 {
402 MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_OUT_MODE, mode);
403 }
404
405 /**
406 * @brief get RNG output mode.
407 *
408 * Register|BitsName
409 * --------|--------
410 * CONFIG | RNG_OUT_MODE
411 *
412 * @param RNGx RNG instance.
413 * @retval Returned value can be one of the following values:
414 * @arg @ref LL_RNG_OUTPUT_FR0_S0
415 * @arg @ref LL_RNG_OUTPUT_CYCLIC_PARITY
416 * @arg @ref LL_RNG_OUTPUT_CYCLIC
417 * @arg @ref LL_RNG_OUTPUT_LFSR_RNG
418 * @arg @ref LL_RNG_OUTPUT_LFSR
419 */
420 __STATIC_INLINE uint32_t ll_rng_get_output_mode(rng_regs_t *RNGx)
421 {
422 return READ_BITS(RNGx->CONFIG, RNG_CONFIG_OUT_MODE);
423 }
424
425 /**
426 * @brief set the waiting time that RNG input reaches stable.
427 *
428 * Register|BitsName
429 * --------|--------
430 * TSCON | RNG_TRDY_TIME
431 *
432 * @param RNGx RNG instance.
433 * @param time range between 0x1 and 0xFF.
434 * @retval None
435 */
436 __STATIC_INLINE void ll_rng_set_trdy_time(rng_regs_t *RNGx, uint32_t time)
437 {
438 MODIFY_REG(RNGx->TSCON, RNG_TSCON_TRDY_TIME, time);
439 }
440
441 /**
442 * @brief get the waiting time that RNG input reaches stable.
443 *
444 * Register|BitsName
445 * --------|--------
446 * TSCON | RNG_TRDY_TIME
447 *
448 * @param RNGx RNG instance.
449 * @retval Between Min_Time = 0 and Max_Time = 0xFF
450 */
451 __STATIC_INLINE uint32_t ll_rng_get_trdy_time(rng_regs_t *RNGx)
452 {
453 return READ_BITS(RNGx->TSCON, RNG_TSCON_TRDY_TIME);
454 }
455
456
457 /**
458 * @brief set RNG seed configured by user.
459 *
460 * Register|BitsName
461 * --------|--------
462 * USER | RNG_USER_SEED
463 *
464 * @param RNGx RNG instance.
465 * @param seed range between 0x1 and 0xFFFF.
466 * @retval None
467 */
468 __STATIC_INLINE void ll_rng_set_user_seed(rng_regs_t *RNGx, uint32_t seed)
469 {
470 WRITE_REG(RNGx->USER_SEED, seed);
471 }
472
473 /** @} */
474
475 /** @defgroup RNG_LL_EF_FLAG_Management FLAG Management
476 * @{
477 */
478
479 /**
480 * @brief Indicate if the Flag of RNG long run test is set or not.
481 *
482 * Register |BitsName
483 * ---------|--------
484 * LR_STATUS| RNG_LR_FLAG
485 *
486 * @param RNGx RNG instance.
487 * @retval State of bit (1 or 0).
488 */
489 __STATIC_INLINE uint32_t ll_rng_is_active_flag_lr(rng_regs_t *RNGx)
490 {
491 return (READ_BITS(RNGx->LR_STATUS, RNG_LR_STATUS_FLAG) == (RNG_LR_STATUS_FLAG));
492 }
493
494 /**
495 * @brief Indicate if the RNG Status Flag is set or not.
496 *
497 * Register|BitsName
498 * --------|--------
499 * STATUS | RNG_READY
500 *
501 * @param RNGx RNG instance.
502 * @retval State of bit (1 or 0).
503 */
504 __STATIC_INLINE uint32_t ll_rng_is_active_flag_sts(rng_regs_t *RNGx)
505 {
506 return (READ_BITS(RNGx->STATUS, RNG_STATUS_READY) == (RNG_STATUS_READY));
507 }
508
509 /**
510 * @brief Clear RNG Status flag.
511 *
512 * Register|BitsName
513 * --------|--------
514 * STATUS | RNG_READY
515 *
516 * @param RNGx RNG instance.
517 * @retval None
518 */
519 __STATIC_INLINE void ll_rng_clear_flag_sts(rng_regs_t *RNGx)
520 {
521 WRITE_REG(RNGx->STATUS, RNG_STATUS_READY);
522 }
523
524 /** @} */
525
526 /** @defgroup RNG_LL_EF_IT_Management IT Management
527 * @{
528 */
529
530 /**
531 * @brief Enable Random Number Generator Interrupt
532 *
533 * Register|BitsName
534 * --------|--------
535 * CONFIG | RNG_IRQ_EN
536 *
537 * @param RNGx RNG instance.
538 * @retval None
539 */
540 __STATIC_INLINE void ll_rng_enable_it(rng_regs_t *RNGx)
541 {
542 SET_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN);
543 }
544
545 /**
546 * @brief Disable Random Number Generator Interrupt
547 *
548 * Register|BitsName
549 * --------|--------
550 * CONFIG | RNG_IRQ_EN
551 *
552 * @param RNGx RNG instance.
553 * @retval None
554 */
555 __STATIC_INLINE void ll_rng_disable_it(rng_regs_t *RNGx)
556 {
557 CLEAR_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN);
558 }
559
560 /**
561 * @brief Check if Random Number Generator Interrupt is enabled
562 *
563 * Register|BitsName
564 * --------|--------
565 * CONFIG | RNG_IRQ_EN
566 *
567 * @param RNGx RNG instance.
568 * @retval State of bit (1 or 0).
569 */
570 __STATIC_INLINE uint32_t ll_rng_is_enabled_it(rng_regs_t *RNGx)
571 {
572 return (READ_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN) == (RNG_CONFIG_IRQ_EN));
573 }
574
575 /** @} */
576
577 /** @defgroup RNG_LL_EF_Data_Management Data Management
578 * @{
579 */
580
581 /**
582 * @brief Return32-bit Random Number value
583 *
584 * Register|BitsName
585 * --------|--------
586 * DATA | RNG_DATA
587 *
588 * @param RNGx RNG instance.
589 * @retval Generated 32-bit random value
590 */
591 __STATIC_INLINE uint32_t ll_rng_read_random_data32(rng_regs_t *RNGx)
592 {
593 return (uint32_t)(READ_REG(RNGx->DATA));
594 }
595
596 /**
597 * @brief Return8-bit RNG Long Run Test counts.
598 *
599 * Register |BitsName
600 * ---------|--------
601 * LR_STATUS| RNG_LR_CNT
602 *
603 * @param RNGx RNG instance.
604 * @retval Output Data[7:0]
605 */
606 __STATIC_INLINE uint32_t ll_rng_read_lr_count(rng_regs_t *RNGx)
607 {
608 return READ_BITS(RNGx->LR_STATUS, RNG_LR_STATUS_CNT) >> RNG_LR_STATUS_CNT_Pos;
609 }
610
611 /** @} */
612
613 /** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions
614 * @{
615 */
616
617 /**
618 * @brief De-initialize the RNG registers to their default reset values.
619 * @param RNGx RNG instance.
620 * @retval An error_status_t enumeration value:
621 * - SUCCESS: RNG registers are de-initialized
622 * - ERROR: RNG registers are not de-initialized
623 */
624 error_status_t ll_rng_deinit(rng_regs_t *RNGx);
625
626 /**
627 * @brief Initialize RNG registers according to the specified
628 * parameters in p_rng_init.
629 * @param RNGx RNG Instance
630 * @param p_rng_init Pointer to a ll_rng_init_t structure that contains the configuration
631 * information for the specified RNG peripheral.
632 * @retval An error_status_t enumeration value:
633 * - SUCCESS: RNG registers are initialized according to p_rng_init content
634 * - ERROR: Problem occurred during RNG Registers initialization
635 */
636 error_status_t ll_rng_init(rng_regs_t *RNGx, ll_rng_init_t *p_rng_init);
637
638 /**
639 * @brief Set each field of a @ref ll_rng_init_t type structure to default value.
640 * @param p_rng_init Pointer to a @ref ll_rng_init_t structure
641 * whose fields will be set to default values.
642 * @retval None
643 */
644 void ll_rng_struct_init(ll_rng_init_t *p_rng_init);
645
646 /** @} */
647
648 /** @} */
649
650 #endif /* RNG */
651
652 #ifdef __cplusplus
653 }
654 #endif
655
656 #endif /* __GR533X_LL_RNG_H__ */
657
658 /** @} */
659
660 /** @} */
661
662 /** @} */
ll_rng_deinit
error_status_t ll_rng_deinit(rng_regs_t *RNGx)
De-initialize the RNG registers to their default reset values.
ll_rng_is_active_flag_lr
__STATIC_INLINE uint32_t ll_rng_is_active_flag_lr(rng_regs_t *RNGx)
Indicate if the Flag of RNG long run test is set or not.
Definition: gr533x_ll_rng.h:489
ll_rng_get_post_mode
__STATIC_INLINE uint32_t ll_rng_get_post_mode(rng_regs_t *RNGx)
Get RNG post-process configuration.
Definition: gr533x_ll_rng.h:379
ll_rng_set_lfsr_seed
__STATIC_INLINE void ll_rng_set_lfsr_seed(rng_regs_t *RNGx, uint32_t seed)
Set source of LFSR seed.
Definition: gr533x_ll_rng.h:288
ll_rng_enable_fro
__STATIC_INLINE void ll_rng_enable_fro(rng_regs_t *RNGx)
Enable Ring oscillator TRNG enabled signal.
Definition: gr533x_ll_rng.h:240
ll_rng_clear_flag_sts
__STATIC_INLINE void ll_rng_clear_flag_sts(rng_regs_t *RNGx)
Clear RNG Status flag.
Definition: gr533x_ll_rng.h:519
ll_rng_set_post_mode
__STATIC_INLINE void ll_rng_set_post_mode(rng_regs_t *RNGx, uint32_t post)
Set RNG post-process configuration.
Definition: gr533x_ll_rng.h:360
ll_rng_enable
__STATIC_INLINE void ll_rng_enable(rng_regs_t *RNGx)
Enable Random Number Generation.
Definition: gr533x_ll_rng.h:195
ll_rng_get_lfsr_seed
__STATIC_INLINE uint32_t ll_rng_get_lfsr_seed(rng_regs_t *RNGx)
Get source of LFSR seed.
Definition: gr533x_ll_rng.h:305
ll_rng_struct_init
void ll_rng_struct_init(ll_rng_init_t *p_rng_init)
Set each field of a ll_rng_init_t type structure to default value.
ll_rng_set_trdy_time
__STATIC_INLINE void ll_rng_set_trdy_time(rng_regs_t *RNGx, uint32_t time)
set the waiting time that RNG input reaches stable.
Definition: gr533x_ll_rng.h:436
ll_rng_read_lr_count
__STATIC_INLINE uint32_t ll_rng_read_lr_count(rng_regs_t *RNGx)
Return8-bit RNG Long Run Test counts.
Definition: gr533x_ll_rng.h:606
ll_rng_is_enabled_it
__STATIC_INLINE uint32_t ll_rng_is_enabled_it(rng_regs_t *RNGx)
Check if Random Number Generator Interrupt is enabled.
Definition: gr533x_ll_rng.h:570
ll_rng_set_output_mode
__STATIC_INLINE void ll_rng_set_output_mode(rng_regs_t *RNGx, uint32_t mode)
set RNG output mode.
Definition: gr533x_ll_rng.h:400
ll_rng_enable_it
__STATIC_INLINE void ll_rng_enable_it(rng_regs_t *RNGx)
Enable Random Number Generator Interrupt.
Definition: gr533x_ll_rng.h:540
ll_rng_disable_it
__STATIC_INLINE void ll_rng_disable_it(rng_regs_t *RNGx)
Disable Random Number Generator Interrupt.
Definition: gr533x_ll_rng.h:555
ll_rng_set_user_seed
__STATIC_INLINE void ll_rng_set_user_seed(rng_regs_t *RNGx, uint32_t seed)
set RNG seed configured by user.
Definition: gr533x_ll_rng.h:468
ll_rng_read_random_data32
__STATIC_INLINE uint32_t ll_rng_read_random_data32(rng_regs_t *RNGx)
Return32-bit Random Number value.
Definition: gr533x_ll_rng.h:591
ll_rng_disable_fro
__STATIC_INLINE void ll_rng_disable_fro(rng_regs_t *RNGx)
Disable Ring oscillator TRNG enabled signal.
Definition: gr533x_ll_rng.h:255
ll_rng_get_output_mode
__STATIC_INLINE uint32_t ll_rng_get_output_mode(rng_regs_t *RNGx)
get RNG output mode.
Definition: gr533x_ll_rng.h:420
ll_rng_get_lfsr_mode
__STATIC_INLINE uint32_t ll_rng_get_lfsr_mode(rng_regs_t *RNGx)
Get LFSR configuration mode.
Definition: gr533x_ll_rng.h:340
_ll_rng_init::out_mode
uint32_t out_mode
Definition: gr533x_ll_rng.h:84
_ll_rng_init
LL RNG Init Structure definition.
Definition: gr533x_ll_rng.h:77
ll_rng_init_t
struct _ll_rng_init ll_rng_init_t
LL RNG Init Structure definition.
_ll_rng_init::interrupt
uint32_t interrupt
Definition: gr533x_ll_rng.h:90
ll_rng_is_enabled
__STATIC_INLINE uint32_t ll_rng_is_enabled(rng_regs_t *RNGx)
Check if Random Number Generator is enabled.
Definition: gr533x_ll_rng.h:225
ll_rng_get_trdy_time
__STATIC_INLINE uint32_t ll_rng_get_trdy_time(rng_regs_t *RNGx)
get the waiting time that RNG input reaches stable.
Definition: gr533x_ll_rng.h:451
_ll_rng_init::seed
uint32_t seed
Definition: gr533x_ll_rng.h:78
ll_rng_init
error_status_t ll_rng_init(rng_regs_t *RNGx, ll_rng_init_t *p_rng_init)
Initialize RNG registers according to the specified parameters in p_rng_init.
_ll_rng_init::post_mode
uint32_t post_mode
Definition: gr533x_ll_rng.h:87
ll_rng_is_active_flag_sts
__STATIC_INLINE uint32_t ll_rng_is_active_flag_sts(rng_regs_t *RNGx)
Indicate if the RNG Status Flag is set or not.
Definition: gr533x_ll_rng.h:504
ll_rng_disable
__STATIC_INLINE void ll_rng_disable(rng_regs_t *RNGx)
Disable Random Number Generation.
Definition: gr533x_ll_rng.h:210
ll_rng_set_lfsr_mode
__STATIC_INLINE void ll_rng_set_lfsr_mode(rng_regs_t *RNGx, uint32_t mode)
Set LFSR configuration mode.
Definition: gr533x_ll_rng.h:323
ll_rng_fro_is_enabled
__STATIC_INLINE uint32_t ll_rng_fro_is_enabled(rng_regs_t *RNGx)
Check if Ring oscillator TRNG enabled signal is enabled.
Definition: gr533x_ll_rng.h:270
_ll_rng_init::lfsr_mode
uint32_t lfsr_mode
Definition: gr533x_ll_rng.h:81