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