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.
*
* 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>
*/
@@ -33,7 +33,7 @@ typedef struct mouse_serial_t {
/* Callback from serial driver: RTS was toggled. */
static void
sermouse_callback(SERIAL *serial, void *priv)
sermouse_callback(void *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.
*
* 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>
* Copyright 2017 Fred N. van Kempen.
@@ -238,6 +238,9 @@ serial_write(uint16_t addr, uint8_t val, void *priv)
uint16_t baud;
long speed;
#if 0
pclog("Serial%d: write(%04x, %02x)\n", sp->port, addr, val);
#endif
switch (addr & 0x07) {
case 0: /* DATA / DLAB1 */
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",
sp->port, baud, speed);
#endif
if (sp->bh != NULL)
if ((sp->bh != NULL) && (speed > 0))
bhtty_speed((BHTTY *)sp->bh, speed);
#if 0
} else {
pclog("Serial%d: divisor %u invalid!\n",
sp->port, baud);
#endif
}
}
wl = (val & LCR_WLS) + 5; /* databits */
@@ -316,7 +321,7 @@ serial_write(uint16_t addr, uint8_t val, void *priv)
* enumerator there 'is' something.
*/
if (sp->rts_callback) {
sp->rts_callback(sp, sp->rts_callback_p);
sp->rts_callback(sp->rts_callback_p);
#if 0
pclog("RTS raised; sending ID\n");
#endif
@@ -505,8 +510,12 @@ serial_setup(int port, uint16_t addr, int irq)
serial_read, NULL, NULL,
serial_write, NULL, NULL, sp);
#if 1
/* Do not disable here, it breaks the SIO chips. */
#else
/* No DTR/RTS callback for now. */
sp->rts_callback = NULL;
#endif
}
@@ -521,8 +530,12 @@ serial_remove(int port)
// FIXME: stop timer, if enabled!
#if 1
/* Do not disable here, it breaks the SIO chips. */
#else
/* Remove any callbacks. */
sp->rts_callback = NULL;
#endif
/* Close the host device. */
(void)serial_link(port, NULL);

View File

@@ -8,7 +8,7 @@
*
* 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>
* Copyright 2017 Fred N. van Kempen.
@@ -38,7 +38,7 @@ typedef struct _serial_ {
uint8_t fcr;
/* Data for the RTS-toggle callback. */
void (*rts_callback)(struct _serial_ *, void *);
void (*rts_callback)(void *);
void *rts_callback_p;
uint8_t hold;