1 /* $NetBSD: clock.c,v 1.6 2006/09/16 15:43:24 skrll Exp $ */
3 /* $OpenBSD: clock.c,v 1.10 2001/08/31 03:13:42 mickey Exp $ */
6 * Copyright (c) 1998-2003 Michael Shalayeff
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
22 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
27 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
31 #include <sys/cdefs.h>
32 __KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.6 2006/09/16 15:43:24 skrll Exp $");
34 #include <sys/param.h>
35 #include <sys/systm.h>
36 #include <sys/kernel.h>
38 #include <sys/timetc.h>
40 #include <machine/pdc.h>
41 #include <machine/iomod.h>
42 #include <machine/psl.h>
43 #include <machine/intr.h>
44 #include <machine/reg.h>
45 #include <machine/cpufunc.h>
46 #include <machine/autoconf.h>
48 #include <hp700/hp700/machdep.h>
51 #include <machine/db_machdep.h>
52 #include <ddb/db_sym.h>
53 #include <ddb/db_extern.h>
56 static unsigned get_itimer_count(struct timecounter
*);
61 static struct timecounter tc
= {
62 .tc_get_timecount
= get_itimer_count
,
64 .tc_counter_mask
= ~0,
68 extern u_int cpu_hzticks
;
71 tc
.tc_frequency
= cpu_hzticks
* hz
;
73 /* Start the interval timer. */
74 mfctl(CR_ITMR
, time_inval
);
75 mtctl(time_inval
+ cpu_hzticks
, CR_ITMR
);
81 get_itimer_count(struct timecounter
*tc
)
93 struct clockframe
*frame
= v
;
94 extern u_int cpu_hzticks
;
97 /* Restart the interval timer. */
98 mfctl(CR_ITMR
, time_inval
);
99 mtctl(time_inval
+ cpu_hzticks
, CR_ITMR
);
101 /* printf ("clock int 0x%x @ 0x%x for %p\n", t,
102 CLKF_PC(frame), curproc); */
109 db_show_regs(NULL
, 0, 0, NULL
);
112 /* printf ("clock out 0x%x\n", t); */
118 setstatclockrate(int newhz
)
120 /* nothing we can do */