summaryrefslogtreecommitdiff
path: root/firmware/test/fat/ata-sim.c
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-10-31 19:06:14 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-10-31 19:06:14 +0000
commit6b104a6c69e3e77f399cdd34ac35648b492b3d75 (patch)
tree3d8c6a4be325a62199e03dc92933c2339e465dfd /firmware/test/fat/ata-sim.c
parent08356fb50a70bc44e598ff49ab61bd149060a668 (diff)
Improved tests.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2794 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/test/fat/ata-sim.c')
-rw-r--r--firmware/test/fat/ata-sim.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c
index 661cc79a1f..10bc3d9dc5 100644
--- a/firmware/test/fat/ata-sim.c
+++ b/firmware/test/fat/ata-sim.c
@@ -10,28 +10,23 @@ static FILE* file;
int ata_read_sectors(unsigned long start, unsigned char count, void* buf)
{
- int i;
- for (i=0; i<count; i++ )
- DEBUGF("[Reading block 0x%lx]\n",start+i);
+ DEBUGF("[Reading block 0x%lx, %d]\n", start, count);
if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) {
perror("fseek");
return -1;
}
if(!fread(buf,BLOCK_SIZE,count,file)) {
- printf("Failed reading %d blocks starting at block 0x%lx\n",count,start);
+ DEBUGF("ata_write_sectors(0x%x, 0x%x, 0x%x)\n", start, count, buf );
perror("fread");
panicf("Disk error\n");
- return -2;
}
return 0;
}
int ata_write_sectors(unsigned long start, unsigned char count, void* buf)
{
- int i;
- for (i=0; i<count; i++ )
- DEBUGF("[Writing block 0x%lx]\n",start+i);
+ DEBUGF("[Writing block 0x%lx, %d]\n", start, count);
if (start == 0)
panicf("Writing on sector 0!\n");
@@ -39,11 +34,10 @@ int ata_write_sectors(unsigned long start, unsigned char count, void* buf)
if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) {
perror("fseek");
return -1;
- panicf("Disk error\n");
}
if(!fwrite(buf,BLOCK_SIZE,count,file)) {
+ DEBUGF("ata_write_sectors(0x%x, 0x%x, 0x%x)\n", start, count, buf );
perror("fwrite");
- return -2;
panicf("Disk error\n");
}
return 0;