Add support for boards with no serial ports

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1512 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-02-18 12:00:36 +00:00
parent 386cebd287
commit dd1c714c30
7 changed files with 57 additions and 29 deletions

View File

@ -136,10 +136,15 @@ void up_initialize(void)
devnull_register(); /* Standard /dev/null */
#endif
/* Initialize the serial device driver */
/* Initialize the console device driver. NOTE that the naming
* implies that the console is a serial driver. That is usually the case,
* however, if no UARTs are enabled, the console could als be provided
* through some other device, such as an LCD. Architecture-specific logic
* will have to detect that case.
*/
#ifdef CONFIG_USE_SERIALDRIVER
up_serialinit();
up_consoleinit();
#elif defined(CONFIG_DEV_LOWCONSOLE)
lowconsole_init();
#endif

View File

@ -55,7 +55,12 @@
#undef CONFIG_SUPPRESS_SCI_CONFIG /* DEFINED: Do not reconfig SCI */
#undef CONFIG_DUMP_ON_EXIT /* DEFINED: Dump task state on exit */
/* Determine which (if any) console driver to use */
/* Determine which (if any) console driver to use. NOTE that the naming
* implies that the console is a serial driver. That is usually the case,
* however, if no UARTs are enabled, the console could als be provided
* through some other device, such as an LCD. Architecture-specific logic
* will have to detect that case.
*/
#if CONFIG_NFILE_DESCRIPTORS == 0 || defined(CONFIG_DEV_LOWCONSOLE)
# undef CONFIG_USE_SERIALDRIVER
@ -142,11 +147,11 @@ extern void up_vectorfiq(void);
/* Defined in up_serial.c */
#if CONFIG_NFILE_DESCRIPTORS > 0
extern void up_earlyserialinit(void);
extern void up_serialinit(void);
extern void up_earlyconsoleinit(void);
extern void up_consoleinit(void);
#else
# define up_earlyserialinit()
# define up_serialinit()
# define up_earlyconsoleinit()
# define up_consoleinit()
#endif
/* Defined in drivers/lowconsole.c */

View File

@ -245,8 +245,8 @@ __start:
/* Perform early serial initialization */
#ifdef CONFIG_USE_EARLYSERIALINIT
.globl _up_earlyserialinit /* Early initialization of serial driver */
jsr.a _up_earlyserialinit /* Call it */
.globl _up_earlyconsoleinit /* Early initialization of serial driver */
jsr.a _up_earlyconsoleinit /* Call it */
showprogress 'D'
#endif

View File

@ -49,6 +49,12 @@
#include "up_internal.h"
#include "m16c_uart.h"
/* Is there any serial support? This might be the case if the board does
* not have serial ports but supports stdout through, say, an LCD.
*/
#if !defined(CONFIG_UART0_DISABLE) && !defined(CONFIG_UART1_DISABLE) && !defined(CONFIG_UART2_DISABLE)
/**************************************************************************
* Private Definitions
**************************************************************************/
@ -59,7 +65,7 @@
# define M16C_XIN_PRESCALER 1
#endif
/* Is there a serial console? */
/* We know that we have a serial port enabled. Is one of them a serial console? */
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE)
# define HAVE_CONSOLE 1
@ -74,9 +80,6 @@
# undef CONFIG_UART0_SERIAL_CONSOLE
# undef CONFIG_UART1_SERIAL_CONSOLE
#else
# if defined(CONFIG_UART0_SERIAL_CONSOLE) || defined(CONFIG_UART1_SERIAL_CONSOLE)|| defined(CONFIG_UART2_SERIAL_CONSOLE)
# error "Serial console selected, but corresponding UART not enabled"
# endif
# undef HAVE_CONSOLE
#endif
@ -291,3 +294,8 @@ void up_lowsetup(void)
regval = (ubyte)getreg16(M16C_UART_BASE + M16C_UART_RB);
#endif
}
#elif defined(CONFIG_UART0_SERIAL_CONSOLE) || defined(CONFIG_UART1_SERIAL_CONSOLE)|| defined(CONFIG_UART2_SERIAL_CONSOLE)
# error "A serial console selected, but corresponding UART not enabled"
#endif /* !CONFIG_UART0_DISABLE && !CONFIG_UART1_DISABLE && !CONFIG_UART2_DISABLE */

View File

