git-svn-id: https://spexeah.com:8443/svn/Asuro@792 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
Binary file not shown.
+3
-3
@@ -54,7 +54,7 @@ afd15dca933f082c73f48aba1059a04e src/include/lists.pas
|
||||
fcbd8be162a75e1a971fbc58318e077c src/include/strings.pas
|
||||
01e4c69601c664fff8922f4a0d96c02d src/include/system.pas
|
||||
6103928fbe8c413929cde49df82f5a1f src/include/types.pas
|
||||
6e06bfa650488c1f9e328fd99717ecae src/include/util.pas
|
||||
177a03d217eba976acf0ead9e70d14c0 src/include/util.pas
|
||||
be084ee5d65fdc85182ff87a3f09c831 src/driver/storage/AHCI_OLD.pas
|
||||
e9c1a0807931287779b0295a88faec30 src/driver/storage/AHCI.pas
|
||||
ff442b1dc417a277c68b2890740ea5a2 src/driver/storage/asfs.pas
|
||||
@@ -62,10 +62,10 @@ ff442b1dc417a277c68b2890740ea5a2 src/driver/storage/asfs.pas
|
||||
15e714c6bf0f6805f95cac019a8ef3ff src/driver/storage/ATA_OLD.pas
|
||||
631b160eab56da3ce6df8a76b1577452 src/driver/storage/fat32_OLD.pas
|
||||
0dbc9a5453191d47edbe85a90177e4ca src/driver/storage/fat32.pas
|
||||
9af5fc15d58531ee6040f2b8d42869b5 src/driver/storage/IDE.pas
|
||||
7e41b1d061d5ffebd887b5fc65fe655f src/driver/storage/IDE.pas
|
||||
0843fb9b9ca537d4c595cafc88eac993 src/driver/storage/partitiontable.pas
|
||||
3437aa5ff213f37f5088ceb690e78d3d src/driver/storage/storagemanagement.pas
|
||||
55bcf502cfd3623ca39048738a8d0917 src/driver/interface/serial.pas
|
||||
2b3d1b9259cd2e80a8849515250998be src/driver/interface/serial.pas
|
||||
24bbc994c12729d6b85026f0881c2ab9 src/driver/exp/testdriver.pas
|
||||
ec93c6fc2b22ac56da6fec164a5da32a src/driver/hid/keyboard.pas
|
||||
71c5ec91a9f0a148472b21cb7554205d src/driver/hid/mouse.pas
|
||||
|
||||
Binary file not shown.
BIN
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.
@@ -20,12 +20,43 @@ procedure init();
|
||||
function receive(PORT : uint16; timeout : uint32) : uint8;
|
||||
function send(PORT : uint16; data : uint8; timeout : uint32) : boolean;
|
||||
function sendString(str : pchar) : boolean;
|
||||
function sendHex(i : uint32) : boolean;
|
||||
procedure soutb(port : uint16; val : uint8);
|
||||
function sinb(port : uint16) : uint8;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
console;
|
||||
|
||||
procedure soutb(port : uint16; val : uint8);
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
MOV AL, val
|
||||
OUT DX, AL
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
function sinb(port : uint16) : uint8;
|
||||
begin
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
MOV DX, port
|
||||
IN AL, DX
|
||||
MOV sinb, AL
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
procedure IRQ_Hook();
|
||||
begin
|
||||
|
||||
@@ -33,13 +64,13 @@ end;
|
||||
|
||||
procedure initPort(PORT : uint16);
|
||||
begin
|
||||
outb(PORT + 1, $00);
|
||||
outb(PORT + 3, $80);
|
||||
outb(PORT + 0, $03);
|
||||
outb(PORT + 1, $00);
|
||||
outb(PORT + 3, $03);
|
||||
outb(PORT + 2, $C7);
|
||||
outb(PORT + 4, $0B);
|
||||
soutb(PORT + 1, $00);
|
||||
soutb(PORT + 3, $80);
|
||||
soutb(PORT + 0, $03);
|
||||
soutb(PORT + 1, $00);
|
||||
soutb(PORT + 3, $03);
|
||||
soutb(PORT + 2, $C7);
|
||||
soutb(PORT + 4, $0B);
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
@@ -52,12 +83,12 @@ end;
|
||||
|
||||
function serial_received(PORT : uint16) : uint32;
|
||||
begin
|
||||
serial_received:= inb(PORT + 5) AND 1;
|
||||
serial_received:= sinb(PORT + 5) AND 1;
|
||||
end;
|
||||
|
||||
function is_transmit_empty(PORT : uint16) : uint32;
|
||||
begin
|
||||
is_transmit_empty:= inb(PORT + 5) AND $20;
|
||||
is_transmit_empty:= sinb(PORT + 5) AND $20;
|
||||
end;
|
||||
|
||||
function receive(PORT : uint16; timeout : uint32) : uint8;
|
||||
@@ -71,7 +102,7 @@ begin
|
||||
dec(_timeout);
|
||||
end;
|
||||
if _timeout <> 0 then begin
|
||||
receive:= inb(PORT);
|
||||
receive:= sinb(PORT);
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -86,7 +117,7 @@ begin
|
||||
dec(_timeout);
|
||||
end;
|
||||
if _timeout <> 0 then begin
|
||||
outb(PORT, data);
|
||||
soutb(PORT, data);
|
||||
send:= true;
|
||||
end;
|
||||
end;
|
||||
@@ -104,4 +135,54 @@ begin
|
||||
sendString:= sendString AND send(COM1, uint8(10), 10000);
|
||||
end;
|
||||
|
||||
function sendHex(i : uint32) : boolean;
|
||||
var
|
||||
Hex : Array[0..7] of Byte;
|
||||
Res : DWORD;
|
||||
Rem : DWORD;
|
||||
c : Integer;
|
||||
|
||||
begin
|
||||
for c:=0 to 7 do begin
|
||||
Hex[c]:= 0;
|
||||
end;
|
||||
c:=0;
|
||||
Res:= i;
|
||||
Rem:= Res mod 16;
|
||||
while Res > 0 do begin
|
||||
Hex[c]:= Rem;
|
||||
Res:= Res div 16;
|
||||
Rem:= Res mod 16;
|
||||
c:=c+1;
|
||||
end;
|
||||
send(COM1, uint8('0'), 10000);
|
||||
send(COM1, uint8('x'), 10000);
|
||||
for c:=7 downto 0 do begin
|
||||
if Hex[c] <> 255 then begin
|
||||
case Hex[c] of
|
||||
0:send(COM1, uint8('0'), 10000);
|
||||
1:send(COM1, uint8('1'), 10000);
|
||||
2:send(COM1, uint8('2'), 10000);
|
||||
3:send(COM1, uint8('3'), 10000);
|
||||
4:send(COM1, uint8('4'), 10000);
|
||||
5:send(COM1, uint8('5'), 10000);
|
||||
6:send(COM1, uint8('6'), 10000);
|
||||
7:send(COM1, uint8('7'), 10000);
|
||||
8:send(COM1, uint8('8'), 10000);
|
||||
9:send(COM1, uint8('9'), 10000);
|
||||
10:send(COM1, uint8('A'), 10000);
|
||||
11:send(COM1, uint8('B'), 10000);
|
||||
12:send(COM1, uint8('C'), 10000);
|
||||
13:send(COM1, uint8('D'), 10000);
|
||||
14:send(COM1, uint8('E'), 10000);
|
||||
15:send(COM1, uint8('F'), 10000);
|
||||
else send(COM1,uint8('?'), 10000);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
send(COM1, uint8(13), 10000);
|
||||
send(COM1, uint8(10), 10000);
|
||||
sendHex:= true;
|
||||
end;
|
||||
|
||||
end.
|
||||
+16
-1
@@ -68,7 +68,7 @@ var
|
||||
implementation
|
||||
|
||||
uses
|
||||
console, RTC, cpu;
|
||||
console, RTC, cpu, serial, strings;
|
||||
|
||||
function MsSinceSystemBoot : uint64;
|
||||
begin
|
||||
@@ -272,6 +272,9 @@ end;
|
||||
|
||||
procedure outl(port : uint16; val : uint32); [public, alias: 'util_outl'];
|
||||
begin
|
||||
//serial.sendString('[outl]');
|
||||
//serial.sendHex(port);
|
||||
//serial.sendHex(val);
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
@@ -286,6 +289,9 @@ end;
|
||||
|
||||
procedure outw(port : uint16; val : uint16); [public, alias: 'util_outw'];
|
||||
begin
|
||||
//serial.sendString('[outw]');
|
||||
//serial.sendHex(port);
|
||||
//serial.sendHex(val);
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
@@ -300,6 +306,9 @@ end;
|
||||
|
||||
procedure outb(port : uint16; val : uint8); [public, alias: 'util_outb'];
|
||||
begin
|
||||
//serial.sendString('[outb]');
|
||||
//serial.sendHex(port);
|
||||
//serial.sendHex(val);
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
@@ -328,6 +337,8 @@ end;
|
||||
|
||||
function inl(port : uint16) : uint32; [public, alias: 'util_inl'];
|
||||
begin
|
||||
//serial.sendString('[inl]');
|
||||
//serial.sendHex(port);
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
@@ -342,6 +353,8 @@ end;
|
||||
|
||||
function inw(port : uint16) : uint16; [public, alias: 'util_inw'];
|
||||
begin
|
||||
//serial.sendString('[inw]');
|
||||
//serial.sendHex(port);
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
@@ -356,6 +369,8 @@ end;
|
||||
|
||||
function inb(port : uint16) : uint8; [public, alias: 'util_inb'];
|
||||
begin
|
||||
//serial.sendString('[inb]');
|
||||
//serial.sendHex(port);
|
||||
asm
|
||||
PUSH EAX
|
||||
PUSH EDX
|
||||
|
||||
Reference in New Issue
Block a user