1/* $Id: pcikbd.h,v 1.1.1.1 2008/10/15 03:26:47 james26_jang Exp $
2 * pcikbd.h: PCI/PC 8042 keyboard/mouse driver stuff.  Mostly snarfed
3 *           from the existing driver by Martin Mares.
4 *
5 * Copyright (C) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
6 *
7 * Ultra/AX specific hacks are:
8 *
9 * Copyright (C) 1997 David S. Miller (davem@caip.rutgers.edu)
10 */
11
12#ifndef __PCIKBD_H
13#define __PCIKBD_H
14
15/*
16 *	Configuration Switches
17 */
18
19#define KBD_REPORT_ERR			/* Report keyboard errors */
20#define KBD_REPORT_UNKN			/* Report unknown scan codes */
21#define KBD_REPORT_TIMEOUTS		/* Report keyboard timeouts */
22
23#define KBD_INIT_TIMEOUT HZ		/* Timeout for initializing the keyboard */
24#define KBC_TIMEOUT (HZ/4)		/* Timeout for sending to keyboard controller */
25#define KBD_TIMEOUT (HZ/4)		/* Timeout for keyboard command acknowledge */
26
27/*
28 *	Internal variables of the driver
29 */
30
31extern unsigned char pckbd_read_mask;
32extern unsigned char aux_device_present;
33
34extern unsigned long pcikbd_iobase;
35extern unsigned int pcikbd_irq;
36
37/*
38 *	Keyboard Controller Registers
39 *
40 * NOTE: These are offsets from pcikbd_iobase, not absolute.
41 */
42
43#define KBD_STATUS_REG		0x04
44#define KBD_CNTL_REG		KBD_STATUS_REG
45#define KBD_DATA_REG		0x00
46
47/*
48 *	Keyboard Controller Commands
49 */
50
51#define KBD_CCMD_READ_MODE	0x20	/* Read mode bits */
52#define KBD_CCMD_WRITE_MODE	0x60	/* Write mode bits */
53#define KBD_CCMD_GET_VERSION	0xA1	/* Get controller version */
54#define KBD_CCMD_MOUSE_DISABLE	0xA7	/* Disable mouse interface */
55#define KBD_CCMD_MOUSE_ENABLE	0xA8	/* Enable mouse interface */
56#define KBD_CCMD_TEST_MOUSE	0xA9	/* Mouse interface test */
57#define KBD_CCMD_SELF_TEST	0xAA	/* Controller self test */
58#define KBD_CCMD_KBD_TEST	0xAB	/* Keyboard interface test */
59#define KBD_CCMD_KBD_DISABLE	0xAD	/* Keyboard interface disable */
60#define KBD_CCMD_KBD_ENABLE	0xAE	/* Keyboard interface enable */
61#define KBD_CCMD_WRITE_MOUSE	0xD4	/* Write the following byte to the mouse */
62
63/*
64 *	Keyboard Commands
65 */
66
67#define KBD_CMD_SET_LEDS	0xED	/* Set keyboard leds */
68#define KBD_CMD_SET_RATE	0xF3	/* Set typematic rate */
69#define KBD_CMD_ENABLE		0xF4	/* Enable scanning */
70#define KBD_CMD_DISABLE		0xF5	/* Disable scanning */
71#define KBD_CMD_RESET		0xFF	/* Reset */
72
73/*
74 *	Keyboard Replies
75 */
76
77#define KBD_REPLY_POR		0xAA	/* Power on reset */
78#define KBD_REPLY_ACK		0xFA	/* Command ACK */
79#define KBD_REPLY_RESEND	0xFE	/* Command NACK, send the cmd again */
80
81/*
82 *	Status Register Bits
83 */
84
85#define KBD_STAT_OBF 		0x01	/* Keyboard output buffer full */
86#define KBD_STAT_IBF 		0x02	/* Keyboard input buffer full */
87#define KBD_STAT_SELFTEST	0x04	/* Self test successful */
88#define KBD_STAT_CMD		0x08	/* Last write was a command write (0=data) */
89#define KBD_STAT_UNLOCKED	0x10	/* Zero if keyboard locked */
90#define KBD_STAT_MOUSE_OBF	0x20	/* Mouse output buffer full */
91#define KBD_STAT_GTO 		0x40	/* General receive/xmit timeout */
92#define KBD_STAT_PERR 		0x80	/* Parity error */
93
94#define AUX_STAT_OBF (KBD_STAT_OBF | KBD_STAT_MOUSE_OBF)
95
96/*
97 *	Controller Mode Register Bits
98 */
99
100#define KBD_MODE_KBD_INT	0x01	/* Keyboard data generage IRQ1 */
101#define KBD_MODE_MOUSE_INT	0x02	/* Mouse data generate IRQ12 */
102#define KBD_MODE_SYS 		0x04	/* The system flag (?) */
103#define KBD_MODE_NO_KEYLOCK	0x08	/* The keylock doesn't affect the keyboard if set */
104#define KBD_MODE_DISABLE_KBD	0x10	/* Disable keyboard interface */
105#define KBD_MODE_DISABLE_MOUSE	0x20	/* Disable mouse interface */
106#define KBD_MODE_KCC 		0x40	/* Scan code conversion to PC format */
107#define KBD_MODE_RFU		0x80
108
109/*
110 *	Mouse Commands
111 */
112
113#define AUX_SET_RES		0xE8	/* Set resolution */
114#define AUX_SET_SCALE11		0xE6	/* Set 1:1 scaling */
115#define AUX_SET_SCALE21		0xE7	/* Set 2:1 scaling */
116#define AUX_GET_SCALE		0xE9	/* Get scaling factor */
117#define AUX_SET_STREAM		0xEA	/* Set stream mode */
118#define AUX_SET_SAMPLE		0xF3	/* Set sample rate */
119#define AUX_ENABLE_DEV		0xF4	/* Enable aux device */
120#define AUX_DISABLE_DEV		0xF5	/* Disable aux device */
121#define AUX_RESET		0xFF	/* Reset aux device */
122
123#endif /* __PCIKBD_H */
124