1 #ifndef _LINUX_BUSMOUSE_H
2 #define _LINUX_BUSMOUSE_H
3 
4 /*
5  * linux/include/linux/busmouse.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	LOGIBM_BASE		0x23c
37 #define	MSE_DATA_PORT		0x23c
38 #define	MSE_SIGNATURE_PORT	0x23d
39 #define	MSE_CONTROL_PORT	0x23e
40 #define	MSE_INTERRUPT_PORT	0x23e
41 #define	MSE_CONFIG_PORT		0x23f
42 #define	LOGIBM_EXTENT		0x4
43 
44 #define	MSE_ENABLE_INTERRUPTS	0x00
45 #define	MSE_DISABLE_INTERRUPTS	0x10
46 
47 #define	MSE_READ_X_LOW		0x80
48 #define	MSE_READ_X_HIGH		0xa0
49 #define	MSE_READ_Y_LOW		0xc0
50 #define	MSE_READ_Y_HIGH		0xe0
51 
52 /* Magic number used to check if the mouse exists */
53 #define MSE_CONFIG_BYTE		0x91
54 #define MSE_DEFAULT_MODE	0x90
55 #define MSE_SIGNATURE_BYTE	0xa5
56 
57 /* useful Logitech Mouse macros */
58 
59 #define MSE_INT_OFF()	outb(MSE_DISABLE_INTERRUPTS, MSE_CONTROL_PORT)
60 #define MSE_INT_ON()	outb(MSE_ENABLE_INTERRUPTS, MSE_CONTROL_PORT)
61 
62 /*--------- MICROSOFT BUSMOUSE ITEMS -------------*/
63 
64 #define	MSBM_BASE			0x23d
65 #define	MS_MSE_DATA_PORT	        0x23d
66 #define	MS_MSE_SIGNATURE_PORT	        0x23e
67 #define	MS_MSE_CONTROL_PORT	        0x23c
68 #define	MS_MSE_CONFIG_PORT		0x23f
69 #define	MSBM_EXTENT			0x3
70 
71 #define	MS_MSE_ENABLE_INTERRUPTS	0x11
72 #define	MS_MSE_DISABLE_INTERRUPTS	0x10
73 
74 #define	MS_MSE_READ_BUTTONS             0x00
75 #define	MS_MSE_READ_X		        0x01
76 #define	MS_MSE_READ_Y                   0x02
77 
78 #define MS_MSE_START                    0x80
79 #define MS_MSE_COMMAND_MODE             0x07
80 
81 /* useful microsoft busmouse macros */
82 
83 #define MS_MSE_INT_OFF() {outb(MS_MSE_COMMAND_MODE, MS_MSE_CONTROL_PORT); \
84 			    outb(MS_MSE_DISABLE_INTERRUPTS, MS_MSE_DATA_PORT);}
85 #define MS_MSE_INT_ON()  {outb(MS_MSE_COMMAND_MODE, MS_MSE_CONTROL_PORT); \
86 			    outb(MS_MSE_ENABLE_INTERRUPTS, MS_MSE_DATA_PORT);}
87 
88 
89 struct mouse_status {
90 	unsigned char	buttons;
91 	unsigned char	latch_buttons;
92 	int		dx;
93 	int		dy;
94 	int 		present;
95 	int		ready;
96 	int		active;
97 	wait_queue_head_t wait;
98 	struct fasync_struct *fasyncptr;
99 };
100 
101 /* Function Prototypes */
102 
103 #endif
104 
105