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

This commit is contained in:
aaron
2018-04-07 22:46:14 +00:00
parent b62e3ce8c6
commit e4ed0cf1cf
4 changed files with 35 additions and 21 deletions

View File

@ -16,7 +16,6 @@ uses
drivertypes,
console,
terminal,
IDE,
drivermanagement,
vmemorymanager,
lmemorymanager;
@ -34,17 +33,16 @@ type
usedSectorCount : uint32;
end;
const
var
storageDevices : array[0..255] of TStorage_Device;
//TODO need callback things for when new devices are connected
procedure init();
procedure register_device(device : TStorage_Device);
function get_all_devices() : APStorage_Device;
function read(device : uint16; address : uint32; byteCount : uint32) : PuInt32;
procedure write(device : uint16; address : uint32; byteCount : uint32; data : PuInt32);
//function get_all_devices() : APStorage_Device;
//function read(device : uint16; address : uint32; byteCount : uint32) : PuInt32;
//procedure write(device : uint16; address : uint32; byteCount : uint32; data : PuInt32);
implementation
@ -53,17 +51,17 @@ var
i : uint8;
begin
for i:=0 to 255 do begin
if storageDevices[i].controller = nil then break;
if storageDevices[i].maxSectorCount = 0 then break;
console.writeint(i);
console.writestring(') Device_Type: ');
case storageDevices[i].controller of
ControllerIDE:console.writestring('IDE ');
ControllerUSB:console.writestring('USB ');
ControllerAHCI:console.writestring('AHCI ');
ControllerNET:console.writestring('NET ');
ControllerIDE : console.writestring('IDE, ');
ControllerUSB : console.writestring('USB, ');
ControllerAHCI : console.writestring('AHCI, ');
ControllerNET : console.writestring('NET, ');
end;
console.writestring('Capacity: ');
console.writeint(((sectors * 512) / 1000) / 1000);
console.writeint(((storageDevices[i].maxSectorCount * 512) DIV 1000) DIV 1000);
console.writestringln('MB');
end;
end;
@ -72,4 +70,17 @@ procedure init();
begin
terminal.registerCommand('disks', @list_drives_command, 'List storage devices');
end;
procedure register_device(device : TStorage_Device);
var
i : uint8;
begin
for i:=0 to 255 do begin
if storageDevices[i].maxSectorCount = 0 then begin
storageDevices[i]:= device;
break;
end;
end;
end;
end.