summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-06-03 14:31:42 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-06-03 14:31:42 +0000
commit5c32faad432e74f9ccb7a6d0632492fe2dba5aab (patch)
tree8b94a3d5961e01b07d7e44b94d90c3d802c8d66a /firmware
parent20a8a9a3c8fefb38ba533e3a2a7e21d02e5b737b (diff)
e200: Finally use GPIO IRQs for the buttons...it's IRQ enable bit 33 afterall and verified independently. There shouldn't now be a need to add tick tasks to monitor GPIO level status in other code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13538 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/pp5024.h4
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/button-e200.c42
-rw-r--r--firmware/target/arm/system-pp502x.c11
3 files changed, 25 insertions, 32 deletions
diff --git a/firmware/export/pp5024.h b/firmware/export/pp5024.h
index b9238ae98d..59c003613b 100644
--- a/firmware/export/pp5024.h
+++ b/firmware/export/pp5024.h
@@ -20,11 +20,11 @@
****************************************************************************/
/* We believe is this quite similar to the 5020 and for how we just use that
- completely */
+ completely and redifine any minor differences */
#include "pp5020.h"
#undef GPIO_IRQ
-#define GPIO_IRQ (32+6)
+#define GPIO_IRQ (32+1)
#undef GPIO_MASK
#define GPIO_MASK (1 << (GPIO_IRQ-32))
diff --git a/firmware/target/arm/sandisk/sansa-e200/button-e200.c b/firmware/target/arm/sandisk/sansa-e200/button-e200.c
index 56bce816e4..f1d5981a18 100644
--- a/firmware/target/arm/sandisk/sansa-e200/button-e200.c
+++ b/firmware/target/arm/sandisk/sansa-e200/button-e200.c
@@ -39,6 +39,9 @@ static unsigned long next_backlight_on = 0;
/* Buttons */
static bool hold_button = false;
static bool hold_button_old = false;
+#define _button_hold() hold_button
+#else
+#define _button_hold() ((GPIOF_INPUT_VAL & 0x80) != 0)
#endif /* BOOTLOADER */
static int int_btn = BUTTON_NONE;
@@ -47,22 +50,19 @@ void button_init_device(void)
/* Enable all buttons */
GPIOF_OUTPUT_EN &= ~0xff;
GPIOF_ENABLE |= 0xff;
-
+
/* Scrollwheel light - enable control through GPIOG pin 7 and set timeout */
GPIOG_OUTPUT_EN |= 0x80;
GPIOG_ENABLE = 0x80;
#ifndef BOOTLOADER
+ /* Get current tick before enabling button interrupts */
+ last_wheel_tick = current_tick;
+ last_wheel_post = current_tick;
+
GPIOH_ENABLE |= 0xc0;
GPIOH_OUTPUT_EN &= ~0xc0;
-#if 0
- CPU_INT_PRIORITY &= ~HI_MASK;
- CPU_HI_INT_PRIORITY &= ~GPIO_MASK;
-
- CPU_INT_CLR = HI_MASK;
- CPU_HI_INT_CLR = GPIO_MASK;
-#endif
GPIOF_INT_CLR = 0xff;
GPIOH_INT_CLR = 0xc0;
@@ -75,25 +75,18 @@ void button_init_device(void)
old_wheel_value = GPIOH_INPUT_VAL & 0xc0;
GPIOH_INT_LEV = (GPIOH_INT_LEV & ~0xc0) | (old_wheel_value ^ 0xc0);
+ /* Enable button interrupts */
GPIOF_INT_EN = 0xff;
GPIOH_INT_EN = 0xc0;
-#if 0
- CPU_HI_INT_EN = GPIO_MASK;
- CPU_INT_EN = HI_MASK;
-#endif
- last_wheel_tick = current_tick;
- last_wheel_post = current_tick;
+ CPU_INT_EN = HI_MASK;
+ CPU_HI_INT_EN = GPIO_MASK;
#endif /* BOOTLOADER */
}
bool button_hold(void)
{
-#ifdef BOOTLOADER
- return (GPIOF_INPUT_VAL & 0x80) != 0;
-#else
- return hold_button;
-#endif /* BOOTLOADER */
+ return _button_hold();
}
/* clickwheel */
@@ -118,10 +111,9 @@ void clickwheel_int(void)
unsigned int wheel_value;
- GPIOH_INT_CLR = GPIOH_INT_STAT & 0xc0;
-
wheel_value = GPIOH_INPUT_VAL & 0xc0;
GPIOH_INT_LEV = (GPIOH_INT_LEV & ~0xc0) | (wheel_value ^ 0xc0);
+ GPIOH_INT_CLR = GPIOH_INT_STAT & 0xc0;
if (!hold_button)
{
@@ -202,15 +194,13 @@ void button_int(void)
state = GPIOF_INPUT_VAL & 0xff;
#ifndef BOOTLOADER
- GPIOF_INT_CLR = GPIOF_INT_STAT;
GPIOF_INT_LEV = (GPIOF_INT_LEV & ~0xff) | (state ^ 0xff);
+ GPIOF_INT_CLR = GPIOF_INT_STAT;
hold_button = (state & 0x80) != 0;
+#endif
- if (!hold_button)
-#else
- if (button_hold())
-#endif /* BOOTLOADER */
+ if (!_button_hold())
{
/* Read normal buttons */
if ((state & 0x01) == 0) int_btn |= BUTTON_REC;
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index a03d479444..2b6a801128 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -63,16 +63,19 @@ void irq(void)
{
if(CURRENT_CORE == CPU) {
if (CPU_INT_STAT & TIMER1_MASK) {
+ TIMER1();
+ }
+ else if (CPU_INT_STAT & TIMER2_MASK)
+ TIMER2();
#ifdef SANSA_E200
+ else if (CPU_HI_INT_STAT & GPIO_MASK)
+ {
if (GPIOF_INT_STAT & 0xff)
button_int();
if (GPIOH_INT_STAT & 0xc0)
clickwheel_int();
-#endif
- TIMER1();
}
- else if (CPU_INT_STAT & TIMER2_MASK)
- TIMER2();
+#endif
} else {
if (COP_INT_STAT & TIMER1_MASK)
TIMER1();