Home | History | Annotate | Line # | Download | only in sun
msvar.h revision 1.3
      1  1.3   pk /*	$NetBSD: msvar.h,v 1.3 2001/12/09 12:02:06 pk Exp $	*/
      2  1.1  mrg 
      3  1.1  mrg /*
      4  1.1  mrg  * Copyright (c) 1992, 1993
      5  1.1  mrg  *	The Regents of the University of California.  All rights reserved.
      6  1.1  mrg  *
      7  1.1  mrg  * This software was developed by the Computer Systems Engineering group
      8  1.1  mrg  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
      9  1.1  mrg  * contributed to Berkeley.
     10  1.1  mrg  *
     11  1.1  mrg  * All advertising materials mentioning features or use of this software
     12  1.1  mrg  * must display the following acknowledgement:
     13  1.1  mrg  *	This product includes software developed by the University of
     14  1.1  mrg  *	California, Lawrence Berkeley Laboratory.
     15  1.1  mrg  *
     16  1.1  mrg  * Redistribution and use in source and binary forms, with or without
     17  1.1  mrg  * modification, are permitted provided that the following conditions
     18  1.1  mrg  * are met:
     19  1.1  mrg  * 1. Redistributions of source code must retain the above copyright
     20  1.1  mrg  *    notice, this list of conditions and the following disclaimer.
     21  1.1  mrg  * 2. Redistributions in binary form must reproduce the above copyright
     22  1.1  mrg  *    notice, this list of conditions and the following disclaimer in the
     23  1.1  mrg  *    documentation and/or other materials provided with the distribution.
     24  1.1  mrg  * 3. All advertising materials mentioning features or use of this software
     25  1.1  mrg  *    must display the following acknowledgement:
     26  1.1  mrg  *	This product includes software developed by the University of
     27  1.1  mrg  *	California, Berkeley and its contributors.
     28  1.1  mrg  * 4. Neither the name of the University nor the names of its contributors
     29  1.1  mrg  *    may be used to endorse or promote products derived from this software
     30  1.1  mrg  *    without specific prior written permission.
     31  1.1  mrg  *
     32  1.1  mrg  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     33  1.1  mrg  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     34  1.1  mrg  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     35  1.1  mrg  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     36  1.1  mrg  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     37  1.1  mrg  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     38  1.1  mrg  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     39  1.1  mrg  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     40  1.1  mrg  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     41  1.1  mrg  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     42  1.1  mrg  * SUCH DAMAGE.
     43  1.1  mrg  *
     44  1.1  mrg  *	@(#)ms.c	8.1 (Berkeley) 6/11/93
     45  1.1  mrg  */
     46  1.1  mrg 
     47  1.1  mrg /*
     48  1.1  mrg  * How many input characters we can buffer.
     49  1.1  mrg  * The port-specific var.h may override this.
     50  1.1  mrg  * Note: must be a power of two!
     51  1.1  mrg  */
     52  1.1  mrg #define	MS_RX_RING_SIZE	256
     53  1.1  mrg #define MS_RX_RING_MASK (MS_RX_RING_SIZE-1)
     54  1.1  mrg /*
     55  1.1  mrg  * Output buffer.  Only need a few chars.
     56  1.1  mrg  */
     57  1.1  mrg #define	MS_TX_RING_SIZE	16
     58  1.1  mrg #define MS_TX_RING_MASK (MS_TX_RING_SIZE-1)
     59  1.1  mrg /*
     60  1.3   pk  * mouse serial line speed defaults to 1200 bps.
     61  1.1  mrg  */
     62  1.3   pk #define MS_DEFAULT_BPS 	1200
     63  1.1  mrg 
     64  1.1  mrg /*
     65  1.1  mrg  * Mouse state.  A Mouse Systems mouse is a fairly simple device,
     66  1.1  mrg  * producing five-byte blobs of the form:
     67  1.1  mrg  *
     68  1.1  mrg  *	b dx dy dx dy
     69  1.1  mrg  *
     70  1.1  mrg  * where b is the button state, encoded as 0x80|(~buttons)---there are
     71  1.1  mrg  * three buttons (4=left, 2=middle, 1=right)---and dx,dy are X and Y
     72  1.1  mrg  * delta values, none of which have are in [0x80..0x87].  (This lets
     73  1.1  mrg  * us sync up with the mouse after an error.)
     74  1.1  mrg  */
     75  1.1  mrg struct ms_softc {
     76  1.1  mrg 	struct	device ms_dev;		/* required first: base device */
     77  1.1  mrg 	struct	zs_chanstate *ms_cs;
     78  1.2  eeh 
     79  1.2  eeh 	/*
     80  1.2  eeh 	 * The deviopen and deviclose routines are provided
     81  1.2  eeh 	 * by the lower level driver and used as a back door
     82  1.2  eeh 	 * when opening and closing the internal device.
     83  1.2  eeh 	 */
     84  1.2  eeh 	int	(*ms_deviopen)	__P((struct device *, int));
     85  1.2  eeh 	int	(*ms_deviclose)	__P((struct device *, int));
     86  1.1  mrg 
     87  1.1  mrg 	/* Flags to communicate with ms_softintr() */
     88  1.1  mrg 	volatile int ms_intr_flags;
     89  1.1  mrg #define	INTR_RX_OVERRUN 1
     90  1.1  mrg #define INTR_TX_EMPTY   2
     91  1.1  mrg #define INTR_ST_CHECK   4
     92  1.1  mrg 
     93  1.1  mrg 	/*
     94  1.1  mrg 	 * The receive ring buffer.
     95  1.1  mrg 	 */
     96  1.1  mrg 	u_int	ms_rbget;	/* ring buffer `get' index */
     97  1.1  mrg 	volatile u_int	ms_rbput;	/* ring buffer `put' index */
     98  1.1  mrg 	u_short	ms_rbuf[MS_RX_RING_SIZE]; /* rr1, data pairs */
     99  1.1  mrg 
    100  1.1  mrg 	/*
    101  1.1  mrg 	 * State of input translator
    102  1.1  mrg 	 */
    103  1.1  mrg 	short	ms_byteno;		/* input byte number, for decode */
    104  1.1  mrg 	char	ms_mb;			/* mouse button state */
    105  1.1  mrg 	char	ms_ub;			/* user button state */
    106  1.1  mrg 	int	ms_dx;			/* delta-x */
    107  1.1  mrg 	int	ms_dy;			/* delta-y */
    108  1.1  mrg 
    109  1.1  mrg 	/*
    110  1.1  mrg 	 * State of upper interface.
    111  1.1  mrg 	 */
    112  1.1  mrg 	volatile int ms_ready;		/* event queue is ready */
    113  1.1  mrg 	struct	evvar ms_events;	/* event queue state */
    114  1.1  mrg };
    115  1.1  mrg 
    116  1.1  mrg /* front-end call back for mouse input */
    117  1.1  mrg void ms_input __P((struct ms_softc *, int c));
    118