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

View File

@ -77,7 +77,7 @@ type
total_len_Lo : uint8;
identifier_Hi : uint8;
identifier_Lo : uint8;
Flags : ubit3;
Flags : ubit3;
Fragment_Off : ubit13;
TTL : uint8;
Protocol : uint8;
@ -89,6 +89,11 @@ type
Padding : uint8;
end;
PIPv4AsWORDs = ^TIPv4AsWORDs;
TIPv4AsWORDs = bitpacked record
WORDS : Array[0..11] of uint16;
end;
TTCPFlags = record
RS : Boolean;
DF : Boolean;

View File

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

View File

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

View File

@ -135,6 +135,7 @@ type
procedure init();
function getMACAddress : puint8;
function sendPacket(p_data : void; p_len : uint16) : sint32;
function readStatus : uint32;
implementation
@ -186,6 +187,11 @@ begin
pop_trace;
end;
function readStatus : uint32;
begin
readStatus:= readCommand(REG_STATUS);
end;
function detectEEPROM() : boolean;
var
val, i : uint32;
@ -305,7 +311,7 @@ begin
writeCommand(REG_RXDESCLO, uint32(outptr));
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_RXDESCTAIL, E1000_NUM_RX_DESC-1);
@ -343,7 +349,7 @@ begin
writeCommand(REG_TXDESCHI, 0);
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_TXDESCTAIL, 0 );

View File

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