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