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