diff options
author | Frank Gevaerts <frank@gevaerts.be> | 2014-01-03 23:55:39 +0100 |
---|---|---|
committer | Frank Gevaerts <frank@gevaerts.be> | 2014-01-03 23:57:32 +0100 |
commit | da94b6303ea75f2b7b8e0b08fb9a96c730c894a4 (patch) | |
tree | f52dd76bb5f6ee2feaf7c5189e6d389e2ef456cb /firmware/test/fat/ata-sim.c | |
parent | 062801e3ed560418264a0fc7954a2008102a4713 (diff) | |
download | rockbox-da94b6303ea75f2b7b8e0b08fb9a96c730c894a4.tar.gz rockbox-da94b6303ea75f2b7b8e0b08fb9a96c730c894a4.zip |
Make fat test tool build again, and make its sector size configurable.
Change-Id: Icfe7c4bb880c2f10918a7809f0f1f1c3838f6f48
Diffstat (limited to 'firmware/test/fat/ata-sim.c')
-rw-r--r-- | firmware/test/fat/ata-sim.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/firmware/test/fat/ata-sim.c b/firmware/test/fat/ata-sim.c index 98fd5adc28..07b772f433 100644 --- a/firmware/test/fat/ata-sim.c +++ b/firmware/test/fat/ata-sim.c | |||
@@ -3,8 +3,6 @@ | |||
3 | #include <string.h> | 3 | #include <string.h> |
4 | #include "debug.h" | 4 | #include "debug.h" |
5 | 5 | ||
6 | #define BLOCK_SIZE 512 | ||
7 | |||
8 | static FILE* file; | 6 | static FILE* file; |
9 | 7 | ||
10 | void panicf( const char *fmt, ... ); | 8 | void panicf( const char *fmt, ... ); |
@@ -17,11 +15,11 @@ int storage_read_sectors(unsigned long start, int count, void* buf) | |||
17 | else | 15 | else |
18 | DEBUGF("[Reading block 0x%lx]\n", start); | 16 | DEBUGF("[Reading block 0x%lx]\n", start); |
19 | 17 | ||
20 | if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { | 18 | if(fseek(file,start*SECTOR_SIZE,SEEK_SET)) { |
21 | perror("fseek"); | 19 | perror("fseek"); |
22 | return -1; | 20 | return -1; |
23 | } | 21 | } |
24 | if(!fread(buf,BLOCK_SIZE,count,file)) { | 22 | if(!fread(buf,SECTOR_SIZE,count,file)) { |
25 | DEBUGF("ata_write_sectors(0x%lx, 0x%x, %p)\n", start, count, buf ); | 23 | DEBUGF("ata_write_sectors(0x%lx, 0x%x, %p)\n", start, count, buf ); |
26 | perror("fread"); | 24 | perror("fread"); |
27 | panicf("Disk error\n"); | 25 | panicf("Disk error\n"); |
@@ -40,11 +38,11 @@ int storage_write_sectors(unsigned long start, int count, void* buf) | |||
40 | if (start == 0) | 38 | if (start == 0) |
41 | panicf("Writing on sector 0!\n"); | 39 | panicf("Writing on sector 0!\n"); |
42 | 40 | ||
43 | if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { | 41 | if(fseek(file,start*SECTOR_SIZE,SEEK_SET)) { |
44 | perror("fseek"); | 42 | perror("fseek"); |
45 | return -1; | 43 | return -1; |
46 | } | 44 | } |
47 | if(!fwrite(buf,BLOCK_SIZE,count,file)) { | 45 | if(!fwrite(buf,SECTOR_SIZE,count,file)) { |
48 | DEBUGF("ata_write_sectors(0x%lx, 0x%x, %p)\n", start, count, buf ); | 46 | DEBUGF("ata_write_sectors(0x%lx, 0x%x, %p)\n", start, count, buf ); |
49 | perror("fwrite"); | 47 | perror("fwrite"); |
50 | panicf("Disk error\n"); | 48 | panicf("Disk error\n"); |