summaryrefslogtreecommitdiff
path: root/nuttx/arch/z80/src
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-20 19:59:40 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-11-20 19:59:40 +0000
commit9db0ee6bd40f94fe5e11e9f53a5cf32e1f20ba3f (patch)
tree769074a903e6aa382d304299134132ce1e1723a9 /nuttx/arch/z80/src
parent77ad659e51fb38eb5c827aa4c6d0b8ac3415a580 (diff)
downloadpx4-nuttx-9db0ee6bd40f94fe5e11e9f53a5cf32e1f20ba3f.tar.gz
px4-nuttx-9db0ee6bd40f94fe5e11e9f53a5cf32e1f20ba3f.tar.bz2
px4-nuttx-9db0ee6bd40f94fe5e11e9f53a5cf32e1f20ba3f.zip
Change how UARTs are enabled for i.MX, M16C, and ez80 to make them compatible with other chips
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5374 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch/z80/src')
-rw-r--r--nuttx/arch/z80/src/ez80/Kconfig16
-rw-r--r--nuttx/arch/z80/src/ez80/ez80_lowuart.c10
-rw-r--r--nuttx/arch/z80/src/ez80/ez80_serial.c30
3 files changed, 36 insertions, 20 deletions
diff --git a/nuttx/arch/z80/src/ez80/Kconfig b/nuttx/arch/z80/src/ez80/Kconfig
index 018ecb511..d02a62c8b 100644
--- a/nuttx/arch/z80/src/ez80/Kconfig
+++ b/nuttx/arch/z80/src/ez80/Kconfig
@@ -4,4 +4,20 @@
#
if ARCH_CHIP_EZ80
+
+config EZ80_UART0
+ bool "UART0"
+ select ARCH_HAVE_UART0
+ default n
+
+config EZ80_UART1
+ bool "UART1"
+ select ARCH_HAVE_UART1
+ default n
+
+config EZ80_UART2
+ bool "UART2"
+ select ARCH_HAVE_UART2
+ default n
+
endif
diff --git a/nuttx/arch/z80/src/ez80/ez80_lowuart.c b/nuttx/arch/z80/src/ez80/ez80_lowuart.c
index ed4f92fac..cc535530d 100644
--- a/nuttx/arch/z80/src/ez80/ez80_lowuart.c
+++ b/nuttx/arch/z80/src/ez80/ez80_lowuart.c
@@ -59,7 +59,7 @@
* not have serial ports but supports stdout through, say, an LCD.
*/
-#if defined(CONFIG_UART0_DISABLE) || defined(CONFIG_UART1_DISABLE)
+#if defined(CONFIG_EZ80_UART0) || defined(CONFIG_EZ80_UART1)
# define HAVE_SERIAL
#else
# undef HAVE_SERIAL
@@ -67,10 +67,10 @@
/* Is one of the serial ports a console? */
-#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE)
+#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_EZ80_UART0)
# define HAVE_SERIALCONSOLE 1
# undef CONFIG_UART1_SERIAL_CONSOLE
-#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && !defined(CONFIG_UART1_DISABLE)
+#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_EZ80_UART1)
# define HAVE_SERIALCONSOLE 1
# undef CONFIG_UART0_SERIAL_CONSOLE
#else
@@ -186,7 +186,7 @@ void up_lowuartinit(void)
/* Configure pins for usage of UARTs (whether or not we have a console) */
-#ifndef CONFIG_UART0_DISABLE
+#ifdef CONFIG_EZ80_UART0
/* Set Port D, pins 0 and 1 for their alternate function (Mode 7) to enable UART0 */
regval = inp(EZ80_PD_DDR);
@@ -202,7 +202,7 @@ void up_lowuartinit(void)
outp(EZ80_PD_ALT2, regval);
#endif
-#ifndef CONFIG_UART1_DISABLE
+#ifdef CONFIG_EZ80_UART1
/* Set Port C, pins 0 and 1 for their alternate function (Mode 7) to enable UART1 */
regval = inp(EZ80_PC_DDR);
diff --git a/nuttx/arch/z80/src/ez80/ez80_serial.c b/nuttx/arch/z80/src/ez80/ez80_serial.c
index e2f9b0294..61c31ba31 100644
--- a/nuttx/arch/z80/src/ez80/ez80_serial.c
+++ b/nuttx/arch/z80/src/ez80/ez80_serial.c
@@ -118,18 +118,18 @@ struct uart_ops_s g_uart_ops =
/* I/O buffers */
-#ifndef CONFIG_UART0_DISABLE
+#ifdef CONFIG_EZ80_UART0
static char g_uart0rxbuffer[CONFIG_UART0_RXBUFSIZE];
static char g_uart0txbuffer[CONFIG_UART0_TXBUFSIZE];
#endif
-#ifndef CONFIG_UART1_DISABLE
+#ifdef CONFIG_EZ80_UART1
static char g_uart1rxbuffer[CONFIG_UART1_RXBUFSIZE];
static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE];
#endif
/* This describes the state of the UART0 port. */
-#ifndef CONFIG_UART0_DISABLE
+#ifdef CONFIG_EZ80_UART0
static struct ez80_dev_s g_uart0priv =
{
EZ80_UART0_BASE, /* uartbase */
@@ -174,7 +174,7 @@ static uart_dev_t g_uart0port =
/* This describes the state of the UART1 port. */
-#ifndef CONFIG_UART1_DISABLE
+#ifdef CONFIG_EZ80_UART1
static struct ez80_dev_s g_uart1priv =
{
EZ80_UART1_BASE, /* uartbase */
@@ -219,24 +219,24 @@ static uart_dev_t g_uart1port =
/* Now, which one with be tty0/console and which tty1? */
-#if defined(CONFIG_UART0_SERIAL_CONSOLE) && !defined(CONFIG_UART0_DISABLE)
+#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_EZ80_UART0)
# define CONSOLE_DEV g_uart0port
# define TTYS0_DEV g_uart0port
-# if !defined(CONFIG_UART1_DISABLE)
+# if defined(CONFIG_EZ80_UART1)
# define TTYS1_DEV g_uart1port
# endif
-#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && !defined(CONFIG_UART1_DISABLE)
+#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_EZ80_UART1)
# define CONSOLE_DEV g_uart1port
# define TTYS0_DEV g_uart1port
-# if !defined(CONFIG_UART0_DISABLE)
+# if defined(CONFIG_EZ80_UART0)
# define TTYS1_DEV g_uart0port
# endif
-#elif !defined(CONFIG_UART0_DISABLE)
+#elif defined(CONFIG_EZ80_UART0)
# define TTYS0_DEV g_uart0port
-# if !defined(CONFIG_UART1_DISABLE)
+# if defined(CONFIG_EZ80_UART1)
# define TTYS1_DEV g_uart1port
# endif
-#elif !defined(CONFIG_UART0_DISABLE)
+#elif defined(CONFIG_EZ80_UART0)
# define TTYS0_DEV g_uart1port
#endif
@@ -475,14 +475,14 @@ static int ez80_interrrupt(int irq, void *context)
struct ez80_dev_s *priv;
volatile uint32_t cause;
-#ifndef CONFIG_UART0_DISABLE
+#ifdef CONFIG_EZ80_UART0
if (g_uart0priv.irq == irq)
{
dev = &g_uart0port;
}
else
#endif
-#ifndef CONFIG_UART1_DISABLE
+#ifdef CONFIG_EZ80_UART1
if (g_uart1priv.irq == irq)
{
dev = &g_uart1port;
@@ -683,7 +683,7 @@ void up_serialinit(void)
/* Configure pins for usage of UARTs */
-#ifndef CONFIG_UART0_DISABLE
+#ifdef CONFIG_EZ80_UART0
/* Set Port D, pins 0 and 1 for their alternate function (Mode 7) to enable UART0 */
regval = inp(EZ80_PD_DDR);
@@ -699,7 +699,7 @@ void up_serialinit(void)
outp(EZ80_PD_ALT2, regval);
#endif
-#ifndef CONFIG_UART1_DISABLE
+#ifdef CONFIG_EZ80_UART1
/* Set Port C, pins 0 and 1 for their alternate function (Mode 7) to enable UART1 */
regval = inp(EZ80_PC_DDR);