xref: /netbsd/sys/arch/hp300/hp300/clockreg.h (revision bf9ec67e)
1 /*	$NetBSD: clockreg.h,v 1.7 2001/11/17 23:51:03 gmcgarry Exp $	*/
2 
3 /*
4  * Copyright (c) 1988 University of Utah.
5  * Copyright (c) 1982, 1990, 1993
6  *	The Regents of the University of California.  All rights reserved.
7  *
8  * This code is derived from software contributed to Berkeley by
9  * the Systems Programming Group of the University of Utah Computer
10  * Science Department.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  * 3. All advertising materials mentioning features or use of this software
21  *    must display the following acknowledgement:
22  *	This product includes software developed by the University of
23  *	California, Berkeley and its contributors.
24  * 4. Neither the name of the University nor the names of its contributors
25  *    may be used to endorse or promote products derived from this software
26  *    without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38  * SUCH DAMAGE.
39  *
40  * from: Utah $Hdr: clockreg.h 1.14 91/01/18$
41  *
42  *	@(#)clockreg.h	8.2 (Berkeley) 1/12/94
43  */
44 
45 /*
46  * MC6840 PTM registers
47  */
48 
49 struct clkreg {
50 	u_char	clk_dummy1;
51 	u_char	clk_cr3;
52 #define	clk_cr1	clk_cr3
53 	u_char	clk_dummy2;
54 	u_char	clk_cr2;
55 #define	clk_sr	clk_cr2
56 	u_char	clk_dummy3;
57 	u_char	clk_msb1;
58 	u_char	clk_dummy4;
59 	u_char	clk_lsb1;
60 	u_char	clk_dummy5;
61 	u_char	clk_msb2;
62 	u_char	clk_dummy6;
63 	u_char	clk_lsb2;
64 	u_char	clk_dummy7;
65 	u_char	clk_msb3;
66 	u_char	clk_dummy8;
67 	u_char	clk_lsb3;
68 };
69 
70 /* base/offsets for register access (for locore.s) */
71 #define	CLKBASE		IIOPOFF(0x5F8000)
72 #define	CLKCR1		0x1
73 #define	CLKCR2		0x3
74 #define	CLKCR3		CLKCR1
75 #define	CLKSR		CLKCR2
76 #define	CLKMSB1		0x5
77 #define	CLKMSB2		0x9
78 #define	CLKMSB3		0xD
79 
80 /* output of counter 3 clocks counter 2 */
81 
82 #define	CLK_OENAB	0x80	/* output enable */
83 #define	CLK_IENAB	0x40	/* interrupt enable */
84 #define	CLK_8BIT	0x04	/* 8 bit mode */
85 #define	CLK_RESET	0x01	/* chip reset (CR1 only) */
86 #define	CLK_CR1		0x01	/* select CR1 (CR2 only) */
87 #define	CLK_CR3		0x00	/* select CR3 (CR2 only) */
88 #define CLK_INT1	0x01	/* interrupt flag for timer 1 (SR only) */
89 #define CLK_INT2	0x02	/* interrupt flag for timer 2 (SR only) */
90 #define CLK_INT3	0x04	/* interrupt flag for timer 3 (SR only) */
91 #define	CLK_INTR	0x80	/* composite interrupt flag (SR only) */
92 
93 #define CLK_RESOLUTION	4	/* 4 usec resolution (250Khz) */
94 #define	CLK_INTERVAL	2500	/* 10msec interval at 250KHz */
95 #ifdef NOTDEF
96 #define CLK_INTERVAL	5000	/* 20msec interval at 250Khz */
97 #endif
98