Mouse cleanups. Serial unmodified, but working on DOS,WfW,Win2000,XP for serial mice.
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
#
|
#
|
||||||
# Modified Makefile for Win32 (MinGW32) environment.
|
# Modified Makefile for Win32 (MinGW32) environment.
|
||||||
#
|
#
|
||||||
# Version: @(#)Makefile.mingw 1.0.31 2017/06/19
|
# Version: @(#)Makefile.mingw 1.0.32 2017/07/27
|
||||||
#
|
#
|
||||||
# Authors: Miran Grca, <mgrca8@gmail.com>
|
# Authors: Miran Grca, <mgrca8@gmail.com>
|
||||||
# Fred N. van Kempen, <decwiz@yahoo.com>
|
# Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
@@ -455,7 +455,7 @@ mfm_at.o: ibm.h device.h hdd_image.h io.h pic.h timer.h mfm_at.h
|
|||||||
mfm_xebec.o: ibm.h device.h dma.h hdd_image.h io.h mem.h pic.h rom.h timer.h mfm_xebec.h
|
mfm_xebec.o: ibm.h device.h dma.h hdd_image.h io.h mem.h pic.h rom.h timer.h mfm_xebec.h
|
||||||
|
|
||||||
model.o: ibm.h io.h mem.h rom.h device.h model.h cpu/cpu.h \
|
model.o: ibm.h io.h mem.h rom.h device.h model.h cpu/cpu.h \
|
||||||
mouse.h mouse_ps2.h cdrom.h disc.h dma.h fdc.h \
|
mouse.h cdrom.h disc.h dma.h fdc.h \
|
||||||
fdc37c665.h fdc37c669.h fdc37c932fr.h \
|
fdc37c665.h fdc37c669.h fdc37c932fr.h \
|
||||||
gameport.h i82335.h ide.h intel.h intel_flash.h \
|
gameport.h i82335.h ide.h intel.h intel_flash.h \
|
||||||
keyboard_amstrad.h keyboard_at.h keyboard_olim24.h \
|
keyboard_amstrad.h keyboard_at.h keyboard_olim24.h \
|
||||||
@@ -466,14 +466,13 @@ model.o: ibm.h io.h mem.h rom.h device.h model.h cpu/cpu.h \
|
|||||||
video/vid_pcjr.h video/vid_tandy.h w83877f.h wd76c10.h \
|
video/vid_pcjr.h video/vid_tandy.h w83877f.h wd76c10.h \
|
||||||
xtide.h bugger.h
|
xtide.h bugger.h
|
||||||
|
|
||||||
mouse.o: ibm.h cpu/cpu.h device.h model.h \
|
mouse.o: ibm.h cpu/cpu.h device.h model.h mouse.h keyboard_olim24.h
|
||||||
mouse.h mouse_serial.h mouse_ps2.h mouse_bus.h keyboard_olim24.h
|
|
||||||
|
|
||||||
mouse_bus.o: ibm.h io.h pic.h mouse.h mouse_bus.h plat_mouse.h
|
mouse_bus.o: ibm.h io.h pic.h mouse.h
|
||||||
|
|
||||||
mouse_ps2.o: ibm.h keyboard_at.h mouse.h mouse_ps2.h plat_mouse.h
|
mouse_ps2.o: ibm.h keyboard_at.h mouse.h plat_mouse.h
|
||||||
|
|
||||||
mouse_serial.o: ibm.h timer.h serial.h mouse.h mouse_serial.h
|
mouse_serial.o: ibm.h timer.h serial.h mouse.h
|
||||||
|
|
||||||
neat.o: ibm.h cpu/cpu.h io.h device.h model.h
|
neat.o: ibm.h cpu/cpu.h io.h device.h model.h
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Handling of the emulated machines.
|
* Handling of the emulated machines.
|
||||||
*
|
*
|
||||||
* Version: @(#)model.c 1.0.4 2017/06/21
|
* Version: @(#)model.c 1.0.5 2017/07/27
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "mouse_ps2.h"
|
|
||||||
#include "cdrom.h"
|
#include "cdrom.h"
|
||||||
|
|
||||||
#include "disc.h"
|
#include "disc.h"
|
||||||
|
|||||||
17
src/mouse.c
17
src/mouse.c
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Common driver module for MOUSE devices.
|
* Common driver module for MOUSE devices.
|
||||||
*
|
*
|
||||||
* Version: @(#)mouse.c 1.0.4 2017/07/24
|
* Version: @(#)mouse.c 1.0.5 2017/07/27
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -21,9 +21,6 @@
|
|||||||
#include "cpu/cpu.h"
|
#include "cpu/cpu.h"
|
||||||
#include "device.h"
|
#include "device.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "mouse_serial.h"
|
|
||||||
#include "mouse_ps2.h"
|
|
||||||
#include "mouse_bus.h"
|
|
||||||
#include "model.h"
|
#include "model.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -36,18 +33,18 @@ static mouse_t mouse_none = {
|
|||||||
|
|
||||||
static mouse_t *mouse_list[] = {
|
static mouse_t *mouse_list[] = {
|
||||||
&mouse_none,
|
&mouse_none,
|
||||||
&mouse_bus, /* 1 Microsoft/Logitech Bus Mouse 2-button */
|
&mouse_bus_logitech, /* 1 Logitech Bus Mouse 2-button */
|
||||||
&mouse_inport, /* 2 Microsoft InPort Mouse */
|
&mouse_bus_msinport, /* 2 Microsoft InPort Mouse */
|
||||||
&mouse_msystems, /* 3 Mouse Systems */
|
&mouse_serial_msystems, /* 3 Mouse Systems Serial Mouse */
|
||||||
&mouse_serial_microsoft, /* 4 Microsoft Serial Mouse */
|
&mouse_serial_microsoft, /* 4 Microsoft Serial Mouse */
|
||||||
&mouse_serial_logitech, /* 5 Logitech 3-button Serial Mouse */
|
&mouse_serial_logitech, /* 5 Logitech 3-button Serial Mouse */
|
||||||
&mouse_serial_mswheel, /* 6 Microsoft Serial Wheel Mouse */
|
&mouse_serial_mswheel, /* 6 Microsoft Serial Wheel Mouse */
|
||||||
&mouse_ps2_2_button, /* 7 PS/2 Mouse 2-button */
|
&mouse_ps2_2button, /* 7 PS/2 Mouse 2-button */
|
||||||
&mouse_intellimouse, /* 8 PS/2 Intellimouse 3-button */
|
&mouse_ps2_intellimouse, /* 8 PS/2 Intellimouse 3-button */
|
||||||
&mouse_amstrad, /* 9 Amstrad PC System Mouse */
|
&mouse_amstrad, /* 9 Amstrad PC System Mouse */
|
||||||
&mouse_olim24, /* 10 Olivetti M24 System Mouse */
|
&mouse_olim24, /* 10 Olivetti M24 System Mouse */
|
||||||
#if 0
|
#if 0
|
||||||
&mouse_genius, /* 11 Genius Bus Mouse */
|
&mouse_bus_genius, /* 11 Genius Bus Mouse */
|
||||||
#endif
|
#endif
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|||||||
26
src/mouse.h
26
src/mouse.h
@@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
* Definitions for the MOUSE driver.
|
* Definitions for the MOUSE driver.
|
||||||
*
|
*
|
||||||
* Version: @(#)mouse.h 1.0.3 2017/06/21
|
* Version: @(#)mouse.h 1.0.4 2017/07/27
|
||||||
*
|
*
|
||||||
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
* Authors: Sarah Walker, <http://pcem-emulator.co.uk/>
|
||||||
* Miran Grca, <mgrca8@gmail.com>
|
* Miran Grca, <mgrca8@gmail.com>
|
||||||
@@ -20,20 +20,22 @@
|
|||||||
# define EMU_MOUSE_H
|
# define EMU_MOUSE_H
|
||||||
|
|
||||||
|
|
||||||
|
#define SERMOUSE_PORT 1 /* attach to Serial1 */
|
||||||
|
|
||||||
#define MOUSE_TYPE_NONE 0
|
#define MOUSE_TYPE_NONE 0
|
||||||
#if 0
|
#define MOUSE_TYPE_LOGIBUS 1 /* Logitech/ATI Bus Mouse */
|
||||||
#define MOUSE_TYPE_GENIUS 11 /* Genius Bus Mouse */
|
|
||||||
#endif
|
|
||||||
#define MOUSE_TYPE_BUS 1 /* Logitech/ATI Bus Mouse */
|
|
||||||
#define MOUSE_TYPE_INPORT 2 /* Microsoft InPort Mouse */
|
#define MOUSE_TYPE_INPORT 2 /* Microsoft InPort Mouse */
|
||||||
#define MOUSE_TYPE_MSYSTEMS 3 /* Mouse Systems mouse */
|
#define MOUSE_TYPE_MSYSTEMS 3 /* Mouse Systems mouse */
|
||||||
#define MOUSE_TYPE_SERIAL 4 /* Serial Mouse */
|
#define MOUSE_TYPE_MICROSOFT 4 /* Microsoft Serial Mouse */
|
||||||
#define MOUSE_TYPE_LOGITECH 5 /* Logitech Serial Mouse */
|
#define MOUSE_TYPE_LOGITECH 5 /* Logitech Serial Mouse */
|
||||||
#define MOUSE_TYPE_MSWHEEL 6 /* Serial Wheel Mouse */
|
#define MOUSE_TYPE_MSWHEEL 6 /* Serial Wheel Mouse */
|
||||||
#define MOUSE_TYPE_PS2 7 /* IBM PS/2 series Bus Mouse */
|
#define MOUSE_TYPE_PS2 7 /* IBM PS/2 series Bus Mouse */
|
||||||
#define MOUSE_TYPE_PS2_MS 8 /* Microsoft Intellimouse PS/2 */
|
#define MOUSE_TYPE_PS2_MS 8 /* Microsoft Intellimouse PS/2 */
|
||||||
#define MOUSE_TYPE_AMSTRAD 9 /* Amstrad PC system mouse */
|
#define MOUSE_TYPE_AMSTRAD 9 /* Amstrad PC system mouse */
|
||||||
#define MOUSE_TYPE_OLIM24 10 /* Olivetti M24 system mouse */
|
#define MOUSE_TYPE_OLIM24 10 /* Olivetti M24 system mouse */
|
||||||
|
#if 0
|
||||||
|
# define MOUSE_TYPE_GENIUS 11 /* Genius Bus Mouse */
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MOUSE_TYPE_MASK 0x0f
|
#define MOUSE_TYPE_MASK 0x0f
|
||||||
#define MOUSE_TYPE_3BUTTON (1<<7) /* device has 3+ buttons */
|
#define MOUSE_TYPE_3BUTTON (1<<7) /* device has 3+ buttons */
|
||||||
@@ -51,9 +53,21 @@ typedef struct {
|
|||||||
|
|
||||||
extern int mouse_type;
|
extern int mouse_type;
|
||||||
|
|
||||||
|
extern mouse_t mouse_bus_logitech;
|
||||||
|
extern mouse_t mouse_bus_msinport;
|
||||||
|
extern mouse_t mouse_serial_msystems;
|
||||||
|
extern mouse_t mouse_serial_microsoft;
|
||||||
|
extern mouse_t mouse_serial_logitech;
|
||||||
|
extern mouse_t mouse_serial_mswheel;
|
||||||
|
extern mouse_t mouse_ps2_2button;
|
||||||
|
extern mouse_t mouse_ps2_intellimouse;
|
||||||
|
|
||||||
|
|
||||||
|
extern void *mouse_ps2_init(void);
|
||||||
|
|
||||||
extern void mouse_emu_init(void);
|
extern void mouse_emu_init(void);
|
||||||
extern void mouse_emu_close(void);
|
extern void mouse_emu_close(void);
|
||||||
|
|
||||||
extern void mouse_poll(int x, int y, int z, int b);
|
extern void mouse_poll(int x, int y, int z, int b);
|
||||||
extern char *mouse_get_name(int mouse);
|
extern char *mouse_get_name(int mouse);
|
||||||
extern char *mouse_get_internal_name(int mouse);
|
extern char *mouse_get_internal_name(int mouse);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
* Based on an early driver for MINIX 1.5.
|
* Based on an early driver for MINIX 1.5.
|
||||||
* Based on the 86Box PS/2 mouse driver as a framework.
|
* Based on the 86Box PS/2 mouse driver as a framework.
|
||||||
*
|
*
|
||||||
* Version: @(#)mouse_bus.c 1.0.6 2017/07/24
|
* Version: @(#)mouse_bus.c 1.0.7 2017/07/27
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
* TheCollector1995,
|
* TheCollector1995,
|
||||||
@@ -45,13 +45,12 @@
|
|||||||
#include "pic.h"
|
#include "pic.h"
|
||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "mouse_bus.h"
|
|
||||||
#include "plat_mouse.h"
|
|
||||||
|
|
||||||
#define BUS_MOUSE_IRQ 5
|
#define BUS_MOUSE_IRQ 5
|
||||||
#define IRQ_MASK ((1<<5) >> BUS_MOUSE_IRQ)
|
#define IRQ_MASK ((1<<5) >> BUS_MOUSE_IRQ)
|
||||||
|
|
||||||
// MS Inport Bus Mouse Adapter
|
/* MS Inport Bus Mouse Adapter. */
|
||||||
#define INP_PORT_CONTROL 0x023C
|
#define INP_PORT_CONTROL 0x023C
|
||||||
#define INP_PORT_DATA 0x023D
|
#define INP_PORT_DATA 0x023D
|
||||||
#define INP_PORT_SIGNATURE 0x023E
|
#define INP_PORT_SIGNATURE 0x023E
|
||||||
@@ -67,7 +66,7 @@
|
|||||||
#define INP_HOLD_COUNTER (1 << 5)
|
#define INP_HOLD_COUNTER (1 << 5)
|
||||||
#define INP_ENABLE_IRQ (1 << 0)
|
#define INP_ENABLE_IRQ (1 << 0)
|
||||||
|
|
||||||
// MS/Logictech Standard Bus Mouse Adapter
|
/* MS/Logictech Standard Bus Mouse Adapter. */
|
||||||
#define BUSM_PORT_DATA 0x023C
|
#define BUSM_PORT_DATA 0x023C
|
||||||
#define BUSM_PORT_SIGNATURE 0x023D
|
#define BUSM_PORT_SIGNATURE 0x023D
|
||||||
#define BUSM_PORT_CONTROL 0x023E
|
#define BUSM_PORT_CONTROL 0x023E
|
||||||
@@ -462,17 +461,17 @@ static void *inport_init(void)
|
|||||||
return(inport);
|
return(inport);
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_t mouse_bus =
|
mouse_t mouse_bus_logitech =
|
||||||
{
|
{
|
||||||
"Bus Mouse",
|
"Logitech Bus Mouse",
|
||||||
"msbus",
|
"msbus",
|
||||||
MOUSE_TYPE_BUS,
|
MOUSE_TYPE_LOGIBUS,
|
||||||
busmouse_init,
|
busmouse_init,
|
||||||
busmouse_close,
|
busmouse_close,
|
||||||
busmouse_poll
|
busmouse_poll
|
||||||
};
|
};
|
||||||
|
|
||||||
mouse_t mouse_inport =
|
mouse_t mouse_bus_msinport =
|
||||||
{
|
{
|
||||||
"InPort Mouse",
|
"InPort Mouse",
|
||||||
"inport",
|
"inport",
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
||||||
* running old operating systems and software designed for IBM
|
|
||||||
* PC systems and compatibles from 1981 through fairly recent
|
|
||||||
* system designs based on the PCI bus.
|
|
||||||
*
|
|
||||||
* This file is part of the 86Box distribution.
|
|
||||||
*
|
|
||||||
* Implementation of Bus Mouse devices.
|
|
||||||
*
|
|
||||||
* These mice devices were made by both Microsoft (InPort) and
|
|
||||||
* Logitech. Sadly, they did not use the same I/O protocol, but
|
|
||||||
* they were close enough to fit into a single implementation.
|
|
||||||
*
|
|
||||||
* Definitions for the Bus Mouse driver.
|
|
||||||
*
|
|
||||||
* Version: @(#)mouse_bus.h 1.0.3 2017/04/22
|
|
||||||
*
|
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
|
||||||
* Copyright 1989-2017 Fred N. van Kempen.
|
|
||||||
*/
|
|
||||||
#ifndef MOUSE_BUS_H
|
|
||||||
# define MOUSE_BUS_H
|
|
||||||
|
|
||||||
|
|
||||||
extern mouse_t mouse_bus;
|
|
||||||
extern mouse_t mouse_inport;
|
|
||||||
|
|
||||||
|
|
||||||
#endif /*MOUSE_BUS_H*/
|
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
#include "ibm.h"
|
#include "ibm.h"
|
||||||
#include "keyboard_at.h"
|
#include "keyboard_at.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "mouse_ps2.h"
|
|
||||||
#include "plat_mouse.h"
|
#include "plat_mouse.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -238,16 +237,18 @@ void mouse_ps2_close(void *p)
|
|||||||
free(mouse);
|
free(mouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse_t mouse_ps2_2_button =
|
|
||||||
|
mouse_t mouse_ps2_2button =
|
||||||
{
|
{
|
||||||
"2-button mouse (PS/2)",
|
"Standard 2-button mouse (PS/2)",
|
||||||
"ps2",
|
"ps2",
|
||||||
MOUSE_TYPE_PS2,
|
MOUSE_TYPE_PS2,
|
||||||
mouse_ps2_init,
|
mouse_ps2_init,
|
||||||
mouse_ps2_close,
|
mouse_ps2_close,
|
||||||
mouse_ps2_poll
|
mouse_ps2_poll
|
||||||
};
|
};
|
||||||
mouse_t mouse_intellimouse =
|
|
||||||
|
mouse_t mouse_ps2_intellimouse =
|
||||||
{
|
{
|
||||||
"Microsoft Intellimouse (PS/2)",
|
"Microsoft Intellimouse (PS/2)",
|
||||||
"intellimouse",
|
"intellimouse",
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
extern mouse_t mouse_ps2_2_button;
|
|
||||||
extern mouse_t mouse_intellimouse;
|
|
||||||
|
|
||||||
extern void *mouse_ps2_init();
|
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
*
|
*
|
||||||
* Based on the 86Box Serial Mouse driver as a framework.
|
* Based on the 86Box Serial Mouse driver as a framework.
|
||||||
*
|
*
|
||||||
* Version: @(#)mouse_serial.c 1.0.6 2017/06/19
|
* Version: @(#)mouse_serial.c 1.0.7 2017/07/27
|
||||||
*
|
*
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
||||||
*/
|
*/
|
||||||
@@ -19,13 +19,6 @@
|
|||||||
#include "timer.h"
|
#include "timer.h"
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "mouse_serial.h"
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef WALTJE
|
|
||||||
#define SERMOUSE_TYPE_MSYSTEMS 1 /* Mouse Systems */
|
|
||||||
#define SERMOUSE_TYPE_MICROSOFT 2 /* Microsoft */
|
|
||||||
#define SERMOUSE_TYPE_LOGITECH 3 /* Logitech */
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct mouse_serial_t {
|
typedef struct mouse_serial_t {
|
||||||
@@ -40,7 +33,11 @@ typedef struct mouse_serial_t {
|
|||||||
|
|
||||||
/* Callback from serial driver: RTS was toggled. */
|
/* Callback from serial driver: RTS was toggled. */
|
||||||
static void
|
static void
|
||||||
|
#ifdef WALTJE
|
||||||
sermouse_callback(void *priv)
|
sermouse_callback(void *priv)
|
||||||
|
#else
|
||||||
|
sermouse_callback(struct SERIAL *serial, void *priv)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
mouse_serial_t *ms = (mouse_serial_t *)priv;
|
mouse_serial_t *ms = (mouse_serial_t *)priv;
|
||||||
|
|
||||||
@@ -58,20 +55,49 @@ sermouse_timer(void *priv)
|
|||||||
|
|
||||||
ms->delay = 0;
|
ms->delay = 0;
|
||||||
|
|
||||||
switch(ms->type) {
|
if (ms->pos != -1) return;
|
||||||
case SERMOUSE_TYPE_MICROSOFT:
|
|
||||||
/* This identifies a two-button Microsoft Serial mouse. */
|
ms->pos = 0;
|
||||||
serial_write_fifo(ms->serial, 'M', 1);
|
switch(ms->type & MOUSE_TYPE_MASK) {
|
||||||
|
case MOUSE_TYPE_MSYSTEMS:
|
||||||
|
/* Identifies Mouse Systems serial mouse. */
|
||||||
|
#ifdef WALTJE
|
||||||
|
serial_write_fifo(ms->serial, 'H', 1);
|
||||||
|
#else
|
||||||
|
serial_write_fifo(ms->serial, 'H');
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SERMOUSE_TYPE_LOGITECH:
|
case MOUSE_TYPE_MICROSOFT:
|
||||||
/* This identifies a two-button Logitech Serial mouse. */
|
default:
|
||||||
|
/* Identifies a two-button Microsoft Serial mouse. */
|
||||||
|
#ifdef WALTJE
|
||||||
|
serial_write_fifo(ms->serial, 'M', 1);
|
||||||
|
#else
|
||||||
|
serial_write_fifo(ms->serial, 'M');
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
|
||||||
|
case MOUSE_TYPE_LOGITECH:
|
||||||
|
/* Identifies a two-button Logitech Serial mouse. */
|
||||||
|
#ifdef WALTJE
|
||||||
serial_write_fifo(ms->serial, 'M', 1);
|
serial_write_fifo(ms->serial, 'M', 1);
|
||||||
serial_write_fifo(ms->serial, '3', 1);
|
serial_write_fifo(ms->serial, '3', 1);
|
||||||
|
#else
|
||||||
|
serial_write_fifo(ms->serial, 'M');
|
||||||
|
serial_write_fifo(ms->serial, '3');
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case MOUSE_TYPE_MSWHEEL:
|
||||||
/* No action needed. */
|
/* Identifies multi-button Microsoft Wheel Mouse. */
|
||||||
|
#ifdef WALTJE
|
||||||
|
serial_write_fifo(ms->serial, 'M', 1);
|
||||||
|
serial_write_fifo(ms->serial, 'Z', 1);
|
||||||
|
#else
|
||||||
|
serial_write_fifo(ms->serial, 'M');
|
||||||
|
serial_write_fifo(ms->serial, 'Z');
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,7 +114,7 @@ sermouse_poll(int x, int y, int z, int b, void *priv)
|
|||||||
|
|
||||||
ms->oldb = b;
|
ms->oldb = b;
|
||||||
|
|
||||||
if (ms->type == SERMOUSE_TYPE_MSYSTEMS) y = -y;
|
if (ms->type == MOUSE_TYPE_MSYSTEMS) y = -y;
|
||||||
|
|
||||||
if (x>127) x = 127;
|
if (x>127) x = 127;
|
||||||
if (y>127) y = 127;
|
if (y>127) y = 127;
|
||||||
@@ -96,8 +122,8 @@ sermouse_poll(int x, int y, int z, int b, void *priv)
|
|||||||
if (y<-128) y = -128;
|
if (y<-128) y = -128;
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
switch(ms->type) {
|
switch(ms->type & MOUSE_TYPE_MASK) {
|
||||||
case SERMOUSE_TYPE_MSYSTEMS:
|
case MOUSE_TYPE_MSYSTEMS:
|
||||||
buff[0] = 0x80;
|
buff[0] = 0x80;
|
||||||
buff[0] |= (b&0x01) ? 0x00 : 0x04; /* left button */
|
buff[0] |= (b&0x01) ? 0x00 : 0x04; /* left button */
|
||||||
buff[0] |= (b&0x02) ? 0x00 : 0x01; /* middle button */
|
buff[0] |= (b&0x02) ? 0x00 : 0x01; /* middle button */
|
||||||
@@ -109,10 +135,10 @@ sermouse_poll(int x, int y, int z, int b, void *priv)
|
|||||||
len = 5;
|
len = 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SERMOUSE_TYPE_MICROSOFT:
|
case MOUSE_TYPE_MICROSOFT:
|
||||||
buff[0] = 0x40;
|
buff[0] = 0x40;
|
||||||
buff[0] |= (((y>>6)&03)<<2);
|
buff[0] |= (((y>>6)&0x03)<<2);
|
||||||
buff[0] |= ((x>>6)&03);
|
buff[0] |= ((x>>6)&0x03);
|
||||||
if (b&0x01) buff[0] |= 0x20;
|
if (b&0x01) buff[0] |= 0x20;
|
||||||
if (b&0x02) buff[0] |= 0x10;
|
if (b&0x02) buff[0] |= 0x10;
|
||||||
buff[1] = x & 0x3F;
|
buff[1] = x & 0x3F;
|
||||||
@@ -120,21 +146,34 @@ sermouse_poll(int x, int y, int z, int b, void *priv)
|
|||||||
len = 3;
|
len = 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SERMOUSE_TYPE_LOGITECH:
|
case MOUSE_TYPE_LOGITECH:
|
||||||
buff[0] = 0x40;
|
buff[0] = 0x40;
|
||||||
buff[0] |= (((y>>6)&03)<<2);
|
buff[0] |= (((y>>6)&0x03)<<2);
|
||||||
buff[0] |= ((x>>6)&03);
|
buff[0] |= ((x>>6)&0x03);
|
||||||
if (b&0x01) buff[0] |= 0x20;
|
if (b&0x01) buff[0] |= 0x20;
|
||||||
if (b&0x02) buff[0] |= 0x10;
|
if (b&0x02) buff[0] |= 0x10;
|
||||||
buff[1] = x & 0x3F;
|
buff[1] = x & 0x3F;
|
||||||
buff[2] = y & 0x3F;
|
buff[2] = y & 0x3F;
|
||||||
|
len = 3;
|
||||||
if (b&0x04) {
|
if (b&0x04) {
|
||||||
buff[3] = 0x20;
|
buff[3] = 0x20;
|
||||||
len = 4;
|
len++;
|
||||||
} else {
|
|
||||||
len = 3;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MOUSE_TYPE_MSWHEEL:
|
||||||
|
buff[0] = 0x40;
|
||||||
|
buff[0] |= (((y>>6)&0x03)<<2);
|
||||||
|
buff[0] |= ((x>>6)&0x03);
|
||||||
|
if (b&0x01) buff[0] |= 0x20;
|
||||||
|
if (b&0x02) buff[0] |= 0x10;
|
||||||
|
buff[1] = x & 0x3F;
|
||||||
|
buff[2] = y & 0x3F;
|
||||||
|
buff[3] = z & 0x0F;
|
||||||
|
if (b&0x04)
|
||||||
|
buff[3] |= 0x10;
|
||||||
|
len = 4;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@@ -145,7 +184,11 @@ sermouse_poll(int x, int y, int z, int b, void *priv)
|
|||||||
|
|
||||||
/* Send the packet to the bottom-half of the attached port. */
|
/* Send the packet to the bottom-half of the attached port. */
|
||||||
for (b=0; b<len; b++)
|
for (b=0; b<len; b++)
|
||||||
|
#ifdef WALTJE
|
||||||
serial_write_fifo(ms->serial, buff[b], 1);
|
serial_write_fifo(ms->serial, buff[b], 1);
|
||||||
|
#else
|
||||||
|
serial_write_fifo(ms->serial, buff[b]);
|
||||||
|
#endif
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
@@ -157,7 +200,11 @@ sermouse_close(void *priv)
|
|||||||
mouse_serial_t *ms = (mouse_serial_t *)priv;
|
mouse_serial_t *ms = (mouse_serial_t *)priv;
|
||||||
|
|
||||||
/* Detach serial port from the mouse. */
|
/* Detach serial port from the mouse. */
|
||||||
|
#ifdef WALTJE
|
||||||
serial_attach(ms->port, NULL, NULL);
|
serial_attach(ms->port, NULL, NULL);
|
||||||
|
#else
|
||||||
|
serial1.rcr_callback = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
free(ms);
|
free(ms);
|
||||||
}
|
}
|
||||||
@@ -172,7 +219,12 @@ sermouse_init(int type)
|
|||||||
ms->type = type;
|
ms->type = type;
|
||||||
|
|
||||||
/* Attach a serial port to the mouse. */
|
/* Attach a serial port to the mouse. */
|
||||||
|
#ifdef WALTJE
|
||||||
ms->serial = serial_attach(ms->port, sermouse_callback, ms);
|
ms->serial = serial_attach(ms->port, sermouse_callback, ms);
|
||||||
|
#else
|
||||||
|
ms->serial = &serial1;
|
||||||
|
ms->serial->rcr_callback = sermouse_callback;
|
||||||
|
#endif
|
||||||
|
|
||||||
timer_add(sermouse_timer, &ms->delay, &ms->delay, ms);
|
timer_add(sermouse_timer, &ms->delay, &ms->delay, ms);
|
||||||
|
|
||||||
@@ -180,31 +232,38 @@ sermouse_init(int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void *
|
||||||
|
sermouse_init_msystems(void)
|
||||||
|
{
|
||||||
|
return(sermouse_init(MOUSE_TYPE_MSYSTEMS));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
sermouse_init_microsoft(void)
|
sermouse_init_microsoft(void)
|
||||||
{
|
{
|
||||||
return(sermouse_init(SERMOUSE_TYPE_MICROSOFT));
|
return(sermouse_init(MOUSE_TYPE_MICROSOFT));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
sermouse_init_logitech(void)
|
sermouse_init_logitech(void)
|
||||||
{
|
{
|
||||||
return(sermouse_init(SERMOUSE_TYPE_LOGITECH));
|
return(sermouse_init(MOUSE_TYPE_LOGITECH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void *
|
static void *
|
||||||
sermouse_init_msystems(void)
|
sermouse_init_mswheel(void)
|
||||||
{
|
{
|
||||||
return(sermouse_init(SERMOUSE_TYPE_MSYSTEMS));
|
return(sermouse_init(MOUSE_TYPE_MSWHEEL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mouse_t mouse_msystems = {
|
mouse_t mouse_serial_msystems = {
|
||||||
"Mouse Systems Mouse (serial)",
|
"Mouse Systems Mouse (serial)",
|
||||||
"mssystems",
|
"mssystems",
|
||||||
MOUSE_TYPE_MSYSTEMS,
|
MOUSE_TYPE_MSYSTEMS | MOUSE_TYPE_3BUTTON,
|
||||||
sermouse_init_msystems,
|
sermouse_init_msystems,
|
||||||
sermouse_close,
|
sermouse_close,
|
||||||
sermouse_poll
|
sermouse_poll
|
||||||
@@ -214,7 +273,7 @@ mouse_t mouse_msystems = {
|
|||||||
mouse_t mouse_serial_microsoft = {
|
mouse_t mouse_serial_microsoft = {
|
||||||
"Microsoft 2-button mouse (serial)",
|
"Microsoft 2-button mouse (serial)",
|
||||||
"msserial",
|
"msserial",
|
||||||
MOUSE_TYPE_SERIAL,
|
MOUSE_TYPE_MICROSOFT,
|
||||||
sermouse_init_microsoft,
|
sermouse_init_microsoft,
|
||||||
sermouse_close,
|
sermouse_close,
|
||||||
sermouse_poll
|
sermouse_poll
|
||||||
@@ -224,232 +283,18 @@ mouse_t mouse_serial_microsoft = {
|
|||||||
mouse_t mouse_serial_logitech = {
|
mouse_t mouse_serial_logitech = {
|
||||||
"Logitech 3-button mouse (serial)",
|
"Logitech 3-button mouse (serial)",
|
||||||
"lserial",
|
"lserial",
|
||||||
MOUSE_TYPE_SERIAL | MOUSE_TYPE_3BUTTON,
|
MOUSE_TYPE_LOGITECH | MOUSE_TYPE_3BUTTON,
|
||||||
sermouse_init_logitech,
|
sermouse_init_logitech,
|
||||||
sermouse_close,
|
sermouse_close,
|
||||||
sermouse_poll
|
sermouse_poll
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#else
|
mouse_t mouse_serial_mswheel = {
|
||||||
|
|
||||||
|
|
||||||
typedef struct mouse_serial_t
|
|
||||||
{
|
|
||||||
int mousepos, mousedelay;
|
|
||||||
int oldb;
|
|
||||||
int type;
|
|
||||||
SERIAL *serial;
|
|
||||||
} mouse_serial_t;
|
|
||||||
|
|
||||||
uint8_t mouse_serial_poll(int x, int y, int z, int b, void *p)
|
|
||||||
{
|
|
||||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
|
||||||
SERIAL *serial = mouse->serial;
|
|
||||||
uint8_t mousedat[4];
|
|
||||||
|
|
||||||
if (!(serial->ier & 1))
|
|
||||||
return 0xff;
|
|
||||||
if (!x && !y && b == mouse->oldb)
|
|
||||||
return 0xff;
|
|
||||||
|
|
||||||
mouse->oldb = b;
|
|
||||||
if (x>127) x=127;
|
|
||||||
if (y>127) y=127;
|
|
||||||
if (x<-128) x=-128;
|
|
||||||
if (y<-128) y=-128;
|
|
||||||
|
|
||||||
/*Use Microsoft format*/
|
|
||||||
mousedat[0]=0x40;
|
|
||||||
mousedat[0]|=(((y>>6)&3)<<2);
|
|
||||||
mousedat[0]|=((x>>6)&3);
|
|
||||||
if (b&1) mousedat[0]|=0x20;
|
|
||||||
if (b&2) mousedat[0]|=0x10;
|
|
||||||
mousedat[1]=x&0x3F;
|
|
||||||
mousedat[2]=y&0x3F;
|
|
||||||
|
|
||||||
if (!(serial->mctrl & 0x10))
|
|
||||||
{
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[0]);
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[1]);
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[2]);
|
|
||||||
if (mouse->type == 2)
|
|
||||||
{
|
|
||||||
if (b&0x04)
|
|
||||||
{
|
|
||||||
serial_write_fifo(mouse->serial, 0x20);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (mouse->type == 3)
|
|
||||||
{
|
|
||||||
mousedat[3] = z & 0xf;
|
|
||||||
if (b&4) mousedat[3] |= 0x10;
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[3]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t mouse_serial_msystems_poll(int x, int y, int z, int b, void *p)
|
|
||||||
{
|
|
||||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
|
||||||
SERIAL *serial = mouse->serial;
|
|
||||||
uint8_t mousedat[5];
|
|
||||||
|
|
||||||
if (!x && !y && b == mouse->oldb)
|
|
||||||
return 0xff;
|
|
||||||
|
|
||||||
y = -y;
|
|
||||||
|
|
||||||
mouse->oldb = b;
|
|
||||||
if (x>127) x=127;
|
|
||||||
if (y>127) y=127;
|
|
||||||
if (x<-128) x=-128;
|
|
||||||
if (y<-128) y=-128;
|
|
||||||
|
|
||||||
/*Use Mouse Systems format*/
|
|
||||||
mousedat[0] = 0x80;
|
|
||||||
mousedat[0] |= (b&0x01) ? 0x00 : 0x04; /* left button */
|
|
||||||
mousedat[0] |= (b&0x02) ? 0x00 : 0x01; /* middle button */
|
|
||||||
mousedat[0] |= (b&0x04) ? 0x00 : 0x02; /* right button */
|
|
||||||
mousedat[1] = x;
|
|
||||||
mousedat[2] = y;
|
|
||||||
mousedat[3] = x; /* same as byte 1 */
|
|
||||||
mousedat[4] = y; /* same as byte 2 */
|
|
||||||
|
|
||||||
if (!(serial->mctrl & 0x10))
|
|
||||||
{
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[0]);
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[1]);
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[2]);
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[3]);
|
|
||||||
serial_write_fifo(mouse->serial, mousedat[4]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouse_serial_rcr(struct SERIAL *serial, void *p)
|
|
||||||
{
|
|
||||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
|
||||||
|
|
||||||
mouse->mousepos = -1;
|
|
||||||
mouse->mousedelay = 5000 * (1 << TIMER_SHIFT);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mousecallback(void *p)
|
|
||||||
{
|
|
||||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
|
||||||
|
|
||||||
mouse->mousedelay = 0;
|
|
||||||
if (mouse->mousepos == -1)
|
|
||||||
{
|
|
||||||
mouse->mousepos = 0;
|
|
||||||
switch(mouse->type)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
serial_write_fifo(mouse->serial, 'H');
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
default:
|
|
||||||
serial_write_fifo(mouse->serial, 'M');
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
serial_write_fifo(mouse->serial, 'M');
|
|
||||||
serial_write_fifo(mouse->serial, '3');
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
serial_write_fifo(mouse->serial, 'M');
|
|
||||||
serial_write_fifo(mouse->serial, 'Z');
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void *mouse_serial_common_init(int type)
|
|
||||||
{
|
|
||||||
mouse_serial_t *mouse = (mouse_serial_t *)malloc(sizeof(mouse_serial_t));
|
|
||||||
memset(mouse, 0, sizeof(mouse_serial_t));
|
|
||||||
|
|
||||||
mouse->serial = &serial1;
|
|
||||||
serial1.rcr_callback = mouse_serial_rcr;
|
|
||||||
serial1.rcr_callback_p = mouse;
|
|
||||||
timer_add(mousecallback, &mouse->mousedelay, &mouse->mousedelay, mouse);
|
|
||||||
|
|
||||||
mouse->type = type;
|
|
||||||
|
|
||||||
return mouse;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *mouse_serial_msystems_init()
|
|
||||||
{
|
|
||||||
return mouse_serial_common_init(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *mouse_serial_init()
|
|
||||||
{
|
|
||||||
return mouse_serial_common_init(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *mouse_serial_logitech_init()
|
|
||||||
{
|
|
||||||
return mouse_serial_common_init(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *mouse_serial_mswheel_init()
|
|
||||||
{
|
|
||||||
return mouse_serial_common_init(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void mouse_serial_close(void *p)
|
|
||||||
{
|
|
||||||
mouse_serial_t *mouse = (mouse_serial_t *)p;
|
|
||||||
|
|
||||||
free(mouse);
|
|
||||||
|
|
||||||
serial1.rcr_callback = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
mouse_t mouse_msystems =
|
|
||||||
{
|
|
||||||
"Mouse Systems Mouse (serial)",
|
|
||||||
"mssystems",
|
|
||||||
MOUSE_TYPE_MSYSTEMS | MOUSE_TYPE_3BUTTON,
|
|
||||||
mouse_serial_msystems_init,
|
|
||||||
mouse_serial_close,
|
|
||||||
mouse_serial_msystems_poll
|
|
||||||
};
|
|
||||||
|
|
||||||
mouse_t mouse_serial_microsoft =
|
|
||||||
{
|
|
||||||
"Microsoft 2-button mouse (serial)",
|
|
||||||
"msserial",
|
|
||||||
MOUSE_TYPE_SERIAL,
|
|
||||||
mouse_serial_init,
|
|
||||||
mouse_serial_close,
|
|
||||||
mouse_serial_poll
|
|
||||||
};
|
|
||||||
|
|
||||||
mouse_t mouse_serial_logitech =
|
|
||||||
{
|
|
||||||
"Logitech 3-button mouse (serial)",
|
|
||||||
"lserial",
|
|
||||||
MOUSE_TYPE_LOGITECH | MOUSE_TYPE_3BUTTON,
|
|
||||||
mouse_serial_logitech_init,
|
|
||||||
mouse_serial_close,
|
|
||||||
mouse_serial_poll
|
|
||||||
};
|
|
||||||
|
|
||||||
mouse_t mouse_serial_mswheel =
|
|
||||||
{
|
|
||||||
"Microsoft wheel mouse (serial)",
|
"Microsoft wheel mouse (serial)",
|
||||||
"mssystems",
|
"mswheel",
|
||||||
MOUSE_TYPE_MSWHEEL | MOUSE_TYPE_3BUTTON,
|
MOUSE_TYPE_MSWHEEL | MOUSE_TYPE_3BUTTON,
|
||||||
mouse_serial_mswheel_init,
|
sermouse_init_mswheel,
|
||||||
mouse_serial_close,
|
sermouse_close,
|
||||||
mouse_serial_poll
|
sermouse_poll
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* 86Box A hypervisor and IBM PC system emulator that specializes in
|
|
||||||
* running old operating systems and software designed for IBM
|
|
||||||
* PC systems and compatibles from 1981 through fairly recent
|
|
||||||
* system designs based on the PCI bus.
|
|
||||||
*
|
|
||||||
* This file is part of the 86Box distribution.
|
|
||||||
*
|
|
||||||
* Implementation of Serial Mouse devices.
|
|
||||||
*
|
|
||||||
* Definitions for the Serial Mouse driver.
|
|
||||||
*
|
|
||||||
* Version: @(#)mouse_serial.h 1.0.3 2017/06/19
|
|
||||||
*
|
|
||||||
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
|
|
||||||
*/
|
|
||||||
#ifndef MOUSE_SERIAL_H
|
|
||||||
# define MOUSE_SERIAL_H
|
|
||||||
|
|
||||||
|
|
||||||
#define SERMOUSE_PORT 1 /* attach to Serial1 */
|
|
||||||
|
|
||||||
|
|
||||||
extern mouse_t mouse_msystems;
|
|
||||||
extern mouse_t mouse_serial_microsoft;
|
|
||||||
extern mouse_t mouse_serial_logitech;
|
|
||||||
extern mouse_t mouse_serial_mswheel;
|
|
||||||
|
|
||||||
|
|
||||||
#endif /*MOUSE_SERIAL_H*/
|
|
||||||
@@ -5,7 +5,11 @@
|
|||||||
#define SCSI_H
|
#define SCSI_H
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef WALTJE
|
||||||
|
#define SCSI_TIME (50 * (1 << TIMER_SHIFT))
|
||||||
|
#else
|
||||||
#define SCSI_TIME (5 * 100 * (1 << TIMER_SHIFT))
|
#define SCSI_TIME (5 * 100 * (1 << TIMER_SHIFT))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* SCSI commands. */
|
/* SCSI commands. */
|
||||||
|
|||||||
@@ -39,6 +39,9 @@
|
|||||||
#include "scsi_aha154x.h"
|
#include "scsi_aha154x.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define SCSI_DELAY_TM 1 /* was 50 */
|
||||||
|
|
||||||
|
|
||||||
#define AHA AHA154xCF /* set desired card type */
|
#define AHA AHA154xCF /* set desired card type */
|
||||||
#define AHA154xB 1 /* AHA-154x Rev.B */
|
#define AHA154xB 1 /* AHA-154x Rev.B */
|
||||||
#define AHA154xC 2 /* AHA-154x Rev.C */
|
#define AHA154xC 2 /* AHA-154x Rev.C */
|
||||||
@@ -419,8 +422,9 @@ again:
|
|||||||
aha_eep[0] |= (0x10 | 0x20 | 0x40);
|
aha_eep[0] |= (0x10 | 0x20 | 0x40);
|
||||||
aha_eep[1] = irq-9; /* IRQ15 */
|
aha_eep[1] = irq-9; /* IRQ15 */
|
||||||
aha_eep[1] |= (dma<<4); /* DMA6 */
|
aha_eep[1] |= (dma<<4); /* DMA6 */
|
||||||
aha_eep[2] = (EE2_DYNSCAN | /* BIOS Space Reserved */
|
aha_eep[2] = (EE2_HABIOS | /* BIOS enabled */
|
||||||
EE2_EXT1G | EE2_RMVOK); /* Immediate return on seek */
|
EE2_DYNSCAN | /* scan bus */
|
||||||
|
EE2_EXT1G | EE2_RMVOK);/* Immediate return on seek */
|
||||||
aha_eep[3] = SPEED_50; /* speed 5.0 MB/s */
|
aha_eep[3] = SPEED_50; /* speed 5.0 MB/s */
|
||||||
aha_eep[6] = (EE6_TERM | /* host term enable */
|
aha_eep[6] = (EE6_TERM | /* host term enable */
|
||||||
EE6_RSTBUS); /* reset SCSI bus on boot */
|
EE6_RSTBUS); /* reset SCSI bus on boot */
|
||||||
@@ -1371,7 +1375,7 @@ aha_write(uint16_t port, uint8_t val, void *priv)
|
|||||||
/* If there are no mailboxes configured, don't even try to do anything. */
|
/* If there are no mailboxes configured, don't even try to do anything. */
|
||||||
if (dev->MailboxCount) {
|
if (dev->MailboxCount) {
|
||||||
if (!AHA_Callback) {
|
if (!AHA_Callback) {
|
||||||
AHA_Callback = 50 * SCSI_TIME;
|
AHA_Callback = SCSI_DELAY_TM * SCSI_TIME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -2106,7 +2110,7 @@ aha_cmd_cb(void *priv)
|
|||||||
if (dev->MailboxCount) {
|
if (dev->MailboxCount) {
|
||||||
aha_do_mail(dev);
|
aha_do_mail(dev);
|
||||||
} else {
|
} else {
|
||||||
AHA_Callback += 50 * SCSI_TIME;
|
AHA_Callback += SCSI_DELAY_TM * SCSI_TIME;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (AHA_InOperation == 1) {
|
} else if (AHA_InOperation == 1) {
|
||||||
@@ -2128,7 +2132,7 @@ aha_cmd_cb(void *priv)
|
|||||||
fatal("Invalid BusLogic callback phase: %i\n", AHA_InOperation);
|
fatal("Invalid BusLogic callback phase: %i\n", AHA_InOperation);
|
||||||
}
|
}
|
||||||
|
|
||||||
AHA_Callback += 50 * SCSI_TIME;
|
AHA_Callback += SCSI_DELAY_TM * SCSI_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t aha_mca_read(int port, void *p)
|
uint8_t aha_mca_read(int port, void *p)
|
||||||
|
|||||||
17
src/serial.c
17
src/serial.c
@@ -186,8 +186,11 @@ update_ints(SERIAL *sp)
|
|||||||
sp->iir = IID_IDMDM;
|
sp->iir = IID_IDMDM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If IRQ line not enabled, done. */
|
||||||
|
if (!(sp->mctrl & MCR_OUT2) && !PCJR) return;
|
||||||
|
|
||||||
/* Raise or clear the level-based IRQ. */
|
/* Raise or clear the level-based IRQ. */
|
||||||
if (stat && ((sp->mctrl & MCR_OUT2) || PCJR))
|
if (stat)
|
||||||
picintlevel(1 << sp->irq);
|
picintlevel(1 << sp->irq);
|
||||||
else
|
else
|
||||||
picintc(1 << sp->irq);
|
picintc(1 << sp->irq);
|
||||||
@@ -291,7 +294,9 @@ serial_write(uint16_t addr, uint8_t val, void *priv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 3: /* LCR */
|
case 3: /* LCR */
|
||||||
if ((sp->lcr & LCR_DLAB) && !(val & LCR_DLAB)) {
|
if (! (val & LCR_DLAB)) {
|
||||||
|
/* DLAB clear. Was it set? */
|
||||||
|
if (sp->lcr & LCR_DLAB) {
|
||||||
/* We dropped DLAB, so handle baudrate. */
|
/* We dropped DLAB, so handle baudrate. */
|
||||||
baud = ((sp->dlab2<<8) | sp->dlab1);
|
baud = ((sp->dlab2<<8) | sp->dlab1);
|
||||||
if (baud > 0) {
|
if (baud > 0) {
|
||||||
@@ -304,13 +309,15 @@ serial_write(uint16_t addr, uint8_t val, void *priv)
|
|||||||
serial_log(1, "Serial%d: divisor %u invalid!\n",
|
serial_log(1, "Serial%d: divisor %u invalid!\n",
|
||||||
sp->port, baud);
|
sp->port, baud);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
wl = (val & LCR_WLS) + 5; /* databits */
|
wl = (val & LCR_WLS) + 5; /* databits */
|
||||||
sb = (val & LCR_SBS) ? 2 : 1; /* stopbits */
|
sb = (val & LCR_SBS) ? 2 : 1; /* stopbits */
|
||||||
pa = (val & (LCR_PE|LCR_EP|LCR_PS)) >> 3;
|
pa = (val & (LCR_PE|LCR_EP|LCR_PS)) >> 3;
|
||||||
serial_log(2, "Serial%d: WL=%d SB=%d PA=%d\n", sp->port, wl, sb, pa);
|
serial_log(2, "Serial%d: WL=%d SB=%d PA=%d\n", sp->port, wl, sb, pa);
|
||||||
if (sp->bh != NULL)
|
if (sp->bh != NULL)
|
||||||
bhtty_params((BHTTY *)sp->bh, wl, pa, sb);
|
bhtty_params((BHTTY *)sp->bh, wl, pa, sb);
|
||||||
|
}
|
||||||
|
}
|
||||||
sp->lcr = val;
|
sp->lcr = val;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -338,12 +345,14 @@ serial_write(uint16_t addr, uint8_t val, void *priv)
|
|||||||
&sp->receive_delay,
|
&sp->receive_delay,
|
||||||
&sp->receive_delay, sp);
|
&sp->receive_delay, sp);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* Fake CTS, DSR and DCD (for now.) */
|
/* Fake CTS, DSR and DCD (for now.) */
|
||||||
sp->msr = (MSR_CTS | MSR_DCTS |
|
sp->msr = (MSR_CTS | MSR_DCTS |
|
||||||
MSR_DSR | MSR_DDSR |
|
MSR_DSR | MSR_DDSR |
|
||||||
MSR_DCD | MSR_DDCD);
|
MSR_DCD | MSR_DDCD);
|
||||||
sp->int_status |= SERINT_MSR;
|
sp->int_status |= SERINT_MSR;
|
||||||
update_ints(sp);
|
update_ints(sp);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sp->mctrl = val;
|
sp->mctrl = val;
|
||||||
@@ -424,7 +433,9 @@ serial_read(uint16_t addr, void *priv)
|
|||||||
} else {
|
} else {
|
||||||
sp->lsr &= ~LSR_DR;
|
sp->lsr &= ~LSR_DR;
|
||||||
sp->int_status &= ~SERINT_RECEIVE;
|
sp->int_status &= ~SERINT_RECEIVE;
|
||||||
|
#if 0
|
||||||
update_ints(sp);
|
update_ints(sp);
|
||||||
|
#endif
|
||||||
ret = read_fifo(sp);
|
ret = read_fifo(sp);
|
||||||
if ((sp->bh == NULL) &&
|
if ((sp->bh == NULL) &&
|
||||||
(sp->fifo_read != sp->fifo_write))
|
(sp->fifo_read != sp->fifo_write))
|
||||||
|
|||||||
Reference in New Issue
Block a user