1*95e1ffb1Schristos /* $NetBSD: dtreg.h,v 1.3 2005/12/11 12:18:41 christos Exp $ */ 29aa9b8ebSad 39aa9b8ebSad /*- 49aa9b8ebSad * Copyright (c) 1992, 1993 59aa9b8ebSad * The Regents of the University of California. All rights reserved. 69aa9b8ebSad * 79aa9b8ebSad * This code is derived from software contributed to Berkeley by 89aa9b8ebSad * Ralph Campbell and Rick Macklem. 99aa9b8ebSad * 109aa9b8ebSad * Redistribution and use in source and binary forms, with or without 119aa9b8ebSad * modification, are permitted provided that the following conditions 129aa9b8ebSad * are met: 139aa9b8ebSad * 1. Redistributions of source code must retain the above copyright 149aa9b8ebSad * notice, this list of conditions and the following disclaimer. 159aa9b8ebSad * 2. Redistributions in binary form must reproduce the above copyright 169aa9b8ebSad * notice, this list of conditions and the following disclaimer in the 179aa9b8ebSad * documentation and/or other materials provided with the distribution. 189aa9b8ebSad * 3. Neither the name of the University nor the names of its contributors 199aa9b8ebSad * may be used to endorse or promote products derived from this software 209aa9b8ebSad * without specific prior written permission. 219aa9b8ebSad * 229aa9b8ebSad * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 239aa9b8ebSad * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 249aa9b8ebSad * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 259aa9b8ebSad * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 269aa9b8ebSad * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 279aa9b8ebSad * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 289aa9b8ebSad * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 299aa9b8ebSad * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 309aa9b8ebSad * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 319aa9b8ebSad * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 329aa9b8ebSad * SUCH DAMAGE. 339aa9b8ebSad * 349aa9b8ebSad * @(#)dtopreg.h 8.1 (Berkeley) 6/10/93 359aa9b8ebSad */ 369aa9b8ebSad 379aa9b8ebSad /* 389aa9b8ebSad * Mach Operating System 399aa9b8ebSad * Copyright (c) 1992 Carnegie Mellon University 409aa9b8ebSad * All Rights Reserved. 419aa9b8ebSad * 429aa9b8ebSad * Permission to use, copy, modify and distribute this software and its 439aa9b8ebSad * documentation is hereby granted, provided that both the copyright 449aa9b8ebSad * notice and this permission notice appear in all copies of the 459aa9b8ebSad * software, derivative works or modified versions, and any portions 469aa9b8ebSad * thereof, and that both notices appear in supporting documentation. 479aa9b8ebSad * 489aa9b8ebSad * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 499aa9b8ebSad * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 509aa9b8ebSad * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 519aa9b8ebSad * 529aa9b8ebSad * Carnegie Mellon requests users of this software to return to 539aa9b8ebSad * 549aa9b8ebSad * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 559aa9b8ebSad * School of Computer Science 569aa9b8ebSad * Carnegie Mellon University 579aa9b8ebSad * Pittsburgh PA 15213-3890 589aa9b8ebSad * 599aa9b8ebSad * any improvements or extensions that they make and grant Carnegie Mellon 609aa9b8ebSad * the rights to redistribute these changes. 619aa9b8ebSad */ 629aa9b8ebSad /* 639aa9b8ebSad * HISTORY 649aa9b8ebSad * Log: dtop.h,v 659aa9b8ebSad * Revision 2.3 92/03/05 17:08:17 rpd 669aa9b8ebSad * Define how many buttons and coordinates we can take. 679aa9b8ebSad * [92/03/05 af] 689aa9b8ebSad * 699aa9b8ebSad * Revision 2.2 92/03/02 18:32:17 rpd 709aa9b8ebSad * Created from DEC specs: 719aa9b8ebSad * "DESKTOPinterconnect Description and Protocol Specification" 729aa9b8ebSad * Version 0.9, Jun 17 1991 739aa9b8ebSad * "Open Desktop Bus, Locator Device Protocol Specification" 749aa9b8ebSad * Version 0.4, Dec 13 1990 759aa9b8ebSad * "Open Desktop Bus, Keyboard Device Protocol Specification" 769aa9b8ebSad * Version 0.7, Jan 9 1991 779aa9b8ebSad * [92/01/19 af] 789aa9b8ebSad * 799aa9b8ebSad */ 809aa9b8ebSad /* 819aa9b8ebSad * File: dtop.h 829aa9b8ebSad * Author: Alessandro Forin, Carnegie Mellon University 839aa9b8ebSad * Date: 1/92 849aa9b8ebSad * 859aa9b8ebSad * Definitions for the Desktop serial bus (i2c aka ACCESS). 869aa9b8ebSad */ 879aa9b8ebSad 889aa9b8ebSad #ifndef _DTREG_H_ 899aa9b8ebSad #define _DTREG_H_ 909aa9b8ebSad 919aa9b8ebSad #define DT_MAX_DEVICES 14 929aa9b8ebSad #define DT_MAX_MSG_SIZE 36 /* 3 hdr + 32 data + 1 checksum */ 939aa9b8ebSad 949aa9b8ebSad /* 959aa9b8ebSad * Standard addresses. 969aa9b8ebSad */ 979aa9b8ebSad #define DT_ADDR_HOST 0x50 /* address for the (only) host */ 989aa9b8ebSad #define DT_ADDR_FIRST 0x52 /* first assignable address */ 999aa9b8ebSad #define DT_ADDR_MOUSE 0x6a /* mouse */ 1009aa9b8ebSad #define DT_ADDR_KBD 0x6c /* keyboard */ 1019aa9b8ebSad #define DT_ADDR_DEFAULT 0x6e /* power-up default address */ 1029aa9b8ebSad #define DT_ADDR_LAST 0x6c /* last, inclusive */ 1039aa9b8ebSad 1049aa9b8ebSad /* 1059aa9b8ebSad * Standard messages 1069aa9b8ebSad */ 1079aa9b8ebSad #define DT_MSG_RESET 0xf0 /* preceded by 0x81: P,len 1 */ 1089aa9b8ebSad #define DT_MSG_ID_REQUEST 0xf1 /* preceded by 0x81: P,len 1 */ 1099aa9b8ebSad #define DT_MSG_ASSIGN_ADDRESS 0xf2 /* preceded by 0x9e: P,len 30 */ 1109aa9b8ebSad /* followed by a dt_id_reply_t */ 1119aa9b8ebSad /* and by the new_IC_address */ 1129aa9b8ebSad #define DT_MSG_CAP_REQUEST 0xf3 /* preceded by 0x83: P,len 3 */ 1139aa9b8ebSad /* followed by a 16 bit u_offset */ 1149aa9b8ebSad #define DT_MSG_APPL_TEST 0xb1 /* precede by P, sub, len 1 */ 1159aa9b8ebSad 1169aa9b8ebSad /* from devices to host */ 1179aa9b8ebSad 1189aa9b8ebSad #define DT_MSG_ATTENTION 0xe0 /* preceded by P, len */ 1199aa9b8ebSad # define DT_ATN_OK_STATUS 0x00 /* anything else bad */ 1209aa9b8ebSad /* followed by 0-30 bytes */ 1219aa9b8ebSad 1229aa9b8ebSad #define DT_MSG_ID_REPLY 0xe1 /* preceded by P,len (29..32) */ 1239aa9b8ebSad 1249aa9b8ebSad struct dt_ident { 1259aa9b8ebSad uint8_t revision[8]; /* ascii, blank padded */ 1269aa9b8ebSad uint8_t vendor[8]; 1279aa9b8ebSad uint8_t module[8]; 1289aa9b8ebSad int device_number; /* 32 bits cpl-2 */ 1299aa9b8ebSad uint8_t optional[4]; /* 0-3 optional bytes, ignore */ 1309aa9b8ebSad }; 1319aa9b8ebSad 1329aa9b8ebSad #define DT_MSG_CAP_REPLY 0xe3 /* preceded by P,len (3..32) */ 1339aa9b8ebSad /* followed by 16 bit u_offset */ 1349aa9b8ebSad /* followed by data */ 1359aa9b8ebSad 1369aa9b8ebSad #define DT_MSG_APPL_SIGNAL 0xa0 /* application level signal */ 1379aa9b8ebSad # define DT_SIG_ATTENTION 0x00 1389aa9b8ebSad # define DT_SIG_RESET 0x01 1399aa9b8ebSad # define DT_SIG_HALT 0x02 1409aa9b8ebSad 1419aa9b8ebSad #define DT_MSG_APPL_TREPLY 0xa1 /* followed by status (0-->ok) */ 1429aa9b8ebSad /* and 0..30 bytes of result data */ 1439aa9b8ebSad 1449aa9b8ebSad /* reserved message codes (testing, manifacturing) */ 1459aa9b8ebSad 1469aa9b8ebSad #define DT_MSG_RES0 0xc0 1479aa9b8ebSad #define DT_MSG_RES1 0xc1 1489aa9b8ebSad #define DT_MSG_RES2 0xc2 1499aa9b8ebSad #define DT_MSG_RES3 0xc3 1509aa9b8ebSad 1519aa9b8ebSad 1529aa9b8ebSad /* 1539aa9b8ebSad * Device specific definitions: Keyboard 1549aa9b8ebSad */ 1559aa9b8ebSad 1569aa9b8ebSad /* From host to keyboard. */ 1579aa9b8ebSad 1589aa9b8ebSad #define DT_KMSG_CLICK 0x01 /* preceded by P, sub len 2 */ 1599aa9b8ebSad # define DT_CLICK_VOLUME_MAX 0x7 /* followed by one byte */ 1609aa9b8ebSad 1619aa9b8ebSad #define DT_KMSG_BELL 0x02 /* preceded by P, sub len 2 */ 1629aa9b8ebSad /* same as above */ 1639aa9b8ebSad 1649aa9b8ebSad #define DT_KMSG_LED 0x03 /* preceded by P, sub len 2 */ 1659aa9b8ebSad /* four lower bits turn leds on */ 1669aa9b8ebSad 1679aa9b8ebSad #define DT_KMSG_POLL 0x04 /* preceded by P, sub len 1 */ 1689aa9b8ebSad 1699aa9b8ebSad /* Keyboard sends up to 11 codes in a data message, distinguished values: */ 1709aa9b8ebSad #define DT_KBD_EMPTY 0x00 1719aa9b8ebSad #define DT_KBD_OUT_ERR 0x01 1729aa9b8ebSad #define DT_KBD_IN_ERR 0x02 1739aa9b8ebSad 1749aa9b8ebSad #define DT_KBD_KEY_MIN 0x08 1759aa9b8ebSad #define DT_KBD_KEY_MAX 0xff 1769aa9b8ebSad 1779aa9b8ebSad /* Powerup status values */ 1789aa9b8ebSad #define DT_KBD_OK 0x00 1799aa9b8ebSad #define DT_KBD_ROM_FAIL 0x01 1809aa9b8ebSad #define DT_KBD_RAM_FAIL 0x02 1819aa9b8ebSad #define DT_KBD_KEY_DOWN 0x03 1829aa9b8ebSad 1839aa9b8ebSad /* 1849aa9b8ebSad * Device specific definitions: Locators (mouse) 1859aa9b8ebSad */ 1869aa9b8ebSad 1879aa9b8ebSad struct dt_locator_msg { 1889aa9b8ebSad uint16_t buttons; /* 1->pressed */ 1899aa9b8ebSad int16_t x; 1909aa9b8ebSad int16_t y; 1919aa9b8ebSad int16_t z; 1929aa9b8ebSad /* possibly 3 more dimensions for gloves */ 1939aa9b8ebSad }; 1949aa9b8ebSad 1959aa9b8ebSad #define DT_LMSG_SET_RATE 0x01 /* preceded by P,sub, len 2 */ 1969aa9b8ebSad /* followed by sampling interval, 1979aa9b8ebSad from 8 to 25 msecs (0->polled */ 1989aa9b8ebSad #define DT_LMSG_POLL 0x02 /* preceded by P,sub, len 1 */ 1999aa9b8ebSad 2009aa9b8ebSad /* Powerup status values: 0 ok, else.. */ 2019aa9b8ebSad #define DT_MOUSE_ROM_FAIL 0x01 2029aa9b8ebSad #define DT_MOUSE_RAM_FAIL 0x02 2039aa9b8ebSad #define DT_MOUSE_KEY_DOWN 0x03 2049aa9b8ebSad 2059aa9b8ebSad #endif /* !_DTREG_H_ */ 206