VSF Documented
|
Go to the source code of this file.
Data Structures | |
struct | vsf_eth_isr_t |
ETH interrupt configuration structure. More... | |
struct | vsf_eth_cfg_t |
ETH configuration structure. More... | |
struct | vsf_eth_status_t |
ETH status information structure Contains the current status of ETH operations and FIFO thresholds. More... | |
struct | vsf_eth_capability_t |
Predefined VSF ETH capability that can be reimplemented in specific hal drivers. The vsf_eth_capability_t structure defines the features supported by the ETH hardware. When reimplementing this structure, all existing members must be preserved. More... | |
struct | vsf_eth_buf_desc_t |
struct | vsf_eth_op_t |
ETH operation function pointer type, used for ETH Multi Class support. More... | |
struct | vsf_eth_t |
ETH instance structure, used for ETH Multi Class support, not needed in non Multi Class mode. More... | |
Macros | |
#define | VSF_ETH_CFG_MULTI_CLASS ENABLED |
Enable multi-class support by default for maximum availability. | |
#define | VSF_ETH_CFG_MULTI_PHY_CLASS ENABLED |
#define | VSF_ETH_CFG_PREFIX vsf |
We can redefine ethro VSF_ETH_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code. Example: | |
#define | VSF_ETH_CFG_FUNCTION_RENAME ENABLED |
After define VSF_ETH_CFG_FUNCTION_RENAME to DISABLED, calling any vsf_eth_xxx() function will not be renamed. It has higher priority than VSF_ETH_CFG_PREFIX. | |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_PHY_MODE DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_PHY_MODE to redefine enum vsf_eth_mode_t. | |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_MODE DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_MODE to redefine enum vsf_eth_mode_t. | |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_CFG DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_CFG to redefine struct vsf_eth_cfg_t. For compatibility, members should not be deleted when redefining it. | |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_STATUS DISABLED |
In the specific hardware driver, we can enable VSF_ETH_CFG_REIMPLEMENT_TYPE_STATUS to redefine struct vsf_eth_status_t. | |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_CAPABILITY to redefine struct vsf_eth_capability_t. For compatibility, members should not be deleted when redefining it. | |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_BUF_MODE DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_BUF_MODE to redefine struct vsf_eth_buf_mode_t. | |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_BUF_DESC DISABLED |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_SEND_BUF_DESC DISABLED |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_RECV_BUF_DESC DISABLED |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_SG_BUF_DESC DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_SG_BUF_DESC to redefine struct vsf_eth_buf_desc_t. | |
#define | VSF_ETH_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_IRQ_MASK to redefine struct vsf_eth_irq_mask_t. | |
#define | VSF_ETH_CFG_INHERIT_HAL_CAPABILITY ENABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_INHERIT_HAL_CAPABILITY to inherit the structure vsf_peripheral_capability_t. | |
#define | VSF_ETH_APIS(__prefix) |
ETH API template, used to generate ETH type, specific prefix function declarations, etc. | |
Typedefs | |
typedef enum vsf_eth_phy_mode_t | vsf_eth_phy_mode_t |
Predefined VSF ETH modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver: | |
typedef enum vsf_eth_mode_t | vsf_eth_mode_t |
Predefined VSF ETH modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver: | |
typedef enum vsf_eth_irq_mask_t | vsf_eth_irq_mask_t |
typedef struct vsf_eth_t | vsf_eth_t |
ETH forward declaration. | |
typedef void | vsf_eth_isr_handler_t(void *target_ptr, vsf_eth_t *eth_ptr, vsf_eth_irq_mask_t irq_mask) |
ETH interrupt handler type declaration. | |
typedef struct vsf_eth_isr_t | vsf_eth_isr_t |
ETH interrupt configuration structure. | |
typedef struct vsf_eth_cfg_t | vsf_eth_cfg_t |
ETH configuration structure. | |
typedef struct vsf_eth_status_t | vsf_eth_status_t |
ETH status information structure Contains the current status of ETH operations and FIFO thresholds. | |
typedef struct vsf_eth_capability_t | vsf_eth_capability_t |
Predefined VSF ETH capability that can be reimplemented in specific hal drivers. The vsf_eth_capability_t structure defines the features supported by the ETH hardware. When reimplementing this structure, all existing members must be preserved. | |
typedef enum vsf_eth_buf_mode_t | vsf_eth_buf_mode_t |
typedef struct vsf_eth_buf_desc_t | vsf_eth_buf_desc_t |
typedef vsf_eth_buf_desc_t | vsf_eth_send_buf_desc_t |
typedef vsf_eth_buf_desc_t | vsf_eth_recv_buf_desc_t |
typedef vsf_eth_buf_desc_t | vsf_eth_send_sg_buf_desc_t |
typedef vsf_eth_buf_desc_t | vsf_eth_recv_sg_buf_desc_t |
typedef enum vsf_eth_ctrl_t | vsf_eth_ctrl_t |
typedef struct vsf_eth_op_t | vsf_eth_op_t |
ETH operation function pointer type, used for ETH Multi Class support. | |
Enumerations | |
enum | vsf_eth_phy_mode_t { VSF_ETH_PHY_MODE_SPEED_10M = 1 << 0 , VSF_ETH_PHY_MODE_SPEED_100M = 1 << 1 , VSF_ETH_PHY_MODE_SPEED_1000M = 1 << 2 , VSF_ETH_PHY_MODE_DUPLEX_HALF = 1 << 3 , VSF_ETH_PHY_MODE_DUPLEX_FULL = 1 << 4 , VSF_ETH_PHY_MODE_LINK_UP = 1 << 5 } |
Predefined VSF ETH modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver: More... | |
enum | { VSF_ETH_PHY_MODE_SPEED_MASK = VSF_ETH_PHY_MODE_SPEED_10M | VSF_ETH_PHY_MODE_SPEED_100M | VSF_ETH_PHY_MODE_SPEED_1000M , VSF_ETH_PHY_MODE_DUPLEX_MASK = VSF_ETH_PHY_MODE_DUPLEX_HALF | VSF_ETH_PHY_MODE_DUPLEX_FULL , VSF_ETH_PHY_MODE_ALL_BITS_MASK = VSF_ETH_PHY_MODE_SPEED_MASK | VSF_ETH_PHY_MODE_DUPLEX_MASK } |
ETH PHY mode completion, used to simplify the definition of ETH mode. More... | |
enum | vsf_eth_mode_t { VSF_ETH_MODE_TX_CHECKSUM_OFFLOAD = 1 << 5 , VSF_ETH_MODE_RX_CHECKSUM_OFFLOAD = 1 << 6 } |
Predefined VSF ETH modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver: More... | |
enum | { VSF_ETH_MODE_OFFLOAD_MASK = VSF_ETH_MODE_RX_CHECKSUM_OFFLOAD | VSF_ETH_MODE_TX_CHECKSUM_OFFLOAD , VSF_ETH_MODE_ALL_BITS_MASK = VSF_ETH_MODE_OFFLOAD_MASK } |
ETH mode completion, used to simplify the definition of ETH mode. More... | |
enum | vsf_eth_irq_mask_t { VSF_ETH_IRQ_MASK_RX_AVAILABLE = (1 << 0) , VSF_ETH_IRQ_MASK_TX_COMPLETE = (1 << 1) , VSF_ETH_IRQ_MASK_SG_RX_AVAILABLE = (1 << 2) , VSF_ETH_IRQ_MASK_SG_TX_COMPLETE = (1 << 3) , VSF_ETH_IRQ_MASK_PHY_LINK_CHANGE = (1 << 4) , VSF_ETH_IRQ_MASK_ERROR = (1 << 5) } |
enum | { VSF_ETH_IRQ_MASK_ALL } |
enum | vsf_eth_buf_mode_t { VSF_ETH_BUF_MODE_TX_CHECKSUM_OFFLOAD = 1 << 0 , VSF_ETH_BUF_MODE_RX_CHECKSUM_OFFLOAD = 1 << 1 } |
enum | vsf_eth_ctrl_t { VSF_ETH_CTRL_GET_MAC_ADDRESS } |
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_isr_enable (vsf_eth_t *eth_ptr, vsf_eth_irq_mask_t isr_mask) |
Enable ETH instance interrupt. | |
void | vsf_eth_isr_disable (vsf_eth_t *eth_ptr, vsf_eth_irq_mask_t isr_mask) |
Disable ETH instance interrupt. | |
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. | |
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_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. | |
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_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. | |
vsf_err_t | vsf_eth_ctrl (vsf_eth_t *eth_ptr, vsf_eth_ctrl_t ctrl, void *param) |
Control ETH instance. | |
vsf_err_t | vsf_eth_phy_read_reg (vsf_eth_t *eth_ptr, uint16_t reg_addr, uint32_t *value_ptr) |
Read a PHY register. | |
vsf_err_t | vsf_eth_phy_write_reg (vsf_eth_t *eth_ptr, uint16_t reg_addr, uint32_t value) |
Write a value to a PHY register. | |
vsf_err_t | vsf_eth_phy_set_mode (vsf_eth_t *eth_ptr, vsf_eth_phy_mode_t mode) |
Configure the PHY operating mode. | |
vsf_err_t | vsf_eth_phy_get_link_status (vsf_eth_t *eth_ptr, vsf_eth_phy_mode_t *phy_mode_ptr) |
Get the current link status of the PHY. | |
#define VSF_ETH_CFG_MULTI_CLASS ENABLED |
Enable multi-class support by default for maximum availability.
#define VSF_ETH_CFG_MULTI_PHY_CLASS ENABLED |
#define VSF_ETH_CFG_PREFIX vsf |
We can redefine ethro VSF_ETH_CFG_PREFIX to specify a prefix to call a specific driver directly in the application code. Example:
#define VSF_ETH_CFG_FUNCTION_RENAME ENABLED |
After define VSF_ETH_CFG_FUNCTION_RENAME to DISABLED, calling any vsf_eth_xxx() function will not be renamed. It has higher priority than VSF_ETH_CFG_PREFIX.
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_PHY_MODE DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_PHY_MODE to redefine enum vsf_eth_mode_t.
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_MODE DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_MODE to redefine enum vsf_eth_mode_t.
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_CFG DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_CFG to redefine struct vsf_eth_cfg_t. For compatibility, members should not be deleted when redefining it.
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_STATUS DISABLED |
In the specific hardware driver, we can enable VSF_ETH_CFG_REIMPLEMENT_TYPE_STATUS to redefine struct vsf_eth_status_t.
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_CAPABILITY DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_CAPABILITY to redefine struct vsf_eth_capability_t. For compatibility, members should not be deleted when redefining it.
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_BUF_MODE DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_BUF_MODE to redefine struct vsf_eth_buf_mode_t.
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_BUF_DESC DISABLED |
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_SEND_BUF_DESC DISABLED |
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_RECV_BUF_DESC DISABLED |
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_SG_BUF_DESC DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_SG_BUF_DESC to redefine struct vsf_eth_buf_desc_t.
#define VSF_ETH_CFG_REIMPLEMENT_TYPE_IRQ_MASK DISABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_REIMPLEMENT_TYPE_IRQ_MASK to redefine struct vsf_eth_irq_mask_t.
#define VSF_ETH_CFG_INHERIT_HAL_CAPABILITY ENABLED |
In specific hardware driver, we can enable ethro VSF_ETH_CFG_INHERIT_HAL_CAPABILITY to inherit the structure vsf_peripheral_capability_t.
#define VSF_ETH_APIS | ( | __prefix | ) |
ETH API template, used to generate ETH type, specific prefix function declarations, etc.
[in] | __prefix | The prefix used for generating ETH functions. |
typedef enum vsf_eth_phy_mode_t vsf_eth_phy_mode_t |
Predefined VSF ETH modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver:
In specific drivers, we can implement optional modes. Optional modes require the driver to provide one or more enumeration options, and provide ethros with the same name (users can determine whether to support the mode at compile time). If these options are N to 1, the corresponding MASK option is also required (users can select different modes at runtime).
typedef enum vsf_eth_mode_t vsf_eth_mode_t |
Predefined VSF ETH modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver:
typedef enum vsf_eth_irq_mask_t vsf_eth_irq_mask_t |
typedef void vsf_eth_isr_handler_t(void *target_ptr, vsf_eth_t *eth_ptr, vsf_eth_irq_mask_t irq_mask) |
ETH interrupt handler type declaration.
[in,out] | target_ptr | user defined target pointer |
[in,out] | eth_ptr | vsf_eth_t watchdog timer structure pointer |
typedef struct vsf_eth_isr_t vsf_eth_isr_t |
ETH interrupt configuration structure.
typedef struct vsf_eth_cfg_t vsf_eth_cfg_t |
ETH configuration structure.
typedef struct vsf_eth_status_t vsf_eth_status_t |
ETH status information structure Contains the current status of ETH operations and FIFO thresholds.
typedef struct vsf_eth_capability_t vsf_eth_capability_t |
Predefined VSF ETH capability that can be reimplemented in specific hal drivers. The vsf_eth_capability_t structure defines the features supported by the ETH hardware. When reimplementing this structure, all existing members must be preserved.
typedef enum vsf_eth_buf_mode_t vsf_eth_buf_mode_t |
typedef struct vsf_eth_buf_desc_t vsf_eth_buf_desc_t |
Send buffer type, refer to vsf_eth_send_buf_desc_t
Receive buffer type, refer to vsf_eth_recv_buf_desc_t
Scatter-gather send buffer type, refer to vsf_eth_send_sg_buf_desc_t
Scatter-gather receive buffer type, refer to vsf_eth_recv_sg_buf_desc_t
typedef enum vsf_eth_ctrl_t vsf_eth_ctrl_t |
typedef struct vsf_eth_op_t vsf_eth_op_t |
ETH operation function pointer type, used for ETH Multi Class support.
enum vsf_eth_phy_mode_t |
Predefined VSF ETH modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver:
In specific drivers, we can implement optional modes. Optional modes require the driver to provide one or more enumeration options, and provide ethros with the same name (users can determine whether to support the mode at compile time). If these options are N to 1, the corresponding MASK option is also required (users can select different modes at runtime).
anonymous enum |
enum vsf_eth_mode_t |
Predefined VSF ETH modes that can be reimplemented in specific HAL drivers.The following modes must be retained even if not supported by hardware. If hardware supports more modes, we can implement them in the hardware driver:
Enumerator | |
---|---|
VSF_ETH_MODE_TX_CHECKSUM_OFFLOAD | TX checksum offload mode. |
VSF_ETH_MODE_RX_CHECKSUM_OFFLOAD | RX checksum offload mode. |
anonymous enum |
enum vsf_eth_irq_mask_t |
enum vsf_eth_buf_mode_t |
enum vsf_eth_ctrl_t |
|
extern |
Initialize a ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | cfg_ptr | a pointer to structure vsf_eth_cfg_t |
|
extern |
Enable a ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
Disable a ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
|
extern |
Enable ETH instance interrupt.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | isr_mask | interrupt mask, refer to vsf_eth_irq_mask_t |
|
extern |
Disable ETH instance interrupt.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | isr_mask | interrupt mask, refer to vsf_eth_irq_mask_t |
|
extern |
Get the status of ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
|
extern |
Get the capability of ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
|
extern |
Send a buffer over ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | buf_ptr | pointer to the buffer to be sent, refer to vsf_eth_send_buf_desc_t |
|
extern |
Send a scatter-gather buffer over ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | sg_ptr | pointer to the scatter-gather buffer array to be sent |
[in] | sg_count | number of scatter-gather buffer elements in the array |
|
extern |
Receive a buffer from ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[out] | buf_ptr | pointer to the buffer to store received data, refer to vsf_eth_recv_buf_desc_t |
|
extern |
Receive data using scatter-gather buffers from ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[out] | sg_ptr | pointer to the scatter-gather buffer array to store received data |
[in] | sg_count | number of scatter-gather buffer elements in the array |
|
extern |
Control ETH instance.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | ctrl_ptr | pointer to the control command, refer to vsf_eth_ctrl_t |
[in] | param | control command parameter, the specific type depends on the control command For example, VSF_ETH_CTRL_SET_MAC_ADDRESS requires a uint8_t* type parameter |
|
extern |
Read a PHY register.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | reg_addr | the address of the PHY register to read |
[out] | value_ptr | pointer to store the read value |
Write a value to a PHY register.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | reg_addr | the address of the PHY register to write |
[in] | value | the value to write to the PHY register |
|
extern |
Configure the PHY operating mode.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[in] | mode | the desired PHY configuration including speed and duplex mode, refer to vsf_eth_phy_mode_t |
|
extern |
Get the current link status of the PHY.
[in] | eth_ptr | a pointer to structure vsf_eth_t |
[out] | phy_mode_ptr | pointer to store the current PHY mode and link status, refer to vsf_eth_phy_mode_t |