XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions | Variables
e1000.cpp File Reference
#include "e1000.h"
#include <Mm\kmalloc.h>
#include <Mm\vmmngr.h>
#include <Mm\pmmngr.h>
#include <pcie.h>
#include <_null.h>
#include <aucon.h>
#include <string.h>
#include <aurora.h>
#include <Hal\x86_64_sched.h>
#include <Hal\serial.h>
#include <audrv.h>
#include <Net\aunet.h>
#include <Net\ethernet.h>
#include <Fs\Dev\devfs.h>
#include <Net\arp.h>
Include dependency graph for e1000.cpp:

Classes

struct  _e1000_nic_
 

Macros

#define INTS   (ICR_LSC | ICR_RXO | ICR_RXT0 | ICR_TXQE | ICR_TXDW | ICR_ACK | ICR_RXDMT0 | ICR_SRPD)
 
#define CTRL_PHY_RST   (1UL << 31UL)
 
#define CTRL_RST   (1UL << 26UL)
 
#define CTRL_SLU   (1UL << 6UL)
 
#define CTRL_LRST   (1UL << 3UL)
 

Typedefs

typedef struct _e1000_nic_ E1000NIC
 

Functions

uint32_t MMIORead32 (uint64_t addr)
 
void MMIOWrite32 (uint64_t addr, uint32_t val)
 
void E1000WriteCmd (E1000NIC *dev, uint16_t addr, uint32_t val)
 
uint32_t E1000ReadCmd (E1000NIC *dev, uint16_t addr)
 
void E1000EEPROMDetect (E1000NIC *dev)
 
uint16_t E1000EEPROMRead (E1000NIC *dev, uint8_t addr)
 
void E1000WriteMAC (E1000NIC *dev)
 
void E1000ReadMAC (E1000NIC *dev)
 
void E1000DisableInterrupt (E1000NIC *dev)
 
void E1000InitRX (E1000NIC *dev)
 
void E1000InitTX (E1000NIC *dev)
 
int E1000TxFull (E1000NIC *dev, int tx_tail, int tx_head)
 
void E1000SendPacket (E1000NIC *dev, uint8_t *payload, size_t payload_sz)
 
void E1000IRQHandler (size_t v, void *p)
 
void E1000Thread (uint64_t val)
 
AU_EXTERN AU_EXPORT int AuDriverUnload ()
 
AU_EXTERN AU_EXPORT size_t E1000ReadFile (AuVFSNode *node, AuVFSNode *file, uint64_t *buffer, uint32_t len)
 
AU_EXTERN AU_EXPORT size_t E1000WriteFile (AuVFSNode *node, AuVFSNode *file, uint64_t *buffer, uint32_t len)
 
AU_EXTERN AU_EXPORT int E1000IOCtl (AuVFSNode *file, int code, void *arg)
 
AU_EXTERN AU_EXPORT int AuDriverMain ()
 

Variables

E1000NICe1000_nic
 
AuNetworkDevicendev
 
AuVFSNodenic
 

Macro Definition Documentation

◆ CTRL_LRST

#define CTRL_LRST   (1UL << 3UL)

◆ CTRL_PHY_RST

#define CTRL_PHY_RST   (1UL << 31UL)

◆ CTRL_RST

#define CTRL_RST   (1UL << 26UL)

◆ CTRL_SLU

#define CTRL_SLU   (1UL << 6UL)

◆ INTS

#define INTS   (ICR_LSC | ICR_RXO | ICR_RXT0 | ICR_TXQE | ICR_TXDW | ICR_ACK | ICR_RXDMT0 | ICR_SRPD)

Typedef Documentation

◆ E1000NIC

typedef struct _e1000_nic_ E1000NIC

BSD 2-Clause License

Copyright (c) 2022-2023, 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.

Function Documentation

◆ AuDriverMain()

AU_EXTERN AU_EXPORT int AuDriverMain ( )

◆ AuDriverUnload()

AU_EXTERN AU_EXPORT int AuDriverUnload ( )

◆ E1000DisableInterrupt()

void E1000DisableInterrupt ( E1000NIC dev)

◆ E1000EEPROMDetect()

void E1000EEPROMDetect ( E1000NIC dev)

◆ E1000EEPROMRead()

uint16_t E1000EEPROMRead ( E1000NIC dev,
uint8_t  addr 
)

◆ E1000InitRX()

void E1000InitRX ( E1000NIC dev)

◆ E1000InitTX()

void E1000InitTX ( E1000NIC dev)

◆ E1000IOCtl()

AU_EXTERN AU_EXPORT int E1000IOCtl ( AuVFSNode file,
int  code,
void *  arg 
)

◆ E1000IRQHandler()

void E1000IRQHandler ( size_t  v,
void *  p 
)

◆ E1000ReadCmd()

uint32_t E1000ReadCmd ( E1000NIC dev,
uint16_t  addr 
)

◆ E1000ReadFile()

AU_EXTERN AU_EXPORT size_t E1000ReadFile ( AuVFSNode node,
AuVFSNode file,
uint64_t buffer,
uint32_t  len 
)

◆ E1000ReadMAC()

void E1000ReadMAC ( E1000NIC dev)

◆ E1000SendPacket()

void E1000SendPacket ( E1000NIC dev,
uint8_t payload,
size_t  payload_sz 
)

◆ E1000Thread()

void E1000Thread ( uint64_t  val)

◆ E1000TxFull()

int E1000TxFull ( E1000NIC dev,
int  tx_tail,
int  tx_head 
)

◆ E1000WriteCmd()

void E1000WriteCmd ( E1000NIC dev,
uint16_t  addr,
uint32_t  val 
)

◆ E1000WriteFile()

AU_EXTERN AU_EXPORT size_t E1000WriteFile ( AuVFSNode node,
AuVFSNode file,
uint64_t buffer,
uint32_t  len 
)

◆ E1000WriteMAC()

void E1000WriteMAC ( E1000NIC dev)

◆ MMIORead32()

uint32_t MMIORead32 ( uint64_t  addr)

◆ MMIOWrite32()

void MMIOWrite32 ( uint64_t  addr,
uint32_t  val 
)

Variable Documentation

◆ e1000_nic

E1000NIC* e1000_nic

◆ ndev

◆ nic

AuVFSNode* nic