git-svn-id: https://spexeah.com:8443/svn/Asuro@383 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
8fd4dd2673
commit
6b96457111
@ -145,10 +145,16 @@ begin
|
|||||||
buffer := puint32(kalloc(1024));
|
buffer := puint32(kalloc(1024));
|
||||||
buffer^:= cpacityMB;
|
buffer^:= cpacityMB;
|
||||||
|
|
||||||
writePIO28(0, 0, 1, buffer);
|
writePIO28(0, 2, 1, buffer);
|
||||||
buffer^:= $FFFF;
|
buffer^:= $FFFF;
|
||||||
readPIO28(0, 0, 1, buffer);
|
readPIO28(0, 2, 1, buffer);
|
||||||
writeintln(uint32(buffer^));
|
|
||||||
|
if uint32(buffer^) = cpacityMB then begin
|
||||||
|
console.writestringln('Tests successful!');
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
console.writestringln('Tests failed!');
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure init();
|
procedure init();
|
||||||
@ -170,11 +176,7 @@ end;
|
|||||||
|
|
||||||
function load(ptr : void) : boolean;
|
function load(ptr : void) : boolean;
|
||||||
begin
|
begin
|
||||||
controller := PPCI_Device(ptr);
|
//controller := PPCI_Device(ptr);
|
||||||
|
|
||||||
bar0 := controller^.address0;
|
|
||||||
bar1 := controller^.address1;
|
|
||||||
bar4 := controller^.address4;
|
|
||||||
|
|
||||||
outb($3F6, inb($3f6) or (1 shl 1));
|
outb($3F6, inb($3f6) or (1 shl 1));
|
||||||
|
|
||||||
@ -183,7 +185,7 @@ begin
|
|||||||
IDEDevices[0].exists:= true;
|
IDEDevices[0].exists:= true;
|
||||||
IDEDevices[0].isMaster:= true;
|
IDEDevices[0].isMaster:= true;
|
||||||
IDEDevices[0].info := identify_device(0, $A0);
|
IDEDevices[0].info := identify_device(0, $A0);
|
||||||
end;
|
end
|
||||||
//identify_device(0, $B0);
|
//identify_device(0, $B0);
|
||||||
|
|
||||||
end;
|
end;
|
||||||
@ -225,8 +227,10 @@ procedure writePIO28(drive : uint8; LBA : uint32; sectorCount : uint8; buffer :
|
|||||||
var
|
var
|
||||||
i : uint8;
|
i : uint8;
|
||||||
ii : uint8;
|
ii : uint8;
|
||||||
|
iii : uint32;
|
||||||
begin
|
begin
|
||||||
buffer:= Puint32(kalloc(1024*2));
|
console.writestringln('Starting write test');
|
||||||
|
//buffer:= Puint32(kalloc(1024*2));
|
||||||
if IDEDevices[drive].isMaster then begin
|
if IDEDevices[drive].isMaster then begin
|
||||||
outb($1F7, $E0 or ((LBA shr 24) and $0F)); //LBA command primary master
|
outb($1F7, $E0 or ((LBA shr 24) and $0F)); //LBA command primary master
|
||||||
end
|
end
|
||||||
@ -247,11 +251,17 @@ begin
|
|||||||
|
|
||||||
while true do begin
|
while true do begin
|
||||||
if (inw($1f7) and (1 shl 3)) <> 0 then break;
|
if (inw($1f7) and (1 shl 3)) <> 0 then break;
|
||||||
if (inw($1F7) and 1) <> 0 then exit; //drive error
|
if (inw($1F7) and 1) <> 0 then begin
|
||||||
|
console.writestringln('write error');
|
||||||
|
exit;
|
||||||
|
end; //drive error
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for ii:=0 to 255 do begin //read data
|
for ii:=0 to 254 do begin //read data
|
||||||
|
//console.writeintln(ii);
|
||||||
outw($1F0, Puint32(buffer + (i * 512) + (ii * 16))^);
|
outw($1F0, Puint32(buffer + (i * 512) + (ii * 16))^);
|
||||||
|
while true do if (inw($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
|
||||||
|
outb($1F7, $E7);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -260,7 +270,9 @@ procedure readPIO28(drive : uint8; LBA : uint32; sectorCount : uint8; buffer : p
|
|||||||
var
|
var
|
||||||
i : uint8;
|
i : uint8;
|
||||||
ii : uint8;
|
ii : uint8;
|
||||||
|
iii : uint32;
|
||||||
begin
|
begin
|
||||||
|
console.writestringln('Starting read test');
|
||||||
if IDEDevices[drive].isMaster then begin
|
if IDEDevices[drive].isMaster then begin
|
||||||
outb($1F7, $E0 or ((LBA shr 24) and $0F)); //read command primary master
|
outb($1F7, $E0 or ((LBA shr 24) and $0F)); //read command primary master
|
||||||
end
|
end
|
||||||
@ -281,11 +293,16 @@ begin
|
|||||||
|
|
||||||
while true do begin
|
while true do begin
|
||||||
if (inw($1f7) and (1 shl 3)) <> 0 then break;
|
if (inw($1f7) and (1 shl 3)) <> 0 then break;
|
||||||
if (inw($1F7) and 1) <> 0 then exit; //drive error
|
if (inw($1F7) and 1) <> 0 then begin
|
||||||
|
console.writestringln('IDE read ERROR');
|
||||||
|
exit;
|
||||||
|
end; //drive error
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for ii:=0 to 255 do begin //read data
|
for ii:=0 to 254 do begin //read data
|
||||||
|
//console.writeintln(ii);
|
||||||
Puint32(buffer + (i * 512) + (ii * 16))^ := inw($1F0);
|
Puint32(buffer + (i * 512) + (ii * 16))^ := inw($1F0);
|
||||||
|
for iii:=0 to 10000 do if(ii = iii) then begin end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user