forked from Imagelibrary/rtems
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.
This commit is contained in:
@@ -1,3 +1,14 @@
|
||||
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.
|
||||
|
||||
2011-03-04 Joel Sherrill <joel.sherrilL@OARcorp.com>
|
||||
|
||||
* timer/timer.c: Retry up to 5 times when the calibration loop fails.
|
||||
|
||||
@@ -63,15 +63,15 @@ libbsp_a_SOURCES += clock/ckinit.c clock/todcfg.c ../../shared/tod.c \
|
||||
../../../shared/clockdrv_shell.h
|
||||
|
||||
include_rtemsdir = $(includedir)/rtems
|
||||
include_rtems_HEADERS = console/keyboard.h console/kd.h \
|
||||
console/serial_mouse.h console/ps2_drv.h
|
||||
include_rtems_HEADERS = console/keyboard.h console/kd.h console/ps2_drv.h
|
||||
|
||||
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 \
|
||||
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 \
|
||||
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 \
|
||||
../../i386/shared/comm/uart.c ../../i386/shared/comm/tty_drv.c
|
||||
|
||||
# gdb
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
/*-------------------------------------------------------------------------+
|
||||
| console.c v1.1 - PC386 BSP - 1997/08/07
|
||||
+--------------------------------------------------------------------------+
|
||||
| This file contains the PC386 console I/O package.
|
||||
+--------------------------------------------------------------------------+
|
||||
| (C) Copyright 1997 -
|
||||
@@ -15,17 +13,16 @@
|
||||
| This file is provided "AS IS" without warranty of any kind, either
|
||||
| expressed or implied.
|
||||
+--------------------------------------------------------------------------+
|
||||
| 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.
|
||||
| **************************************************************************
|
||||
| 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.
|
||||
|
|
||||
|
|
||||
| $Id$
|
||||
+--------------------------------------------------------------------------*/
|
||||
@@ -44,7 +41,8 @@
|
||||
#include <libcpu/cpuModel.h>
|
||||
|
||||
#include <rtems/mw_uid.h>
|
||||
#include "mouse_parser.h"
|
||||
#include <rtems/mouse_parser.h>
|
||||
#include <rtems/keyboard.h>
|
||||
|
||||
/*
|
||||
* Possible value for console input/output :
|
||||
@@ -71,32 +69,21 @@ int BSPPrintkPort = BSP_CONSOLE_PORT_CONSOLE;
|
||||
int BSPBaseBaud = 115200;
|
||||
int BSPCmdBaud = 9600;
|
||||
|
||||
extern BSP_polling_getchar_function_type BSP_poll_char;
|
||||
extern int getch( void );
|
||||
extern void kbd_init( void );
|
||||
|
||||
/* 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;
|
||||
|
||||
/*-------------------------------------------------------------------------+
|
||||
| External Prototypes
|
||||
+--------------------------------------------------------------------------*/
|
||||
extern void keyboard_interrupt(void );
|
||||
extern void keyboard_interrupt_wrapper(void *);
|
||||
extern int BSP_wait_polled_input(void);
|
||||
extern void _IBMPC_initVideo(void);
|
||||
|
||||
static int conSetAttr(int minor, const struct termios *);
|
||||
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};
|
||||
|
||||
/*
|
||||
* Keyboard Interrupt Configuration
|
||||
*/
|
||||
static void
|
||||
isr_on(const rtems_irq_connect_data *unused)
|
||||
{
|
||||
@@ -115,7 +102,13 @@ isr_is_on(const rtems_irq_connect_data *irq)
|
||||
return BSP_irq_enabled_at_i8259s(irq->name);
|
||||
}
|
||||
|
||||
extern int rtems_kbpoll( void );
|
||||
static rtems_irq_connect_data console_isr_data =
|
||||
{BSP_KEYBOARD,
|
||||
keyboard_interrupt,
|
||||
0,
|
||||
isr_on,
|
||||
isr_off,
|
||||
isr_is_on};
|
||||
|
||||
static ssize_t
|
||||
ibmpc_console_write(int minor, const char *buf, size_t len)
|
||||
@@ -472,8 +465,6 @@ console_write(rtems_device_major_number major,
|
||||
return RTEMS_SUCCESSFUL;
|
||||
} /* console_write */
|
||||
|
||||
extern int vt_ioctl( unsigned int cmd, unsigned long arg);
|
||||
|
||||
/*
|
||||
* Handle ioctl request.
|
||||
*/
|
||||
@@ -550,16 +541,3 @@ conSetAttr(int minor, const struct termios *t)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
49
c/src/lib/libbsp/i386/pc386/console/kbd_parser.c
Normal file
49
c/src/lib/libbsp/i386/pc386/console/kbd_parser.c
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* 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 );
|
||||
}
|
||||
@@ -30,8 +30,6 @@
|
||||
#define KBD_DEFLOCK 0
|
||||
#endif
|
||||
|
||||
extern void add_to_queue( unsigned short );
|
||||
|
||||
int set_bit(int nr, unsigned long * addr)
|
||||
{
|
||||
int mask;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/*
|
||||
* $Id$
|
||||
*
|
||||
* Submitted by: Rosimildo da Silva: rdasilva@connecttel.com
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RTEMS_KEYBOARD_H
|
||||
@@ -497,10 +496,10 @@ struct kbd_struct {
|
||||
|
||||
extern struct kbd_struct kbd_table[];
|
||||
|
||||
extern int kbd_init(void);
|
||||
|
||||
extern unsigned char getledstate(void);
|
||||
extern void setledstate(struct kbd_struct *kbd, unsigned int led);
|
||||
void kbd_set_driver_handler(
|
||||
void ( *handler )( void *, unsigned short, unsigned long )
|
||||
);
|
||||
|
||||
static inline void show_console(void)
|
||||
{
|
||||
@@ -510,7 +509,7 @@ static inline void set_console(int nr)
|
||||
{
|
||||
}
|
||||
|
||||
extern void set_leds(void);
|
||||
void set_leds(void);
|
||||
|
||||
static inline int vc_kbd_mode(struct kbd_struct * kbd, int flag)
|
||||
{
|
||||
@@ -566,13 +565,34 @@ static inline void chg_vc_kbd_led(struct kbd_struct * kbd, int flag)
|
||||
#define U(x) ((x) ^ 0xf000)
|
||||
|
||||
/* keyboard.c */
|
||||
|
||||
int kbd_init(void);
|
||||
int getkeycode(unsigned int scancode);
|
||||
int setkeycode(unsigned int scancode, unsigned int keycode);
|
||||
void compute_shiftstate(void);
|
||||
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 );
|
||||
|
||||
/* defkeymap.c */
|
||||
|
||||
extern unsigned int keymap_count;
|
||||
|
||||
/* 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);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,398 +0,0 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* The following environment variables control the mouse type expected
|
||||
* and the serial port to open.
|
||||
*
|
||||
* Environment Var Default Allowed
|
||||
* MOUSE_TYPE pc ms, pc, logi, ps2
|
||||
*/
|
||||
#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 "keyboard.h"
|
||||
#include "mouse_parser.h"
|
||||
#include "serial_mouse.h"
|
||||
|
||||
/* NOTE NOTE NOTE NOTE:
|
||||
Select here the mouse type !!!!!
|
||||
*/
|
||||
#ifndef MOUSE_TYPE
|
||||
#define MOUSE_TYPE "ms" /* default mouse type "ms","pc","ps2" */
|
||||
#endif
|
||||
|
||||
/* 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 */
|
||||
|
||||
extern void uart_set_driver_handler( int port, void ( *handler )( void *, char *, int ) );
|
||||
extern void kbd_set_driver_handler( void ( *handler )( void *, unsigned short, unsigned long ) );
|
||||
extern void ps2_set_driver_handler( int port, void ( *handler )( void *, char *, int ) );
|
||||
|
||||
/*
|
||||
* Open up the mouse device.
|
||||
* Returns the fd if successful, or negative if unsuccessful.
|
||||
*/
|
||||
int MOU_Init(void)
|
||||
{
|
||||
char *type;
|
||||
|
||||
/* get mouse type and port*/
|
||||
type = MOUSE_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", MOUSE_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;
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
static rtems_id queue_id = 0;
|
||||
|
||||
/* generic keyboard parser */
|
||||
static void mouse_parser( void *ptr, char *buffer, int 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 ); */
|
||||
rtems_message_queue_send( queue_id, ( void * )&m, sizeof( struct MW_UID_MESSAGE ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* enable the mouse to add messages to the queue */
|
||||
void register_mou_msg_queue( char * q_name, int port )
|
||||
{
|
||||
rtems_name queue_name;
|
||||
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_ident( queue_name, RTEMS_LOCAL, &queue_id );
|
||||
if( status != RTEMS_SUCCESSFUL )
|
||||
{
|
||||
printk( "UID_Queue: error open queue: %d\n", status );
|
||||
return;
|
||||
}
|
||||
MOU_Init();
|
||||
if( port == -1 )
|
||||
{
|
||||
/* we know the mouse type in this case, let's initialize everything */
|
||||
left = PS2_LEFT_BUTTON;
|
||||
right = PS2_RIGHT_BUTTON;
|
||||
middle = 0;
|
||||
parse = ParsePS2;
|
||||
ps2_set_driver_handler( port, mouse_parser );
|
||||
}
|
||||
else
|
||||
{
|
||||
uart_set_driver_handler( port, mouse_parser );
|
||||
}
|
||||
}
|
||||
|
||||
/* stop the mouse from adding messages to the queue */
|
||||
void unregister_mou_msg_queue( int port )
|
||||
{
|
||||
if( port == -1 )
|
||||
{
|
||||
ps2_set_driver_handler( port, NULL );
|
||||
}
|
||||
else
|
||||
{
|
||||
uart_set_driver_handler( port, NULL );
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 ); */
|
||||
rtems_message_queue_send( queue_id, ( void * )&m,
|
||||
sizeof( struct MW_UID_MESSAGE ) );
|
||||
}
|
||||
|
||||
void register_kbd_msg_queue( char *q_name, int port )
|
||||
{
|
||||
rtems_name queue_name;
|
||||
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_ident( queue_name, RTEMS_LOCAL, &queue_id );
|
||||
if( status != RTEMS_SUCCESSFUL )
|
||||
{
|
||||
printk( "UID_Queue: error open queue: %d\n", status );
|
||||
return;
|
||||
}
|
||||
kbd_set_driver_handler( kbd_parser );
|
||||
}
|
||||
|
||||
void unregister_kbd_msg_queue( int port )
|
||||
{
|
||||
kbd_set_driver_handler( NULL );
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef __mouse_parser_h__
|
||||
#define __mouse_parser_h__
|
||||
|
||||
#include <rtems/mw_uid.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Use the same definitions as the user interface */
|
||||
#define RBUTTON MV_BUTTON_RIGHT
|
||||
#define MBUTTON MV_BUTTON_CENTER
|
||||
#define LBUTTON MV_BUTTON_LEFT
|
||||
|
||||
typedef int COORD; /* device coordinates*/
|
||||
typedef unsigned int BUTTON; /* mouse button mask*/
|
||||
|
||||
/* local routines */
|
||||
int MOU_Init(void);
|
||||
int MOU_Data( int ch, COORD *dx, COORD *dy, COORD *dz, BUTTON *bptr );
|
||||
|
||||
/* Mouse Interface */
|
||||
void register_mou_msg_queue( char * qname, int port );
|
||||
void unregister_mou_msg_queue( int port );
|
||||
|
||||
/* KBD Interface */
|
||||
void register_kbd_msg_queue( char *qname, int port );
|
||||
void unregister_kbd_msg_queue( int port );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __mouse_parser_h__ */
|
||||
@@ -21,11 +21,9 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <rtems/keyboard.h>
|
||||
#include "i386kbd.h"
|
||||
|
||||
/* keyboard.c */
|
||||
extern void handle_scancode(unsigned char scancode, int down);
|
||||
|
||||
static unsigned char handle_kbd_event(void);
|
||||
static void kbd_write_command_w(int data);
|
||||
static void kbd_write_output_w(int data);
|
||||
@@ -384,7 +382,7 @@ static unsigned char handle_kbd_event(void)
|
||||
return status;
|
||||
}
|
||||
|
||||
void keyboard_interrupt( void )
|
||||
void keyboard_interrupt(void *unused)
|
||||
{
|
||||
handle_kbd_event();
|
||||
}
|
||||
@@ -627,17 +625,3 @@ void pckbd_init_hw(void)
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
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;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -10,8 +10,8 @@
|
||||
* C. Scott Ananian <cananian@alumni.princeton.edu> 1999-01-29.
|
||||
*
|
||||
* RTEMS port: by Rosimildo da Silva.
|
||||
* This module was ported from Linux.
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -26,11 +26,11 @@
|
||||
#include <termios.h>
|
||||
#include <i386_io.h>
|
||||
#include <rtems/mw_uid.h>
|
||||
#include <rtems/mouse_parser.h>
|
||||
|
||||
#define INITIALIZE_MOUSE
|
||||
/* Some configuration switches are present in the include file... */
|
||||
#include "ps2_mouse.h"
|
||||
#include "mouse_parser.h"
|
||||
|
||||
static void kbd_write_command_w(int data);
|
||||
#if 0
|
||||
@@ -59,14 +59,16 @@ static unsigned char mouse_reply_expected = 0;
|
||||
#define MAX_RETRIES 60 /* some aux operations take long time*/
|
||||
|
||||
static void ps2_mouse_interrupt(rtems_irq_hdl_param);
|
||||
|
||||
static void ( *driver_input_handler_ps2 )( void *, unsigned char *, int ) = 0;
|
||||
static mouse_parser_enqueue_handler driver_input_handler_ps2 = NULL;
|
||||
|
||||
/*
|
||||
* This routine sets the handler to handle the characters received
|
||||
* from the serial port.
|
||||
*/
|
||||
void ps2_set_driver_handler( int port, void ( *handler )( void *, unsigned char *, int ) )
|
||||
void ps2_set_driver_handler(
|
||||
int port,
|
||||
mouse_parser_enqueue_handler handler
|
||||
)
|
||||
{
|
||||
driver_input_handler_ps2 = handler;
|
||||
}
|
||||
@@ -185,7 +187,7 @@ static inline void handle_mouse_event(unsigned char scancode)
|
||||
|
||||
/* if the input queue is active, add to it */
|
||||
if( driver_input_handler_ps2 ) {
|
||||
driver_input_handler_ps2( NULL, &scancode, 1 );
|
||||
driver_input_handler_ps2( &scancode, 1 );
|
||||
} else {
|
||||
/* post this byte to termios */
|
||||
rtems_termios_enqueue_raw_characters( termios_ttyp_paux, (char *)&scancode, 1 );
|
||||
@@ -557,12 +559,16 @@ rtems_device_driver paux_control(
|
||||
break;
|
||||
|
||||
case MW_UID_REGISTER_DEVICE:
|
||||
printk( "PS2 Mouse: reg=%s\n", args->buffer );
|
||||
register_mou_msg_queue( args->buffer, -1 );
|
||||
printk( "PS2 Mouse: registering\n" );
|
||||
mouse_parser_initialize( "ps2" );
|
||||
ps2_set_driver_handler( minor, mouse_parser_enqueue );
|
||||
break;
|
||||
|
||||
case MW_UID_UNREGISTER_DEVICE:
|
||||
/*
|
||||
unregister_mou_msg_queue( -1 );
|
||||
*/
|
||||
ps2_set_driver_handler( minor, NULL );
|
||||
break;
|
||||
}
|
||||
args->ioctl_return = 0;
|
||||
|
||||
@@ -1,316 +0,0 @@
|
||||
/***************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* MODULE DESCRIPTION:
|
||||
* This module implements the RTEMS drivers for the PC serial ports
|
||||
* as /dev/ttyS1 for COM1 and /dev/ttyS2 as COM2. If one of the ports
|
||||
* is used as the console, this driver would fail to initialize.
|
||||
*
|
||||
* This code was based on the console driver. It is based on the
|
||||
* current termios framework. This is just a shell around the
|
||||
* termios support.
|
||||
*
|
||||
* by: Rosimildo da Silva:
|
||||
* rdasilva@connecttel.com
|
||||
* http://www.connecttel.com
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <rtems/termiostypes.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <bsp/irq.h>
|
||||
#include <rtems/libio.h>
|
||||
#include <termios.h>
|
||||
#include <uart.h>
|
||||
#include <libcpu/cpuModel.h>
|
||||
|
||||
int BSP_poll_read(int);
|
||||
|
||||
#include <rtems/mw_uid.h>
|
||||
#include "serial_mouse.h"
|
||||
#include "mouse_parser.h"
|
||||
|
||||
/* Internal routines */
|
||||
static int serial_mouse_conSetAttr( int minor, const struct termios *t);
|
||||
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 BSP_polling_getchar_function_type BSP_poll_char;
|
||||
extern int BSPConsolePort;
|
||||
|
||||
/* Select Default to be COM1 */
|
||||
#if !defined( SERIAL_MOUSE_COM1 ) && !defined( SERIAL_MOUSE_COM2 )
|
||||
#define SERIAL_MOUSE_COM1 1
|
||||
#endif
|
||||
|
||||
/* select which serial port the mouse is connected to */
|
||||
#ifdef SERIAL_MOUSE_COM1
|
||||
#define BSP_UART_PORT BSP_UART_COM1
|
||||
#define BSP_UART_IRQ BSP_UART_COM1_IRQ
|
||||
#define BSP_ISR_FUNC BSP_uart_termios_isr_com1
|
||||
#define BSP_WRITE_FUNC BSP_uart_termios_write_com1
|
||||
#endif
|
||||
|
||||
#ifdef SERIAL_MOUSE_COM2
|
||||
#define BSP_UART_PORT BSP_UART_COM2
|
||||
#define BSP_UART_IRQ BSP_UART_COM2_IRQ
|
||||
#define BSP_ISR_FUNC BSP_uart_termios_isr_com2
|
||||
#define BSP_WRITE_FUNC BSP_uart_termios_write_com2
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Interrupt structure for serial_mouse
|
||||
*/
|
||||
static rtems_irq_connect_data serial_mouse_isr_data =
|
||||
{
|
||||
BSP_UART_IRQ,
|
||||
BSP_ISR_FUNC,
|
||||
0,
|
||||
isr_on,
|
||||
isr_off,
|
||||
isr_is_on};
|
||||
|
||||
static void isr_on(const rtems_irq_connect_data *unused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static void isr_off(const rtems_irq_connect_data *unused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int isr_is_on(const rtems_irq_connect_data *irq)
|
||||
{
|
||||
return BSP_irq_enabled_at_i8259s(irq->name);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
rtems_status_code status;
|
||||
|
||||
/* Check if this port is not been used as console */
|
||||
if( BSPConsolePort == BSP_UART_PORT )
|
||||
{
|
||||
status = -1;
|
||||
printk("SERIAL MOUSE: port selected as console.( %d )\n", BSP_UART_PORT );
|
||||
rtems_fatal_error_occurred( status );
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up TERMIOS
|
||||
*/
|
||||
rtems_termios_initialize();
|
||||
|
||||
/*
|
||||
* Do device-specific initialization
|
||||
*/
|
||||
/* 9600-8-N-1, without hardware flow control */
|
||||
BSP_uart_init( BSP_UART_PORT, 1200, CHR_8_BITS, 0, 0, 0 );
|
||||
status = BSP_install_rtems_irq_handler( &serial_mouse_isr_data );
|
||||
if( !status )
|
||||
{
|
||||
printk("Error installing serial mouse interrupt handler!\n");
|
||||
rtems_fatal_error_occurred(status);
|
||||
}
|
||||
/*
|
||||
* Register the device
|
||||
*/
|
||||
status = rtems_io_register_name ("/dev/mouse", major, 0);
|
||||
if (status != RTEMS_SUCCESSFUL)
|
||||
{
|
||||
printk("Error registering /dev/mouse device!\n");
|
||||
rtems_fatal_error_occurred (status);
|
||||
}
|
||||
printk("Device: /dev/mouse on COM%d -- ok \n", BSP_UART_PORT );
|
||||
return RTEMS_SUCCESSFUL;
|
||||
} /* tty_initialize */
|
||||
|
||||
static int serial_mouse_last_close(int major, int minor, void *arg)
|
||||
{
|
||||
BSP_remove_rtems_irq_handler( &serial_mouse_isr_data );
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* serial_mouse - device driver OPEN entry point
|
||||
*/
|
||||
rtems_device_driver
|
||||
serial_mouse_open(rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg)
|
||||
{
|
||||
rtems_status_code status;
|
||||
static rtems_termios_callbacks cb =
|
||||
{
|
||||
NULL, /* firstOpen */
|
||||
serial_mouse_last_close, /* lastClose */
|
||||
NULL, /* poll read */
|
||||
BSP_WRITE_FUNC, /* write */
|
||||
serial_mouse_conSetAttr, /* setAttributes */
|
||||
NULL, /* stopRemoteTx */
|
||||
NULL, /* startRemoteTx */
|
||||
1 /* outputUsesInterrupts */
|
||||
};
|
||||
|
||||
status = rtems_termios_open( major, minor, arg, &cb );
|
||||
if(status != RTEMS_SUCCESSFUL)
|
||||
{
|
||||
printk("Error openning serial_mouse device\n");
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
* Pass data area info down to driver
|
||||
*/
|
||||
BSP_uart_termios_set( BSP_UART_PORT,
|
||||
((rtems_libio_open_close_args_t *)arg)->iop->data1 );
|
||||
/* Enable interrupts on channel */
|
||||
BSP_uart_intr_ctrl( BSP_UART_PORT, BSP_UART_INTR_CTRL_TERMIOS);
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*
|
||||
* TTY - device driver CLOSE entry point
|
||||
*/
|
||||
rtems_device_driver
|
||||
serial_mouse_close(rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg)
|
||||
{
|
||||
|
||||
return (rtems_termios_close (arg));
|
||||
|
||||
} /* tty_close */
|
||||
|
||||
/*
|
||||
* TTY device driver READ entry point.
|
||||
* Read characters from the tty device.
|
||||
*/
|
||||
rtems_device_driver
|
||||
serial_mouse_read(rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void *arg)
|
||||
{
|
||||
return rtems_termios_read (arg);
|
||||
} /* tty_read */
|
||||
|
||||
/*
|
||||
* TTY device driver WRITE entry point.
|
||||
* Write characters to the tty device.
|
||||
*/
|
||||
rtems_device_driver
|
||||
serial_mouse_write(rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg)
|
||||
{
|
||||
return rtems_termios_write (arg);
|
||||
|
||||
} /* tty_write */
|
||||
|
||||
/*
|
||||
* Handle ioctl request. This is a generic internal
|
||||
* routine to handle both devices.
|
||||
*/
|
||||
static rtems_device_driver serial_mouse_control_internal( int port, void *arg )
|
||||
{
|
||||
rtems_libio_ioctl_args_t *args = arg;
|
||||
switch( args->command )
|
||||
{
|
||||
default:
|
||||
return rtems_termios_ioctl (arg);
|
||||
break;
|
||||
|
||||
case MW_UID_REGISTER_DEVICE:
|
||||
printk( "SerialMouse: reg=%s\n", args->buffer );
|
||||
register_mou_msg_queue( args->buffer, BSP_UART_PORT );
|
||||
break;
|
||||
|
||||
case MW_UID_UNREGISTER_DEVICE:
|
||||
unregister_mou_msg_queue( BSP_UART_PORT );
|
||||
break;
|
||||
|
||||
}
|
||||
args->ioctl_return = 0;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle ioctl request for ttyS1.
|
||||
*/
|
||||
rtems_device_driver
|
||||
serial_mouse_control(rtems_device_major_number major,
|
||||
rtems_device_minor_number minor,
|
||||
void * arg
|
||||
)
|
||||
{
|
||||
return serial_mouse_control_internal( BSP_UART_PORT, arg );
|
||||
}
|
||||
|
||||
static int
|
||||
conSetAttr(int port, int minor, const struct termios *t)
|
||||
{
|
||||
unsigned long baud, databits, parity, stopbits;
|
||||
|
||||
baud = rtems_termios_baud_to_number(t->c_cflag & CBAUD);
|
||||
if ( baud > 115200 )
|
||||
rtems_fatal_error_occurred (RTEMS_INTERNAL_ERROR);
|
||||
|
||||
if (t->c_cflag & PARENB) {
|
||||
/* Parity is enabled */
|
||||
if (t->c_cflag & PARODD) {
|
||||
/* Parity is odd */
|
||||
parity = PEN;
|
||||
}
|
||||
else {
|
||||
/* Parity is even */
|
||||
parity = PEN | EPS;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* No parity */
|
||||
parity = 0;
|
||||
}
|
||||
|
||||
switch (t->c_cflag & CSIZE) {
|
||||
case CS5: databits = CHR_5_BITS; break;
|
||||
case CS6: databits = CHR_6_BITS; break;
|
||||
case CS7: databits = CHR_7_BITS; break;
|
||||
default: /* just to avoid warnings -- all cases are covered. */
|
||||
case CS8: databits = CHR_8_BITS; break;
|
||||
}
|
||||
|
||||
if (t->c_cflag & CSTOPB) {
|
||||
/* 2 stop bits */
|
||||
stopbits = STB;
|
||||
}
|
||||
else {
|
||||
/* 1 stop bit */
|
||||
stopbits = 0;
|
||||
}
|
||||
printk("Mouse baud, port=%X, baud=%d\n", port, baud );
|
||||
BSP_uart_set_attributes(port, baud, databits, parity, stopbits);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Handle ioctl request for ttyS2.
|
||||
*/
|
||||
static int
|
||||
serial_mouse_conSetAttr( int minor, const struct termios *t)
|
||||
{
|
||||
return conSetAttr( BSP_UART_PORT, minor, t );
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#ifndef __serial_mouse_drv__
|
||||
#define __serial_mouse_drv__
|
||||
/***************************************************************************
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 1999 ConnectTel, Inc. All Rights Reserved.
|
||||
*
|
||||
* MODULE DESCRIPTION: Prototype routines for the /dev/mouse driver.
|
||||
*
|
||||
* by: Rosimildo da Silva:
|
||||
* rdasilva@connecttel.com
|
||||
* http://www.connecttel.com
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/* functions */
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ttyS1 entry points */
|
||||
rtems_device_driver serial_mouse_initialize(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver serial_mouse_open(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver serial_mouse_control(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
/* serial_mouse entry points */
|
||||
rtems_device_driver serial_mouse_close(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver serial_mouse_read(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
rtems_device_driver serial_mouse_write(
|
||||
rtems_device_major_number,
|
||||
rtems_device_minor_number,
|
||||
void *
|
||||
);
|
||||
|
||||
/* Select the mouse type: "ms","pc","ps2" */
|
||||
#define MOUSE_TYPE "ms"
|
||||
|
||||
/* Select the serial port for the serial mouse driver */
|
||||
#define SERIAL_MOUSE_COM1 1
|
||||
/* #define SERIAL_MOUSE_COM2 1 */
|
||||
|
||||
#define SERIAL_MOUSE_DRIVER_TABLE_ENTRY \
|
||||
{ serial_mouse_initialize, serial_mouse_open, serial_mouse_close, \
|
||||
serial_mouse_read, serial_mouse_write, serial_mouse_control }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __tty_drv__ */
|
||||
54
c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c
Normal file
54
c/src/lib/libbsp/i386/pc386/console/serial_mouse_config.c
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
*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;
|
||||
}
|
||||
@@ -58,7 +58,6 @@ typedef struct {
|
||||
int data2;
|
||||
} REGIO;
|
||||
|
||||
/* extern data*/
|
||||
#if ROMFONT
|
||||
extern FARADDR rom_char_addr; /* address of ROM font*/
|
||||
extern int ROM_CHAR_HEIGHT; /* ROM character height*/
|
||||
|
||||
@@ -106,10 +106,6 @@ $(PROJECT_INCLUDE)/rtems/kd.h: console/kd.h $(PROJECT_INCLUDE)/rtems/$(dirstamp)
|
||||
$(INSTALL_DATA) $< $(PROJECT_INCLUDE)/rtems/kd.h
|
||||
PREINSTALL_FILES += $(PROJECT_INCLUDE)/rtems/kd.h
|
||||
|
||||
$(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
|
||||
|
||||
$(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
|
||||
|
||||
Reference in New Issue
Block a user