summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
authorBrandon Low <lostlogic@rockbox.org>2006-03-07 05:21:00 +0000
committerBrandon Low <lostlogic@rockbox.org>2006-03-07 05:21:00 +0000
commita4b45ee1311f3848e2f16d88ca9f67e49f3e41c6 (patch)
tree717cf97c6e7c60ae93ae1f630d624e15dac4f6e3 /firmware/drivers/button.c
parentb5648000ba63476b99823046a6702881a28fd6c0 (diff)
downloadrockbox-a4b45ee1311f3848e2f16d88ca9f67e49f3e41c6.zip
rockbox-a4b45ee1311f3848e2f16d88ca9f67e49f3e41c6.tar.gz
rockbox-a4b45ee1311f3848e2f16d88ca9f67e49f3e41c6.tar.bz2
rockbox-a4b45ee1311f3848e2f16d88ca9f67e49f3e41c6.tar.xz
Additional minor button interrupt tweaks, in a completely unscientific way, this seems to make the 5g more responsive at 30mhz
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8940 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index cdbb9f5..573d57f 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -124,28 +124,22 @@ static void opto_i2c_init(void)
static int ipod_4g_button_read(void)
{
- unsigned reg, status;
- static int clickwheel_down = 0;
- static int old_wheel_value = -1;
- int wheel_keycode = BUTTON_NONE;
- int new_wheel_value;
- int btn = BUTTON_NONE;
-
/* The ipodlinux source had a udelay(250) here, but testing has shown that
it is not needed - tested on Nano, Color/Photo and Video. */
/* udelay(250);*/
- reg = 0x7000c104;
+ int btn = BUTTON_NONE;
+ unsigned reg = 0x7000c104;
if ((inl(0x7000c104) & 0x4000000) != 0) {
- reg = reg + 0x3C; /* 0x7000c140 */
+ unsigned status = inl(0x7000c140);
- status = inl(0x7000c140);
- outl(0x0, 0x7000c140); /* clear interrupt status? */
+ reg = reg + 0x3C; /* 0x7000c140 */
+ outl(0x0, 0x7000c140); /* clear interrupt status? */
if ((status & 0x800000ff) == 0x8000001a) {
- /* NB: highest wheel = 0x5F, clockwise increases */
- new_wheel_value = ((status << 9) >> 25) & 0xff;
-
+ static int clickwheel_down IDATA_ATTR = 0;
+ static int old_wheel_value IDATA_ATTR = -1;
+
if (status & 0x100)
btn |= BUTTON_SELECT;
if (status & 0x200)
@@ -157,10 +151,14 @@ static int ipod_4g_button_read(void)
if (status & 0x1000)
btn |= BUTTON_MENU;
if (status & 0x40000000) {
+ /* NB: highest wheel = 0x5F, clockwise increases */
+ int new_wheel_value = ((status << 9) >> 25) & 0xff;
+
/* scroll wheel down */
clickwheel_down = 1;
backlight_on();
- if (old_wheel_value != -1) {
+ if (old_wheel_value >= 0) {
+ int wheel_keycode = BUTTON_NONE;
int wheel_delta;
if (old_wheel_value > new_wheel_value + 48) {
/* Forward wrapping case */