Drivers now using DriverManagement.

git-svn-id: https://spexeah.com:8443/svn/Asuro@302 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
kieron
2018-04-05 10:42:12 +00:00
parent 6b3c4fb634
commit e3c96aa9f8
6 changed files with 270 additions and 38 deletions

View File

@ -75,14 +75,13 @@ function getDeviceInfo(class_code : uint8; subclass_code : uint8; prog_if : uint
implementation
procedure init();
function load(ptr : void) : boolean;
var
current_bus : uint8;
begin
console.writestringln('PCI: INIT BEGIN.');
console.writestringln('PCI: Scanning Bus: 0');
scanBus(0);
//while unscanned busses scan busses
current_bus := 1;
while true do begin
@ -93,7 +92,22 @@ begin
current_bus := current_bus + 1;
end else break;
end;
load:= true;
end;
procedure init();
var
DevID : TDeviceIdentifier;
begin
console.writestringln('PCI: INIT BEGIN.');
DevID.Bus:= biUnknown;
DevID.id0:= 0;
DevID.id1:= 0;
DevID.id2:= 0;
DevID.id3:= 0;
DevID.ex:= nil;
drivermanagement.register_driver_ex('PCI Driver', @DevID, @load, true);
console.writestringln('PCI: INIT END.');
end;

View File

@ -8,7 +8,8 @@ uses
drivertypes,
pmemorymanager,
vmemorymanager,
util;
util,
drivermanagement;
type
POHCI_MMR = ^TOHCI_MMR;
@ -39,7 +40,7 @@ procedure init;
implementation
procedure init;
function loadOHCI(ptr : void) : boolean;
var
devices : TDeviceArray;
count : uint32;
@ -48,25 +49,6 @@ var
MMR : POHCI_MMR;
begin
console.writestringln('USB: INIT BEGIN.');
devices:= PCI.getDeviceInfo($0C, $03, $00, count);
console.writestring('USB-UHCI: Found ');
console.writeint(count);
console.writestringln(' USB Controller(s).');
if count > 0 then begin
for i:=0 to count-1 do begin
console.writestring('USB: Controller[');
console.writeint(i);
console.writestring(']: ');
console.writehex(devices[i].device_id);
console.writestring(' ');
console.writehex(devices[i].vendor_id);
console.writestring(' ');
console.writehexln(devices[i].prog_if);
end;
end;
devices:= PCI.getDeviceInfo($0C, $03, $10, count);
console.writestring('USB-OHCI: Found ');
console.writeint(count);
@ -87,7 +69,57 @@ begin
MMR:= POHCI_MMR(devices[i].address0);
end;
end;
end;
function loadUHCI(ptr : void) : boolean;
var
devices : TDeviceArray;
count : uint32;
i : uint32;
begin
devices:= PCI.getDeviceInfo($0C, $03, $00, count);
console.writestring('USB-UHCI: Found ');
console.writeint(count);
console.writestringln(' USB Controller(s).');
if count > 0 then begin
for i:=0 to count-1 do begin
console.writestring('USB: Controller[');
console.writeint(i);
console.writestring(']: ');
console.writehex(devices[i].device_id);
console.writestring(' ');
console.writehex(devices[i].vendor_id);
console.writestring(' ');
console.writehexln(devices[i].prog_if);
end;
end;
end;
procedure init;
var
UHCI_ID, OHCI_ID : TDeviceIdentifier;
begin
console.writestringln('USB: INIT BEGIN.');
UHCI_ID.Bus:= biPCI;
UHCI_ID.id0:= idANY;
UHCI_ID.id1:= $0000000C;
UHCI_ID.id2:= $00000003;
UHCI_ID.id3:= $00000000;
UHCI_ID.ex:= nil;
OHCI_ID.Bus:= biPCI;
OHCI_ID.id0:= idANY;
OHCI_ID.id1:= $0000000C;
OHCI_ID.id2:= $00000003;
OHCI_ID.id3:= $00000010;
OHCI_ID.ex:= nil;
drivermanagement.register_driver('USB-UHCI Driver', @UHCI_ID, @loadUHCI);
drivermanagement.register_driver('USB-OHCI Driver', @OHCI_ID, @loadOHCI);
console.writestringln('USB: INIT END.');
end;

View File

@ -32,7 +32,6 @@ var
key_matrix_shift : array [1..256] of TKeyInfo;
captin_hook : pp_hook_method = nil;
is_shift : boolean = false;
procedure init(keyboard_layout : array of TKeyInfo);
procedure hook(proc : pp_hook_method);
@ -40,6 +39,8 @@ procedure lang_USA();
implementation
uses
drivermanagement;
procedure callback(scan_code : void);
begin
@ -58,11 +59,27 @@ begin
if uint8(scan_code) = 170 then is_shift := false;
end;
function load(ptr : void) : boolean;
begin
isr33.hook(uint32(@callback));
console.writestringln('PS/2 KEYBOARD: LOADED.');
load:= true;
end;
procedure init(keyboard_layout : array of TKeyInfo);
var
devid : TDeviceIdentifier;
begin
console.writestringln('PS/2 KEYBOARD: INIT BEGIN.');
if keyboard_layout[1].key_code = 0 then lang_USA();
isr33.hook(uint32(@callback));
devid.bus:= biUnknown;
devid.id0:= 0;
devid.id1:= 0;
devid.id2:= 0;
devid.id3:= 0;
devid.ex:= nil;
drivermanagement.register_driver_ex('PS/2 Keyboard', @devid, @load, true);
console.writestringln('PS/2 KEYBOARD: INIT END.');
end;
//2A AA

View File

@ -16,7 +16,8 @@ uses
util,
isr44,
lmemorymanager,
strings;
strings,
drivermanagement;
type
PMousePacket = ^TMousePacket;
@ -103,10 +104,26 @@ begin
//console.writehexln(DWORD(raw));
end;
function load(ptr : void) : boolean;
begin
isr44.hook(uint32(@callback));
console.writestringln('PS/2 MOUSE: LOADED.');
load:= true;
end;
procedure init();
var
devid : TDeviceIdentifier;
begin
console.writestringln('PS/2 MOUSE: INIT BEGIN.');
isr44.hook(uint32(@callback));
devid.bus:= biUnknown;
devid.id0:= 0;
devid.id1:= 0;
devid.id2:= 0;
devid.id3:= 0;
devid.ex:= nil;
drivermanagement.register_driver_ex('PS/2 Mouse', @devid, @load, true);
console.writestringln('PS/2 MOUSE: INIT END.');
end;