Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Use one more bit of precision when calculating fr...



details:   https://anonhg.NetBSD.org/src/rev/721f862a9c44
branches:  trunk
changeset: 767754:721f862a9c44
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Fri Jul 29 19:19:14 2011 +0000

description:
Use one more bit of precision when calculating frequency from period.
This makes the 4-times-NTSC color carrier get calculated to a
correct 14318180Hz, instead of 14318179Hz, which seems a bit odd.

diffstat:

 sys/dev/ic/hpet.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r 7abe9aba17b4 -r 721f862a9c44 sys/dev/ic/hpet.c
--- a/sys/dev/ic/hpet.c Fri Jul 29 18:47:11 2011 +0000
+++ b/sys/dev/ic/hpet.c Fri Jul 29 19:19:14 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hpet.c,v 1.11 2011/06/15 09:09:48 jruoho Exp $ */
+/* $NetBSD: hpet.c,v 1.12 2011/07/29 19:19:14 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2006 Nicolas Joly
@@ -33,7 +33,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.11 2011/06/15 09:09:48 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.12 2011/07/29 19:19:14 jakllsch Exp $");
 
 #include <sys/systm.h>
 #include <sys/device.h>
@@ -87,7 +87,8 @@
                aprint_error_dev(dv, "invalid timer period\n");
                return;
        }
-       tc->tc_frequency = 1000000000000000ULL / val;
+       val = (1000000000000000ULL * 2) / val;
+       tc->tc_frequency = (val / 2) + (val & 1);
 
        /* Enable timer */
        val = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_CONFIG);



Home | Main Index | Thread Index | Old Index