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:
parent
386cebd287
commit
dd1c714c30
@ -136,10 +136,15 @@ void up_initialize(void)
|
|||||||
devnull_register(); /* Standard /dev/null */
|
devnull_register(); /* Standard /dev/null */
|
||||||
#endif
|
#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
|
#ifdef CONFIG_USE_SERIALDRIVER
|
||||||
up_serialinit();
|
up_consoleinit();
|
||||||
#elif defined(CONFIG_DEV_LOWCONSOLE)
|
#elif defined(CONFIG_DEV_LOWCONSOLE)
|
||||||
lowconsole_init();
|
lowconsole_init();
|
||||||
#endif
|
#endif
|
||||||
|
@ -55,7 +55,12 @@
|
|||||||
#undef CONFIG_SUPPRESS_SCI_CONFIG /* DEFINED: Do not reconfig SCI */
|
#undef CONFIG_SUPPRESS_SCI_CONFIG /* DEFINED: Do not reconfig SCI */
|
||||||
#undef CONFIG_DUMP_ON_EXIT /* DEFINED: Dump task state on exit */
|
#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)
|
#if CONFIG_NFILE_DESCRIPTORS == 0 || defined(CONFIG_DEV_LOWCONSOLE)
|
||||||
# undef CONFIG_USE_SERIALDRIVER
|
# undef CONFIG_USE_SERIALDRIVER
|
||||||
@ -142,11 +147,11 @@ extern void up_vectorfiq(void);
|
|||||||
/* Defined in up_serial.c */
|
/* Defined in up_serial.c */
|
||||||
|
|
||||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
extern void up_earlyserialinit(void);
|
extern void up_earlyconsoleinit(void);
|
||||||
extern void up_serialinit(void);
|
extern void up_consoleinit(void);
|
||||||
#else
|
#else
|
||||||
# define up_earlyserialinit()
|
# define up_earlyconsoleinit()
|
||||||
# define up_serialinit()
|
# define up_consoleinit()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Defined in drivers/lowconsole.c */
|
/* Defined in drivers/lowconsole.c */
|
||||||
|
@ -245,8 +245,8 @@ __start:
|
|||||||
/* Perform early serial initialization */
|
/* Perform early serial initialization */
|
||||||
|
|
||||||
#ifdef CONFIG_USE_EARLYSERIALINIT
|
#ifdef CONFIG_USE_EARLYSERIALINIT
|
||||||
.globl _up_earlyserialinit /* Early initialization of serial driver */
|
.globl _up_earlyconsoleinit /* Early initialization of serial driver */
|
||||||
jsr.a _up_earlyserialinit /* Call it */
|
jsr.a _up_earlyconsoleinit /* Call it */
|
||||||
showprogress 'D'
|
showprogress 'D'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -49,6 +49,12 @@
|
|||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
#include "m16c_uart.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
|
* Private Definitions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@ -59,7 +65,7 @@
|
|||||||
# define M16C_XIN_PRESCALER 1
|
# define M16C_XIN_PRESCALER 1
|
||||||
#endif
|
#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)
|
#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE)
|
||||||
# define HAVE_CONSOLE 1
|
# define HAVE_CONSOLE 1
|
||||||
@ -74,9 +80,6 @@
|
|||||||
# undef CONFIG_UART0_SERIAL_CONSOLE
|
# undef CONFIG_UART0_SERIAL_CONSOLE
|
||||||
# undef CONFIG_UART1_SERIAL_CONSOLE
|
# undef CONFIG_UART1_SERIAL_CONSOLE
|
||||||
#else
|
#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
|
# undef HAVE_CONSOLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -291,3 +294,8 @@ void up_lowsetup(void)
|
|||||||
regval = (ubyte)getreg16(M16C_UART_BASE + M16C_UART_RB);
|
regval = (ubyte)getreg16(M16C_UART_BASE + M16C_UART_RB);
|
||||||
#endif
|
#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 */
|
||||||
|
|
||||||
|
@ -55,6 +55,12 @@
|
|||||||
#include "os_internal.h"
|
#include "os_internal.h"
|
||||||
#include "m16c_uart.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
|
* Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -1056,16 +1062,16 @@ static boolean up_txready(struct uart_dev_s *dev)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: up_earlyconsoleinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level UART initialization early in
|
* Performs the low level UART initialization early in
|
||||||
* debug so that the serial console will be available
|
* 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
|
/* NOTE: All GPIO configuration for the UARTs was performed in
|
||||||
* up_lowsetup
|
* up_lowsetup
|
||||||
@ -1092,15 +1098,15 @@ void up_earlyserialinit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: up_consoleinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes
|
* 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 */
|
/* Register the console */
|
||||||
|
|
||||||
@ -1184,3 +1190,7 @@ int up_putc(int ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif /* CONFIG_USE_SERIALDRIVER */
|
#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 */
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
|
|
||||||
.globl _up_lowsetup /* Early initialization of UART */
|
.globl _up_lowsetup /* Early initialization of UART */
|
||||||
#ifdef CONFIG_USE_EARLYSERIALINIT
|
#ifdef CONFIG_USE_EARLYSERIALINIT
|
||||||
.globl _up_earlyserialinit /* Early initialization of serial driver */
|
.globl _up_earlyconsoleinit /* Early initialization of console driver */
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_ARCH_LEDS
|
#ifdef CONFIG_ARCH_LEDS
|
||||||
.globl _up_ledinit /* Boot LED setup */
|
.globl _up_ledinit /* Boot LED setup */
|
||||||
@ -161,7 +161,7 @@
|
|||||||
|
|
||||||
.macro showprogress, code
|
.macro showprogress, code
|
||||||
#ifdef CONFIG_DEBUG
|
#ifdef CONFIG_DEBUG
|
||||||
mov.l .Llowputc, r0 /* Address of up_earlyserialinit */
|
mov.l .Llowputc, r0 /* Address of up_earlyconsoleinit */
|
||||||
jsr @r0 /* Call it */
|
jsr @r0 /* Call it */
|
||||||
mov #\code, r4 /* Delay slot */
|
mov #\code, r4 /* Delay slot */
|
||||||
#endif
|
#endif
|
||||||
@ -427,7 +427,7 @@ __start0:
|
|||||||
/* Perform early serial initialization */
|
/* Perform early serial initialization */
|
||||||
|
|
||||||
#ifdef CONFIG_USE_EARLYSERIALINIT
|
#ifdef CONFIG_USE_EARLYSERIALINIT
|
||||||
mov.l .Learlyser, r0 /* Address of up_earlyserialinit */
|
mov.l .Learlyser, r0 /* Address of up_earlyconsoleinit */
|
||||||
jsr @r0 /* Call it */
|
jsr @r0 /* Call it */
|
||||||
or r0, r0 /* Delay slot */
|
or r0, r0 /* Delay slot */
|
||||||
#endif
|
#endif
|
||||||
@ -483,7 +483,7 @@ __start0:
|
|||||||
.long _ebss
|
.long _ebss
|
||||||
#ifdef CONFIG_USE_EARLYSERIALINIT
|
#ifdef CONFIG_USE_EARLYSERIALINIT
|
||||||
.Learlyser:
|
.Learlyser:
|
||||||
.long _up_earlyserialinit
|
.long _up_earlyconsoleinit
|
||||||
#endif
|
#endif
|
||||||
.Llowsetup:
|
.Llowsetup:
|
||||||
.long _up_lowsetup
|
.long _up_lowsetup
|
||||||
|
@ -829,16 +829,16 @@ static boolean up_txready(struct uart_dev_s *dev)
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: up_earlyconsoleinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Performs the low level SCI initialization early in
|
* Performs the low level SCI initialization early in
|
||||||
* debug so that the serial console will be available
|
* 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
|
/* NOTE: All GPIO configuration for the SCIs was performed in
|
||||||
* up_lowsetup
|
* up_lowsetup
|
||||||
@ -862,15 +862,15 @@ void up_earlyserialinit(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_serialinit
|
* Name: up_consoleinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Register serial console and serial ports. This assumes
|
* 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 */
|
/* Register the console */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user