From fd41b407a70b28bf951ca9fa32fb437d82fe0cd5 Mon Sep 17 00:00:00 2001 From: funman Date: Mon, 26 Apr 2010 14:49:51 +0000 Subject: [PATCH] Fuzev2: fix screen corruption Revive the delay removed by r25636 (and make it longer so it works when boosted) Also read GPIOA pins 7 & 6 in one load git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25722 a1c6a512-1295-4272-9138-f99709370657 --- .../target/arm/as3525/sansa-fuzev2/button-fuzev2.c | 29 ++++++++-------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c index b9139ef55..d50df9f1c 100644 --- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c +++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c @@ -38,29 +38,15 @@ void button_init_device(void) GPIOB_PIN(4) = 1<<4; /* activate the wheel */ } -unsigned read_GPIOA_67(void) -{ - unsigned ret = 0; - volatile int i; - DBOP_CTRL |= 1<<19; - for(i = 20; i; i--) nop; - GPIOA_DIR &= ~0xc0; - for(i = 20; i; i--) nop; - if (GPIOA_PIN(6) != 0) - ret = 1<<0; - for(i = 20; i; i--) nop; - if (GPIOA_PIN(7) != 0) - ret |= 1<<1; - DBOP_CTRL &= ~(1<<19); - for(i = 20; i; i--) nop; - return ret; -} - void get_scrollwheel(void) { #if defined(HAVE_SCROLLWHEEL) && !defined(BOOTLOADER) /* scroll wheel handling */ - scrollwheel(read_GPIOA_67()); + +#define GPIOA_PIN76_offset ((1<<(6+2)) | (1<<(7+2))) +#define GPIOA_PIN76 (*(volatile unsigned char*)(GPIOA_BASE+GPIOA_PIN76_offset)) + scrollwheel(GPIOA_PIN76 >> 6); + #endif } @@ -77,6 +63,11 @@ int button_read_device(void) static long power_counter = 0; unsigned gpiod6; + /* if we remove this delay, we see screen corruption (the higher the CPU + * frequency the higher the corruption) */ + for(delay = 1000; delay; delay--) + nop; + get_scrollwheel(); CCU_IO &= ~(1<<12); -- 2.11.4.GIT