source: rtems/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.h @ 1c0b8d7

4.115
Last change on this file since 1c0b8d7 was f05b2ac, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/21/04 at 16:01:48

Remove duplicate white lines.

  • Property mode set to 100644
File size: 4.7 KB
Line 
1/*
2 *      include/linux/pc_keyb.h
3 *      PC Keyboard And Keyboard Controller
4 *      (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
5 *
6 * RTEMS port: by Rosimildo da Silva.
7 *
8 * This module was ported from Linux.
9 *
10 */
11
12/*
13 *      Configuration Switches
14 */
15
16#undef KBD_REPORT_ERR                   /* Report keyboard errors */
17#define KBD_REPORT_UNKN                 /* Report unknown scan codes */
18#define KBD_REPORT_TIMEOUTS             /* Report keyboard timeouts */
19#undef KBD_IS_FOCUS_9000                /* We have the brain-damaged FOCUS-9000 keyboard */
20#undef INITIALIZE_MOUSE                 /* Define if your PS/2 mouse needs initialization. */
21
22#define KBD_INIT_TIMEOUT 1000           /* Timeout in ms for initializing the keyboard */
23#define KBC_TIMEOUT 250                 /* Timeout in ms for sending to keyboard controller */
24#define KBD_TIMEOUT 1000                /* Timeout in ms for keyboard command acknowledge */
25
26/*
27 *      Internal variables of the driver
28 */
29
30extern unsigned char pckbd_read_mask;
31extern unsigned char aux_device_present;
32
33/*
34 *      Keyboard Controller Registers on normal PCs.
35 */
36
37#define KBD_STATUS_REG          0x64    /* Status register (R) */
38#define KBD_CNTL_REG            0x64    /* Controller command register (W) */
39#define KBD_DATA_REG            0x60    /* Keyboard data register (R/W) */
40
41/*
42 *      Keyboard Controller Commands
43 */
44
45#define KBD_CCMD_READ_MODE      0x20    /* Read mode bits */
46#define KBD_CCMD_WRITE_MODE     0x60    /* Write mode bits */
47#define KBD_CCMD_GET_VERSION    0xA1    /* Get controller version */
48#define KBD_CCMD_MOUSE_DISABLE  0xA7    /* Disable mouse interface */
49#define KBD_CCMD_MOUSE_ENABLE   0xA8    /* Enable mouse interface */
50#define KBD_CCMD_TEST_MOUSE     0xA9    /* Mouse interface test */
51#define KBD_CCMD_SELF_TEST      0xAA    /* Controller self test */
52#define KBD_CCMD_KBD_TEST       0xAB    /* Keyboard interface test */
53#define KBD_CCMD_KBD_DISABLE    0xAD    /* Keyboard interface disable */
54#define KBD_CCMD_KBD_ENABLE     0xAE    /* Keyboard interface enable */
55#define KBD_CCMD_WRITE_AUX_OBUF 0xD3    /* Write to output buffer as if
56                                           initiated by the auxiliary device */
57#define KBD_CCMD_WRITE_MOUSE    0xD4    /* Write the following byte to the mouse */
58
59/*
60 *      Keyboard Commands
61 */
62
63#define KBD_CMD_SET_LEDS        0xED    /* Set keyboard leds */
64#define KBD_CMD_SET_RATE        0xF3    /* Set typematic rate */
65#define KBD_CMD_ENABLE          0xF4    /* Enable scanning */
66#define KBD_CMD_DISABLE         0xF5    /* Disable scanning */
67#define KBD_CMD_RESET           0xFF    /* Reset */
68
69/*
70 *      Keyboard Replies
71 */
72
73#define KBD_REPLY_POR           0xAA    /* Power on reset */
74#define KBD_REPLY_ACK           0xFA    /* Command ACK */
75#define KBD_REPLY_RESEND        0xFE    /* Command NACK, send the cmd again */
76
77/*
78 *      Status Register Bits
79 */
80
81#define KBD_STAT_OBF            0x01    /* Keyboard output buffer full */
82#define KBD_STAT_IBF            0x02    /* Keyboard input buffer full */
83#define KBD_STAT_SELFTEST       0x04    /* Self test successful */
84#define KBD_STAT_CMD            0x08    /* Last write was a command write (0=data) */
85#define KBD_STAT_UNLOCKED       0x10    /* Zero if keyboard locked */
86#define KBD_STAT_MOUSE_OBF      0x20    /* Mouse output buffer full */
87#define KBD_STAT_GTO            0x40    /* General receive/xmit timeout */
88#define KBD_STAT_PERR           0x80    /* Parity error */
89
90#define AUX_STAT_OBF (KBD_STAT_OBF | KBD_STAT_MOUSE_OBF)
91
92/*
93 *      Controller Mode Register Bits
94 */
95
96#define KBD_MODE_KBD_INT        0x01    /* Keyboard data generate IRQ1 */
97#define KBD_MODE_MOUSE_INT      0x02    /* Mouse data generate IRQ12 */
98#define KBD_MODE_SYS            0x04    /* The system flag (?) */
99#define KBD_MODE_NO_KEYLOCK     0x08    /* The keylock doesn't affect the keyboard if set */
100#define KBD_MODE_DISABLE_KBD    0x10    /* Disable keyboard interface */
101#define KBD_MODE_DISABLE_MOUSE  0x20    /* Disable mouse interface */
102#define KBD_MODE_KCC            0x40    /* Scan code conversion to PC format */
103#define KBD_MODE_RFU            0x80
104
105/*
106 *      Mouse Commands
107 */
108
109#define AUX_SET_RES             0xE8    /* Set resolution */
110#define AUX_SET_SCALE11         0xE6    /* Set 1:1 scaling */
111#define AUX_SET_SCALE21         0xE7    /* Set 2:1 scaling */
112#define AUX_GET_SCALE           0xE9    /* Get scaling factor */
113#define AUX_SET_STREAM          0xEA    /* Set stream mode */
114#define AUX_SET_SAMPLE          0xF3    /* Set sample rate */
115#define AUX_ENABLE_DEV          0xF4    /* Enable aux device */
116#define AUX_DISABLE_DEV         0xF5    /* Disable aux device */
117#define AUX_RESET               0xFF    /* Reset aux device */
118#define AUX_ACK                 0xFA    /* Command byte ACK. */
119
120#define AUX_BUF_SIZE            512     /* This might be better divisible by
121                                           three to make overruns stay in sync
122                                           but then the read function would need
123                                           a lock etc - ick */
124
125struct aux_queue {
126        unsigned long head;
127        unsigned long tail;
128        struct wait_queue *proc_list;
129        struct fasync_struct *fasync;
130        unsigned char buf[AUX_BUF_SIZE];
131};
132
133/* How to access the keyboard macros on this platform.  */
134#define kbd_read_input() inb(KBD_DATA_REG)
135#define kbd_read_status() inb(KBD_STATUS_REG)
136#define kbd_write_output(val) outb(val, KBD_DATA_REG)
137#define kbd_write_command(val) outb(val, KBD_CNTL_REG)
138
139/*
140 * Machine specific bits for the PS/2 driver
141 */
142
143#define AUX_IRQ 12
Note: See TracBrowser for help on using the repository browser.