VSF Documented
Data Structures | Macros | Typedefs | Functions
vsf_template_rng.h File Reference
#include "./vsf_template_hal_driver.h"
#include "hal/arch/vsf_arch.h"

Go to the source code of this file.

Data Structures

struct  vsf_rng_capability_t
 
struct  vsf_rng_op_t
 
struct  vsf_rng_t
 

Macros

#define VSF_RNG_CFG_MULTI_CLASS   ENABLED
 Enable multi-class support by default for maximum availability.
 
#define VSF_RNG_CFG_PREFIX   vsf
 Convert count to mask in specific hardware driver.
 
#define VSF_RNG_CFG_FUNCTION_RENAME   ENABLED
 Disable VSF_RNG_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_rng_init()).
 
#define VSF_RNG_CFG_REIMPLEMENT_TYPE_CFG   DISABLED
 Enable macro VSF_RNG_CFG_REIMPLEMENT_TYPE_CFG in specific hardware drivers to redefine struct vsf_rng_cfg_t. For compatibility, members should not be deleted when redefining. The vsf_rng_isr_handler_t type also needs to be redefined.
 
#define VSF_RNG_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED
 Enable macro VSF_RNG_CFG_REIMPLEMENT_TYPE_CAPABILITY in specific hardware drivers to redefine struct vsf_rng_capability_t. For compatibility, members should not be deleted when redefining.
 
#define VSF_RNG_CFG_INHERIT_HAL_CAPABILITY   ENABLED
 Enable macro VSF_RNG_CFG_INHERIT_HAL_CAPABILITY to inherit the structure vsf_peripheral_capability_t.
 
#define VSF_RNG_APIS(__prefix_name)
 RNG API template, used to generate RNG type, specific prefix function declarations, etc.
 

Typedefs

typedef struct vsf_rng_t vsf_rng_t
 
typedef void vsf_rng_on_ready_callback_t(void *param, uint32_t *buffer, uint32_t num)
 
typedef struct vsf_rng_capability_t vsf_rng_capability_t
 
typedef struct vsf_rng_op_t vsf_rng_op_t
 

Functions

vsf_err_t vsf_rng_init (vsf_rng_t *rng_ptr)
 Initialize a RNG instance.
 
void vsf_rng_fini (vsf_rng_t *rng_ptr)
 Finalize a RNG instance.
 
vsf_rng_capability_t vsf_rng_capability (vsf_rng_t *rng_ptr)
 Get the capability of RNG instance.
 
vsf_err_t vsf_rng_generate_request (vsf_rng_t *rng_ptr, uint32_t *buffer, uint32_t num, void *param, vsf_rng_on_ready_callback_t *on_ready_cb)
 RNG generate request.
 

Macro Definition Documentation

◆ VSF_RNG_CFG_MULTI_CLASS

#define VSF_RNG_CFG_MULTI_CLASS   ENABLED

Enable multi-class support by default for maximum availability.

◆ VSF_RNG_CFG_PREFIX

#define VSF_RNG_CFG_PREFIX   vsf

Convert count to mask in specific hardware driver.

Convert mask to count in specific hardware driver.

We can redefine macro VSF_RNG_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code.

◆ VSF_RNG_CFG_FUNCTION_RENAME

#define VSF_RNG_CFG_FUNCTION_RENAME   ENABLED

Disable VSF_RNG_CFG_FUNCTION_RENAME to use the original function names (e.g., vsf_rng_init()).

◆ VSF_RNG_CFG_REIMPLEMENT_TYPE_CFG

#define VSF_RNG_CFG_REIMPLEMENT_TYPE_CFG   DISABLED

Enable macro VSF_RNG_CFG_REIMPLEMENT_TYPE_CFG in specific hardware drivers to redefine struct vsf_rng_cfg_t. For compatibility, members should not be deleted when redefining. The vsf_rng_isr_handler_t type also needs to be redefined.

◆ VSF_RNG_CFG_REIMPLEMENT_TYPE_CAPABILITY

#define VSF_RNG_CFG_REIMPLEMENT_TYPE_CAPABILITY   DISABLED

