diff --git a/arch/arm/src/c5471/c5471_lowputc.S b/arch/arm/src/c5471/c5471_lowputc.S index 78154fd8c1..4e949cf351 100644 --- a/arch/arm/src/c5471/c5471_lowputc.S +++ b/arch/arm/src/c5471/c5471_lowputc.S @@ -1,7 +1,7 @@ /************************************************************************** * c5471/c5471_lowputc.S * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/arch/arm/src/common/up_head.S b/arch/arm/src/common/up_head.S index e6afed640d..019872f4d7 100644 --- a/arch/arm/src/common/up_head.S +++ b/arch/arm/src/common/up_head.S @@ -284,7 +284,7 @@ __start: #endif /* Perform early serial initialization */ -#if defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_USE_EARLYSERIALINIT bl up_earlyserialinit #endif diff --git a/arch/arm/src/common/up_initialize.c b/arch/arm/src/common/up_initialize.c index 583142ec05..e5b612fc62 100644 --- a/arch/arm/src/common/up_initialize.c +++ b/arch/arm/src/common/up_initialize.c @@ -135,7 +135,11 @@ void up_initialize(void) /* Initialize the serial device driver */ +#ifdef CONFIG_USE_SERIALDRIVER up_serialinit(); +#elif defined(CONFIG_DEV_LOWCONSOLE) + lowconsole_init(); +#endif /* Initialize the netwok */ diff --git a/arch/arm/src/common/up_internal.h b/arch/arm/src/common/up_internal.h index 182e6058c8..836a2579ff 100644 --- a/arch/arm/src/common/up_internal.h +++ b/arch/arm/src/common/up_internal.h @@ -55,6 +55,16 @@ #undef CONFIG_SUPPRESS_UART_CONFIG /* DEFINED: Do not reconfig UART */ #undef CONFIG_DUMP_ON_EXIT /* DEFINED: Dump task state on exit */ +/* Determine which (if any) console driver to use */ + +#if CONFIG_NFILE_DESCRIPTORS == 0 || defined(CONFIG_DEV_LOWCONSOLE) +# undef CONFIG_USE_SERIALDRIVER +# undef CONFIG_USE_EARLYSERIALINIT +#elif defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS > 0 +# define CONFIG_USE_SERIALDRIVER 1 +# define CONFIG_USE_EARLYSERIALINIT 1 +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -88,7 +98,6 @@ extern uint32 g_heapbase; * Inline Functions ****************************************************************************/ - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -110,12 +119,7 @@ extern void up_sigdeliver(void); extern void up_syscall(uint32 *regs); extern int up_timerisr(int irq, uint32 *regs); extern void up_undefinedinsn(uint32 *regs); - -#ifdef CONFIG_DEBUG extern void up_lowputc(char ch); -#else -# define up_lowputc(ch) -#endif /* Defined in up_vectors.S */ @@ -137,6 +141,14 @@ extern void up_serialinit(void); # define up_serialinit() #endif +/* Defined in drivers/lowconsole.c */ + +#ifdef CONFIG_DEV_LOWCONSOLE +extern void lowconsole_init(void); +#else +# define lowconsole_init() +#endif + /* Defined in up_watchdog.c */ extern void up_wdtinit(void); diff --git a/arch/arm/src/common/up_nommuhead.S b/arch/arm/src/common/up_nommuhead.S index 581ed0a6d2..318afb1861 100644 --- a/arch/arm/src/common/up_nommuhead.S +++ b/arch/arm/src/common/up_nommuhead.S @@ -105,10 +105,10 @@ __start: #endif -#if defined(CONFIG_DEV_CONSOLE) && CONFIG_NFILE_DESCRIPTORS >0 /* Perform early serial initialization */ mov fp, #0 +#ifdef CONFIG_USE_EARLYSERIALINIT bl up_earlyserialinit #endif diff --git a/arch/arm/src/dm320/dm320_lowputc.S b/arch/arm/src/dm320/dm320_lowputc.S index 5566b3f584..53c9912bfc 100644 --- a/arch/arm/src/dm320/dm320_lowputc.S +++ b/arch/arm/src/dm320/dm320_lowputc.S @@ -1,7 +1,7 @@ /************************************************************************** * dm320/dm320_lowputc.S * - * Copyright (C) 2007 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -14,7 +14,7 @@ * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. - * 3. Neither the name Gregory Nutt nor the names of its contributors may be + * 3. Neither the name NuttX nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * diff --git a/arch/arm/src/dm320/dm320_serial.c b/arch/arm/src/dm320/dm320_serial.c index 7018f7b415..479c271bb0 100644 --- a/arch/arm/src/dm320/dm320_serial.c +++ b/arch/arm/src/dm320/dm320_serial.c @@ -55,7 +55,7 @@ #include "os_internal.h" #include "up_internal.h" -#if CONFIG_NFILE_DESCRIPTORS > 0 +#ifdef CONFIG_USE_SERIALDRIVER /**************************************************************************** * Definitions @@ -780,7 +780,7 @@ int up_putc(int ch) return ch; } -#else /* CONFIG_NFILE_DESCRIPTORS > 0 */ +#else /* CONFIG_USE_SERIALDRIVER */ /**************************************************************************** * Definitions @@ -833,6 +833,6 @@ int up_putc(int ch) return ch; } -#endif /* CONFIG_NFILE_DESCRIPTORS > 0 */ +#endif /* CONFIG_USE_SERIALDRIVER */ diff --git a/arch/arm/src/lpc214x/lpc214x_head.S b/arch/arm/src/lpc214x/lpc214x_head.S index 117ca6a1fa..6b5c24e177 100644 --- a/arch/arm/src/lpc214x/lpc214x_head.S +++ b/arch/arm/src/lpc214x/lpc214x_head.S @@ -477,7 +477,9 @@ __start: /* Perform early serial initialization */ mov fp, #0 +#ifdef CONFIG_USE_EARLYSERIALINIT bl up_earlyserialinit +#endif showprogress 'C' showprogress '\n' diff --git a/arch/arm/src/lpc214x/lpc214x_serial.c b/arch/arm/src/lpc214x/lpc214x_serial.c index dc8a4accb1..746899b96f 100644 --- a/arch/arm/src/lpc214x/lpc214x_serial.c +++ b/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 @@ -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 */ diff --git a/arch/z80/src/common/up_internal.h b/arch/z80/src/common/up_internal.h index ec3f6b8117..3c60495cc5 100644 --- a/arch/z80/src/common/up_internal.h +++ b/arch/z80/src/common/up_internal.h @@ -63,7 +63,7 @@ * Definitions ****************************************************************************/ - /* Determine which (if any) console driver to use */ +/* Determine which (if any) console driver to use */ #if CONFIG_NFILE_DESCRIPTORS == 0 || defined(CONFIG_DEV_LOWCONSOLE) # undef CONFIG_USE_SERIALDRIVER