Driver for the Microchip LAN7800 Ethernet device.
More...
|
usb_status_t | lan7800_wait_device_attached (ushort minor) |
|
devcall | etherInit (device *devptr) |
|
usb_status_t | lan7800_write_reg (struct usb_device *udev, uint32_t index, uint32_t data) |
|
usb_status_t | lan7800_read_reg (struct usb_device *udev, uint32_t index, uint32_t *data) |
|
usb_status_t | lan7800_modify_reg (struct usb_device *udev, uint32_t index, uint32_t mask, uint32_t set) |
|
usb_status_t | lan7800_set_reg_bits (struct usb_device *udev, uint32_t index, uint32_t set) |
|
usb_status_t | lan7800_set_mac_address (struct usb_device *udev, const uint8_t *macaddr) |
|
usb_status_t | lan7800_get_mac_address (struct usb_device *udev, uint8_t *macaddr) |
|
usb_status_t | lan7800_mdio_wait_for_bit (struct usb_device *udev, const uint32_t reg, const uint32_t mask, const bool set) |
|
usb_status_t | lan7800_phy_wait_not_busy (struct usb_device *udev) |
|
usb_status_t | lan7800_read_raw_eeprom (struct usb_device *udev, uint32_t offset, uint32_t length, uint8_t *data) |
|
usb_status_t | lan7800_set_rx_max_frame_length (struct usb_device *udev, int size) |
|
usb_status_t | lan7800_set_features (struct usb_device *udev, uint32_t set) |
|
usb_status_t | lan7800_init (struct usb_device *udev, uint8_t *macaddress) |
|
Driver for the Microchip LAN7800 Ethernet device.
This module presents a driver implementation for the Raspberry Pi 3 B+ Ethernet device.
- Authors
- Rade Latinovich Patrick J. McGee
Initialization for the LAN7800 USB Ethernet Adapter
devcall etherInit |
( |
device * |
devptr | ) |
|
Implementation of etherInit() for lan7800; documentation in ether.h
- Parameters
-
devptr | Pointer to ethernet device. |
- Returns
- ::OK on successful initialization, ::SYSERR otherwise.
LAN7800-specific notes: This function returns ::OK if the Ethernet Driver was successfully registered with the USB core, otherwise ::SYSERR. This is a work-around to use USB's dynamic device model at the same time as Xinu's static device model, and there is no guarantee that the device actually exists when the function returns.
usb_status_t lan7800_get_mac_address |
( |
struct usb_device * |
udev, |
|
|
uint8_t * |
macaddr |
|
) |
| |
Reads the MAC address of the MICROCHIP LAN7800 USB Ethernet Adapter.
- Parameters
-
udev | USB device for the adapter |
macaddr | Pointer into which to write the MAC address (6 bytes long) |
- Returns
- ::USB_STATUS_SUCCESS on success; otherwise another ::usb_status_t error code.
usb_status_t lan7800_init |
( |
struct usb_device * |
udev, |
|
|
uint8_t * |
macaddress |
|
) |
| |
Initialize various functions for the Microchip LAN7800 Ethernet device.
- Parameters
-
udev | USB device for the adapter |
macaddress | MAC address to be set on the device (obtained from the BCM2837B0 mailbox) |
- Returns
- ::USB_STATUS_SUCCESS on success.
usb_status_t lan7800_mdio_wait_for_bit |
( |
struct usb_device * |
udev, |
|
|
const uint32_t |
reg, |
|
|
const uint32_t |
mask, |
|
|
const bool |
set |
|
) |
| |
Wait for a bit value to change on the Microchip LAN7800 USB Ethernet Adapter.
- Parameters
-
udev | USB device for the adapter |
reg | Register to change |
mask | Mask value for register |
set | Value of register bit to apply |
- Returns
- ::USB_STATUS_SUCCESS after value is applied
usb_status_t lan7800_modify_reg |
( |
struct usb_device * |
udev, |
|
|
uint32_t |
index, |
|
|
uint32_t |
mask, |
|
|
uint32_t |
set |
|
) |
| |
Modify the value contained in a register on the Microchip LAN7800 USB Ethernet Adapter.
- Parameters
-
udev | USB device for the adapter |
index | Index of the register to modify |
mask | Mask that contains 1 for the bits where the old value in the register will be kept rather than cleared (unless those bits also appear in set , in which case they will still be set). |
set | Mask of bits to set in the register. |
- Returns
- ::USB_STATUS_SUCCESS on success; otherwise another ::usb_status_t error code.
usb_status_t lan7800_phy_wait_not_busy |
( |
struct usb_device * |
udev | ) |
|
Waits for PHY to be free.
- Parameters
-
udev | USB device for the adapter |
- Returns
- ::USB_STATUS_SUCCESS on success.
usb_status_t lan7800_read_raw_eeprom |
( |
struct usb_device * |
udev, |
|
|
uint32_t |
offset, |
|
|
uint32_t |
length, |
|
|
uint8_t * |
data |
|
) |
| |
Read raw EEPROM from the Microchip LAN7800 Ethernet device.
- Parameters
-
udev | USB device for the adapter |
- Returns
- ::USB_STATUS_SUCCESS on success.
usb_status_t lan7800_read_reg |
( |
struct usb_device * |
udev, |
|
|
uint32_t |
index, |
|
|
uint32_t * |
data |
|
) |
| |
Read from a register on the Microchip LAN7800 USB Ethernet Adapter.
- Parameters
-
udev | USB device for the adapter |
index | Index of the register to read |
data | Pointer into which to write the register's value |
- Returns
- ::USB_STATUS_SUCCESS on success; otherwise another ::usb_status_t error code.
usb_status_t lan7800_set_features |
( |
struct usb_device * |
udev, |
|
|
uint32_t |
set |
|
) |
| |
Enable or disable Rx checksum offload engine for the Microchip LAN7800 Ethernet device.
- Parameters
-
udev | USB device for the adapter |
set | Bit (whether to enable or disable) |
- Returns
- ::USB_STATUS_SUCCESS on success.
usb_status_t lan7800_set_mac_address |
( |
struct usb_device * |
udev, |
|
|
const uint8_t * |
macaddr |
|
) |
| |
Change the MAC address of the Microchip LAN7800 USB Ethernet Adapter on the actual hardware by writing to its registers.
- Parameters
-
udev | USB device for the adapter |
macaddr | New MAC address to set (6 bytes long) |
- Returns
- ::USB_STATUS_SUCCESS on success; otherwise another ::usb_status_t error code. On failure the existing MAC address may have been partially modified.
usb_status_t lan7800_set_reg_bits |
( |
struct usb_device * |
udev, |
|
|
uint32_t |
index, |
|
|
uint32_t |
set |
|
) |
| |
Set bits in a register on the Microchip LAN7800 USB Ethernet Adapter.
- Parameters
-
udev | USB Device for the adapter |
index | Index of the register to modify |
set | Bits to set in the register. At positions where the is a 0, the old value in the register will be written. |
- Returns
- ::USB_STATUS_SUCCESS on success; otherwise another ::usb_status_t error code.
usb_status_t lan7800_set_rx_max_frame_length |
( |
struct usb_device * |
udev, |
|
|
int |
size |
|
) |
| |
Set max RX frame length for the Microchip LAN7800 Ethernet device.
- Parameters
-
udev | USB device for the adapter |
size | Size of max RX frame |
- Returns
- ::USB_STATUS_SUCCESS on success.
usb_status_t lan7800_wait_device_attached |
( |
ushort |
minor | ) |
|
Wait until the specified Ethernet device has been attached. This is necessary because USB is a dynamic bus, but Xinu expects static devices.
- Parameters
-
minor | Minor number of the Ethernet device to wait for. |
- Returns
- Currently ::USB_STATUS_SUCCESS.
usb_status_t lan7800_write_reg |
( |
struct usb_device * |
udev, |
|
|
uint32_t |
index, |
|
|
uint32_t |
data |
|
) |
| |
Write to a register on the Microchip LAN7800 USB Ethernet Adapter.
- Parameters
-
udev | USB device for the adapter |
index | Index of the register to write |
data | Value to write to the register |
- Returns
- ::USB_STATUS_SUCCESS on success; otherwise another ::usb_status_t error code.