ETH_DEV

The ethernet driver provides access to an ethernet device.

int fd;

 //open and init ethernet driver

 //sending packets: initialize TX, write data, send packet
ioctl(fd, I_ETH_INITTXPKT); //prepare transmission
write(fd, eth_buffer, eth_size); //write to buffers
ioctl(fd, I_ETH_SENDTXPKT); //send the packet

 //receiving packets
 int len;
 uint32_t addr;
 len = ioctl(fd, I_ETH_RXPKTRDY, &addr);
 if( len > 0 ){
     read(fd, eth_buffer, len);
     ioctl(fd, I_ETH_RXPKTCOMPLETE, addr);
 }

Details

define ETH_VERSION

define ETH_IOC_IDENT_CHAR

define I_ETH_GETVERSION

define I_ETH_GETINFO

This requests reads the ADC attributes.

Example:

#include <sos/dev/eth.h>
eth_attr_t attr;
int eth_fd;
...
ioctl(eth_fd, I_ETH_GETINFO, &attr);

define I_ETH_SETATTR

This requests writes the ETH attributes.

Example:

#include <sos/dev/eth.h>
eth_attr_t attr;
int eth_fd;
...
ioctl(eth_fd, I_ETH_SETATTR, &attr);

define I_ETH_SETACTION

define I_ETH_SETREGISTER

define I_ETH_GETREGISTER

define I_ETH_TOTAL

enum @11
  • ETH_FLAG_SET_INTERFACE
  • ETH_FLAG_IS_FULLDUPLEX
  • ETH_FLAG_IS_HALFDUPLEX
  • ETH_FLAG_IS_AUTONEGOTIATION_ENABLED
  • ETH_FLAG_IS_SPEED_100M
  • ETH_FLAG_IS_SPEED_1G
  • ETH_FLAG_IS_MII
  • ETH_FLAG_IS_RMII
  • ETH_FLAG_GET_STATE
  • ETH_FLAG_SET_REGISTER
  • ETH_FLAG_GET_REGISTER
  • ETH_FLAG_STOP
  • ETH_FLAG_START

struct::eth_rmii_pin_assignment_t

mcu_pin_t clk

mcu_pin_t txd0

mcu_pin_t txd1

mcu_pin_t tx_en

mcu_pin_t rxd0

mcu_pin_t rxd1

mcu_pin_t crs_dv

mcu_pin_t rx_er

mcu_pin_t unused

struct::eth_mii_pin_assignment_t

mcu_pin_t tx_clk

mcu_pin_t txd0

mcu_pin_t txd1

mcu_pin_t txd2

mcu_pin_t txd3

mcu_pin_t tx_en

mcu_pin_t tx_er

mcu_pin_t rx_clk

mcu_pin_t rxd0

mcu_pin_t rxd1

mcu_pin_t rxd2

mcu_pin_t rxd3

mcu_pin_t rx_dv

mcu_pin_t rx_er

mcu_pin_t crs

mcu_pin_t col

struct::eth_pin_assignment_t

eth_rmii_pin_assignment_t rmii

eth_mii_pin_assignment_t mii

union eth_pin_assignment_t::@12 @13

mcu_pin_t mdio

mcu_pin_t mdc

struct::eth_info_t

u32 o_flags

u32 o_events

u8 mac_address

Hardware mac address

u16 resd0

u32 resd1

struct::eth_attr_t

This structure defines the attributes structure for configuring the ethernet port.

u32 o_flags

Flag settings

eth_pin_assignment_t pin_assignment

Pin assignement (use with ETH_FLAG_SET_INTERFACE)

u8 mac_address

the MAC address (use with ETH_FLAG_SET_INTERFACE)

u16 phy_address

Address of PHY chip (use with ETH_FLAG_SET_INTERFACE)


X

Thanks for Coming!

Subscribe to news and updates