ARM architecture supports lowconsole

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@930 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2008-09-18 14:48:26 +00:00
parent b9278cd364
commit f08de9a812
10 changed files with 74 additions and 29 deletions

View File

@ -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 <spudmonkey@racsa.co.cr>
*
* 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.
*

View File

@ -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

View File

@ -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 */

View File

@ -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);

View File

@ -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

View File

@ -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 <spudmonkey@racsa.co.cr>
*
* 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.
*

View File

@ -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 */

View File

@ -477,7 +477,9 @@ __start:
/* Perform early serial initialization */
mov fp, #0
#ifdef CONFIG_USE_EARLYSERIALINIT
bl up_earlyserialinit
#endif
showprogress 'C'
showprogress '\n'

View File

@ -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 */

View File

@ -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