<!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-03-14)</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-03-14 Joel Sherrill <joel.sherrill@oarcorp.com>

        PR 1762/cpukit
        * Makefile.am, preinstall.am, libmisc/Makefile.am, wrapup/Makefile.am:
        Add generic serial mouse driver and mouse parser. The parser code was
        in the pc386 BSP but was generic so cleaned up and placed here.
        Serial mouse driver itself is new.
        * libmisc/mouse/README, libmisc/mouse/mouse_parser.c,
        libmisc/mouse/mouse_parser.h, libmisc/mouse/serial_mouse.c,
        libmisc/mouse/serial_mouse.h: New files.
</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.2770&r2=text&tr2=1.2771&diff_format=h">M</a></td><td width='1%'>1.2771</td><td width='100%'>cpukit/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/Makefile.am.diff?r1=text&tr1=1.104&r2=text&tr2=1.105&diff_format=h">M</a></td><td width='1%'>1.105</td><td width='100%'>cpukit/Makefile.am</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.88&r2=text&tr2=1.89&diff_format=h">M</a></td><td width='1%'>1.89</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/mouse/README?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/mouse/README</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/mouse/mouse_parser.h?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/mouse/mouse_parser.h</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/mouse/mouse_parser.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/mouse/mouse_parser.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/mouse/serial_mouse.h?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/mouse/serial_mouse.h</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libmisc/mouse/serial_mouse.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/mouse/serial_mouse.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/preinstall.am.diff?r1=text&tr1=1.48&r2=text&tr2=1.49&diff_format=h">M</a></td><td width='1%'>1.49</td><td width='100%'>cpukit/preinstall.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/wrapup/Makefile.am.diff?r1=text&tr1=1.74&r2=text&tr2=1.75&diff_format=h">M</a></td><td width='1%'>1.75</td><td width='100%'>cpukit/wrapup/Makefile.am</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/cpukit/ChangeLog:1.2770 rtems/cpukit/ChangeLog:1.2771
--- rtems/cpukit/ChangeLog:1.2770       Mon Mar 14 08:18:34 2011
+++ rtems/cpukit/ChangeLog      Mon Mar 14 09:56:06 2011
</font><font color='#997700'>@@ -1,3 +1,14 @@
</font><font color='#000088'>+2011-03-14    Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       PR 1762/cpukit
+       * Makefile.am, preinstall.am, libmisc/Makefile.am, wrapup/Makefile.am:
+       Add generic serial mouse driver and mouse parser. The parser code was
+       in the pc386 BSP but was generic so cleaned up and placed here.
+       Serial mouse driver itself is new.
+       * libmisc/mouse/README, libmisc/mouse/mouse_parser.c,
+       libmisc/mouse/mouse_parser.h, libmisc/mouse/serial_mouse.c,
+       libmisc/mouse/serial_mouse.h: New files.
+
</font> 2011-03-14        Joel Sherrill <joel.sherrilL@OARcorp.com>
 
        * score/include/rtems/score/sysstate.h: Spelling.

<font color='#006600'>diff -u rtems/cpukit/Makefile.am:1.104 rtems/cpukit/Makefile.am:1.105
--- rtems/cpukit/Makefile.am:1.104      Wed Feb  9 00:15:53 2011
+++ rtems/cpukit/Makefile.am    Mon Mar 14 09:56:07 2011
</font><font color='#997700'>@@ -155,6 +155,10 @@
</font> ## fb
 include_rtems_HEADERS += libmisc/fb/fb.h libmisc/fb/mw_uid.h
 
<font color='#000088'>+## mouse
+include_rtems_HEADERS += libmisc/mouse/mouse_parser.h \
+    libmisc/mouse/serial_mouse.h
+
</font> ## shell
 if LIBSHELL
 include_rtems_HEADERS += libmisc/shell/shell.h libmisc/shell/shellconfig.h

<font color='#006600'>diff -u rtems/cpukit/libmisc/Makefile.am:1.88 rtems/cpukit/libmisc/Makefile.am:1.89
--- rtems/cpukit/libmisc/Makefile.am:1.88       Thu Feb 17 13:24:20 2011
+++ rtems/cpukit/libmisc/Makefile.am    Mon Mar 14 09:56:07 2011
</font><font color='#997700'>@@ -64,6 +64,11 @@
</font> noinst_LIBRARIES += libmw-fb.a
 libmw_fb_a_SOURCES = fb/mw_print.c fb/mw_uid.c fb/fb.h fb/mw_uid.h
 
<font color='#000088'>+## mouse
+noinst_LIBRARIES += libmouse.a
+libmouse_a_SOURCES = mouse/mouse_parser.c mouse/serial_mouse.c
+EXTRA_DIST += mouse/README
+
</font> ## shell
 if LIBSHELL
 noinst_LIBRARIES += libshell.a

