<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems (2011-02-17)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
<font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>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.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2716&r2=text&tr2=1.2717&diff_format=h">M</a></td><td width='1%'>1.2717</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/Makefile.am.diff?r1=text&tr1=1.87&r2=text&tr2=1.88&diff_format=h">M</a></td><td width='1%'>1.88</td><td width='100%'>cpukit/libmisc/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/fb/mw_print.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">cpukit/libmisc/fb/mw_print.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/fb/mw_uid.h.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>cpukit/libmisc/fb/mw_uid.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/fb/mw_uid.c.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>cpukit/libmisc/fb/mw_uid.c</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2716 rtems/cpukit/ChangeLog:1.2717
--- rtems/cpukit/ChangeLog:1.2716 Thu Feb 17 10:25:42 2011
+++ rtems/cpukit/ChangeLog Thu Feb 17 13:24:19 2011
</font><font color='#997700'>@@ -1,3 +1,9 @@
</font><font color='#000088'>+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.
+
</font> 2011-02-17 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libblock/include/rtems/bdpart.h (rtems_bdpart_format):
<font color='#006600'>diff -u rtems/cpukit/libmisc/Makefile.am:1.87 rtems/cpukit/libmisc/Makefile.am:1.88
--- rtems/cpukit/libmisc/Makefile.am:1.87 Mon Jan 31 23:48:30 2011
+++ rtems/cpukit/libmisc/Makefile.am Thu Feb 17 13:24:20 2011
</font><font color='#997700'>@@ -62,7 +62,7 @@
</font>
## fb
noinst_LIBRARIES += libmw-fb.a
<font color='#880000'>-libmw_fb_a_SOURCES = fb/mw_uid.c fb/fb.h fb/mw_uid.h
</font><font color='#000088'>+libmw_fb_a_SOURCES = fb/mw_print.c fb/mw_uid.c fb/fb.h fb/mw_uid.h
</font>
## shell
if LIBSHELL
<font color='#006600'>diff -u /dev/null rtems/cpukit/libmisc/fb/mw_print.c:1.1
--- /dev/null Thu Feb 17 14:10:31 2011
+++ rtems/cpukit/libmisc/fb/mw_print.c Thu Feb 17 13:24:20 2011
</font><font color='#997700'>@@ -0,0 +1,92 @@
</font><font color='#000088'>+/*
+ * COPYRIGHT (c) 1989-2011.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/mw_uid.h>
+#include <stdio.h>
+
+const char *uid_buttons(
+ unsigned short btns,
+ char *buffer,
+ size_t max
+)
+{
+ snprintf(
+ buffer,
+ max,
+ "LEFT=%s CENTER=%s RIGHT=%s",
+ ((btns & MV_BUTTON_LEFT) ? "down" : "up"),
+ ((btns & MV_BUTTON_CENTER) ? "down" : "up"),
+ ((btns & MV_BUTTON_RIGHT) ? "down" : "up")
+ );
+ return buffer;
+}
+
+void uid_print_message(
+ struct MW_UID_MESSAGE *uid
+)
+{
+ uid_print_message_with_plugin( NULL, printk_plugin, uid );
+}
+
+void uid_print_message_with_plugin(
+ void *context,
+ rtems_printk_plugin_t handler,
+ struct MW_UID_MESSAGE *uid
+)
+{
+ char buttons[80];
+
+ switch (uid->type) {
+ case MV_UID_INVALID:
+ (*handler)( context, "MV_UID_INVALID\n" );
+ break;
+ case MV_UID_REL_POS:
+ (*handler)(
+ context,
+ "MV_UID_REL_POS - %s x=%d y=%d z=%d\n",
+ uid_buttons( uid->m.pos.btns, buttons, sizeof(buttons)),
+ uid->m.pos.x, /* x location */
+ uid->m.pos.y, /* y location */
+ uid->m.pos.z /* z location, 0 for 2D */
+ );
+ break;
+ case MV_UID_ABS_POS:
+ (*handler)(
+ context,
+ "MV_UID_ABS_POS - %s x=%d y=%d z=%d\n",
+ uid_buttons( uid->m.pos.btns, buttons, sizeof(buttons)),
+ uid->m.pos.x, /* x location */
+ uid->m.pos.y, /* y location */
+ uid->m.pos.z /* z location, 0 for 2D */
+ );
+ break;
+ case MV_UID_KBD:
+ (*handler)( context,
+ "MV_UID_KBD - code=0x%04x modifiers=0x%02x mode=0x%02x\n",
+ uid->m.kbd.code, /* keycode or scancode */
+ uid->m.kbd.modifiers, /* key modifiers */
+ uid->m.kbd.mode /* current Kbd mode */
+ );
+ break;
+ case MV_UID_TIMER:
+ (*handler)( context, "MV_UID_TIMER\n" );
+ break;
+ default:
+ (*handler)( context, "Invalid device type\n" );
+ break;
+ }
+<span style="background-color: #FF0000"> </span>
+}
+
</font>
<font color='#006600'>diff -u rtems/cpukit/libmisc/fb/mw_uid.h:1.1 rtems/cpukit/libmisc/fb/mw_uid.h:1.2
--- rtems/cpukit/libmisc/fb/mw_uid.h:1.1 Fri Aug 21 13:39:59 2009
+++ rtems/cpukit/libmisc/fb/mw_uid.h Thu Feb 17 13:24:20 2011
</font><font color='#997700'>@@ -11,26 +11,26 @@
</font> #ifndef _MW_UID_H
#define _MW_UID_H
<font color='#880000'>-#ifdef __cplusplus
</font><font color='#000088'>+#include <sys/types.h>
+#include <rtems/bspIo.h>
+
+#ifdef __cplusplus
</font> extern "C" {
#endif
<font color='#880000'>-/* 0x41XX -- IOCLT functions for the Micro Input Devices commands */
</font><font color='#000088'>+/* 0x41XX -- IOCTL functions for the Micro Input Devices commands */
</font> #define MW_UID_REGISTER_DEVICE 0x4100
#define MW_UID_UNREGISTER_DEVICE 0x4101
<font color='#880000'>-
</font> /* devices supported by MicroWindows */
<font color='#880000'>-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 */
</font><font color='#000088'>+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 */
</font> };
<font color='#880000'>-
</font> /* matching MicroWindows */
#define MV_BUTTON_RIGHT 0x01
#define MV_BUTTON_CENTER 0x02
<font color='#997700'>@@ -53,43 +53,39 @@
</font> */
#define MV_KEY_MODE_SCANCODE 0x00
<font color='#880000'>-
</font> /* these defines match with the linux keyboard range
<font color='#880000'>- for ioctls functions for the keyboard interface.
- 0x4BXX --- keyboard related functions
</font><font color='#000088'>+ * for ioctls functions for the keyboard interface.
+ * 0x4BXX --- keyboard related functions
</font> */
<font color='#880000'>-#define MV_KDGKBMODE 0x4B44 /* gets current keyboard mode */
-#define MV_KDSKBMODE 0x4B45 /* sets current keyboard mode */
</font><font color='#000088'>+#define MV_KDGKBMODE 0x4B44 /* gets current keyboard mode */
+#define MV_KDSKBMODE 0x4B45 /* sets current keyboard mode */
</font>
/*
* Message generated by input devices controlled by MicroWindows.
*/
<font color='#880000'>-struct MW_UID_MESSAGE
-{
</font><font color='#000088'>+struct MW_UID_MESSAGE {
</font> enum MW_INPUT_DEVICE_TYPE type; /* device type */
<font color='#880000'>- 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 */
</font><font color='#000088'>+ 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 */
</font> } kbd;
/* fired when position events are raised, mouse, touch screen, etc */
struct pos_t {
<font color='#880000'>- unsigned short btns; /* indicates which buttons are pressed */
- short x; /* x location */
- short y; /* y location */
- short z; /* z location, 0 for 2D */
</font><font color='#000088'>+ unsigned short btns; /* indicates which buttons are pressed */
+ short x; /* x location */
+ short y; /* y location */
+ short z; /* z location, 0 for 2D */
</font> } pos;
/* fired by a timer device periodically */
struct timer_t {
<font color='#880000'>- unsigned long frt; /* free running timer */
- unsigned long seq; /* sequence number */
</font><font color='#000088'>+ unsigned long frt; /* free running timer */
+ unsigned long seq; /* sequence number */
</font> } tmr;
<font color='#880000'>-
</font> } m;
};
<font color='#997700'>@@ -105,23 +101,51 @@
</font> * support.
*/
<font color='#880000'>-/* creates the message queue that holds events from the input devices */
</font><font color='#000088'>+/**
+ * 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.
+ */
</font> extern int uid_open_queue( const char *q_name, int flags, size_t max_msgs );
<font color='#880000'>-/* closes message queue */
</font><font color='#000088'>+/**
+ * This method closes the message queue and deletes it.
+ *
+ * @return This method returns 0 on success and -1 on error.
+ */
</font> extern int uid_close_queue( void );
<font color='#880000'>-/*
- * reads a message from the queue. It waits up to the specified
- * timeout in mili-seconds.
</font><font color='#000088'>+/**
+ * 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.
</font> */
extern int uid_read_message( struct MW_UID_MESSAGE *m, unsigned long timeout );
<font color='#880000'>-/* write a message to the queue */
-extern int uid_write_message( struct MW_UID_MESSAGE *m );
-
</font><font color='#000088'>+/**
+ * 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 );
</font>
<font color='#880000'>-/* register device to insert data to the queue */
</font><font color='#000088'>+/**
+ * This method registers the device associated with @a fd to
+ * to insert data to the queue
+ */
</font> extern int uid_register_device( int fd, const char *q_name );
/* unregister device to stop adding messages to the queue */
<font color='#997700'>@@ -130,7 +154,31 @@
</font> /* set the keyboard */
extern int uid_set_kbd_mode( int fd, int mode, int *old_mode );
<font color='#880000'>-#ifdef __cplusplus
</font><font color='#000088'>+/**
+ * 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
</font> }
#endif
<font color='#006600'>diff -u rtems/cpukit/libmisc/fb/mw_uid.c:1.1 rtems/cpukit/libmisc/fb/mw_uid.c:1.2
--- rtems/cpukit/libmisc/fb/mw_uid.c:1.1 Fri Aug 21 13:39:59 2009
+++ rtems/cpukit/libmisc/fb/mw_uid.c Thu Feb 17 13:24:20 2011
</font><font color='#997700'>@@ -4,9 +4,8 @@
</font> *
* MODULE DESCRIPTION:
* This module implements the input devices interface used by MicroWindows
<font color='#880000'>- * in an embedded system environment.
- * It uses the RTEMS message queue as the repository for the messages posted
- * by the devices registered.
</font><font color='#000088'>+ * in an embedded system environment. It uses the RTEMS message queue as
+ * the repository for the messages posted by the devices registered.
</font> *
* $Id$
*/
<font color='#997700'>@@ -24,58 +23,59 @@
</font> #include <rtems/mw_uid.h>
#include <rtems/seterr.h>
<font color='#880000'>-static rtems_id queue_id = 0;
-static int open_count = 0;
</font><font color='#000088'>+static rtems_id queue_id = 0;
+static int open_count = 0;
</font>
/*
#define MW_DEBUG_ON 1
*/
/* open a message queue with the kernel */
<font color='#880000'>-int uid_open_queue( const char *q_name, int flags __attribute__((unused)), size_t max_msgs )
</font><font color='#000088'>+int uid_open_queue(
+ const char *q_name,
+ int flags __attribute__((unused)),
+ size_t max_msgs
+)
</font> {
<font color='#880000'>- static rtems_name queue_name;
</font><font color='#000088'>+ rtems_status_code status;
</font>
<font color='#880000'>- /*
- * For the first device calling this function we would create the queue.
- * It is assumed that this call is done at initialization, and no concerns
- * regarding multi-threading is taken in consideration here.
- */
- if( !open_count )
- {
- rtems_status_code status;
- queue_name = rtems_build_name( q_name[0],
- q_name[1],
- q_name[2],
- q_name[3] );
- status = rtems_message_queue_create( queue_name,
- max_msgs,
- sizeof( struct MW_UID_MESSAGE ),
- RTEMS_FIFO | RTEMS_LOCAL,
- &queue_id );
- if( status != RTEMS_SUCCESSFUL )
- {
-#ifdef MW_DEBUG_ON
- printk( "UID_Queue: error creating queue: %d\n", status );
-#endif
- return -1;
- }
-#ifdef MW_DEBUG_ON
- printk( "UID_Queue: id=%X\n", queue_id );
-#endif
- }
- open_count++;
- return 0;
</font><font color='#000088'>+ /*
+ * For the first device calling this function we would create the queue.
+ * It is assumed that this call is done at initialization, and no concerns
+ * regarding multi-threading is taken in consideration here.
+ */
+ if ( open_count ) {
+ open_count++;
+ return 0;
+ }
+
+ status = rtems_message_queue_create(
+ rtems_build_name( q_name[0], q_name[1], q_name[2], q_name[3] ),
+ max_msgs,
+ sizeof( struct MW_UID_MESSAGE ),
+ RTEMS_FIFO | RTEMS_LOCAL,
+ &queue_id
+ );
+ if ( status != RTEMS_SUCCESSFUL ) {
+ #ifdef MW_DEBUG_ON
+ printk( "UID_Queue: error creating queue: %d\n", status );
+ #endif
+ return -1;
+ }
+ #ifdef MW_DEBUG_ON
+ printk( "UID_Queue: id=%X\n", queue_id );
+ #endif
+ open_count++;
+ return 0;
</font> }
/* close message queue */
int uid_close_queue( void )
{
<font color='#880000'>- if( open_count == 1 )
- {
- rtems_message_queue_delete( queue_id );
- queue_id = 0;
</font><font color='#000088'>+ if ( open_count == 1 ) {
+ rtems_message_queue_delete( queue_id );
+ queue_id = 0;
</font> }
open_count--;
return 0;
<font color='#997700'>@@ -86,43 +86,40 @@
</font> {
rtems_status_code status;
size_t size = 0;
<font color='#880000'>- unsigned long micro_secs = timeout*1000;
- int wait = ( timeout != 0 );
</font><font color='#000088'>+ unsigned long micro_secs = timeout*1000;
+ int wait = (timeout != 0);
</font>
<font color='#880000'>- status = rtems_message_queue_receive( queue_id,
- (void*)m,
- &size,
- wait ? RTEMS_WAIT : RTEMS_NO_WAIT,
- RTEMS_MICROSECONDS_TO_TICKS(micro_secs));
</font><font color='#000088'>+ status = rtems_message_queue_receive(
+ queue_id,
+ (void*)m,
+ &size,
+ wait ? RTEMS_WAIT : RTEMS_NO_WAIT,
+ RTEMS_MICROSECONDS_TO_TICKS(micro_secs)
+ );
</font>
<font color='#880000'>- if( status == RTEMS_SUCCESSFUL )
- {
</font><font color='#000088'>+ if( status == RTEMS_SUCCESSFUL ) {
</font> return size;
<font color='#880000'>- }
- else if( ( status == RTEMS_UNSATISFIED ) || ( status == RTEMS_TIMEOUT ) )
- {
- /* this macro returns -1 */
</font><font color='#000088'>+ } else if( ( status == RTEMS_UNSATISFIED ) || ( status == RTEMS_TIMEOUT ) ) {
</font> rtems_set_errno_and_return_minus_one( ETIMEDOUT );
}
/* Here we have one error condition */
<font color='#880000'>-#ifdef MW_DEBUG_ON
- printk( "UID_Queue: error reading queue: %d\n", status );
-#endif
</font><font color='#000088'>+ #ifdef MW_DEBUG_ON
+ printk( "UID_Queue: error reading queue: %d\n", status );
+ #endif
</font> return -1;
}
<font color='#880000'>-
</font> /*
<font color='#880000'>- * add a message to the queue of events. This method cna be used to
</font><font color='#000088'>+ * add a message to the queue of events. This method can be used to
</font> * simulate hardware events, and it can be very handy during development
* a new interface.
*/
int uid_send_message( struct MW_UID_MESSAGE *m )
{
rtems_status_code status;
<font color='#880000'>- status = rtems_message_queue_send( queue_id, ( void * )m,
- sizeof( struct MW_UID_MESSAGE ) );
- return status == RTEMS_SUCCESSFUL ? 0 : -1;
</font><font color='#000088'>+ status = rtems_message_queue_send(
+ queue_id, ( void * )m, sizeof( struct MW_UID_MESSAGE ) );
+ return (status == RTEMS_SUCCESSFUL) ? 0 : -1;
</font> }
/*
<font color='#997700'>@@ -143,13 +140,11 @@
</font> /* set the keyboard */
int uid_set_kbd_mode( int fd, int mode, int *old_mode )
{
<font color='#880000'>- if (ioctl( fd, MV_KDGKBMODE, old_mode) < 0)
- {
- return -1;
- }
- if (ioctl(fd, MV_KDSKBMODE, mode ) < 0 )
- {
- return -1;
- }
- return 0;
</font><font color='#000088'>+ if (ioctl( fd, MV_KDGKBMODE, old_mode) < 0) {
+ return -1;
+ }
+ if (ioctl(fd, MV_KDSKBMODE, mode ) < 0 ) {
+ return -1;
+ }
+ return 0;
</font> }
</pre>
<p> </p>
<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>