Home | History | Annotate | Line # | Download | only in dec
      1 /*	$NetBSD: dzvar.h,v 1.12 2019/12/27 06:52:43 msaitoh Exp $	*/
      2 /*
      3  * Copyright (c) 1992, 1993
      4  *	The Regents of the University of California.  All rights reserved.
      5  *
      6  * This code is derived from software contributed to Berkeley by
      7  * Ralph Campbell and Rick Macklem.
      8  *
      9  * Redistribution and use in source and binary forms, with or without
     10  * modification, are permitted provided that the following conditions
     11  * are met:
     12  * 1. Redistributions of source code must retain the above copyright
     13  *    notice, this list of conditions and the following disclaimer.
     14  * 2. Redistributions in binary form must reproduce the above copyright
     15  *    notice, this list of conditions and the following disclaimer in the
     16  *    documentation and/or other materials provided with the distribution.
     17  * 3. Neither the name of the University nor the names of its contributors
     18  *    may be used to endorse or promote products derived from this software
     19  *    without specific prior written permission.
     20  *
     21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     31  * SUCH DAMAGE.
     32  */
     33 
     34 /*
     35  * Copyright (c) 1996  Ken C. Wellsch.  All rights reserved.
     36  *
     37  * This code is derived from software contributed to Berkeley by
     38  * Ralph Campbell and Rick Macklem.
     39  *
     40  * Redistribution and use in source and binary forms, with or without
     41  * modification, are permitted provided that the following conditions
     42  * are met:
     43  * 1. Redistributions of source code must retain the above copyright
     44  *    notice, this list of conditions and the following disclaimer.
     45  * 2. Redistributions in binary form must reproduce the above copyright
     46  *    notice, this list of conditions and the following disclaimer in the
     47  *    documentation and/or other materials provided with the distribution.
     48  * 3. All advertising materials mentioning features or use of this software
     49  *    must display the following acknowledgement:
     50  *	This product includes software developed by the University of
     51  *	California, Berkeley and its contributors.
     52  * 4. Neither the name of the University nor the names of its contributors
     53  *    may be used to endorse or promote products derived from this software
     54  *    without specific prior written permission.
     55  *
     56  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     57  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     58  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     59  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     60  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     61  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     62  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     63  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     64  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     65  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     66  * SUCH DAMAGE.
     67  */
     68 
     69 #ifndef _DEV_DEC_DZVAR_H_
     70 #define _DEV_DEC_DZVAR_H_
     71 
     72 /* A DZ-11 has 8 ports while a DZV/DZQ-11 has only 4. */
     73 
     74 #define	NDZLINE 	8
     75 
     76 #define	DZ_DZ		8
     77 #define	DZ_DZV		4
     78 #define	DZ_DC		4
     79 
     80 #define DZ_C2I(c)	((c)<<3)	/* convert controller # to index */
     81 #define DZ_I2C(c)	((c)>>3)	/* convert minor to controller # */
     82 #define DZ_PORT(u)	((u)&07)	/* extract the port # */
     83 
     84 struct	dz_softc {
     85 	device_t	sc_dev;		/* Autoconf blaha */
     86 	struct	evcnt	sc_rintrcnt;	/* receive interrupt counts */
     87 	struct	evcnt	sc_tintrcnt;	/* transmit interrupt counts */
     88 	struct	dz_regs	sc_dr;		/* reg pointers */
     89 	bus_space_tag_t	sc_iot;
     90 	bus_space_handle_t sc_ioh;
     91 	int		sc_type;	/* DZ11 or DZV11? */
     92 	int		sc_consline;	/* console line, or -1 */
     93 	int		sc_rxint;	/* Receive interrupt count XXX */
     94 	u_char		sc_brk;		/* Break asserted on some lines */
     95 	u_char		sc_dsr;		/* DSR set bits if no mdm ctrl */
     96 	struct dz_linestate {
     97 		struct	dz_softc *dz_sc;	/* backpointer to softc */
     98 		int		dz_line;	/* channel number */
     99 		void		*dz_private;	/* sub-driver data pointer */
    100 		int		(*dz_catch)(void *, int); /* Fast catch recv */
    101 		struct	tty *	dz_tty;		/* what we work on */
    102 #ifdef notyet
    103 		void *		dz_mem;		/* pointers to clist output */
    104 		void *		dz_end;		/*   allowing pdma action */
    105 #endif
    106 	} sc_dz[NDZLINE];
    107 };
    108 
    109 void	dzattach(struct dz_softc *, struct evcnt *, int);
    110 void	dzrint(void *);
    111 void	dzxint(void *);
    112 void	dzreset(device_t);
    113 
    114 #endif /* _DEV_DEC_DZVAR_H_ */
    115