Port-amiga archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Keyboard lockup with NetBSD5
On Mon, 16 Nov 2009, Frank Wille wrote:
> The following patch makes delay() work (for keyboard and floppy disk):
>
> RCS file: /cvsroot/src/sys/arch/amiga/dev/clock.c,v
> retrieving revision 1.50
> diff -r1.50 clock.c
> 697c697
> < remaining -= amiga_clk_interval - (cur_tick -
> initial_tick);
> ---
> > remaining -= cur_tick - initial_tick;
> 699c699
> < remaining -= initial_tick - cur_tick;
> ---
> > remaining -= amiga_clk_interval - (initial_tick -
> cur_tick);
I'm not certain that this patch is entirely correct, if I understand it
properly (no guarantee that I'm not missing something). Most of the time
in the while() loop, cur_tick will be equal to initial_tick, and it will
subtract amiga_clk_interval from remaining each time through the loop
and delay() will exit very quickly. Was this the patch that worked on the
A1200?
I would thing that this would be a better change:
Index: sys/arch/amiga/dev/clock.c
===================================================================
RCS file: /cvsroot/src/sys/arch/amiga/dev/clock.c,v
retrieving revision 1.50
diff -u -p -r1.50 clock.c
--- sys/arch/amiga/dev/clock.c 11 Sep 2009 19:43:08 -0000 1.50
+++ sys/arch/amiga/dev/clock.c 26 Nov 2009 17:35:26 -0000
@@ -693,10 +693,10 @@ delay(unsigned int n)
while (remaining > 0) {
cur_tick = clk_gettick();
- if (cur_tick > initial_tick)
- remaining -= amiga_clk_interval - (cur_tick -
initial_tick);
+ if (cur_tick >= initial_tick)
+ remaining -= cur_tick - initial_tick;
else
- remaining -= initial_tick - cur_tick;
+ remaining -= amiga_clk_interval - (initial_tick -
cur_tick);
initial_tick = cur_tick;
}
}
With this patch, most of the time in the loop will be subtracting 0 from
remaining. Every time the hardware counter decrement, it would then
subtract 1 from remaining [presuming the loop hasn't been interrupted,
otherwise it would subtract a larger amount]. And every 100 milliseconds,
the other subtraction would occur.
Home |
Main Index |
Thread Index |
Old Index