Rev 494 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
494 | giacomo | 1 | #ifndef _I8042_H |
2 | #define _I8042_H |
||
3 | |||
4 | /* |
||
5 | * Copyright (c) 1999-2002 Vojtech Pavlik |
||
6 | * |
||
7 | * This program is free software; you can redistribute it and/or modify it |
||
8 | * under the terms of the GNU General Public License version 2 as published by |
||
9 | * the Free Software Foundation. |
||
10 | */ |
||
11 | |||
12 | /* |
||
13 | * Arch-dependent inline functions and defines. |
||
14 | */ |
||
15 | |||
16 | #if defined(CONFIG_PPC) |
||
17 | #include "i8042-ppcio.h" |
||
18 | #elif defined(CONFIG_SPARC32) || defined(CONFIG_SPARC64) |
||
19 | #include "i8042-sparcio.h" |
||
20 | #else |
||
21 | #include "i8042-io.h" |
||
22 | #endif |
||
23 | |||
24 | /* |
||
25 | * This is in 50us units, the time we wait for the i8042 to react. This |
||
26 | * has to be long enough for the i8042 itself to timeout on sending a byte |
||
27 | * to a non-existent mouse. |
||
28 | */ |
||
29 | |||
30 | #define I8042_CTL_TIMEOUT 10000 |
||
31 | |||
32 | /* |
||
33 | * When the device isn't opened and it's interrupts aren't used, we poll it at |
||
34 | * regular intervals to see if any characters arrived. If yes, we can start |
||
35 | * probing for any mouse / keyboard connected. This is the period of the |
||
36 | * polling. |
||
37 | */ |
||
38 | |||
39 | #define I8042_POLL_PERIOD HZ/20 |
||
40 | |||
41 | /* |
||
42 | * Status register bits. |
||
43 | */ |
||
44 | |||
45 | #define I8042_STR_PARITY 0x80 |
||
46 | #define I8042_STR_TIMEOUT 0x40 |
||
47 | #define I8042_STR_AUXDATA 0x20 |
||
48 | #define I8042_STR_KEYLOCK 0x10 |
||
49 | #define I8042_STR_CMDDAT 0x08 |
||
50 | #define I8042_STR_MUXERR 0x04 |
||
51 | #define I8042_STR_IBF 0x02 |
||
52 | #define I8042_STR_OBF 0x01 |
||
53 | |||
54 | /* |
||
55 | * Control register bits. |
||
56 | */ |
||
57 | |||
58 | #define I8042_CTR_KBDINT 0x01 |
||
59 | #define I8042_CTR_AUXINT 0x02 |
||
60 | #define I8042_CTR_IGNKEYLOCK 0x08 |
||
61 | #define I8042_CTR_KBDDIS 0x10 |
||
62 | #define I8042_CTR_AUXDIS 0x20 |
||
63 | #define I8042_CTR_XLATE 0x40 |
||
64 | |||
65 | /* |
||
66 | * Commands. |
||
67 | */ |
||
68 | |||
69 | #define I8042_CMD_CTL_RCTR 0x0120 |
||
70 | #define I8042_CMD_CTL_WCTR 0x1060 |
||
71 | #define I8042_CMD_CTL_TEST 0x01aa |
||
72 | |||
73 | #define I8042_CMD_KBD_DISABLE 0x00ad |
||
74 | #define I8042_CMD_KBD_ENABLE 0x00ae |
||
75 | #define I8042_CMD_KBD_TEST 0x01ab |
||
76 | #define I8042_CMD_KBD_LOOP 0x11d2 |
||
77 | |||
78 | #define I8042_CMD_AUX_DISABLE 0x00a7 |
||
79 | #define I8042_CMD_AUX_ENABLE 0x00a8 |
||
80 | #define I8042_CMD_AUX_TEST 0x01a9 |
||
81 | #define I8042_CMD_AUX_SEND 0x10d4 |
||
82 | #define I8042_CMD_AUX_LOOP 0x11d3 |
||
83 | |||
84 | #define I8042_CMD_MUX_PFX 0x0090 |
||
85 | #define I8042_CMD_MUX_SEND 0x1090 |
||
86 | |||
87 | /* |
||
88 | * Return codes. |
||
89 | */ |
||
90 | |||
91 | #define I8042_RET_CTL_TEST 0x55 |
||
92 | |||
93 | /* |
||
94 | * Expected maximum internal i8042 buffer size. This is used for flushing |
||
95 | * the i8042 buffers. 32 should be more than enough. |
||
96 | */ |
||
97 | |||
98 | #define I8042_BUFFER_SIZE 32 |
||
99 | |||
100 | /* |
||
101 | * Debug. |
||
102 | */ |
||
103 | |||
104 | #ifdef DEBUG |
||
105 | static unsigned long i8042_start; |
||
106 | #define dbg_init() do { i8042_start = jiffies26; } while (0) |
||
107 | #define dbg(format, arg...) printk(KERN_DEBUG __FILE__ ": " format " [%d]\n" ,\ |
||
108 | ## arg, (int) (jiffies26 - i8042_start)) |
||
109 | #else |
||
110 | #define dbg_init() do { } while (0) |
||
111 | #define dbg(format, arg...) do {} while (0) |
||
112 | #endif |
||
113 | |||
114 | #endif /* _I8042_H */ |