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