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