WIP: drivers and boot
This commit is contained in:
35
kernel/drivers/rtl8139/rtl8139.cpp
Normal file
35
kernel/drivers/rtl8139/rtl8139.cpp
Normal file
@ -0,0 +1,35 @@
|
||||
#include "rtl8139.h"
|
||||
#include "../io/io.h"
|
||||
|
||||
|
||||
rtl8139::rtl8139(){
|
||||
|
||||
}
|
||||
|
||||
rtl8139::~rtl8139(){
|
||||
|
||||
}
|
||||
|
||||
void rtl8139::Wake(){
|
||||
outb(ioaddr + CONFIG_1, 0x0);
|
||||
}
|
||||
|
||||
void rtl8139::Reset(){
|
||||
outb(ioaddr + CMD_OFFSET, 0x10);
|
||||
// Wait for the reset procedure
|
||||
while((inb(ioaddr + CMD_OFFSET) & 0x10) != 0) continue;
|
||||
}
|
||||
|
||||
|
||||
void rtl8139::Sleep(){
|
||||
|
||||
}
|
||||
|
||||
void rtl8139::Receive(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
void rtl8139::Transmit(){
|
||||
|
||||
}
|
||||
35
kernel/drivers/rtl8139/rtl8139.h
Normal file
35
kernel/drivers/rtl8139/rtl8139.h
Normal file
@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#define MAC05_OFFSET 0x00 // size 6
|
||||
#define MAC07_OFFSET 0x08 // size 8
|
||||
#define RBSTART_OFFSET 0x30 // size 4
|
||||
#define CMD_OFFSET 0x37 // size 1
|
||||
#define IMR_OFFSET 0x3C // size 2
|
||||
#define ISR_OFFSET 0x3E // size 2
|
||||
#define CONFIG_1 0x52
|
||||
|
||||
// Copyright © Nigel Barink 2023
|
||||
// Information source: https://wiki.osdev.org/RTL8139
|
||||
|
||||
// Get me some networking !! XD
|
||||
class NetworkDevice {
|
||||
protected:
|
||||
|
||||
};
|
||||
|
||||
|
||||
class rtl8139 : public NetworkDevice {
|
||||
public:
|
||||
rtl8139();
|
||||
~rtl8139();
|
||||
|
||||
|
||||
void Wake();
|
||||
void Reset();
|
||||
|
||||
void Sleep();
|
||||
void Receive();
|
||||
void Transmit();
|
||||
private:
|
||||
int ioaddr ;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user