Another fixup for the serial driver for chipset-based boards. Serial mice now work as expected on those as well.

This commit is contained in:
waltje
2017-05-07 23:39:45 -04:00
parent d75d630976
commit baa847b759
3 changed files with 21 additions and 8 deletions

View File

@@ -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.2 2017/05/06 * Version: @(#)mouse_serial.c 1.0.3 2017/05/07
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
*/ */
@@ -33,7 +33,7 @@ typedef struct mouse_serial_t {
/* Callback from serial driver: RTS was toggled. */ /* Callback from serial driver: RTS was toggled. */
static void static void
sermouse_callback(SERIAL *serial, void *priv) sermouse_callback(void *priv)
{ {
mouse_serial_t *ms = (mouse_serial_t *)priv; mouse_serial_t *ms = (mouse_serial_t *)priv;

View File

@@ -33,7 +33,7 @@
* *
* Based on the 86Box serial port driver as a framework. * Based on the 86Box serial port driver as a framework.
* *
* Version: @(#)serial.c 1.0.4 2017/05/07 * Version: @(#)serial.c 1.0.5 2017/05/07
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Copyright 2017 Fred N. van Kempen. * Copyright 2017 Fred N. van Kempen.
@@ -238,6 +238,9 @@ serial_write(uint16_t addr, uint8_t val, void *priv)
uint16_t baud; uint16_t baud;
long speed; long speed;
#if 0
pclog("Serial%d: write(%04x, %02x)\n", sp->port, addr, val);
#endif
switch (addr & 0x07) { switch (addr & 0x07) {
case 0: /* DATA / DLAB1 */ case 0: /* DATA / DLAB1 */
if (sp->lcr & LCR_DLAB) { if (sp->lcr & LCR_DLAB) {
@@ -289,11 +292,13 @@ serial_write(uint16_t addr, uint8_t val, void *priv)
pclog("Serial%d: divisor %u, baudrate %ld\n", pclog("Serial%d: divisor %u, baudrate %ld\n",
sp->port, baud, speed); sp->port, baud, speed);
#endif #endif
if (sp->bh != NULL) if ((sp->bh != NULL) && (speed > 0))
bhtty_speed((BHTTY *)sp->bh, speed); bhtty_speed((BHTTY *)sp->bh, speed);
#if 0
} else { } else {
pclog("Serial%d: divisor %u invalid!\n", pclog("Serial%d: divisor %u invalid!\n",
sp->port, baud); sp->port, baud);
#endif
} }
} }
wl = (val & LCR_WLS) + 5; /* databits */ wl = (val & LCR_WLS) + 5; /* databits */
@@ -316,7 +321,7 @@ serial_write(uint16_t addr, uint8_t val, void *priv)
* enumerator there 'is' something. * enumerator there 'is' something.
*/ */
if (sp->rts_callback) { if (sp->rts_callback) {
sp->rts_callback(sp, sp->rts_callback_p); sp->rts_callback(sp->rts_callback_p);
#if 0 #if 0
pclog("RTS raised; sending ID\n"); pclog("RTS raised; sending ID\n");
#endif #endif
@@ -505,8 +510,12 @@ serial_setup(int port, uint16_t addr, int irq)
serial_read, NULL, NULL, serial_read, NULL, NULL,
serial_write, NULL, NULL, sp); serial_write, NULL, NULL, sp);
#if 1
/* Do not disable here, it breaks the SIO chips. */
#else
/* No DTR/RTS callback for now. */ /* No DTR/RTS callback for now. */
sp->rts_callback = NULL; sp->rts_callback = NULL;
#endif
} }
@@ -521,8 +530,12 @@ serial_remove(int port)
// FIXME: stop timer, if enabled! // FIXME: stop timer, if enabled!
#if 1
/* Do not disable here, it breaks the SIO chips. */
#else
/* Remove any callbacks. */ /* Remove any callbacks. */
sp->rts_callback = NULL; sp->rts_callback = NULL;
#endif
/* Close the host device. */ /* Close the host device. */
(void)serial_link(port, NULL); (void)serial_link(port, NULL);

View File

@@ -8,7 +8,7 @@
* *
* Definitions for the SERIAL card. * Definitions for the SERIAL card.
* *
* Version: @(#)serial.h 1.0.2 2017/05/06 * Version: @(#)serial.h 1.0.3 2017/05/07
* *
* Author: Fred N. van Kempen, <decwiz@yahoo.com> * Author: Fred N. van Kempen, <decwiz@yahoo.com>
* Copyright 2017 Fred N. van Kempen. * Copyright 2017 Fred N. van Kempen.
@@ -38,7 +38,7 @@ typedef struct _serial_ {
uint8_t fcr; uint8_t fcr;
/* Data for the RTS-toggle callback. */ /* Data for the RTS-toggle callback. */
void (*rts_callback)(struct _serial_ *, void *); void (*rts_callback)(void *);
void *rts_callback_p; void *rts_callback_p;
uint8_t hold; uint8_t hold;