Index: firmware/export/config-c200.h =================================================================== --- firmware/export/config-c200.h (revision 19143) +++ firmware/export/config-c200.h (working copy) @@ -159,7 +159,8 @@ /* #define USB_IPODSTYLE */ #ifndef BOOTLOADER -#define HAVE_MULTIVOLUME +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 #define HAVE_HOTSWAP #endif Index: firmware/export/config-ondiofm.h =================================================================== --- firmware/export/config-ondiofm.h (revision 19143) +++ firmware/export/config-ondiofm.h (working copy) @@ -55,7 +55,8 @@ #define HAVE_FLASH_STORAGE /* define this if more than one device/partition can be used */ -#define HAVE_MULTIVOLUME +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ Index: firmware/export/config-fuze.h =================================================================== --- firmware/export/config-fuze.h (revision 19143) +++ firmware/export/config-fuze.h (working copy) @@ -157,7 +157,8 @@ #define FIRMWARE_OFFSET_FILE_DATA 0x8 #ifndef BOOTLOADER -#define HAVE_MULTIVOLUME +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 #define HAVE_HOTSWAP #endif Index: firmware/export/config-e200v2.h =================================================================== --- firmware/export/config-e200v2.h (revision 19143) +++ firmware/export/config-e200v2.h (working copy) @@ -157,7 +157,8 @@ #define FIRMWARE_OFFSET_FILE_DATA 0x8 #ifndef BOOTLOADER -#define HAVE_MULTIVOLUME +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 #define HAVE_HOTSWAP #endif Index: firmware/export/sd.h =================================================================== --- firmware/export/sd.h (revision 19143) +++ firmware/export/sd.h (working copy) @@ -23,7 +23,7 @@ #define __SD_H__ #include -#include "mv.h" /* for HAVE_MULTIVOLUME or not */ +#include "mv.h" /* for HAVE_MULTIDRIVE or not */ struct storage_info; @@ -34,20 +34,25 @@ int sd_soft_reset(void); int sd_init(void); void sd_close(void); -int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); -int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); +int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); +int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); void sd_spin(void); #ifdef STORAGE_GET_INFO -void sd_get_info(IF_MV2(int drive,) struct storage_info *info); +void sd_get_info(IF_MD2(int drive,) struct storage_info *info); #endif #ifdef HAVE_HOTSWAP -bool sd_removable(IF_MV_NONVOID(int drive)); -bool sd_present(IF_MV_NONVOID(int drive)); +bool sd_removable(IF_MD_NONVOID(int drive)); +bool sd_present(IF_MD_NONVOID(int drive)); #endif long sd_last_disk_activity(void); +#ifdef CONFIG_STORAGE_MULTI +int sd_num_drives(void); +#endif + + /* SD States */ #define SD_IDLE 0 #define SD_READY 1 Index: firmware/export/config-e200.h =================================================================== --- firmware/export/config-e200.h (revision 19143) +++ firmware/export/config-e200.h (working copy) @@ -154,7 +154,8 @@ #define FIRMWARE_OFFSET_FILE_DATA 0x8 #ifndef BOOTLOADER -#define HAVE_MULTIVOLUME +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 #define HAVE_HOTSWAP #endif Index: firmware/export/nand.h =================================================================== --- firmware/export/nand.h (revision 19143) +++ firmware/export/nand.h (working copy) @@ -23,7 +23,7 @@ #define __NAND_H__ #include -#include "mv.h" /* for HAVE_MULTIVOLUME or not */ +#include "mv.h" /* for HAVE_MULTIDRIVE or not */ struct storage_info; @@ -34,14 +34,18 @@ int nand_soft_reset(void); int nand_init(void); void nand_close(void); -int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); -int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); +int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); +int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); void nand_spin(void); #ifdef STORAGE_GET_INFO -void nand_get_info(IF_MV2(int drive,) struct storage_info *info); +void nand_get_info(IF_MD2(int drive,) struct storage_info *info); #endif long nand_last_disk_activity(void); +#ifdef CONFIG_STORAGE_MULTI +int nand_num_drives(void); #endif + +#endif Index: firmware/export/config.h =================================================================== --- firmware/export/config.h (revision 19143) +++ firmware/export/config.h (working copy) @@ -389,6 +389,11 @@ #define CONFIG_STORAGE_MULTI #endif +#if defined(HAVE_MULTIDRIVE) && !defined(HAVE_MULTIVOLUME) +#define HAVE_MULTIVOLUME +#define NUM_VOLUMES NUM_DRIVES +#endif + #if defined(BOOTLOADER) && defined(HAVE_ADJUSTABLE_CPU_FREQ) /* Bootloaders don't use CPU frequency adjustment */ #undef HAVE_ADJUSTABLE_CPU_FREQ Index: firmware/export/mv.h =================================================================== --- firmware/export/mv.h (revision 19143) +++ firmware/export/mv.h (working copy) @@ -26,11 +26,30 @@ /* FixMe: These macros are a bit nasty and perhaps misplaced here. We'll get rid of them once decided on how to proceed with multivolume. */ + +/* Drives are things like a disk, a card, a flash chip. They can have volumes on them */ +#ifdef HAVE_MULTIDRIVE +#define IF_MD(x) x /* optional drive parameter */ +#define IF_MD2(x,y) x,y /* same, for a list of arguments */ +#define IF_MD_NONVOID(x) x /* for prototype with sole volume parameter */ +#ifndef NUM_DRIVES +#error The target configuration doesn't define NUM_DRIVES +#endif +#else /* empty definitions if no multi-drive */ +#define IF_MD(x) +#define IF_MD2(x,y) +#define IF_MD_NONVOID(x) void +#define NUM_DRIVES 1 +#endif + +/* Volumes mean things that have filesystems on them, like partitions */ #ifdef HAVE_MULTIVOLUME -#define IF_MV(x) x /* optional volume/drive parameter */ +#define IF_MV(x) x /* optional volume parameter */ #define IF_MV2(x,y) x,y /* same, for a list of arguments */ #define IF_MV_NONVOID(x) x /* for prototype with sole volume parameter */ -#define NUM_VOLUMES 2 +#ifndef NUM_VOLUMES +#error The target configuration doesn't define NUM_VOLUMES +#endif #else /* empty definitions if no multi-volume */ #define IF_MV(x) #define IF_MV2(x,y) @@ -38,4 +57,5 @@ #define NUM_VOLUMES 1 #endif + #endif Index: firmware/export/storage.h =================================================================== --- firmware/export/storage.h (revision 19143) +++ firmware/export/storage.h (working copy) @@ -23,7 +23,7 @@ #define __STORAGE_H__ #include -#include "config.h" /* for HAVE_MULTIVOLUME or not */ +#include "config.h" /* for HAVE_MULTIDRIVE or not */ #include "mv.h" #if (CONFIG_STORAGE & STORAGE_SD) @@ -51,154 +51,149 @@ char *revision; }; -#ifndef 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_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() - - #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_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() - - #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_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() - - #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_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() - - #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 - #elif (CONFIG_STORAGE & STORAGE_RAMDISK) - #define storage_spindown ramdisk_spindown - #define storage_sleep ramdisk_sleep - #define storage_spin ramdisk_spin - - #define storage_enable(on) (void)0 - #define storage_sleepnow() ramdisk_sleepnow() - #define storage_disk_is_active() 0 - #define storage_soft_reset() (void)0 - #define storage_init() ramdisk_init() - #define storage_close() ramdisk_close() - #define storage_read_sectors(drive, start, count, buf) ramdisk_read_sectors(IF_MV2(drive,) start, count, buf) - #define storage_write_sectors(drive, start, count, buf) ramdisk_write_sectors(IF_MV2(drive,) start, count, buf) - #define storage_last_disk_activity() ramdisk_last_disk_activity() - #define storage_spinup_time() 0 - #define storage_get_identify() ramdisk_get_identify() - - #ifdef STORAGE_GET_INFO - #define storage_get_info(drive, info) ramdisk_get_info(IF_MV2(drive,) info) - #endif - #ifdef HAVE_HOTSWAP - #define storage_removable(drive) ramdisk_removable(IF_MV(drive)) - #define storage_present(drive) ramdisk_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 */ +#if !defined(SIMULATOR) && !defined(CONFIG_STORAGE_MULTI) +/* storage_spindown, storage_sleep and storage_spin are passed as + * pointers, which doesn't work with argument-macros. + */ + #define storage_num_drives() NUM_DRIVES + #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_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_MD2(drive,) start, count, buf) + #define storage_write_sectors(drive, start, count, buf) ata_write_sectors(IF_MD2(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() + + #ifdef STORAGE_GET_INFO + #define storage_get_info(drive, info) ata_get_info(IF_MD2(drive,) info) + #endif + #ifdef HAVE_HOTSWAP + #define storage_removable(drive) ata_removable(IF_MD(drive)) + #define storage_present(drive) ata_present(IF_MD(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_soft_reset() (void)0 + #define storage_init() sd_init() + #define storage_read_sectors(drive, start, count, buf) sd_read_sectors(IF_MD2(drive,) start, count, buf) + #define storage_write_sectors(drive, start, count, buf) sd_write_sectors(IF_MD2(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() + + #ifdef STORAGE_GET_INFO + #define storage_get_info(drive, info) sd_get_info(IF_MD2(drive,) info) + #endif + #ifdef HAVE_HOTSWAP + #define storage_removable(drive) sd_removable(IF_MD(drive)) + #define storage_present(drive) sd_present(IF_MD(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_soft_reset() (void)0 + #define storage_init() mmc_init() + #define storage_read_sectors(drive, start, count, buf) mmc_read_sectors(IF_MD2(drive,) start, count, buf) + #define storage_write_sectors(drive, start, count, buf) mmc_write_sectors(IF_MD2(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() + + #ifdef STORAGE_GET_INFO + #define storage_get_info(drive, info) mmc_get_info(IF_MD2(drive,) info) + #endif + #ifdef HAVE_HOTSWAP + #define storage_removable(drive) mmc_removable(IF_MD(drive)) + #define storage_present(drive) mmc_present(IF_MD(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_soft_reset() (void)0 + #define storage_init() nand_init() + #define storage_read_sectors(drive, start, count, buf) nand_read_sectors(IF_MD2(drive,) start, count, buf) + #define storage_write_sectors(drive, start, count, buf) nand_write_sectors(IF_MD2(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() + + #ifdef STORAGE_GET_INFO + #define storage_get_info(drive, info) nand_get_info(IF_MD2(drive,) info) + #endif + #ifdef HAVE_HOTSWAP + #define storage_removable(drive) nand_removable(IF_MD(drive)) + #define storage_present(drive) nand_present(IF_MD(drive)) + #endif + #elif (CONFIG_STORAGE & STORAGE_RAMDISK) + #define storage_spindown ramdisk_spindown + #define storage_sleep ramdisk_sleep + #define storage_spin ramdisk_spin + + #define storage_enable(on) (void)0 + #define storage_sleepnow() ramdisk_sleepnow() + #define storage_disk_is_active() 0 + #define storage_soft_reset() (void)0 + #define storage_init() ramdisk_init() + #define storage_read_sectors(drive, start, count, buf) ramdisk_read_sectors(IF_MD2(drive,) start, count, buf) + #define storage_write_sectors(drive, start, count, buf) ramdisk_write_sectors(IF_MD2(drive,) start, count, buf) + #define storage_last_disk_activity() ramdisk_last_disk_activity() + #define storage_spinup_time() 0 + #define storage_get_identify() ramdisk_get_identify() + + #ifdef STORAGE_GET_INFO + #define storage_get_info(drive, info) ramdisk_get_info(IF_MD2(drive,) info) + #endif + #ifdef HAVE_HOTSWAP + #define storage_removable(drive) ramdisk_removable(IF_MD(drive)) + #define storage_present(drive) ramdisk_present(IF_MD(drive)) + #endif + #else + //#error No storage driver! + #endif +#else /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/ + +/* Simulator and multi-driver use normal functions */ + +#define MAX_NUM_DRIVES 10 + void storage_enable(bool on); void storage_sleep(void); void storage_sleepnow(void); bool storage_disk_is_active(void); int storage_soft_reset(void); int storage_init(void); -void storage_close(void); int storage_read_sectors(int drive, unsigned long start, int count, void* buf); int storage_write_sectors(int drive, unsigned long start, int count, const void* buf); void storage_spin(void); void storage_spindown(int seconds); long storage_last_disk_activity(void); int storage_spinup_time(void); +int storage_num_drives(void); #ifdef STORAGE_GET_INFO void storage_get_info(int drive, struct storage_info *info); #endif @@ -206,5 +201,6 @@ bool storage_removable(int drive); bool storage_present(int drive); #endif -#endif/*NOT SIMULATOR */ + +#endif /* NOT CONFIG_STORAGE_MULTI and NOT SIMULATOR*/ #endif Index: firmware/export/config-ondavx767.h =================================================================== --- firmware/export/config-ondavx767.h (revision 19143) +++ firmware/export/config-ondavx767.h (working copy) @@ -39,7 +39,8 @@ #define HAVE_ATA_SD #define HAVE_HOTSWAP -#define HAVE_MULTIVOLUME +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP Index: firmware/export/mmc.h =================================================================== --- firmware/export/mmc.h (revision 19143) +++ firmware/export/mmc.h (working copy) @@ -23,7 +23,7 @@ #define __MMC_H__ #include -#include "mv.h" /* for HAVE_MULTIVOLUME or not */ +#include "mv.h" /* for HAVE_MULTIDRIVE or not */ struct storage_info; @@ -35,19 +35,24 @@ int mmc_soft_reset(void); int mmc_init(void); 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); +int mmc_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); +int mmc_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); void mmc_spin(void); int mmc_spinup_time(void); #ifdef STORAGE_GET_INFO -void mmc_get_info(IF_MV2(int drive,) struct storage_info *info); +void mmc_get_info(IF_MD2(int drive,) struct storage_info *info); #endif #ifdef HAVE_HOTSWAP -bool mmc_removable(IF_MV_NONVOID(int drive)); -bool mmc_present(IF_MV_NONVOID(int drive)); +bool mmc_removable(IF_MD_NONVOID(int drive)); +bool mmc_present(IF_MD_NONVOID(int drive)); #endif long mmc_last_disk_activity(void); +#ifdef CONFIG_STORAGE_MULTI +int mmc_num_drives(void); #endif + + +#endif Index: firmware/export/ramdisk.h =================================================================== --- firmware/export/ramdisk.h (revision 19143) +++ firmware/export/ramdisk.h (working copy) @@ -23,7 +23,7 @@ #define __RAMDISK_H__ #include -#include "mv.h" /* for HAVE_MULTIVOLUME or not */ +#include "mv.h" /* for HAVE_MULTIDRIVE or not */ struct storage_info; @@ -34,15 +34,20 @@ int ramdisk_soft_reset(void); int ramdisk_init(void); void ramdisk_close(void); -int ramdisk_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); -int ramdisk_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); +int ramdisk_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); +int ramdisk_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); void ramdisk_spin(void); void ramdisk_sleepnow(void); +int ramdisk_spinup_time(void); #ifdef STORAGE_GET_INFO -void ramdisk_get_info(IF_MV2(int drive,) struct storage_info *info); +void ramdisk_get_info(IF_MD2(int drive,) struct storage_info *info); #endif long ramdisk_last_disk_activity(void); +#ifdef CONFIG_STORAGE_MULTI +int ramdisk_num_drives(void); #endif + +#endif Index: firmware/export/ata.h =================================================================== --- firmware/export/ata.h (revision 19143) +++ firmware/export/ata.h (working copy) @@ -39,8 +39,8 @@ int ata_soft_reset(void); int ata_init(void); void ata_close(void); -int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); -int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); +int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); +int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); void ata_spin(void); #if (CONFIG_LED == LED_REAL) void ata_set_led_enabled(bool enabled); @@ -48,11 +48,11 @@ unsigned short* ata_get_identify(void); #ifdef STORAGE_GET_INFO -void ata_get_info(IF_MV2(int drive,) struct storage_info *info); +void ata_get_info(IF_MD2(int drive,) struct storage_info *info); #endif #ifdef HAVE_HOTSWAP -bool ata_removable(IF_MV_NONVOID(int drive)); -bool ata_present(IF_MV_NONVOID(int drive)); +bool ata_removable(IF_MD_NONVOID(int drive)); +bool ata_present(IF_MD_NONVOID(int drive)); #endif @@ -60,5 +60,9 @@ long ata_last_disk_activity(void); int ata_spinup_time(void); /* ticks */ +#ifdef CONFIG_STORAGE_MULTI +int ata_num_drives(void); +#endif + #endif Index: firmware/export/config-ondiosp.h =================================================================== --- firmware/export/config-ondiosp.h (revision 19143) +++ firmware/export/config-ondiosp.h (working copy) @@ -44,7 +44,8 @@ #define HAVE_FLASH_STORAGE /* define this if more than one device/partition can be used */ -#define HAVE_MULTIVOLUME +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 #define BATTERY_CAPACITY_DEFAULT 1000 /* default battery capacity */ #define BATTERY_CAPACITY_MIN 500 /* min. capacity selectable */ Index: firmware/export/disk.h =================================================================== --- firmware/export/disk.h (revision 19143) +++ firmware/export/disk.h (working copy) @@ -35,7 +35,7 @@ #define PARTITION_TYPE_OS2_HIDDEN_C_DRIVE 0x84 /* returns a pointer to an array of 8 partinfo structs */ -struct partinfo* disk_init(IF_MV_NONVOID(int volume)); +struct partinfo* disk_init(IF_MD_NONVOID(int drive)); struct partinfo* disk_partinfo(int partition); int disk_mount_all(void); /* returns the # of successful mounts */ int disk_mount(int drive); Index: firmware/export/config-ondavx747.h =================================================================== --- firmware/export/config-ondavx747.h (revision 19143) +++ firmware/export/config-ondavx747.h (working copy) @@ -41,7 +41,8 @@ #define CONFIG_NAND NAND_CC -#define HAVE_MULTIVOLUME +#define HAVE_MULTIDRIVE +#define NUM_DRIVES 2 /* define this if you have a bitmap LCD display */ #define HAVE_LCD_BITMAP Index: firmware/export/fat.h =================================================================== --- firmware/export/fat.h (revision 19143) +++ firmware/export/fat.h (working copy) @@ -90,7 +90,7 @@ #endif extern void fat_init(void); -extern int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector); +extern int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector); extern int fat_unmount(int volume, bool flush); extern void fat_size(IF_MV2(int volume,) /* public for info */ unsigned long* size, Index: firmware/test/fat/main.c =================================================================== --- firmware/test/fat/main.c (revision 19143) +++ firmware/test/fat/main.c (working copy) @@ -696,7 +696,7 @@ #endif ) { DEBUGF("*** Mounting at block %ld\n",pinfo[i].start); - rc = fat_mount(IF_MV2(0,) IF_MV2(0,) pinfo[i].start); + rc = fat_mount(IF_MV2(0,) IF_MD2(0,) pinfo[i].start); if(rc) { DEBUGF("mount: %d",rc); return -1; @@ -705,7 +705,7 @@ } } if ( i==4 ) { - if(fat_mount(IF_MV2(0,) IF_MV2(0,) 0)) { + if(fat_mount(IF_MV2(0,) IF_MD2(0,) 0)) { DEBUGF("No FAT32 partition!"); return -1; } Index: firmware/test/i2c/main.c =================================================================== --- firmware/test/i2c/main.c (revision 19143) +++ firmware/test/i2c/main.c (working copy) @@ -642,7 +642,7 @@ - i = fat_mount(IF_MV2(0,) IF_MV2(0,) part[0].start); + i = fat_mount(IF_MV2(0,) IF_MD2(0,) part[0].start); debugf("fat_mount() returned %d\n", i); Index: firmware/usbstack/usb_storage.c =================================================================== --- firmware/usbstack/usb_storage.c (revision 19143) +++ firmware/usbstack/usb_storage.c (working copy) @@ -42,11 +42,12 @@ #if (CONFIG_STORAGE & STORAGE_SD) #define SERIALIZE_WRITES #endif -/* Enable the following define to export only the SD card slot. This - * is useful for USBCV MSC tests, as those are destructive. - * This won't work right if the device doesn't have a card slot. +/* Enable the following define to not export the first drive. This + * is useful for USBCV MSC tests, as those are destructive, or for + * while developing a usb driver to avoid bricking the device. + * This won't work right if the device has only one drive. */ -//#define ONLY_EXPOSE_CARD_SLOT +//#define HIDE_FIRST_DRIVE #ifdef USB_USE_RAMDISK #define RAMDISK_SIZE 2048 @@ -147,8 +148,7 @@ struct report_lun_data { unsigned int lun_list_length; unsigned int reserved1; - // TODO this should be cleaned up with the VOLUMES vs DRIVES mess - unsigned char luns[NUM_VOLUMES][8]; + unsigned char luns[NUM_DRIVES][8]; } __attribute__ ((packed)); struct sense_data { @@ -261,9 +261,9 @@ static void send_command_failed_result(void); static void send_block_data(void *data,int size); static void receive_block_data(void *data,int size); -static void fill_inquiry(IF_MV_NONVOID(int lun)); +static void fill_inquiry(IF_MD_NONVOID(int lun)); static void send_and_read_next(void); -static bool ejected[NUM_VOLUMES]; +static bool ejected[NUM_DRIVES]; static int usb_interface; static int ep_in, ep_out; @@ -281,7 +281,7 @@ SENDING_CSW } state = WAITING_FOR_COMMAND; -static bool check_disk_present(IF_MV_NONVOID(int volume)) +static bool check_disk_present(IF_MD_NONVOID(int volume)) { #ifdef USB_USE_RAMDISK return true; @@ -297,7 +297,7 @@ release excusive access */ bool canrelease=true; int i; - for(i=0;ibRequest) { case USB_BULK_GET_MAX_LUN: { -#ifdef ONLY_EXPOSE_CARD_SLOT - *tb.max_lun = 0; -#else - *tb.max_lun = NUM_VOLUMES - 1; + *tb.max_lun = storage_num_drives() - 1; +#ifdef HIDE_FIRST_DRIVE + *tb.max_lun --; #endif logf("ums: getmaxlun"); usb_drv_send(EP_CONTROL, tb.max_lun, 1); @@ -657,12 +656,12 @@ unsigned int block_size = 0; unsigned int block_count = 0; bool lun_present=true; -#ifdef ONLY_EXPOSE_CARD_SLOT - unsigned char lun = cbw->lun+1; -#else unsigned char lun = cbw->lun; + unsigned int block_size_mult = 1; +#ifdef HIDE_FIRST_DRIVE + lun++; #endif - unsigned int block_size_mult = 1; + storage_get_info(lun,&info); #ifdef USB_USE_RAMDISK block_size = SECTOR_SIZE; @@ -714,13 +713,14 @@ logf("scsi inquiry %d",lun); int allocation_length=0; int i; + unsigned int response_length = 8+8*storage_num_drives(); allocation_length|=(cbw->command_block[6]<<24); allocation_length|=(cbw->command_block[7]<<16); allocation_length|=(cbw->command_block[8]<<8); allocation_length|=(cbw->command_block[9]); memset(tb.lun_data,0,sizeof(struct report_lun_data)); - tb.lun_data->lun_list_length=htobe32(8*NUM_VOLUMES); - for(i=0;ilun_list_length=htobe32(8*storage_num_drives()); + for(i=0;iluns[i][1]=0; } send_command_result(tb.lun_data, - MIN(sizeof(struct report_lun_data), length)); + MIN(response_length, length)); break; } case SCSI_INQUIRY: logf("scsi inquiry %d",lun); - fill_inquiry(IF_MV(lun)); + fill_inquiry(IF_MD(lun)); length = MIN(length, cbw->command_block[4]); send_command_result(tb.inquiry, MIN(sizeof(struct inquiry_data), length)); @@ -1085,7 +1085,7 @@ } /* build SCSI INQUIRY */ -static void fill_inquiry(IF_MV_NONVOID(int lun)) +static void fill_inquiry(IF_MD_NONVOID(int lun)) { memset(tb.inquiry, 0, sizeof(struct inquiry_data)); struct storage_info info; Index: firmware/SOURCES =================================================================== --- firmware/SOURCES (revision 19143) +++ firmware/SOURCES (working copy) @@ -111,17 +111,25 @@ #ifndef SIMULATOR #if (CONFIG_STORAGE & STORAGE_MMC) drivers/ata_mmc.c -#elif (CONFIG_STORAGE & STORAGE_NAND) && (CONFIG_NAND == NAND_IFP7XX) +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) && (CONFIG_NAND == NAND_IFP7XX) drivers/ata_flash.c -#elif (CONFIG_STORAGE & STORAGE_NAND) && (CONFIG_NAND == NAND_TCC) +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) && (CONFIG_NAND == NAND_TCC) target/arm/ata-nand-telechips.c -#elif (CONFIG_STORAGE & STORAGE_NAND) && (CONFIG_NAND == NAND_SAMSUNG) +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) && (CONFIG_NAND == NAND_SAMSUNG) target/arm/s5l8700/ata-nand-s5l8700.c -#elif (CONFIG_STORAGE & STORAGE_ATA) +#endif +#if (CONFIG_STORAGE & STORAGE_ATA) drivers/ata.c -#elif (CONFIG_STORAGE & STORAGE_RAMDISK) +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) drivers/ramdisk.c -#endif /* CONFIG_STORAGE */ +#endif +#ifdef CONFIG_STORAGE_MULTI +storage.c +#endif drivers/fat.c #if (CONFIG_STORAGE & STORAGE_MMC) || (CONFIG_STORAGE & STORAGE_SD) hotswap.c Index: firmware/storage.c =================================================================== --- firmware/storage.c (revision 0) +++ firmware/storage.c (revision 0) @@ -0,0 +1,430 @@ +/*************************************************************************** + * __________ __ ___. + * Open \______ \ ____ ____ | | _\_ |__ _______ ___ + * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / + * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < + * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ + * \/ \/ \/ \/ \/ + * $Id: buffer.c 17847 2008-06-28 18:10:04Z bagder $ + * + * 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 "storage.h" + +#define DRIVER_MASK 0xff000000 +#define DRIVER_OFFSET 24 +#define DRIVE_MASK 0x00ff0000 +#define DRIVE_OFFSET 16 +#define PARTITION_MASK 0x0000ff00 +static unsigned int storage_drivers[MAX_NUM_DRIVES]; +static unsigned int num_drives; + +int storage_num_drives(void) +{ + return num_drives; +} + +int storage_init(void) +{ + int rc=0; + int i; + num_drives=0; +#if (CONFIG_STORAGE & STORAGE_ATA) + if((rc=ata_init())) return rc; + for(i=0;i>DRIVER_OFFSET; + int ldrive=(storage_drivers[drive]&DRIVE_MASK)>>DRIVE_OFFSET; + switch(driver) + { +#if (CONFIG_STORAGE & STORAGE_ATA) + case STORAGE_ATA: + return ata_read_sectors(ldrive,start,count,buf); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + case STORAGE_MMC: + return mmc_read_sectors(ldrive,start,count,buf); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + case STORAGE_SD: + return sd_read_sectors(ldrive,start,count,buf); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + case STORAGE_NAND: + return nand_read_sectors(ldrive,start,count,buf); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + case STORAGE_RAMDISK: + return ramdisk_read_sectors(ldrive,start,count,buf); +#endif + } + return -1; +} +int storage_write_sectors(int drive, unsigned long start, int count, const void* buf) +{ + int driver=(storage_drivers[drive]&DRIVER_MASK)>>DRIVER_OFFSET; + int ldrive=(storage_drivers[drive]&DRIVE_MASK)>>DRIVE_OFFSET; + switch(driver) + { +#if (CONFIG_STORAGE & STORAGE_ATA) + case STORAGE_ATA: + return ata_write_sectors(ldrive,start,count,buf); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + case STORAGE_MMC: + return mmc_write_sectors(ldrive,start,count,buf); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + case STORAGE_SD: + return sd_write_sectors(ldrive,start,count,buf); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + case STORAGE_NAND: + return nand_write_sectors(ldrive,start,count,buf); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + case STORAGE_RAMDISK: + return ramdisk_write_sectors(ldrive,start,count,buf); +#endif + } + return -1; +} + +void storage_enable(bool on) +{ +#if (CONFIG_STORAGE & STORAGE_ATA) + ata_enable(on); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + mmc_enable(on); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + sd_enable(on); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + nand_enable(on); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + ramdisk_enable(on); +#endif +} + +void storage_sleep(void) +{ +#if (CONFIG_STORAGE & STORAGE_ATA) + ata_sleep(); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + mmc_sleep(); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + sd_sleep(); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + nand_sleep(); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + ramdisk_sleep(); +#endif +} + +void storage_sleepnow(void) +{ +#if (CONFIG_STORAGE & STORAGE_ATA) + ata_sleepnow(); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + mmc_sleepnow(); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + sd_sleepnow(); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + nand_sleepnow(); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + ramdisk_sleepnow(); +#endif +} + +bool storage_disk_is_active(void) +{ +#if (CONFIG_STORAGE & STORAGE_ATA) + if(ata_disk_is_active()) return true; +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + if(mmc_disk_is_active()) return true; +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + if(sd_disk_is_active()) return true; +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + if(nand_disk_is_active()) return true; +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + if(ramdisk_disk_is_active()) return true; +#endif + return false; +} +int storage_soft_reset(void) +{ + int rc=0; +#if (CONFIG_STORAGE & STORAGE_ATA) + if((rc=ata_soft_reset())) return rc; +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + if((rc=mmc_soft_reset())) return rc; +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + if((rc=sd_soft_reset())) return rc; +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + if((rc=nand_soft_reset())) return rc; +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + if((rc=ramdisk_soft_reset())) return rc; +#endif + return 0; +} + +void storage_spin(void) +{ +#if (CONFIG_STORAGE & STORAGE_ATA) + ata_spin(); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + mmc_spin(); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + sd_spin(); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + nand_spin(); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + ramdisk_spin(); +#endif +} +void storage_spindown(int seconds) +{ +#if (CONFIG_STORAGE & STORAGE_ATA) + ata_spindown(seconds); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + mmc_spindown(seconds); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + sd_spindown(seconds); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + nand_spindown(seconds); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + ramdisk_spindown(seconds); +#endif +} +#if (CONFIG_LED == LED_REAL) +void storage_set_led_enabled(bool enabled) +{ +#if (CONFIG_STORAGE & STORAGE_ATA) + ata_set_led_enabled(enabled); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + mmc_set_led_enabled(enabled); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + sd_set_led_enabled(enabled); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + nand_set_led_enabled(enabled); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + ramdisk_set_led_enabled(enabled); +#endif +} +#endif +long storage_last_disk_activity(void) +{ + long max=0; + long t; +#if (CONFIG_STORAGE & STORAGE_ATA) + t=ata_last_disk_activity(); + if(t>max) max=t; +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + t=mmc_last_disk_activity(); + if(t>max) max=t; +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + t=sd_last_disk_activity(); + if(t>max) max=t; +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + t=nand_last_disk_activity(); + if(t>max) max=t; +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + t=ramdisk_last_disk_activity(); + if(t>max) max=t; +#endif + return max; +} +int storage_spinup_time(void) +{ + int max=0; + int t; +#if (CONFIG_STORAGE & STORAGE_ATA) + t=ata_spinup_time(); + if(t>max) max=t; +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + t=mmc_spinup_time(); + if(t>max) max=t; +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + t=sd_spinup_time(); + if(t>max) max=t; +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + t=nand_spinup_time(); + if(t>max) max=t; +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + t=ramdisk_spinup_time(); + if(t>max) max=t; +#endif + return max; +} +#ifdef STORAGE_GET_INFO +void storage_get_info(int drive, struct storage_info *info) +{ + int driver=(storage_drivers[drive]&DRIVER_MASK)>>DRIVER_OFFSET; + int ldrive=(storage_drivers[drive]&DRIVE_MASK)>>DRIVE_OFFSET; + switch(driver) + { +#if (CONFIG_STORAGE & STORAGE_ATA) + case STORAGE_ATA: + return ata_get_info(ldrive,info); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + case STORAGE_MMC: + return mmc_get_info(ldrive,info); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + case STORAGE_SD: + return sd_get_info(ldrive,info); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + case STORAGE_NAND: + return nand_get_info(ldrive,info); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + case STORAGE_RAMDISK: + return ramdisk_get_info(ldrive,info); +#endif + } +} +#endif +#ifdef HOTSWAP +bool storage_removable(int drive) +{ + int driver=(storage_drivers[drive]&DRIVER_MASK)>>DRIVER_OFFSET; + int ldrive=(storage_drivers[drive]&DRIVE_MASK)>>DRIVE_OFFSET; + switch(driver) + { +#if (CONFIG_STORAGE & STORAGE_ATA) + case STORAGE_ATA: + return ata_removable(ldrive); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + case STORAGE_MMC: + return mmc_removable(ldrive); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + case STORAGE_SD: + return sd_removable(ldrive); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + case STORAGE_NAND: + return nand_removable(ldrive); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + case STORAGE_RAMDISK: + return ramdisk_removable(ldrive); +#endif + } +} +bool storage_present(int drive) +{ + int driver=(storage_drivers[drive]&DRIVER_MASK)>>DRIVER_OFFSET; + int ldrive=(storage_drivers[drive]&DRIVE_MASK)>>DRIVE_OFFSET; + switch(driver) + { +#if (CONFIG_STORAGE & STORAGE_ATA) + case STORAGE_ATA: + return ata_present(ldrive); +#endif +#if (CONFIG_STORAGE & STORAGE_MMC) + case STORAGE_MMC: + return mmc_present(ldrive); +#endif +#if (CONFIG_STORAGE & STORAGE_SD) + case STORAGE_SD: + return sd_present(ldrive); +#endif +#if (CONFIG_STORAGE & STORAGE_NAND) + case STORAGE_NAND: + return nand_present(ldrive); +#endif +#if (CONFIG_STORAGE & STORAGE_RAMDISK) + case STORAGE_RAMDISK: + return ramdisk_present(ldrive); +#endif + } +} +#endif + Index: firmware/target/arm/s5l8700/ata-nand-s5l8700.c =================================================================== --- firmware/target/arm/s5l8700/ata-nand-s5l8700.c (revision 19143) +++ firmware/target/arm/s5l8700/ata-nand-s5l8700.c (working copy) @@ -46,13 +46,13 @@ led(onoff); } -int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, +int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int incount, void* inbuf) { } -int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, +int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* outbuf) { } @@ -87,3 +87,10 @@ int nand_init(void) { } + +#ifdef CONFIG_STORAGE_MULTI +int nand_num_drives(void) +{ + return 1; +} +#endif Index: firmware/target/arm/as3525/ata_sd_as3525.c =================================================================== --- firmware/target/arm/as3525/ata_sd_as3525.c (revision 19143) +++ firmware/target/arm/as3525/ata_sd_as3525.c (working copy) @@ -22,7 +22,7 @@ /* Driver for the ARM PL180 SD/MMC controller inside AS3525 SoC */ -#include "config.h" /* for HAVE_MULTIVOLUME */ +#include "config.h" /* for HAVE_MULTIDRIVE */ #include "fat.h" #include "thread.h" #include "hotswap.h" @@ -74,9 +74,9 @@ #define NAND_AS3525 0 /* embedded SD card */ #define SD_AS3525 1 /* SD slot if present */ -static const int pl180_base[NUM_VOLUMES] = { +static const int pl180_base[NUM_DRIVES] = { NAND_FLASH_BASE -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE , SD_MCI_BASE #endif }; @@ -84,7 +84,7 @@ #define BLOCK_SIZE 512 #define SECTOR_SIZE 512 -static tSDCardInfo card_info[NUM_VOLUMES]; +static tSDCardInfo card_info[NUM_DRIVES]; /* for compatibility */ static long last_disk_activity = -1; @@ -248,7 +248,7 @@ card_info[drive].numblocks = c_size * c_mult * (card_info[drive].max_read_bl_len/512); card_info[drive].capacity = card_info[drive].numblocks * card_info[drive].block_size; } -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE else if( (card_info[drive].csd[3]>>30) == 1) { /* CSD version 2.0 */ @@ -385,7 +385,7 @@ 1 /* clock source = PLLA */; CGU_PERI |= CGU_NAF_CLOCK_ENABLE; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE CGU_PERI |= CGU_MCI_CLOCK_ENABLE; #endif @@ -394,7 +394,7 @@ if(ret < 0) return ret; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE CCU_IO &= ~8; /* bits 3:2 = 01, xpd is SD interface */ CCU_IO |= 4; @@ -410,9 +410,9 @@ } #ifdef STORAGE_GET_INFO -void sd_get_info(IF_MV2(int drive,) struct storage_info *info) +void sd_get_info(IF_MD2(int drive,) struct storage_info *info) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif info->sector_size=card_info[drive].block_size; @@ -424,24 +424,24 @@ #endif #ifdef HAVE_HOTSWAP -bool sd_removable(IF_MV_NONVOID(int drive)) +bool sd_removable(IF_MD_NONVOID(int drive)) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif return (drive==1); } -bool sd_present(IF_MV_NONVOID(int drive)) +bool sd_present(IF_MD_NONVOID(int drive)) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif return (card_info[drive].initialized && card_info[drive].numblocks > 0); } #endif -int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf) +int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf) { (void)start; (void)count; @@ -506,10 +506,10 @@ } } -int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, +int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int incount, void* inbuf) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive = 0; #endif int ret; @@ -528,7 +528,7 @@ mutex_lock(&sd_mtx); -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE if (drive != 0 && !card_detect_target()) { /* no external sd-card inserted */ @@ -677,7 +677,7 @@ if(on) { CGU_PERI |= CGU_NAF_CLOCK_ENABLE; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE CGU_PERI |= CGU_MCI_CLOCK_ENABLE; #endif CGU_IDE |= (1<<7) /* AHB interface enable */ | @@ -686,7 +686,7 @@ else { CGU_PERI &= ~CGU_NAF_CLOCK_ENABLE; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE CGU_PERI &= ~CGU_MCI_CLOCK_ENABLE; #endif CGU_IDE &= ~((1<<7)|(1<<6)); @@ -749,3 +749,14 @@ #endif #endif /* BOOTLOADER */ + +#ifdef CONFIG_STORAGE_MULTI +int sd_num_drives(void) +{ +#ifdef HAVE_MULTIDRIVE + return 2; +#else + return 1; +#endif +} +#endif Index: firmware/target/arm/ata-nand-telechips.c =================================================================== --- firmware/target/arm/ata-nand-telechips.c (revision 19143) +++ firmware/target/arm/ata-nand-telechips.c (working copy) @@ -681,10 +681,10 @@ } -int nand_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, +int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int incount, void* inbuf) { -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE (void)drive; /* unused for now */ #endif mutex_lock(&ata_mtx); @@ -721,11 +721,10 @@ return 0; } - -int nand_write_sectors(IF_MV2(int drive,) unsigned long start, int count, +int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* outbuf) { -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE (void)drive; /* unused for now */ #endif @@ -878,3 +877,10 @@ { (void)seconds; } + +#ifdef CONFIG_STORAGE_MULTI +int nand_num_drives(void) +{ + return 1; +} +#endif Index: firmware/target/arm/tms320dm320/creative-zvm/ata-target.h =================================================================== --- firmware/target/arm/tms320dm320/creative-zvm/ata-target.h (revision 19143) +++ firmware/target/arm/tms320dm320/creative-zvm/ata-target.h (working copy) @@ -38,8 +38,8 @@ /* Nasty hack, but Creative is nasty... */ #define ata_read_sectors _ata_read_sectors #define ata_write_sectors _ata_write_sectors -extern int _ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); -extern int _ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); +extern int _ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); +extern int _ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); /* General purpose memory region #1 */ #define ATA_IOBASE 0x50FEE000 Index: firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c =================================================================== --- firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c (revision 19143) +++ firmware/target/arm/tms320dm320/creative-zvm/ata-creativezvm.c (working copy) @@ -124,8 +124,8 @@ #define VFAT_SECTOR_SIZE(x) ( (x)/0x8000 ) /* 1GB array requires 80kB of RAM */ -extern int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf); -extern int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf); +extern int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf); +extern int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf); struct main_header { @@ -354,14 +354,14 @@ return cfs_start+sectors[sector/64]*64+sector%64; } -int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf) +int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf) { if(!cfs_inited) cfs_init(); /* Check if count is lesser than or equal to 1 native CFS sector */ if(count <= 64) - return _ata_read_sectors(IF_MV2(drive,) map_sector(start), count, buf); + return _ata_read_sectors(IF_MD2(drive,) map_sector(start), count, buf); else { int i, ret; @@ -370,7 +370,7 @@ /* Read sectors in parts of 0x8000 */ for(i=0; i= 64 ? 64 : count-i), (void*)dest); + ret = _ata_read_sectors(IF_MD2(drive,) map_sector(start+i), (count-i >= 64 ? 64 : count-i), (void*)dest); if(ret != 0) return ret; @@ -381,14 +381,14 @@ } } -int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf) +int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf) { if(!cfs_inited) cfs_init(); /* Check if count is lesser than or equal to 1 native CFS sector */ if(count <= 64) - return _ata_write_sectors(IF_MV2(drive,) map_sector(start), count, buf); + return _ata_write_sectors(IF_MD2(drive,) map_sector(start), count, buf); else { int i, ret; @@ -397,7 +397,7 @@ /* Read sectors in parts of 0x8000 */ for(i=0; i= 64 ? 64 : count-i), (const void*)dest); + ret = _ata_write_sectors(IF_MD2(drive,) map_sector(start+i), (count-i >= 64 ? 64 : count-i), (const void*)dest); if(ret != 0) return ret; Index: firmware/target/arm/ata-sd-pp.c =================================================================== --- firmware/target/arm/ata-sd-pp.c (revision 19143) +++ firmware/target/arm/ata-sd-pp.c (working copy) @@ -18,7 +18,7 @@ * KIND, either express or implied. * ****************************************************************************/ -#include "config.h" /* for HAVE_MULTIVOLUME */ +#include "config.h" /* for HAVE_MULTIDRIVE */ #include "fat.h" #include "hotswap.h" #include "ata-sd-target.h" @@ -107,10 +107,10 @@ int retry_max; }; -static struct sd_card_status sd_status[NUM_VOLUMES] = +static struct sd_card_status sd_status[NUM_DRIVES] = { { 0, 1 }, -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE { 0, 10 } #endif }; @@ -745,10 +745,10 @@ led(onoff); } -int sd_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, +int sd_read_sectors(IF_MD2(int drive,) unsigned long start, int incount, void* inbuf) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive = 0; #endif int ret; @@ -859,13 +859,13 @@ } } -int sd_write_sectors(IF_MV2(int drive,) unsigned long start, int count, +int sd_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* outbuf) { /* Write support is not finished yet */ /* TODO: The standard suggests using ACMD23 prior to writing multiple blocks to improve performance */ -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive = 0; #endif int ret; @@ -1255,9 +1255,9 @@ } #ifdef STORAGE_GET_INFO -void sd_get_info(IF_MV2(int drive,) struct storage_info *info) +void sd_get_info(IF_MD2(int drive,) struct storage_info *info) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif info->sector_size=card_info[drive].block_size; @@ -1276,17 +1276,17 @@ #endif #ifdef HAVE_HOTSWAP -bool sd_removable(IF_MV_NONVOID(int drive)) +bool sd_removable(IF_MD_NONVOID(int drive)) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif return (drive==1); } -bool sd_present(IF_MV_NONVOID(int drive)) +bool sd_present(IF_MD_NONVOID(int drive)) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif return (card_info[drive].initialized && card_info[drive].numblocks > 0); @@ -1305,3 +1305,14 @@ { (void)seconds; } + +#ifdef CONFIG_STORAGE_MULTI +int sd_num_drives(void) +{ +#ifdef HAVE_MULTIDRIVE + return 2; +#else + return 1; +#endif +} +#endif Index: firmware/target/mips/ingenic_jz47xx/ata-jz4740.c =================================================================== --- firmware/target/mips/ingenic_jz47xx/ata-jz4740.c (revision 19143) +++ firmware/target/mips/ingenic_jz47xx/ata-jz4740.c (working copy) @@ -25,7 +25,7 @@ #include "ata-nand-target.h" #include "panic.h" -int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int count, void* buf) +int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf) { switch(drive) { @@ -39,7 +39,7 @@ } } -int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const void* buf) +int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf) { switch(drive) { @@ -102,3 +102,10 @@ /* null - flash controller is enabled/disabled as needed. */ (void)on; } + +#ifdef CONFIG_STORAGE_MULTI +int ata_num_drives(void) +{ + return 2; +} +#endif Index: firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c =================================================================== --- firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c (revision 19143) +++ firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c (working copy) @@ -1166,3 +1166,10 @@ (void)buf; return -1; } + +#ifdef CONFIG_STORAGE_MULTI +int sd_num_drives(void) +{ + return 1; +} +#endif Index: firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c =================================================================== --- firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c (revision 19143) +++ firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c (working copy) @@ -506,3 +506,10 @@ /* null - flash controller is enabled/disabled as needed. */ (void)on; } + +#ifdef CONFIG_STORAGE_MULTI +int nand_num_drives(void) +{ + return 1; +} +#endif Index: firmware/common/disk.c =================================================================== --- firmware/common/disk.c (revision 19143) +++ firmware/common/disk.c (working copy) @@ -65,11 +65,11 @@ int disk_sector_multiplier = 1; #endif -struct partinfo* disk_init(IF_MV_NONVOID(int drive)) +struct partinfo* disk_init(IF_MD_NONVOID(int drive)) { int i; unsigned char sector[512]; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE /* For each drive, start at a different position, in order not to destroy the first entry of drive 0. That one is needed to calculate config sector position. */ @@ -155,7 +155,7 @@ { int mounted = 0; /* reset partition-on-drive flag */ int volume = get_free_volume(); - struct partinfo* pinfo = disk_init(IF_MV(drive)); + struct partinfo* pinfo = disk_init(IF_MD(drive)); if (pinfo == NULL) { @@ -177,7 +177,7 @@ for (j = 1; j <= (MAX_LOG_SECTOR_SIZE/SECTOR_SIZE); j <<= 1) { - if (!fat_mount(IF_MV2(volume,) IF_MV2(drive,) pinfo[i].start * j)) + if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) pinfo[i].start * j)) { pinfo[i].start *= j; pinfo[i].size *= j; @@ -190,7 +190,7 @@ } } #else - if (!fat_mount(IF_MV2(volume,) IF_MV2(drive,) pinfo[i].start)) + if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) pinfo[i].start)) { mounted++; vol_drive[volume] = drive; /* remember the drive for this volume */ @@ -202,7 +202,7 @@ if (mounted == 0 && volume != -1) /* none of the 4 entries worked? */ { /* try "superfloppy" mode */ DEBUGF("No partition found, trying to mount sector 0.\n"); - if (!fat_mount(IF_MV2(volume,) IF_MV2(drive,) 0)) + if (!fat_mount(IF_MV2(volume,) IF_MD2(drive,) 0)) { mounted = 1; vol_drive[volume] = drive; /* remember the drive for this volume */ Index: firmware/drivers/ata.c =================================================================== --- firmware/drivers/ata.c (revision 19143) +++ firmware/drivers/ata.c (working copy) @@ -295,7 +295,7 @@ int incount, void* inbuf) #else -int ata_read_sectors(IF_MV2(int drive,) +int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int incount, void* inbuf) @@ -308,7 +308,7 @@ long spinup_start; #ifndef MAX_PHYS_SECTOR_SIZE -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE (void)drive; /* unused for now */ #endif mutex_lock(&ata_mtx); @@ -504,7 +504,7 @@ int count, const void* buf) #else -int ata_write_sectors(IF_MV2(int drive,) +int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf) @@ -515,7 +515,7 @@ long spinup_start; #ifndef MAX_PHYS_SECTOR_SIZE -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE (void)drive; /* unused for now */ #endif mutex_lock(&ata_mtx); @@ -645,7 +645,7 @@ sector_cache.data); } -int ata_read_sectors(IF_MV2(int drive,) +int ata_read_sectors(IF_MD2(int drive,) unsigned long start, int incount, void* inbuf) @@ -653,7 +653,7 @@ int rc = 0; int offset; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE (void)drive; /* unused for now */ #endif mutex_lock(&ata_mtx); @@ -711,7 +711,7 @@ return rc; } -int ata_write_sectors(IF_MV2(int drive,) +int ata_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf) @@ -719,7 +719,7 @@ int rc = 0; int offset; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE (void)drive; /* unused for now */ #endif mutex_lock(&ata_mtx); @@ -1404,12 +1404,15 @@ } #ifdef STORAGE_GET_INFO -void ata_get_info(struct storage_info *info) +void ata_get_info(IF_MD2(int drive,)struct storage_info *info) { unsigned short *src,*dest; static char vendor[8]; static char product[16]; static char revision[4]; +#ifdef HAVE_MULTIDRIVE + (void)drive; /* unused for now */ +#endif int i; info->sector_size = SECTOR_SIZE; info->num_sectors= ((unsigned long)identify_info[61] << 16 | \ @@ -1434,3 +1437,10 @@ info->revision=revision; } #endif + +#ifdef CONFIG_STORAGE_MULTI +int ata_num_drives(void) +{ + return 1; +} +#endif Index: firmware/drivers/ata_mmc.c =================================================================== --- firmware/drivers/ata_mmc.c (revision 19143) +++ firmware/drivers/ata_mmc.c (working copy) @@ -125,7 +125,7 @@ static const unsigned char *send_block_addr = NULL; static tCardInfo card_info[2]; -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE static int current_card = 0; #endif static bool last_mmc_status = false; @@ -601,7 +601,7 @@ return rc; } -int mmc_read_sectors(IF_MV2(int drive,) +int mmc_read_sectors(IF_MD2(int drive,) unsigned long start, int incount, void* inbuf) @@ -610,7 +610,7 @@ int lastblock = 0; unsigned long end_block; tCardInfo *card; -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE int drive = current_card; #endif @@ -687,7 +687,7 @@ return rc; } -int mmc_write_sectors(IF_MV2(int drive,) +int mmc_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf) @@ -696,7 +696,7 @@ int write_cmd; unsigned char start_token; tCardInfo *card; -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE int drive = current_card; #endif @@ -919,7 +919,7 @@ led(false); last_mmc_status = mmc_detect(); -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE /* Use MMC if inserted, internal flash otherwise */ current_card = last_mmc_status ? 1 : 0; #endif @@ -964,9 +964,9 @@ } #ifdef STORAGE_GET_INFO -void mmc_get_info(IF_MV2(int drive,) struct storage_info *info) +void mmc_get_info(IF_MD2(int drive,) struct storage_info *info) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif info->sector_size=card_info[drive].blocksize; @@ -985,17 +985,17 @@ #endif #ifdef HAVE_HOTSWAP -bool mmc_removable(IF_MV_NONVOID(int drive)) +bool mmc_removable(IF_MD_NONVOID(int drive)) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif return (drive==1); } -bool mmc_present(IF_MV_NONVOID(int drive)) +bool mmc_present(IF_MD_NONVOID(int drive)) { -#ifndef HAVE_MULTIVOLUME +#ifndef HAVE_MULTIDRIVE const int drive=0; #endif return (card_info[drive].initialized && card_info[drive].numblocks > 0); @@ -1015,3 +1015,14 @@ { (void)seconds; } + +#ifdef CONFIG_STORAGE_MULTI +int mmc_num_drives(void) +{ +#ifdef HAVE_MULTIDRIVE + return 2; +#else + return 1; +#endif +} +#endif Index: firmware/drivers/fat.c =================================================================== --- firmware/drivers/fat.c (revision 19143) +++ firmware/drivers/fat.c (working copy) @@ -167,7 +167,9 @@ * of first pseudo cluster */ #endif /* #ifdef HAVE_FAT16SUPPORT */ #ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE int drive; /* on which physical device is this located */ +#endif bool mounted; /* flag if this volume is mounted */ #endif }; @@ -285,7 +287,7 @@ #endif } -int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector) +int fat_mount(IF_MV2(int volume,) IF_MD2(int drive,) long startsector) { #ifndef HAVE_MULTIVOLUME const int volume = 0; @@ -309,7 +311,7 @@ memset(fat_bpb, 0, sizeof(struct bpb)); fat_bpb->startsector = startsector; -#ifdef HAVE_MULTIVOLUME +#ifdef HAVE_MULTIDRIVE fat_bpb->drive = drive; #endif Index: firmware/drivers/ata_flash.c =================================================================== --- firmware/drivers/ata_flash.c (revision 19143) +++ firmware/drivers/ata_flash.c (working copy) @@ -384,7 +384,7 @@ return done; } -int nand_read_sectors(IF_MV2(int drive,) +int nand_read_sectors(IF_MD2(int drive,) unsigned long start, int incount, void* inbuf) @@ -401,7 +401,7 @@ return 0; } -int nand_write_sectors(IF_MV2(int drive,) +int nand_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf) @@ -472,3 +472,10 @@ } #endif +#ifdef CONFIG_STORAGE_MULTI +int nand_num_drives(void) +{ + return 1; +} +#endif + Index: firmware/drivers/ramdisk.c =================================================================== --- firmware/drivers/ramdisk.c (revision 19143) +++ firmware/drivers/ramdisk.c (working copy) @@ -31,11 +31,14 @@ long last_disk_activity = -1; -int ramdisk_read_sectors(IF_MV2(int drive,) +int ramdisk_read_sectors(IF_MD2(int drive,) unsigned long start, int count, void* buf) { +#ifdef HAVE_MULTIDRIVE + (void)drive; /* unused for now */ +#endif if(start+count>=NUM_SECTORS) { return -1; @@ -44,11 +47,14 @@ return 0; } -int ramdisk_write_sectors(IF_MV2(int drive,) +int ramdisk_write_sectors(IF_MD2(int drive,) unsigned long start, int count, const void* buf) { +#ifdef HAVE_MULTIDRIVE + (void)drive; /* unused for now */ +#endif if(start+count>=NUM_SECTORS) { return -1; @@ -79,13 +85,36 @@ { } +void ramdisk_enable(bool on) +{ + (void)on; +} + +bool ramdisk_disk_is_active(void) +{ + return true; +} + +int ramdisk_soft_reset(void) +{ + return 0; +} + +int ramdisk_spinup_time(void) +{ + return 0; +} + void ramdisk_spindown(int seconds) { (void)seconds; } #ifdef STORAGE_GET_INFO -void ramdisk_get_info(IF_MV2(int drive,) struct storage_info *info) +void ramdisk_get_info(IF_MD2(int drive,) struct storage_info *info) { +#ifdef HAVE_MULTIDRIVE + (void)drive; /* unused for now */ +#endif /* firmware version */ info->revision="0.00"; @@ -100,3 +129,11 @@ } #endif +#ifdef CONFIG_STORAGE_MULTI +int ramdisk_num_drives(void) +{ + return 1; +} +#endif + +