aboutsummaryrefslogtreecommitdiff
path: root/src/serial.c
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2008-06-07 10:43:07 -0400
committerKevin O'Connor <kevin@koconnor.net>2008-06-07 10:43:07 -0400
commit5c73240407f321312fc05a83fd246f47b0dbbbec (patch)
tree55fdb07b7162af431c861ddec917572114adb86a /src/serial.c
parentc1adedc1c04b25fb14efa8bdbd614f3c31a14593 (diff)
downloadseabios-hppa-5c73240407f321312fc05a83fd246f47b0dbbbec.zip
seabios-hppa-5c73240407f321312fc05a83fd246f47b0dbbbec.tar.gz
seabios-hppa-5c73240407f321312fc05a83fd246f47b0dbbbec.tar.bz2
Serial debugging code must not access BDA.
Regular serial writing code uses the system timer to timeout failed writes - however, serial debugging can't rely on access to the BDA segment or the hardware timer. Therefore, implement a simple debug only serial writing function and separate it from the regular serial output code. Also include change to dump_regs - don't call __dprintf if debugging not on.
Diffstat (limited to 'src/serial.c')
-rw-r--r--src/serial.c49
1 files changed, 10 insertions, 39 deletions
diff --git a/src/serial.c b/src/serial.c
index 026c399..f9988a3 100644
--- a/src/serial.c
+++ b/src/serial.c
@@ -76,10 +76,15 @@ handle_1400(struct bregs *regs)
set_success(regs);
}
-static int
-write_serial(u16 addr, u16 timeout, char c)
+// SERIAL - WRITE CHARACTER TO PORT
+static void
+handle_1401(struct bregs *regs)
{
+ u16 addr = getComAddr(regs);
+ if (!addr)
+ return;
u16 timer = GET_BDA(timer_counter);
+ u16 timeout = GET_BDA(com_timeout[regs->dx]);
while (((inb(addr+5) & 0x60) != 0x60) && (timeout)) {
u16 val16 = GET_BDA(timer_counter);
if (val16 != timer) {
@@ -87,24 +92,10 @@ write_serial(u16 addr, u16 timeout, char c)
timeout--;
}
}
- if (!timeout)
- // Ran out of time.
- return -1;
- outb(c, addr);
- return 0;
-}
-
-// SERIAL - WRITE CHARACTER TO PORT
-static void
-handle_1401(struct bregs *regs)
-{
- u16 addr = getComAddr(regs);
- if (!addr)
- return;
- u16 timeout = GET_BDA(com_timeout[regs->dx]);
- int ret = write_serial(addr, timeout, regs->al);
+ if (timeout)
+ outb(regs->al, addr);
regs->ah = inb(addr+5);
- if (ret)
+ if (!timeout)
regs->ah |= 0x80;
set_success(regs);
}
@@ -172,26 +163,6 @@ handle_14(struct bregs *regs)
/****************************************************************
- * Serial debugging
- ****************************************************************/
-
-#define BX_DEBUG_PORT 0x03f8
-
-void
-debug_serial_setup()
-{
- /* setup for serial logging: 8N1 */
- outb(0x03, BX_DEBUG_PORT+3);
-}
-
-void
-debug_serial(char c)
-{
- write_serial(BX_DEBUG_PORT, 0x0a, c);
-}
-
-
-/****************************************************************
* LPT ports
****************************************************************/