VSF Documented
Data Structures | Macros | Typedefs | Enumerations | 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_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_CFG_REIMPLEMENT_TYPE_CTRL   DISABLED
 
#define VSF_RNG_APIS(__prefix_name)
 RNG API template, used to generate RNG type, specific prefix function declarations, etc.
 

Typedefs

typedef enum vsf_rng_ctrl_t vsf_rng_ctrl_t
 Predefined VSF RNG control commands that can be reimplemented in specific HAL drivers.
 
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
 

Enumerations

enum  vsf_rng_ctrl_t { __VSF_RNG_CTRL_DUMMY = 0 }
 Predefined VSF RNG control commands that can be reimplemented in specific HAL drivers. More...
 

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.
 
vsf_err_t vsf_rng_ctrl (vsf_rng_t *rng_ptr, vsf_rng_ctrl_t ctrl, void *param)
 

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_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_CFG_REIMPLEMENT_TYPE_CTRL

#define VSF_RNG_CFG_REIMPLEMENT_TYPE_CTRL   DISABLED

◆ 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, _t) *rng_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, void, rng, fini, VSF_MCONNECT(__prefix_name, _t) *rng_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_rng_capability_t, rng, capability, VSF_MCONNECT(__prefix_name, _t) *rng_ptr) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rng, generate_request, VSF_MCONNECT(__prefix_name, _t) *rng_ptr, \
uint32_t *buffer, uint32_t num, void *param, vsf_rng_on_ready_callback_t * on_ready_cb) \
__VSF_HAL_TEMPLATE_API(__prefix_name, vsf_err_t, rng, ctrl, VSF_MCONNECT(__prefix_name, _t) *rng_ptr, vsf_rng_ctrl_t ctrl, void* param)
vsf_err_t
Definition __type.h:42
struct VSF_MCONNECT(VSF_DMA_CFG_IMP_PREFIX, _dma_channel_t)
Definition dma.c:57
__le16 capability
Definition ieee80211.h:134
unsigned uint32_t
Definition stdint.h:9
Definition vsf_template_rng.h:180
#define __VSF_HAL_TEMPLATE_API
Definition vsf_template_instance_declaration.h:120
void vsf_rng_on_ready_callback_t(void *param, uint32_t *buffer, uint32_t num)
Definition vsf_template_rng.h:177
vsf_rng_ctrl_t
Predefined VSF RNG control commands that can be reimplemented in specific HAL drivers.
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_ctrl_t

Predefined VSF RNG control commands that can be reimplemented in specific HAL drivers.

Note
Used as the 'ctrl' parameter (second parameter) in vsf_rng_ctrl(vsf_rng_t *rng_ptr, vsf_rng_ctrl_t ctrl, void *param) function
The 'param' parameter (third parameter) type depends on the specific control command

◆ 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

Enumeration Type Documentation

◆ vsf_rng_ctrl_t

Predefined VSF RNG control commands that can be reimplemented in specific HAL drivers.

Note
Used as the 'ctrl' parameter (second parameter) in vsf_rng_ctrl(vsf_rng_t *rng_ptr, vsf_rng_ctrl_t ctrl, void *param) function
The 'param' parameter (third parameter) type depends on the specific control command
Enumerator
__VSF_RNG_CTRL_DUMMY 

Dummy value for compilation, required when no actual control commands are defined.

Note
This value is needed only when using the template default enum definition (VSF_RNG_CFG_REIMPLEMENT_TYPE_CTRL == DISABLED) and all optional control commands are commented out. It ensures the enum has at least one member to avoid compilation errors with some C compilers that don't allow empty enums.
If you enable any control commands below (uncomment them), or if you redefine the enum in a specific hardware driver (VSF_RNG_CFG_REIMPLEMENT_TYPE_CTRL == ENABLED), you can remove this DUMMY value as long as at least one actual command is defined.

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

◆ vsf_rng_ctrl()

vsf_err_t vsf_rng_ctrl ( vsf_rng_t rng_ptr,
vsf_rng_ctrl_t  ctrl,
void *  param 
)
extern
Generated from commit: vsfteam/vsf@9f48a28