diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-02-17 19:24:20 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2011-02-17 19:24:20 +0000 |
commit | d18d5890abf09a2c75e985e688fb2baa6e0bfdc3 (patch) | |
tree | c7081acc1dad45fdfb0a43d76fa6eb19c7b13a5d /cpukit/libmisc/fb/mw_uid.h | |
parent | 2011-02-17 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-d18d5890abf09a2c75e985e688fb2baa6e0bfdc3.tar.bz2 |
2011-02-17 Joel Sherrill <joel.sherrill@oarcorp.com>
* libmisc/Makefile.am, libmisc/fb/mw_uid.c, libmisc/fb/mw_uid.h: Clean
up. Add Doxygen style comments. Add method to print uid structure.
* libmisc/fb/mw_print.c: New file.
Diffstat (limited to '')
-rw-r--r-- | cpukit/libmisc/fb/mw_uid.h | 132 |
1 files changed, 90 insertions, 42 deletions
diff --git a/cpukit/libmisc/fb/mw_uid.h b/cpukit/libmisc/fb/mw_uid.h index 867a28e2e5..89f440acf4 100644 --- a/cpukit/libmisc/fb/mw_uid.h +++ b/cpukit/libmisc/fb/mw_uid.h @@ -11,26 +11,26 @@ #ifndef _MW_UID_H #define _MW_UID_H -#ifdef __cplusplus +#include <sys/types.h> +#include <rtems/bspIo.h> + +#ifdef __cplusplus extern "C" { #endif -/* 0x41XX -- IOCLT functions for the Micro Input Devices commands */ +/* 0x41XX -- IOCTL functions for the Micro Input Devices commands */ #define MW_UID_REGISTER_DEVICE 0x4100 #define MW_UID_UNREGISTER_DEVICE 0x4101 - /* devices supported by MicroWindows */ -enum MW_INPUT_DEVICE_TYPE -{ - MV_UID_INVALID = 0, - MV_UID_REL_POS = 1, /* mouse */ - MV_UID_ABS_POS = 2, /* touch-screen */ - MV_UID_KBD = 3, /* keyboard */ - MV_UID_TIMER = 4 /* timer -- not used */ +enum MW_INPUT_DEVICE_TYPE { + MV_UID_INVALID = 0, + MV_UID_REL_POS = 1, /* mouse */ + MV_UID_ABS_POS = 2, /* touch-screen */ + MV_UID_KBD = 3, /* keyboard */ + MV_UID_TIMER = 4 /* timer -- not used */ }; - /* matching MicroWindows */ #define MV_BUTTON_RIGHT 0x01 #define MV_BUTTON_CENTER 0x02 @@ -53,43 +53,39 @@ enum MW_INPUT_DEVICE_TYPE */ #define MV_KEY_MODE_SCANCODE 0x00 - /* these defines match with the linux keyboard range - for ioctls functions for the keyboard interface. - 0x4BXX --- keyboard related functions + * for ioctls functions for the keyboard interface. + * 0x4BXX --- keyboard related functions */ -#define MV_KDGKBMODE 0x4B44 /* gets current keyboard mode */ -#define MV_KDSKBMODE 0x4B45 /* sets current keyboard mode */ +#define MV_KDGKBMODE 0x4B44 /* gets current keyboard mode */ +#define MV_KDSKBMODE 0x4B45 /* sets current keyboard mode */ /* * Message generated by input devices controlled by MicroWindows. */ -struct MW_UID_MESSAGE -{ +struct MW_UID_MESSAGE { enum MW_INPUT_DEVICE_TYPE type; /* device type */ - union - { - /* fired when keyboard events are raised */ - struct kbd_t { - unsigned short code; /* keycode or scancode */ - unsigned char modifiers; /* key modifiers */ - unsigned char mode; /* current Kbd mode */ + union { + /* fired when keyboard events are raised */ + struct kbd_t { + unsigned short code; /* keycode or scancode */ + unsigned char modifiers; /* key modifiers */ + unsigned char mode; /* current Kbd mode */ } kbd; /* fired when position events are raised, mouse, touch screen, etc */ struct pos_t { - unsigned short btns; /* indicates which buttons are pressed */ - short x; /* x location */ - short y; /* y location */ - short z; /* z location, 0 for 2D */ + unsigned short btns; /* indicates which buttons are pressed */ + short x; /* x location */ + short y; /* y location */ + short z; /* z location, 0 for 2D */ } pos; /* fired by a timer device periodically */ struct timer_t { - unsigned long frt; /* free running timer */ - unsigned long seq; /* sequence number */ + unsigned long frt; /* free running timer */ + unsigned long seq; /* sequence number */ } tmr; - } m; }; @@ -105,23 +101,51 @@ struct MW_UID_MESSAGE * support. */ -/* creates the message queue that holds events from the input devices */ +/** + * This method creates the message queue that holds events from the + * input devices. + * + * @param[in] q_name is the name of the message queue + * @param[in] flags controls the behaviour of the queue + * @param[in] max_msgs specifies the maximum number of pending messages + * + * @note The message queue is from the Classic API. + * + * @return This method returns 0 on success and -1 on error. + */ extern int uid_open_queue( const char *q_name, int flags, size_t max_msgs ); -/* closes message queue */ +/** + * This method closes the message queue and deletes it. + * + * @return This method returns 0 on success and -1 on error. + */ extern int uid_close_queue( void ); -/* - * reads a message from the queue. It waits up to the specified - * timeout in mili-seconds. +/** + * This method reads a message from the queue. It waits up to the specified + * timeout in miliseconds. A @a timeout of 0 is a poll. + * + * @param[in] m will be filled in with the received message + * @param[in] timeout is the maximum number of mulliseconds to wait + * + * @return This method returns 0 on success and -1 on error. */ extern int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout ); -/* write a message to the queue */ -extern int uid_write_message( struct MW_UID_MESSAGE *m ); - +/** + * This methods writes a message to the queue. + * + * @param[in] m is the message to send + * + * @return This method returns 0 on success and -1 on error. + */ +extern int uid_send_message( struct MW_UID_MESSAGE *m ); -/* register device to insert data to the queue */ +/** + * This method registers the device associated with @a fd to + * to insert data to the queue + */ extern int uid_register_device( int fd, const char *q_name ); /* unregister device to stop adding messages to the queue */ @@ -130,7 +154,31 @@ extern int uid_unregister_device( int fd ); /* set the keyboard */ extern int uid_set_kbd_mode( int fd, int mode, int *old_mode ); -#ifdef __cplusplus +/** + * This methods prints the specified UID message using printk + * + * @param[in] uid points to the message to print + */ +void uid_print_message( + struct MW_UID_MESSAGE *uid +); + +/** + * This methods prints the specified UID message using your fprintf + * style method of choice. + * + * @param[in] context is a pointer to a data area which may be + * used by some print handlers + * @param[in] handler is the fprintf style method to invoke + * @param[in] uid points to the message to print + */ +void uid_print_message_with_plugin( + void *context, + rtems_printk_plugin_t handler, + struct MW_UID_MESSAGE *uid +); + +#ifdef __cplusplus } #endif |