1*02cb47caStsutsui /* $NetBSD: z8530var.h,v 1.13 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 */ 4281fc5956Schuck 4381fc5956Schuck /* 4481fc5956Schuck * Copyright (c) 1994 Gordon W. Ross 4581fc5956Schuck * 4681fc5956Schuck * This software was developed by the Computer Systems Engineering group 4781fc5956Schuck * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 4881fc5956Schuck * contributed to Berkeley. 4981fc5956Schuck * 5081fc5956Schuck * All advertising materials mentioning features or use of this software 5181fc5956Schuck * must display the following acknowledgement: 5281fc5956Schuck * This product includes software developed by the University of 5381fc5956Schuck * California, Lawrence Berkeley Laboratory. 5481fc5956Schuck * 5581fc5956Schuck * Redistribution and use in source and binary forms, with or without 5681fc5956Schuck * modification, are permitted provided that the following conditions 5781fc5956Schuck * are met: 5881fc5956Schuck * 1. Redistributions of source code must retain the above copyright 5981fc5956Schuck * notice, this list of conditions and the following disclaimer. 6081fc5956Schuck * 2. Redistributions in binary form must reproduce the above copyright 6181fc5956Schuck * notice, this list of conditions and the following disclaimer in the 6281fc5956Schuck * documentation and/or other materials provided with the distribution. 6381fc5956Schuck * 3. All advertising materials mentioning features or use of this software 6481fc5956Schuck * must display the following acknowledgement: 6581fc5956Schuck * This product includes software developed by the University of 6681fc5956Schuck * California, Berkeley and its contributors. 6781fc5956Schuck * 4. Neither the name of the University nor the names of its contributors 6881fc5956Schuck * may be used to endorse or promote products derived from this software 6981fc5956Schuck * without specific prior written permission. 7081fc5956Schuck * 7181fc5956Schuck * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 7281fc5956Schuck * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 7381fc5956Schuck * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 7481fc5956Schuck * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 7581fc5956Schuck * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 7681fc5956Schuck * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 7781fc5956Schuck * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 7881fc5956Schuck * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 7981fc5956Schuck * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 8081fc5956Schuck * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 8181fc5956Schuck * SUCH DAMAGE. 8281fc5956Schuck * 8381fc5956Schuck * @(#)zsvar.h 8.1 (Berkeley) 6/11/93 8481fc5956Schuck */ 8581fc5956Schuck 8681fc5956Schuck #include <dev/ic/z8530sc.h> 8781fc5956Schuck 8855d81fe0Sgwr struct zsc_softc { 89*02cb47caStsutsui device_t zsc_dev; /* required first: base device */ 9055d81fe0Sgwr struct zs_chanstate *zsc_cs[2]; /* channel A and B soft state */ 9155d81fe0Sgwr /* Machine-dependent part follows... */ 9255d81fe0Sgwr struct zs_chanstate zsc_cs_store[2]; 9383e678b1Sscw void *zsc_softintr_cookie; 9459ba4788Sscw struct evcnt zsc_evcnt; 9555d81fe0Sgwr }; 9655d81fe0Sgwr 9781fc5956Schuck /* 9881fc5956Schuck * Functions to read and write individual registers in a channel. 9981fc5956Schuck * The ZS chip requires a 1.6 uSec. recovery time between accesses, 10081fc5956Schuck * and the Sun3 hardware does NOT take care of this for you. 10181fc5956Schuck * The delay is now handled inside the chip access functions. 10281fc5956Schuck * These could be inlines, but with the delay, speed is moot. 10381fc5956Schuck */ 10481fc5956Schuck 105*02cb47caStsutsui uint8_t zs_read_reg(struct zs_chanstate *cs, uint8_t reg); 106*02cb47caStsutsui uint8_t zs_read_csr(struct zs_chanstate *cs); 107*02cb47caStsutsui uint8_t zs_read_data(struct zs_chanstate *cs); 10881fc5956Schuck 109*02cb47caStsutsui void zs_write_reg(struct zs_chanstate *cs, uint8_t reg, uint8_t val); 110*02cb47caStsutsui void zs_write_csr(struct zs_chanstate *cs, uint8_t val); 111*02cb47caStsutsui void zs_write_data(struct zs_chanstate *cs, uint8_t val); 11281fc5956Schuck 11381fc5956Schuck /* Interrupt priority for the SCC chip; needs to match ZSHARD_PRI. */ 114c5b6f436Sscw #define splzs() splserial() 115d3793569Sad #define IPL_ZS IPL_SERIAL 116