From 89ee609e511682cff2278d613a26e7aa4969e6c1 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 9 Nov 2008 18:18:55 +0000 Subject: [PATCH] Support enable/disable of devices to reduce size git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@1176 42af7a65-404d-4744-a932-0658087f49c3 --- arch/sh/src/sh1/sh1_lowputc.c | 13 +++++++++++-- arch/sh/src/sh1/sh1_serial.c | 25 +++++++++++++++++++++---- 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/arch/sh/src/sh1/sh1_lowputc.c b/arch/sh/src/sh1/sh1_lowputc.c index 983c3688bf4..816a84835e5 100644 --- a/arch/sh/src/sh1/sh1_lowputc.c +++ b/arch/sh/src/sh1/sh1_lowputc.c @@ -56,9 +56,16 @@ /* Is there a serial console? */ -#if defined(CONFIG_SCI0_SERIAL_CONSOLE) || defined(CONFIG_SCI1_SERIAL_CONSOLE) -# define HAVE_CONSOLE +#if defined(CONFIG_SCI0_SERIAL_CONSOLE) && defined(CONFIG_SH1_SCI0) +# define HAVE_CONSOLE 1 +# undef CONFIG_SCI1_SERIAL_CONSOLE +#elif defined(CONFIG_SCI1_SERIAL_CONSOLE) && defined(CONFIG_SH1_SCI1) +# define HAVE_CONSOLE 1 +# undef CONFIG_SCI0_SERIAL_CONSOLE #else +# if defined(CONFIG_SCI0_SERIAL_CONSOLE) || defined(CONFIG_SCI1_SERIAL_CONSOLE) +# error "Serial console selected, but corresponding SCI not enabled" +# endif # undef HAVE_CONSOLE #endif @@ -166,10 +173,12 @@ * **************************************************************************/ +#ifdef HAVE_CONSOLE int inline up_txready(void) { return getreg8(SH1_SCI_BASE + SH1_SCI_SSR_OFFSET) & SH1_SCISSR_TDRE; } +#endif /************************************************************************** * Public Functions diff --git a/arch/sh/src/sh1/sh1_serial.c b/arch/sh/src/sh1/sh1_serial.c index 7578132b2af..550ca8cc72a 100644 --- a/arch/sh/src/sh1/sh1_serial.c +++ b/arch/sh/src/sh1/sh1_serial.c @@ -53,19 +53,36 @@ #include "up_arch.h" #include "up_internal.h" -#ifdef CONFIG_USE_SERIALDRIVER - /**************************************************************************** * Definitions ****************************************************************************/ /* Some sanity checks *******************************************************/ +/* Are there any SCIs? */ + +#if !defined(CONFIG_SH1_SCI0) && !defined(CONFIG_SH1_SCI1) +# ifdef CONFIG_USE_SERIALDRIVER +# error "Serial driver selected, but SCIs not enabled" +# endif +# undef HAVE_CONSOLE +# undef CONFIG_USE_SERIALDRIVER +#endif + +#ifdef CONFIG_USE_SERIALDRIVER + /* Is there a serial console? */ -#if defined(CONFIG_SCI0_SERIAL_CONSOLE) || defined(CONFIG_SCI1_SERIAL_CONSOLE) -# define HAVE_CONSOLE +#if defined(CONFIG_SCI0_SERIAL_CONSOLE) && defined(CONFIG_SH1_SCI0) +# define HAVE_CONSOLE 1 +# undef CONFIG_SCI1_SERIAL_CONSOLE +#elif defined(CONFIG_SCI1_SERIAL_CONSOLE) && defined(CONFIG_SH1_SCI1) +# define HAVE_CONSOLE 1 +# undef CONFIG_SCI0_SERIAL_CONSOLE #else +# if defined(CONFIG_SCI0_SERIAL_CONSOLE) || defined(CONFIG_SCI1_SERIAL_CONSOLE) +# error "Serial console selected, but corresponding SCI not enabled" +# endif # undef HAVE_CONSOLE #endif