grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / hidds / serialmouse / mouse.h
blob120fa908d39105df8d8deaa47f370c8b0c686fc1
1 #ifndef _MOUSE_H
2 #define _MOUSE_H
4 /*
5 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
6 $Id$
8 Desc: Include for the mouse native HIDD.
9 Lang: English.
12 #include <dos/bptr.h>
13 #include <exec/libraries.h>
14 #include <oop/oop.h>
15 #include <exec/semaphores.h>
16 #include <hidd/mouse.h>
18 /* defines for buttonstate */
20 #define LEFT_BUTTON 1
21 #define RIGHT_BUTTON 2
22 #define MIDDLE_BUTTON 4
24 /***** Mouse HIDD *******************/
26 struct mouse_staticdata
28 OOP_AttrBase hiddAttrBase;
29 OOP_AttrBase hiddMouseAB;
30 OOP_MethodID hwMethodBase;
32 OOP_Class *mouseclass;
33 OOP_Object *mousehidd;
35 struct Library *oopBase;
36 struct Library *utilityBase;
37 BPTR segList;
40 struct mousebase
42 struct Library library;
44 struct mouse_staticdata msd;
47 /* 488 byte long ring buffer used to read data with timeout defined */
49 #define RingSize 488
51 struct Ring
53 char ring[RingSize];
54 int top, ptr;
57 /* Object data */
59 struct mouse_data
61 VOID (*mouse_callback)(APTR, struct pHidd_Mouse_Event *);
62 APTR callbackdata;
64 UWORD buttonstate;
66 char *mouse_name;
68 OOP_Object *serial;
69 OOP_Object *unit;
70 struct Library *shidd;
71 UBYTE mouse_data[5];
72 UBYTE mouse_collected_bytes;
73 UBYTE mouse_protocol;
74 UBYTE mouse_inth_state;
76 struct pHidd_Mouse_Event event;
77 struct Ring *rx; /* Ring structure for mouse init */
80 /* Mouse types */
81 #define P_MS 0 /* Microsoft */
82 #define P_MSC 1 /* Mouse Systems Corp */
83 #define P_MM 2 /* MMseries */
84 #define P_LOGI 3 /* Logitech */
85 #define P_BM 4 /* BusMouse ??? */
86 #define P_LOGIMAN 5 /* MouseMan / TrackMan */
87 #define P_PS2 6 /* PS/2 mouse */
88 #define P_MMHIT 7 /* MM_HitTab */
89 #define P_GLIDEPOINT 8 /* ALPS serial GlidePoint */
90 #define P_IMSERIAL 9 /* Microsoft serial IntelliMouse */
91 #define P_THINKING 10 /* Kensington serial ThinkingMouse */
92 #define P_IMPS2 11 /* Microsoft PS/2 IntelliMouse */
93 #define P_THINKINGPS2 12 /* Kensington PS/2 ThinkingMouse */
94 #define P_MMANPLUSPS2 13 /* Logitech PS/2 MouseMan+ */
95 #define P_GLIDEPOINTPS2 14 /* ALPS PS/2 GlidePoint */
96 #define P_NETPS2 15 /* Genius PS/2 NetMouse */
97 #define P_NETSCROLLPS2 16 /* Genius PS/2 NetScroll */
98 #define P_SYSMOUSE 17 /* SysMouse */
99 #define P_AUTO 18 /* automatic */
100 #define P_ACECAD 19 /* ACECAD protocol */
102 /****************************************************************************************/
104 #ifdef inb
105 #undef inb
106 #endif
107 static inline unsigned char inb(unsigned short port)
109 unsigned char _v;
111 __asm__ __volatile__
112 ("inb %w1,%0"
113 : "=a" (_v)
114 : "Nd" (port)
117 return _v;
120 #ifdef outb
121 #undef outb
122 #endif
123 static inline void outb(unsigned char value, unsigned short port)
125 __asm__ __volatile__
126 ("outb %b0,%w1"
128 : "a" (value), "Nd" (port)
132 /****************************************************************************************/
134 #define MSD(cl) (&((struct mousebase *)cl->UserData)->msd)
136 #undef HiddAttrBase
137 #undef HiddMouseAB
138 #undef HWBase
139 #define HiddAttrBase (MSD(cl)->hiddAttrBase)
140 #define HiddMouseAB (MSD(cl)->hiddMouseAB)
141 #define HWBase (MSD(cl)->hwMethodBase)
143 #define OOPBase (MSD(cl)->oopBase)
144 #define UtilityBase (MSD(cl)->utilityBase)
146 #endif /* _MOUSE_H */