xref: /haiku/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h (revision 99d027cd0238c1d86da86d7c3f4200509ccc61a6)
1 /*
2  * Copyright 2001-2010 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 #ifndef __PS2_STANDARD_MOUSE_H
15 #define __PS2_STANDARD_MOUSE_H
16 
17 
18 #include <Drivers.h>
19 
20 #include "packet_buffer.h"
21 
22 
23 #define MOUSE_HISTORY_SIZE				256
24 	// we record that many mouse packets before we start to drop them
25 
26 #define F_MOUSE_TYPE_STANDARD			0x1
27 #define F_MOUSE_TYPE_INTELLIMOUSE		0x2
28 
29 typedef struct {
30 	ps2_dev*			dev;
31 
32 	sem_id				standard_mouse_sem;
33 struct 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				buffer[PS2_MAX_PACKET_SIZE];
41 } standard_mouse_cookie;
42 
43 
44 status_t probe_standard_mouse(ps2_dev* dev);
45 
46 status_t standard_mouse_open(const char* name, uint32 flags, void** _cookie);
47 status_t standard_mouse_close(void* _cookie);
48 status_t standard_mouse_freecookie(void* _cookie);
49 status_t standard_mouse_ioctl(void* _cookie, uint32 op, void* buffer,
50 	size_t length);
51 
52 int32 standard_mouse_handle_int(ps2_dev* dev);
53 void standard_mouse_disconnect(ps2_dev* dev);
54 
55 extern device_hooks gStandardMouseDeviceHooks;
56 
57 
58 #endif	/* __PS2_STANDARD_MOUSE_H */
59