@ -55,6 +55,12 @@
#include "os_internal.h"
#include "m16c_uart.h"
/* Is there any serial support? This might be the case if the board does
* not have serial ports but supports a console through, say, an LCD.
*/
#if !defined(CONFIG_UART0_DISABLE) && !defined(CONFIG_UART1_DISABLE) && !defined(CONFIG_UART2_DISABLE)
/****************************************************************************
* Definitions
****************************************************************************/
@ -1056,16 +1062,16 @@ static boolean up_txready(struct uart_dev_s *dev)
****************************************************************************/
/****************************************************************************
* Name: up_serialinit
* Name: up_earlyconsoleinit
*
* Description:
* Performs the low level UART initialization early in
* debug so that the serial console will be available
* during bootup. This must be called before up_serialinit.
* during bootup. This must be called before up_consoleinit.
*
****************************************************************************/
void up_earlyserialinit(void)
void up_earlyconsoleinit(void)
{
/* NOTE: All GPIO configuration for the UARTs was performed in
* up_lowsetup
@ -1092,15 +1098,15 @@ void up_earlyserialinit(void)
}
/****************************************************************************
* Name: up_serialinit
* Name: up_consoleinit
*
* Description:
* Register serial console and serial ports. This assumes
* that up_earlyserialinit was called previously.
* that up_earlyconsoleinit was called previously.
*
****************************************************************************/
void up_serialinit(void)
void up_consoleinit(void)
{
/* Register the console */
@ -1184,3 +1190,7 @@ int up_putc(int ch)
}
#endif /* CONFIG_USE_SERIALDRIVER */
#elif defined(CONFIG_UART0_SERIAL_CONSOLE) || defined(CONFIG_UART1_SERIAL_CONSOLE)|| defined(CONFIG_UART2_SERIAL_CONSOLE)
# error "A serial console selected, but corresponding UART not enabled"
#endif /* !CONFIG_UART0_DISABLE && !CONFIG_UART1_DISABLE && !CONFIG_UART2_DISABLE */

View File

@ -62,7 +62,7 @@
.globl _up_lowsetup /* Early initialization of UART */
#ifdef CONFIG_USE_EARLYSERIALINIT
.globl _up_earlyserialinit /* Early initialization of serial driver */
.globl _up_earlyconsoleinit /* Early initialization of console driver */
#endif
#ifdef CONFIG_ARCH_LEDS
.globl _up_ledinit /* Boot LED setup */
@ -161,7 +161,7 @@
.macro showprogress, code
#ifdef CONFIG_DEBUG
mov.l .Llowputc, r0 /* Address of up_earlyserialinit */
mov.l .Llowputc, r0 /* Address of up_earlyconsoleinit */
jsr @r0 /* Call it */
mov #\code, r4 /* Delay slot */
#endif
@ -427,7 +427,7 @@ __start0:
/* Perform early serial initialization */
#ifdef CONFIG_USE_EARLYSERIALINIT
mov.l .Learlyser, r0 /* Address of up_earlyserialinit */
mov.l .Learlyser, r0 /* Address of up_earlyconsoleinit */
jsr @r0 /* Call it */
or r0, r0 /* Delay slot */
#endif
@ -483,7 +483,7 @@ __start0:
.long _ebss
#ifdef CONFIG_USE_EARLYSERIALINIT
.Learlyser:
.long _up_earlyserialinit
.long _up_earlyconsoleinit
#endif
.Llowsetup:
.long _up_lowsetup

View File

@ -829,16 +829,16 @@ static boolean up_txready(struct uart_dev_s *dev)
****************************************************************************/
/****************************************************************************
* Name: up_serialinit
* Name: up_earlyconsoleinit
*
* Description:
* Performs the low level SCI initialization early in
* debug so that the serial console will be available
* during bootup. This must be called before up_serialinit.
* during bootup. This must be called before up_consoleinit.
*
****************************************************************************/
void up_earlyserialinit(void)
void up_earlyconsoleinit(void)
{
/* NOTE: All GPIO configuration for the SCIs was performed in
* up_lowsetup
@ -862,15 +862,15 @@ void up_earlyserialinit(void)
}
/****************************************************************************
* Name: up_serialinit
* Name: up_consoleinit
*
* Description:
* Register serial console and serial ports. This assumes
* that up_earlyserialinit was called previously.
* that up_earlyconsoleinit was called previously.
*
****************************************************************************/
void up_serialinit(void)
void up_consoleinit(void)
{
/* Register the console */