summaryrefslogtreecommitdiff
path: root/firmware/drivers/fat.c
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-11-01 16:14:28 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-11-01 16:14:28 +0000
commit2f8a0081c64534da23fc0fa9cc685eb7454fd9c9 (patch)
tree84dbdbd5326cb48f43d2ebd5a4c86e992c1d5288 /firmware/drivers/fat.c
parent646cac0bde7b11fa7bcb670d1d76eec78e360485 (diff)
downloadrockbox-2f8a0081c64534da23fc0fa9cc685eb7454fd9c9.tar.gz
rockbox-2f8a0081c64534da23fc0fa9cc685eb7454fd9c9.zip
Apply FS#9500. This adds a storage_*() abstraction to replace ata_*(). To do that, it also introduces sd_*, nand_*, and mmc_*.
This should be a good first step to allow multi-driver targets, like the Elio (ATA/SD), or the D2 (NAND/SD). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18960 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r--firmware/drivers/fat.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 90be93f4f4..4317b70766 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -24,7 +24,7 @@
24#include <ctype.h> 24#include <ctype.h>
25#include <stdbool.h> 25#include <stdbool.h>
26#include "fat.h" 26#include "fat.h"
27#include "ata.h" 27#include "storage.h"
28#include "debug.h" 28#include "debug.h"
29#include "panic.h" 29#include "panic.h"
30#include "system.h" 30#include "system.h"
@@ -300,7 +300,7 @@ int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector)
300#endif 300#endif
301 301
302 /* Read the sector */ 302 /* Read the sector */
303 rc = ata_read_sectors(IF_MV2(drive,) startsector,1,buf); 303 rc = storage_read_sectors(IF_MV2(drive,) startsector,1,buf);
304 if(rc) 304 if(rc)
305 { 305 {
306 DEBUGF( "fat_mount() - Couldn't read BPB (error code %d)\n", rc); 306 DEBUGF( "fat_mount() - Couldn't read BPB (error code %d)\n", rc);
@@ -422,7 +422,7 @@ int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector)
422#endif /* #ifdef HAVE_FAT16SUPPORT */ 422#endif /* #ifdef HAVE_FAT16SUPPORT */
423 { 423 {
424 /* Read the fsinfo sector */ 424 /* Read the fsinfo sector */
425 rc = ata_read_sectors(IF_MV2(drive,) 425 rc = storage_read_sectors(IF_MV2(drive,)
426 startsector + fat_bpb->bpb_fsinfo, 1, buf); 426 startsector + fat_bpb->bpb_fsinfo, 1, buf);
427 if (rc < 0) 427 if (rc < 0)
428 { 428 {
@@ -597,7 +597,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
597#endif 597#endif
598 598
599 /* Write to the first FAT */ 599 /* Write to the first FAT */
600 rc = ata_write_sectors(IF_MV2(fce->fat_vol->drive,) 600 rc = storage_write_sectors(IF_MV2(fce->fat_vol->drive,)
601 secnum, 1, 601 secnum, 1,
602 sectorbuf); 602 sectorbuf);
603 if(rc < 0) 603 if(rc < 0)
@@ -618,7 +618,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
618#else 618#else
619 secnum += fat_bpbs[0].fatsize; 619 secnum += fat_bpbs[0].fatsize;
620#endif 620#endif
621 rc = ata_write_sectors(IF_MV2(fce->fat_vol->drive,) 621 rc = storage_write_sectors(IF_MV2(fce->fat_vol->drive,)
622 secnum, 1, sectorbuf); 622 secnum, 1, sectorbuf);
623 if(rc < 0) 623 if(rc < 0)
624 { 624 {
@@ -664,7 +664,7 @@ static void *cache_fat_sector(IF_MV2(struct bpb* fat_bpb,)
664 /* Load the sector if it is not cached */ 664 /* Load the sector if it is not cached */
665 if(!fce->inuse) 665 if(!fce->inuse)
666 { 666 {
667 rc = ata_read_sectors(IF_MV2(fat_bpb->drive,) 667 rc = storage_read_sectors(IF_MV2(fat_bpb->drive,)
668 secnum + fat_bpb->startsector,1, 668 secnum + fat_bpb->startsector,1,
669 sectorbuf); 669 sectorbuf);
670 if(rc < 0) 670 if(rc < 0)
@@ -923,7 +923,7 @@ static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb))
923#endif /* #ifdef HAVE_FAT16SUPPORT */ 923#endif /* #ifdef HAVE_FAT16SUPPORT */
924 924
925 /* update fsinfo */ 925 /* update fsinfo */
926 rc = ata_read_sectors(IF_MV2(fat_bpb->drive,) 926 rc = storage_read_sectors(IF_MV2(fat_bpb->drive,)
927 fat_bpb->startsector + fat_bpb->bpb_fsinfo, 1,fsinfo); 927 fat_bpb->startsector + fat_bpb->bpb_fsinfo, 1,fsinfo);
928 if (rc < 0) 928 if (rc < 0)
929 { 929 {
@@ -936,7 +936,7 @@ static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb))
936 intptr = (long*)&(fsinfo[FSINFO_NEXTFREE]); 936 intptr = (long*)&(fsinfo[FSINFO_NEXTFREE]);
937 *intptr = htole32(fat_bpb->fsinfo.nextfree); 937 *intptr = htole32(fat_bpb->fsinfo.nextfree);
938 938
939 rc = ata_write_sectors(IF_MV2(fat_bpb->drive,) 939 rc = storage_write_sectors(IF_MV2(fat_bpb->drive,)
940 fat_bpb->startsector + fat_bpb->bpb_fsinfo,1,fsinfo); 940 fat_bpb->startsector + fat_bpb->bpb_fsinfo,1,fsinfo);
941 if (rc < 0) 941 if (rc < 0)
942 { 942 {
@@ -2077,11 +2077,11 @@ static int transfer(IF_MV2(struct bpb* fat_bpb,)
2077 if (start + count > fat_bpb->totalsectors) 2077 if (start + count > fat_bpb->totalsectors)
2078 panicf("Write %ld after data\n", 2078 panicf("Write %ld after data\n",
2079 start + count - fat_bpb->totalsectors); 2079 start + count - fat_bpb->totalsectors);
2080 rc = ata_write_sectors(IF_MV2(fat_bpb->drive,) 2080 rc = storage_write_sectors(IF_MV2(fat_bpb->drive,)
2081 start + fat_bpb->startsector, count, buf); 2081 start + fat_bpb->startsector, count, buf);
2082 } 2082 }
2083 else 2083 else
2084 rc = ata_read_sectors(IF_MV2(fat_bpb->drive,) 2084 rc = storage_read_sectors(IF_MV2(fat_bpb->drive,)
2085 start + fat_bpb->startsector, count, buf); 2085 start + fat_bpb->startsector, count, buf);
2086 if (rc < 0) { 2086 if (rc < 0) {
2087 DEBUGF( "transfer() - Couldn't %s sector %lx" 2087 DEBUGF( "transfer() - Couldn't %s sector %lx"