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