app_rng.h
Go to the documentation of this file.
1
52 #ifndef _APP_RNG_H_
53 #define _APP_RNG_H_
54
55 #include "gr55xx_hal.h"
56 #include "app_drv_error.h"
57 #ifdef ENV_USE_FREERTOS
58 #include "app_rtos_cfg.h"
59 #endif
60
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64
65 #ifdef HAL_RNG_MODULE_ENABLED
66
74 typedef enum
75 {
76 APP_RNG_TYPE_INTERRUPT,
77 APP_RNG_TYPE_POLLING,
78 APP_RNG_TYPE_MAX
79 } app_rng_type_t;
80
84 typedef enum
85 {
86 APP_RNG_EVT_DONE,
87 APP_RNG_EVT_ERROR,
88 } app_rng_evt_type_t;
97 typedef struct
98 {
99 app_rng_type_t use_type;
100 rng_init_t init;
101 } app_rng_params_t;
102
106 typedef struct
107 {
108 app_rng_evt_type_t type;
109 uint32_t random_data;
110 } app_rng_evt_t;
111
115 typedef void (*app_rng_evt_handler_t)(app_rng_evt_t *p_evt);
116
119 /* Exported functions --------------------------------------------------------*/
138 uint16_t app_rng_init(app_rng_params_t *p_params, app_rng_evt_handler_t evt_handler);
139
147 uint16_t app_rng_deinit(void);
148
162 uint16_t app_rng_gen_sync(uint16_t *p_seed, uint32_t *p_random32bit);
163
176 uint16_t app_rng_gen_async(uint16_t *p_seed);
177
185 rng_handle_t *app_rng_get_handle(void);
186
187 #ifdef ENV_RTOS_USE_SEMP
188
201 uint16_t app_rng_gen_sem_sync(uint16_t *p_seed);
202
203 #endif
204
205 #endif
206
208 #ifdef __cplusplus
209 }
210 #endif
211
212 #endif
213
app_rng_gen_async
uint16_t app_rng_gen_async(uint16_t *p_seed)
Generate a 32-bit random number in interrupt mode.
app_rng_type_t
app_rng_type_t
RNG operating mode Enumerations definition.
Definition: app_rng.h:75
app_rng_evt_t::type
app_rng_evt_type_t type
Definition: app_rng.h:108
APP_RNG_EVT_DONE
@ APP_RNG_EVT_DONE
Definition: app_rng.h:86
APP_RNG_TYPE_MAX
@ APP_RNG_TYPE_MAX
Definition: app_rng.h:78
APP_RNG_TYPE_INTERRUPT
@ APP_RNG_TYPE_INTERRUPT
Definition: app_rng.h:76
app_rng_gen_sync
uint16_t app_rng_gen_sync(uint16_t *p_seed, uint32_t *p_random32bit)
Generate a 32-bit random number.
app_rng_params_t
RNG parameters structure definition.
Definition: app_rng.h:98
app_rng_evt_t::random_data
uint32_t random_data
Definition: app_rng.h:109
app_rng_deinit
uint16_t app_rng_deinit(void)
De-initialize the APP RNG DRIVER peripheral.
app_rng_evt_type_t
app_rng_evt_type_t
RNG event Enumerations definition.
Definition: app_rng.h:85
app_rng_params_t::init
rng_init_t init
Definition: app_rng.h:100
app_rng_evt_t
RNG event structure definition.
Definition: app_rng.h:107
app_rng_evt_handler_t
void(* app_rng_evt_handler_t)(app_rng_evt_t *p_evt)
RNG event callback definition.
Definition: app_rng.h:115
_rng_handle
RNG handle Structure definition.
Definition: gr55xx_hal_rng.h:125
APP_RNG_EVT_ERROR
@ APP_RNG_EVT_ERROR
Definition: app_rng.h:87
_rng_init
RNG init structure definition.
Definition: gr55xx_hal_rng.h:100
app_rng_get_handle
rng_handle_t * app_rng_get_handle(void)
Return the RNG handle.
gr55xx_hal.h
This file contains all the functions prototypes for the HAL module driver.
APP_RNG_TYPE_POLLING
@ APP_RNG_TYPE_POLLING
Definition: app_rng.h:77
app_rng_params_t::use_type
app_rng_type_t use_type
Definition: app_rng.h:99
app_rtos_cfg.h
Header file of app rtos config code.
app_drv_error.h
Header file of app driver error code.
app_rng_init
uint16_t app_rng_init(app_rng_params_t *p_params, app_rng_evt_handler_t evt_handler)
Initialize the APP RNG DRIVER according to the specified parameters in the app_rng_params_t and app_r...