<font color='#006600'>diff -u /dev/null rtems/cpukit/libmisc/mouse/README:1.1
--- /dev/null   Mon Mar 14 10:10:48 2011
+++ rtems/cpukit/libmisc/mouse/README   Mon Mar 14 09:56:07 2011
</font><font color='#997700'>@@ -0,0 +1,214 @@
</font><font color='#000088'>+#
+#  $Id$
+#
+
+SOURCE: http://www.kryslix.com/nsfaq/Q.12.html
+
+Subject: What protocol do mice use?
+Date: 09/16/97
+Updated: 11/16/00 This document was adapated from a web page produced by
+Tomi Engdahl <then@delta.hut.fi>
+Microsoft serial mouse
+Description
+
+The Microsoft serial mouse is the most popular 2 button mouse. It is
+supported by all major operating systems. The maximum tracking rate for
+a Microsoft mouse is 40 reports/second * 127 counts per report, in other
+words, 5080 counts per second. The most common range for mice is is 100
+to 400 CPI (counts per inch) but can be up to 1000 CPI. A 100CPI mouse
+can discriminate motion up to 50.8 inches/second while a 400 CPI mouse
+can only discriminate motion up to 12.7 inches/second.
+Pinout
+
+9 pin  25 pin    Line    Comments
+shell  1         GND
+3      2         TD      Serial data from host to mouse (only for power)
+2      3         RD      Serial data from mouse to host
+7      4         RTS     Positive voltage to mouse
+8      5         CTS
+6      6         DSR
+5      7         SGND
+4      20        DTR     Positive voltage to mouse and reset/detection
+
+RTS = Request to Send   CTS  = Clear to Send
+DSR = Data Set Ready    DTR  = Data Terminal Ready
+GND = Protective Ground SGND = Signal Ground
+
+To function correctly, both the RTS and DTR lines must be
+positive. DTR/DSR and RTS/CTS must NOT be shorted. RTS may be toggled
+negative for at least 100ms to reset the mouse. (After a cold boot, the
+RTS line is usually negative. This provides an automatic toggle when
+RTS is brought positive). When DTR is toggled the mouse should send a
+single byte 0x45 (ASCII 'M').
+
+Serial data parameters:
+1200bps, 7 databits, 1 stop-bit
+
+Data packet format:
+
+Data is sent in 3 byte packets for each event (a button is pressed or
+released or the mouse moves):
+
+        D7      D6      D5      D4      D3      D2      D1      D0
+<span style="background-color: #FF0000"> </span>
+Byte 1  X       1       LB      RB      Y7      Y6      X7      X6
+Byte 2  X       0       X5      X4      X3      X2      X1      X0<span style="background-color: #FF0000">      </span>
+Byte 3  X       0       Y5      Y4      Y3      Y2      Y1      Y0
+
+LB is the state of the left button (1 means down)
+RB is the state of the right button (1 means down)
+X7-X0 movement in X direction since last packet (signed byte)
+Y7-Y0 movement in Y direction since last packet (signed byte)
+
+The high order bit of each byte (D7) is ignored. Bit D6 indicates the start of an event, which allows the software to synchronize with the mouse.
+
+Graphical representation of a packet
+
+              1st byte        2nd byte         3rd byte
+          ================  ===============  ================
+           - 1 ? ? Y Y X X  - 0 X X X X X X  - 0 Y Y Y Y Y Y
+          ================  ===============  ================
+               | | \ / \ /      \---------/      \---------/
+               | |  |   |            |                |
+               | |  |   \----\       |                |
+               | |  \--------|-------|--------\       |
+               | |          / \ /---------\  / \ /---------\
+               | |         ================ =================
+               | |          0 0 0 0 0 0 0 0  0 0 0 0 0 0 0 0
+ Left Button --/ |         ================ =================
+Right Button ----/            X increment      Y increment
+
+3 Button Logitech extension
+
+Logitech extended the 2 button mouse protocol to support 3 button mice
+by adding a 4th byte when the middle button is pressed (and the first
+packet after it is released). If a 4th byte is encountered (i.e., an
+extra byte with D6 set to 0) then D5 of that byte (0x20) indicates the
+status of the middle mouse button.
+
+Mouse systems mouse
+
+Serial data parameters:
+
+1200bps, 8 databits, 1 stop-bit
+
+5 byte Mouse Systems packet
+
+        D7      D6      D5      D4      D3      D2      D1      D0
+
+Byte 1  1       0       0       0       0       LB      CB      RB
+Byte 2  X7      X6      X5      X4      X3      X2      X1      X0
+Byte 3  Y7      Y6      Y5      Y4      Y3      Y4      Y1      Y0
+Byte 4  X7'     X6'     X5'     X4'     X3'     X2'     X1'     X0'
+Byte 5  Y7'     Y6'     Y5'     Y4'     Y3'     Y4'     Y1'     Y0'
+
+LB is left button state (0=pressed, 1=released)
+CB is center button state (0=pressed, 1=released)
+RB is right button state (0=pressed, 1=released)
+X7-X0 movement in X direction since last packet in signed byte<span style="background-color: #FF0000"> </span>
+      format (-128..+127), positive direction right
+Y7-Y0 movement in Y direction since last packet in signed byte<span style="background-color: #FF0000"> </span>
+      format (-128..+127), positive direction up
+X7'-X0' movement in X direction since sending of X7-X0 packet in signed byte<span style="background-color: #FF0000"> </span>
+      format (-128..+127), positive direction right
+Y7'-Y0' movement in Y direction since sending of Y7-Y0 in signed byte<span style="background-color: #FF0000"> </span>
+      format (-128..+127), positive direction up
+
+The last two bytes in the packet (bytes 4 and 5) contain information
+about movement data changes which have occured after data bytes 2 and
+3 have been sent.
+
+PS/2 mouse
+
+The standard PS/2 mouse (such as the Logitech mouse) defaults to 160 CPI
+and can be switched to 40, 80, 160 or 320 CPI via software. The Microsoft
+mouse driver for Windows 3.x and Windows 95 defaults to 160 counts per
+inch. The maximum tracking rate for PS/2 mouse is 40 reports/second *
+255 counts per report, or 10200 counts per second. A 100 CPI mouse could
+discriminate motion up to 102 inches per second while a 400 CPI mouse
+could discriminate motion up to 25.2 inches per second.
+
+Connector pinout
+
+Pin     Wire Name
+1       DATA
+2       Reserved
+3       Ground
+4       +5V Supply
+5       CLK
+6       Reserved
+Shield  Chassis
+
+Packet Format
+
+        D7      D6      D5      D4      D3      D2      D1      D0
+Byte 1  XV      XV      YS      XS       1       M       R       L
+Byte 2  X7      X6      X5      X4      X3      X2      X1      X0
+Byte 3  Y7      Y6      Y5      Y4      Y3      Y2      Y1      Y0
+
+L       Left button state (1 = pressed down)
+M      Middle button state (1 = pressed down)
+R       Right button state (1 = pressed down)
+X0-X7   Movement in X direction
+Y0-Y7   Movement in Y direction
+XS,YS   Movement data sign bits (1 = negative)
+XV,YV   Movement data overflow bits (1 = overflow has occured)
+
+Physical connector
+
+The PS/2 mouse connector has the following pinout when looking at the
+connector on the back of the computer:
+
+        4 u 6
+       1  .  2
+        3   5
+
+1.      GND
+2.      +5V
+3.      DATA
+4.      CLOCK
+5.      Not used
+6.      Not used
+
+Bi-directional transmission is controlled by the CLK and DATA lines. Both
+are fed by an open collector device which lets either host or mouse force
+the line to "0". During non-transmission, CLK is at "1" and DATA can be at
+"0" or "1".
+
+The host can inhibit mouse transmission by forcing CLK to "0". If the
+host inhibits the mouse while it is transmitting, the byte must be
+retransmitted (if the inhibit state arrived before the 11th clock).
+
+Receiving data: Check 'clock'. If inactive, there is a bit on the 'data'
+line. Each transmission unit is one start bit, eight data bits, odd
+parity and one stop bit. Start bits are low, stop bits high. Each clock
+active or inactive period is 30 to 50 microseconds. Data transition to
+falling edge of clock is 5 to 25 microseconds.
+
+Sending: Check that both clock and data are high. Pull down data for
+start bit, and start clocking.
+
+NOTE: Logitech has made the extension to this protocol to allow three
+buttons (the M bit is always 0 on 2 button mice).
+
+References
+
+* Original PC mouse info page by Tomi Engdahl
+  http://www.hut.fi/~then/mytexts/mouse.html
+
+* PC Magazine May 28, 1991
+
+* Programmer's Reference to Genius Mouse
+  ftp://x2ftp.oulu.fi/pub/msdos/programming/docs/gmouse.doc
+
+* Logitech Pointing Device Hardware Information Product Support Document # 1410
+  ftp://ftp.logitech.com/pub/TechSupport/MOUSE/HELP/1410.txt
+
+* Mice: How do they work? by Richard Torrens
+  http://box.argonet.co.uk/users/4qd/meece.html
+
+* In Pursuit Of The Perfect Portable Pointer by Intelink Electronics
+from EDN Products Edition April 16, 1977 pages 43-45
+
+* Programming the Microsoft Mouse<span style="background-color: #FF0000"> </span>
+  http://www.geocities.com/SiliconValley/2151/mouse.html
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/libmisc/mouse/mouse_parser.h:1.1
--- /dev/null   Mon Mar 14 10:10:48 2011
+++ rtems/cpukit/libmisc/mouse/mouse_parser.h   Mon Mar 14 09:56:07 2011
</font><font color='#997700'>@@ -0,0 +1,108 @@
</font><font color='#000088'>+/*
+ * This file is the header file for the Mouse Parser Engine which
+ * is derived from a UNIX Serial Port Mouse Driver with the following
+ * notice:
+ *
+ * ==================================================================
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * UNIX Serial Port Mouse Driver
+ *
+ * This driver opens a serial port directly, and interprets serial data.
+ * Microsoft, PC, Logitech and PS/2 mice are supported.  The PS/2 mouse
+ * is only supported if the OS runs the mouse byte codes through the
+ * serial port.
+ *
+ * Mouse Types Supported: pc  ms, logi, ps2
+ * ==================================================================
+ *
+ * It has been modified to support the concept of being just a parser
+ * fed data from an arbitrary source.  It is independent of either<span style="background-color: #FF0000"> </span>
+ * a PS/2 driver or a serial port.
+ *
+ * It was moved to cpukit/libmisc/mouse by Joel Sherrill.
+ *
+ * $Id$
+ */
+
+#ifndef __MOUSE_PARSER_h__
+#define __MOUSE_PARSER_h__
+
+#include <rtems/mw_uid.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *  This is the mask for the right button.
+ *
+ *  @note Use the same definitions as the user interface.
+ */
+#define RBUTTON      MV_BUTTON_RIGHT
+
+/**
+ * This is the mask for the center button.
+ *
+ *  @note Use the same definitions as the user interface.
+ */
+#define MBUTTON      MV_BUTTON_CENTER
+
+/**
+ *  This is the mask for the left button.
+ *
+ *  @note Use the same definitions as the user interface.
+ */
+#define LBUTTON      MV_BUTTON_LEFT
+
+/**
+ *  This type is the device coordinates.
+ */
+typedef int           COORD;
+
+/**
+ *  This type is the mouse button mask.
+ */
+typedef unsigned int  BUTTON;
+
+/**
+ *  This type defines a pointer to the enqueue method.  It is
+ *  available since some device drivers keep pointers to the method
+ *  to know when to enqueue or not.
+ */
+typedef void (*mouse_parser_enqueue_handler)(unsigned char *, size_t);
+
+/**
+ *  @brief Initialize the Mouse Parser Engine
+ *
+ *  This method initializes the Mouse Parser Engine for the mouse
+ *  of @a type. The @a type should be one of the following strings:
+ *  pc  ms, logi, ps2.
+ *
+ *  @a param[in] type indicates the type of mouse.
+ *
+ *  @return This method returns 0 on success and -1 on error.
+ */
+int mouse_parser_initialize(const char *type);
+
+/**
+ *  @brief Enqueue Input to the Mouse Parser Engine
+ *
+ *  This method is used to pass mouse input to the Mouse Parser Engine.
+ *
+ *  @a param[in] buffer is the data to enqueue
+ *  @a param[in] size is the amount of data to enqueue
+ */
+void mouse_parser_enqueue(
+  unsigned char *buffer,
+  size_t         size
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/libmisc/mouse/mouse_parser.c:1.1
--- /dev/null   Mon Mar 14 10:10:48 2011
+++ rtems/cpukit/libmisc/mouse/mouse_parser.c   Mon Mar 14 09:56:07 2011
</font><font color='#997700'>@@ -0,0 +1,312 @@
</font><font color='#000088'>+/*
+ * This code is derived from a UNIX Serial Port Mouse Driver with
+ * the following notice:
+ *
+ * ==================================================================
+ * Copyright (c) 1999 Greg Haerr <greg@censoft.com>
+ * Portions Copyright (c) 1991 David I. Bell
+ * Permission is granted to use, distribute, or modify this source,
+ * provided that this copyright notice remains intact.
+ *
+ * UNIX Serial Port Mouse Driver
+ *
+ * This driver opens a serial port directly, and interprets serial data.
+ * Microsoft, PC, Logitech and PS/2 mice are supported.  The PS/2 mouse
+ * is only supported if the OS runs the mouse byte codes through the
+ * serial port.
+ *
+ * Mouse Types Supported: pc  ms, logi, ps2
+ * ==================================================================
+ *
+ * It has been modified to support the concept of being just a parser
+ * fed data from an arbitrary source.  It is independent of either<span style="background-color: #FF0000"> </span>
+ * a PS/2 driver or a serial port.
+ *
+ * It was moved to cpukit/libmisc/mouse by Joel Sherrill.
+ *
+ * $Id$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>  /* strcmp */
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+
+#include <rtems.h>
+#include <bsp.h>
+#include <rtems/mouse_parser.h>
+#include <rtems/mw_uid.h>
+
+/* states for the mouse */
+#define IDLE   0  /* start of byte sequence */
+#define XSET   1  /* setting x delta */
+#define YSET   2  /* setting y delta */
+#define XADD   3  /* adjusting x delta */
+#define YADD   4  /* adjusting y delta */
+
+/* values in the bytes returned by the mouse for the buttons*/
+#define PC_LEFT_BUTTON   4
+#define PC_MIDDLE_BUTTON 2
+#define PC_RIGHT_BUTTON  1
+
+#define MS_LEFT_BUTTON   2
+#define MS_RIGHT_BUTTON  1
+
+#define PS2_CTRL_BYTE    0x08
+#define PS2_LEFT_BUTTON    1
+#define PS2_RIGHT_BUTTON  2
+
+/* Bit fields in the bytes sent by the mouse.*/
+#define TOP_FIVE_BITS      0xf8
+#define BOTTOM_THREE_BITS  0x07
+#define TOP_BIT            0x80
+#define SIXTH_BIT          0x40
+#define BOTTOM_TWO_BITS    0x03
+#define THIRD_FOURTH_BITS  0x0c
+#define BOTTOM_SIX_BITS    0x3f
+
+/* local data */
+static int     state;            /* IDLE, XSET, ... */
+static BUTTON  buttons;          /* current mouse buttons pressed*/
+static BUTTON  availbuttons;     /* which buttons are available */
+static COORD   xd;               /* change in x */
+static COORD   yd;               /* change in y */
+
+static int     left;             /* because the button values change */
+static int     middle;           /* between mice, the buttons are */
+static int     right;            /* redefined */
+
+static int     (*parse)( int );  /* parse routine */
+
+/* local routines*/
+static int ParsePC(int);    /* routine to interpret PC mouse */
+static int ParseMS(int);    /* routine to interpret MS mouse */
+static int ParsePS2(int);    /* routine to interpret PS/2 mouse */
+
+/*
+ * Open up the mouse device.
+ * Returns the fd if successful, or negative if unsuccessful.
+ */
+int mouse_parser_initialize(const char *type)
+{
+  /* set button bits and parse procedure*/
+  if (!strcmp(type, "pc") || !strcmp(type, "logi")) {
+    /* pc or logitech mouse*/
+    left = PC_LEFT_BUTTON;
+    middle = PC_MIDDLE_BUTTON;
+    right = PC_RIGHT_BUTTON;
+    parse = ParsePC;
+  } else if (strcmp(type, "ms") == 0) {
+    /* microsoft mouse*/
+    left = MS_LEFT_BUTTON;
+    right = MS_RIGHT_BUTTON;
+    middle = 0;
+    parse = ParseMS;
+  } else if (strcmp(type, "ps2") == 0) {
+    /* PS/2 mouse*/
+    left = PS2_LEFT_BUTTON;
+    right = PS2_RIGHT_BUTTON;
+    middle = 0;
+    parse = ParsePS2;
+  } else
+    return -1;
+
+  printk("Device: /dev/mouse -- mouse type is: %s\n", type );
+
+  /* initialize data*/
+  availbuttons = left | middle | right;
+  state = IDLE;
+  buttons = 0;
+  xd = 0;
+  yd = 0;
+  return 0;
+}
+
+/*
+ * Attempt to read bytes from the mouse and interpret them.
+ * Returns -1 on error, 0 if either no bytes were read or not enough
+ * was read for a complete state, or 1 if the new state was read.
+ * When a new state is read, the current buttons and x and y deltas
+ * are returned.  This routine does not block.
+ */
+int MOU_Data( int ch, COORD *dx, COORD *dy, COORD *dz, BUTTON *bptr)
+{
+  int b;
+
+  if ( !parse ) {
+    printk( "Mouse parser is not initialized!\n" );
+    return -1;
+  }<span style="background-color: #FF0000"> </span>
+
+  /*
+   * Loop over all the bytes read in the buffer, parsing them.
+   * When a complete state has been read, return the results,
+   * leaving further bytes in the buffer for later calls.
+   */
+  if ( (*parse)( ch ) ) {
+    *dx = xd;
+    *dy = yd;
+    *dz = 0;
+    b = 0;
+    if (buttons & left)
+      b |= LBUTTON;
+    if (buttons & right)
+      b |= RBUTTON;
+    if (buttons & middle)
+      b |= MBUTTON;
+    *bptr = b;
+    return 1;
+  }
+  return 0;
+}
+
+/*
+ * Input routine for PC mouse.
+ * Returns nonzero when a new mouse state has been completed.
+ */
+static int ParsePC(int byte)
+{
+  int  sign;      /* sign of movement */
+
+  switch (state) {
+    case IDLE:
+      if ((byte & TOP_FIVE_BITS) == TOP_BIT) {
+        buttons = ~byte & BOTTOM_THREE_BITS;
+        state = XSET;
+      }
+      break;
+
+    case XSET:
+      sign = 1;
+      if (byte > 127) {
+        byte = 256 - byte;
+        sign = -1;
+      }
+      xd = byte * sign;
+      state = YSET;
+      break;
+
+    case YSET:
+      sign = 1;
+      if (byte > 127) {
+        byte = 256 - byte;
+        sign = -1;
+      }
+      yd = -byte * sign;
+      state = XADD;
+      break;
+
+    case XADD:
+      sign = 1;
+      if (byte > 127) {
+        byte = 256 - byte;
+        sign = -1;
+      }
+      xd += byte * sign;
+      state = YADD;
+      break;
+
+    case YADD:
+      sign = 1;
+      if (byte > 127) {
+        byte = 256 - byte;
+        sign = -1;
+      }
+      yd -= byte * sign;
+      state = IDLE;
+      return 1;
+  }
+  return 0;
+}
+
+/*
+ * Input routine for Microsoft mouse.
+ * Returns nonzero when a new mouse state has been completed.
+ */
+static int ParseMS(int byte)
+{
+  switch (state) {
+    case IDLE:
+      if (byte & SIXTH_BIT) {
+        buttons = (byte >> 4) & BOTTOM_TWO_BITS;
+        yd = ((byte & THIRD_FOURTH_BITS) << 4);
+        xd = ((byte & BOTTOM_TWO_BITS) << 6);
+        state = XADD;
+      }
+      break;
+
+    case XADD:
+      xd |= (byte & BOTTOM_SIX_BITS);
+      state = YADD;
+      break;
+
+    case YADD:
+      yd |= (byte & BOTTOM_SIX_BITS);
+      state = IDLE;
+      if (xd > 127)
+        xd -= 256;
+      if (yd > 127)
+        yd -= 256;
+      return 1;
+  }
+  return 0;
+}
+
+/*
+ * Input routine for PS/2 mouse.
+ * Returns nonzero when a new mouse state has been completed.
+ */
+static int ParsePS2(int byte)
+{
+  switch (state) {
+    case IDLE:
+      if (byte & PS2_CTRL_BYTE) {
+        buttons = byte &
+          (PS2_LEFT_BUTTON|PS2_RIGHT_BUTTON);
+        state = XSET;
+      }
+      break;
+
+    case XSET:
+      if(byte > 127)
+        byte -= 256;
+      xd = byte;
+      state = YSET;
+      break;
+
+    case YSET:
+      if(byte > 127)
+        byte -= 256;
+      yd = -byte;
+      state = IDLE;
+      return 1;
+  }
+  return 0;
+}
+
+/* generic mouse parser */
+void mouse_parser_enqueue( unsigned char *buffer, size_t size )
+{
+  COORD dx;
+  COORD dy;
+  COORD dz;
+  BUTTON bptr;
+
+  while( size-- ) {
+    if ( MOU_Data( *buffer++, &dx, &dy, &dz, &bptr ) ) {
+       struct MW_UID_MESSAGE m;
+
+        m.type = MV_UID_REL_POS;
+        /* buttons definitons have been selected to match */
+        m.m.pos.btns = bptr;
+        m.m.pos.x  = dx;
+        m.m.pos.y  = dy;
+        m.m.pos.z  = dz;
+        /* printk( "Mouse: msg: dx=%d, dy=%d, btn=%X\n", dx, dy, bptr ); */
+        uid_send_message( &m );
+    }
+  }
+}
+
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/libmisc/mouse/serial_mouse.h:1.1
--- /dev/null   Mon Mar 14 10:10:48 2011
+++ rtems/cpukit/libmisc/mouse/serial_mouse.h   Mon Mar 14 09:56:07 2011
</font><font color='#997700'>@@ -0,0 +1,156 @@
</font><font color='#000088'>+/**
+ * @file rtems/serial_mouse.h
+ *
+ *  This file describes the Serial Mouse Driver for all boards.
+ *  This driver assumes that the BSP or application will provide
+ *  an implementation of the method bsp_get_serial_mouse_device()
+ *  which tells the driver what serial port device to open() and
+ *  what type of mouse is connected.
+ *
+ *  This driver relies on the Mouse Parser Engine.
+ */
+
+/*
+ *  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$
+ */
+
+#ifndef __SERIAL_MOUSE_h__
+#define __SERIAL_MOUSE_h__
+
+/* functions */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ *  This macro defines the serial mouse device driver entry points.
+ */
+#define SERIAL_MOUSE_DRIVER_TABLE_ENTRY \
+  { serial_mouse_initialize, serial_mouse_open, serial_mouse_close, \
+    serial_mouse_read, serial_mouse_write, serial_mouse_control }
+
+/**
+ *  @brief Serial Mouse Driver Initialization
+ *
+ *  This method initializes the serial mouse driver.
+ *
+ *  @param[in] major is the mouse device major number
+ *  @param[in] minor is the mouse device minor number
+ *  @param[in] arguments points to device driver arguments
+ */
+rtems_device_driver serial_mouse_initialize(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+);
+
+/**
+ *  @brief Serial Mouse Driver Open
+ *
+ *  This method implements the Open device driver entry
+ *  point for the serial mouse driver.
+ *
+ *  @param[in] major is the mouse device major number
+ *  @param[in] minor is the mouse device minor number
+ *  @param[in] arguments points to device driver arguments
+ */
+rtems_device_driver serial_mouse_open(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+);
+
+/**
+ *  @brief Serial Mouse Driver Close
+ *
+ *  This method implements the Close device driver entry
+ *  point for the serial mouse driver.
+ *
+ *  @param[in] major is the mouse device major number
+ *  @param[in] minor is the mouse device minor number
+ *  @param[in] arguments points to device driver arguments
+ */
+rtems_device_driver serial_mouse_close(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+);
+
+/**
+ *  @brief Serial Mouse Driver Read
+ *
+ *  This method implements the Read device driver entry
+ *  point for the serial mouse driver.
+ *
+ *  @param[in] major is the mouse device major number
+ *  @param[in] minor is the mouse device minor number
+ *  @param[in] arguments points to device driver arguments
+ */
+rtems_device_driver serial_mouse_read(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+);
+
+/**
+ *  @brief Serial Mouse Driver Write
+ *
+ *  This method implements the Write device driver entry
+ *  point for the serial mouse driver.
+ *
+ *  @param[in] major is the mouse device major number
+ *  @param[in] minor is the mouse device minor number
+ *  @param[in] arguments points to device driver arguments
+ */
+rtems_device_driver serial_mouse_write(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+);
+
+/**
+ *  @brief Serial Mouse Driver IO Control
+ *
+ *  This method implements the IO Control device driver entry
+ *  point for the serial mouse driver.
+ *
+ *  @param[in] major is the mouse device major number
+ *  @param[in] minor is the mouse device minor number
+ *  @param[in] arguments points to device driver arguments
+ */
+rtems_device_driver serial_mouse_control(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+);
+
+/**
+ *  @brief Obtain Serial Mouse Configuration Information
+ *
+ *  This method is implemented by the BSP or application and
+ *  tells the driver what device to open() and what type of
+ *  mouse is connected.
+ *
+ *  @param[in] name will point to a string with the device name
+ *             of the serial port with the mouse connected.
+ *  @param[in] type will point to a string with the type of mouse connected.
+ *
+ *  @return This method returns true on success and false on error.
+ */
+bool bsp_get_serial_mouse_device(
+  const char **name,
+  const char **type
+);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif  /* __tty_drv__  */
</font>
<font color='#006600'>diff -u /dev/null rtems/cpukit/libmisc/mouse/serial_mouse.c:1.1
--- /dev/null   Mon Mar 14 10:10:48 2011
+++ rtems/cpukit/libmisc/mouse/serial_mouse.c   Mon Mar 14 09:56:07 2011
</font><font color='#997700'>@@ -0,0 +1,185 @@
</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$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <bsp.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+#include <rtems/libio.h>
+#include <termios.h>
+#include <rtems/termiostypes.h>
+#include <rtems/mouse_parser.h>
+#include <rtems/serial_mouse.h>
+
+int         serial_mouse_fd = -1;
+const char *serial_mouse_device;
+const char *serial_mouse_type;
+
+int serial_mouse_l_rint(int c, struct rtems_termios_tty *tp)
+{
+  unsigned char buf = c;
+<span style="background-color: #FF0000">  </span>
+  /* call mouse_parser( void *ptr, char *buffer, int size ) */
+  mouse_parser_enqueue( &buf, 1 );
+  return 0;
+}
+
+static struct rtems_termios_linesw serial_mouse_linesw = {
+  .l_open = NULL,
+  .l_close = NULL,
+  .l_read  = NULL,
+  .l_write = NULL,
+  .l_rint  = serial_mouse_l_rint,
+  .l_start = NULL,
+  .l_ioctl = NULL,
+  .l_modem = NULL
+};
+
+
+/*
+ *  Serial Mouse - device driver INITIALIZE entry point.
+ */
+rtems_device_driver serial_mouse_initialize(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+)
+{
+  bool status;
+
+  status = bsp_get_serial_mouse_device(
+    &serial_mouse_device,
+    &serial_mouse_type
+  );
+
+  (void) rtems_io_register_name( "/dev/mouse", major, 0 );
+
+  rtems_termios_linesw[ 6 ] = serial_mouse_linesw;
+
+  return RTEMS_SUCCESSFUL;
+}
+
+/*
+ * serial_mouse - device driver OPEN entry point
+ */
+rtems_device_driver serial_mouse_open(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *args
+)
+{
+  struct termios  termios_attr;
+  int             status;
+  int             disc = 6;
+
+  /* XXX open(2) the configured /dev/comX */
+  /* XXX save the file descriptor */
+  serial_mouse_fd = open( serial_mouse_device, O_RDONLY );
+  if ( serial_mouse_fd == -1 ) {
+   printk(
+     "Error opening serial_mouse device on %s\n",
+     serial_mouse_device
+   );
+   return RTEMS_IO_ERROR;
+  }
+
+  /* 1200-8-N-1, without hardware flow control */
+  /* BSP_uart_init( BSP_UART_PORT, 1200, CHR_8_BITS, 0, 0, 0 ); */
+  status = tcgetattr(serial_mouse_fd, &termios_attr );
+  if (status != 0) {
+    printk("Error getting mouse attributes\n");
+    return RTEMS_IO_ERROR;
+  }
+  termios_attr.c_lflag &= ~(ICANON|ECHO|ECHONL|ECHOK|ECHOE|ECHOPRT|ECHOCTL);
+  termios_attr.c_iflag &= ~(IXON|IXANY|IXOFF);
+  /*
+  termios_attr.c_cc[VMIN] = itask_VMIN;
+  termios_attr.c_cc[VTIME] = itask_VTIME;
+  */
+  termios_attr.c_cflag |= B1200;
+  termios_attr.c_cflag |= CS8;
+  status = tcsetattr( serial_mouse_fd, TCSANOW, &termios_attr );
+  if (status != 0) {
+    printk("Error setting mouse attributes\n");
+    return RTEMS_IO_ERROR;
+  }
+
+  status = ioctl(serial_mouse_fd, TIOCSETD, &disc);
+  if (status != 0) {
+    printk("Error setting mouse attributes\n");
+    return RTEMS_IO_ERROR;
+  }
+
+  sleep(5);
+  return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver serial_mouse_close(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+)
+{
+  close( serial_mouse_fd );
+
+  return RTEMS_SUCCESSFUL;
+}
+
+rtems_device_driver serial_mouse_read(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+
+rtems_device_driver serial_mouse_write(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+)
+{
+  return RTEMS_SUCCESSFUL;
+}
+
+
+rtems_device_driver serial_mouse_control(
+  rtems_device_major_number  major,
+  rtems_device_minor_number  minor,
+  void                      *arg
+)
+{
+  rtems_libio_ioctl_args_t *args = (rtems_libio_ioctl_args_t *)arg;
+
+  switch( args->command ) {
+
+    case MW_UID_REGISTER_DEVICE:
+      printk( "SerialMouse: reg=%s\n", args->buffer );
+      mouse_parser_initialize( serial_mouse_type );
+      break;
+
+    case MW_UID_UNREGISTER_DEVICE:
+      break;
+
+    default:
+      args->ioctl_return = ioctl(serial_mouse_fd, args->command, args->buffer );
+      if ( !args->ioctl_return )
+        return RTEMS_SUCCESSFUL;
+      return RTEMS_IO_ERROR;
+  }
+  args->ioctl_return = 0;
+  return RTEMS_SUCCESSFUL;
+}
</font>
<font color='#006600'>diff -u rtems/cpukit/preinstall.am:1.48 rtems/cpukit/preinstall.am:1.49
--- rtems/cpukit/preinstall.am:1.48     Wed Feb  9 00:16:10 2011
+++ rtems/cpukit/preinstall.am  Mon Mar 14 09:56:07 2011
</font><font color='#997700'>@@ -338,6 +338,14 @@
</font>   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/mw_uid.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/mw_uid.h
 
<font color='#000088'>+$(PROJECT_INCLUDE)/rtems/mouse_parser.h: libmisc/mouse/mouse_parser.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
+       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/mouse_parser.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/mouse_parser.h
+
+$(PROJECT_INCLUDE)/rtems/serial_mouse.h: libmisc/mouse/serial_mouse.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
+       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/serial_mouse.h
+PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/serial_mouse.h
+
</font> if LIBSHELL
 $(PROJECT_INCLUDE)/rtems/shell.h: libmisc/shell/shell.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/shell.h

<font color='#006600'>diff -u rtems/cpukit/wrapup/Makefile.am:1.74 rtems/cpukit/wrapup/Makefile.am:1.75
--- rtems/cpukit/wrapup/Makefile.am:1.74        Wed Jul 14 10:44:44 2010
+++ rtems/cpukit/wrapup/Makefile.am     Mon Mar 14 09:56:08 2011
</font><font color='#997700'>@@ -53,6 +53,7 @@
</font> TMP_LIBS += ../libmisc/libdevnull.a
 TMP_LIBS += ../libmisc/libdummy.a
 TMP_LIBS += ../libmisc/libfsmount.a
<font color='#000088'>+TMP_LIBS += ../libmisc/libmouse.a
</font> TMP_LIBS += ../libmisc/libmw-fb.a
 TMP_LIBS += ../libmisc/libstringto.a
 TMP_LIBS += ../libmisc/libuuid.a
</pre>
<p> </p>
<a name='cs2'></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-03-14 Joel Sherrill <joel.sherrill@oarcorp.com>

        PR 1762/cpukit
        * Makefile.am, preinstall.am, console/console.c, console/keyboard.c,
        console/keyboard.h, console/pc_keyb.c, console/ps2_mouse.c,
        console/vgainit.c: Made mouse parser engine generic. Now use generic
        serial mouse driver. Moved many externs from C to .h.
        * console/kbd_parser.c, console/serial_mouse_config.c: New files.
        * console/mouse_parser.c, console/mouse_parser.h,
        console/serial_mouse.c, console/serial_mouse.h: Removed.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/ChangeLog.diff?r1=text&tr1=1.269&r2=text&tr2=1.270&diff_format=h">M</a></td><td width='1%'>1.270</td><td width='100%'>c/src/lib/libbsp/i386/pc386/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/Makefile.am.diff?r1=text&tr1=1.56&r2=text&tr2=1.57&diff_format=h">M</a></td><td width='1%'>1.57</td><td width='100%'>c/src/lib/libbsp/i386/pc386/Makefile.am</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/console.c.diff?r1=text&tr1=1.51&r2=text&tr2=1.52&diff_format=h">M</a></td><td width='1%'>1.52</td><td width='100%'>c/src/lib/libbsp/i386/pc386/console/console.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/kbd_parser.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">c/src/lib/libbsp/i386/pc386/console/kbd_parser.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.h.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>c/src/lib/libbsp/i386/pc386/console/keyboard.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.c.diff?r1=text&tr1=1.10&r2=text&tr2=1.11&diff_format=h">M</a></td><td width='1%'>1.11</td><td width='100%'>c/src/lib/libbsp/i386/pc386/console/keyboard.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/mouse_parser.h?rev=1.5&content-type=text/vnd.viewcvs-markup">R</a></td><td width='1%'><font color="#880000">1.5</font></td><td width='100%'><font color="#880000">c/src/lib/libbsp/i386/pc386/console/mouse_parser.h</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/mouse_parser.c?rev=1.5&content-type=text/vnd.viewcvs-markup">R</a></td><td width='1%'><font color="#880000">1.5</font></td><td width='100%'><font color="#880000">c/src/lib/libbsp/i386/pc386/console/mouse_parser.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>c/src/lib/libbsp/i386/pc386/console/pc_keyb.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c.diff?r1=text&tr1=1.15&r2=text&tr2=1.16&diff_format=h">M</a></td><td width='1%'>1.16</td><td width='100%'>c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/serial_mouse.h?rev=1.7&content-type=text/vnd.viewcvs-markup">R</a></td><td width='1%'><font color="#880000">1.7</font></td><td width='100%'><font color="#880000">c/src/lib/libbsp/i386/pc386/console/serial_mouse.h</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/serial_mouse.c?rev=1.15&content-type=text/vnd.viewcvs-markup">R</a></td><td width='1%'><font color="#880000">1.15</font></td><td width='100%'><font color="#880000">c/src/lib/libbsp/i386/pc386/console/serial_mouse.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.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">c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/console/vgainit.c.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>c/src/lib/libbsp/i386/pc386/console/vgainit.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/c/src/lib/libbsp/i386/pc386/preinstall.am.diff?r1=text&tr1=1.9&r2=text&tr2=1.10&diff_format=h">M</a></td><td width='1%'>1.10</td><td width='100%'>c/src/lib/libbsp/i386/pc386/preinstall.am</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/ChangeLog:1.269 rtems/c/src/lib/libbsp/i386/pc386/ChangeLog:1.270
--- rtems/c/src/lib/libbsp/i386/pc386/ChangeLog:1.269   Fri Mar  4 15:56:44 2011
+++ rtems/c/src/lib/libbsp/i386/pc386/ChangeLog Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -1,3 +1,14 @@
</font><font color='#000088'>+2011-03-14    Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       PR 1762/cpukit
+       * Makefile.am, preinstall.am, console/console.c, console/keyboard.c,
+       console/keyboard.h, console/pc_keyb.c, console/ps2_mouse.c,
+       console/vgainit.c: Made mouse parser engine generic. Now use generic
+       serial mouse driver. Moved many externs from C to .h.
+       * console/kbd_parser.c, console/serial_mouse_config.c: New files.
+       * console/mouse_parser.c, console/mouse_parser.h,
+       console/serial_mouse.c, console/serial_mouse.h: Removed.
+
</font> 2011-03-04        Joel Sherrill <joel.sherrilL@OARcorp.com>
 
        * timer/timer.c: Retry up to 5 times when the calibration loop fails.

<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/Makefile.am:1.56 rtems/c/src/lib/libbsp/i386/pc386/Makefile.am:1.57
--- rtems/c/src/lib/libbsp/i386/pc386/Makefile.am:1.56  Fri Apr 30 06:43:01 2010
+++ rtems/c/src/lib/libbsp/i386/pc386/Makefile.am       Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -63,15 +63,15 @@
</font>     ../../../shared/clockdrv_shell.h
 
 include_rtemsdir = $(includedir)/rtems
<font color='#880000'>-include_rtems_HEADERS = console/keyboard.h console/kd.h \
-    console/serial_mouse.h console/ps2_drv.h
</font><font color='#000088'>+include_rtems_HEADERS = console/keyboard.h console/kd.h console/ps2_drv.h
</font> 
 include_HEADERS += ../../i386/shared/comm/i386_io.h
 # console
 libbsp_a_SOURCES += console/console.c console/inch.c console/outch.c \
     console/defkeymap.c console/fb_vga.c console/keyboard.c \
<font color='#880000'>-    console/mouse_parser.c console/pc_keyb.c console/ps2_mouse.c \
-    console/serial_mouse.c console/vgainit.c console/vt.c console/videoAsm.S \
</font><font color='#000088'>+    console/pc_keyb.c console/ps2_mouse.c \
+    console/vgainit.c console/vt.c console/videoAsm.S \
+    console/kbd_parser.c console/serial_mouse_config.c \
</font>     ../../i386/shared/comm/uart.c ../../i386/shared/comm/tty_drv.c
 
 # gdb

<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/console/console.c:1.51 rtems/c/src/lib/libbsp/i386/pc386/console/console.c:1.52
--- rtems/c/src/lib/libbsp/i386/pc386/console/console.c:1.51    Fri Jan 28 14:35:34 2011
+++ rtems/c/src/lib/libbsp/i386/pc386/console/console.c Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -1,6 +1,4 @@
</font> /*-------------------------------------------------------------------------+
<font color='#880000'>-| console.c v1.1 - PC386 BSP - 1997/08/07
-+--------------------------------------------------------------------------+
</font> | This file contains the PC386 console I/O package.
 +--------------------------------------------------------------------------+
 | (C) Copyright 1997 -
<font color='#997700'>@@ -15,17 +13,16 @@
</font> | This file is provided "AS IS" without warranty of any kind, either
 | expressed or implied.
 +--------------------------------------------------------------------------+
<font color='#880000'>-| This code is based on:
-|   console.c,v 1.4 1995/12/19 20:07:23 joel Exp - go32 BSP
-| With the following copyright notice:
-| **************************************************************************
-| *  COPYRIGHT (c) 1989-1999.
-| *  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.
-| **************************************************************************
</font><font color='#000088'>+| This code was based on code from the go32 BSP and was copyright by OAR.
+| Subsequent modifications are also copyright OAR.
+|
+|  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.
+|
</font> |
 |  $Id$
 +--------------------------------------------------------------------------*/
<font color='#997700'>@@ -44,7 +41,8 @@
</font> #include <libcpu/cpuModel.h>
 
 #include <rtems/mw_uid.h>
<font color='#880000'>-#include "mouse_parser.h"
</font><font color='#000088'>+#include <rtems/mouse_parser.h>
+#include <rtems/keyboard.h>
</font> 
 /*
  * Possible value for console input/output :
<font color='#997700'>@@ -71,32 +69,21 @@
</font> int BSPBaseBaud    = 115200;
 int BSPCmdBaud     = 9600;
 
<font color='#880000'>-extern BSP_polling_getchar_function_type BSP_poll_char;
-extern int getch( void );
-extern void kbd_init( void );
</font><font color='#000088'>+
+/* printk support */
+BSP_output_char_function_type BSP_output_char =
+                       (BSP_output_char_function_type) _IBMPC_outch;
+
+BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input;
</font> 
 /*-------------------------------------------------------------------------+
 | External Prototypes
 +--------------------------------------------------------------------------*/
<font color='#880000'>-extern void keyboard_interrupt(void );
-extern void keyboard_interrupt_wrapper(void *);
-extern int BSP_wait_polled_input(void);
-extern void _IBMPC_initVideo(void);
-
</font> static int  conSetAttr(int minor, const struct termios *);
<font color='#880000'>-static void isr_on(const rtems_irq_connect_data *);
-static void isr_off(const rtems_irq_connect_data *);
-static int  isr_is_on(const rtems_irq_connect_data *);
-
-extern int rtems_kbpoll( void );
-
-static rtems_irq_connect_data console_isr_data = {BSP_KEYBOARD,
-                                                  keyboard_interrupt_wrapper,
-                                                  0,
-                                                  isr_on,
-                                                  isr_off,
-                                                  isr_is_on};
</font> 
<font color='#000088'>+/*
+ *  Keyboard Interrupt Configuration
+ */
</font> static void
 isr_on(const rtems_irq_connect_data *unused)
 {
<font color='#997700'>@@ -115,7 +102,13 @@
</font>   return BSP_irq_enabled_at_i8259s(irq->name);
 }
 
<font color='#880000'>-extern int  rtems_kbpoll( void );
</font><font color='#000088'>+static rtems_irq_connect_data console_isr_data =
+  {BSP_KEYBOARD,
+   keyboard_interrupt,
+   0,
+   isr_on,
+   isr_off,
+   isr_is_on};
</font> 
 static ssize_t
 ibmpc_console_write(int minor, const char *buf, size_t len)
<font color='#997700'>@@ -472,8 +465,6 @@
</font>   return RTEMS_SUCCESSFUL;
 } /* console_write */
 
<font color='#880000'>-extern int vt_ioctl( unsigned int cmd, unsigned long arg);
-
</font> /*
  * Handle ioctl request.
  */
<font color='#997700'>@@ -550,16 +541,3 @@
</font>   
   return 0;
 }
<font color='#880000'>-
-void keyboard_interrupt_wrapper(void *unused){
-  keyboard_interrupt();
-}
-
-/*
- * BSP initialization
- */
-
-BSP_output_char_function_type BSP_output_char =
-                       (BSP_output_char_function_type) _IBMPC_outch;
-
-BSP_polling_getchar_function_type BSP_poll_char = BSP_wait_polled_input;
</font>
<font color='#006600'>diff -u /dev/null rtems/c/src/lib/libbsp/i386/pc386/console/kbd_parser.c:1.1
--- /dev/null   Mon Mar 14 10:10:49 2011
+++ rtems/c/src/lib/libbsp/i386/pc386/console/kbd_parser.c      Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -0,0 +1,49 @@
</font><font color='#000088'>+/*
+ *  The contents of this file were formerly in console.c which
+ *  had the following copyright notice:
+ *
+ *  (C) Copyright 1997
+ *  NavIST Group - Real-Time Distributed Systems and Industrial Automation
+ *  http://pandora.ist.utl.pt
+ *  Instituto Superior Tecnico * Lisboa * PORTUGAL
+ *
+ *  The original code and subsequent modifications are:
+ *
+ *  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$
+ */
+
+#include <rtems.h>
+#include <rtems/keyboard.h>
+#include <rtems/mw_uid.h>
+
+/* adds a kbd message to the queue */
+static void kbd_parser( void *ptr, unsigned short keycode, unsigned long mods )
+{
+  struct MW_UID_MESSAGE m;
+  struct kbd_struct * kbd = (struct kbd_struct *)ptr;
+
+  m.type = MV_UID_KBD;
+  m.m.kbd.code       = keycode;
+  m.m.kbd.modifiers  = kbd->ledflagstate;
+  m.m.kbd.mode       = kbd->kbdmode;
+  /*  printk( "kbd: msg: keycode=%X, mod=%X\n", keycode, mods );  */
+
+  uid_send_message( &m );
+}
+
+void register_kbd_msg_queue( char *q_name, int port )
+{
+  kbd_set_driver_handler( kbd_parser );
+}
+
+void unregister_kbd_msg_queue( int port )
+{
+   kbd_set_driver_handler( NULL );
+}
</font>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.h:1.5 rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.h:1.6
--- rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.h:1.5    Fri Feb 18 15:05:49 2005
+++ rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.h        Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -1,8 +1,7 @@
</font> /*
<font color='#880000'>- * $Id$
- *
</font>  *  Submitted by: Rosimildo da Silva:  rdasilva@connecttel.com
  *
<font color='#000088'>+ *  $Id$
</font>  */
 
 #ifndef __RTEMS_KEYBOARD_H
<font color='#997700'>@@ -497,10 +496,10 @@
</font> 
 extern struct kbd_struct kbd_table[];
 
<font color='#880000'>-extern int kbd_init(void);
</font> 
<font color='#880000'>-extern unsigned char getledstate(void);
-extern void setledstate(struct kbd_struct *kbd, unsigned int led);
</font><font color='#000088'>+void kbd_set_driver_handler(
+  void ( *handler )( void *, unsigned short, unsigned long )
+);
</font> 
 static inline void show_console(void)
 {
<font color='#997700'>@@ -510,69 +509,90 @@
</font> {
 }
 
<font color='#880000'>-extern void set_leds(void);
</font><font color='#000088'>+void set_leds(void);
</font> 
 static inline int vc_kbd_mode(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   return ((kbd->modeflags >> flag) & 1);
</font><font color='#000088'>+  return ((kbd->modeflags >> flag) & 1);
</font> }
 
 static inline int vc_kbd_led(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   return ((kbd->ledflagstate >> flag) & 1);
</font><font color='#000088'>+  return ((kbd->ledflagstate >> flag) & 1);
</font> }
 
 static inline void set_vc_kbd_mode(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   kbd->modeflags |= 1 << flag;
</font><font color='#000088'>+  kbd->modeflags |= 1 << flag;
</font> }
 
 static inline void set_vc_kbd_led(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   kbd->ledflagstate |= 1 << flag;
</font><font color='#000088'>+  kbd->ledflagstate |= 1 << flag;
</font> }
 
 static inline void clr_vc_kbd_mode(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   kbd->modeflags &= ~(1 << flag);
</font><font color='#000088'>+  kbd->modeflags &= ~(1 << flag);
</font> }
 
 static inline void clr_vc_kbd_led(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   kbd->ledflagstate &= ~(1 << flag);
</font><font color='#000088'>+  kbd->ledflagstate &= ~(1 << flag);
</font> }
 
 static inline void chg_vc_kbd_lock(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   kbd->lockstate ^= 1 << flag;
</font><font color='#000088'>+  kbd->lockstate ^= 1 << flag;
</font> }
 
 static inline void chg_vc_kbd_slock(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   kbd->slockstate ^= 1 << flag;
</font><font color='#000088'>+  kbd->slockstate ^= 1 << flag;
</font> }
 
 static inline void chg_vc_kbd_mode(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   kbd->modeflags ^= 1 << flag;
</font><font color='#000088'>+  kbd->modeflags ^= 1 << flag;
</font> }
 
 static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag)
 {
<font color='#880000'>-   kbd->ledflagstate ^= 1 << flag;
-   set_leds();
</font><font color='#000088'>+  kbd->ledflagstate ^= 1 << flag;
+  set_leds();
</font> }
 
 #define U(x) ((x) ^ 0xf000)
 
 /* keyboard.c */
<font color='#880000'>-
</font><font color='#000088'>+int kbd_init(void);
</font> int getkeycode(unsigned int scancode);
 int setkeycode(unsigned int scancode, unsigned int keycode);
 void compute_shiftstate(void);
<font color='#000088'>+unsigned char getledstate(void);
+void setledstate(struct kbd_struct *kbd, unsigned int led);
+void handle_scancode(unsigned char scancode, int down);
+
+/* kbd_parser.c */
+void register_kbd_msg_queue( char *qname, int port );
+void unregister_kbd_msg_queue( int port );
</font> 
 /* defkeymap.c */
<font color='#880000'>-
</font> extern unsigned int keymap_count;
 
<font color='#000088'>+/* inch.c */
+void add_to_queue( unsigned short );
+int getch( void );
+int BSP_wait_polled_input(void);
+int rtems_kbpoll( void );
+
+/* outch.c */
+void _IBMPC_initVideo(void);
+
+/* pc_keyb.c */
+void keyboard_interrupt(void *unused);
+
+/* vt.c */
+int vt_ioctl( unsigned int cmd, unsigned long arg);
+
</font> #endif

<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.c:1.10 rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.c:1.11
--- rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.c:1.10   Mon Sep 22 16:49:43 2008
+++ rtems/c/src/lib/libbsp/i386/pc386/console/keyboard.c        Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -30,8 +30,6 @@
</font> #define KBD_DEFLOCK 0
 #endif
 
<font color='#880000'>-extern void add_to_queue( unsigned short );
-
</font> int set_bit(int nr, unsigned long * addr)
 {
   int                   mask;

<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c:1.5 rtems/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c:1.6
--- rtems/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c:1.5     Wed Sep 12 10:16:00 2007
+++ rtems/c/src/lib/libbsp/i386/pc386/console/pc_keyb.c Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -21,11 +21,9 @@
</font> #include <errno.h>
 
 #include <bsp.h>
<font color='#000088'>+#include <rtems/keyboard.h>
</font> #include "i386kbd.h"
 
<font color='#880000'>-/* keyboard.c */
-extern void handle_scancode(unsigned char scancode, int down);
-
</font> static unsigned char handle_kbd_event(void);
 static void kbd_write_command_w(int data);
 static void kbd_write_output_w(int data);
<font color='#997700'>@@ -384,7 +382,7 @@
</font>   return status;
 }
 
<font color='#880000'>-void keyboard_interrupt( void )
</font><font color='#000088'>+void keyboard_interrupt(void *unused)
</font> {
        handle_kbd_event();
 }
<font color='#997700'>@@ -627,17 +625,3 @@
</font> #endif
 
 }
