Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/amiga/dev Round amiga_clk_interval to the nearest i...



details:   https://anonhg.NetBSD.org/src/rev/82e3ca4c0771
branches:  trunk
changeset: 972194:82e3ca4c0771
user:      rin <rin%NetBSD.org@localhost>
date:      Tue May 19 08:43:30 2020 +0000

description:
Round amiga_clk_interval to the nearest integer, in order to emulate
100 Hz clock better by that running at PAL frequency (709379 Hz).

No functional changes for systems running at NTSC freq (715909 Hz).

diffstat:

 sys/arch/amiga/dev/clock.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r fee7a6a0a7f9 -r 82e3ca4c0771 sys/arch/amiga/dev/clock.c
--- a/sys/arch/amiga/dev/clock.c        Tue May 19 08:21:29 2020 +0000
+++ b/sys/arch/amiga/dev/clock.c        Tue May 19 08:43:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.55 2015/11/12 12:19:49 phx Exp $ */
+/*     $NetBSD: clock.c,v 1.56 2020/05/19 08:43:30 rin Exp $ */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.55 2015/11/12 12:19:49 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.56 2020/05/19 08:43:30 rin Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -147,7 +147,10 @@
                clockchip = "CIA B";
        }
 
+       /* round nearest to mitigate clock drift for PAL */
        amiga_clk_interval = chipfreq / hz;
+       if (chipfreq % hz >= hz / 2)
+               amiga_clk_interval++;
 
        if (self != NULL) {     /* real autoconfig? */
                printf(": %s system hz %d hardware hz %d\n", clockchip, hz,



Home | Main Index | Thread Index | Old Index