z8530var.h revision 1.3
11.3Ssimonb/*	$NetBSD: z8530var.h,v 1.3 2002/03/13 13:12:28 simonb Exp $	*/
21.1Ssoren
31.1Ssoren/*
41.1Ssoren * Copyright (c) 1994 Gordon W. Ross
51.1Ssoren * Copyright (c) 1992, 1993
61.1Ssoren *	The Regents of the University of California.  All rights reserved.
71.1Ssoren *
81.1Ssoren * This software was developed by the Computer Systems Engineering group
91.1Ssoren * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
101.1Ssoren * contributed to Berkeley.
111.1Ssoren *
121.1Ssoren * All advertising materials mentioning features or use of this software
131.1Ssoren * must display the following acknowledgement:
141.1Ssoren *	This product includes software developed by the University of
151.1Ssoren *	California, Lawrence Berkeley Laboratory.
161.1Ssoren *
171.1Ssoren * Redistribution and use in source and binary forms, with or without
181.1Ssoren * modification, are permitted provided that the following conditions
191.1Ssoren * are met:
201.1Ssoren * 1. Redistributions of source code must retain the above copyright
211.1Ssoren *    notice, this list of conditions and the following disclaimer.
221.1Ssoren * 2. Redistributions in binary form must reproduce the above copyright
231.1Ssoren *    notice, this list of conditions and the following disclaimer in the
241.1Ssoren *    documentation and/or other materials provided with the distribution.
251.1Ssoren * 3. All advertising materials mentioning features or use of this software
261.1Ssoren *    must display the following acknowledgement:
271.1Ssoren *	This product includes software developed by the University of
281.1Ssoren *	California, Berkeley and its contributors.
291.1Ssoren * 4. Neither the name of the University nor the names of its contributors
301.1Ssoren *    may be used to endorse or promote products derived from this software
311.1Ssoren *    without specific prior written permission.
321.1Ssoren *
331.1Ssoren * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
341.1Ssoren * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
351.1Ssoren * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
361.1Ssoren * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
371.1Ssoren * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
381.1Ssoren * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
391.1Ssoren * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
401.1Ssoren * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
411.1Ssoren * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
421.1Ssoren * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
431.1Ssoren * SUCH DAMAGE.
441.2Sthorpej *
451.2Sthorpej *	@(#)zsvar.h	8.1 (Berkeley) 6/11/93
461.1Ssoren */
471.1Ssoren
481.1Ssoren#include <machine/bus.h>
491.1Ssoren#include <dev/ic/z8530sc.h>
501.1Ssoren
511.2Sthorpejstruct zs_channel {
521.2Sthorpej	struct zs_chanstate	cs_zscs; 	/* Required: soft state */
531.2Sthorpej	bus_space_tag_t		cs_bustag;	/* Machine-dependent */
541.2Sthorpej	bus_space_handle_t	cs_regs;
551.3Ssimonb};
561.2Sthorpej
571.1Ssorenstruct zsc_softc {
581.2Sthorpej	struct	device		zsc_dev;	/* required: base device */
591.2Sthorpej	struct	zs_chanstate   *zsc_cs[2];	/* channel soft state */
601.3Ssimonb	struct	zs_channel	zsc_cs_store[2];
611.1Ssoren	/* Machine-dependent part follows... */
621.2Sthorpej	bus_space_tag_t		zsc_bustag;	/* Bus type */
631.2Sthorpej	bus_space_handle_t	zsc_base; 	/* Device base address */
641.2Sthorpej	void		       *sc_si;		/* Softinterrupt handle */
651.1Ssoren};
661.1Ssoren
671.1Ssoren/*
681.1Ssoren * Functions to read and write individual registers in a channel.
691.2Sthorpej * The SCC chip requires 3-4 PCLK cycles recovery time between accesses
701.1Ssoren */
711.1Ssoren
721.2Sthorpeju_char zs_read_reg __P((struct zs_chanstate *cs, u_char reg));
731.2Sthorpeju_char zs_read_csr __P((struct zs_chanstate *cs));
741.2Sthorpeju_char zs_read_data __P((struct zs_chanstate *cs));
751.2Sthorpej
761.2Sthorpejvoid  zs_write_reg __P((struct zs_chanstate *cs, u_char reg, u_char val));
771.2Sthorpejvoid  zs_write_csr __P((struct zs_chanstate *cs, u_char val));
781.2Sthorpejvoid  zs_write_data __P((struct zs_chanstate *cs, u_char val));
791.2Sthorpej
801.2Sthorpej/* Zilog Serial hardware interrupts (level 0) */
811.2Sthorpej#define splzs()		spltty()
82