summaryrefslogtreecommitdiff
path: root/nuttx/arch/x86
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-06 13:55:20 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2011-03-06 13:55:20 +0000
commit517ae43b4f1c1eaf64137a5a6d0d79f3e26608af (patch)
tree5a063aa82942faca48e26c8c35b6e65ef8c0b89c /nuttx/arch/x86
parent84beafe48b5fdb3bf8dfc80bf84ce922eb7dba31 (diff)
downloadpx4-nuttx-517ae43b4f1c1eaf64137a5a6d0d79f3e26608af.tar.gz
px4-nuttx-517ae43b4f1c1eaf64137a5a6d0d79f3e26608af.tar.bz2
px4-nuttx-517ae43b4f1c1eaf64137a5a6d0d79f3e26608af.zip
RTL driver update (still in progress)
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3346 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/x86')
-rw-r--r--nuttx/arch/x86/src/qemu/qemu_lowputc.c36
-rwxr-xr-xnuttx/arch/x86/src/qemu/qemu_vectors.S10
2 files changed, 33 insertions, 13 deletions
diff --git a/nuttx/arch/x86/src/qemu/qemu_lowputc.c b/nuttx/arch/x86/src/qemu/qemu_lowputc.c
index 4e3471e60..1fa4aa6c5 100644
--- a/nuttx/arch/x86/src/qemu/qemu_lowputc.c
+++ b/nuttx/arch/x86/src/qemu/qemu_lowputc.c
@@ -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);
}
diff --git a/nuttx/arch/x86/src/qemu/qemu_vectors.S b/nuttx/arch/x86/src/qemu/qemu_vectors.S
index 810904538..6795203e2 100755
--- a/nuttx/arch/x86/src/qemu/qemu_vectors.S
+++ b/nuttx/arch/x86/src/qemu/qemu_vectors.S
@@ -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