diff options
Diffstat (limited to 'bsp/x86/drivers/serial.c')
| -rw-r--r-- | bsp/x86/drivers/serial.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/bsp/x86/drivers/serial.c b/bsp/x86/drivers/serial.c index f5510ae0d5..3ed8d6fed5 100644 --- a/bsp/x86/drivers/serial.c +++ b/bsp/x86/drivers/serial.c @@ -8,7 +8,7 @@ * 2006-09-15 QiuYi the first version * 2006-10-10 Bernard use keyboard instead of serial */ - + #include <rtthread.h> #include <rthw.h> @@ -24,26 +24,26 @@ */ void rt_serial_init(void) { - outb(COM1+3,0x80); /* set DLAB of line control reg */ - outb(COM1,0x0c); /* LS of divisor (48 -> 2400 bps */ - outb(COM1+1,0x00); /* MS of divisor */ - outb(COM1+3,0x03); /* reset DLAB */ - outb(COM1+4,0x0b); /* set DTR,RTS, OUT_2 */ - outb(COM1+1,0x0d); /* enable all intrs but writes */ - inb(COM1); /* read data port to reset things (?) */ + outb(COM1+3,0x80); /* set DLAB of line control reg */ + outb(COM1,0x0c); /* LS of divisor (48 -> 2400 bps */ + outb(COM1+1,0x00); /* MS of divisor */ + outb(COM1+3,0x03); /* reset DLAB */ + outb(COM1+4,0x0b); /* set DTR,RTS, OUT_2 */ + outb(COM1+1,0x0d); /* enable all intrs but writes */ + inb(COM1); /* read data port to reset things (?) */ } /** - * This function read a character from serial without interrupt enable mode + * This function read a character from serial without interrupt enable mode * * @return the read char */ char rt_serial_getc(void) { - while(!(inb(COM1+COMSTATUS) & COMDATA)); - - return inb(COM1+COMREAD); + while(!(inb(COM1+COMSTATUS) & COMDATA)); + + return inb(COM1+COMREAD); } @@ -54,15 +54,15 @@ char rt_serial_getc(void) */ void rt_serial_putc(const char c) { - int val; - - while(1) - { - if ((val = inb(COM1+COMSTATUS)) & THRE) - break; - } - - outb(COM1+COMWRITE, c&0xff); + int val; + + while(1) + { + if ((val = inb(COM1+COMSTATUS)) & THRE) + break; + } + + outb(COM1+COMWRITE, c&0xff); } /*@}*/ |
