summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/ata.c33
-rw-r--r--firmware/drivers/ata_flash.c14
-rw-r--r--firmware/drivers/ata_mmc.c40
-rw-r--r--firmware/drivers/fat.c6
-rw-r--r--firmware/drivers/ramdisk.c46
5 files changed, 109 insertions, 30 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index adc720e..3c37077 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -307,7 +307,7 @@ static int _read_sectors(unsigned long start,
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)
@@ -323,7 +323,7 @@ int ata_read_sectors(IF_MV2(int drive,)
#endif
#ifndef MAX_PHYS_SECTOR_SIZE
-#ifdef HAVE_MULTIVOLUME
+#ifdef HAVE_MULTIDRIVE
(void)drive; /* unused for now */
#endif
mutex_lock(&ata_mtx);
@@ -555,7 +555,7 @@ static int _write_sectors(unsigned long start,
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)
@@ -569,7 +569,7 @@ int ata_write_sectors(IF_MV2(int drive,)
#endif
#ifndef MAX_PHYS_SECTOR_SIZE
-#ifdef HAVE_MULTIVOLUME
+#ifdef HAVE_MULTIDRIVE
(void)drive; /* unused for now */
#endif
mutex_lock(&ata_mtx);
@@ -728,7 +728,7 @@ static inline int flush_current_sector(void)
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)
@@ -736,7 +736,7 @@ int ata_read_sectors(IF_MV2(int drive,)
int rc = 0;
int offset;
-#ifdef HAVE_MULTIVOLUME
+#ifdef HAVE_MULTIDRIVE
(void)drive; /* unused for now */
#endif
mutex_lock(&ata_mtx);
@@ -794,7 +794,7 @@ int ata_read_sectors(IF_MV2(int drive,)
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)
@@ -802,7 +802,7 @@ int ata_write_sectors(IF_MV2(int drive,)
int rc = 0;
int offset;
-#ifdef HAVE_MULTIVOLUME
+#ifdef HAVE_MULTIDRIVE
(void)drive; /* unused for now */
#endif
mutex_lock(&ata_mtx);
@@ -1503,7 +1503,7 @@ int ata_init(void)
create_thread(ata_thread, ata_stack,
sizeof(ata_stack), 0, ata_thread_name
IF_PRIO(, PRIORITY_USER_INTERFACE)
- IF_COP(, CPU));
+ IF_COP(, CPU));
initialized = true;
}
@@ -1552,12 +1552,15 @@ int ata_spinup_time(void)
}
#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= total_sectors;
@@ -1595,3 +1598,13 @@ void ata_keep_active(void)
last_disk_activity = current_tick;
}
#endif
+
+#ifdef CONFIG_STORAGE_MULTI
+int ata_num_drives(int first_drive)
+{
+ /* We don't care which logical drive number(s) we have been assigned */
+ (void)first_drive;
+
+ return 1;
+}
+#endif
diff --git a/firmware/drivers/ata_flash.c b/firmware/drivers/ata_flash.c
index ba96ea0..2d31b41 100644
--- a/firmware/drivers/ata_flash.c
+++ b/firmware/drivers/ata_flash.c
@@ -384,7 +384,7 @@ int flash_disk_read_sectors(unsigned long start,
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 @@ int nand_read_sectors(IF_MV2(int drive,)
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,13 @@ void nand_get_info(struct storage_info *info)
}
#endif
+#ifdef CONFIG_STORAGE_MULTI
+int nand_num_drives(int first_drive)
+{
+ /* We don't care which logical drive number(s) we have been assigned */
+ (void)first_drive;
+
+ return 1;
+}
+#endif
+
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index 0fe89c5..2397785 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -126,7 +126,7 @@ static int current_buffer = 0;
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;
@@ -602,7 +602,7 @@ static int send_block_send(unsigned char start_token, long timeout,
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)
@@ -611,7 +611,7 @@ int mmc_read_sectors(IF_MV2(int drive,)
int lastblock = 0;
unsigned long end_block;
tCardInfo *card;
-#ifndef HAVE_MULTIVOLUME
+#ifndef HAVE_MULTIDRIVE
int drive = current_card;
#endif
@@ -688,7 +688,7 @@ int mmc_read_sectors(IF_MV2(int drive,)
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)
@@ -697,7 +697,7 @@ int mmc_write_sectors(IF_MV2(int drive,)
int write_cmd;
unsigned char start_token;
tCardInfo *card;
-#ifndef HAVE_MULTIVOLUME
+#ifndef HAVE_MULTIDRIVE
int drive = current_card;
#endif
@@ -920,7 +920,7 @@ int mmc_init(void)
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
@@ -949,7 +949,7 @@ int mmc_init(void)
create_thread(mmc_thread, mmc_stack,
sizeof(mmc_stack), 0, mmc_thread_name
IF_PRIO(, PRIORITY_SYSTEM)
- IF_COP(, CPU));
+ IF_COP(, CPU));
tick_add_task(mmc_tick);
initialized = true;
}
@@ -965,9 +965,9 @@ long mmc_last_disk_activity(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)
{
-#ifndef HAVE_MULTIVOLUME
+#ifndef HAVE_MULTIDRIVE
const int drive=0;
#endif
info->sector_size=card_info[drive].blocksize;
@@ -986,17 +986,17 @@ void mmc_get_info(IF_MV2(int drive,) struct storage_info *info)
#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);
@@ -1016,3 +1016,17 @@ void mmc_spindown(int seconds)
{
(void)seconds;
}
+
+#ifdef CONFIG_STORAGE_MULTI
+int mmc_num_drives(int first_drive)
+{
+ /* We don't care which logical drive number(s) we have been assigned */
+ (void)first_drive;
+
+#ifdef HAVE_MULTIDRIVE
+ return 2;
+#else
+ return 1;
+#endif
+}
+#endif
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index a710593..e319669 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -167,7 +167,9 @@ struct bpb
* 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 @@ void fat_init(void)
#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 @@ int fat_mount(IF_MV2(int volume,) IF_MV2(int drive,) long startsector)
memset(fat_bpb, 0, sizeof(struct bpb));
fat_bpb->startsector = startsector;
-#ifdef HAVE_MULTIVOLUME
+#ifdef HAVE_MULTIDRIVE
fat_bpb->drive = drive;
#endif
diff --git a/firmware/drivers/ramdisk.c b/firmware/drivers/ramdisk.c
index 0ea4012..661aa39 100644
--- a/firmware/drivers/ramdisk.c
+++ b/firmware/drivers/ramdisk.c
@@ -31,11 +31,14 @@ unsigned char ramdisk[SECTOR_SIZE * NUM_SECTORS];
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 @@ int ramdisk_read_sectors(IF_MV2(int drive,)
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_sleepnow(void)
{
}
+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,14 @@ void ramdisk_get_info(IF_MV2(int drive,) struct storage_info *info)
}
#endif
+#ifdef CONFIG_STORAGE_MULTI
+int ramdisk_num_drives(int first_drive)
+{
+ /* We don't care which logical drive number(s) we have been assigned */
+ (void)first_drive;
+
+ return 1;
+}
+#endif
+
+