diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c index 10bc3d9dc5..04cdadb6ce 100644 --- a/firmware/test/fat/ata-sim.c +++ b/firmware/test/fat/ata-sim.c @@ -10,7 +10,11 @@ static FILE* file; int ata_read_sectors(unsigned long start, unsigned char count, void* buf) { - DEBUGF("[Reading block 0x%lx, %d]\n", start, count); + if ( count > 1 ) + DEBUGF("[Reading %d blocks: 0x%lx to 0x%lx]\n", + count, start, start+count-1); + else + DEBUGF("[Reading block 0x%lx, %d]\n", start, count); if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { perror("fseek"); @@ -26,7 +30,11 @@ int ata_read_sectors(unsigned long start, unsigned char count, void* buf) int ata_write_sectors(unsigned long start, unsigned char count, void* buf) { - DEBUGF("[Writing block 0x%lx, %d]\n", start, count); + if ( count > 1 ) + DEBUGF("[Writing %d blocks: 0x%lx to 0x%lx]\n", + count, start, start+count-1); + else + DEBUGF("[Writing block 0x%lx]\n", start); if (start == 0) panicf("Writing on sector 0!\n"); diff --git a/firmware/test/fat/main.c b/firmware/test/fat/main.c index ab71308abb..68cef1f08c 100644 --- a/firmware/test/fat/main.c +++ b/firmware/test/fat/main.c @@ -125,9 +125,9 @@ int dbg_mkfile(char* name, int num) return 0; } -int dbg_chkfile(char* name) +int dbg_chkfile(char* name, int size) { - char text[8192]; + char text[81920]; int i; int x=0; int block=0; @@ -136,6 +136,13 @@ int dbg_chkfile(char* name) DEBUGF("Failed opening file\n"); return -1; } + + if (size) { + lseek(fd, size*512, SEEK_SET); + x = size * 1024 / 16; + LDEBUGF("Check base is %x\n",x); + } + while (1) { int rc = read(fd, text, sizeof text); DEBUGF("read %d bytes\n",rc); @@ -343,8 +350,12 @@ int dbg_cmd(int argc, char *argv[]) if (!strcasecmp(cmd, "chkfile")) { - if (arg1) - return dbg_chkfile(arg1); + if (arg1) { + if (arg2) + return dbg_chkfile(arg1, atoi(arg2)); + else + return dbg_chkfile(arg1, 0); + } } return 0; diff --git a/firmware/test/fat/test.sh b/firmware/test/fat/test.sh index 2f58b3cb81..f723f69ec3 100644 --- a/firmware/test/fat/test.sh +++ b/firmware/test/fat/test.sh @@ -34,22 +34,27 @@ runtests() { echo ---Test: create a 10K file try mkfile /apa.txt 10 check - try chkfile /apa.txt + try chkfile /apa.txt 10 echo ---Test: create a 1K file try mkfile /bpa.txt 1 check - try chkfile /bpa.txt + try chkfile /bpa.txt 1 echo ---Test: create a 40K file try mkfile /cpa.txt 40 check - try chkfile /cpa.txt + try chkfile /cpa.txt 40 + + echo ---Test: create a 400K file + try mkfile /dpa.txt 400 + check + try chkfile /dpa.txt 400 echo ---Test: truncate previous 40K file to 20K try mkfile /cpa.txt 20 check - try chkfile /cpa.txt + try chkfile /cpa.txt 20 echo ---Test: truncate previous 20K file to 0K try mkfile /cpa.txt 0 @@ -59,14 +64,15 @@ runtests() { try chkfile /bpa.txt LOOP=50 + SIZE=50 - echo ---Test: create $LOOP 40k files + echo ---Test: create $LOOP $SIZE k files for i in `seq 1 $LOOP`; do echo ---Test: $i/$LOOP --- - try mkfile /rockbox.$i 40 + try mkfile /rockbox.$i $SIZE check - try chkfile /rockbox.$i + try chkfile /rockbox.$i $SIZE done }