DHCP Works now.

git-svn-id: https://spexeah.com:8443/svn/Asuro@1034 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2020-07-12 17:02:14 +00:00
parent 46cb414b43
commit fbc59a1617
12 changed files with 389 additions and 166 deletions

View File

@ -165,7 +165,6 @@ var
mem : puint32;
begin
push_trace('E1000.writeCommand');
if (bar_type = 0) then begin
mem:= puint32(mem_base + p_address);
mem^:= p_value;
@ -173,7 +172,6 @@ begin
outl(io_base + 0, p_address);
outl(io_base + 4, p_address)
end;
pop_trace;
end;
function readCommand(p_address : uint16) : uint32;
@ -181,7 +179,6 @@ var
mem : puint32;
begin
push_trace('E1000.readCommand');
if (bar_type = 0) then begin
mem:= puint32(mem_base + p_address);
readCommand:= mem^;
@ -189,7 +186,6 @@ begin
outl(io_base, p_address);
readCommand:= inl(io_base + 4);
end;
pop_trace;
end;
function readStatus : uint32;
@ -202,7 +198,6 @@ var
val, i : uint32;
begin
push_trace('E1000.detectEEPROM');
val:= 0;
writeCommand(REG_EEPROM, $1);
for i:=0 to 1000 do begin
@ -211,7 +206,6 @@ begin
if (val and $10) > 0 then eeprom_exists:= true else eeprom_exists:= false;
end;
detectEEPROM:= eeprom_exists;
pop_trace;
end;
function EEPROMRead( address : uint8 ) : uint32;
@ -220,7 +214,6 @@ var
tmp : uint32;
begin
push_trace('E1000.EEPROMRead');
tmp:= 0;
if (eeprom_exists) then begin
writeCommand( REG_EEPROM, 1 OR (uint32(address) SHL 8) );
@ -235,7 +228,6 @@ begin
end;
data:= uint16( (tmp SHR 16) AND ($FFFF) );
EEPROMRead:= data;
pop_trace;
end;
function readMACAddress() : boolean;
@ -271,7 +263,6 @@ begin
end;
end;
readMACAddress:= res;
pop_trace;
end;
procedure startLink();
@ -279,10 +270,8 @@ var
val : uint32;
begin
push_trace('E1000.startLink');
val:= readCommand(REG_CTRL);
writeCommand(REG_CTRL, val OR ECTRL_SLU);
pop_trace;
end;
procedure rxinit();
@ -293,7 +282,6 @@ var
i : uint32;
begin
push_trace('E1000.rxinit');
ptr:= puint8(kalloc(sizeof(TE1000_rx_desc) * E1000_NUM_RX_DESC + 16));
descs:= PE1000_rx_desc(ptr);
for i:=0 to E1000_NUM_RX_DESC do begin
@ -323,7 +311,6 @@ begin
rx_curr:= 0;
writeCommand(REG_RCTRL, RCTL_EN OR RCTL_SBP OR RCTL_UPE OR RCTL_MPE OR RCTL_LBM_NONE OR RTCL_RDMTS_HALF OR RCTL_BAM OR RCTL_SECRC OR RCTL_BSIZE_2048);
pop_trace;
end;
procedure txinit();
@ -334,7 +321,6 @@ var
i : uint32;
begin
push_trace('E1000.txinit');
ptr:= puint8(kalloc(sizeof(TE1000_tx_desc) * (E1000_NUM_TX_DESC + 16)));
descs:= PE1000_tx_desc(ptr);
for i:=0 to E1000_NUM_TX_DESC do begin
@ -346,9 +332,7 @@ begin
outptr:= puint8(vtop(uint32(ptr))); //puint8(uint32(ptr) - KERNEL_VIRTUAL_BASE);
console.output('E1000 Driver', 'TX VMem: ');
console.writehexln(uint32(ptr));
console.output('E1000 Driver', 'TX Mem: ');
console.writehexln(uint32(outptr));
writeCommand(REG_TXDESCHI, 0);
@ -366,16 +350,13 @@ begin
writeCommand(REG_TCTRL, $3003F0FA);
writeCommand(REG_TIPG, $0060200A);
end;
pop_trace;
end;
procedure enableInturrupt();
begin
push_trace('E1000.enableInterrupt');
writeCommand(REG_IMASK, $1F6DC);
writeCommand(REG_IMASK, $FF AND NOT(4));
readCommand($C0);
pop_trace;
end;
procedure handleReceive();
@ -387,7 +368,6 @@ var
i : uint16;
begin
push_trace('E1000.handleReceive');
while (rx_descs[rx_curr]^.status AND $1) > 0 do begin
got_packet:= true;
buf:= rx_buffs[rx_curr];
@ -401,7 +381,6 @@ begin
rx_curr:= (rx_curr + 1) mod E1000_NUM_RX_DESC;
writeCommand(REG_RXDESCTAIL, old_cur);
end;
pop_trace;
end;
procedure writeCardType();
@ -421,8 +400,6 @@ var
data : uint32;
begin
push_trace('E1000.fire');
writeToLogLn('L0: E1000 Fire');
status:= readCommand($C0);
if (status AND $04) > 0 then begin
startLink();
@ -439,9 +416,7 @@ end;
procedure console_command_mac(params : PParamList);
begin
push_trace('E1000.console_command_mac');
writeMACAddress(@mac[0], getTerminalHWND);
pop_trace;
end;
procedure console_command_sendtest(params : PParamList);
@ -461,7 +436,6 @@ var
);
begin
push_trace('E1000.console_command_sendtest');
TestPacket[6]:= mac[0];
TestPacket[7]:= mac[1];
TestPacket[8]:= mac[2];
@ -579,35 +553,29 @@ end;
function loadE1000(ptr : void) : boolean;
begin
push_trace('E1000.loadE1000');
loadE1000:= false;
if not Loaded then begin
card_type:= ctE1000;
loadE1000:= load(ptr);
end;
pop_trace;
end;
function load82577LM(ptr : void) : boolean;
begin
push_trace('E1000.load82577LM');
load82577LM:= false;
if not Loaded then begin
card_type:= ct82577LM;
load82577LM:= load(ptr);
end;
pop_trace;
end;
function loadI217(ptr : void) : boolean;
begin
push_trace('E1000.loadI217');
loadI217:= false;
if not Loaded then begin
card_type:= ctI217;
loadI217:= load(ptr);
end;
pop_trace;
end;
procedure init();
@ -643,7 +611,6 @@ var
timeout : uint32;
begin
push_trace('E1000.sendPacket');
tx_descs[tx_curr]^.address:= uint32(vtop(uint32(p_data)));
tx_descs[tx_curr]^.length:= p_len;
tx_descs[tx_curr]^.cmd:= CMD_EOP OR CMD_IFCS OR CMD_RS OR CMD_RPS;
@ -657,7 +624,6 @@ begin
end;
sendPacket:= 1;
if timeout > 0 then sendPacket:= 0;
pop_trace;
end;
end.