git-svn-id: https://spexeah.com:8443/svn/Asuro@722 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron 2018-05-12 09:20:28 +00:00
parent b8ebad8d42
commit 5dee385248
22 changed files with 56 additions and 9 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -89,6 +89,11 @@ type
Padding : uint8; Padding : uint8;
end; end;
PIPv4AsWORDs = ^TIPv4AsWORDs;
TIPv4AsWORDs = bitpacked record
WORDS : Array[0..11] of uint16;
end;
TTCPFlags = record TTCPFlags = record
RS : Boolean; RS : Boolean;
DF : Boolean; DF : Boolean;

View File

@ -21,7 +21,7 @@ procedure writeToLogLn(str : pchar);
implementation implementation
uses uses
ipv4, arp, eth2; ipv4, arp, eth2, e1000, terminal;
var var
CBSend : TNetSendCallback = nil; CBSend : TNetSendCallback = nil;
@ -108,12 +108,18 @@ begin
pop_trace; pop_trace;
end; end;
procedure terminal_command_e1000status(Params : PParamList);
begin
console.writeHexLnWND(e1000.readStatus, getTerminalHWND);
end;
procedure init; procedure init;
begin begin
push_trace('net.init'); push_trace('net.init');
eth2.register; eth2.register;
arp.register; arp.register;
ipv4.register; ipv4.register;
terminal.registerCommand('e1000status', @terminal_command_e1000status, 'e1000 status');
pop_trace; pop_trace;
end; end;

View File

@ -67,6 +67,18 @@ begin
end; end;
end; end;
function findCacheRecord(ip : puint8) : PARPCacheRecord;
var
CacheRecord : PARPCacheRecord;
begin
CacheRecord:= findCacheRecordByIP(ip);
if CacheRecord = nil then begin
end;
findCacheRecord:= CacheRecord;
end;
procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext); procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext);
var var
buf : void; buf : void;
@ -124,6 +136,24 @@ begin
freePacketContext(context); freePacketContext(context);
end; end;
procedure sendRequestGateway(ip : puint8);
var
context : PPacketContext;
CacheRecord : PARPCacheRecord;
begin
context:= newPacketContext;
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
if CacheRecord <> nil then begin
CopyMAC(@CacheRecord^.MAC[0], @context^.MAC.Destination[0]);
CopyIPv4(ip, @context^.IP.Destination[0]);
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
CopyMAC(GetMAC, @context^.MAC.Source[0]);
arp.send($1, $0800, $1, context);
end;
freePacketContext(context);
end;
procedure sendRequest(ip : puint8); procedure sendRequest(ip : puint8);
var var
context : PPacketContext; context : PPacketContext;
@ -135,10 +165,10 @@ begin
CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]); CopyIPv4(@getIPv4Config^.Address[0], @context^.IP.Source[0]);
CopyMAC(GetMAC, @context^.MAC.Source[0]); CopyMAC(GetMAC, @context^.MAC.Source[0]);
CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]); CacheRecord:= findCacheRecordByIP(@getIPv4Config^.Gateway[0]);
if CacheRecord <> nil then CopyMAC(@CacheRecord^.MAC[0], @context^.MAC.Destination[0]) CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
else CopyMAC(@NULL_MAC[0], @context^.MAC.Destination[0]);
arp.send($1, $0800, $1, context); arp.send($1, $0800, $1, context);
freePacketContext(context); freePacketContext(context);
sendRequestGateway(ip);
end; end;
procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext); procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext);

View File

@ -135,6 +135,7 @@ type
procedure init(); procedure init();
function getMACAddress : puint8; function getMACAddress : puint8;
function sendPacket(p_data : void; p_len : uint16) : sint32; function sendPacket(p_data : void; p_len : uint16) : sint32;
function readStatus : uint32;
implementation implementation
@ -186,6 +187,11 @@ begin
pop_trace; pop_trace;
end; end;
function readStatus : uint32;
begin
readStatus:= readCommand(REG_STATUS);
end;
function detectEEPROM() : boolean; function detectEEPROM() : boolean;
var var
val, i : uint32; val, i : uint32;
@ -305,7 +311,7 @@ begin
writeCommand(REG_RXDESCLO, uint32(outptr)); writeCommand(REG_RXDESCLO, uint32(outptr));
writeCommand(REG_RXDESCHI, 0); writeCommand(REG_RXDESCHI, 0);
writeCommand(REG_RXDESCLEN, E1000_NUM_RX_DESC * 16); writeCommand(REG_RXDESCLEN, E1000_NUM_RX_DESC * sizeof(TE1000_rx_desc));
writeCommand(REG_RXDESCHEAD, 0); writeCommand(REG_RXDESCHEAD, 0);
writeCommand(REG_RXDESCTAIL, E1000_NUM_RX_DESC-1); writeCommand(REG_RXDESCTAIL, E1000_NUM_RX_DESC-1);
@ -343,7 +349,7 @@ begin
writeCommand(REG_TXDESCHI, 0); writeCommand(REG_TXDESCHI, 0);
writeCommand(REG_TXDESCLO, uint32(outptr)); writeCommand(REG_TXDESCLO, uint32(outptr));
writeCommand(REG_TXDESCLEN, E1000_NUM_TX_DESC * 16); writeCommand(REG_TXDESCLEN, E1000_NUM_TX_DESC * sizeof(TE1000_tx_desc));
writeCommand( REG_TXDESCHEAD, 0 ); writeCommand( REG_TXDESCHEAD, 0 );
writeCommand( REG_TXDESCTAIL, 0 ); writeCommand( REG_TXDESCTAIL, 0 );

View File

@ -9,14 +9,14 @@ const
VERSION_SUB = '1'; VERSION_SUB = '1';
REVISION = '677'; REVISION = '677';
RELEASE = 'ia'; RELEASE = 'ia';
LINE_COUNT = 28049; LINE_COUNT = 28096;
FILE_COUNT = 90; FILE_COUNT = 90;
DRIVER_COUNT = 32; DRIVER_COUNT = 32;
FPC_VERSION = '2.6.4'; FPC_VERSION = '2.6.4';
NASM_VERSION = '2.10.09'; NASM_VERSION = '2.10.09';
MAKE_VERSION = '3.81'; MAKE_VERSION = '3.81';
COMPILE_DATE = '11/05/18'; COMPILE_DATE = '12/05/18';
COMPILE_TIME = '10:15:31'; COMPILE_TIME = '10:20:16';
implementation implementation