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