Port-amiga archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Keyboard lockup with NetBSD5



Michael L. Hitch wrote:

>   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.

Hmm. You're right. amiga_clk_interval - (initial_tick - cur_tick) should
only be subtracted when an overflow occured, and it didn't when cur_tick
and initial_tick are still equal.


> Was this the patch that worked on the A1200?

Yes.


>   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;
>         }
>  }

Agreed. That would be better.

-- 
    _  Frank Wille (frank%phoenix.owl.de@localhost)
 _ //  http://sun.hasenbraten.de/~frank/
 \X/   Phx @ #AmigaGer



Home | Main Index | Thread Index | Old Index