Commit 25771e77 authored by John Ballance's avatar John Ballance
Browse files

More work on filecore format routine.

Detail:
   The routine embedded in the sources will now write a correct filecore format
   across the full range of IDLen values, though in use it will generally select
   the largest IDLen value as this permits the most files to be stored on disc.
Admin:
   tested in iMx6


Version 0.13. Tagged as 'PartMan-0_13'
parent 728edb85
Dir <Obey$Dir>
amu -f MakeFmtTester THROWBACK=-throwback
amu -f MakeFmtTester THROWBACK=-throwback CDEFINES="-DDebug"
Dir <Obey$Dir>
amu -f MakeGPTTST THROWBACK=-throwback
amu -f MakeGPTTST THROWBACK=-throwback CDEFINES="-DDebug"
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.12"
Module_Version SETA 12
Module_MajorVersion SETS "0.13"
Module_Version SETA 13
Module_MinorVersion SETS ""
Module_Date SETS "11 Dec 2016"
Module_ApplicationDate SETS "11-Dec-16"
Module_Date SETS "09 Jan 2017"
Module_ApplicationDate SETS "09-Jan-17"
Module_ComponentName SETS "PartMan"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/SCSIFS/PartMan"
Module_FullVersion SETS "0.12"
Module_HelpVersion SETS "0.12 (11 Dec 2016)"
Module_FullVersion SETS "0.13"
Module_HelpVersion SETS "0.13 (09 Jan 2017)"
END
/* (0.12)
/* (0.13)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.12
#define Module_MajorVersion_CMHG 0.13
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 11 Dec 2016
#define Module_Date_CMHG 09 Jan 2017
#define Module_MajorVersion "0.12"
#define Module_Version 12
#define Module_MajorVersion "0.13"
#define Module_Version 13
#define Module_MinorVersion ""
#define Module_Date "11 Dec 2016"
#define Module_Date "09 Jan 2017"
#define Module_ApplicationDate "11-Dec-16"
#define Module_ApplicationDate "09-Jan-17"
#define Module_ComponentName "PartMan"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/SCSIFS/PartMan"
#define Module_FullVersion "0.12"
#define Module_HelpVersion "0.12 (11 Dec 2016)"
#define Module_LibraryVersionInfo "0:12"
#define Module_FullVersion "0.13"
#define Module_HelpVersion "0.13 (09 Jan 2017)"
#define Module_LibraryVersionInfo "0:13"
......@@ -77,16 +77,16 @@ void reportfmt(FormatArray* fmt)
{
testprint("\nfmt->log2secsize %x",fmt->log2secsize);
testprint("\nfmt->idlen %d",fmt->idlen);
testprint("\nfmt->idlen %x",fmt->idlen);
testprint("\nfmt->log2bpmb %x",fmt->log2bpmb );
testprint("\n (LFAU) %x",1<<fmt->log2bpmb );
testprint("\nfmt->zonecount %d",fmt->zonecount);
testprint("\nfmt->zonecount %x",fmt->zonecount);
testprint("\nfmt->zonecount2 %x",fmt->zonecount2);
testprint("\nfmt->zonetotal &%x %d",fmt->zonec,fmt->zonec);
testprint("\nfmt->bigdisc %x",fmt->bigdisc);
testprint("\nfmt->bigdir %x",fmt->bigdir);
testprint("\nfmt->zonespare %d",fmt->zonespare);
testprint("\nfmt->SecSize %d",fmt->SecSize);
testprint("\nfmt->zonespare %x",fmt->zonespare);
testprint("\nfmt->SecSize %x",fmt->SecSize);
testprint("\nfmt->SecCount %x",fmt->SecCount);
testprint("\nfmt->endzonebits %x",fmt->endzonebits);
testprint("\nfmt->rootaddress %x",fmt->rootaddress);
......@@ -95,7 +95,7 @@ void reportfmt(FormatArray* fmt)
testprint("\nfmt->mapbase %x",fmt->mapbase);
testprint("\nfmt->discsize %x",fmt->discsize);
testprint("\nfmt->discsizehi %x",fmt->discsizehi);
testprint("\nfmt->sharesize %d",fmt->sharesize);
testprint("\nfmt->log2zsize %x",fmt->log2zsize);
testprint("\nfmt->newshsize %x",fmt->newsharesize);
testprint("\nfmt->mapbits %x",fmt->mapbits);
testprint("\nfmt->dirbits %x",fmt->dirbits);
......@@ -112,7 +112,7 @@ void reportfmt(FormatArray* fmt)
testprint("\nfmt->heads %d",fmt->heads);
testprint("\nfmt->density %x",fmt->density);
testprint("\nfmt->skew %x",fmt->skew);
testprint("\n");
}
void reportAcornBootSec(disc_record* dr)
{
......@@ -128,9 +128,9 @@ void reportAcornBootSec(disc_record* dr)
testprint("\nzonespare %x",dr->zonespare[0]+(dr->zonespare[1]<<8));
testprint("\nroot %x",dr->root);
testprint("\ndiscsize %08x%08x",dr->discsizehi,dr->discsize);
testprint("\ndiscid %04x",dr->discid[1]+(dr->discid[0]<<8));
testprint("\ndiscid %04x",dr->discid[0]+(dr->discid[1]<<8));
testprint("\ndiscname %10s",dr->discname);
testprint("\nsharesize %d",dr->sharesize);
testprint("\nlog2zsize %d",dr->log2zsize);
testprint("\nbigflag %d",dr->bigflag);
testprint("\nformatversn %x",dr->formatversion);
testprint("\nrootdirsize %x\n",dr->rootdirsize);
......
This diff is collapsed.
......@@ -232,6 +232,7 @@ bool CheckGPTValid(int device)
}
}
}
// return leaving all pointers in place
return true;
}
// convert GUID in string format to binary
......@@ -457,7 +458,7 @@ void ReadGPTInfo(int device)
// returns partition pointer, or NULL if partition not there
GUIDPartn* ReturnGPTPartionInfo ( int ID, int partition)
{
GUIDPartn * gp;
static GUIDPartn * gp;
if(CheckGPTValid(ID))
{
gp=calloc(1,sizeof(struct GUIDPartn));
......
......@@ -111,6 +111,7 @@ int main (int argc,char* argv[])
strncpy(FPp->discname,"Filecore7",FPNameLenMAX);
}
_swix(OS_Module,_INR(0,1) ,3, "SCSIFS");
_swix(OS_ServiceCall,_INR(0,2),ID,Service_SCSIDetached,0x7);
......@@ -129,11 +130,13 @@ int main (int argc,char* argv[])
freepointers();
}
else
{
testprint(" CheckGPTValid returned false\n");
}
printf("Checked and completed\n");
{
testprint(" CheckGPTValid returned false\n");
}
_swix(OS_ServiceCall,_INR(0,2),ID,Service_SCSIAttached,0x7);
printf("Completed\n");
}
void wimp_error(_kernel_oserror *er)
......
......@@ -41,27 +41,48 @@ int main (int argc,char* argv[])
testfileinit ();
ReadDiscCapacity(ID, OverrideKey,&capacity,&sectorsize);
if(argc==2)
{
int param=0;
sscanf(argv[1],"%x",&param);
if (!((param)&&(param>((2<<20)/sectorsize))&&(param<capacity)))
{
printf("Either *fmat_tst with no parameters to format the disc full size\n or *fmat_tst <n> where n is between %x and %x\n",((2<<20)/sectorsize),capacity);
return NULL;
}
else
{
capacity=param;
}
}
if(sectorsize>0&&ID!=preventID)
{
// buf[0]=0;
// ReadAcornPartitionName(ID,OverrideKey,04,buf,sectorsize);
// testprint("buf:%s\n",buf);
testprint("capacity to be used %x\n",capacity);
printf("Formatting disc with single partition size %x sectors\n",capacity);
_swix(OS_Module,_INR(0,1) ,3, "SCSIFS");
_swix(OS_ServiceCall,_INR(0,2),ID,Service_SCSIDetached,0x7);
// write a empty MBR dos header just to ensure we're in control
// 0 means write
e=NukeBootSectors(ID);
if(e) wimp_error(e);
MakeAcornFormat(ID,OverrideKey,sectorsize,0,capacity,"SingleAcrn", defect,2,1);
// MakeDosFormat(ID,OverrideKey,sectorsize,0,capacity-1,capacity-1,"testdosx", defect,dospart,1);
//MakeDosFormat (1,0xfc000003,0x200,0xf4000, 0xf4000,0xf4000,"testdos",defect,1,2);
// MakeAcornFormat(1,0xfc000003,0x200,0xf4000<<1,0xf40,"test2",defect,2,1);
_swix(OS_ServiceCall,_INR(0,2),ID,Service_SCSIAttached,0x7);
}
else
{
printf("Suspect sector size %x found \n",sectorsize);
}
(void) argc;
(void) argv;
(void) dospart;
printf("Completed\n");
}
void wimp_error(_kernel_oserror *er)
......
......@@ -17,8 +17,6 @@
// Format defines etc
#include "FormatDef.h"
int BuildAcornLayout(FormatArray* fmt,bootsector* bs);
int MakeAcornFormat(int ID,
unsigned int AccessKey,
int SecSize,
......@@ -54,10 +52,10 @@ void DefectChecksum(int *defect, int disctype);
_kernel_oserror* ReadAcornPartitionName(int ID, unsigned int AccessKey, int PartitionOffset, char *Name, int sectorsize);
void ComputeAcornLayout(FormatArray* fmt);
void fragwrite(char* mapsector, int position, int FragmentID, int FragmentLen, int IDlen);
_kernel_oserror* FormatPartition( int ID, FormatParamsp FP, int sectorsize);
void MakeRootDir(int bigdir , char* map, int rootaddress);
#endif
......@@ -9,20 +9,23 @@ char l2secsize;
char spt;
char heads;
char density;
char idlen;
char l2bpmb;
char skew;
char bootoption;
char lowsector;
char nzones;
char zonespare[2];
char zonespare[2]; // looks like only low byte used
int root;
int discsize;
char discid[2];
char discname[10];
int disctype;
int discsizehi;
char sharesize; // max 0xf
char log2zsize; // max 0xf
char bigflag;
char nzones2;
char bdspare1; // must be 0
......
......@@ -27,7 +27,7 @@ unsigned char zonecount2; // input: zone count hi byte (bigdir)
unsigned char bigdisc; // input: 1 if => 512 MBytes disc
unsigned char bigdir; // input: 1 if big directory disc
unsigned int zonec; // zonecount work register
unsigned int sharesize; // input: log 2 of bigdisc sharesize
unsigned int log2zsize; // input: log 2 of zone count
unsigned int zonespare; // input: spare bits in zone
unsigned int SecSize; // input: sector size, bytes
unsigned int SecCount; // input: disc length in sectors
......@@ -52,6 +52,7 @@ unsigned int fragmentzonenorm; // result: fragments in main zones
unsigned int fragmentzonelast; // result: fragments in last zone
unsigned int zonesparefound; // result: zonespare bits computed
unsigned int zone0sparefound; // result: zone0spare bits computed
unsigned int NewSecCount; // result: sectors used
unsigned int cyls; // result: cylinders
unsigned char spt; // result: secs per trk
unsigned char heads; // result: heads
......
......@@ -100,6 +100,7 @@ typedef struct GPTHeader {
#define GUID_unused "00000000-0000-0000-0000-000000000000"
#define GUID_EFISysPartn "C12A7328-F81F-11D2-BA4B-00A0C93EC93B"
#define GUID_LegacyMBR "024DEE41-33E7-11D3-9D69-0008C781F39F"
// this below is a 'basic data partition'
#define GUID_WinNormal "EBD0A0A2-B9E5-4433-87C0-6866672699C7"
// 'INVENTED' Filecore type partition "FilecoreType0001"
#define GUID_Filecore "656C6946-6F63-6572-5479-706530303031"
......
......@@ -39,6 +39,6 @@
#include "FormatBits.h"
#include "SectorRW.h"
void wimp_error(_kernel_oserror *er);
extern void wimp_error(_kernel_oserror *er);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment