From da94b6303ea75f2b7b8e0b08fb9a96c730c894a4 Mon Sep 17 00:00:00 2001 From: Frank Gevaerts Date: Fri, 3 Jan 2014 23:55:39 +0100 Subject: Make fat test tool build again, and make its sector size configurable. Change-Id: Icfe7c4bb880c2f10918a7809f0f1f1c3838f6f48 --- firmware/test/fat/ata-sim.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'firmware/test/fat/ata-sim.c') 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 @@ #include #include "debug.h" -#define BLOCK_SIZE 512 - static FILE* file; void panicf( const char *fmt, ... ); @@ -17,11 +15,11 @@ int storage_read_sectors(unsigned long start, int count, void* buf) else DEBUGF("[Reading block 0x%lx]\n", start); - if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { + if(fseek(file,start*SECTOR_SIZE,SEEK_SET)) { perror("fseek"); return -1; } - if(!fread(buf,BLOCK_SIZE,count,file)) { + if(!fread(buf,SECTOR_SIZE,count,file)) { DEBUGF("ata_write_sectors(0x%lx, 0x%x, %p)\n", start, count, buf ); perror("fread"); panicf("Disk error\n"); @@ -40,11 +38,11 @@ int storage_write_sectors(unsigned long start, int count, void* buf) if (start == 0) panicf("Writing on sector 0!\n"); - if(fseek(file,start*BLOCK_SIZE,SEEK_SET)) { + if(fseek(file,start*SECTOR_SIZE,SEEK_SET)) { perror("fseek"); return -1; } - if(!fwrite(buf,BLOCK_SIZE,count,file)) { + if(!fwrite(buf,SECTOR_SIZE,count,file)) { DEBUGF("ata_write_sectors(0x%lx, 0x%x, %p)\n", start, count, buf ); perror("fwrite"); panicf("Disk error\n"); -- cgit v1.2.3