Enable macro VSF_RNG_CFG_REIMPLEMENT_TYPE_CAPABILITY in specific hardware drivers to redefine struct vsf_rng_capability_t. For compatibility, members should not be deleted when redefining.

◆ VSF_RNG_CFG_INHERIT_HAL_CAPABILITY

#define VSF_RNG_CFG_INHERIT_HAL_CAPABILITY   ENABLED

Enable macro VSF_RNG_CFG_INHERIT_HAL_CAPABILITY to inherit the structure vsf_peripheral_capability_t.

◆ VSF_RNG_APIS

#define VSF_RNG_APIS (   __prefix_name)
Value:
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rng, init, VSF_MCONNECT(__prefix_name, _rng_t) *rng_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, rng, fini, VSF_MCONNECT(__prefix_name, _rng_t) *rng_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_rng_capability_t, rng, capability, VSF_MCONNECT(__prefix_name, _rng_t) *rng_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rng, generate_request, VSF_MCONNECT(__prefix_name, _rng_t) *rng_ptr, \
uint32_t *buffer, uint32_t num, void *param, vsf_rng_on_ready_callback_t * on_ready_cb)
vsf_err_t
Definition __type.h:42
struct VSF_MCONNECT(VSF_FLASH_CFG_IMP_PREFIX, _flash_t)
Definition flash.c:53
__le16 capability
Definition ieee80211.h:134
unsigned uint32_t
Definition stdint.h:9
Definition vsf_template_rng.h:156
#define __VSF_HAL_TEMPLATE_API
Definition vsf_template_instance_declaration.h:57
void vsf_rng_on_ready_callback_t(void *param, uint32_t *buffer, uint32_t num)
Definition vsf_template_rng.h:154

RNG API template, used to generate RNG type, specific prefix function declarations, etc.

Parameters
[in]__prefix_nameThe prefix used for generating RNG functions.

Typedef Documentation

◆ vsf_rng_t

typedef struct vsf_rng_t vsf_rng_t

◆ vsf_rng_on_ready_callback_t

typedef void vsf_rng_on_ready_callback_t(void *param, uint32_t *buffer, uint32_t num)

◆ vsf_rng_capability_t

◆ vsf_rng_op_t

typedef struct vsf_rng_op_t vsf_rng_op_t

Function Documentation

◆ vsf_rng_init()

vsf_err_t vsf_rng_init ( vsf_rng_t rng_ptr)
extern

Initialize a RNG instance.

Parameters
[in]rng_ptra pointer to structure vsf_rng_t
Returns
vsf_err_t: VSF_ERR_NONE if initialization successful, otherwise returns error code
Note
It is not necessary to call vsf_rng_fini() to deinitialize. vsf_rng_init() should be called before any other RNG API except vsf_rng_capability().

◆ vsf_rng_fini()

void vsf_rng_fini ( vsf_rng_t rng_ptr)
extern

Finalize a RNG instance.

Parameters
[in]rng_ptra pointer to structure vsf_rng_t
Returns
none

◆ vsf_rng_capability()

vsf_rng_capability_t vsf_rng_capability ( vsf_rng_t rng_ptr)
extern

Get the capability of RNG instance.

Parameters
[in]rng_ptra pointer to structure vsf_rng_t
Returns
vsf_rng_capability_t: All capabilities of current RNG vsf_rng_capability_t

◆ vsf_rng_generate_request()

vsf_err_t vsf_rng_generate_request ( vsf_rng_t rng_ptr,
uint32_t buffer,
uint32_t  num,
void *  param,
vsf_rng_on_ready_callback_t on_ready_cb 
)
extern

RNG generate request.

Parameters
[in]rng_ptra pointer to structure vsf_rng_t
[in]bufferRNG data buffer
[in]numthe length of RNG data buffer
[in]paramcallback parameter
[in]on_ready_cbcallback function
Returns
vsf_err_t: VSF_ERR_NONE if the request was successful, otherwise returns error code
Generated from commit: vsfteam/vsf@2b286be