RTL driver update (still in progress)

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3346 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2011-03-06 13:55:20 +00:00
parent b1397cd73c
commit e7fd9883f0
2 changed files with 33 additions and 13 deletions

View File

@ -45,6 +45,32 @@
* Pre-processor Definitions
****************************************************************************/
/* COM1 port addresses */
#define COM1_PORT 0x3f8 /* COM1: I/O port 0x3f8, IRQ 4 */
#define COM2_PORT 0x2f8 /* COM2: I/O port 0x2f8, IRQ 3 */
#define COM3_PORT 0x3e8 /* COM3: I/O port 0x3e8, IRQ 4 */
#define COM4_PORT 0x2e8 /* COM4: I/O port 0x2e8, IRQ 3 */
/* 16650 register offsets */
#define COM_RBR 0 /* DLAB=0, Receiver Buffer (read) */
#define COM_THR 0 /* DLAB=0, Transmitter Holding Register (write) */
#define COM_DLL 0 /* DLAB=1, Divisor Latch (least significant byte) */
#define COM_IER 1 /* DLAB=0, Interrupt Enable */
#define COM_DLM 1 /* DLAB=1, Divisor Latch(most significant byte) */
#define COM_IIR 2 /* Interrupt Identification (read) */
#define COM_FCR 2 /* FIFO Control (write) */
#define COM_LCR 3 /* Line Control */
#define COM_MCR 4 /* MODEM Control */
#define COM_LSR 5 /* Line Status */
#define COM_MSR 6 /* MODEM Status */
#define COM_SCR 7 /* Scratch */
/* 16650 register bit definitions */
#define LSR_THRE (1 << 5) /* Bit 5: Transmitter Holding Register Empty */
/****************************************************************************
* Private Data
****************************************************************************/
@ -67,14 +93,12 @@
void up_lowputc(char ch)
{
/* Wait until the BIOS can accept another character (so that the OS will
* continue to run.
*/
/* Wait until the Transmitter Holding Register (THR) is empty. */
while ((inb(0x3f8+5) & (1 << 5)) == 0);
while ((inb(COM1_PORT+COM_LSR) & LSR_THRE) == 0);
/* Then output the character */
/* Then output the character to the THR*/
outb(ch, 0x3f8);
outb(ch, COM1_PORT+COM_THR);
}

View File

@ -296,14 +296,10 @@ irq_common:
/* Trace macros, use like trace 'i' to print char to serial port. */
.macro io_outb, addr, data
mov dx, $\addr
mov al, $\data
out dx, al
.endm
.macro trace, ch
io_outb 0x3f8, \ch
mov $0x3f8, %dx
mov $\ch, %al
out %al, %dx
.endm
/* This macro creates a stub for an ISR which does NOT pass it's own