VSF Documented
Macros | Functions
eth_common.c File Reference
#include "hal/driver/driver.h"

Macros

#define VSF_ETH_CFG_FUNCTION_RENAME   DISABLED
 

Functions

vsf_err_t vsf_eth_init (vsf_eth_t *eth_ptr, vsf_eth_cfg_t *cfg_ptr)
 Initialize a ETH instance.
 
void vsf_eth_fini (vsf_eth_t *eth_ptr)
 Finalize a ETH instance.
 
fsm_rt_t vsf_eth_enable (vsf_eth_t *eth_ptr)
 Enable a ETH instance.
 
fsm_rt_t vsf_eth_disable (vsf_eth_t *eth_ptr)
 Disable a ETH instance.
 
void vsf_eth_irq_enable (vsf_eth_t *eth_ptr, vsf_eth_irq_mask_t irq_mask)
 
void vsf_eth_irq_disable (vsf_eth_t *eth_ptr, vsf_eth_irq_mask_t irq_mask)
 
vsf_err_t vsf_eth_send_request (vsf_eth_t *eth_ptr, vsf_eth_send_buf_desc_t *buf_ptr)
 Send a buffer over ETH instance.
 
vsf_err_t vsf_eth_recv_request (vsf_eth_t *eth_ptr, vsf_eth_recv_buf_desc_t *buf_ptr)
 Receive a buffer from ETH instance.
 
vsf_err_t vsf_eth_send_sg_request (vsf_eth_t *eth_ptr, vsf_eth_send_sg_buf_desc_t *buf_ptr, uint32_t sg_count)
 Send a scatter-gather buffer over ETH instance.
 
vsf_err_t vsf_eth_recv_sg_request (vsf_eth_t *eth_ptr, vsf_eth_recv_sg_buf_desc_t *buf_ptr, uint32_t sg_count)
 Receive data using scatter-gather buffers from ETH instance.
 
vsf_err_t vsf_eth_ctrl (vsf_eth_t *eth_ptr, vsf_eth_ctrl_t ctrl, void *param)
 Control ETH instance.
 
vsf_eth_status_t vsf_eth_status (vsf_eth_t *eth_ptr)
 Get the status of ETH instance.
 
vsf_eth_capability_t vsf_eth_capability (vsf_eth_t *eth_ptr)
 Get the capability of ETH instance.
 

Macro Definition Documentation

◆ VSF_ETH_CFG_FUNCTION_RENAME

#define VSF_ETH_CFG_FUNCTION_RENAME   DISABLED

Function Documentation

◆ vsf_eth_init()

vsf_err_t vsf_eth_init ( vsf_eth_t eth_ptr,
vsf_eth_cfg_t cfg_ptr 
)

Initialize a ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
[in]cfg_ptra pointer to structure vsf_eth_cfg_t
Returns
vsf_err_t: VSF_ERR_NONE if ETH was initialized, or a negative error code
Note
It is not necessary to call vsf_eth_fini() for deinitialization. vsf_eth_init() should be called before any other ETH API except vsf_eth_capability().

◆ vsf_eth_fini()

void vsf_eth_fini ( vsf_eth_t eth_ptr)

Finalize a ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
Returns
none

◆ vsf_eth_enable()

fsm_rt_t vsf_eth_enable ( vsf_eth_t eth_ptr)

Enable a ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
Returns
fsm_rt_t: FSM_RT_CPL if ETH was enabled, fsm_rt_on_going if ETH is still enabling

◆ vsf_eth_disable()

fsm_rt_t vsf_eth_disable ( vsf_eth_t eth_ptr)

Disable a ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
Returns
fsm_rt_t: FSM_RT_CPL if ETH was disabled, fsm_rt_on_going if ETH is still disabling

◆ vsf_eth_irq_enable()

void vsf_eth_irq_enable ( vsf_eth_t eth_ptr,
vsf_eth_irq_mask_t  irq_mask 
)

◆ vsf_eth_irq_disable()

void vsf_eth_irq_disable ( vsf_eth_t eth_ptr,
vsf_eth_irq_mask_t  irq_mask 
)

◆ vsf_eth_send_request()

vsf_err_t vsf_eth_send_request ( vsf_eth_t eth_ptr,
vsf_eth_send_buf_desc_t buf_ptr 
)

Send a buffer over ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
[in]buf_ptrpointer to the buffer to be sent, refer to vsf_eth_send_buf_desc_t
Returns
vsf_err_t: VSF_ERR_NONE if buffer was sent successfully, or a negative error code
Note
If the capability is_send_buf_releasable_immediately is false, the buffer should remain valid until the transmission complete interrupt is received

◆ vsf_eth_recv_request()

vsf_err_t vsf_eth_recv_request ( vsf_eth_t eth_ptr,
vsf_eth_recv_buf_desc_t buf_ptr 
)

Receive a buffer from ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
[out]buf_ptrpointer to the buffer to store received data, refer to vsf_eth_recv_buf_desc_t
Returns
vsf_err_t: VSF_ERR_NONE if buffer was received successfully, or a negative error code
Note
The buffer must be pre-allocated with sufficient size to hold received data

◆ vsf_eth_send_sg_request()

vsf_err_t vsf_eth_send_sg_request ( vsf_eth_t eth_ptr,
vsf_eth_send_sg_buf_desc_t sg_ptr,
uint32_t  sg_count 
)

Send a scatter-gather buffer over ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
[in]sg_ptrpointer to the scatter-gather buffer array to be sent
[in]sg_countnumber of scatter-gather buffer elements in the array
Returns
vsf_err_t: VSF_ERR_NONE if buffer was sent successfully, or a negative error code
Note
The buffers should remain valid until the transmission complete interrupt is received

◆ vsf_eth_recv_sg_request()

vsf_err_t vsf_eth_recv_sg_request ( vsf_eth_t eth_ptr,
vsf_eth_recv_sg_buf_desc_t sg_ptr,
uint32_t  sg_count 
)

Receive data using scatter-gather buffers from ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
[out]sg_ptrpointer to the scatter-gather buffer array to store received data
[in]sg_countnumber of scatter-gather buffer elements in the array
Returns
vsf_err_t: VSF_ERR_NONE if data was received successfully, or a negative error code
Note
The buffers must be pre-allocated with sufficient size to hold received data

◆ vsf_eth_ctrl()

vsf_err_t vsf_eth_ctrl ( vsf_eth_t eth_ptr,
vsf_eth_ctrl_t  ctrl,
void *  param 
)

Control ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
[in]ctrl_ptrpointer to the control command, refer to vsf_eth_ctrl_t
[in]paramcontrol command parameter, the specific type depends on the control command For example, VSF_ETH_CTRL_SET_MAC_ADDRESS requires a uint8_t* type parameter
Returns
vsf_err_t: VSF_ERR_NONE if control command was executed successfully, or a negative error code

◆ vsf_eth_status()

vsf_eth_status_t vsf_eth_status ( vsf_eth_t eth_ptr)

Get the status of ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
Returns
vsf_eth_status_t: return all status of current ETH

◆ vsf_eth_capability()

vsf_eth_capability_t vsf_eth_capability ( vsf_eth_t eth_ptr)

Get the capability of ETH instance.

Parameters
[in]eth_ptra pointer to structure vsf_eth_t
Returns
vsf_eth_capability_t: all capability of current ETH vsf_eth_capability_t
Generated from commit: vsfteam/vsf@e0b5993