summaryrefslogtreecommitdiff
path: root/console.c
diff options
context:
space:
mode:
authorrsc <rsc>2009-05-31 00:24:11 +0000
committerrsc <rsc>2009-05-31 00:24:11 +0000
commit74afa70d3051553df46d1ea0d76149a7a86c0a47 (patch)
tree593b7b00869b161597d2d8b5af76ee09d4cc7c12 /console.c
parent0ca9ca0c55922f72dbf324c4ac1aecf8069d1dbe (diff)
downloadxv6-labs-74afa70d3051553df46d1ea0d76149a7a86c0a47.tar.gz
xv6-labs-74afa70d3051553df46d1ea0d76149a7a86c0a47.tar.bz2
xv6-labs-74afa70d3051553df46d1ea0d76149a7a86c0a47.zip
Add serial port input/output.
Delete parallel port output. Works well with qemu -nographic mode.
Diffstat (limited to 'console.c')
-rw-r--r--console.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/console.c b/console.c
index c1c66b2..8f89b49 100644
--- a/console.c
+++ b/console.c
@@ -1,6 +1,6 @@
// Console input and output.
-// Input is from the keyboard only.
-// Output is written to the screen and the printer port.
+// Input is from the keyboard or serial port.
+// Output is written to the screen and serial port.
#include "types.h"
#include "defs.h"
@@ -13,31 +13,13 @@
#include "x86.h"
#define CRTPORT 0x3d4
-#define LPTPORT 0x378
#define BACKSPACE 0x100
static ushort *crt = (ushort*)0xb8000; // CGA memory
static struct spinlock console_lock;
int panicked = 0;
-int use_console_lock = 0;
-
-// Copy console output to parallel port, which you can tell
-// .bochsrc to copy to the stdout:
-// parport1: enabled=1, file="/dev/stdout"
-static void
-lptputc(int c)
-{
- int i;
-
- for(i = 0; !(inb(LPTPORT+1) & 0x80) && i < 12800; i++)
- ;
- if(c == BACKSPACE)
- c = '\b';
- outb(LPTPORT+0, c);
- outb(LPTPORT+2, 0x08|0x04|0x01);
- outb(LPTPORT+2, 0x08);
-}
+volatile int use_console_lock = 0;
static void
cgaputc(int c)
@@ -80,14 +62,14 @@ consputc(int c)
;
}
- lptputc(c);
+ uartputc(c);
cgaputc(c);
}
void
printint(int xx, int base, int sgn)
{
- static char digits[] = "0123456789ABCDEF";
+ static char digits[] = "0123456789abcdef";
char buf[16];
int i = 0, neg = 0;
uint x;