hal_rng.h File Reference

Header file containing functions prototypes of RNG HAL library. More...

#include "ll_rng.h"
#include "hal_def.h"
#include "hal_pwr_mgmt.h"

Go to the source code of this file.

Classes

struct  _rng_init
 RNG init structure definition. More...
 
struct  _rng_handle
 RNG handle Structure definition. More...
 
struct  _hal_rng_callback
 HAL_RNG Callback function definition. More...
 

Macros

#define RNG_SEED_FR0_S0   LL_RNG_SEED_FR0_S0
 
#define RNG_SEED_USER   LL_RNG_SEED_USER
 
#define RNG_LFSR_MODE_59BIT   LL_RNG_LFSR_MODE_59BIT
 
#define RNG_LFSR_MODE_128BIT   LL_RNG_LFSR_MODE_128BIT
 
#define RNG_POST_PRO_NOT   LL_RNG_POST_PRO_NOT
 
#define RNG_POST_PRO_SKIPPING   LL_RNG_POST_PRO_SKIPPING
 
#define RNG_POST_PRO_COUNTING   LL_RNG_POST_PRO_COUNTING
 
#define RNG_POST_PRO_NEUMANN   LL_RNG_POST_PRO_NEUMANN
 
#define RNG_OUTPUT_FR0_S0   LL_RNG_OUTPUT_FR0_S0
 
#define RNG_OUTPUT_CYCLIC_PARITY   LL_RNG_OUTPUT_CYCLIC_PARITY
 
#define RNG_OUTPUT_CYCLIC   LL_RNG_OUTPUT_CYCLIC
 
#define RNG_OUTPUT_LFSR_RNG   LL_RNG_OUTPUT_LFSR_RNG
 
#define RNG_OUTPUT_LFSR   LL_RNG_OUTPUT_LFSR
 

Typedefs

typedef struct _rng_init rng_init_t
 RNG init structure definition. More...
 
typedef struct _rng_handle rng_handle_t
 RNG handle Structure definition. More...
 
typedef struct _hal_rng_callback hal_rng_callback_t
 HAL_RNG Callback function definition. More...
 

Enumerations

enum  hal_rng_state_t {
  HAL_RNG_STATE_RESET = 0x00,
  HAL_RNG_STATE_READY = 0x01,
  HAL_RNG_STATE_BUSY = 0x02,
  HAL_RNG_STATE_TIMEOUT = 0x03,
  HAL_RNG_STATE_ERROR = 0x04
}
 HAL RNG State Enumerations definition. More...
 

Functions

hal_status_t hal_rng_init (rng_handle_t *p_rng)
 Initialize the RNG according to the specified parameters in the rng_init_t of associated handle. More...
 
hal_status_t hal_rng_deinit (rng_handle_t *p_rng)
 De-initialize the RNG peripheral. More...
 
void hal_rng_msp_init (rng_handle_t *p_rng)
 Initialize the RNG MSP. More...
 
void hal_rng_msp_deinit (rng_handle_t *p_rng)
 De-initialize the RNG MSP. More...
 
hal_status_t hal_rng_generate_random_number (rng_handle_t *p_rng, const uint16_t *p_seed, uint32_t *p_random32bit)
 Generate a 32-bit random number. More...
 
hal_status_t hal_rng_generate_random_number_it (rng_handle_t *p_rng, const uint16_t *p_seed)
 Generate a 32-bit random number in interrupt mode. More...
 
uint32_t hal_rng_read_last_random_number (const rng_handle_t *p_rng)
 Read the latest generated random number. More...
 
void hal_rng_irq_handler (rng_handle_t *p_rng)
 Handle RNG interrupt request. More...
 
void hal_rng_ready_data_callback (rng_handle_t *p_rng, uint32_t random32bit)
 Data Ready callback in non-blocking mode. More...
 
hal_rng_state_t hal_rng_get_state (const rng_handle_t *p_rng)
 Return the RNG handle state. More...
 
void hal_rng_suspend_reg (rng_handle_t *p_rng)
 Suspend some registers related to RNG configuration before sleep. More...
 
void hal_rng_resume_reg (const rng_handle_t *p_rng)
 Restore some registers related to RNG configuration after sleep. This function must be used in conjunction with the hal_rng_resume_reg(). More...
 
hal_status_t hal_is_rng_force_clk_enable (void)
 check the force off rng clk has been set or not More...
 
hal_status_t hal_is_rng_wfi_clk_enable (void)
 check the rng wif clk has been set or not More...
 
hal_status_t hal_rng_clk_recover (uint8_t rng_force_clk_flag, uint8_t rng_wfi_clk_flag)
 recover rng clk More...
 
hal_pm_status_t hal_pm_rng_suspend (rng_handle_t *p_rng)
 Suspend the specified RNG. More...
 
void hal_pm_rng_resume (rng_handle_t *p_rng)
 Resume the specified RNG. More...
 

Detailed Description

Header file containing functions prototypes of RNG HAL library.

Author
BLE Driver Team
Attention
#####Copyright (c) 2019 GOODIX All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of GOODIX nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file hal_rng.h.