1231858Sbz/* $NetBSD: z8530var.h,v 1.8 2007/11/07 15:56:11 ad Exp $ */
2231858Sbz
3231858Sbz/*
4231858Sbz * Copyright (c) 1992, 1993
5231858Sbz *	The Regents of the University of California.  All rights reserved.
6231858Sbz *
7231858Sbz * This software was developed by the Computer Systems Engineering group
8231858Sbz * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9231858Sbz * contributed to Berkeley.
10231858Sbz *
11231858Sbz * All advertising materials mentioning features or use of this software
12231858Sbz * must display the following acknowledgement:
13231858Sbz *	This product includes software developed by the University of
14231858Sbz *	California, Lawrence Berkeley Laboratory.
15231858Sbz *
16231858Sbz * Redistribution and use in source and binary forms, with or without
17231858Sbz * modification, are permitted provided that the following conditions
18231858Sbz * are met:
19231858Sbz * 1. Redistributions of source code must retain the above copyright
20231858Sbz *    notice, this list of conditions and the following disclaimer.
21231858Sbz * 2. Redistributions in binary form must reproduce the above copyright
22231858Sbz *    notice, this list of conditions and the following disclaimer in the
23231858Sbz *    documentation and/or other materials provided with the distribution.
24231858Sbz * 3. Neither the name of the University nor the names of its contributors
25231858Sbz *    may be used to endorse or promote products derived from this software
26231858Sbz *    without specific prior written permission.
27231858Sbz *
28231858Sbz * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29231858Sbz * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30231858Sbz * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31231858Sbz * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32231858Sbz * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33231858Sbz * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34231858Sbz * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35231858Sbz * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36231858Sbz * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37231858Sbz * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38232114Sbz * SUCH DAMAGE.
39231858Sbz *
40231858Sbz *	@(#)zsvar.h	8.1 (Berkeley) 6/11/93
41231858Sbz */
42231858Sbz
43231858Sbz/*
44231858Sbz * Copyright (c) 1994 Gordon W. Ross
45231858Sbz *
46231858Sbz * This software was developed by the Computer Systems Engineering group
47231858Sbz * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
48231858Sbz * contributed to Berkeley.
49231858Sbz *
50231858Sbz * All advertising materials mentioning features or use of this software
51231858Sbz * must display the following acknowledgement:
52231858Sbz *	This product includes software developed by the University of
53231858Sbz *	California, Lawrence Berkeley Laboratory.
54231858Sbz *
55231858Sbz * Redistribution and use in source and binary forms, with or without
56231858Sbz * modification, are permitted provided that the following conditions
57231858Sbz * are met:
58231858Sbz * 1. Redistributions of source code must retain the above copyright
59231858Sbz *    notice, this list of conditions and the following disclaimer.
60231858Sbz * 2. Redistributions in binary form must reproduce the above copyright
61231858Sbz *    notice, this list of conditions and the following disclaimer in the
62231858Sbz *    documentation and/or other materials provided with the distribution.
63231858Sbz * 3. All advertising materials mentioning features or use of this software
64231858Sbz *    must display the following acknowledgement:
65 *	This product includes software developed by the University of
66 *	California, Berkeley and its contributors.
67 * 4. Neither the name of the University nor the names of its contributors
68 *    may be used to endorse or promote products derived from this software
69 *    without specific prior written permission.
70 *
71 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
72 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
73 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
74 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
75 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
76 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
77 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
78 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
79 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
80 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
81 * SUCH DAMAGE.
82 *
83 *	@(#)zsvar.h	8.1 (Berkeley) 6/11/93
84 */
85
86/*
87 * XXX XXX XXX THIS DOES NOT WORK WITH MULTIPLE ATTACHMENTS!!! XXX XXX XXX
88 */
89
90#include <dev/ic/z8530sc.h>
91
92struct zsc_softc {
93	device_t zsc_dev;		/* required first: base device */
94	struct	zs_chanstate *zsc_cs[2];	/* channel A and B soft state */
95	/* Machine-dependent part follows... */
96	int zsc_addroffset;	/* used as "cookie" to identify scc */
97	void *zsc_sih;
98};
99
100/*
101 * Functions to read and write individual registers in a channel.
102 * The ZS chip requires a 1.6 uSec. recovery time between accesses,
103 * and the Alpha TC hardware does NOT take care of this for you.
104 * The delay is now handled inside the chip access functions.
105 * These could be inlines, but with the delay, speed is moot.
106 */
107
108u_int zs_read_reg(struct zs_chanstate *cs, u_int reg);
109u_int zs_read_csr(struct zs_chanstate *cs);
110u_int zs_read_data(struct zs_chanstate *cs);
111
112void  zs_write_reg(struct zs_chanstate *cs, u_int reg, u_int val);
113void  zs_write_csr(struct zs_chanstate *cs, u_int val);
114void  zs_write_data(struct zs_chanstate *cs, u_int val);
115
116/* Interrupt priority for the SCC chip; needs to match ZSHARD_PRI. */
117#define splzs()		spltty()
118#define	IPL_ZS		IPL_TTY
119