summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-04-27 09:34:29 +0000
committerThomas Martitz <kugel@rockbox.org>2010-04-27 09:34:29 +0000
commit845af676f8a37910613e7ce6b59dc229bb1a89c1 (patch)
tree0cc577ce1f31aea64a70b83f9323512da56912d4 /firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
parentf2f34881ec84fb18020ae9a492f347e87c36359c (diff)
downloadrockbox-845af676f8a37910613e7ce6b59dc229bb1a89c1.tar.gz
rockbox-845af676f8a37910613e7ce6b59dc229bb1a89c1.zip
as3525(v2): Add a somewhat inaccurate udelay (-0.5/+1.0µs). It should work good for some huge delays.
Use it in fuzev2 to improve some big delays (correct the biggest one to actually wait for the fifo to empty), and use it in the sd drivers. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25734 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c')
-rw-r--r--firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
index d50df9f1c6..db08414ae5 100644
--- a/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
+++ b/firmware/target/arm/as3525/sansa-fuzev2/button-fuzev2.c
@@ -58,29 +58,26 @@ void get_scrollwheel(void)
58int button_read_device(void) 58int button_read_device(void)
59{ 59{
60 int btn = 0; 60 int btn = 0;
61 volatile int delay;
62 static bool hold_button_old = false; 61 static bool hold_button_old = false;
63 static long power_counter = 0; 62 static long power_counter = 0;
64 unsigned gpiod6; 63 unsigned gpiod6;
65 64
66 /* if we remove this delay, we see screen corruption (the higher the CPU 65
67 * frequency the higher the corruption) */ 66 /* if we don't wait for the fifo to empty, we'll see screen corruption
68 for(delay = 1000; delay; delay--) 67 * (the higher the CPU frequency the higher the corruption) */
69 nop; 68 while ((DBOP_STAT & (1<<10)) == 0);
70 69
71 get_scrollwheel(); 70 get_scrollwheel();
72 71
73 CCU_IO &= ~(1<<12); 72 CCU_IO &= ~(1<<12);
74 73
75 GPIOB_PIN(0) = 1<<0; 74 GPIOB_PIN(0) = 1<<0;
76 for(delay = 500; delay; delay--) 75 udelay(1);
77 nop;
78 76
79 gpiod6 = GPIOD_PIN(6); 77 gpiod6 = GPIOD_PIN(6);
80 78
81 GPIOB_PIN(0) = 0; 79 GPIOB_PIN(0) = 0;
82 for(delay = 240; delay; delay--) 80 udelay(1);
83 nop;
84 81
85 if (GPIOC_PIN(1) & 1<<1) 82 if (GPIOC_PIN(1) & 1<<1)
86 btn |= BUTTON_DOWN; 83 btn |= BUTTON_DOWN;