summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2008-05-13 02:50:31 +0000
committerMark Arigo <markarigo@gmail.com>2008-05-13 02:50:31 +0000
commit3e743ec6c9685ef3b7d9729e2b21236bf66bed93 (patch)
tree199570de7b6cb44ef7ccf26090fbbaa061b6101c /firmware
parent76567482215b9d786ba329072b715729ea506b7e (diff)
Preparing for the Philips SA9200 part 2. Since the SA9200 doesn't have a microsd card (no hotswap), use HAVE_ATA_SD for the Sansa flash driver so we don't rely on HAVE_HOTSWAP in some places.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17488 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/config-c200.h3
-rw-r--r--firmware/export/config-e200.h3
-rw-r--r--firmware/export/hotswap.h6
-rw-r--r--firmware/target/arm/ata-sd-pp.c8
-rw-r--r--firmware/target/arm/ata-sd-target.h3
-rw-r--r--firmware/target/arm/system-pp502x.c4
-rw-r--r--firmware/usbstack/usb_storage.c2
7 files changed, 21 insertions, 8 deletions
diff --git a/firmware/export/config-c200.h b/firmware/export/config-c200.h
index a0bb1aeb2c..9f3e78f611 100644
--- a/firmware/export/config-c200.h
+++ b/firmware/export/config-c200.h
@@ -113,6 +113,9 @@
/* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE
+/* define this if the flash memory uses the SecureDigital Memory Card protocol */
+#define HAVE_ATA_SD
+
#define BATTERY_CAPACITY_DEFAULT 530 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 530 /* min. capacity selectable */
#define BATTERY_CAPACITY_MAX 530 /* max. capacity selectable */
diff --git a/firmware/export/config-e200.h b/firmware/export/config-e200.h
index c49ee23841..8d42dd2618 100644
--- a/firmware/export/config-e200.h
+++ b/firmware/export/config-e200.h
@@ -108,6 +108,9 @@
/* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE
+/* define this if the flash memory uses the SecureDigital Memory Card protocol */
+#define HAVE_ATA_SD
+
#define BATTERY_CAPACITY_DEFAULT 750 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 750 /* min. capacity selectable */
#define BATTERY_CAPACITY_MAX 750 /* max. capacity selectable */
diff --git a/firmware/export/hotswap.h b/firmware/export/hotswap.h
index 7f0aa80fda..f54423325d 100644
--- a/firmware/export/hotswap.h
+++ b/firmware/export/hotswap.h
@@ -39,13 +39,13 @@ typedef struct
unsigned int block_exp; /* block size exponent */
} tCardInfo;
-#ifdef TARGET_TREE
-#ifdef HAVE_HOTSWAP
+#ifdef HAVE_ATA_SD
#include "ata-sd-target.h"
-#endif
#define card_detect card_detect_target
#define card_get_info card_get_info_target
+#ifdef HAVE_HOTSWAP
#define card_enable_monitoring card_enable_monitoring_target
+#endif
#else /* HAVE_MMC */
#include "ata_mmc.h"
#define card_detect mmc_detect
diff --git a/firmware/target/arm/ata-sd-pp.c b/firmware/target/arm/ata-sd-pp.c
index 8c7ebcddc7..e4ab922f24 100644
--- a/firmware/target/arm/ata-sd-pp.c
+++ b/firmware/target/arm/ata-sd-pp.c
@@ -18,9 +18,7 @@
****************************************************************************/
#include "fat.h"
#include "hotswap.h"
-#ifdef BOOTLOADER
#include "ata-sd-target.h"
-#endif
#include "ata_idle_notify.h"
#include "system.h"
#include <string.h>
@@ -1278,16 +1276,20 @@ tCardInfo *card_get_info_target(int card_no)
return &card;
}
-#ifdef HAVE_HOTSWAP
bool card_detect_target(void)
{
+#ifdef HAVE_HOTSWAP
#ifdef SANSA_E200
return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */
#elif defined SANSA_C200
return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */
#endif
+#else
+ return false;
+#endif
}
+#ifdef HAVE_HOTSWAP
static bool sd1_oneshot_callback(struct timeout *tmo)
{
(void)tmo;
diff --git a/firmware/target/arm/ata-sd-target.h b/firmware/target/arm/ata-sd-target.h
index dce2ca9030..33106156cc 100644
--- a/firmware/target/arm/ata-sd-target.h
+++ b/firmware/target/arm/ata-sd-target.h
@@ -40,6 +40,9 @@ typedef struct
tCardInfo *card_get_info_target(int card_no);
bool card_detect_target(void);
+
+#ifdef HAVE_HOTSWAP
void card_enable_monitoring_target(bool on);
+#endif
#endif
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index 9b335fe223..4e3f2c0cf0 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -54,17 +54,19 @@ void irq(void)
else if (CPU_HI_INT_STAT & I2C_MASK)
ipod_4g_button_int();
#elif defined(SANSA_E200)
+#ifdef HAVE_HOTSWAP
else if (CPU_HI_INT_STAT & GPIO0_MASK) {
if (GPIOA_INT_STAT & 0x80)
microsd_int();
}
+#endif
else if (CPU_HI_INT_STAT & GPIO1_MASK) {
if (GPIOF_INT_STAT & 0xff)
button_int();
if (GPIOH_INT_STAT & 0xc0)
clickwheel_int();
}
-#elif defined(SANSA_C200)
+#elif defined(SANSA_C200) && defined(HAVE_HOTSWAP)
else if (CPU_HI_INT_STAT & GPIO2_MASK) {
if (GPIOL_INT_STAT & 0x08)
microsd_int();
diff --git a/firmware/usbstack/usb_storage.c b/firmware/usbstack/usb_storage.c
index c496e5142b..72306995aa 100644
--- a/firmware/usbstack/usb_storage.c
+++ b/firmware/usbstack/usb_storage.c
@@ -605,7 +605,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
unsigned char lun = cbw->lun;
#endif
unsigned int block_size_mult = 1;
-#ifdef HAVE_HOTSWAP
+#if defined(HAVE_ATA_SD) || defined(HAVE_HOTSWAP)
tCardInfo* cinfo = card_get_info(lun);
if(cinfo->initialized==1 && cinfo->numblocks > 0) {
block_size = cinfo->blocksize;