1/*
2 * Copyright 2001-2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors (in chronological order):
6 *		Elad Lahav, elad@eldarshany.com
7 *		Stefano Ceccherini, burton666@libero.it
8 *		Axel D��rfler, axeld@pinc-software.de
9 *		Marcus Overhagen, marcus@overhagen.de
10 *		Clemens Zeidler, czeidler@gmx.de
11 *		John Scipione, jscipione@gmail.com
12 */
13#ifndef __PS2_STANDARD_MOUSE_H
14#define __PS2_STANDARD_MOUSE_H
15
16
17#include <Drivers.h>
18
19#include "packet_buffer.h"
20
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
28typedef struct {
29	ps2_dev*				dev;
30
31	sem_id					standard_mouse_sem;
32	struct packet_buffer*	standard_mouse_buffer;
33	bigtime_t				click_last_time;
34	bigtime_t				click_speed;
35	int						click_count;
36	int						buttons_state;
37	int						flags;
38	size_t					packet_index;
39	uint8					buffer[PS2_MAX_PACKET_SIZE];
40} standard_mouse_cookie;
41
42
43status_t probe_standard_mouse(ps2_dev* dev);
44
45status_t standard_mouse_open(const char* name, uint32 flags, void** _cookie);
46status_t standard_mouse_close(void* _cookie);
47status_t standard_mouse_freecookie(void* _cookie);
48status_t standard_mouse_ioctl(void* _cookie, uint32 op, void* buffer,
49	size_t length);
50
51int32 standard_mouse_handle_int(ps2_dev* dev);
52void standard_mouse_disconnect(ps2_dev* dev);
53
54extern device_hooks gStandardMouseDeviceHooks;
55
56
57#endif	/* __PS2_STANDARD_MOUSE_H */
58