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