summaryrefslogtreecommitdiff
path: root/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-18 14:48:26 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2008-09-18 14:48:26 +0000
commitb1bb829bbf07e59acb1aecf24c514901b32752e2 (patch)
treee4748aef6be341f1656f646ace2d449dd3cdc72c /nuttx/arch/arm/src/lpc214x/lpc214x_serial.c
parent460d93a5ee00cdc770f4e02eef186af2f363a96f (diff)
downloadpx4-nuttx-b1bb829bbf07e59acb1aecf24c514901b32752e2.tar.gz
px4-nuttx-b1bb829bbf07e59acb1aecf24c514901b32752e2.tar.bz2
px4-nuttx-b1bb829bbf07e59acb1aecf24c514901b32752e2.zip
ARM architecture supports lowconsole
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@930 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/arm/src/lpc214x/lpc214x_serial.c')
-rw-r--r--nuttx/arch/arm/src/lpc214x/lpc214x_serial.c53
1 files changed, 40 insertions, 13 deletions
diff --git a/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c b/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c
index dc8a4accb..746899b96 100644
--- a/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c
+++ b/nuttx/arch/arm/src/lpc214x/lpc214x_serial.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * lpc214x/lpc214x_serial.c
+ * arch/arm/src/lpc214x/lpc214x_serial.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@@ -55,11 +55,13 @@
#include "lpc214x_uart.h"
+#ifdef CONFIG_USE_SERIALDRIVER
+
/****************************************************************************
* Definitions
****************************************************************************/
-#define BASE_BAUD 115200
+#define BASE_BAUD 38400
/****************************************************************************
* Private Types
@@ -458,9 +460,9 @@ static int up_interrupt(int irq, void *context)
*/
status = up_serialin(priv, LPC214X_UART_IIR_OFFSET);
-
+
/* The NO INTERRUPT should be zero */
-
+
if (status != LPC214X_IIR_NO_INT)
{
/* Handline incoming, receive bytes (with or without timeout) */
@@ -478,20 +480,20 @@ static int up_interrupt(int irq, void *context)
}
/* Just clear modem status interrupts */
-
+
else if (status == LPC214X_IIR_MS_INT)
{
/* Read the modem status regisgter (MSR) to clear */
-
+
(void)up_serialin(priv, LPC214X_UART_MSR_OFFSET);
}
/* Just clear any line status interrupts */
-
+
else if (status == LPC214X_IIR_RLS_INT)
{
/* Read the line status register (LSR) to clear */
-
+
(void)up_serialin(priv, LPC214X_UART_LSR_OFFSET);
}
}
@@ -698,19 +700,19 @@ static boolean up_txempty(struct uart_dev_s *dev)
void up_earlyserialinit(void)
{
/* Enable UART0 and 1 */
-
+
uint32 pinsel = getreg32(LPC214X_PINSEL0);
pinsel &= ~(LPC214X_UART0_PINMASK|LPC214X_UART1_PINMASK);
pinsel |= (LPC214X_UART0_PINSEL|LPC214X_UART1_PINSEL);
putreg32(pinsel, LPC214X_PINSEL0);
/* Disable both UARTS */
-
+
up_disableuartint(TTYS0_DEV.priv, NULL);
up_disableuartint(TTYS1_DEV.priv, NULL);
/* Configuration whichever on is the console */
-
+
CONSOLE_DEV.isconsole = TRUE;
up_setup(&CONSOLE_DEV);
}
@@ -735,8 +737,7 @@ void up_serialinit(void)
* Name: up_putc
*
* Description:
- * Provide priority, low-level access to support OS debug
- * writes
+ * Provide priority, low-level access to support OS debug writes
*
****************************************************************************/
@@ -764,3 +765,29 @@ int up_putc(int ch)
return ch;
}
+#else /* CONFIG_USE_SERIALDRIVER */
+
+/****************************************************************************
+ * Name: up_putc
+ *
+ * Description:
+ * Provide priority, low-level access to support OS debug writes
+ *
+ ****************************************************************************/
+
+int up_putc(int ch)
+{
+ /* Check for LF */
+
+ if (ch == '\n')
+ {
+ /* Add CR */
+
+ up_lowputc('\r');
+ }
+
+ up_lowputc(ch);
+ return ch;
+}
+
+#endif /* CONFIG_USE_SERIALDRIVER */