summaryrefslogtreecommitdiffstats
path: root/nuttx/arch/arm/src/dm320
diff options
context:
space:
mode:
authorpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2007-11-20 20:32:33 +0000
committerpatacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679>2007-11-20 20:32:33 +0000
commitcb241d68c3b5166c8c5bab79d44555c1671f426d (patch)
tree0af928d900e8e43c520f6b06248eb84177b6a56e /nuttx/arch/arm/src/dm320
parent057172a274ad036c66b579bc61a4eca07528a633 (diff)
Several webserver bugs fixed
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@391 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/arch/arm/src/dm320')
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_lowputc.S6
-rw-r--r--nuttx/arch/arm/src/dm320/dm320_serial.c61
2 files changed, 64 insertions, 3 deletions
diff --git a/nuttx/arch/arm/src/dm320/dm320_lowputc.S b/nuttx/arch/arm/src/dm320/dm320_lowputc.S
index c27918262b..5566b3f584 100644
--- a/nuttx/arch/arm/src/dm320/dm320_lowputc.S
+++ b/nuttx/arch/arm/src/dm320/dm320_lowputc.S
@@ -84,10 +84,10 @@
up_lowputc:
/* On entry, r0 holds the character to be printed */
-#ifdef CONFIG_UART0_SERIAL_CONSOLE
- ldr r2, =DM320_UART0_REGISTER_BASE /* r2=UART0 base */
-#else
+#ifdef CONFIG_UART1_SERIAL_CONSOLE
ldr r2, =DM320_UART1_REGISTER_BASE /* r2=UART1 base */
+#else
+ ldr r2, =DM320_UART0_REGISTER_BASE /* r2=UART0 base */
#endif
/* Poll the TX fifo trigger level bit of the UART_SSR
diff --git a/nuttx/arch/arm/src/dm320/dm320_serial.c b/nuttx/arch/arm/src/dm320/dm320_serial.c
index 8051393cf3..c74264b8d7 100644
--- a/nuttx/arch/arm/src/dm320/dm320_serial.c
+++ b/nuttx/arch/arm/src/dm320/dm320_serial.c
@@ -38,20 +38,25 @@
************************************************************/
#include <nuttx/config.h>
+
#include <sys/types.h>
#include <unistd.h>
#include <semaphore.h>
#include <string.h>
#include <errno.h>
#include <debug.h>
+
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include <nuttx/serial.h>
#include <arch/serial.h>
+
#include "up_arch.h"
#include "os_internal.h"
#include "up_internal.h"
+#if CONFIG_NFILE_DESCRIPTORS > 0
+
/************************************************************
* Definitions
************************************************************/
@@ -723,3 +728,59 @@ int up_putc(int ch)
return ch;
}
+#else /* CONFIG_NFILE_DESCRIPTORS > 0 */
+
+/************************************************************
+ * Definitions
+ ************************************************************/
+
+# ifdef CONFIG_UART1_SERIAL_CONSOLE
+# define DM320_REGISTER_BASE DM320_UART1_REGISTER_BASE
+# else
+# define DM320_REGISTER_BASE DM320_UART0_REGISTER_BASE
+# endif
+
+/************************************************************
+ * Private Functions
+ ************************************************************/
+
+static inline void up_waittxfifonotfull(void)
+{
+ int tmp;
+
+ for (tmp = 1000 ; tmp > 0 ; tmp--)
+ {
+
+ if ((getreg16(DM320_REGISTER_BASE + UART_SR) & UART_SR_TFTI) != 0)
+ {
+ break;
+ }
+ }
+}
+
+/************************************************************
+ * Public Functions
+ ************************************************************/
+
+int up_putc(int ch)
+{
+ up_waittxfifonotfull();
+ putreg16((uint16)ch, DM320_REGISTER_BASE + UART_DTRR);
+
+ /* Check for LF */
+
+ if (ch == '\n')
+ {
+ /* Add CR */
+
+ up_waittxfifonotfull();
+ putreg16((uint16)'\r', DM320_REGISTER_BASE + UART_DTRR);
+ }
+
+ up_waittxfifonotfull();
+ return ch;
+}
+
+#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */
+
+