1 #ifndef _LINUX_BUSMOUSE_H
2 #define _LINUX_BUSMOUSE_H
3
4 /*
5 * linux/include/linux/mouse.h: header file for Logitech Bus Mouse driver
6 * by James Banks
7 *
8 * based on information gleamed from various mouse drivers on the net
9 *
10 * Heavily modified by David giller (rafetmad@oxy.edu)
11 *
12 * Minor modifications for Linux 0.96c-pl1 by Nathan Laredo
13 * gt7080a@prism.gatech.edu (13JUL92)
14 *
15 * Microsoft BusMouse support by Teemu Rantanen (tvr@cs.hut.fi) (02AUG92)
16 *
17 * Microsoft Bus Mouse support modified by Derrick Cole (cole@concert.net)
18 * 8/28/92
19 *
20 * Microsoft Bus Mouse support folded into 0.97pl4 code
21 * by Peter Cervasio (pete%q106fm.uucp@wupost.wustl.edu) (08SEP92)
22 * Changes: Logitech and Microsoft support in the same kernel.
23 * Defined new constants in busmouse.h for MS mice.
24 * Added int mse_busmouse_type to distinguish busmouse types
25 * Added a couple of new functions to handle differences in using
26 * MS vs. Logitech (where the int variable wasn't appropriate).
27 *
28 */
29
30 #define MOUSE_IRQ 5
31 #define LOGITECH_BUSMOUSE 0 /* Minor device # for Logitech */
32 #define MICROSOFT_BUSMOUSE 2 /* Minor device # for Microsoft */
33
34 /*--------- LOGITECH BUSMOUSE ITEMS -------------*/
35
36 #define MSE_DATA_PORT 0x23c
37 #define MSE_SIGNATURE_PORT 0x23d
38 #define MSE_CONTROL_PORT 0x23e
39 #define MSE_INTERRUPT_PORT 0x23e
40 #define MSE_CONFIG_PORT 0x23f
41
42 #define MSE_ENABLE_INTERRUPTS 0x00
43 #define MSE_DISABLE_INTERRUPTS 0x10
44
45 #define MSE_READ_X_LOW 0x80
46 #define MSE_READ_X_HIGH 0xa0
47 #define MSE_READ_Y_LOW 0xc0
48 #define MSE_READ_Y_HIGH 0xe0
49
50 /* Magic number used to check if the mouse exists */
51 #define MSE_CONFIG_BYTE 0x91
52 #define MSE_DEFAULT_MODE 0x90
53 #define MSE_SIGNATURE_BYTE 0xa5
54
55 /* useful Logitech Mouse macros */
56
57 #define MSE_INT_OFF() outb(MSE_DISABLE_INTERRUPTS, MSE_CONTROL_PORT)
58 #define MSE_INT_ON() outb(MSE_ENABLE_INTERRUPTS, MSE_CONTROL_PORT)
59
60 /*--------- MICROSOFT BUSMOUSE ITEMS -------------*/
61
62 #define MS_MSE_DATA_PORT 0x23d
63 #define MS_MSE_SIGNATURE_PORT 0x23e
64 #define MS_MSE_CONTROL_PORT 0x23c
65 #define MS_MSE_CONFIG_PORT 0x23f
66
67 #define MS_MSE_ENABLE_INTERRUPTS 0x11
68 #define MS_MSE_DISABLE_INTERRUPTS 0x10
69
70 #define MS_MSE_READ_BUTTONS 0x00
71 #define MS_MSE_READ_X 0x01
72 #define MS_MSE_READ_Y 0x02
73
74 #define MS_MSE_START 0x80
75 #define MS_MSE_COMMAND_MODE 0x07
76
77 /* useful microsoft busmouse macros */
78
79 #define MS_MSE_INT_OFF() {outb(MS_MSE_COMMAND_MODE, MS_MSE_CONTROL_PORT); \
80 outb(MS_MSE_DISABLE_INTERRUPTS, MS_MSE_DATA_PORT);}
81 #define MS_MSE_INT_ON() {outb(MS_MSE_COMMAND_MODE, MS_MSE_CONTROL_PORT); \
82 outb(MS_MSE_ENABLE_INTERRUPTS, MS_MSE_DATA_PORT);}
83
84
85 struct mouse_status {
86 char buttons;
87 char latch_buttons;
88 int dx;
89 int dy;
90 int present;
91 int ready;
92 int active;
93 struct wait_queue *wait;
94 };
95
96 /* Function Prototypes */
97 extern long mouse_init(long);
98
99 #endif
100