summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/ipod/button-mini1g.c6
-rw-r--r--firmware/target/arm/sandisk/ata-c200_e200.c35
-rw-r--r--firmware/target/arm/system-pp502x.c9
3 files changed, 43 insertions, 7 deletions
diff --git a/firmware/target/arm/ipod/button-mini1g.c b/firmware/target/arm/ipod/button-mini1g.c
index 242f06c071..f02e6acaac 100644
--- a/firmware/target/arm/ipod/button-mini1g.c
+++ b/firmware/target/arm/ipod/button-mini1g.c
@@ -164,10 +164,10 @@ static int ipod_mini_button_read(void)
void ipod_mini_button_int(void)
{
- CPU_HI_INT_CLR = GPIO_MASK;
+ CPU_HI_INT_CLR = GPIO0_MASK;
int_btn = ipod_mini_button_read();
//CPU_INT_EN = 0x40000000;
- CPU_HI_INT_EN = GPIO_MASK;
+ CPU_HI_INT_EN = GPIO0_MASK;
}
void button_init_device(void)
@@ -190,7 +190,7 @@ void button_init_device(void)
GPIOB_INT_EN = 0x30;
/* unmask interrupt */
CPU_INT_EN = 0x40000000;
- CPU_HI_INT_EN = GPIO_MASK;
+ CPU_HI_INT_EN = GPIO0_MASK;
}
/*
diff --git a/firmware/target/arm/sandisk/ata-c200_e200.c b/firmware/target/arm/sandisk/ata-c200_e200.c
index 8e17152e6f..a8e1651280 100644
--- a/firmware/target/arm/sandisk/ata-c200_e200.c
+++ b/firmware/target/arm/sandisk/ata-c200_e200.c
@@ -1171,10 +1171,17 @@ int ata_init(void)
#ifdef HAVE_HOTSWAP
/* enable card detection port - mask interrupt first */
+#ifdef SANSA_E200
GPIOA_INT_EN &= ~0x80;
GPIOA_OUTPUT_EN &= ~0x80;
GPIOA_ENABLE |= 0x80;
+#elif defined SANSA_C200
+ GPIOL_INT_EN &= ~0x08;
+
+ GPIOL_OUTPUT_EN &= ~0x08;
+ GPIOL_ENABLE |= 0x08;
+#endif
#endif
sd_select_device(0);
@@ -1188,6 +1195,7 @@ int ata_init(void)
/* enable interupt for the mSD card */
sleep(HZ/10);
#ifdef HAVE_HOTSWAP
+#ifdef SANSA_E200
CPU_INT_EN = HI_MASK;
CPU_HI_INT_EN = GPIO0_MASK;
@@ -1195,6 +1203,15 @@ int ata_init(void)
GPIOA_INT_CLR = 0x80;
GPIOA_INT_EN |= 0x80;
+#elif defined SANSA_C200
+ CPU_INT_EN = HI_MASK;
+ CPU_HI_INT_EN = GPIO2_MASK;
+
+ GPIOL_INT_LEV = (GPIOL_INT_LEV & ~0x08) | (~GPIOL_INPUT_VAL & 0x08);
+
+ GPIOL_INT_CLR = 0x08;
+ GPIOL_INT_EN |= 0x08;
+#endif
#endif
spinlock_unlock(&sd_spin);
}
@@ -1239,8 +1256,11 @@ tCardInfo *card_get_info_target(int card_no)
#ifdef HAVE_HOTSWAP
bool card_detect_target(void)
{
- /* 0x00:inserted, 0x80:not inserted */
- return (GPIOA_INPUT_VAL & 0x80) == 0;
+#ifdef SANSA_E200
+ return (GPIOA_INPUT_VAL & 0x80) == 0; /* low active */
+#elif defined SANSA_C200
+ return (GPIOL_INPUT_VAL & 0x08) != 0; /* high active */
+#endif
}
static bool sd1_oneshot_callback(struct timeout *tmo)
@@ -1256,6 +1276,7 @@ void microsd_int(void)
{
static struct timeout sd1_oneshot;
+#ifdef SANSA_E200
int detect = GPIOA_INPUT_VAL & 0x80;
GPIOA_INT_LEV = (GPIOA_INT_LEV & ~0x80) | (detect ^ 0x80);
@@ -1263,5 +1284,15 @@ void microsd_int(void)
timeout_register(&sd1_oneshot, sd1_oneshot_callback,
detect ? 1 : HZ/2, detect == 0);
+#elif defined SANSA_C200
+ int detect = GPIOL_INPUT_VAL & 0x08;
+
+ GPIOL_INT_LEV = (GPIOL_INT_LEV & ~0x08) | (detect ^ 0x08);
+ GPIOL_INT_CLR = 0x08;
+
+ timeout_register(&sd1_oneshot, sd1_oneshot_callback,
+ detect ? HZ/2 : 1, detect != 0);
+#endif
+
}
#endif /* HAVE_HOTSWAP */
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index 8d253a70db..0f24997451 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -27,10 +27,10 @@ extern void TIMER1(void);
extern void TIMER2(void);
extern void ipod_mini_button_int(void); /* iPod Mini 1st gen only */
extern void ipod_4g_button_int(void); /* iPod 4th gen and higher only */
+extern void microsd_int(void); /* Sansa E200 and C200 */
#ifdef SANSA_E200
extern void button_int(void);
extern void clickwheel_int(void);
-extern void microsd_int(void);
#endif
#ifdef HAVE_USBSTACK
@@ -49,7 +49,7 @@ void irq(void)
} else if (CPU_INT_STAT & TIMER2_MASK)
TIMER2();
#if defined(IPOD_MINI) /* Mini 1st gen only, mini 2nd gen uses iPod 4G code */
- else if (CPU_HI_INT_STAT & GPIO_MASK)
+ else if (CPU_HI_INT_STAT & GPIO0_MASK)
ipod_mini_button_int();
#elif CONFIG_KEYPAD == IPOD_4G_PAD /* except Mini 1st gen, handled above */
else if (CPU_HI_INT_STAT & I2C_MASK)
@@ -65,6 +65,11 @@ void irq(void)
if (GPIOH_INT_STAT & 0xc0)
clickwheel_int();
}
+#elif defined(SANSA_C200)
+ else if (CPU_HI_INT_STAT & GPIO2_MASK) {
+ if (GPIOL_INT_STAT & 0x08)
+ microsd_int();
+ }
#endif
} else {
if (COP_INT_STAT & TIMER2_MASK)