1 /* 2 * Copyright 2004-2005 Haiku, Inc. 3 * Distributed under the terms of the MIT License. 4 * 5 * PS/2 interface definitions 6 * 7 * Authors (in chronological order): 8 * Elad Lahav (elad@eldarshany.com) 9 * Stefano Ceccherini (burton666@libero.it) 10 * Axel Dörfler, axeld@pinc-software.de 11 */ 12 #ifndef _PS2_DEFS_H 13 #define _PS2_DEFS_H 14 15 16 /** Interface definitions for the Intel 8042, 8741, or 8742 (PS/2) */ 17 18 // I/O addresses 19 #define PS2_PORT_DATA 0x60 20 #define PS2_PORT_CTRL 0x64 21 22 // data port bits 23 #define PS2_STATUS_OUTPUT_BUFFER_FULL 0x01 24 #define PS2_STATUS_INPUT_BUFFER_FULL 0x02 25 #define PS2_STATUS_AUX_DATA 0x20 26 #define PS2_STATUS_TIMEOUT 0x40 27 28 // control words 29 #define PS2_CTRL_READ_CMD 0x20 30 #define PS2_CTRL_WRITE_CMD 0x60 31 #define PS2_CTRL_AUX_LOOPBACK 0xd3 32 #define PS2_CTRL_WRITE_AUX 0xd4 33 #define PS2_CTRL_MOUSE_DISABLE 0xa7 34 #define PS2_CTRL_MOUSE_ENABLE 0xa8 35 #define PS2_CTRL_MOUSE_TEST 0xa9 36 #define PS2_CTRL_SELF_TEST 0xaa 37 #define PS2_CTRL_KEYBOARD_TEST 0xab 38 #define PS2_CTRL_KEYBOARD_DISABLE 0xad 39 #define PS2_CTRL_KEYBOARD_ENABLE 0xae 40 41 // command bytes 42 #define PS2_CMD_DEV_INIT 0x43 43 44 // command bits 45 #define PS2_BITS_KEYBOARD_INTERRUPT 0x01 46 #define PS2_BITS_AUX_INTERRUPT 0x02 47 #define PS2_BITS_KEYBOARD_DISABLED 0x10 48 #define PS2_BITS_MOUSE_DISABLED 0x20 49 #define PS2_BITS_TRANSLATE_SCANCODES 0x40 50 51 // data words 52 #define PS2_CMD_MOUSE_SET_SCALE11 0xe6 53 #define PS2_CMD_MOUSE_SET_SCALE21 0xe7 54 #define PS2_CMD_MOUSE_SET_RES 0xe8 55 #define PS2_CMD_MOUSE_GET_INFO 0xe9 56 #define PS2_CMD_MOUSE_SET_STREAM 0xea 57 #define PS2_CMD_KEYBOARD_SET_LEDS 0xed 58 #define PS2_CMD_MOUSE_SET_POLL 0xf0 59 #define PS2_CMD_SET_TYPEMATIC 0xf3 60 #define PS2_CMD_ECHO 0xee 61 #define PS2_CMD_TEST_PASSED 0xaa 62 #define PS2_CMD_GET_DEVICE_ID 0xf2 63 #define PS2_CMD_SET_SAMPLE_RATE 0xf3 64 #define PS2_CMD_ENABLE 0xf4 65 #define PS2_CMD_DISABLE 0xf5 66 #define PS2_CMD_MOUSE_RESET_DIS 0xf6 67 #define PS2_CMD_RESET 0xff 68 #define PS2_CMD_RESEND 0xfe 69 70 // reply codes 71 #define PS2_REPLY_TEST_PASSED 0x55 72 #define PS2_REPLY_ACK 0xfa 73 #define PS2_REPLY_RESEND 0xfe 74 #define PS2_REPLY_ERROR 0xfc 75 76 // interrupts 77 #define INT_PS2_MOUSE 0x0c 78 #define INT_PS2_KEYBOARD 0x01 79 80 // mouse device IDs 81 #define PS2_DEV_ID_STANDARD 0 82 #define PS2_DEV_ID_INTELLIMOUSE 3 83 #define PS2_DEV_ID_TOUCHPAD_RICATECH 4 84 85 // packet sizes 86 #define PS2_PACKET_STANDARD 3 87 #define PS2_PACKET_INTELLIMOUSE 4 88 #define PS2_PACKET_SYNAPTICS 6 89 #define PS2_PACKET_ALPS 6 90 #define PS2_PACKET_ELANTECH 6 // version 1 is only 4 91 #define PS2_MAX_PACKET_SIZE 6 92 // Should be equal to the biggest packet size 93 94 // timeouts 95 #define PS2_CTRL_WAIT_TIMEOUT 500000 96 97 #endif /* _PS2_H */ 98