<font color='#880000'>-
-/*
-char BSP_wait_polled_input( void )
-{
-  int                   c;
-  rtems_interrupt_level level;
-
-  rtems_interrupt_disable(level);
-  while ( ( c= kbd_wait_for_input() ) < 0 )
-      continue;
-  rtems_interrupt_enable(level);
-  return c;
-}
-*/
</font>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c:1.15 rtems/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c:1.16
--- rtems/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c:1.15  Wed Feb  9 09:57:29 2011
+++ rtems/c/src/lib/libbsp/i386/pc386/console/ps2_mouse.c       Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -9,9 +9,9 @@
</font>  * Code fixes to handle mouse ACKs properly.
  * C. Scott Ananian <cananian@alumni.princeton.edu> 1999-01-29.
  *
<font color='#880000'>- * RTEMS port: by Rosimildo da Silva.
- * This module was ported from Linux.
</font><font color='#000088'>+ *  RTEMS port: by Rosimildo da Silva.
</font>  *
<font color='#000088'>+ *  $Id$
</font>  */
 
 #include <stdlib.h>
<font color='#997700'>@@ -26,11 +26,11 @@
</font> #include <termios.h>
 #include <i386_io.h>
 #include <rtems/mw_uid.h>
<font color='#000088'>+#include <rtems/mouse_parser.h>
</font> 
 #define  INITIALIZE_MOUSE
 /* Some configuration switches are present in the include file... */
 #include "ps2_mouse.h"
