xref: /netbsd/sys/arch/cobalt/include/z8530var.h (revision 02cb47ca)
1*02cb47caStsutsui /*	$NetBSD: z8530var.h,v 1.2 2008/03/29 19:15:34 tsutsui Exp $	*/
2fc21b008Stsutsui 
3fc21b008Stsutsui /*
4fc21b008Stsutsui  * Copyright (c) 1992, 1993
5fc21b008Stsutsui  *	The Regents of the University of California.  All rights reserved.
6fc21b008Stsutsui  *
7fc21b008Stsutsui  * This software was developed by the Computer Systems Engineering group
8fc21b008Stsutsui  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9fc21b008Stsutsui  * contributed to Berkeley.
10fc21b008Stsutsui  *
11fc21b008Stsutsui  * All advertising materials mentioning features or use of this software
12fc21b008Stsutsui  * must display the following acknowledgement:
13fc21b008Stsutsui  *	This product includes software developed by the University of
14fc21b008Stsutsui  *	California, Lawrence Berkeley Laboratory.
15fc21b008Stsutsui  *
16fc21b008Stsutsui  * Redistribution and use in source and binary forms, with or without
17fc21b008Stsutsui  * modification, are permitted provided that the following conditions
18fc21b008Stsutsui  * are met:
19fc21b008Stsutsui  * 1. Redistributions of source code must retain the above copyright
20fc21b008Stsutsui  *    notice, this list of conditions and the following disclaimer.
21fc21b008Stsutsui  * 2. Redistributions in binary form must reproduce the above copyright
22fc21b008Stsutsui  *    notice, this list of conditions and the following disclaimer in the
23fc21b008Stsutsui  *    documentation and/or other materials provided with the distribution.
24fc21b008Stsutsui  * 3. Neither the name of the University nor the names of its contributors
25fc21b008Stsutsui  *    may be used to endorse or promote products derived from this software
26fc21b008Stsutsui  *    without specific prior written permission.
27fc21b008Stsutsui  *
28fc21b008Stsutsui  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29fc21b008Stsutsui  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30fc21b008Stsutsui  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31fc21b008Stsutsui  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32fc21b008Stsutsui  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33fc21b008Stsutsui  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34fc21b008Stsutsui  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35fc21b008Stsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36fc21b008Stsutsui  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37fc21b008Stsutsui  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38fc21b008Stsutsui  * SUCH DAMAGE.
39fc21b008Stsutsui  *
40fc21b008Stsutsui  *	@(#)zsvar.h	8.1 (Berkeley) 6/11/93
41fc21b008Stsutsui  */
42fc21b008Stsutsui 
43fc21b008Stsutsui /*
44fc21b008Stsutsui  * Copyright (c) 1994 Gordon W. Ross
45fc21b008Stsutsui  *
46fc21b008Stsutsui  * This software was developed by the Computer Systems Engineering group
47fc21b008Stsutsui  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
48fc21b008Stsutsui  * contributed to Berkeley.
49fc21b008Stsutsui  *
50fc21b008Stsutsui  * All advertising materials mentioning features or use of this software
51fc21b008Stsutsui  * must display the following acknowledgement:
52fc21b008Stsutsui  *	This product includes software developed by the University of
53fc21b008Stsutsui  *	California, Lawrence Berkeley Laboratory.
54fc21b008Stsutsui  *
55fc21b008Stsutsui  * Redistribution and use in source and binary forms, with or without
56fc21b008Stsutsui  * modification, are permitted provided that the following conditions
57fc21b008Stsutsui  * are met:
58fc21b008Stsutsui  * 1. Redistributions of source code must retain the above copyright
59fc21b008Stsutsui  *    notice, this list of conditions and the following disclaimer.
60fc21b008Stsutsui  * 2. Redistributions in binary form must reproduce the above copyright
61fc21b008Stsutsui  *    notice, this list of conditions and the following disclaimer in the
62fc21b008Stsutsui  *    documentation and/or other materials provided with the distribution.
63fc21b008Stsutsui  * 3. All advertising materials mentioning features or use of this software
64fc21b008Stsutsui  *    must display the following acknowledgement:
65fc21b008Stsutsui  *	This product includes software developed by the University of
66fc21b008Stsutsui  *	California, Berkeley and its contributors.
67fc21b008Stsutsui  * 4. Neither the name of the University nor the names of its contributors
68fc21b008Stsutsui  *    may be used to endorse or promote products derived from this software
69fc21b008Stsutsui  *    without specific prior written permission.
70fc21b008Stsutsui  *
71fc21b008Stsutsui  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
72fc21b008Stsutsui  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
73fc21b008Stsutsui  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
74fc21b008Stsutsui  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
75fc21b008Stsutsui  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
76fc21b008Stsutsui  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
77fc21b008Stsutsui  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
78fc21b008Stsutsui  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
79fc21b008Stsutsui  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
80fc21b008Stsutsui  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
81fc21b008Stsutsui  * SUCH DAMAGE.
82fc21b008Stsutsui  *
83fc21b008Stsutsui  *	@(#)zsvar.h	8.1 (Berkeley) 6/11/93
84fc21b008Stsutsui  */
85fc21b008Stsutsui 
86fc21b008Stsutsui #include <dev/ic/z8530sc.h>
87fc21b008Stsutsui 
88fc21b008Stsutsui struct zsc_softc {
89*02cb47caStsutsui 	device_t zsc_dev;		/* required first: base device */
90fc21b008Stsutsui 	struct	zs_chanstate *zsc_cs[2];	/* channel A and B soft state */
91fc21b008Stsutsui 	/* Machine-dependent part follows... */
92fc21b008Stsutsui 	struct zs_chanstate  zsc_cs_store[2];
93fc21b008Stsutsui 	void *zsc_softintr_cookie;
94fc21b008Stsutsui };
95fc21b008Stsutsui 
96fc21b008Stsutsui /*
97fc21b008Stsutsui  * Functions to read and write individual registers in a channel.
98fc21b008Stsutsui  * The ZS chip requires a 1.6 us recovery time between accesses,
99fc21b008Stsutsui  * and the Cobalt Qube 2700 does NOT take care of this for you.
100fc21b008Stsutsui  * The delay is now handled inside the chip access functions.
101fc21b008Stsutsui  * These could be inlines, but with the delay, speed is moot.
102fc21b008Stsutsui  */
103fc21b008Stsutsui 
104fc21b008Stsutsui uint8_t zs_read_reg(struct zs_chanstate *cs, uint8_t reg);
105fc21b008Stsutsui uint8_t zs_read_csr(struct zs_chanstate *cs);
106fc21b008Stsutsui uint8_t zs_read_data(struct zs_chanstate *cs);
107fc21b008Stsutsui 
108fc21b008Stsutsui void  zs_write_reg(struct zs_chanstate *cs, uint8_t reg, uint8_t val);
109fc21b008Stsutsui void  zs_write_csr(struct zs_chanstate *cs, uint8_t val);
110fc21b008Stsutsui void  zs_write_data(struct zs_chanstate *cs, uint8_t val);
111fc21b008Stsutsui 
112fc21b008Stsutsui void zscnprobe(struct consdev *);
113fc21b008Stsutsui void zscninit(struct consdev *);
114fc21b008Stsutsui int  zscngetc(dev_t);
115fc21b008Stsutsui void zscnputc(dev_t, int);
116fc21b008Stsutsui 
117fc21b008Stsutsui #define splzs()		splserial()
118fc21b008Stsutsui #define IPL_ZS		IPL_SERIAL
119