forked from len0rd/rockbox
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
This commit is contained in:
parent
646cac0bde
commit
2f8a0081c6
64 changed files with 541 additions and 554 deletions
|
|
@ -24,7 +24,7 @@
|
|||
#include <ctype.h>
|
||||
#include <stdbool.h>
|
||||
#include "fat.h"
|
||||
#include "ata.h"
|
||||
#include "storage.h"
|
||||
#include "debug.h"
|
||||
#include "panic.h"
|
||||
#include "system.h"
|
||||
|
|
@ -300,7 +300,7 @@ int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector)
|
|||
#endif
|
||||
|
||||
/* Read the sector */
|
||||
rc = ata_read_sectors(IF_MV2(drive,) startsector,1,buf);
|
||||
rc = storage_read_sectors(IF_MV2(drive,) startsector,1,buf);
|
||||
if(rc)
|
||||
{
|
||||
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)
|
|||
#endif /* #ifdef HAVE_FAT16SUPPORT */
|
||||
{
|
||||
/* Read the fsinfo sector */
|
||||
rc = ata_read_sectors(IF_MV2(drive,)
|
||||
rc = storage_read_sectors(IF_MV2(drive,)
|
||||
startsector + fat_bpb->bpb_fsinfo, 1, buf);
|
||||
if (rc < 0)
|
||||
{
|
||||
|
|
@ -597,7 +597,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
|
|||
#endif
|
||||
|
||||
/* Write to the first FAT */
|
||||
rc = ata_write_sectors(IF_MV2(fce->fat_vol->drive,)
|
||||
rc = storage_write_sectors(IF_MV2(fce->fat_vol->drive,)
|
||||
secnum, 1,
|
||||
sectorbuf);
|
||||
if(rc < 0)
|
||||
|
|
@ -618,7 +618,7 @@ static void flush_fat_sector(struct fat_cache_entry *fce,
|
|||
#else
|
||||
secnum += fat_bpbs[0].fatsize;
|
||||
#endif
|
||||
rc = ata_write_sectors(IF_MV2(fce->fat_vol->drive,)
|
||||
rc = storage_write_sectors(IF_MV2(fce->fat_vol->drive,)
|
||||
secnum, 1, sectorbuf);
|
||||
if(rc < 0)
|
||||
{
|
||||
|
|
@ -664,7 +664,7 @@ static void *cache_fat_sector(IF_MV2(struct bpb* fat_bpb,)
|
|||
/* Load the sector if it is not cached */
|
||||
if(!fce->inuse)
|
||||
{
|
||||
rc = ata_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
secnum + fat_bpb->startsector,1,
|
||||
sectorbuf);
|
||||
if(rc < 0)
|
||||
|
|
@ -923,7 +923,7 @@ static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb))
|
|||
#endif /* #ifdef HAVE_FAT16SUPPORT */
|
||||
|
||||
/* update fsinfo */
|
||||
rc = ata_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
fat_bpb->startsector + fat_bpb->bpb_fsinfo, 1,fsinfo);
|
||||
if (rc < 0)
|
||||
{
|
||||
|
|
@ -936,7 +936,7 @@ static int update_fsinfo(IF_MV_NONVOID(struct bpb* fat_bpb))
|
|||
intptr = (long*)&(fsinfo[FSINFO_NEXTFREE]);
|
||||
*intptr = htole32(fat_bpb->fsinfo.nextfree);
|
||||
|
||||
rc = ata_write_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_write_sectors(IF_MV2(fat_bpb->drive,)
|
||||
fat_bpb->startsector + fat_bpb->bpb_fsinfo,1,fsinfo);
|
||||
if (rc < 0)
|
||||
{
|
||||
|
|
@ -2077,11 +2077,11 @@ static int transfer(IF_MV2(struct bpb* fat_bpb,)
|
|||
if (start + count > fat_bpb->totalsectors)
|
||||
panicf("Write %ld after data\n",
|
||||
start + count - fat_bpb->totalsectors);
|
||||
rc = ata_write_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_write_sectors(IF_MV2(fat_bpb->drive,)
|
||||
start + fat_bpb->startsector, count, buf);
|
||||
}
|
||||
else
|
||||
rc = ata_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
start + fat_bpb->startsector, count, buf);
|
||||
if (rc < 0) {
|
||||
DEBUGF( "transfer() - Couldn't %s sector %lx"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue