XenevaOS
Loading...
Searching...
No Matches
Macros | Functions
lan7800.cpp File Reference
#include "usb_desc.h"
#include "dwc2.h"
#include "dwc2_usbdev.h"
#include <Drivers/uart.h>
#include <string.h>
#include <Mm/pmmngr.h>
#include <Hal/AA64/aa64cpu.h>
#include <Hal/AA64/aa64lowlevel.h>
Include dependency graph for lan7800.cpp:

Macros

#define LAN7800_VENDOR_REQUEST_WRITE   0xA0
 
#define LAN7800_VENDOR_REQUEST_READ   0xA1
 
#define LAN7800_HW_CFG   0x010
 
#define LAN7800_PMT_CTL   0x014
 
#define LAN7800_E2P_CMD   0x040
 
#define LAN7800_E2P_DATA   0x044
 
#define LAN7800_OTP_BASE   0x01000
 
#define LAN7800_ADDR_FILTX   0x400
 
#define LAN7800_RX_ADDRH   0x118
 
#define LAN7800_RX_ADDRL   0x11C
 
#define E2P_CMD_BUSY   (1U << 31)
 
#define E2P_CMD_READ   (0x0 << 28)
 
#define E2P_CMD_ADDR_MASK   0x1FF
 

Functions

uint32_t lan7800_read_reg (dwc2_core_regs *regs, dwc2_usb_device *dev, uint32_t reg)
 
void lan7800_write_reg (dwc2_core_regs *regs, dwc2_usb_device *dev, uint32_t reg, uint32_t val)
 
uint8_t lan7800_eeprom_read_bytes (dwc2_core_regs *regs, dwc2_usb_device *dev, uint32_t addr)
 
void lan7800_read_mac_from_eeprom (dwc2_core_regs *regs, dwc2_usb_device *dev, uint8_t *mac)
 
void lan7800_initialize (dwc2_core_regs *regs, dwc2_usb_device *dev)
 lan7800_initialize – initialize SMSC lan7800
 

Detailed Description

BSD 2-Clause License

Copyright (c) 2022-2026, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ E2P_CMD_ADDR_MASK

#define E2P_CMD_ADDR_MASK   0x1FF

◆ E2P_CMD_BUSY

#define E2P_CMD_BUSY   (1U << 31)

◆ E2P_CMD_READ

#define E2P_CMD_READ   (0x0 << 28)

◆ LAN7800_ADDR_FILTX

#define LAN7800_ADDR_FILTX   0x400

◆ LAN7800_E2P_CMD

#define LAN7800_E2P_CMD   0x040

◆ LAN7800_E2P_DATA

#define LAN7800_E2P_DATA   0x044

◆ LAN7800_HW_CFG

#define LAN7800_HW_CFG   0x010

◆ LAN7800_OTP_BASE

#define LAN7800_OTP_BASE   0x01000

◆ LAN7800_PMT_CTL

#define LAN7800_PMT_CTL   0x014

◆ LAN7800_RX_ADDRH

#define LAN7800_RX_ADDRH   0x118

◆ LAN7800_RX_ADDRL

#define LAN7800_RX_ADDRL   0x11C

◆ LAN7800_VENDOR_REQUEST_READ

#define LAN7800_VENDOR_REQUEST_READ   0xA1

◆ LAN7800_VENDOR_REQUEST_WRITE

#define LAN7800_VENDOR_REQUEST_WRITE   0xA0

Function Documentation

◆ lan7800_eeprom_read_bytes()

uint8_t lan7800_eeprom_read_bytes ( dwc2_core_regs regs,
dwc2_usb_device dev,
uint32_t  addr 
)

◆ lan7800_initialize()

void lan7800_initialize ( dwc2_core_regs regs,
dwc2_usb_device dev 
)

lan7800_initialize – initialize SMSC lan7800

Parameters
regs– pointer to dwc2 core registers
dev– pointer to usb device of lan7800

◆ lan7800_read_mac_from_eeprom()

void lan7800_read_mac_from_eeprom ( dwc2_core_regs regs,
dwc2_usb_device dev,
uint8_t mac 
)

◆ lan7800_read_reg()

uint32_t lan7800_read_reg ( dwc2_core_regs regs,
dwc2_usb_device dev,
uint32_t  reg 
)

◆ lan7800_write_reg()

void lan7800_write_reg ( dwc2_core_regs regs,
dwc2_usb_device dev,
uint32_t  reg,
uint32_t  val 
)