changeset 393:d7591faa1258

target-utils serial I/O made consistent with other projects
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Wed, 11 Jun 2014 17:22:55 +0000
parents 134c047c1269
children 6661e5bc0712
files target-utils/libcommon/Makefile target-utils/libcommon/serflush.S target-utils/libcommon/serio.S
diffstat 3 files changed, 12 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/target-utils/libcommon/Makefile	Wed Jun 11 16:38:28 2014 +0000
+++ b/target-utils/libcommon/Makefile	Wed Jun 11 17:22:55 2014 +0000
@@ -4,7 +4,7 @@
 AR=	arm-elf-ar
 RANLIB=	arm-elf-ranlib
 
-OBJS=	cmdentry.o dispatch.o hexarg.o parseargs.o serio.o serflush.o uartsel.o\
+OBJS=	cmdentry.o dispatch.o hexarg.o parseargs.o serio.o uartsel.o \
 	cmd_baud_switch.o cmd_dieid.o cmd_jump.o cmd_r8.o cmd_r16.o cmd_r32.o \
 	cmd_w8.o cmd_w16.o cmd_w32.o abbcmd.o abbdrv.o osmodelay.o spidrv.o
 
--- a/target-utils/libcommon/serflush.S	Wed Jun 11 16:38:28 2014 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#include "ns16550.h"
-
-	.text
-	.code	32
-	.global	serial_flush
-serial_flush:
-	ldr	r1, =uart_base
-	ldr	r2, [r1]
-1:	ldrb	r3, [r2, #NS16550_LSR]
-	tst	r3, #NS16550_LSR_TEMP
-	beq	1b
-	bx	lr
--- a/target-utils/libcommon/serio.S	Wed Jun 11 16:38:28 2014 +0000
+++ b/target-utils/libcommon/serio.S	Wed Jun 11 17:22:55 2014 +0000
@@ -20,7 +20,15 @@
 	ldr	r2, [r1]
 	ldrb	r3, [r2, #NS16550_LSR]
 	tst	r3, #NS16550_LSR_DR
-	mvneq	r0, #1
-	bxeq	lr
-	ldrb	r0, [r2, #NS16550_RBR]
+	ldrneb	r0, [r2, #NS16550_RBR]
+	mvneq	r0, #0
 	bx	lr
+
+	.global	serial_flush
+serial_flush:
+	ldr	r1, =uart_base
+	ldr	r2, [r1]
+1:	ldrb	r3, [r2, #NS16550_LSR]
+	tst	r3, #NS16550_LSR_TEMP
+	beq	1b
+	bx	lr