git-svn-id: https://spexeah.com:8443/svn/Asuro@673 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
2cbea55087
commit
680b758ee7
@ -223,6 +223,10 @@ begin
|
|||||||
storageDevice.controller := ControllerIDE;
|
storageDevice.controller := ControllerIDE;
|
||||||
storageDevice.controllerId0:= 0;
|
storageDevice.controllerId0:= 0;
|
||||||
storageDevice.maxSectorCount:= (IDEDevices[0].info[60] or (IDEDevices[0].info[61] shl 16) ); //LBA28 SATA
|
storageDevice.maxSectorCount:= (IDEDevices[0].info[60] or (IDEDevices[0].info[61] shl 16) ); //LBA28 SATA
|
||||||
|
|
||||||
|
console.writeintln(storageDevice.maxSectorCount);
|
||||||
|
redrawWindows();
|
||||||
|
|
||||||
storageDevice.sectorSize:= 512;
|
storageDevice.sectorSize:= 512;
|
||||||
if storageDevice.maxSectorCount <> 0 then begin
|
if storageDevice.maxSectorCount <> 0 then begin
|
||||||
IDEDevices[0].exists:= true;
|
IDEDevices[0].exists:= true;
|
||||||
@ -244,7 +248,7 @@ begin
|
|||||||
IDEDevices[1].exists:= true;
|
IDEDevices[1].exists:= true;
|
||||||
storageDevice1.readCallback:= @read;
|
storageDevice1.readCallback:= @read;
|
||||||
storageDevice1.writeCallback:= @write;
|
storageDevice1.writeCallback:= @write;
|
||||||
storagemanagement.register_device(@storageDevice1);
|
//storagemanagement.register_device(@storageDevice1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -299,7 +303,7 @@ begin
|
|||||||
t +=1;
|
t +=1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
for i:=0 to 254 do begin
|
for i:=0 to 255 do begin
|
||||||
identResponse[i] := inw($1F0); //read all bits
|
identResponse[i] := inw($1F0); //read all bits
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -393,17 +397,39 @@ begin
|
|||||||
|
|
||||||
for i:=0 to sectorCount do begin
|
for i:=0 to sectorCount do begin
|
||||||
|
|
||||||
|
console.writeintln(11);
|
||||||
|
redrawWindows();
|
||||||
|
|
||||||
//poll status
|
//poll status
|
||||||
while true do if (inw($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
|
while true do if (inw($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
|
||||||
|
|
||||||
|
|
||||||
|
console.writeintln(12);
|
||||||
|
redrawWindows();
|
||||||
|
|
||||||
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 shl 5)) <> 0 then begin
|
||||||
|
console.writestringln('IDE DRIVE FAULT');
|
||||||
|
redrawWindows();
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if (inw($1f7) and (1 shl 6)) <> 0 then begin
|
||||||
|
console.writestringln('IDE Spun Down');
|
||||||
|
redrawWindows();
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
if (inw($1F7) and 1) <> 0 then begin
|
if (inw($1F7) and 1) <> 0 then begin
|
||||||
console.writestringln('IDE read ERROR');
|
console.writestringln('IDE read ERROR');
|
||||||
|
redrawWindows();
|
||||||
exit;
|
exit;
|
||||||
end; //drive error
|
end; //drive error
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
console.writeintln(13);
|
||||||
|
redrawWindows();
|
||||||
|
|
||||||
for ii:=0 to 127 do begin //read data
|
for ii:=0 to 127 do begin //read data
|
||||||
Puint32(buffer + ((i * 512) + (ii * 32) DIV 32))^ := uint32(inw($1F0));
|
Puint32(buffer + ((i * 512) + (ii * 32) DIV 32))^ := uint32(inw($1F0));
|
||||||
while true do if (inw($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
|
while true do if (inw($1f7) and (1 shl 7)) = 0 then break; //Wait until drive not busy
|
||||||
|
@ -319,6 +319,7 @@ var
|
|||||||
ii : uint32 = 0;
|
ii : uint32 = 0;
|
||||||
dirEntry : PDirectory;
|
dirEntry : PDirectory;
|
||||||
begin
|
begin
|
||||||
|
status^:= 0;
|
||||||
bootRecord:= readBootRecord(volume);
|
bootRecord:= readBootRecord(volume);
|
||||||
directoryStrings:= LL_fromString(directory, '/');
|
directoryStrings:= LL_fromString(directory, '/');
|
||||||
directories:= getDirEntries(volume, bootRecord^.rootCluster, bootRecord);
|
directories:= getDirEntries(volume, bootRecord^.rootCluster, bootRecord);
|
||||||
@ -328,7 +329,10 @@ begin
|
|||||||
ii:=0;
|
ii:=0;
|
||||||
|
|
||||||
while true do begin
|
while true do begin
|
||||||
if ii > LL_Size(directories) - 1 then break;
|
if ii > LL_Size(directories) - 1 then begin
|
||||||
|
status^:= 1;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
dirEntry:= PDirectory(LL_Get(directories, ii));
|
dirEntry:= PDirectory(LL_Get(directories, ii));
|
||||||
|
|
||||||
if compareByteArray8( dirEntry^.fileName, cleanString( pchar(puint32(LL_Get(directoryStrings, i))^) ) ) then begin
|
if compareByteArray8( dirEntry^.fileName, cleanString( pchar(puint32(LL_Get(directoryStrings, i))^) ) ) then begin
|
||||||
@ -338,6 +342,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
ii+=1;
|
ii+=1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if status^ <> 0 then break;
|
||||||
|
|
||||||
LL_Free(directories); //TODO need to really free the things
|
LL_Free(directories); //TODO need to really free the things
|
||||||
directories:= getDirEntries(volume, cluster, bootRecord);
|
directories:= getDirEntries(volume, cluster, bootRecord);
|
||||||
@ -434,6 +440,8 @@ begin
|
|||||||
LL_Free(directories);
|
LL_Free(directories);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
//procedure writeFile()
|
||||||
|
|
||||||
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
procedure create_volume(disk : PStorage_Device; sectors : uint32; start : uint32; config : puint32);
|
||||||
var
|
var
|
||||||
buffer : puint32;
|
buffer : puint32;
|
||||||
@ -456,15 +464,15 @@ var
|
|||||||
begin
|
begin
|
||||||
push_trace('fat32.create_volume()');
|
push_trace('fat32.create_volume()');
|
||||||
|
|
||||||
zeroBuffer:= puint32(kalloc( disk^.sectorSize * 4 ));
|
// zeroBuffer:= puint32(kalloc( disk^.sectorSize * 4 ));
|
||||||
memset(uint32(zeroBuffer), 0, disk^.sectorSize * 4);
|
// memset(uint32(zeroBuffer), 0, disk^.sectorSize * 4);
|
||||||
|
|
||||||
while true do begin
|
// while true do begin
|
||||||
if i > sectors then break;
|
// if i > sectors then break;
|
||||||
disk^.writecallback(disk, 1 + i, 1, zeroBuffer);
|
// disk^.writecallback(disk, 1 + i, 1, zeroBuffer);
|
||||||
i+=1;
|
// i+=1;
|
||||||
end;
|
// end;
|
||||||
kfree(zeroBuffer);
|
// kfree(zeroBuffer);
|
||||||
|
|
||||||
//fat32 structure
|
//fat32 structure
|
||||||
(* BootRecord *)
|
(* BootRecord *)
|
||||||
@ -505,11 +513,11 @@ begin
|
|||||||
zeroBuffer:= puint32(kalloc( disk^.sectorSize * 4 ));
|
zeroBuffer:= puint32(kalloc( disk^.sectorSize * 4 ));
|
||||||
memset(uint32(zeroBuffer), 0, disk^.sectorSize * 4);
|
memset(uint32(zeroBuffer), 0, disk^.sectorSize * 4);
|
||||||
|
|
||||||
// while true do begin
|
while true do begin
|
||||||
// if i > FATSize then break;
|
if i > FATSize then break;
|
||||||
// disk^.writecallback(disk, fatStart + i, 1, zeroBuffer);
|
disk^.writecallback(disk, fatStart + i, 1, zeroBuffer);
|
||||||
// i+=4;
|
i+=4;
|
||||||
// end;
|
end;
|
||||||
|
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
kfree(zeroBuffer);
|
kfree(zeroBuffer);
|
||||||
@ -565,8 +573,8 @@ var
|
|||||||
dirs : PLinkedListBase;
|
dirs : PLinkedListBase;
|
||||||
begin
|
begin
|
||||||
push_trace('fat32.detectVolumes()');
|
push_trace('fat32.detectVolumes()');
|
||||||
redrawWindows();
|
console.writeintln(2);
|
||||||
//sleep(1);
|
redrawWindows();
|
||||||
|
|
||||||
volume:= PStorage_volume(kalloc(sizeof(TStorage_Volume)));
|
volume:= PStorage_volume(kalloc(sizeof(TStorage_Volume)));
|
||||||
//check first address for MBR
|
//check first address for MBR
|
||||||
@ -575,6 +583,9 @@ begin
|
|||||||
memset(uint32(buffer), 0, 512);
|
memset(uint32(buffer), 0, 512);
|
||||||
disk^.readcallback(disk, 2, 1, buffer);
|
disk^.readcallback(disk, 2, 1, buffer);
|
||||||
|
|
||||||
|
console.writeintln(3);
|
||||||
|
redrawWindows();
|
||||||
|
|
||||||
if (puint32(buffer)[127] = $55AA) and (PBootRecord(buffer)^.bsignature = $29) then begin
|
if (puint32(buffer)[127] = $55AA) and (PBootRecord(buffer)^.bsignature = $29) then begin
|
||||||
console.writestringln('FAT32: volume found!');
|
console.writestringln('FAT32: volume found!');
|
||||||
volume^.device:= disk;
|
volume^.device:= disk;
|
||||||
@ -584,6 +595,7 @@ begin
|
|||||||
volume^.filesystem := @filesystem;
|
volume^.filesystem := @filesystem;
|
||||||
storagemanagement.register_volume(disk, volume);
|
storagemanagement.register_volume(disk, volume);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
kfree(buffer);
|
kfree(buffer);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ uses
|
|||||||
type
|
type
|
||||||
|
|
||||||
TControllerType = (ControllerIDE, ControllerUSB, ControllerAHCI, ControllerNET);
|
TControllerType = (ControllerIDE, ControllerUSB, ControllerAHCI, ControllerNET);
|
||||||
|
TDirectory_Entry_Type = (Directory, Data, Executable, Mounted);
|
||||||
PStorage_volume = ^TStorage_Volume;
|
PStorage_volume = ^TStorage_Volume;
|
||||||
PStorage_device = ^TStorage_Device;
|
PStorage_device = ^TStorage_Device;
|
||||||
APStorage_Volume = array[0..10] of PStorage_volume;
|
APStorage_Volume = array[0..10] of PStorage_volume;
|
||||||
@ -74,6 +75,13 @@ type
|
|||||||
end;
|
end;
|
||||||
APStorage_Device = array[0..255] of PStorage_device;
|
APStorage_Device = array[0..255] of PStorage_device;
|
||||||
|
|
||||||
|
TDirectory_Entry = record //TODO implement dtae.time stuff
|
||||||
|
fileName : pchar;
|
||||||
|
extension : pchar;
|
||||||
|
volume : PStorage_Volume;
|
||||||
|
entryType : TDirectory_Entry_Type;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
var
|
var
|
||||||
storageDevices : PLinkedListBase; //index in this array is global drive id
|
storageDevices : PLinkedListBase; //index in this array is global drive id
|
||||||
@ -208,17 +216,19 @@ var
|
|||||||
dirp : PDirectory;
|
dirp : PDirectory;
|
||||||
device : PStorage_Device;
|
device : PStorage_Device;
|
||||||
volume : PStorage_Volume;
|
volume : PStorage_Volume;
|
||||||
error : uint32;
|
error : puint32;
|
||||||
i : uint32;
|
i : uint32;
|
||||||
begin
|
begin
|
||||||
push_trace('ls');
|
push_trace('ls');
|
||||||
|
|
||||||
|
error:= puint32(kalloc(4));
|
||||||
|
|
||||||
if paramCount(params) > 0 then begin
|
if paramCount(params) > 0 then begin
|
||||||
dir := getParam(0, params);
|
dir := getParam(0, params);
|
||||||
|
|
||||||
device:= PStorage_Device(LL_Get(storageDevices, 0));
|
device:= PStorage_Device(LL_Get(storageDevices, 0));
|
||||||
volume:= PStorage_Volume(LL_Get(device^.volumes, 0));
|
volume:= PStorage_Volume(LL_Get(device^.volumes, 0));
|
||||||
dirs:= volume^.filesystem^.readDirCallback(volume, dir, @error);
|
dirs:= volume^.filesystem^.readDirCallback(volume, dir, error);
|
||||||
|
|
||||||
//if error <> 1 then console.writestringln('ERROR');
|
//if error <> 1 then console.writestringln('ERROR');
|
||||||
for i:=2 to LL_Size(dirs) - 1 do begin
|
for i:=2 to LL_Size(dirs) - 1 do begin
|
||||||
@ -232,6 +242,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure volume_command(params : PParamList);
|
procedure volume_command(params : PParamList);
|
||||||
var
|
var
|
||||||
i : uint32;
|
i : uint32;
|
||||||
|
@ -3,20 +3,20 @@ unit asuro;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
const
|
const
|
||||||
VERSION = '1.0.1-670ia';
|
VERSION = '1.0.1-672ia';
|
||||||
VERSION_MAJOR = '1';
|
VERSION_MAJOR = '1';
|
||||||
VERSION_MINOR = '0';
|
VERSION_MINOR = '0';
|
||||||
VERSION_SUB = '1';
|
VERSION_SUB = '1';
|
||||||
REVISION = '670';
|
REVISION = '672';
|
||||||
RELEASE = 'ia';
|
RELEASE = 'ia';
|
||||||
LINE_COUNT = 27481;
|
LINE_COUNT = 28133;
|
||||||
FILE_COUNT = 88;
|
FILE_COUNT = 89;
|
||||||
DRIVER_COUNT = 32;
|
DRIVER_COUNT = 33;
|
||||||
FPC_VERSION = '2.6.4';
|
FPC_VERSION = '2.6.4';
|
||||||
NASM_VERSION = '2.10.09';
|
NASM_VERSION = '2.10.09';
|
||||||
MAKE_VERSION = '3.81';
|
MAKE_VERSION = '3.81';
|
||||||
COMPILE_DATE = '07/05/18';
|
COMPILE_DATE = '08/05/18';
|
||||||
COMPILE_TIME = '22:56:53';
|
COMPILE_TIME = '00:44:47';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user