RTEMS 6.1-rc6
Loading...
Searching...
No Matches
i386kbd.h
Go to the documentation of this file.
1
9/*
10 * linux/include/asm-i386/keyboard.h
11 *
12 * Created 3 Nov 1996 by Geert Uytterhoeven
13 */
14
15/*
16 * This file contains the i386 architecture specific keyboard definitions
17 */
18
19#ifndef _I386_KEYBOARD_H
20#define _I386_KEYBOARD_H
21
22#include <i386_io.h>
23
24#define KEYBOARD_IRQ 1
25#define DISABLE_KBD_DURING_INTERRUPTS 0
26
27extern int pckbd_setkeycode(unsigned int scancode, unsigned int keycode);
28extern int pckbd_getkeycode(unsigned int scancode);
29extern int pckbd_translate(unsigned char scancode, unsigned char *keycode,
30 char raw_mode);
31extern char pckbd_unexpected_up(unsigned char keycode);
32extern void pckbd_leds(unsigned char leds);
33extern void pckbd_init_hw(void);
34extern unsigned char pckbd_sysrq_xlate[128];
35
36#define kbd_setkeycode pckbd_setkeycode
37#define kbd_getkeycode pckbd_getkeycode
38#define kbd_translate pckbd_translate
39#define kbd_unexpected_up pckbd_unexpected_up
40#define kbd_leds pckbd_leds
41#define kbd_init_hw pckbd_init_hw
42#define kbd_sysrq_xlate pckbd_sysrq_xlate
43
44#define SYSRQ_KEY 0x54
45
46/* resource allocation */
47#define kbd_request_region() /* request_region(0x60, 16, "keyboard") */
48#define kbd_request_irq(handler) /* request_irq(KEYBOARD_IRQ, handler, 0, "keyboard", NULL) */
49
50/* How to access the keyboard macros on this platform. */
51#define kbd_read_input() inb(KBD_DATA_REG)
52#define kbd_read_status() inb(KBD_STATUS_REG)
53#define kbd_write_output(val) outb(val, KBD_DATA_REG)
54#define kbd_write_command(val) outb(val, KBD_CNTL_REG)
55
56/* Some stoneage hardware needs delays after some operations. */
57#define kbd_pause() do { } while(0)
58
59/*
60 * Machine specific bits for the PS/2 driver
61 */
62
63#define AUX_IRQ 12
64
65#define aux_request_irq(hand, dev_id) /* request_irq(AUX_IRQ, hand, SA_SHIRQ, "PS/2 Mouse", dev_id) */
66
67#define aux_free_irq(dev_id) /* free_irq(AUX_IRQ, dev_id) */
68
69/*
70 * include/linux/pc_keyb.h
71 *
72 * PC Keyboard And Keyboard Controller
73 *
74 * (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
75 */
76
77/*
78 * Configuration Switches
79 */
80
81#undef KBD_REPORT_ERR /* Report keyboard errors */
82#define KBD_REPORT_UNKN /* Report unknown scan codes */
83#define KBD_REPORT_TIMEOUTS /* Report keyboard timeouts */
84#undef KBD_IS_FOCUS_9000 /* We have the brain-damaged FOCUS-9000 keyboard */
85#undef INITIALIZE_MOUSE /* Define if your PS/2 mouse needs initialization. */
86
87#define KBD_INIT_TIMEOUT 1000 /* Timeout in ms for initializing the keyboard */
88#define KBC_TIMEOUT 250 /* Timeout in ms for sending to keyboard controller */
89#define KBD_TIMEOUT 1000 /* Timeout in ms for keyboard command acknowledge */
90
91/*
92 * Internal variables of the driver
93 */
94
95extern unsigned char pckbd_read_mask;
96extern unsigned char aux_device_present;
97
98/*
99 * Keyboard Controller Registers on normal PCs.
100 */
101
102#define KBD_STATUS_REG 0x64 /* Status register (R) */
103#define KBD_CNTL_REG 0x64 /* Controller command register (W) */
104#define KBD_DATA_REG 0x60 /* Keyboard data register (R/W) */
105
106/*
107 * Keyboard Controller Commands
108 */
109
110#define KBD_CCMD_READ_MODE 0x20 /* Read mode bits */
111#define KBD_CCMD_WRITE_MODE 0x60 /* Write mode bits */
112#define KBD_CCMD_GET_VERSION 0xA1 /* Get controller version */
113#define KBD_CCMD_MOUSE_DISABLE 0xA7 /* Disable mouse interface */
114#define KBD_CCMD_MOUSE_ENABLE 0xA8 /* Enable mouse interface */
115#define KBD_CCMD_TEST_MOUSE 0xA9 /* Mouse interface test */
116#define KBD_CCMD_SELF_TEST 0xAA /* Controller self test */
117#define KBD_CCMD_KBD_TEST 0xAB /* Keyboard interface test */
118#define KBD_CCMD_KBD_DISABLE 0xAD /* Keyboard interface disable */
119#define KBD_CCMD_KBD_ENABLE 0xAE /* Keyboard interface enable */
120#define KBD_CCMD_WRITE_AUX_OBUF 0xD3 /* Write to output buffer as if
121 initiated by the auxiliary device */
122#define KBD_CCMD_WRITE_MOUSE 0xD4 /* Write the following byte to the mouse */
123
124/*
125 * Keyboard Commands
126 */
127
128#define KBD_CMD_SET_LEDS 0xED /* Set keyboard leds */
129#define KBD_CMD_SET_RATE 0xF3 /* Set typematic rate */
130#define KBD_CMD_ENABLE 0xF4 /* Enable scanning */
131#define KBD_CMD_DISABLE 0xF5 /* Disable scanning */
132#define KBD_CMD_RESET 0xFF /* Reset */
133
134/*
135 * Keyboard Replies
136 */
137
138#define KBD_REPLY_POR 0xAA /* Power on reset */
139#define KBD_REPLY_ACK 0xFA /* Command ACK */
140#define KBD_REPLY_RESEND 0xFE /* Command NACK, send the cmd again */
141
142/*
143 * Status Register Bits
144 */
145
146#define KBD_STAT_OBF 0x01 /* Keyboard output buffer full */
147#define KBD_STAT_IBF 0x02 /* Keyboard input buffer full */
148#define KBD_STAT_SELFTEST 0x04 /* Self test successful */
149#define KBD_STAT_CMD 0x08 /* Last write was a command write (0=data) */
150#define KBD_STAT_UNLOCKED 0x10 /* Zero if keyboard locked */
151#define KBD_STAT_MOUSE_OBF 0x20 /* Mouse output buffer full */
152#define KBD_STAT_GTO 0x40 /* General receive/xmit timeout */
153#define KBD_STAT_PERR 0x80 /* Parity error */
154
155#define AUX_STAT_OBF (KBD_STAT_OBF | KBD_STAT_MOUSE_OBF)
156
157/*
158 * Controller Mode Register Bits
159 */
160
161#define KBD_MODE_KBD_INT 0x01 /* Keyboard data generate IRQ1 */
162#define KBD_MODE_MOUSE_INT 0x02 /* Mouse data generate IRQ12 */
163#define KBD_MODE_SYS 0x04 /* The system flag (?) */
164#define KBD_MODE_NO_KEYLOCK 0x08 /* The keylock doesn't affect the keyboard if set */
165#define KBD_MODE_DISABLE_KBD 0x10 /* Disable keyboard interface */
166#define KBD_MODE_DISABLE_MOUSE 0x20 /* Disable mouse interface */
167#define KBD_MODE_KCC 0x40 /* Scan code conversion to PC format */
168#define KBD_MODE_RFU 0x80
169
170/*
171 * Mouse Commands
172 */
173
174#define AUX_SET_RES 0xE8 /* Set resolution */
175#define AUX_SET_SCALE11 0xE6 /* Set 1:1 scaling */
176#define AUX_SET_SCALE21 0xE7 /* Set 2:1 scaling */
177#define AUX_GET_SCALE 0xE9 /* Get scaling factor */
178#define AUX_SET_STREAM 0xEA /* Set stream mode */
179#define AUX_SET_SAMPLE 0xF3 /* Set sample rate */
180#define AUX_ENABLE_DEV 0xF4 /* Enable aux device */
181#define AUX_DISABLE_DEV 0xF5 /* Disable aux device */
182#define AUX_RESET 0xFF /* Reset aux device */
183#define AUX_ACK 0xFA /* Command byte ACK. */
184
185#define AUX_BUF_SIZE 2048 /* This might be better divisible by
186 three to make overruns stay in sync
187 but then the read function would need
188 a lock etc - ick */
189
190#define mark_bh(x)
191
192#endif /* _I386_KEYBOARD_H */