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
This commit is contained in:
Thomas Martitz 2010-04-27 09:34:29 +00:00
parent f2f34881ec
commit 845af676f8
5 changed files with 68 additions and 25 deletions

View file

@ -58,29 +58,26 @@ void get_scrollwheel(void)
int button_read_device(void)
{
int btn = 0;
volatile int delay;
static bool hold_button_old = false;
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;
/* if we don't wait for the fifo to empty, we'll see screen corruption
* (the higher the CPU frequency the higher the corruption) */
while ((DBOP_STAT & (1<<10)) == 0);
get_scrollwheel();
CCU_IO &= ~(1<<12);
GPIOB_PIN(0) = 1<<0;
for(delay = 500; delay; delay--)
nop;
udelay(1);
gpiod6 = GPIOD_PIN(6);
GPIOB_PIN(0) = 0;
for(delay = 240; delay; delay--)
nop;
udelay(1);
if (GPIOC_PIN(1) & 1<<1)
btn |= BUTTON_DOWN;