SemiDrive SSDK Appication Program Interface PTG3.0
Data Structures | Functions
sdrv_eth.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include "sdrv_ckgen.h"
#include "sdrv_rstgen.h"
#include "netdev.h"
#include "../source/eth/sdrv_mac_lld.h"
#include "../source/eth/phy/phy.h"

Go to the source code of this file.

Data Structures

struct  eqos_desc
 
struct  dwc_eth_config_t
 
struct  eqos_priv
 
struct  dwc_eth_dev
 

Functions

void dwc_eth_enable_dma_rx_int (struct net_driver_s *dev, dma_rx_int_cb_t callback)
 
int dwc_eth_rx (struct net_driver_s *dev, bool pool)
 
int dwc_eth_probe (struct net_driver_s *dev, dwc_eth_config_t *cfg)
 

Detailed Description

Revision History:

Macro Definition Documentation

◆ ARCH_DMA_MINALIGN

#define ARCH_DMA_MINALIGN   CONFIG_ARCH_CACHE_LINE /* Should be cache line aligned */

◆ CONFIG_ETH_RX_DESCRIPTOR_NUM

#define CONFIG_ETH_RX_DESCRIPTOR_NUM   32

◆ CONFIG_ETH_TX_DESCRIPTOR_NUM

#define CONFIG_ETH_TX_DESCRIPTOR_NUM   32

◆ EQOS_BUFFER_ALIGN

#define EQOS_BUFFER_ALIGN   ARCH_DMA_MINALIGN

◆ EQOS_DESC3_BUF1V

#define EQOS_DESC3_BUF1V   BIT(24)

◆ EQOS_DESC3_FD

#define EQOS_DESC3_FD   BIT(29)

◆ EQOS_DESC3_IOC

#define EQOS_DESC3_IOC   BIT(30)

◆ EQOS_DESC3_LD

#define EQOS_DESC3_LD   BIT(28)

◆ EQOS_DESC3_OWN

#define EQOS_DESC3_OWN   BIT(31)

◆ EQOS_DESCRIPTOR_ALIGN

#define EQOS_DESCRIPTOR_ALIGN   ARCH_DMA_MINALIGN

◆ EQOS_DESCRIPTORS_NUM

#define EQOS_DESCRIPTORS_NUM   (EQOS_DESCRIPTORS_TX + EQOS_DESCRIPTORS_RX)

◆ EQOS_DESCRIPTORS_RX

#define EQOS_DESCRIPTORS_RX   CONFIG_ETH_RX_DESCRIPTOR_NUM

◆ EQOS_DESCRIPTORS_TX

#define EQOS_DESCRIPTORS_TX   CONFIG_ETH_TX_DESCRIPTOR_NUM

◆ EQOS_MAX_PACKET_SIZE

#define EQOS_MAX_PACKET_SIZE   ALIGN(1568, ARCH_DMA_MINALIGN)

◆ EQOS_RX_BUFFER_SIZE

#define EQOS_RX_BUFFER_SIZE   (EQOS_DESCRIPTORS_RX * EQOS_MAX_PACKET_SIZE)

◆ EQOS_RX_LOCK

#define EQOS_RX_LOCK (   eqos)

◆ EQOS_RX_UNLOCK

#define EQOS_RX_UNLOCK (   eqos)

◆ EQOS_TX_BUFFER_SIZE

#define EQOS_TX_BUFFER_SIZE   (EQOS_DESCRIPTORS_TX * EQOS_MAX_PACKET_SIZE)

◆ EQOS_TX_LOCK

#define EQOS_TX_LOCK (   eqos)

◆ EQOS_TX_UNLOCK

#define EQOS_TX_UNLOCK (   eqos)

Typedef Documentation

◆ dma_rx_int_cb_t

typedef void(* dma_rx_int_cb_t) (struct net_driver_s *dev)

◆ dwc_eth_dev_t

typedef struct dwc_eth_dev dwc_eth_dev_t

Enumeration Type Documentation

◆ eth_filter_action_type

Enumerator
ETH_ADD_TO_FILTER 
ETH_REMOVE_FROM_FILTER 

◆ eth_idx_type

Enumerator
ETHERNET1_IDX 
ETHERNET2_IDX 

◆ eth_mac_layer_speed_type

Enumerator
ETH_MAC_LAYER_SPEED_100M 
ETH_MAC_LAYER_SPEED_10G 
ETH_MAC_LAYER_SPEED_10M 
ETH_MAC_LAYER_SPEED_1G 

◆ eth_mac_layer_sub_type

Enumerator
LIGHT 
REDUCED 
REVERSED 
SERIAL 
STANDARD 
UNIVERSAL_SERIAL 

◆ eth_mac_layer_type

Enumerator
ETH_MAC_LAYER_TYPE_XGMII 
ETH_MAC_LAYER_TYPE_XMII 
ETH_MAC_LAYER_TYPE_XXGMII 

◆ eth_mode_type

Enumerator
ETH_MODE_DOWN 
ETH_MODE_ACTIVE 

◆ eth_phy_intf_mode_type

Enumerator
ETH_PHY_INTF_SEL_GMII 
ETH_PHY_INTF_SEL_RGMII 
ETH_PHY_INTF_SEL_SGMII 
ETH_PHY_INTF_SEL_TBI 
ETH_PHY_INTF_SEL_RMII 
ETH_PHY_INTF_SEL_RTBI 
ETH_PHY_INTF_SEL_SMII 
ETH_PHY_INTF_SEL_REVMII 
ETH_PHY_INTF_SEL_MII 

Function Documentation

◆ dwc_eth_enable_dma_rx_int()

void dwc_eth_enable_dma_rx_int ( struct net_driver_s *  dev,
dma_rx_int_cb_t  callback 
)

Enable rx interrupt.

When receive is completed, callback will be executed.

Parameters
[in]deveth device.
[in]callbackreceive complete callback.

◆ dwc_eth_probe()

int dwc_eth_probe ( struct net_driver_s *  dev,
dwc_eth_config_t cfg 
)

Initializes net driver.

Parameters
[in]deveth device.
[in]cfgConfiguration of ethernet.
Returns
int return ERR_OK if initialization can be completed.

◆ dwc_eth_rx()

int dwc_eth_rx ( struct net_driver_s *  dev,
bool  pool 
)

try to read rx packet and send the packet to lwip stack. Should be called in thread context. If enable DMA rx interrupt, i.e. poll is false, this function should be called after DMA rx interrupt triggered. DMA rx interrupt will be disabled in ISR, and re-enabled in this function after reading out all rx packets, this is helpful to avoid too much rx interrupt.

Parameters
[in]deveth device
[in]polltrue for polling read, false for interrupt read
Returns
int total length of rx packets or -1 if rx nothing