gr55xx_ll_rng.h
Go to the documentation of this file.
1 /**
2 ****************************************************************************************
3 *
4 * @file gr55xx_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 __GR55XX_LL_RNG_H__
53 #define __GR55XX_LL_RNG_H__
54
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58
59 /* Includes ------------------------------------------------------------------*/
60 #include "gr55xx.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 /**
100 * @defgroup RNG_LL_MACRO Defines
101 * @{
102 */
103
104 /* Exported constants --------------------------------------------------------*/
105 /** @defgroup RNG_LL_Exported_Constants RNG Exported Constants
106 * @{
107 */
108
109 /** @defgroup RNG_LL_EC_SEED_SOURCE LFSR seed source
110 * @{
111 */
112 #define LL_RNG_SEED_FR0_S0 (4UL << RNG_CONFIG_LFSR_SEED_SEL_Pos) /**< LFSR seed is from the switching oscillator s0. */
113 #define LL_RNG_SEED_USER (6UL << RNG_CONFIG_LFSR_SEED_SEL_Pos) /**< LFSR seed is configured by users. */
114 /** @} */
115
116
117 /** @defgroup RNG_LL_EC_LFSR_MODE LFSR configuration mode
118 * @{
119 */
120 #define LL_RNG_LFSR_MODE_59BIT (0x00000000UL) /**< 59 bit LFSR. */
121 #define LL_RNG_LFSR_MODE_128BIT (1UL << RNG_CONFIG_LFSR_MODE_Pos) /**< 128 bit LFSR. */
122 /** @} */
123
124 /** @defgroup RNG_LL_EC_POST_PRO Post-process mode
125 * @{
126 */
127 #define LL_RNG_POST_PRO_NOT (0x00000000UL) /**< No post process. */
128 #define LL_RNG_POST_PRO_SKIPPING (1UL << RNG_CONFIG_POST_MODE_Pos) /**< bit skipping. */
129 #define LL_RNG_POST_PRO_COUNTING (2UL << RNG_CONFIG_POST_MODE_Pos) /**< bit counting. */
130 #define LL_RNG_POST_PRO_NEUMANN (3UL << RNG_CONFIG_POST_MODE_Pos) /**< Von-Neumann. */
131 /** @} */
132
133 /** @defgroup RNG_LL_EC_IT RNG hardware interrupt enable.
134 * @{
135 */
136 #define LL_RNG_IT_DISABLE (0x00000000UL) /**< Disable RNG interrupt. */
137 #define LL_RNG_IT_ENABLE (1UL << RNG_CONFIG_IRQ_EN_Pos) /**< Enable RNG interrupt. */
138 /** @} */
139
140 /** @defgroup RNG_LL_EC_OUTPUT_MODE RNG Output mode
141 * @{
142 */
143 #define LL_RNG_OUTPUT_FR0_S0 (4UL << RNG_CONFIG_OUT_MODE_Pos) /**< Digital RNG direct output, ring oscillator s0. */
144 #define LL_RNG_OUTPUT_CYCLIC_PARITY (6UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR and RNG cyclic sampling and parity generation. */
145 #define LL_RNG_OUTPUT_CYCLIC (7UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR and RNG cyclic sampling. */
146 #define LL_RNG_OUTPUT_LFSR_RNG (8UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR ⊕ RNG. */
147 #define LL_RNG_OUTPUT_LFSR (9UL << RNG_CONFIG_OUT_MODE_Pos) /**< LFSR direct output. */
148 /** @} */
149
150 /** @} */
151
152 /* Exported macro ------------------------------------------------------------*/
153 /** @defgroup RNG_LL_Exported_Macros RNG Exported Macros
154 * @{
155 */
156
157 /** @defgroup RNG_LL_EM_WRITE_READ Common Write and read registers Macros
158 * @{
159 */
160
161 /**
162 * @brief Write a value in RNG register
163 * @param __instance__ RNG instance
164 * @param __REG__ Register to be written
165 * @param __VALUE__ Value to be written in the register
166 * @retval None.
167 */
168 #define LL_RNG_WriteReg(__instance__, __REG__, __VALUE__) WRITE_REG(__instance__->__REG__, (__VALUE__))
169
170 /**
171 * @brief Read a value in RNG register
172 * @param __instance__ RNG instance
173 * @param __REG__ Register to be read
174 * @retval Register value
175 */
176 #define LL_RNG_ReadReg(__instance__, __REG__) READ_REG(__instance__->__REG__)
177 /** @} */
178
179 /** @} */
180
181 /** @} */
182
183 /* Exported functions --------------------------------------------------------*/
184 /** @defgroup RNG_LL_Exported_Functions RNG Exported Functions
185 * @{
186 */
187
188 /** @defgroup RNG_LL_EF_Configuration RNG Configuration functions
189 * @{
190 */
191
192 /**
193 * @brief Enable Random Number Generation.
194 *
195 * Register|BitsName
196 * --------|--------
197 * CTRL | RNG_RUN
198 *
199 * @param RNGx RNG instance.
200 * @retval None
201 */
202 __STATIC_INLINE void ll_rng_enable(rng_regs_t *RNGx)
203 {
204 SET_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN);
205 }
206
207 /**
208 * @brief Disable Random Number Generation.
209 *
210 * Register|BitsName
211 * --------|--------
212 * CTRL | RNG_RUN
213 *
214 * @param RNGx RNG instance.
215 * @retval None
216 */
217 __STATIC_INLINE void ll_rng_disable(rng_regs_t *RNGx)
218 {
219 CLEAR_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN);
220 }
221
222 /**
223 * @brief Check if Random Number Generator is enabled.
224 *
225 * Register|BitsName
226 * --------|--------
227 * CTRL | RNG_RUN
228 *
229 * @param RNGx RNG instance.
230 * @retval State of bit (1 or 0).
231 */
232 __STATIC_INLINE uint32_t ll_rng_is_enabled(rng_regs_t *RNGx)
233 {
234 return (READ_BITS(RNGx->CTRL, RNG_CTRL_RUN_EN) == (RNG_CTRL_RUN_EN));
235 }
236
237 /**
238 * @brief Enable Ring oscillator TRNG enabled signal.
239 *
240 * Register|BitsName
241 * --------|--------
242 * CONFIG | RNG_FRO_EN
243 *
244 * @param RNGx RNG instance.
245 * @retval None
246 */
247 __STATIC_INLINE void ll_rng_enable_fro(rng_regs_t *RNGx)
248 {
249 SET_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN);
250 }
251
252 /**
253 * @brief Disable Ring oscillator TRNG enabled signal.
254 *
255 * Register|BitsName
256 * --------|--------
257 * CTRL | RNG_RUN
258 *
259 * @param RNGx RNG instance.
260 * @retval None
261 */
262 __STATIC_INLINE void ll_rng_disable_fro(rng_regs_t *RNGx)
263 {
264 CLEAR_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN);
265 }
266
267 /**
268 * @brief Check if Ring oscillator TRNG enabled signal is enabled.
269 *
270 * Register|BitsName
271 * --------|--------
272 * CTRL | RNG_RUN
273 *
274 * @param RNGx RNG instance.
275 * @retval State of bit (1 or 0).
276 */
277 __STATIC_INLINE uint32_t ll_rng_fro_is_enabled(rng_regs_t *RNGx)
278 {
279 return (READ_BITS(RNGx->CONFIG, RNG_CONFIG_FRO_EN) == (RNG_CONFIG_FRO_EN));
280 }
281
282 /**
283 * @brief Set source of LFSR seed.
284 *
285 * Register|BitsName
286 * --------|--------
287 * CONFIG | RNG_LFSR_SEED_SEL
288 *
289 * @param RNGx RNG instance.
290 * @param seed This parameter can be one of the following values:
291 * @arg @ref LL_RNG_SEED_FR0_S0
292 * @arg @ref LL_RNG_SEED_USER
293 * @retval None
294 */
295 __STATIC_INLINE void ll_rng_set_lfsr_seed(rng_regs_t *RNGx, uint32_t seed)
296 {
297 MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_LFSR_SEED_SEL, seed);
298 }
299
300 /**
301 * @brief Get source of LFSR seed.
302 *
303 * Register|BitsName
304 * --------|--------
305 * CONFIG | RNG_LFSR_SEED_SEL
306 *
307 * @param RNGx RNG instance.
308 * @retval Returned value can be one of the following values:
309 * @arg @ref LL_RNG_SEED_FR0_S0
310 * @arg @ref LL_RNG_SEED_USER
311 */
312 __STATIC_INLINE uint32_t ll_rng_get_lfsr_seed(rng_regs_t *RNGx)
313 {
314 return READ_BITS(RNGx->CONFIG, RNG_CONFIG_LFSR_SEED_SEL);
315 }
316
317 /**
318 * @brief Set LFSR configuration mode.
319 *
320 * Register|BitsName
321 * --------|--------
322 * CONFIG | RNG_LFSR_MODE
323 *
324 * @param RNGx RNG instance.
325 * @param mode This parameter can be one of the following values:
326 * @arg @ref LL_RNG_LFSR_MODE_59BIT
327 * @arg @ref LL_RNG_LFSR_MODE_128BIT
328 * @retval None
329 */
330 __STATIC_INLINE void ll_rng_set_lfsr_mode(rng_regs_t *RNGx, uint32_t mode)
331 {
332 MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_LFSR_MODE, mode);
333 }
334
335 /**
336 * @brief Get LFSR configuration mode.
337 *
338 * Register|BitsName
339 * --------|--------
340 * CONFIG | RNG_LFSR_MODE
341 *
342 * @param RNGx RNG instance.
343 * @retval Returned value can be one of the following values:
344 * @arg @ref LL_RNG_LFSR_MODE_59BIT
345 * @arg @ref LL_RNG_LFSR_MODE_128BIT
346 */
347 __STATIC_INLINE uint32_t ll_rng_get_lfsr_mode(rng_regs_t *RNGx)
348 {
349 return READ_BITS(RNGx->CONFIG, RNG_CONFIG_LFSR_MODE);
350 }
351
352 /**
353 * @brief Set RNG post-process configuration.
354 *
355 * Register|BitsName
356 * --------|--------
357 * CONFIG | RNG_POST_MODE
358 *
359 * @param RNGx RNG instance.
360 * @param post This parameter can be one of the following values:
361 * @arg @ref LL_RNG_POST_PRO_NOT
362 * @arg @ref LL_RNG_POST_PRO_SKIPPING
363 * @arg @ref LL_RNG_POST_PRO_COUNTING
364 * @arg @ref LL_RNG_POST_PRO_NEUMANN
365 * @retval None
366 */
367 __STATIC_INLINE void ll_rng_set_post_mode(rng_regs_t *RNGx, uint32_t post)
368 {
369 MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_POST_MODE, post);
370 }
371
372 /**
373 * @brief Get RNG post-process configuration.
374 *
375 * Register|BitsName
376 * --------|--------
377 * CONFIG | RNG_POST_MODE
378 *
379 * @param RNGx RNG instance.
380 * @retval Returned value can be one of the following values:
381 * @arg @ref LL_RNG_POST_PRO_NOT
382 * @arg @ref LL_RNG_POST_PRO_SKIPPING
383 * @arg @ref LL_RNG_POST_PRO_COUNTING
384 * @arg @ref LL_RNG_POST_PRO_NEUMANN
385 */
386 __STATIC_INLINE uint32_t ll_rng_get_post_mode(rng_regs_t *RNGx)
387 {
388 return READ_BITS(RNGx->CONFIG, RNG_CONFIG_POST_MODE);
389 }
390
391 /**
392 * @brief set RNG output mode.
393 *
394 * Register|BitsName
395 * --------|--------
396 * CONFIG | RNG_OUT_MODE
397 *
398 * @param RNGx RNG instance.
399 * @param mode This parameter can be one of the following values:
400 * @arg @ref LL_RNG_OUTPUT_FR0_S0
401 * @arg @ref LL_RNG_OUTPUT_CYCLIC_PARITY
402 * @arg @ref LL_RNG_OUTPUT_CYCLIC
403 * @arg @ref LL_RNG_OUTPUT_LFSR_RNG
404 * @arg @ref LL_RNG_OUTPUT_LFSR
405 * @retval None
406 */
407 __STATIC_INLINE void ll_rng_set_output_mode(rng_regs_t *RNGx, uint32_t mode)
408 {
409 MODIFY_REG(RNGx->CONFIG, RNG_CONFIG_OUT_MODE, mode);
410 }
411
412 /**
413 * @brief get RNG output mode.
414 *
415 * Register|BitsName
416 * --------|--------
417 * CONFIG | RNG_OUT_MODE
418 *
419 * @param RNGx RNG instance.
420 * @retval Returned value can be one of the following values:
421 * @arg @ref LL_RNG_OUTPUT_FR0_S0
422 * @arg @ref LL_RNG_OUTPUT_CYCLIC_PARITY
423 * @arg @ref LL_RNG_OUTPUT_CYCLIC
424 * @arg @ref LL_RNG_OUTPUT_LFSR_RNG
425 * @arg @ref LL_RNG_OUTPUT_LFSR
426 */
427 __STATIC_INLINE uint32_t ll_rng_get_output_mode(rng_regs_t *RNGx)
428 {
429 return READ_BITS(RNGx->CONFIG, RNG_CONFIG_OUT_MODE);
430 }
431
432 /**
433 * @brief set the waiting time that RNG input reaches stable.
434 *
435 * Register|BitsName
436 * --------|--------
437 * TSCON | RNG_TRDY_TIME
438 *
439 * @param RNGx RNG instance.
440 * @param time range between 0x1 and 0xFF.
441 * @retval None
442 */
443 __STATIC_INLINE void ll_rng_set_trdy_time(rng_regs_t *RNGx, uint32_t time)
444 {
445 MODIFY_REG(RNGx->TSCON, RNG_TSCON_TRDY_TIME, time);
446 }
447
448 /**
449 * @brief get the waiting time that RNG input reaches stable.
450 *
451 * Register|BitsName
452 * --------|--------
453 * TSCON | RNG_TRDY_TIME
454 *
455 * @param RNGx RNG instance.
456 * @retval Between Min_Time = 0 and Max_Time = 0xFF
457 */
458 __STATIC_INLINE uint32_t ll_rng_get_trdy_time(rng_regs_t *RNGx)
459 {
460 return READ_BITS(RNGx->TSCON, RNG_TSCON_TRDY_TIME);
461 }
462
463
464 /**
465 * @brief set RNG seed configured by user.
466 *
467 * Register|BitsName
468 * --------|--------
469 * USER | RNG_USER_SEED
470 *
471 * @param RNGx RNG instance.
472 * @param seed range between 0x1 and 0xFFFF.
473 * @retval None
474 */
475 __STATIC_INLINE void ll_rng_set_user_seed(rng_regs_t *RNGx, uint32_t seed)
476 {
477 WRITE_REG(RNGx->USER_SEED, seed);
478 }
479
480 /** @} */
481
482 /** @defgroup RNG_LL_EF_FLAG_Management FLAG Management
483 * @{
484 */
485
486 /**
487 * @brief Indicate if the Flag of RNG long run test is set or not.
488 *
489 * Register |BitsName
490 * ---------|--------
491 * LR_STATUS| RNG_LR_FLAG
492 *
493 * @param RNGx RNG instance.
494 * @retval State of bit (1 or 0).
495 */
496 __STATIC_INLINE uint32_t ll_rng_is_active_flag_lr(rng_regs_t *RNGx)
497 {
498 return (READ_BITS(RNGx->LR_STATUS, RNG_LR_STATUS_FLAG) == (RNG_LR_STATUS_FLAG));
499 }
500
501 /**
502 * @brief Indicate if the RNG Status Flag is set or not.
503 *
504 * Register|BitsName
505 * --------|--------
506 * STATUS | RNG_READY
507 *
508 * @param RNGx RNG instance.
509 * @retval State of bit (1 or 0).
510 */
511 __STATIC_INLINE uint32_t ll_rng_is_active_flag_sts(rng_regs_t *RNGx)
512 {
513 return (READ_BITS(RNGx->STATUS, RNG_STATUS_READY) == (RNG_STATUS_READY));
514 }
515
516 /**
517 * @brief Clear RNG Status flag.
518 *
519 * Register|BitsName
520 * --------|--------
521 * STATUS | RNG_READY
522 *
523 * @param RNGx RNG instance.
524 * @retval None
525 */
526 __STATIC_INLINE void ll_rng_clear_flag_sts(rng_regs_t *RNGx)
527 {
528 WRITE_REG(RNGx->STATUS, RNG_STATUS_READY);
529 }
530
531 /** @} */
532
533 /** @defgroup RNG_LL_EF_IT_Management IT Management
534 * @{
535 */
536
537 /**
538 * @brief Enable Random Number Generator Interrupt
539 *
540 * Register|BitsName
541 * --------|--------
542 * CONFIG | RNG_IRQ_EN
543 *
544 * @param RNGx RNG instance.
545 * @retval None
546 */
547 __STATIC_INLINE void ll_rng_enable_it(rng_regs_t *RNGx)
548 {
549 SET_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN);
550 }
551
552 /**
553 * @brief Disable Random Number Generator Interrupt
554 *
555 * Register|BitsName
556 * --------|--------
557 * CONFIG | RNG_IRQ_EN
558 *
559 * @param RNGx RNG instance.
560 * @retval None
561 */
562 __STATIC_INLINE void ll_rng_disable_it(rng_regs_t *RNGx)
563 {
564 CLEAR_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN);
565 }
566
567 /**
568 * @brief Check if Random Number Generator Interrupt is enabled
569 *
570 * Register|BitsName
571 * --------|--------
572 * CONFIG | RNG_IRQ_EN
573 *
574 * @param RNGx RNG instance.
575 * @retval State of bit (1 or 0).
576 */
577 __STATIC_INLINE uint32_t ll_rng_is_enabled_it(rng_regs_t *RNGx)
578 {
579 return (READ_BITS(RNGx->CONFIG, RNG_CONFIG_IRQ_EN) == (RNG_CONFIG_IRQ_EN));
580 }
581
582 /** @} */
583
584 /** @defgroup RNG_LL_EF_Data_Management Data Management
585 * @{
586 */
587
588 /**
589 * @brief Return32-bit Random Number value
590 *
591 * Register|BitsName
592 * --------|--------
593 * DATA | RNG_DATA
594 *
595 * @param RNGx RNG instance.
596 * @retval Generated 32-bit random value
597 */
598 __STATIC_INLINE uint32_t ll_rng_read_random_data32(rng_regs_t *RNGx)
599 {
600 return (uint32_t)(READ_REG(RNGx->DATA));
601 }
602
603 /**
604 * @brief Return8-bit RNG Long Run Test counts.
605 *
606 * Register |BitsName
607 * ---------|--------
608 * LR_STATUS| RNG_LR_CNT
609 *
610 * @param RNGx RNG instance.
611 * @retval Output Data[7:0]
612 */
613 __STATIC_INLINE uint32_t ll_rng_read_lr_count(rng_regs_t *RNGx)
614 {
615 return READ_BITS(RNGx->LR_STATUS, RNG_LR_STATUS_CNT) >> RNG_LR_STATUS_CNT_Pos;
616 }
617
618 /** @} */
619
620 /** @defgroup RNG_LL_EF_Init Initialization and de-initialization functions
621 * @{
622 */
623
624 /**
625 * @brief De-initialize the RNG registers to their default reset values.
626 * @param RNGx RNG instance.
627 * @retval An error_status_t enumeration value:
628 * - SUCCESS: RNG registers are de-initialized
629 * - ERROR: RNG registers are not de-initialized
630 */
631 error_status_t ll_rng_deinit(rng_regs_t *RNGx);
632
633 /**
634 * @brief Initialize RNG registers according to the specified
635 * parameters in p_rng_init.
636 * @param RNGx RNG Instance
637 * @param p_rng_init Pointer to a ll_rng_init_t structure that contains the configuration
638 * information for the specified RNG peripheral.
639 * @retval An error_status_t enumeration value:
640 * - SUCCESS: RNG registers are initialized according to p_rng_init content
641 * - ERROR: Problem occurred during RNG Registers initialization
642 */
643 error_status_t ll_rng_init(rng_regs_t *RNGx, ll_rng_init_t *p_rng_init);
644
645 /**
646 * @brief Set each field of a @ref ll_rng_init_t type structure to default value.
647 * @param p_rng_init Pointer to a @ref ll_rng_init_t structure
648 * whose fields will be set to default values.
649 * @retval None
650 */
651 void ll_rng_struct_init(ll_rng_init_t *p_rng_init);
652
653 /** @} */
654
655 /** @} */
656
657 #endif /* RNG */
658
659 #ifdef __cplusplus
660 }
661 #endif
662
663 #endif /* __GR55XX_LL_RNG_H__ */
664
665 /** @} */
666
667 /** @} */
668
669 /** @} */
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: gr55xx_ll_rng.h:496
ll_rng_get_post_mode
__STATIC_INLINE uint32_t ll_rng_get_post_mode(rng_regs_t *RNGx)
Get RNG post-process configuration.
Definition: gr55xx_ll_rng.h:386
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: gr55xx_ll_rng.h:295
ll_rng_enable_fro
__STATIC_INLINE void ll_rng_enable_fro(rng_regs_t *RNGx)
Enable Ring oscillator TRNG enabled signal.
Definition: gr55xx_ll_rng.h:247
ll_rng_clear_flag_sts
__STATIC_INLINE void ll_rng_clear_flag_sts(rng_regs_t *RNGx)
Clear RNG Status flag.
Definition: gr55xx_ll_rng.h:526
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: gr55xx_ll_rng.h:367
ll_rng_enable
__STATIC_INLINE void ll_rng_enable(rng_regs_t *RNGx)
Enable Random Number Generation.
Definition: gr55xx_ll_rng.h:202
ll_rng_get_lfsr_seed
__STATIC_INLINE uint32_t ll_rng_get_lfsr_seed(rng_regs_t *RNGx)
Get source of LFSR seed.
Definition: gr55xx_ll_rng.h:312
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: gr55xx_ll_rng.h:443
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: gr55xx_ll_rng.h:613
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: gr55xx_ll_rng.h:577
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: gr55xx_ll_rng.h:407
ll_rng_enable_it
__STATIC_INLINE void ll_rng_enable_it(rng_regs_t *RNGx)
Enable Random Number Generator Interrupt.
Definition: gr55xx_ll_rng.h:547
ll_rng_disable_it
__STATIC_INLINE void ll_rng_disable_it(rng_regs_t *RNGx)
Disable Random Number Generator Interrupt.
Definition: gr55xx_ll_rng.h:562
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: gr55xx_ll_rng.h:475
ll_rng_read_random_data32
__STATIC_INLINE uint32_t ll_rng_read_random_data32(rng_regs_t *RNGx)
Return32-bit Random Number value.
Definition: gr55xx_ll_rng.h:598
ll_rng_disable_fro
__STATIC_INLINE void ll_rng_disable_fro(rng_regs_t *RNGx)
Disable Ring oscillator TRNG enabled signal.
Definition: gr55xx_ll_rng.h:262
ll_rng_get_output_mode
__STATIC_INLINE uint32_t ll_rng_get_output_mode(rng_regs_t *RNGx)
get RNG output mode.
Definition: gr55xx_ll_rng.h:427
ll_rng_get_lfsr_mode
__STATIC_INLINE uint32_t ll_rng_get_lfsr_mode(rng_regs_t *RNGx)
Get LFSR configuration mode.
Definition: gr55xx_ll_rng.h:347
_ll_rng_init::out_mode
uint32_t out_mode
Definition: gr55xx_ll_rng.h:84
_ll_rng_init
LL RNG Init Structure definition.
Definition: gr55xx_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: gr55xx_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: gr55xx_ll_rng.h:232
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: gr55xx_ll_rng.h:458
_ll_rng_init::seed
uint32_t seed
Definition: gr55xx_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: gr55xx_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: gr55xx_ll_rng.h:511
ll_rng_disable
__STATIC_INLINE void ll_rng_disable(rng_regs_t *RNGx)
Disable Random Number Generation.
Definition: gr55xx_ll_rng.h:217
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: gr55xx_ll_rng.h:330
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: gr55xx_ll_rng.h:277
_ll_rng_init::lfsr_mode
uint32_t lfsr_mode
Definition: gr55xx_ll_rng.h:81