Home | History | Annotate | Line # | Download | only in include
adbsys.h revision 1.2
      1 /*	$NetBSD: adbsys.h,v 1.2 1994/10/26 08:46:23 cgd Exp $	*/
      2 
      3 /*-
      4  * Copyright (C) 1993, 1994	Allen K. Briggs, Chris P. Caputo,
      5  *			Michael L. Finch, Bradley A. Grantham, and
      6  *			Lawrence A. Kesteloot
      7  * All rights reserved.
      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. All advertising materials mentioning features or use of this software
     18  *    must display the following acknowledgement:
     19  *	This product includes software developed by the Alice Group.
     20  * 4. The names of the Alice Group or any of its members may not be used
     21  *    to endorse or promote products derived from this software without
     22  *    specific prior written permission.
     23  *
     24  * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
     25  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     26  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     27  * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
     28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     29  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     34  */
     35 
     36 
     37 #include <sys/time.h>	/* timeval stuff */
     38 #include <sys/ioctl.h>	/* ioctls */
     39 
     40 
     41 /* Handy visual constants */
     42 #define ADB_MAX_HANDLERS	256
     43 #define ADB_MAX_DEVS	16
     44 
     45 
     46 /* Different ADB system types */
     47 enum adb_system_e {
     48 	MacIIADB,
     49 	MacIIsiADB,
     50 	MacPBADB};
     51 extern enum adb_system_e adb_system_type;
     52 
     53 
     54 /* an ADB event */
     55 typedef struct adb_event_s {
     56 	int addr;			/* device address */
     57 	int hand_id;			/* handler id */
     58 	int def_addr;			/* default address */
     59 	int byte_count;			/* number of bytes */
     60 	unsigned char bytes[8];		/* bytes from register 0 */
     61 	struct timeval timestamp;	/* time event was acquired */
     62 	union {
     63 		struct adb_keydata_s{
     64 			int key;	/* ADB key code */
     65 		} k;
     66 		struct adb_mousedata_s{
     67 			int dx;		/* mouse delta x */
     68 			int dy;		/* mouse delta y */
     69 			int buttons;	/* buttons (down << (buttonnum)) */
     70 		} m;
     71 	} u;				/* courtesy interpretation */
     72 } adb_event_t;
     73 
     74 
     75 /* a device on the ADB */
     76 typedef struct adb_dev_s{
     77 	int		default_addr;	/* startup address */
     78 	int		handler_id;	/* handler ID */
     79 } adb_dev_t;
     80 
     81 extern adb_dev_t adb_devs[ADB_MAX_DEVS];
     82 
     83 
     84 	/* Interesting default addresses */
     85 #define ADBADDR_MAP	2
     86 #define ADBADDR_REL	3
     87 #define ADBADDR_ABS	4
     88 #define ADBADDR_KBD	ADBADDR_MAP
     89 #define ADBADDR_MS	ADBADDR_REL
     90 #define ADBADDR_TABLET	ADBADDR_ABS
     91 
     92 
     93 	/* Interesting handler IDs */
     94 #define ADB_STDKBD	1
     95 #define ADB_EXTKBD	2
     96 #define ADBMS_100DPI	1
     97 #define ADBMS_200DPI	2
     98 
     99 
    100 /* Need to export for mac68k/machdep.c:setmachdep() */
    101 extern long adb_intr_II(void);
    102 extern long adb_intr_SI(void);
    103 extern long adb_intr_PB(void);
    104 
    105 
    106 	/* Get device info from ADB system */
    107 typedef struct adb_devinfo_s{
    108 	adb_dev_t	dev[ADB_MAX_DEVS];
    109 } adb_devinfo_t;
    110 #define ADBIOC_GETDEVS	_IOR('A', 128, adb_devinfo_t)
    111 
    112 
    113 	/* Set keyboard lights */
    114 typedef struct adb_setlights_s{
    115 	int addr;
    116 	unsigned int lights;
    117 } adb_setlights_t;
    118 #define ADBIOC_SETLIGHTS	_IOWR('A', 129, adb_setlights_t)
    119 
    120 
    121 	/* Event auto-repeat */
    122 typedef struct adb_rptinfo_s{
    123 	int delay_ticks;	/* ticks before repeat */
    124 	int interval_ticks;	/* ticks between repeats */
    125 } adb_rptinfo_t;
    126 #define ADBIOC_GETREPEAT	_IOR('A', 130, adb_rptinfo_t)
    127 #define ADBIOC_SETREPEAT	_IOW('A', 131, adb_rptinfo_t)
    128