source: rtems/cpukit/libmisc/fb/mw_uid.h @ 1ccbfe2d

4.115
Last change on this file since 1ccbfe2d was 9ab091e, checked in by Mathew Kallada <matkallada@…>, on 12/28/12 at 16:35:32

Header File Doxygen Enhancement Task #2

  • Property mode set to 100644
File size: 5.6 KB
Line 
1/**
2 * @file rtems/mw_uid.h
3 *
4 * @brief Input device Interface for MicroWindows in an
5 * Embedded System Enviroment
6 *
7 * This file defines the interface for input devices used by
8 * MicroWindows in an embedded system environment.
9 */
10
11/*
12 * Copyright (c) 2000 - Rosimildo da Silva
13 */
14
15#ifndef _MW_UID_H
16#define _MW_UID_H
17
18#include <sys/types.h>
19#include <rtems/bspIo.h>
20
21/**
22 *  @defgroup libmisc_fb_mw Input Devices for MicroWindows
23 *
24 *  @ingroup libmisc
25 */
26/**@{*/
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31/* 0x41XX  -- IOCTL functions for the Micro Input Devices commands */
32#define MW_UID_REGISTER_DEVICE     0x4100
33#define MW_UID_UNREGISTER_DEVICE   0x4101
34
35/* devices supported by MicroWindows */
36enum MW_INPUT_DEVICE_TYPE {
37  MV_UID_INVALID   = 0,
38  MV_UID_REL_POS   = 1,   /* mouse        */
39  MV_UID_ABS_POS   = 2,   /* touch-screen */
40  MV_UID_KBD       = 3,   /* keyboard     */
41  MV_UID_TIMER     = 4    /* timer -- not used */
42};
43
44/* matching MicroWindows */
45#define MV_BUTTON_RIGHT                 0x01
46#define MV_BUTTON_CENTER                0x02
47#define MV_BUTTON_LEFT                  0x04
48
49/* modifiers of the keyboard type devices */
50#define MV_KEY_MODIFIER_SHIFT_DOWN      0x10
51#define MV_KEY_MODIFIER_ALT_DOWN        0x20
52
53/* indication of the LEDS */
54#define MV_KEY_MODIFIER_CAPS_ON         0x04
55#define MV_KEY_MODIFIER_NUN_LOCK_ON     0x02
56#define MV_KEY_SCROLL_LOCK_ON           0x01
57
58/* keyboard modes -- default ASCII     */
59#define MV_KEY_MODE_ASCII               0x01
60/*
61 * This mode one event is sent when a key is pressed,
62 * and another one is send when a key is released.
63 */
64#define MV_KEY_MODE_SCANCODE            0x00
65
66/* these defines match with the linux keyboard range
67 * for ioctls functions for the keyboard interface.
68 * 0x4BXX --- keyboard related functions
69 */
70#define MV_KDGKBMODE  0x4B44   /* gets current keyboard mode */
71#define MV_KDSKBMODE  0x4B45   /* sets current keyboard mode */
72
73/*
74 * Message generated by input devices controlled by MicroWindows.
75 */
76struct MW_UID_MESSAGE {
77  enum MW_INPUT_DEVICE_TYPE type;  /* device type */
78  union {
79    /* fired when keyboard events are raised */
80    struct kbd_t {
81      unsigned short code;        /* keycode or scancode        */
82      unsigned char  modifiers;   /* key modifiers              */
83      unsigned char  mode;        /* current Kbd mode           */
84    } kbd;
85
86    /* fired when position events are raised, mouse, touch screen, etc */
87    struct pos_t {
88      unsigned short btns; /* indicates which buttons are pressed */
89      short x;             /* x location */
90      short y;             /* y location */
91      short z;             /* z location, 0 for 2D */
92    } pos;
93
94    /* fired by a timer device periodically */
95    struct timer_t {
96      unsigned long  frt;   /* free running timer */
97      unsigned long  seq;   /* sequence number */
98    } tmr;
99  } m;
100};
101
102
103/*
104 * API for creating/closing/accessing the message queue used by the micro
105 * input device interface. All functions in this interface returns a
106 * zero ( 0 ) on success. One exception for that is the "read" routine
107 * that returns the number of bytes read. Negaive numbers indicate errors
108 *
109 * The implementation of the message queue for RTEMS uses a POSIX message
110 * queue interface. It should be very portable among systems with a POSIX
111 * support.
112 */
113
114/**
115 *  This method creates the message queue that holds events from the
116 *  input devices.
117 *
118 *  @param[in] q_name is the name of the message queue
119 *  @param[in] flags controls the behaviour of the queue
120 *  @param[in] max_msgs specifies the maximum number of pending messages
121 *
122 *  @note The message queue is from the Classic API.
123 *
124 *  @return This method returns 0 on success and -1 on error.
125 */
126extern int uid_open_queue( const char *q_name, int flags, size_t max_msgs );
127
128/**
129 *  This method closes the message queue and deletes it.
130 *
131 *  @return This method returns 0 on success and -1 on error.
132 */
133extern int uid_close_queue( void );
134
135/**
136 *  This method reads a message from the queue. It waits up to the specified
137 *  timeout in miliseconds. A @a timeout of 0 is a poll.
138 *
139 *  @param[in] m will be filled in with the received message
140 *  @param[in] timeout is the maximum number of mulliseconds to wait
141 *
142 *  @return This method returns 0 on success and -1 on error.
143 */
144extern int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout );
145
146/**
147 *  This methods writes a message to the queue.
148 *
149 *  @param[in] m is the message to send
150 *
151 *  @return This method returns 0 on success and -1 on error.
152 */
153extern int uid_send_message( struct MW_UID_MESSAGE *m );
154
155/**
156 *  This method registers the device associated with @a fd to
157 *  to insert data to the queue
158 */
159extern int uid_register_device( int fd, const char *q_name );
160
161/* unregister device to stop adding messages to the queue */
162extern int uid_unregister_device( int fd );
163
164/* set the keyboard */
165extern int uid_set_kbd_mode( int fd, int mode, int *old_mode );
166
167/**
168 *  This methods prints the specified UID message using printk
169 *
170 *  @param[in] uid points to the message to print
171 */
172void uid_print_message(
173  struct MW_UID_MESSAGE *uid
174);
175
176/**
177 *  This methods prints the specified UID message using your fprintf
178 *  style method of choice.
179 *
180 *  @param[in] context is a pointer to a data area which may be
181 *             used by some print handlers
182 *  @param[in] handler is the fprintf style method to invoke
183 *  @param[in] uid points to the message to print
184 */
185void uid_print_message_with_plugin(
186  void                  *context,
187  rtems_printk_plugin_t  handler,
188  struct MW_UID_MESSAGE *uid
189);
190
191#ifdef __cplusplus
192}
193#endif
194/**@}*/
195#endif /* _MW_UID_H */
Note: See TracBrowser for help on using the repository browser.