1*820a544dStsutsui /* $NetBSD: msvar.h,v 1.2 2008/03/28 18:19:56 tsutsui Exp $ */ 208f4daf2Stsutsui 308f4daf2Stsutsui /*- 408f4daf2Stsutsui * Copyright (c) 2001 Tsubai Masanari. All rights reserved. 508f4daf2Stsutsui * 608f4daf2Stsutsui * Redistribution and use in source and binary forms, with or without 708f4daf2Stsutsui * modification, are permitted provided that the following conditions 808f4daf2Stsutsui * are met: 908f4daf2Stsutsui * 1. Redistributions of source code must retain the above copyright 1008f4daf2Stsutsui * notice, this list of conditions and the following disclaimer. 1108f4daf2Stsutsui * 2. Redistributions in binary form must reproduce the above copyright 1208f4daf2Stsutsui * notice, this list of conditions and the following disclaimer in the 1308f4daf2Stsutsui * documentation and/or other materials provided with the distribution. 1408f4daf2Stsutsui * 3. The name of the author may not be used to endorse or promote products 1508f4daf2Stsutsui * derived from this software without specific prior written permission. 1608f4daf2Stsutsui * 1708f4daf2Stsutsui * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 1808f4daf2Stsutsui * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 1908f4daf2Stsutsui * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 2008f4daf2Stsutsui * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 2108f4daf2Stsutsui * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 2208f4daf2Stsutsui * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2308f4daf2Stsutsui * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2408f4daf2Stsutsui * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2508f4daf2Stsutsui * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2608f4daf2Stsutsui * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2708f4daf2Stsutsui */ 2808f4daf2Stsutsui 2908f4daf2Stsutsui #define MS_S_BYTE 0 /* start byte */ 3008f4daf2Stsutsui #define MS_X_BYTE 1 /* second byte */ 3108f4daf2Stsutsui #define MS_Y_BYTE 2 /* third byte */ 3208f4daf2Stsutsui #define MS_DB_SIZE 3 3308f4daf2Stsutsui 3408f4daf2Stsutsui #define MS_S_MARK 0x80 /* start mark (first byte)*/ 3508f4daf2Stsutsui #define MS_S_XSIGN 0x08 /* MSB(sign bit) of X */ 3608f4daf2Stsutsui #define MS_S_YSIGN 0x10 /* MSB(sign bit) of Y */ 3708f4daf2Stsutsui #define MS_S_SW1 0x01 /* left button is pressed */ 3808f4daf2Stsutsui #define MS_S_SW2 0x02 /* right button is pressed */ 3908f4daf2Stsutsui #define MS_S_SW3 0x04 /* middle button is pressed */ 4008f4daf2Stsutsui 4108f4daf2Stsutsui #define MS_X_DATA 0x7f /* data bits of X (second byte) */ 4208f4daf2Stsutsui #define MS_Y_DATA 0x7f /* data bits of Y (third byte) */ 4308f4daf2Stsutsui 4408f4daf2Stsutsui struct ms_softc { 45*820a544dStsutsui device_t sc_dev; 4608f4daf2Stsutsui bus_space_tag_t sc_bt; 4708f4daf2Stsutsui bus_space_handle_t sc_bh; 48*820a544dStsutsui device_t sc_wsmousedev; 4908f4daf2Stsutsui bus_size_t sc_offset; /* ms data port offset */ 5008f4daf2Stsutsui int sc_ndata; 5108f4daf2Stsutsui u_char sc_buf[MS_DB_SIZE]; 5208f4daf2Stsutsui }; 5308f4daf2Stsutsui 5408f4daf2Stsutsui void ms_intr(struct ms_softc *); 55