summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/mouse/mouse_parser.h
blob: b675d7010aa2bb4e8608ca1819b30df8a4d6dcb5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/**
 * @file rtems/mouse_parser.h
 *
 * This file is the header file for the Mouse Parser Engine.
 */

/*
 * This file is derived from a UNIX Serial Port Mouse Driver with the
 * following notice:
 *
 * ==================================================================
 * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
 * Portions Copyright (c) 1991 David I. Bell
 * Permission is granted to use, distribute, or modify this source,
 * provided that this copyright notice remains intact.
 *
 * UNIX Serial Port Mouse Driver
 *
 * This driver opens a serial port directly, and interprets serial data.
 * Microsoft, PC, Logitech and PS/2 mice are supported.  The PS/2 mouse
 * is only supported if the OS runs the mouse byte codes through the
 * serial port.
 *
 * Mouse Types Supported: pc  ms, logi, ps2
 * ==================================================================
 *
 * It has been modified to support the concept of being just a parser
 * fed data from an arbitrary source.  It is independent of either 
 * a PS/2 driver or a serial port.
 *
 * It was moved to cpukit/libmisc/mouse by Joel Sherrill.
 *
 * $Id$
 */

#ifndef __MOUSE_PARSER_h__
#define __MOUSE_PARSER_h__

#include <rtems/mw_uid.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 *  This is the mask for the right button.
 *
 *  @note Use the same definitions as the user interface.
 */
#define RBUTTON      MV_BUTTON_RIGHT

/**
 * This is the mask for the center button.
 *
 *  @note Use the same definitions as the user interface.
 */
#define MBUTTON      MV_BUTTON_CENTER

/**
 *  This is the mask for the left button.
 *
 *  @note Use the same definitions as the user interface.
 */
#define LBUTTON      MV_BUTTON_LEFT

/**
 *  This type is the device coordinates.
 */
typedef int           COORD;

/**
 *  This type is the mouse button mask.
 */
typedef unsigned int  BUTTON;

/**
 *  This type defines a pointer to the enqueue method.  It is
 *  available since some device drivers keep pointers to the method
 *  to know when to enqueue or not.
 */
typedef void (*mouse_parser_enqueue_handler)(unsigned char *, size_t);

/**
 *  @brief Initialize the Mouse Parser Engine
 *
 *  This method initializes the Mouse Parser Engine for the mouse
 *  of @a type. The @a type should be one of the following strings:
 *  pc  ms, logi, ps2.
 *
 *  @a param[in] type indicates the type of mouse.
 *
 *  @return This method returns 0 on success and -1 on error.
 */
int mouse_parser_initialize(const char *type);

/**
 *  @brief Enqueue Input to the Mouse Parser Engine
 *
 *  This method is used to pass mouse input to the Mouse Parser Engine.
 *
 *  @a param[in] buffer is the data to enqueue
 *  @a param[in] size is the amount of data to enqueue
 */
void mouse_parser_enqueue(
  unsigned char *buffer,
  size_t         size
);

#ifdef __cplusplus
}
#endif

#endif