From a4b45ee1311f3848e2f16d88ca9f67e49f3e41c6 Mon Sep 17 00:00:00 2001 From: Brandon Low Date: Tue, 7 Mar 2006 05:21:00 +0000 Subject: 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 --- firmware/drivers/button.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'firmware') diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index cdbb9f5374..573d57fd0a 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 */ -- cgit v1.2.3