<font color='#880000'>-#include "mouse_parser.h"
</font> 
 static void kbd_write_command_w(int data);
 #if 0
<font color='#997700'>@@ -59,14 +59,16 @@
</font> #define MAX_RETRIES       60              /* some aux operations take long time*/
 
 static void ps2_mouse_interrupt(rtems_irq_hdl_param);
<font color='#880000'>-
-static void ( *driver_input_handler_ps2 )( void *,  unsigned char *, int ) = 0;
</font><font color='#000088'>+static mouse_parser_enqueue_handler driver_input_handler_ps2 = NULL;
</font> 
 /*
  * This routine sets the handler to handle the characters received
  * from the serial port.
  */
<font color='#880000'>-void ps2_set_driver_handler( int port, void ( *handler )( void *,  unsigned char *, int ) )
</font><font color='#000088'>+void ps2_set_driver_handler(
+  int                          port,
+  mouse_parser_enqueue_handler handler
+)
</font> {
   driver_input_handler_ps2 = handler;
 }
<font color='#997700'>@@ -185,7 +187,7 @@
</font> 
     /* if the input queue is active, add to it */
     if( driver_input_handler_ps2 ) {
<font color='#880000'>-      driver_input_handler_ps2( NULL,  &scancode, 1 );
</font><font color='#000088'>+      driver_input_handler_ps2( &scancode, 1 );
</font>     } else {
       /* post this byte to termios */
       rtems_termios_enqueue_raw_characters( termios_ttyp_paux, (char *)&scancode, 1 );
<font color='#997700'>@@ -557,12 +559,16 @@
</font>       break;
 
     case MW_UID_REGISTER_DEVICE:
<font color='#880000'>-      printk( "PS2 Mouse: reg=%s\n", args->buffer );
-      register_mou_msg_queue( args->buffer, -1 );
</font><font color='#000088'>+      printk( "PS2 Mouse: registering\n" );
+      mouse_parser_initialize( "ps2" );
+      ps2_set_driver_handler( minor, mouse_parser_enqueue );
</font>       break;
 
     case MW_UID_UNREGISTER_DEVICE:
<font color='#000088'>+/*
</font>       unregister_mou_msg_queue( -1 );
<font color='#000088'>+*/
+      ps2_set_driver_handler( minor, NULL );
</font>       break;
   }
   args->ioctl_return = 0;

