diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2007-07-29 04:49:19 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2007-07-29 04:49:19 +0000 |
commit | e64f7e3a6f3019be855469373920198ac19ee654 (patch) | |
tree | df75ceff98beb6d4eff222fa18de74b155d33ddc /firmware/target/arm/sandisk | |
parent | 4f08483b3992d0d66300fd2109529965301ee880 (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.c | 15 |
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); } |