summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorFrank Gevaerts <frank@gevaerts.be>2008-11-03 20:52:27 +0000
committerFrank Gevaerts <frank@gevaerts.be>2008-11-03 20:52:27 +0000
commit214cd81f080436fddb1994ed712f1000e143dfd7 (patch)
tree98e8deb0db4160385c4b73291031e61c4bc0c516 /firmware/export
parent65d9ca8a6f557847cf87ffe37e5b1ef48b1fa11b (diff)
downloadrockbox-214cd81f080436fddb1994ed712f1000e143dfd7.zip
rockbox-214cd81f080436fddb1994ed712f1000e143dfd7.tar.gz
rockbox-214cd81f080436fddb1994ed712f1000e143dfd7.tar.bz2
rockbox-214cd81f080436fddb1994ed712f1000e143dfd7.tar.xz
Add ramdisk storage driver. It will be useful for developing multi-driver storage
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18993 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/config.h9
-rw-r--r--firmware/export/ramdisk.h53
-rw-r--r--firmware/export/storage.h31
3 files changed, 89 insertions, 4 deletions
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 1574d40..914ac1e 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -29,10 +29,11 @@
/* symbolic names for multiple choice configurations: */
/* CONFIG_STORAGE (note these are combineable bit-flags) */
-#define STORAGE_ATA 0x01
-#define STORAGE_MMC 0x02
-#define STORAGE_SD 0x04
-#define STORAGE_NAND 0x08
+#define STORAGE_ATA 0x01
+#define STORAGE_MMC 0x02
+#define STORAGE_SD 0x04
+#define STORAGE_NAND 0x08
+#define STORAGE_RAMDISK 0x10
/* CONFIG_TUNER (note these are combineable bit-flags) */
#define S1A0903X01 0x01 /* Samsung */
diff --git a/firmware/export/ramdisk.h b/firmware/export/ramdisk.h
new file mode 100644
index 0000000..7fb8fb7
--- /dev/null
+++ b/firmware/export/ramdisk.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2002 by Alan Korr
+ * 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.
+ *
+ ****************************************************************************/
+#ifndef __RAMDISK_H__
+#define __RAMDISK_H__
+
+#include <stdbool.h>
+#include "mv.h" /* for HAVE_MULTIVOLUME or not */
+
+struct storage_info;
+
+void ramdisk_enable(bool on);
+void ramdisk_spindown(int seconds);
+void ramdisk_sleep(void);
+bool ramdisk_disk_is_active(void);
+int ramdisk_hard_reset(void);
+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);
+void ramdisk_spin(void);
+void ramdisk_sleepnow(void);
+
+#if (CONFIG_LED == LED_REAL)
+void ramdisk_set_led_enabled(bool enabled);
+#endif
+
+#ifdef STORAGE_GET_INFO
+void ramdisk_get_info(IF_MV2(int drive,) struct storage_info *info);
+#endif
+
+long ramdisk_last_disk_activity(void);
+
+#endif
diff --git a/firmware/export/storage.h b/firmware/export/storage.h
index d4e6916..4040fe9 100644
--- a/firmware/export/storage.h
+++ b/firmware/export/storage.h
@@ -38,6 +38,9 @@
#if (CONFIG_STORAGE & STORAGE_NAND)
#include "nand.h"
#endif
+#if (CONFIG_STORAGE & STORAGE_RAMDISK)
+#include "ramdisk.h"
+#endif
struct storage_info
{
@@ -165,6 +168,34 @@ struct storage_info
#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_hard_reset() (void)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()
+
+ #if (CONFIG_LED == LED_REAL)
+ #define storage_set_led_enabled(enabled) ramdisk_set_led_enabled(enabled)
+ #endif
+ #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