<font color='#006600'>diff -u /dev/null rtems/c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c:1.1
--- /dev/null   Mon Mar 14 10:10:49 2011
+++ rtems/c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c     Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -0,0 +1,54 @@
</font><font color='#000088'>+/*
+ *  COPYRIGHT (c) 1989-2007.
+ *  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$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <bsp.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+/* select which serial port the mouse is connected to */
+/* XXX - Hook these somewhere */
+#ifdef   SERIAL_MOUSE_COM1
+  #define SERIAL_MOUSE_COM  1
+#elif defined(SERIAL_MOUSE_COM2)
+  #define SERIAL_MOUSE_COM  2
+#else
+  /* Select Default to be COM1  */
+  #define SERIAL_MOUSE_COM  1
+#endif
+
+extern int BSPConsolePort;
+
+bool bsp_get_serial_mouse_device(
+  const char **name,
+  const char **type
+)
+{
+  #ifdef SERIAL_MOUSE_COM2
+    *name = "/dev/ttyS2";
+  #else
+    *name = "/dev/ttyS1";
+  #endif
+<span style="background-color: #FF0000">  </span>
+  *type = "ms";
+
+  /* Check if this port is not been used as console */
+  /* XXX configure the serial port, take boot args additionally */
+  if ( BSPConsolePort == SERIAL_MOUSE_COM ) {
+    printk( "SERIAL MOUSE: port selected as console.(%s)\n", *name );
+    rtems_fatal_error_occurred( -1 );
+  }
+
+  printk("Mouse Device: %s\n", *name );
+  return name;
+}
</font>
<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/console/vgainit.c:1.5 rtems/c/src/lib/libbsp/i386/pc386/console/vgainit.c:1.6
--- rtems/c/src/lib/libbsp/i386/pc386/console/vgainit.c:1.5     Wed Jan 19 15:27:39 2005
+++ rtems/c/src/lib/libbsp/i386/pc386/console/vgainit.c Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -58,7 +58,6 @@
</font>   int data2;
 } REGIO;
 
<font color='#880000'>-/* extern data*/
</font> #if ROMFONT
 extern FARADDR<span style="background-color: #FF0000"> </span>           rom_char_addr;          /* address of ROM font*/
 extern int             ROM_CHAR_HEIGHT;        /* ROM character height*/

<font color='#006600'>diff -u rtems/c/src/lib/libbsp/i386/pc386/preinstall.am:1.9 rtems/c/src/lib/libbsp/i386/pc386/preinstall.am:1.10
--- rtems/c/src/lib/libbsp/i386/pc386/preinstall.am:1.9 Fri Apr 30 06:43:01 2010
+++ rtems/c/src/lib/libbsp/i386/pc386/preinstall.am     Mon Mar 14 09:57:00 2011
</font><font color='#997700'>@@ -106,10 +106,6 @@
</font>   $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/kd.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/kd.h
 
<font color='#880000'>-$(PROJECT_INCLUDE)/rtems/serial_mouse.h: console/serial_mouse.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
-       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/serial_mouse.h
-PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/serial_mouse.h
-
</font> $(PROJECT_INCLUDE)/rtems/ps2_drv.h: console/ps2_drv.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/ps2_drv.h
 PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/ps2_drv.h
</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>