xref: /haiku/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h (revision a4ef4a49150f118d47324242917a596a3f8f8bd5)
1 /*
2  * Copyright 2001-2008 Haiku, Inc.
3  * Distributed under the terms of the MIT License.
4  *
5  * PS/2 mouse device driver
6  *
7  * Authors (in chronological order):
8  * 		Elad Lahav (elad@eldarshany.com)
9  *		Stefano Ceccherini (burton666@libero.it)
10  *		Axel Dörfler, axeld@pinc-software.de
11  *      Marcus Overhagen <marcus@overhagen.de>
12  *		Clemens Zeidler	<czeidler@gmx.de>
13  */
14 
15 #ifndef __PS2_STANDARD_MOUSE_H
16 #define __PS2_STANDARD_MOUSE_H
17 
18 #include <Drivers.h>
19 
20 #include "packet_buffer.h"
21 
22 #define MOUSE_HISTORY_SIZE				256
23 	// we record that many mouse packets before we start to drop them
24 
25 #define F_MOUSE_TYPE_STANDARD			0x1
26 #define F_MOUSE_TYPE_INTELLIMOUSE		0x2
27 
28 typedef struct
29 {
30 	ps2_dev *		dev;
31 
32 	sem_id			standard_mouse_sem;
33 	packet_buffer *	standard_mouse_buffer;
34 	bigtime_t		click_last_time;
35 	bigtime_t		click_speed;
36 	int				click_count;
37 	int				buttons_state;
38 	int				flags;
39 	size_t			packet_index;
40 	uint8			packet_buffer[PS2_MAX_PACKET_SIZE];
41 
42 } standard_mouse_cookie;
43 
44 
45 status_t probe_standard_mouse(ps2_dev *dev);
46 
47 status_t standard_mouse_open(const char *name, uint32 flags, void **_cookie);
48 status_t standard_mouse_close(void *_cookie);
49 status_t standard_mouse_freecookie(void *_cookie);
50 status_t standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer,
51 	size_t length);
52 
53 int32 standard_mouse_handle_int(ps2_dev *dev);
54 void standard_mouse_disconnect(ps2_dev *dev);
55 
56 device_hooks gStandardMouseDeviceHooks;
57 
58 
59 #endif /* __PS2_STANDARD_MOUSE_H */
60 
61