diff options
Diffstat (limited to 'firmware/test/fat/ata-sim.c')
-rw-r--r-- | firmware/test/fat/ata-sim.c | 14 |
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; | |||
10 | 10 | ||
11 | int ata_read_sectors(unsigned long start, unsigned char count, void* buf) | 11 | int ata_read_sectors(unsigned long start, unsigned char count, void* buf) |
12 | { | 12 | { |
13 | int i; | 13 | DEBUGF("[Reading block 0x%lx, %d]\n", start, count); |
14 | for (i=0; i<count; i++ ) | ||
15 | DEBUGF("[Reading block 0x%lx]\n",start+i); | ||
16 | 14 | ||
17 | if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { | 15 | if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { |
18 | perror("fseek"); | 16 | perror("fseek"); |
19 | return -1; | 17 | return -1; |
20 | } | 18 | } |
21 | if(!fread(buf,BLOCK_SIZE,count,file)) { | 19 | if(!fread(buf,BLOCK_SIZE,count,file)) { |
22 | printf("Failed reading %d blocks starting at block 0x%lx\n",count,start); | 20 | DEBUGF("ata_write_sectors(0x%x, 0x%x, 0x%x)\n", start, count, buf ); |
23 | perror("fread"); | 21 | perror("fread"); |
24 | panicf("Disk error\n"); | 22 | panicf("Disk error\n"); |
25 | return -2; | ||
26 | } | 23 | } |
27 | return 0; | 24 | return 0; |
28 | } | 25 | } |
29 | 26 | ||
30 | int ata_write_sectors(unsigned long start, unsigned char count, void* buf) | 27 | int ata_write_sectors(unsigned long start, unsigned char count, void* buf) |
31 | { | 28 | { |
32 | int i; | 29 | DEBUGF("[Writing block 0x%lx, %d]\n", start, count); |
33 | for (i=0; i<count; i++ ) | ||
34 | DEBUGF("[Writing block 0x%lx]\n",start+i); | ||
35 | 30 | ||
36 | if (start == 0) | 31 | if (start == 0) |
37 | panicf("Writing on sector 0!\n"); | 32 | panicf("Writing on sector 0!\n"); |
@@ -39,11 +34,10 @@ int ata_write_sectors(unsigned long start, unsigned char count, void* buf) | |||
39 | if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { | 34 | if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { |
40 | perror("fseek"); | 35 | perror("fseek"); |
41 | return -1; | 36 | return -1; |
42 | panicf("Disk error\n"); | ||
43 | } | 37 | } |
44 | if(!fwrite(buf,BLOCK_SIZE,count,file)) { | 38 | if(!fwrite(buf,BLOCK_SIZE,count,file)) { |
39 | DEBUGF("ata_write_sectors(0x%x, 0x%x, 0x%x)\n", start, count, buf ); | ||
45 | perror("fwrite"); | 40 | perror("fwrite"); |
46 | return -2; | ||
47 | panicf("Disk error\n"); | 41 | panicf("Disk error\n"); |
48 | } | 42 | } |
49 | return 0; | 43 | return 0; |