FreeBSD/Linux Kernel Cross Reference
sys/dev/adb/adb.h
1 /* $OpenBSD: adb.h,v 1.6 2022/10/21 22:42:36 gkoehler Exp $ */
2 /* $NetBSD: adbsys.h,v 1.4 2000/12/19 02:59:24 tsubai Exp $ */
3
4 /*-
5 * Copyright (C) 1993, 1994 Allen K. Briggs, Chris P. Caputo,
6 * Michael L. Finch, Bradley A. Grantham, and
7 * Lawrence A. Kesteloot
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. All advertising materials mentioning features or use of this software
19 * must display the following acknowledgement:
20 * This product includes software developed by the Alice Group.
21 * 4. The names of the Alice Group or any of its members may not be used
22 * to endorse or promote products derived from this software without
23 * specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``AS IS'' AND ANY EXPRESS OR
26 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
27 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
28 * IN NO EVENT SHALL THE ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
29 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
31 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
32 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
33 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 #ifndef _ADB_H_
38 #define _ADB_H_
39
40 #ifdef _KERNEL
41
42 /*
43 * Arguments used to attach a device to the Apple Desktop Bus
44 */
45 struct adb_attach_args {
46 const char *name; /* adb_device_name if real adb device */
47 int origaddr;
48 int adbaddr;
49 int handler_id;
50 };
51
52 extern const char adb_device_name[];
53
54 #define ADB_CMDADDR(cmd) ((u_int8_t)(cmd & 0xf0) >> 4)
55 #define ADBFLUSH(dev) ((((u_int8_t)dev & 0x0f) << 4) | 0x01)
56 #define ADBLISTEN(dev, reg) ((((u_int8_t)dev & 0x0f) << 4) | 0x08 | reg)
57 #define ADBTALK(dev, reg) ((((u_int8_t)dev & 0x0f) << 4) | 0x0c | reg)
58
59 /* an ADB event */
60 typedef struct adb_event_s {
61 int byte_count; /* number of bytes */
62 unsigned char bytes[8]; /* bytes from register 0 */
63 } adb_event_t;
64
65 /* Interesting default addresses */
66 #define ADBADDR_SECURE 1 /* Security dongles */
67 #define ADBADDR_MAP 2 /* Mapped devices (keyboards/pads) */
68 #define ADBADDR_REL 3 /* Relative positioning devices
69 (mice, trackballs/pads) */
70 #define ADBADDR_ABS 4 /* Absolute positioning devices
71 (graphics tablets) */
72 #define ADBADDR_DATATX 5
73 #define ADBADDR_RSRVD 6 /* Reserved by Apple */
74 #define ADBADDR_MISC 7 /* Miscellaneous appliances */
75 #define ADBADDR_DONGLE ADBADDR_SECURE
76 #define ADBADDR_KBD ADBADDR_MAP
77 #define ADBADDR_MS ADBADDR_REL
78 #define ADBADDR_TABLET ADBADDR_ABS
79 #define ADBADDR_MODEM ADBADDR_DATATX
80
81 /* Interesting keyboard handler IDs */
82 #define ADB_STDKBD 1
83 #define ADB_EXTKBD 2
84 #define ADB_ISOKBD 4
85 #define ADB_EXTISOKBD 5
86 #define ADB_KBDII 8
87 #define ADB_ISOKBDII 9
88 #define ADB_PBKBD 12
89 #define ADB_PBISOKBD 13
90 #define ADB_ADJKPD 14
91 #define ADB_ADJKBD 16
92 #define ADB_ADJISOKBD 17
93 #define ADB_ADJJAPKBD 18
94 #define ADB_PBEXTISOKBD 20
95 #define ADB_PBEXTJAPKBD 21
96 #define ADB_JPKBDII 22
97 #define ADB_PBEXTKBD 24
98 #define ADB_DESIGNKBD 27 /* XXX Needs to be verified XXX */
99 #define ADB_PBJPKBD 30
100 #define ADB_PBG4KBD 195
101 #define ADB_IBITISOKBD 196
102 #define ADB_PBG3JPKBD 201
103
104 /* Interesting mouse handler IDs */
105 #define ADBMS_100DPI 1
106 #define ADBMS_200DPI 2
107 #define ADBMS_MSA3 3 /* Mouse Systems A3 Mouse */
108 #define ADBMS_EXTENDED 4 /* Extended mouse protocol */
109 #define ADBMS_USPEED 0x2f /* MicroSpeed mouse */
110 #define ADBMS_UCONTOUR 0x66 /* Contour mouse */
111 #define ADBMS_TURBO 50 /* Kensington Turbo Mouse */
112
113 /* Interesting tablet handler ID */
114 #define ADB_ARTPAD 58 /* WACOM ArtPad II tablet */
115
116 /* Interesting miscellaneous handler ID */
117 #define ADB_POWERKEY 34 /* Sophisticated Circuits PowerKey */
118 /* (intelligent power tap) */
119
120 extern int adb_polling;
121 #ifdef ADB_DEBUG
122 extern int adb_debug;
123 #endif
124
125 /* ADB Manager */
126
127 typedef caddr_t Ptr;
128
129 typedef struct {
130 Ptr siServiceRtPtr;
131 Ptr siDataAreaAddr;
132 } ADBSetInfoBlock;
133
134 typedef struct {
135 unsigned char devType;
136 unsigned char origADBAddr;
137 Ptr dbServiceRtPtr;
138 Ptr dbDataAreaAddr;
139 } ADBDataBlock;
140
141 int adbprint(void *, const char *);
142 void adb_lid_closed_intr(void);
143 void adb_power_button_intr(void);
144 int adb_op_sync(Ptr, short);
145 int set_adb_info(ADBSetInfoBlock *, int);
146
147 #endif /* _KERNEL */
148
149 #endif /* _ADB_H_ */
Cache object: 425cc2944ed6df1a018517bb7ddef81d
|