RTEMS  5.0.0
mw_uid.h
Go to the documentation of this file.
1 
13 /*
14  * Copyright (c) 2000 - Rosimildo da Silva
15  */
16 
17 #ifndef _MW_UID_H
18 #define _MW_UID_H
19 
20 #include <sys/types.h>
21 #include <rtems/print.h>
22 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
33 /* 0x41XX -- IOCTL functions for the Micro Input Devices commands */
34 #define MW_UID_REGISTER_DEVICE 0x4100
35 #define MW_UID_UNREGISTER_DEVICE 0x4101
36 
37 /* devices supported by MicroWindows */
38 enum MW_INPUT_DEVICE_TYPE {
39  MV_UID_INVALID = 0,
40  MV_UID_REL_POS = 1, /* mouse */
41  MV_UID_ABS_POS = 2, /* touch-screen */
42  MV_UID_KBD = 3, /* keyboard */
43  MV_UID_TIMER = 4 /* timer -- not used */
44 };
45 
46 /* matching MicroWindows */
47 #define MV_BUTTON_RIGHT 0x01
48 #define MV_BUTTON_CENTER 0x02
49 #define MV_BUTTON_LEFT 0x04
50 
51 /* modifiers of the keyboard type devices */
52 #define MV_KEY_MODIFIER_SHIFT_DOWN 0x10
53 #define MV_KEY_MODIFIER_ALT_DOWN 0x20
54 
55 /* indication of the LEDS */
56 #define MV_KEY_MODIFIER_CAPS_ON 0x04
57 #define MV_KEY_MODIFIER_NUN_LOCK_ON 0x02
58 #define MV_KEY_SCROLL_LOCK_ON 0x01
59 
60 /* keyboard modes -- default ASCII */
61 #define MV_KEY_MODE_ASCII 0x01
62 /*
63  * This mode one event is sent when a key is pressed,
64  * and another one is send when a key is released.
65  */
66 #define MV_KEY_MODE_SCANCODE 0x00
67 
68 /* these defines match with the linux keyboard range
69  * for ioctls functions for the keyboard interface.
70  * 0x4BXX --- keyboard related functions
71  */
72 #define MV_KDGKBMODE 0x4B44 /* gets current keyboard mode */
73 #define MV_KDSKBMODE 0x4B45 /* sets current keyboard mode */
74 
75 /*
76  * Message generated by input devices controlled by MicroWindows.
77  */
79  enum MW_INPUT_DEVICE_TYPE type; /* device type */
80  union {
81  /* fired when keyboard events are raised */
82  struct kbd_t {
83  unsigned short code; /* keycode or scancode */
84  unsigned char modifiers; /* key modifiers */
85  unsigned char mode; /* current Kbd mode */
86  } kbd;
87 
88  /* fired when position events are raised, mouse, touch screen, etc */
89  struct pos_t {
90  unsigned short btns; /* indicates which buttons are pressed */
91  short x; /* x location */
92  short y; /* y location */
93  short z; /* z location, 0 for 2D */
94  } pos;
95 
96  /* fired by a timer device periodically */
97  struct timer_t {
98  unsigned long frt; /* free running timer */
99  unsigned long seq; /* sequence number */
100  } tmr;
101  } m;
102 };
103 
104 
105 /*
106  * API for creating/closing/accessing the message queue used by the micro
107  * input device interface. All functions in this interface returns a
108  * zero ( 0 ) on success. One exception for that is the "read" routine
109  * that returns the number of bytes read. Negaive numbers indicate errors
110  *
111  * The implementation of the message queue for RTEMS uses a POSIX message
112  * queue interface. It should be very portable among systems with a POSIX
113  * support.
114  */
115 
128 extern int uid_open_queue( const char *q_name, int flags, size_t max_msgs );
129 
135 extern int uid_close_queue( void );
136 
146 extern int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout );
147 
155 extern int uid_send_message( struct MW_UID_MESSAGE *m );
156 
161 extern int uid_register_device( int fd, const char *q_name );
162 
163 /* unregister device to stop adding messages to the queue */
164 extern int uid_unregister_device( int fd );
165 
166 /* set the keyboard */
167 extern int uid_set_kbd_mode( int fd, int mode, int *old_mode );
168 
174 void uid_print_message(
175  struct MW_UID_MESSAGE *uid
176 );
177 
186  const rtems_printer *printer,
187  struct MW_UID_MESSAGE *uid
188 );
189 
190 #ifdef __cplusplus
191 }
192 #endif
193 
194 #endif /* _MW_UID_H */
void uid_print_message_with_plugin(const rtems_printer *printer, struct MW_UID_MESSAGE *uid)
Definition: mw_print.c:52
void uid_print_message(struct MW_UID_MESSAGE *uid)
Definition: mw_print.c:43
int uid_close_queue(void)
Definition: mw_uid.c:77
Definition: printer.h:55
int uid_open_queue(const char *q_name, int flags, size_t max_msgs)
Definition: mw_uid.c:37
Definition: mw_uid.h:78
int uid_register_device(int fd, const char *q_name)
Definition: mw_uid.c:141
int uid_send_message(struct MW_UID_MESSAGE *m)
Definition: mw_uid.c:129
int uid_read_message(struct MW_UID_MESSAGE *m, unsigned long timeout)
Definition: mw_uid.c:88
Definition: inftrees.h:24