summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2003-04-24 18:33:32 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2003-04-24 18:33:32 +0000
commitcc6183e73c80cfc7449bfee78101220a36562518 (patch)
tree966cce0864b8f91400ac6cb9269b9f24ecaf7930 /firmware
parente4e466504d86f83b1a3a6bd51a2d1e2ce895093d (diff)
More detailed error codes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@3605 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/fat.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 7d87a8ae9c..8f4e3e0632 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -1481,7 +1481,7 @@ static int next_write_cluster(struct fat_file* file,
return cluster;
}
-static bool transfer( unsigned int start, int count, char* buf, bool write )
+static int transfer( unsigned int start, int count, char* buf, bool write )
{
int rc;
@@ -1497,9 +1497,9 @@ static bool transfer( unsigned int start, int count, char* buf, bool write )
DEBUGF( "transfer() - Couldn't %s sector %x"
" (error code %d)\n",
write ? "write":"read", start, rc);
- return false;
+ return rc;
}
- return true;
+ return 0;
}
@@ -1512,6 +1512,7 @@ int fat_readwrite( struct fat_file *file, int sectorcount,
bool eof = file->eof;
int first=0, last=0;
int i;
+ int rc;
LDEBUGF( "fat_readwrite(file:%x,count:0x%x,buf:%x,%s)\n",
file->firstcluster,sectorcount,buf,write?"write":"read");
@@ -1560,8 +1561,9 @@ int fat_readwrite( struct fat_file *file, int sectorcount,
if ( ((sector != first) && (sector != last+1)) || /* not sequential */
(last-first+1 == 256) ) { /* max 256 sectors per ata request */
int count = last - first + 1;
- if (!transfer( first + fat_bpb.startsector, count, buf, write ))
- return -1;
+ rc = transfer( first + fat_bpb.startsector, count, buf, write );
+ if (rc < 0)
+ return rc * 10 - 1;
((char*)buf) += count * SECTOR_SIZE;
first = sector;
@@ -1571,9 +1573,9 @@ int fat_readwrite( struct fat_file *file, int sectorcount,
(!eof))
{
int count = sector - first + 1;
- if (!transfer( first + fat_bpb.startsector,
- count, buf, write ))
- return -2;
+ rc = transfer( first + fat_bpb.startsector, count, buf, write );
+ if (rc < 0)
+ return rc * 10 - 2;
}
last = sector;