dtreg.h revision 1.3 1 /* $NetBSD: dtreg.h,v 1.3 2005/12/11 12:18:41 christos Exp $ */
2
3 /*-
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell and Rick Macklem.
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. Neither the name of the University nor the names of its contributors
19 * may be used to endorse or promote products derived from this software
20 * without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 * @(#)dtopreg.h 8.1 (Berkeley) 6/10/93
35 */
36
37 /*
38 * Mach Operating System
39 * Copyright (c) 1992 Carnegie Mellon University
40 * All Rights Reserved.
41 *
42 * Permission to use, copy, modify and distribute this software and its
43 * documentation is hereby granted, provided that both the copyright
44 * notice and this permission notice appear in all copies of the
45 * software, derivative works or modified versions, and any portions
46 * thereof, and that both notices appear in supporting documentation.
47 *
48 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
49 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
50 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
51 *
52 * Carnegie Mellon requests users of this software to return to
53 *
54 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
55 * School of Computer Science
56 * Carnegie Mellon University
57 * Pittsburgh PA 15213-3890
58 *
59 * any improvements or extensions that they make and grant Carnegie Mellon
60 * the rights to redistribute these changes.
61 */
62 /*
63 * HISTORY
64 * Log: dtop.h,v
65 * Revision 2.3 92/03/05 17:08:17 rpd
66 * Define how many buttons and coordinates we can take.
67 * [92/03/05 af]
68 *
69 * Revision 2.2 92/03/02 18:32:17 rpd
70 * Created from DEC specs:
71 * "DESKTOPinterconnect Description and Protocol Specification"
72 * Version 0.9, Jun 17 1991
73 * "Open Desktop Bus, Locator Device Protocol Specification"
74 * Version 0.4, Dec 13 1990
75 * "Open Desktop Bus, Keyboard Device Protocol Specification"
76 * Version 0.7, Jan 9 1991
77 * [92/01/19 af]
78 *
79 */
80 /*
81 * File: dtop.h
82 * Author: Alessandro Forin, Carnegie Mellon University
83 * Date: 1/92
84 *
85 * Definitions for the Desktop serial bus (i2c aka ACCESS).
86 */
87
88 #ifndef _DTREG_H_
89 #define _DTREG_H_
90
91 #define DT_MAX_DEVICES 14
92 #define DT_MAX_MSG_SIZE 36 /* 3 hdr + 32 data + 1 checksum */
93
94 /*
95 * Standard addresses.
96 */
97 #define DT_ADDR_HOST 0x50 /* address for the (only) host */
98 #define DT_ADDR_FIRST 0x52 /* first assignable address */
99 #define DT_ADDR_MOUSE 0x6a /* mouse */
100 #define DT_ADDR_KBD 0x6c /* keyboard */
101 #define DT_ADDR_DEFAULT 0x6e /* power-up default address */
102 #define DT_ADDR_LAST 0x6c /* last, inclusive */
103
104 /*
105 * Standard messages
106 */
107 #define DT_MSG_RESET 0xf0 /* preceded by 0x81: P,len 1 */
108 #define DT_MSG_ID_REQUEST 0xf1 /* preceded by 0x81: P,len 1 */
109 #define DT_MSG_ASSIGN_ADDRESS 0xf2 /* preceded by 0x9e: P,len 30 */
110 /* followed by a dt_id_reply_t */
111 /* and by the new_IC_address */
112 #define DT_MSG_CAP_REQUEST 0xf3 /* preceded by 0x83: P,len 3 */
113 /* followed by a 16 bit u_offset */
114 #define DT_MSG_APPL_TEST 0xb1 /* precede by P, sub, len 1 */
115
116 /* from devices to host */
117
118 #define DT_MSG_ATTENTION 0xe0 /* preceded by P, len */
119 # define DT_ATN_OK_STATUS 0x00 /* anything else bad */
120 /* followed by 0-30 bytes */
121
122 #define DT_MSG_ID_REPLY 0xe1 /* preceded by P,len (29..32) */
123
124 struct dt_ident {
125 uint8_t revision[8]; /* ascii, blank padded */
126 uint8_t vendor[8];
127 uint8_t module[8];
128 int device_number; /* 32 bits cpl-2 */
129 uint8_t optional[4]; /* 0-3 optional bytes, ignore */
130 };
131
132 #define DT_MSG_CAP_REPLY 0xe3 /* preceded by P,len (3..32) */
133 /* followed by 16 bit u_offset */
134 /* followed by data */
135
136 #define DT_MSG_APPL_SIGNAL 0xa0 /* application level signal */
137 # define DT_SIG_ATTENTION 0x00
138 # define DT_SIG_RESET 0x01
139 # define DT_SIG_HALT 0x02
140
141 #define DT_MSG_APPL_TREPLY 0xa1 /* followed by status (0-->ok) */
142 /* and 0..30 bytes of result data */
143
144 /* reserved message codes (testing, manifacturing) */
145
146 #define DT_MSG_RES0 0xc0
147 #define DT_MSG_RES1 0xc1
148 #define DT_MSG_RES2 0xc2
149 #define DT_MSG_RES3 0xc3
150
151
152 /*
153 * Device specific definitions: Keyboard
154 */
155
156 /* From host to keyboard. */
157
158 #define DT_KMSG_CLICK 0x01 /* preceded by P, sub len 2 */
159 # define DT_CLICK_VOLUME_MAX 0x7 /* followed by one byte */
160
161 #define DT_KMSG_BELL 0x02 /* preceded by P, sub len 2 */
162 /* same as above */
163
164 #define DT_KMSG_LED 0x03 /* preceded by P, sub len 2 */
165 /* four lower bits turn leds on */
166
167 #define DT_KMSG_POLL 0x04 /* preceded by P, sub len 1 */
168
169 /* Keyboard sends up to 11 codes in a data message, distinguished values: */
170 #define DT_KBD_EMPTY 0x00
171 #define DT_KBD_OUT_ERR 0x01
172 #define DT_KBD_IN_ERR 0x02
173
174 #define DT_KBD_KEY_MIN 0x08
175 #define DT_KBD_KEY_MAX 0xff
176
177 /* Powerup status values */
178 #define DT_KBD_OK 0x00
179 #define DT_KBD_ROM_FAIL 0x01
180 #define DT_KBD_RAM_FAIL 0x02
181 #define DT_KBD_KEY_DOWN 0x03
182
183 /*
184 * Device specific definitions: Locators (mouse)
185 */
186
187 struct dt_locator_msg {
188 uint16_t buttons; /* 1->pressed */
189 int16_t x;
190 int16_t y;
191 int16_t z;
192 /* possibly 3 more dimensions for gloves */
193 };
194
195 #define DT_LMSG_SET_RATE 0x01 /* preceded by P,sub, len 2 */
196 /* followed by sampling interval,
197 from 8 to 25 msecs (0->polled */
198 #define DT_LMSG_POLL 0x02 /* preceded by P,sub, len 1 */
199
200 /* Powerup status values: 0 ok, else.. */
201 #define DT_MOUSE_ROM_FAIL 0x01
202 #define DT_MOUSE_RAM_FAIL 0x02
203 #define DT_MOUSE_KEY_DOWN 0x03
204
205 #endif /* !_DTREG_H_ */
206