1*f75609fcSmiod /* $OpenBSD: z8530var.h,v 1.9 2024/03/29 21:17:13 miod Exp $ */ 2284584b0Sjason /* $NetBSD: z8530var.h,v 1.4 2000/11/08 23:41:42 eeh Exp $ */ 3284584b0Sjason 4284584b0Sjason /* 5284584b0Sjason * Copyright (c) 1992, 1993 6284584b0Sjason * The Regents of the University of California. All rights reserved. 7284584b0Sjason * 8284584b0Sjason * This software was developed by the Computer Systems Engineering group 9284584b0Sjason * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 10284584b0Sjason * contributed to Berkeley. 11284584b0Sjason * 12284584b0Sjason * All advertising materials mentioning features or use of this software 13284584b0Sjason * must display the following acknowledgement: 14284584b0Sjason * This product includes software developed by the University of 15284584b0Sjason * California, Lawrence Berkeley Laboratory. 16284584b0Sjason * 17284584b0Sjason * Redistribution and use in source and binary forms, with or without 18284584b0Sjason * modification, are permitted provided that the following conditions 19284584b0Sjason * are met: 20284584b0Sjason * 1. Redistributions of source code must retain the above copyright 21284584b0Sjason * notice, this list of conditions and the following disclaimer. 22284584b0Sjason * 2. Redistributions in binary form must reproduce the above copyright 23284584b0Sjason * notice, this list of conditions and the following disclaimer in the 24284584b0Sjason * documentation and/or other materials provided with the distribution. 2529295d1cSmillert * 3. Neither the name of the University nor the names of its contributors 26284584b0Sjason * may be used to endorse or promote products derived from this software 27284584b0Sjason * without specific prior written permission. 28284584b0Sjason * 29284584b0Sjason * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 30284584b0Sjason * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 31284584b0Sjason * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 32284584b0Sjason * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 33284584b0Sjason * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 34284584b0Sjason * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 35284584b0Sjason * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 36284584b0Sjason * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 37284584b0Sjason * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 38284584b0Sjason * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 39284584b0Sjason * SUCH DAMAGE. 40284584b0Sjason * 41284584b0Sjason * @(#)zsvar.h 8.1 (Berkeley) 6/11/93 42284584b0Sjason */ 43284584b0Sjason 44284584b0Sjason #include <machine/bus.h> 45e7f17214Ssebastia #include <dev/ic/z8530sc.h> 46284584b0Sjason 47284584b0Sjason struct zsc_softc { 48284584b0Sjason struct device zsc_dev; /* base device */ 49284584b0Sjason bus_space_tag_t zsc_bustag; /* bus space/dma tags */ 50284584b0Sjason bus_dma_tag_t zsc_dmatag; 51284584b0Sjason struct zs_chanstate *zsc_cs[2]; /* channel A and B soft state */ 52284584b0Sjason 53284584b0Sjason /* Machine-dependent part follows... */ 54284584b0Sjason void *zsc_softintr; 55284584b0Sjason int zsc_promunit; /* PROM's view of zs devices */ 56284584b0Sjason int zsc_node; /* PROM node, if any */ 57284584b0Sjason struct zs_chanstate zsc_cs_store[2]; 58284584b0Sjason }; 59284584b0Sjason 60284584b0Sjason /* 61284584b0Sjason * Functions to read and write individual registers in a channel. 62284584b0Sjason * The ZS chip requires a 1.6 uSec. recovery time between accesses. 63*f75609fcSmiod * On sparc64, the recovery time is handled in hardware. 64284584b0Sjason */ 65284584b0Sjason 66c4071fd1Smillert u_char zs_read_reg(struct zs_chanstate *cs, u_char reg); 67c4071fd1Smillert u_char zs_read_csr(struct zs_chanstate *cs); 68c4071fd1Smillert u_char zs_read_data(struct zs_chanstate *cs); 69284584b0Sjason 70c4071fd1Smillert void zs_write_reg(struct zs_chanstate *cs, u_char reg, u_char val); 71c4071fd1Smillert void zs_write_csr(struct zs_chanstate *cs, u_char val); 72c4071fd1Smillert void zs_write_data(struct zs_chanstate *cs, u_char val); 73284584b0Sjason 74284584b0Sjason /* The sparc has splzs() in psl.h */ 75284584b0Sjason 76284584b0Sjason /* We want to call it "zs" instead of "zsc" (sigh). */ 77284584b0Sjason #ifndef ZSCCF_CHANNEL 78284584b0Sjason #define ZSCCF_CHANNEL 0 79284584b0Sjason #define ZSCCF_CHANNEL_DEFAULT -1 80284584b0Sjason #endif 81