1 | /* |
---|
2 | ///////////////////////////////////////////////////////////////////////////// |
---|
3 | // $Header$ |
---|
4 | // |
---|
5 | // Copyright (c) 2000 - Rosimildo da Silva |
---|
6 | // |
---|
7 | // MODULE DESCRIPTION: |
---|
8 | // This module defines the interface for input devices used by MicroWindows |
---|
9 | // in an embedded system environment. |
---|
10 | // |
---|
11 | // MODIFICATION/HISTORY: |
---|
12 | // |
---|
13 | // $Log$ |
---|
14 | // Revision 1.1 2000/08/30 08:21:24 joel |
---|
15 | // 2000-08-26 Rosimildo da Silva <rdasilva@connecttel.com> |
---|
16 | // |
---|
17 | // * Added generic Micro FrameBuffer interface for MicroWindows. |
---|
18 | // This interface allows MicroWindows to under RTEMS. A sample |
---|
19 | // driver has been developed for the pc386 BSP. See |
---|
20 | // pc386/fb_vga.c as a sample. |
---|
21 | // * Added Uniform Input Device interface for MicroWindows. |
---|
22 | // See PC386 bsp for sample drivers for mouse and keyboard (console). |
---|
23 | // * mw-bf: New directory. |
---|
24 | // * Makefile.am, configure.in, wrapup/Makefile.am: Account for mw-fb. |
---|
25 | // * mw-fb/Makefile.am: New file. |
---|
26 | // * mw-fb/mw_fb.c: New file. |
---|
27 | // * mw-fb/mw_fb.h: New file. |
---|
28 | // * mw-fb/mw_uid.c: New file. |
---|
29 | // * mw-fb/mw_uid.h: New file. |
---|
30 | // |
---|
31 | // |
---|
32 | ///////////////////////////////////////////////////////////////////////////// |
---|
33 | */ |
---|
34 | #ifndef _MW_UID_H |
---|
35 | #define _MW_UID_H |
---|
36 | |
---|
37 | #ifdef __cplusplus |
---|
38 | extern "C" { |
---|
39 | #endif |
---|
40 | |
---|
41 | /* 0x41XX -- IOCLT functions for the Micro Input Devices commands */ |
---|
42 | #define MW_UID_REGISTER_DEVICE 0x4100 |
---|
43 | #define MW_UID_UNREGISTER_DEVICE 0x4101 |
---|
44 | |
---|
45 | |
---|
46 | /* devices supported by MicroWindows */ |
---|
47 | enum MW_INPUT_DEVICE_TYPE |
---|
48 | { |
---|
49 | MV_UID_INVALID = 0, |
---|
50 | MV_UID_REL_POS = 1, /* mouse */ |
---|
51 | MV_UID_ABS_POS = 2, /* touch-screen */ |
---|
52 | MV_UID_KBD = 3, /* keyboard */ |
---|
53 | MV_UID_TIMER = 4 /* timer -- not used */ |
---|
54 | }; |
---|
55 | |
---|
56 | |
---|
57 | /* matching MicroWindows */ |
---|
58 | #define MV_BUTTON_RIGHT 0x01 |
---|
59 | #define MV_BUTTON_CENTER 0x02 |
---|
60 | #define MV_BUTTON_LEFT 0x04 |
---|
61 | |
---|
62 | /* modifiers of the keyboard type devices */ |
---|
63 | #define MV_KEY_MODIFIER_SHIFT_DOWN 0x10 |
---|
64 | #define MV_KEY_MODIFIER_ALT_DOWN 0x20 |
---|
65 | |
---|
66 | /* indication of the LEDS */ |
---|
67 | #define MV_KEY_MODIFIER_CAPS_ON 0x04 |
---|
68 | #define MV_KEY_MODIFIER_NUN_LOCK_ON 0x02 |
---|
69 | #define MV_KEY_SCROLL_LOCK_ON 0x01 |
---|
70 | |
---|
71 | /* keyboard modes -- default ASCII */ |
---|
72 | #define MV_KEY_MODE_ASCII 0x01 |
---|
73 | /* |
---|
74 | * This mode one event is sent when a key is pressed, |
---|
75 | * and another one is send when a key is released. |
---|
76 | */ |
---|
77 | #define MV_KEY_MODE_SCANCODE 0x00 |
---|
78 | |
---|
79 | |
---|
80 | /* these defines match with the linux keyboard range |
---|
81 | for ioctls functions for the keyboard interface. |
---|
82 | 0x4BXX --- keyboard related functions |
---|
83 | */ |
---|
84 | #define MV_KDGKBMODE 0x4B44 /* gets current keyboard mode */ |
---|
85 | #define MV_KDSKBMODE 0x4B45 /* sets current keyboard mode */ |
---|
86 | |
---|
87 | /* |
---|
88 | * Message generated by input devices controlled by MicroWindows. |
---|
89 | */ |
---|
90 | struct MW_UID_MESSAGE |
---|
91 | { |
---|
92 | enum MW_INPUT_DEVICE_TYPE type; /* device type */ |
---|
93 | union |
---|
94 | { |
---|
95 | /* fired when keyboard events are raised */ |
---|
96 | struct kbd_t { |
---|
97 | unsigned short code; /* keycode or scancode */ |
---|
98 | unsigned char modifiers; /* key modifiers */ |
---|
99 | unsigned char mode; /* current Kbd mode */ |
---|
100 | } kbd; |
---|
101 | |
---|
102 | /* fired when position events are raised, mouse, touch screen, etc */ |
---|
103 | struct pos_t { |
---|
104 | unsigned short btns; /* indicates which buttons are pressed */ |
---|
105 | short x; /* x location */ |
---|
106 | short y; /* y location */ |
---|
107 | short z; /* z location, 0 for 2D */ |
---|
108 | } pos; |
---|
109 | |
---|
110 | /* fired by a timer device periodically */ |
---|
111 | struct timer_t { |
---|
112 | unsigned long frt; /* free running timer */ |
---|
113 | unsigned long seq; /* sequence number */ |
---|
114 | } tmr; |
---|
115 | |
---|
116 | } m; |
---|
117 | }; |
---|
118 | |
---|
119 | |
---|
120 | /* |
---|
121 | * API for creating/closing/accessing the message queue used by the micro |
---|
122 | * input device interface. All functions in this interface returns a |
---|
123 | * zero ( 0 ) on success. One exception for that is the "read" routine |
---|
124 | * that returns the number of bytes read. Negaive numbers indicate errors |
---|
125 | * |
---|
126 | * The implementation of the message queue for RTEMS uses a POSIX message |
---|
127 | * queue interface. It should be very portable among systems with a POSIX |
---|
128 | * support. |
---|
129 | */ |
---|
130 | |
---|
131 | /* creates the message queue that holds events from the input devices */ |
---|
132 | extern int uid_open_queue( const char *q_name, int flags, size_t max_msgs ); |
---|
133 | |
---|
134 | /* closes message queue */ |
---|
135 | extern int uid_close_queue( void ); |
---|
136 | |
---|
137 | /* |
---|
138 | * reads a message from the queue. It waits up to the specified |
---|
139 | * timeout in mili-seconds. |
---|
140 | */ |
---|
141 | extern int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout ); |
---|
142 | |
---|
143 | /* write a message to the queue */ |
---|
144 | extern int uid_write_message( struct MW_UID_MESSAGE *m ); |
---|
145 | |
---|
146 | |
---|
147 | /* register device to insert data to the queue */ |
---|
148 | extern int uid_register_device( int fd, const char *q_name ); |
---|
149 | |
---|
150 | /* unregister device to stop adding messages to the queue */ |
---|
151 | extern int uid_unregister_device( int fd ); |
---|
152 | |
---|
153 | /* set the keyboard */ |
---|
154 | extern int uid_set_kbd_mode( int fd, int mode, int *old_mode ); |
---|
155 | |
---|
156 | #ifdef __cplusplus |
---|
157 | } |
---|
158 | #endif |
---|
159 | |
---|
160 | #endif /* _MW_UID_H */ |
---|