|
XenevaOS
|
#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>
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) |
| MMIORead32 – reads a 32 bit value from the given address. | |
| void | MMIOWrite32 (uint64_t addr, uint32_t val) |
| MMIOWrite32 – write a 32 bit value to given address. | |
| void | E1000WriteCmd (E1000NIC *dev, uint16_t addr, uint32_t val) |
| E1000WriteCmd – write a command to given offset from mmio address. | |
| uint32_t | E1000ReadCmd (E1000NIC *dev, uint16_t addr) |
| E1000ReadCmd – read a command from given offset from mmio address. | |
| 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 () |
| AuDriverUnload – Frees and clear up everthing from the driver. | |
| 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 | |
| E1000NIC * | e1000_nic |
| AuNetworkDevice * | ndev |
| AuVFSNode * | nic |
| #define CTRL_LRST (1UL << 3UL) |
| #define CTRL_PHY_RST (1UL << 31UL) |
| #define CTRL_RST (1UL << 26UL) |
| #define CTRL_SLU (1UL << 6UL) |
| 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:
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.
AuDriverUnload – Frees and clear up everthing from the driver.
| void E1000DisableInterrupt | ( | E1000NIC * | dev | ) |
| void E1000EEPROMDetect | ( | E1000NIC * | dev | ) |
| void E1000InitRX | ( | E1000NIC * | dev | ) |
| void E1000InitTX | ( | E1000NIC * | dev | ) |
| void E1000IRQHandler | ( | size_t | v, |
| void * | p | ||
| ) |
E1000ReadCmd – read a command from given offset from mmio address.
| dev | – pointer to e1000 device |
| addr | – offset from mmio address |
| AU_EXTERN AU_EXPORT size_t E1000ReadFile | ( | AuVFSNode * | node, |
| AuVFSNode * | file, | ||
| uint64_t * | buffer, | ||
| uint32_t | len | ||
| ) |
| void E1000ReadMAC | ( | E1000NIC * | dev | ) |
| void E1000Thread | ( | uint64_t | val | ) |
| int E1000TxFull | ( | E1000NIC * | dev, |
| int | tx_tail, | ||
| int | tx_head | ||
| ) |
E1000WriteCmd – write a command to given offset from mmio address.
| dev | – pointer to e1000 device |
| addr | – offset from mmio address |
| val | – value to write |
| AU_EXTERN AU_EXPORT size_t E1000WriteFile | ( | AuVFSNode * | node, |
| AuVFSNode * | file, | ||
| uint64_t * | buffer, | ||
| uint32_t | len | ||
| ) |
| void E1000WriteMAC | ( | E1000NIC * | dev | ) |
MMIORead32 – reads a 32 bit value from the given address.
| addr | – address from where to read |
MMIOWrite32 – write a 32 bit value to given address.
| addr | – address where to write |
| val | – value to write |
| E1000NIC* e1000_nic |
| AuNetworkDevice* ndev |
| AuVFSNode* nic |