summaryrefslogtreecommitdiff
path: root/firmware/test/fat/ata-sim.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/test/fat/ata-sim.c')
-rw-r--r--firmware/test/fat/ata-sim.c10
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
8static FILE* file; 6static FILE* file;
9 7
10void panicf( const char *fmt, ... ); 8void 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");