summaryrefslogtreecommitdiff
path: root/firmware/target/arm/sandisk
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-07-29 04:49:19 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-07-29 04:49:19 +0000
commite64f7e3a6f3019be855469373920198ac19ee654 (patch)
treedf75ceff98beb6d4eff222fa18de74b155d33ddc /firmware/target/arm/sandisk
parent4f08483b3992d0d66300fd2109529965301ee880 (diff)
Add a new timeout API to the kernel. Enable only for e200 right now since it's the only user. Use that as the one-shot delay for SD card inserts.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14049 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/sandisk')
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/ata-e200.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c
index 1b67454445..ff277ec8a3 100644
--- a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c
@@ -1122,15 +1122,24 @@ bool card_detect_target(void)
return (GPIOA_INPUT_VAL & 0x80) == 0;
}
+static bool sd1_oneshot_callback(struct timeout *tmo)
+{
+ /* Take final state only - insert/remove is bouncy */
+ queue_remove_from_head(&sd_queue, SD_HOTSWAP);
+ queue_post(&sd_queue, SD_HOTSWAP, tmo->data);
+ return false;
+}
+
/* called on insertion/removal interrupt */
void microsd_int(void)
{
+ static struct timeout sd1_oneshot;
+
int detect = GPIOA_INPUT_VAL & 0x80;
GPIOA_INT_LEV = (GPIOA_INT_LEV & ~0x80) | (detect ^ 0x80);
GPIOA_INT_CLR = 0x80;
- /* Take final state only - insert/remove is bouncy */
- queue_remove_from_head(&sd_queue, SD_HOTSWAP);
- queue_post(&sd_queue, SD_HOTSWAP, detect == 0);
+ timeout_register(&sd1_oneshot, sd1_oneshot_callback,
+ detect ? 1 : HZ/2, detect == 0);
}