summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--firmware/common/pathfuncs.c9
-rw-r--r--firmware/export/config.h6
-rw-r--r--firmware/export/hostfs.h2
-rw-r--r--firmware/export/mv.h3
-rw-r--r--firmware/export/storage.h8
-rw-r--r--firmware/target/hosted/fiio/system-fiio.c4
-rw-r--r--firmware/target/hosted/system-hosted.c7
7 files changed, 35 insertions, 4 deletions
diff --git a/firmware/common/pathfuncs.c b/firmware/common/pathfuncs.c
index 0935a9a6e3..1c48a54972 100644
--- a/firmware/common/pathfuncs.c
+++ b/firmware/common/pathfuncs.c
@@ -45,6 +45,9 @@ enum storage_name_dec_indexes
#if (CONFIG_STORAGE & STORAGE_RAMDISK)
STORAGE_DEC_IDX_RAMDISK,
#endif
+#if (CONFIG_STORAGE & STORAGE_USB)
+ STORAGE_DEC_IDX_USB,
+#endif
#if (CONFIG_STORAGE & STORAGE_HOSTFS)
STORAGE_DEC_IDX_HOSTFS,
#endif
@@ -68,6 +71,9 @@ static const char * const storage_dec_names[STORAGE_NUM_DEC_IDX+1] =
#if (CONFIG_STORAGE & STORAGE_RAMDISK)
[STORAGE_DEC_IDX_RAMDISK] = RAMDISK_VOL_DEC,
#endif
+#if (CONFIG_STORAGE & STORAGE_USB)
+ [STORAGE_DEC_IDX_USB] = USB_VOL_DEC,
+#endif
#if (CONFIG_STORAGE & STORAGE_HOSTFS)
[STORAGE_DEC_IDX_HOSTFS] = HOSTFS_VOL_DEC,
#endif
@@ -92,6 +98,9 @@ static const unsigned char storage_dec_indexes[STORAGE_NUM_TYPES+1] =
#if (CONFIG_STORAGE & STORAGE_RAMDISK)
[STORAGE_RAMDISK_NUM] = STORAGE_DEC_IDX_RAMDISK,
#endif
+#if (CONFIG_STORAGE & STORAGE_USB)
+ [STORAGE_USB_NUM] = STORAGE_DEC_IDX_USB,
+#endif
#if (CONFIG_STORAGE & STORAGE_HOSTFS)
[STORAGE_HOSTFS_NUM] = STORAGE_DEC_IDX_HOSTFS,
#endif
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 7e8d751090..547c359d8d 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -32,14 +32,16 @@
#define STORAGE_SD_NUM 2
#define STORAGE_NAND_NUM 3
#define STORAGE_RAMDISK_NUM 4
-#define STORAGE_HOSTFS_NUM 5
-#define STORAGE_NUM_TYPES 6
+#define STORAGE_USB_NUM 5
+#define STORAGE_HOSTFS_NUM 6
+#define STORAGE_NUM_TYPES 7
#define STORAGE_ATA (1 << STORAGE_ATA_NUM)
#define STORAGE_MMC (1 << STORAGE_MMC_NUM)
#define STORAGE_SD (1 << STORAGE_SD_NUM)
#define STORAGE_NAND (1 << STORAGE_NAND_NUM)
#define STORAGE_RAMDISK (1 << STORAGE_RAMDISK_NUM)
+#define STORAGE_USB (1 << STORAGE_USB_NUM)
/* meant for APPLICATION targets (implicit for SIMULATOR) */
#define STORAGE_HOSTFS (1 << STORAGE_HOSTFS_NUM)
diff --git a/firmware/export/hostfs.h b/firmware/export/hostfs.h
index fa916870f3..c0fe85236e 100644
--- a/firmware/export/hostfs.h
+++ b/firmware/export/hostfs.h
@@ -54,6 +54,8 @@ extern int hostfs_driver_type(int drive);
# define hostfs_driver_type(drive) (STORAGE_ATA_NUM)
# elif (CONFIG_STORAGE & STORAGE_SD)
# define hostfs_driver_type(drive) (STORAGE_SD_NUM)
+# elif (CONFIG_STORAGE & STORAGE_USB)
+# define hostfs_driver_type(drive) (STORAGE_USB_NUM)
# elif (CONFIG_STORAGE & STORAGE_MMC)
# define hostfs_driver_type(drive) (STORAGE_MMC_NUM)
# elif (CONFIG_STORAGE & STORAGE_NAND)
diff --git a/firmware/export/mv.h b/firmware/export/mv.h
index ec7b2efdbd..3657ef6c98 100644
--- a/firmware/export/mv.h
+++ b/firmware/export/mv.h
@@ -70,6 +70,9 @@
#if (CONFIG_STORAGE & STORAGE_RAMDISK)
#define RAMDISK_VOL_DEC "RAMDisk"
#endif
+#if (CONFIG_STORAGE & STORAGE_USB)
+#define USB_VOL_DEC "USB"
+#endif
#if (CONFIG_STORAGE & STORAGE_HOSTFS)
#ifndef HOSTFS_VOL_DEC /* overridable */
#define HOSTFS_VOL_DEC DEFAULT_VOL_DEC
diff --git a/firmware/export/storage.h b/firmware/export/storage.h
index e6424f7b03..ee1423c93a 100644
--- a/firmware/export/storage.h
+++ b/firmware/export/storage.h
@@ -34,6 +34,9 @@
#if (CONFIG_STORAGE & STORAGE_SD)
#include "sd.h"
#endif
+#if (CONFIG_STORAGE & STORAGE_USB)
+// TODO: Doesn't matter until we're native
+#endif
#if (CONFIG_STORAGE & STORAGE_MMC)
#include "mmc.h"
#endif
@@ -97,6 +100,9 @@ int nand_event(long id, intptr_t data);
#if (CONFIG_STORAGE & STORAGE_RAMDISK)
int ramdisk_event(long id, intptr_t data);
#endif
+#if (CONFIG_STORAGE & STORAGE_USB)
+// int usb_event(long id, intptr_t data); // TODO: Implement
+#endif
struct storage_info
{
@@ -278,6 +284,8 @@ static inline void storage_sleep(void) {};
#define storage_present(drive) ramdisk_present(IF_MD(drive))
#endif
#define storage_driver_type(drive) (STORAGE_RAMDISK_NUM)
+ #elif (CONFIG_STORAGE & STORAGE_USB)
+ // TODO: Eventually fix me
#else
//#error No storage driver!
#endif
diff --git a/firmware/target/hosted/fiio/system-fiio.c b/firmware/target/hosted/fiio/system-fiio.c
index f011ceea75..46a4d0f835 100644
--- a/firmware/target/hosted/fiio/system-fiio.c
+++ b/firmware/target/hosted/fiio/system-fiio.c
@@ -174,7 +174,11 @@ int volume_drive(int drive)
#ifdef CONFIG_STORAGE_MULTI
int hostfs_driver_type(int drive)
{
+#if (CONFIG_STORAGE & STORAGE_USB)
+ return drive > 0 ? STORAGE_USB_NUM : STORAGE_HOSTFS_NUM;
+#else
return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM;
+#endif
}
#endif /* CONFIG_STORAGE_MULTI */
diff --git a/firmware/target/hosted/system-hosted.c b/firmware/target/hosted/system-hosted.c
index cad84ac868..f485dc4c15 100644
--- a/firmware/target/hosted/system-hosted.c
+++ b/firmware/target/hosted/system-hosted.c
@@ -130,7 +130,7 @@ void system_exception_wait(void)
bool hostfs_removable(IF_MD_NONVOID(int drive))
{
#ifdef HAVE_MULTIDRIVE
- if (drive > 0) /* Active LOW */
+ if (drive > 0)
return true;
else
#endif
@@ -157,7 +157,11 @@ int volume_drive(int drive)
#ifdef CONFIG_STORAGE_MULTI
int hostfs_driver_type(int drive)
{
+#if (CONFIG_STORAGE & STORAGE_USB)
+ return drive > 0 ? STORAGE_USB_NUM : STORAGE_HOSTFS_NUM;
+#else
return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM;
+#endif
}
#endif /* CONFIG_STORAGE_MULTI */
@@ -185,4 +189,3 @@ bool volume_present(int volume)
return hostfs_present(volume);
}
#endif
-