Home | History | Annotate | Line # | Download | only in include
adbsys.h revision 1.4
      1  1.4   briggs /*	$NetBSD: adbsys.h,v 1.4 1996/05/05 06:17:29 briggs 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.4   briggs #ifndef _ADBSYS_MACHINE_
     37  1.4   briggs #define _ADBSYS_MACHINE_
     38  1.1  lkestel 
     39  1.1  lkestel #include <sys/time.h>	/* timeval stuff */
     40  1.1  lkestel #include <sys/ioctl.h>	/* ioctls */
     41  1.1  lkestel 
     42  1.1  lkestel 
     43  1.1  lkestel /* Handy visual constants */
     44  1.1  lkestel #define ADB_MAX_HANDLERS	256
     45  1.1  lkestel #define ADB_MAX_DEVS	16
     46  1.1  lkestel 
     47  1.1  lkestel 
     48  1.1  lkestel /* Different ADB system types */
     49  1.1  lkestel enum adb_system_e {
     50  1.1  lkestel 	MacIIADB,
     51  1.1  lkestel 	MacIIsiADB,
     52  1.1  lkestel 	MacPBADB};
     53  1.1  lkestel extern enum adb_system_e adb_system_type;
     54  1.1  lkestel 
     55  1.1  lkestel 
     56  1.1  lkestel /* an ADB event */
     57  1.1  lkestel typedef struct adb_event_s {
     58  1.1  lkestel 	int addr;			/* device address */
     59  1.1  lkestel 	int hand_id;			/* handler id */
     60  1.1  lkestel 	int def_addr;			/* default address */
     61  1.1  lkestel 	int byte_count;			/* number of bytes */
     62  1.1  lkestel 	unsigned char bytes[8];		/* bytes from register 0 */
     63  1.1  lkestel 	struct timeval timestamp;	/* time event was acquired */
     64  1.1  lkestel 	union {
     65  1.1  lkestel 		struct adb_keydata_s{
     66  1.1  lkestel 			int key;	/* ADB key code */
     67  1.1  lkestel 		} k;
     68  1.1  lkestel 		struct adb_mousedata_s{
     69  1.1  lkestel 			int dx;		/* mouse delta x */
     70  1.1  lkestel 			int dy;		/* mouse delta y */
     71  1.1  lkestel 			int buttons;	/* buttons (down << (buttonnum)) */
     72  1.1  lkestel 		} m;
     73  1.1  lkestel 	} u;				/* courtesy interpretation */
     74  1.1  lkestel } adb_event_t;
     75  1.1  lkestel 
     76  1.1  lkestel 
     77  1.1  lkestel /* a device on the ADB */
     78  1.1  lkestel typedef struct adb_dev_s{
     79  1.3   briggs 	int		addr;		/* current address */
     80  1.1  lkestel 	int		default_addr;	/* startup address */
     81  1.1  lkestel 	int		handler_id;	/* handler ID */
     82  1.1  lkestel } adb_dev_t;
     83  1.1  lkestel 
     84  1.1  lkestel 
     85  1.1  lkestel 	/* Interesting default addresses */
     86  1.1  lkestel #define ADBADDR_MAP	2
     87  1.1  lkestel #define ADBADDR_REL	3
     88  1.1  lkestel #define ADBADDR_ABS	4
     89  1.1  lkestel #define ADBADDR_KBD	ADBADDR_MAP
     90  1.1  lkestel #define ADBADDR_MS	ADBADDR_REL
     91  1.1  lkestel #define ADBADDR_TABLET	ADBADDR_ABS
     92  1.1  lkestel 
     93  1.1  lkestel 
     94  1.1  lkestel 	/* Interesting handler IDs */
     95  1.1  lkestel #define ADB_STDKBD	1
     96  1.1  lkestel #define ADB_EXTKBD	2
     97  1.1  lkestel #define ADBMS_100DPI	1
     98  1.1  lkestel #define ADBMS_200DPI	2
     99  1.1  lkestel 
    100  1.1  lkestel 
    101  1.1  lkestel 	/* Get device info from ADB system */
    102  1.1  lkestel typedef struct adb_devinfo_s{
    103  1.1  lkestel 	adb_dev_t	dev[ADB_MAX_DEVS];
    104  1.3   briggs 		/* [addr].addr == -1 if none */
    105  1.1  lkestel } adb_devinfo_t;
    106  1.3   briggs #define ADBIOC_DEVSINFO	_IOR('A', 128, adb_devinfo_t)
    107  1.1  lkestel 
    108  1.1  lkestel 
    109  1.1  lkestel 	/* Event auto-repeat */
    110  1.1  lkestel typedef struct adb_rptinfo_s{
    111  1.1  lkestel 	int delay_ticks;	/* ticks before repeat */
    112  1.1  lkestel 	int interval_ticks;	/* ticks between repeats */
    113  1.1  lkestel } adb_rptinfo_t;
    114  1.1  lkestel #define ADBIOC_GETREPEAT	_IOR('A', 130, adb_rptinfo_t)
    115  1.1  lkestel #define ADBIOC_SETREPEAT	_IOW('A', 131, adb_rptinfo_t)
    116  1.3   briggs 
    117  1.3   briggs 
    118  1.3   briggs 	/* Reset and reinitialize */
    119  1.3   briggs #define ADBIOC_RESET		_IO('A', 132)
    120  1.3   briggs 
    121  1.3   briggs 
    122  1.3   briggs typedef struct adb_listencmd_s{
    123  1.3   briggs 	int address;		/* device address */
    124  1.3   briggs 	int reg;		/* register to which to send bytes */
    125  1.3   briggs 	int bytecnt;		/* number of bytes */
    126  1.3   briggs 	u_char bytes[8];	/* bytes */
    127  1.3   briggs } adb_listencmd_t;
    128  1.3   briggs #define ADBIOC_LISTENCMD	_IOW('A', 133, adb_listencmd_t)
    129  1.4   briggs 
    130  1.4   briggs void	adb_init __P((void));
    131  1.4   briggs 
    132  1.4   briggs #endif /* _ADBSYS_MACHINE_ */
    133