11.10Sdyoung/* $NetBSD: z8530var.h,v 1.10 2011/07/01 21:00:21 dyoung Exp $ */ 21.1Ssoren 31.1Ssoren/* 41.1Ssoren * Copyright (c) 1992, 1993 51.1Ssoren * The Regents of the University of California. All rights reserved. 61.5Sagc * 71.5Sagc * This software was developed by the Computer Systems Engineering group 81.5Sagc * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 91.5Sagc * contributed to Berkeley. 101.5Sagc * 111.5Sagc * All advertising materials mentioning features or use of this software 121.5Sagc * must display the following acknowledgement: 131.5Sagc * This product includes software developed by the University of 141.5Sagc * California, Lawrence Berkeley Laboratory. 151.5Sagc * 161.5Sagc * Redistribution and use in source and binary forms, with or without 171.5Sagc * modification, are permitted provided that the following conditions 181.5Sagc * are met: 191.5Sagc * 1. Redistributions of source code must retain the above copyright 201.5Sagc * notice, this list of conditions and the following disclaimer. 211.5Sagc * 2. Redistributions in binary form must reproduce the above copyright 221.5Sagc * notice, this list of conditions and the following disclaimer in the 231.5Sagc * documentation and/or other materials provided with the distribution. 241.5Sagc * 3. Neither the name of the University nor the names of its contributors 251.5Sagc * may be used to endorse or promote products derived from this software 261.5Sagc * without specific prior written permission. 271.5Sagc * 281.5Sagc * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 291.5Sagc * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 301.5Sagc * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 311.5Sagc * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 321.5Sagc * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 331.5Sagc * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 341.5Sagc * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 351.5Sagc * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 361.5Sagc * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 371.5Sagc * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 381.5Sagc * SUCH DAMAGE. 391.5Sagc * 401.5Sagc * @(#)zsvar.h 8.1 (Berkeley) 6/11/93 411.5Sagc */ 421.5Sagc 431.5Sagc/* 441.5Sagc * Copyright (c) 1994 Gordon W. Ross 451.1Ssoren * 461.1Ssoren * This software was developed by the Computer Systems Engineering group 471.1Ssoren * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 481.1Ssoren * contributed to Berkeley. 491.1Ssoren * 501.1Ssoren * All advertising materials mentioning features or use of this software 511.1Ssoren * must display the following acknowledgement: 521.1Ssoren * This product includes software developed by the University of 531.1Ssoren * California, Lawrence Berkeley Laboratory. 541.1Ssoren * 551.1Ssoren * Redistribution and use in source and binary forms, with or without 561.1Ssoren * modification, are permitted provided that the following conditions 571.1Ssoren * are met: 581.1Ssoren * 1. Redistributions of source code must retain the above copyright 591.1Ssoren * notice, this list of conditions and the following disclaimer. 601.1Ssoren * 2. Redistributions in binary form must reproduce the above copyright 611.1Ssoren * notice, this list of conditions and the following disclaimer in the 621.1Ssoren * documentation and/or other materials provided with the distribution. 631.1Ssoren * 3. All advertising materials mentioning features or use of this software 641.1Ssoren * must display the following acknowledgement: 651.1Ssoren * This product includes software developed by the University of 661.1Ssoren * California, Berkeley and its contributors. 671.1Ssoren * 4. Neither the name of the University nor the names of its contributors 681.1Ssoren * may be used to endorse or promote products derived from this software 691.1Ssoren * without specific prior written permission. 701.1Ssoren * 711.1Ssoren * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 721.1Ssoren * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 731.1Ssoren * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 741.1Ssoren * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 751.1Ssoren * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 761.1Ssoren * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 771.1Ssoren * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 781.1Ssoren * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 791.1Ssoren * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 801.1Ssoren * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 811.1Ssoren * SUCH DAMAGE. 821.2Sthorpej * 831.2Sthorpej * @(#)zsvar.h 8.1 (Berkeley) 6/11/93 841.1Ssoren */ 851.1Ssoren 861.10Sdyoung#include <sys/bus.h> 871.1Ssoren#include <dev/ic/z8530sc.h> 881.1Ssoren 891.2Sthorpejstruct zs_channel { 901.2Sthorpej struct zs_chanstate cs_zscs; /* Required: soft state */ 911.2Sthorpej bus_space_tag_t cs_bustag; /* Machine-dependent */ 921.2Sthorpej bus_space_handle_t cs_regs; 931.3Ssimonb}; 941.2Sthorpej 951.1Ssorenstruct zsc_softc { 961.9Stsutsui device_t zsc_dev; /* required: base device */ 971.2Sthorpej struct zs_chanstate *zsc_cs[2]; /* channel soft state */ 981.3Ssimonb struct zs_channel zsc_cs_store[2]; 991.1Ssoren /* Machine-dependent part follows... */ 1001.2Sthorpej bus_space_tag_t zsc_bustag; /* Bus type */ 1011.2Sthorpej bus_space_handle_t zsc_base; /* Device base address */ 1021.4Srafal struct evcnt zsc_intrcnt; /* count interrupts */ 1031.2Sthorpej void *sc_si; /* Softinterrupt handle */ 1041.1Ssoren}; 1051.1Ssoren 1061.1Ssoren/* 1071.1Ssoren * Functions to read and write individual registers in a channel. 1081.2Sthorpej * The SCC chip requires 3-4 PCLK cycles recovery time between accesses 1091.1Ssoren */ 1101.1Ssoren 1111.9Stsutsuiuint8_t zs_read_reg (struct zs_chanstate *, uint8_t); 1121.9Stsutsuiuint8_t zs_read_csr (struct zs_chanstate *); 1131.9Stsutsuiuint8_t zs_read_data (struct zs_chanstate *); 1141.9Stsutsui 1151.9Stsutsuivoid zs_write_reg (struct zs_chanstate *, uint8_t, uint8_t); 1161.9Stsutsuivoid zs_write_csr (struct zs_chanstate *, uint8_t); 1171.9Stsutsuivoid zs_write_data (struct zs_chanstate *, uint8_t); 1181.2Sthorpej 1191.2Sthorpej/* Zilog Serial hardware interrupts (level 0) */ 1201.2Sthorpej#define splzs() spltty() 1211.8Sad#define IPL_ZS IPL_TTY 122