summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-02-18 12:00:36 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2009-02-18 12:00:36 +0000
commit9fa3ac76e655b92daf653fb833da59fd904e9d17 (patch)
treef484915ce11a90da3859bf15bd018347f11bb4ab
parentf3fad3954742d93d27c75c2f5a1b9542cf82fc32 (diff)
downloadpx4-nuttx-9fa3ac76e655b92daf653fb833da59fd904e9d17.tar.gz
px4-nuttx-9fa3ac76e655b92daf653fb833da59fd904e9d17.tar.bz2
px4-nuttx-9fa3ac76e655b92daf653fb833da59fd904e9d17.zip
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
-rw-r--r--nuttx/arch/sh/src/common/up_initialize.c9
-rw-r--r--nuttx/arch/sh/src/common/up_internal.h15
-rw-r--r--nuttx/arch/sh/src/m16c/m16c_head.S4
-rw-r--r--nuttx/arch/sh/src/m16c/m16c_lowputc.c16
-rw-r--r--nuttx/arch/sh/src/m16c/m16c_serial.c22
-rw-r--r--nuttx/arch/sh/src/sh1/sh1_head.S8
-rw-r--r--nuttx/arch/sh/src/sh1/sh1_serial.c12
-rw-r--r--nuttx/configs/skp16c26/ostest/defconfig6
8 files changed, 60 insertions, 32 deletions
diff --git a/nuttx/arch/sh/src/common/up_initialize.c b/nuttx/arch/sh/src/common/up_initialize.c
index adab1d00e..114c8df98 100644
--- a/nuttx/arch/sh/src/common/up_initialize.c
+++ b/nuttx/arch/sh/src/common/up_initialize.c
@@ -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
diff --git a/nuttx/arch/sh/src/common/up_internal.h b/nuttx/arch/sh/src/common/up_internal.h
index 204ef6ca0..fbd046ff3 100644
--- a/nuttx/arch/sh/src/common/up_internal.h
+++ b/nuttx/arch/sh/src/common/up_internal.h
@@ -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 */
diff --git a/nuttx/arch/sh/src/m16c/m16c_head.S b/nuttx/arch/sh/src/m16c/m16c_head.S
index 7a2049198..81a8e0c94 100644
--- a/nuttx/arch/sh/src/m16c/m16c_head.S
+++ b/nuttx/arch/sh/src/m16c/m16c_head.S
@@ -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
diff --git a/nuttx/arch/sh/src/m16c/m16c_lowputc.c b/nuttx/arch/sh/src/m16c/m16c_lowputc.c
index 861623dc2..c08a0ec20 100644
--- a/nuttx/arch/sh/src/m16c/m16c_lowputc.c
+++ b/nuttx/arch/sh/src/m16c/m16c_lowputc.c
@@ -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 */
+
diff --git a/nuttx/arch/sh/src/m16c/m16c_serial.c b/nuttx/arch/sh/src/m16c/m16c_serial.c
index 12b614864..7ee4050f7 100644
--- a/nuttx/arch/sh/src/m16c/m16c_serial.c
+++ b/nuttx/arch/sh/src/m16c/m16c_serial.c
@@ -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 */
+
diff --git a/nuttx/arch/sh/src/sh1/sh1_head.S b/nuttx/arch/sh/src/sh1/sh1_head.S
index 61f14443d..c402e45ba 100644
--- a/nuttx/arch/sh/src/sh1/sh1_head.S
+++ b/nuttx/arch/sh/src/sh1/sh1_head.S
@@ -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
diff --git a/nuttx/arch/sh/src/sh1/sh1_serial.c b/nuttx/arch/sh/src/sh1/sh1_serial.c
index d6708d5fa..6991e0f32 100644
--- a/nuttx/arch/sh/src/sh1/sh1_serial.c
+++ b/nuttx/arch/sh/src/sh1/sh1_serial.c
@@ -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 */
diff --git a/nuttx/configs/skp16c26/ostest/defconfig b/nuttx/configs/skp16c26/ostest/defconfig
index bc3dc1db7..ae17228c2 100644
--- a/nuttx/configs/skp16c26/ostest/defconfig
+++ b/nuttx/configs/skp16c26/ostest/defconfig
@@ -90,10 +90,10 @@ CONFIG_ARCH_STACKDUMP=y
# CONFIG_UARTn_PARTIY - 0=no parity, 1=odd parity, 2=even parity
# CONFIG_UARTn_2STOP - Two stop bits
#
-CONFIG_UART0_DISABLE=n
+CONFIG_UART0_DISABLE=y
CONFIG_UART1_DISABLE=y
CONFIG_UART2_DISABLE=y
-CONFIG_UART0_SERIAL_CONSOLE=y
+CONFIG_UART0_SERIAL_CONSOLE=n
CONFIG_UART1_SERIAL_CONSOLE=n
CONFIG_UART2_SERIAL_CONSOLE=n
CONFIG_UART0_TXBUFSIZE=64
@@ -177,7 +177,7 @@ CONFIG_SCHED_INSTRUMENTATION=n
CONFIG_TASK_NAME_SIZE=0
CONFIG_START_YEAR=2009
CONFIG_START_MONTH=2
-CONFIG_START_DAY=8
+CONFIG_START_DAY=17
CONFIG_JULIAN_TIME=n
CONFIG_DEV_CONSOLE=y
CONFIG_DEV_LOWCONSOLE=n