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