implement single-driver storage layer with macros instead of inlines
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18975 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
0b34b77e13
commit
430343bca7
12 changed files with 211 additions and 265 deletions
|
@ -1956,7 +1956,7 @@ static int disk_callback(int btn, struct gui_synclist *lists)
|
|||
(void)btn;
|
||||
(void)lists;
|
||||
struct storage_info info;
|
||||
storage_get_info(IF_MV2(0,)&info);
|
||||
storage_get_info(0,&info);
|
||||
simplelist_addline(SIMPLELIST_ADD_LINE, "Vendor: %s", info.vendor);
|
||||
simplelist_addline(SIMPLELIST_ADD_LINE, "Model: %s", info.product);
|
||||
simplelist_addline(SIMPLELIST_ADD_LINE, "Firmware: %s", info.revision);
|
||||
|
|
|
@ -108,7 +108,6 @@ drivers/serial.c
|
|||
|
||||
|
||||
/* Storage */
|
||||
storage.c
|
||||
#ifndef SIMULATOR
|
||||
#if (CONFIG_STORAGE & STORAGE_MMC)
|
||||
drivers/ata_mmc.c
|
||||
|
|
|
@ -78,9 +78,11 @@ struct partinfo* disk_init(IF_MV_NONVOID(int drive))
|
|||
return NULL; /* out of space in table */
|
||||
#else
|
||||
struct partinfo* pinfo = part;
|
||||
int drive;
|
||||
(void)drive;
|
||||
#endif
|
||||
|
||||
storage_read_sectors(IF_MV2(drive,) 0,1, §or);
|
||||
storage_read_sectors(drive, 0,1, §or);
|
||||
/* check that the boot sector is initialized */
|
||||
if ( (sector[510] != 0x55) ||
|
||||
(sector[511] != 0xaa)) {
|
||||
|
|
|
@ -1002,3 +1002,16 @@ bool mmc_present(IF_MV_NONVOID(int drive))
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
void mmc_sleep(void)
|
||||
{
|
||||
}
|
||||
|
||||
void mmc_spin(void)
|
||||
{
|
||||
}
|
||||
|
||||
void mmc_spindown(int seconds)
|
||||
{
|
||||
(void)seconds;
|
||||
}
|
||||
|
|
|
@ -300,7 +300,7 @@ int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector)
|
|||
#endif
|
||||
|
||||
/* Read the sector */
|
||||
rc = storage_read_sectors(IF_MV2(drive,) startsector,1,buf);
|
||||
rc = storage_read_sectors(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 = storage_read_sectors(IF_MV2(drive,)
|
||||
rc = storage_read_sectors(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 = storage_write_sectors(IF_MV2(fce->fat_vol->drive,)
|
||||
rc = storage_write_sectors(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 = storage_write_sectors(IF_MV2(fce->fat_vol->drive,)
|
||||
rc = storage_write_sectors(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 = storage_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_read_sectors(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 = storage_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_read_sectors(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 = storage_write_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_write_sectors(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 = storage_write_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_write_sectors(fat_bpb->drive,
|
||||
start + fat_bpb->startsector, count, buf);
|
||||
}
|
||||
else
|
||||
rc = storage_read_sectors(IF_MV2(fat_bpb->drive,)
|
||||
rc = storage_read_sectors(fat_bpb->drive,
|
||||
start + fat_bpb->startsector, count, buf);
|
||||
if (rc < 0) {
|
||||
DEBUGF( "transfer() - Couldn't %s sector %lx"
|
||||
|
|
|
@ -383,6 +383,11 @@
|
|||
#define CONFIG_TUNER_MULTI
|
||||
#endif
|
||||
|
||||
#if (CONFIG_STORAGE & (CONFIG_STORAGE - 1)) != 0
|
||||
/* Multiple storage drivers */
|
||||
#define CONFIG_STORAGE_MULTI
|
||||
#endif
|
||||
|
||||
#if defined(BOOTLOADER) && defined(HAVE_ADJUSTABLE_CPU_FREQ)
|
||||
/* Bootloaders don't use CPU frequency adjustment */
|
||||
#undef HAVE_ADJUSTABLE_CPU_FREQ
|
||||
|
|
|
@ -39,6 +39,7 @@ void mmc_close(void);
|
|||
int mmc_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf);
|
||||
int mmc_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf);
|
||||
void mmc_spin(void);
|
||||
int mmc_spinup_time(void);
|
||||
|
||||
#if (CONFIG_LED == LED_REAL)
|
||||
void mmc_set_led_enabled(bool enabled);
|
||||
|
|
|
@ -48,204 +48,133 @@ struct storage_info
|
|||
char *revision;
|
||||
};
|
||||
|
||||
void storage_spindown(int seconds);
|
||||
|
||||
#ifndef SIMULATOR
|
||||
static inline void storage_enable(bool on)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
ata_enable(on);
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
sd_enable(on);
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
mmc_enable(on);
|
||||
#else
|
||||
(void)on;
|
||||
#endif
|
||||
}
|
||||
static inline void storage_sleep(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
ata_sleep();
|
||||
#endif
|
||||
}
|
||||
static inline void storage_sleepnow(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
ata_sleepnow();
|
||||
#endif
|
||||
}
|
||||
static inline bool storage_disk_is_active(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_disk_is_active();
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
return mmc_disk_is_active();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
static inline int storage_hard_reset(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_hard_reset();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
static inline int storage_soft_reset(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_soft_reset();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
static inline int storage_init(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_init();
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
return sd_init();
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
return nand_init();
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
return mmc_init();
|
||||
#else
|
||||
#error No storage driver!
|
||||
#endif
|
||||
}
|
||||
static inline void storage_close(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
ata_close();
|
||||
#endif
|
||||
}
|
||||
static inline int storage_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_read_sectors(IF_MV2(drive,) start, count, buf);
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
return sd_read_sectors(IF_MV2(drive,) start, count, buf);
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
return nand_read_sectors(IF_MV2(drive,) start, count, buf);
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
return mmc_read_sectors(IF_MV2(drive,) start, count, buf);
|
||||
#else
|
||||
#error No storage driver!
|
||||
#endif
|
||||
}
|
||||
static inline int storage_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_write_sectors(IF_MV2(drive,) start, count, buf);
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
return sd_write_sectors(IF_MV2(drive,) start, count, buf);
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
return nand_write_sectors(IF_MV2(drive,) start, count, buf);
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
return mmc_write_sectors(IF_MV2(drive,) start, count, buf);
|
||||
#else
|
||||
#error No storage driver!
|
||||
#endif
|
||||
}
|
||||
static inline void storage_spin(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
ata_spin();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if (CONFIG_LED == LED_REAL)
|
||||
static inline void storage_set_led_enabled(bool enabled)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
ata_set_led_enabled(enabled);
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
sd_set_led_enabled(enabled);
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
nand_set_led_enabled(enabled);
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
mmc_set_led_enabled(enabled);
|
||||
#else
|
||||
#error No storage driver!
|
||||
#endif
|
||||
}
|
||||
#endif /*LED*/
|
||||
|
||||
static inline long storage_last_disk_activity(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_last_disk_activity();
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
return sd_last_disk_activity();
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
return nand_last_disk_activity();
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
return mmc_last_disk_activity();
|
||||
#else
|
||||
#error No storage driver!
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int storage_spinup_time(void)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_spinup_time();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef STORAGE_GET_INFO
|
||||
static inline void storage_get_info(IF_MV2(int drive,) struct storage_info *info)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_get_info(IF_MV2(drive,) info);
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
return sd_get_info(IF_MV2(drive,) info);
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
return nand_get_info(IF_MV2(drive,) info);
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
return mmc_get_info(IF_MV2(drive,) info);
|
||||
#else
|
||||
#error No storage driver!
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HOTSWAP
|
||||
static inline bool storage_removable(IF_MV_NONVOID(int drive))
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_removable(IF_MV(drive));
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
return sd_removable(IF_MV(drive));
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
return nand_removable(IF_MV(drive));
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
return mmc_removable(IF_MV(drive));
|
||||
#else
|
||||
#error No storage driver!
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool storage_present(IF_MV_NONVOID(int drive))
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
return ata_present(IF_MV(drive));
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
return sd_present(IF_MV(drive));
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
return nand_present(IF_MV(drive));
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
return mmc_present(IF_MV(drive));
|
||||
#else
|
||||
#error No storage driver!
|
||||
#endif
|
||||
}
|
||||
#endif /* HOTSWAP */
|
||||
#else /* SIMULATOR */
|
||||
#ifndef CONFIG_STORAGE_MULTI
|
||||
/* storage_spindown, storage_sleep and storage_spin are passed as
|
||||
* pointers, which doesn't work with argument-macros.
|
||||
*/
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
#define storage_spindown ata_spindown
|
||||
#define storage_sleep ata_sleep
|
||||
#define storage_spin ata_spin
|
||||
|
||||
#define storage_enable(on) ata_enable(on)
|
||||
#define storage_sleepnow() ata_sleepnow()
|
||||
#define storage_disk_is_active() ata_disk_is_active()
|
||||
#define storage_hard_reset() ata_hard_reset()
|
||||
#define storage_soft_reset() ata_soft_reset()
|
||||
#define storage_init() ata_init()
|
||||
#define storage_close() ata_close()
|
||||
#define storage_read_sectors(drive, start, count, buf) ata_read_sectors(IF_MV2(drive,) start, count, buf)
|
||||
#define storage_write_sectors(drive, start, count, buf) ata_write_sectors(IF_MV2(drive,) start, count, buf)
|
||||
#define storage_last_disk_activity() ata_last_disk_activity()
|
||||
#define storage_spinup_time() ata_spinup_time()
|
||||
#define storage_get_identify() ata_get_identify()
|
||||
|
||||
#if (CONFIG_LED == LED_REAL)
|
||||
#define storage_set_led_enabled(enabled) ata_set_led_enabled(enabled)
|
||||
#endif
|
||||
#ifdef STORAGE_GET_INFO
|
||||
#define storage_get_info(drive, info) ata_get_info(IF_MV2(drive,) info)
|
||||
#endif
|
||||
#ifdef HAVE_HOTSWAP
|
||||
#define storage_removable(drive) ata_removable(IF_MV(drive))
|
||||
#define storage_present(drive) ata_present(IF_MV(drive))
|
||||
#endif
|
||||
#elif (CONFIG_STORAGE & STORAGE_SD)
|
||||
#define storage_spindown sd_spindown
|
||||
#define storage_sleep sd_sleep
|
||||
#define storage_spin sd_spin
|
||||
|
||||
#define storage_enable(on) sd_enable(on)
|
||||
#define storage_sleepnow() sd_sleepnow()
|
||||
#define storage_disk_is_active() 0
|
||||
#define storage_hard_reset() (void)0
|
||||
#define storage_soft_reset() (void)0
|
||||
#define storage_init() sd_init()
|
||||
#define storage_close() sd_close()
|
||||
#define storage_read_sectors(drive, start, count, buf) sd_read_sectors(IF_MV2(drive,) start, count, buf)
|
||||
#define storage_write_sectors(drive, start, count, buf) sd_write_sectors(IF_MV2(drive,) start, count, buf)
|
||||
#define storage_last_disk_activity() sd_last_disk_activity()
|
||||
#define storage_spinup_time() 0
|
||||
#define storage_get_identify() sd_get_identify()
|
||||
|
||||
#if (CONFIG_LED == LED_REAL)
|
||||
#define storage_set_led_enabled(enabled) sd_set_led_enabled(enabled)
|
||||
#endif
|
||||
#ifdef STORAGE_GET_INFO
|
||||
#define storage_get_info(drive, info) sd_get_info(IF_MV2(drive,) info)
|
||||
#endif
|
||||
#ifdef HAVE_HOTSWAP
|
||||
#define storage_removable(drive) sd_removable(IF_MV(drive))
|
||||
#define storage_present(drive) sd_present(IF_MV(drive))
|
||||
#endif
|
||||
#elif (CONFIG_STORAGE & STORAGE_MMC)
|
||||
#define storage_spindown mmc_spindown
|
||||
#define storage_sleep mmc_sleep
|
||||
#define storage_spin mmc_spin
|
||||
|
||||
#define storage_enable(on) mmc_enable(on)
|
||||
#define storage_sleepnow() mmc_sleepnow()
|
||||
#define storage_disk_is_active() mmc_disk_is_active()
|
||||
#define storage_hard_reset() (void)0
|
||||
#define storage_soft_reset() (void)0
|
||||
#define storage_init() mmc_init()
|
||||
#define storage_close() mmc_close()
|
||||
#define storage_read_sectors(drive, start, count, buf) mmc_read_sectors(IF_MV2(drive,) start, count, buf)
|
||||
#define storage_write_sectors(drive, start, count, buf) mmc_write_sectors(IF_MV2(drive,) start, count, buf)
|
||||
#define storage_last_disk_activity() mmc_last_disk_activity()
|
||||
#define storage_spinup_time() 0
|
||||
#define storage_get_identify() mmc_get_identify()
|
||||
|
||||
#if (CONFIG_LED == LED_REAL)
|
||||
#define storage_set_led_enabled(enabled) mmc_set_led_enabled(enabled)
|
||||
#endif
|
||||
#ifdef STORAGE_GET_INFO
|
||||
#define storage_get_info(drive, info) mmc_get_info(IF_MV2(drive,) info)
|
||||
#endif
|
||||
#ifdef HAVE_HOTSWAP
|
||||
#define storage_removable(drive) mmc_removable(IF_MV(drive))
|
||||
#define storage_present(drive) mmc_present(IF_MV(drive))
|
||||
#endif
|
||||
#elif (CONFIG_STORAGE & STORAGE_NAND)
|
||||
#define storage_spindown nand_spindown
|
||||
#define storage_sleep nand_sleep
|
||||
#define storage_spin nand_spin
|
||||
|
||||
#define storage_enable(on) (void)0
|
||||
#define storage_sleepnow() nand_sleepnow()
|
||||
#define storage_disk_is_active() 0
|
||||
#define storage_hard_reset() (void)0
|
||||
#define storage_soft_reset() (void)0
|
||||
#define storage_init() nand_init()
|
||||
#define storage_close() nand_close()
|
||||
#define storage_read_sectors(drive, start, count, buf) nand_read_sectors(IF_MV2(drive,) start, count, buf)
|
||||
#define storage_write_sectors(drive, start, count, buf) nand_write_sectors(IF_MV2(drive,) start, count, buf)
|
||||
#define storage_last_disk_activity() nand_last_disk_activity()
|
||||
#define storage_spinup_time() 0
|
||||
#define storage_get_identify() nand_get_identify()
|
||||
|
||||
#if (CONFIG_LED == LED_REAL)
|
||||
#define storage_set_led_enabled(enabled) nand_set_led_enabled(enabled)
|
||||
#endif
|
||||
#ifdef STORAGE_GET_INFO
|
||||
#define storage_get_info(drive, info) nand_get_info(IF_MV2(drive,) info)
|
||||
#endif
|
||||
#ifdef HAVE_HOTSWAP
|
||||
#define storage_removable(drive) nand_removable(IF_MV(drive))
|
||||
#define storage_present(drive) nand_present(IF_MV(drive))
|
||||
#endif
|
||||
#else
|
||||
//#error No storage driver!
|
||||
#endif
|
||||
#else /* NOT CONFIG_STORAGE_MULTI */
|
||||
|
||||
/* TODO : implement multi-driver here */
|
||||
#error Multi-driver storage not implemented yet
|
||||
|
||||
#endif /* NOT CONFIG_STORAGE_MULTI */
|
||||
#else /*NOT SIMULATOR */
|
||||
static inline void storage_enable(bool on)
|
||||
{
|
||||
(void)on;
|
||||
|
@ -275,26 +204,31 @@ static inline int storage_init(void)
|
|||
static inline void storage_close(void)
|
||||
{
|
||||
}
|
||||
static inline int storage_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf)
|
||||
static inline int storage_read_sectors(int drive, unsigned long start, int count, void* buf)
|
||||
{
|
||||
IF_MV((void)drive;)
|
||||
(void)drive;
|
||||
(void)start;
|
||||
(void)count;
|
||||
(void)buf;
|
||||
return 0;
|
||||
}
|
||||
static inline int storage_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf)
|
||||
static inline int storage_write_sectors(int drive, unsigned long start, int count, const void* buf)
|
||||
{
|
||||
IF_MV((void)drive;)
|
||||
(void)drive;
|
||||
(void)start;
|
||||
(void)count;
|
||||
(void)buf;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void storage_spin(void)
|
||||
{
|
||||
}
|
||||
|
||||
static inline void storage_spindown(int seconds)
|
||||
{
|
||||
(void)seconds;
|
||||
}
|
||||
|
||||
#if (CONFIG_LED == LED_REAL)
|
||||
static inline void storage_set_led_enabled(bool enabled)
|
||||
{
|
||||
|
@ -313,25 +247,27 @@ static inline int storage_spinup_time(void)
|
|||
}
|
||||
|
||||
#ifdef STORAGE_GET_INFO
|
||||
static inline void storage_get_info(IF_MV2(int drive,) struct storage_info *info)
|
||||
static inline void storage_get_info(int drive, struct storage_info *info)
|
||||
{
|
||||
IF_MV((void)drive;)
|
||||
(void)drive;
|
||||
(void)info;
|
||||
}
|
||||
#endif
|
||||
+#endif /* NOT CONFIG_STORAGE_MULTI */
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_HOTSWAP
|
||||
static inline bool storage_removable(IF_MV_NONVOID(int drive))
|
||||
static inline bool storage_removable(int drive)
|
||||
{
|
||||
IF_MV((void)drive;)
|
||||
(void)drive;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool storage_present(IF_MV_NONVOID(int drive))
|
||||
static inline bool storage_present(int drive)
|
||||
{
|
||||
IF_MV((void)drive;)
|
||||
(void)drive;
|
||||
return 0;
|
||||
}
|
||||
#endif /* HOTSWAP */
|
||||
#endif /* SIMULATOR */
|
||||
|
||||
#endif/*NOT SIMULATOR */
|
||||
#endif
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id: $
|
||||
*
|
||||
* Copyright (C) 2008 by Frank Gevaerts
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "config.h" /* for HAVE_MULTIVOLUME or not */
|
||||
#include "storage.h"
|
||||
|
||||
/* storage_spindown() can't be inlined as it is passed as a function
|
||||
pointer in settings_list.c
|
||||
*/
|
||||
|
||||
void storage_spindown(int seconds)
|
||||
{
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
ata_spindown(seconds);
|
||||
#else
|
||||
(void)seconds;
|
||||
#endif
|
||||
}
|
|
@ -856,3 +856,16 @@ long nand_last_disk_activity(void)
|
|||
{
|
||||
return last_disk_activity;
|
||||
}
|
||||
|
||||
void nand_sleep(void)
|
||||
{
|
||||
}
|
||||
|
||||
void nand_spin(void)
|
||||
{
|
||||
}
|
||||
|
||||
void nand_spindown(int seconds)
|
||||
{
|
||||
(void)seconds;
|
||||
}
|
||||
|
|
|
@ -1339,3 +1339,15 @@ bool sd_present(IF_MV_NONVOID(int drive))
|
|||
}
|
||||
#endif
|
||||
|
||||
void sd_sleep(void)
|
||||
{
|
||||
}
|
||||
|
||||
void sd_spin(void)
|
||||
{
|
||||
}
|
||||
|
||||
void sd_spindown(int seconds)
|
||||
{
|
||||
(void)seconds;
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ static bool check_disk_present(IF_MV_NONVOID(int volume))
|
|||
return true;
|
||||
#else
|
||||
unsigned char sector[512];
|
||||
return storage_read_sectors(IF_MV2(volume,)0,1,sector) == 0;
|
||||
return storage_read_sectors(volume,0,1,sector) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ void usb_storage_transfer_complete(int ep,int dir,int status,int length)
|
|||
cur_cmd.data[cur_cmd.data_select],
|
||||
MIN(BUFFER_SIZE/SECTOR_SIZE, cur_cmd.count)*SECTOR_SIZE);
|
||||
#else
|
||||
int result = storage_write_sectors(IF_MV2(cur_cmd.lun,)
|
||||
int result = storage_write_sectors(cur_cmd.lun,
|
||||
cur_cmd.sector,
|
||||
MIN(BUFFER_SIZE/SECTOR_SIZE,
|
||||
cur_cmd.count),
|
||||
|
@ -637,7 +637,7 @@ static void send_and_read_next(void)
|
|||
ramdisk_buffer + cur_cmd.sector*SECTOR_SIZE,
|
||||
MIN(BUFFER_SIZE/SECTOR_SIZE, cur_cmd.count)*SECTOR_SIZE);
|
||||
#else
|
||||
cur_cmd.last_result = storage_read_sectors(IF_MV2(cur_cmd.lun,)
|
||||
cur_cmd.last_result = storage_read_sectors(cur_cmd.lun,
|
||||
cur_cmd.sector,
|
||||
MIN(BUFFER_SIZE/SECTOR_SIZE,
|
||||
cur_cmd.count),
|
||||
|
@ -663,7 +663,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
|
|||
unsigned char lun = cbw->lun;
|
||||
#endif
|
||||
unsigned int block_size_mult = 1;
|
||||
storage_get_info(IF_MV2(lun,)&info);
|
||||
storage_get_info(lun,&info);
|
||||
#ifdef USB_USE_RAMDISK
|
||||
block_size = SECTOR_SIZE;
|
||||
block_count = RAMDISK_SIZE;
|
||||
|
@ -673,7 +673,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_HOTSWAP
|
||||
if(storage_removable(IF_MV(lun)) && !storage_present(IF_MV(lun))) {
|
||||
if(storage_removable(lun) && !storage_present(lun)) {
|
||||
ejected[lun] = true;
|
||||
try_release_ata();
|
||||
}
|
||||
|
@ -723,7 +723,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
|
|||
for(i=0;i<NUM_VOLUMES;i++)
|
||||
{
|
||||
#ifdef HAVE_HOTSWAP
|
||||
if(storage_removable(IF_MV(i)))
|
||||
if(storage_removable(i))
|
||||
tb.lun_data->luns[i][1]=1;
|
||||
else
|
||||
#endif
|
||||
|
@ -972,7 +972,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
|
|||
ramdisk_buffer + cur_cmd.sector*SECTOR_SIZE,
|
||||
MIN(BUFFER_SIZE/SECTOR_SIZE, cur_cmd.count)*SECTOR_SIZE);
|
||||
#else
|
||||
cur_cmd.last_result = storage_read_sectors(IF_MV2(cur_cmd.lun,)
|
||||
cur_cmd.last_result = storage_read_sectors(cur_cmd.lun,
|
||||
cur_cmd.sector,
|
||||
MIN(BUFFER_SIZE/SECTOR_SIZE,
|
||||
cur_cmd.count),
|
||||
|
@ -1089,7 +1089,7 @@ static void fill_inquiry(IF_MV_NONVOID(int lun))
|
|||
{
|
||||
memset(tb.inquiry, 0, sizeof(struct inquiry_data));
|
||||
struct storage_info info;
|
||||
storage_get_info(IF_MV2(lun,)&info);
|
||||
storage_get_info(lun,&info);
|
||||
copy_padded(tb.inquiry->VendorId,info.vendor,sizeof(tb.inquiry->VendorId));
|
||||
copy_padded(tb.inquiry->ProductId,info.product,sizeof(tb.inquiry->ProductId));
|
||||
copy_padded(tb.inquiry->ProductRevisionLevel,info.revision,sizeof(tb.inquiry->ProductRevisionLevel));
|
||||
|
|
Loading…
Reference in a new issue