You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by gn...@apache.org on 2020/02/18 18:36:50 UTC

[incubator-nuttx] 01/05: arch/z80: Remove z80_lowserial_initialize related stuff

This is an automated email from the ASF dual-hosted git repository.

gnutt pushed a commit to branch pr297
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 867738443447747057bae765bb47ed3ae11f0615
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Tue Feb 18 11:42:54 2020 +0800

    arch/z80: Remove z80_lowserial_initialize related stuff
    
    since nobody call this function at all
    
    Change-Id: I5cfdcd7ec1a40584a5693335c58c59d7ad63cdce
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 arch/z80/Kconfig                   |   7 -
 arch/z80/src/common/z80_internal.h |  11 --
 arch/z80/src/ez80/Make.defs        |   2 +-
 arch/z80/src/ez80/ez80_lowuart.c   | 256 -------------------------------------
 arch/z80/src/z180/z180_lowscc.c    |  22 ----
 arch/z80/src/z180/z180_lowserial.c |  18 ---
 arch/z80/src/z180/z180_lowuart.c   |  22 ----
 arch/z80/src/z180/z180_serial.h    |  30 -----
 arch/z80/src/z8/Make.defs          |   2 +-
 arch/z80/src/z8/z8_lowuart.c       | 134 -------------------
 10 files changed, 2 insertions(+), 502 deletions(-)

diff --git a/arch/z80/Kconfig b/arch/z80/Kconfig
index 2aee96f..a41ba39 100644
--- a/arch/z80/Kconfig
+++ b/arch/z80/Kconfig
@@ -338,7 +338,6 @@ config ARCH_CHIP_Z8F6403
 	select ARCH_CHIP_Z8
 	select ARCH_CHIP_Z8F640X
 	select ENDIAN_BIG
-	select HAVE_LOWSERIALINIT
 	---help---
 		ZiLOG Z8F6403 (z8 Encore)
 
@@ -347,7 +346,6 @@ config ARCH_CHIP_Z8F6423
 	select ARCH_CHIP_Z8
 	select ARCH_CHIP_Z8F642X
 	select ENDIAN_BIG
-	select HAVE_LOWSERIALINIT
 	---help---
 		ZiLOG Z8F6423 (z8 Encore)
 
@@ -383,7 +381,6 @@ config ARCH_CHIP_Z180
 	select ARCH_NOINTC
 	select ARCH_HAVE_ADDRENV
 	select ARCH_ADDRENV
-	select HAVE_LOWSERIALINIT
 
 config ARCH_CHIP_Z80180
 	bool
@@ -413,12 +410,8 @@ config ARCH_CHIP_Z8
 config ARCH_CHIP_EZ80
 	bool
 	select MM_SMALL if EZ80_Z80MODE
-	select HAVE_LOWSERIALINIT
 	select ARCH_HAVE_PHY
 
-config HAVE_LOWSERIALINIT
-	bool
-
 config ARCH_CHIP
 	string
 	default "z80"		if ARCH_CHIP_Z80
diff --git a/arch/z80/src/common/z80_internal.h b/arch/z80/src/common/z80_internal.h
index 5b488c0..32e6605 100644
--- a/arch/z80/src/common/z80_internal.h
+++ b/arch/z80/src/common/z80_internal.h
@@ -59,18 +59,11 @@
 
 #if defined(CONFIG_DEV_LOWCONSOLE)
 #  undef USE_SERIALDRIVER
-#  ifdef CONFIG_HAVE_LOWSERIALINIT
-#    define USE_LOWSERIALINIT 1
-#  else
-#    undef USE_LOWSERIALINIT
-#  endif
 #elif !defined(CONFIG_DEV_CONSOLE)
 #  undef  USE_SERIALDRIVER
-#  undef  USE_LOWSERIALINIT
 #  undef  CONFIG_DEV_LOWCONSOLE
 #  undef  CONFIG_RAMLOG_CONSOLE
 #else
-#  undef  USE_LOWSERIALINIT
 #  if defined(CONFIG_RAMLOG_CONSOLE)
 #    undef  USE_SERIALDRIVER
 #    undef  CONFIG_DEV_LOWCONSOLE
@@ -104,10 +97,6 @@ extern "C"
 {
 #endif
 
-#ifdef USE_LOWSERIALINIT
-void z80_lowserial_initialize(void);
-#endif
-
 /* Defined in xyz_doirq.c */
 
 FAR chipreg_t *z80_doirq(uint8_t irq, FAR chipreg_t *regs);
diff --git a/arch/z80/src/ez80/Make.defs b/arch/z80/src/ez80/Make.defs
index ac8c588..c369fd5 100644
--- a/arch/z80/src/ez80/Make.defs
+++ b/arch/z80/src/ez80/Make.defs
@@ -61,7 +61,7 @@ endif
 
 CHIP_SSRCS  =
 CHIP_CSRCS  = ez80_clock.c ez80_initialstate.c ez80_irq.c ez80_copystate.c
-CHIP_CSRCS += ez80_schedulesigaction.c ez80_sigdeliver.c ez80_lowuart.c
+CHIP_CSRCS += ez80_schedulesigaction.c ez80_sigdeliver.c
 CHIP_CSRCS += ez80_timerisr.c ez80_serial.c
 
 ifeq ($(CONFIG_ARCH_STACKDUMP),y)
diff --git a/arch/z80/src/ez80/ez80_lowuart.c b/arch/z80/src/ez80/ez80_lowuart.c
deleted file mode 100644
index d0029a8..0000000
--- a/arch/z80/src/ez80/ez80_lowuart.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/****************************************************************************
- * arch/z80/src/ez80/ez80_loweruart.c
- *
- *   Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-#include <string.h>
-
-#include <arch/io.h>
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "chip.h"
-#include "z80_internal.h"
-
-#ifdef USE_LOWSERIALINIT
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/* 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_EZ80_UART0) || defined(CONFIG_EZ80_UART1)
-#  define HAVE_SERIAL
-#else
-#  undef HAVE_SERIAL
-#endif
-
-/* Is one of the serial ports a console? */
-
-#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_EZ80_UART1)
-#  define HAVE_SERIALCONSOLE 1
-#  undef CONFIG_UART0_SERIAL_CONSOLE
-#else
-#  warning "No console is defined"
-#  if defined(CONFIG_UART0_SERIAL_CONSOLE) || defined(CONFIG_UART1_SERIAL_CONSOLE)
-#    error "A serial console selected, but corresponding UART not enabled"
-#  endif
-#  undef CONFIG_UART0_SERIAL_CONSOLE
-#  undef CONFIG_UART1_SERIAL_CONSOLE
-#  undef HAVE_SERIALCONSOLE
-#endif
-
-/* Select UART parameters for the selected console */
-
-#if defined(CONFIG_UART0_SERIAL_CONSOLE)
-#  define ez80_inp(offs)       inp((EZ80_UART0_BASE+(offs)))
-#  define ez80_outp(offs,val)  outp((EZ80_UART0_BASE+(offs)), (val))
-#  define CONFIG_UART_BAUD     CONFIG_UART0_BAUD
-#  if CONFIG_UART0_BITS == 7
-#    define CONFIG_UART_BITS   EZ80_UARTCHAR_7BITS
-#  else
-#    define CONFIG_UART_BITS   EZ80_UARTCHAR_8BITS
-#  endif
-#  if CONFIG_UART0_2STOP != 0
-#    define CONFIG_UART_2STOP  EZ80_UARTLCTl_2STOP
-#  else
-#    define CONFIG_UART_2STOP 0
-#  endif
-#  if CONFIG_UART0_PARITY == 1 /* Odd parity */
-#    define CONFIG_UART_PARITY EZ80_UARTLCTL_PEN
-#  elif CONFIG_UART0_PARITY == 2  /* Even parity */
-#    define CONFIG_UART_PARITY (EZ80_UARTLCTL_PEN|EZ80_UARTLCTL_EPS)
-#  else
-#    define CONFIG_UART_PARITY 0
-#  endif
-#elif defined(CONFIG_UART1_SERIAL_CONSOLE)
-#  define ez80_inp(offs)       inp((EZ80_UART1_BASE+(offs)))
-#  define ez80_outp(offs.val)  outp((EZ80_UART1_BASE+(offs)), (val))
-#  define CONFIG_UART_BAUD     CONFIG_UART1_BAUD
-#  if CONFIG_UART1_BITS == 7
-#    define CONFIG_UART_BITS   EZ80_UARTCHAR_7BITS
-#  else
-#    define CONFIG_UART_BITS   EZ80_UARTCHAR_8BITS
-#  endif
-#  if CONFIG_UART1_2STOP != 0
-#    define CONFIG_UART_2STOP  EZ80_UARTLCTl_2STOP
-#  else
-#    define CONFIG_UART_2STOP  0
-#  endif
-#  if CONFIG_UART1_PARITY == 1 /* Odd parity */
-#    define CONFIG_UART_PARITY EZ80_UARTLCTL_PEN
-#  elif CONFIG_UART1_PARITY == 2  /* Even parity */
-#    define CONFIG_UART_PARITY (EZ80_UARTLCTL_PEN|EZ80_UARTLCTL_EPS)
-#  else
-#    define CONFIG_UART_PARITY 0
-#  endif
-#endif
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-#if defined(HAVE_SERIALCONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG)
-static void ez80_setbaud(void)
-{
-  uint32_t brg_divisor;
-  uint8_t lctl;
-
-  /* The resulting BAUD and depends on the system clock frequency and the
-   * BRG divisor as follows:
-   *
-   *   BAUD = SYSTEM_CLOCK_FREQUENCY / (16 * BRG_Divisor)
-   *
-   * Or
-   *
-   *   BRG_Divisor = SYSTEM_CLOCK_FREQUENCY / 16 / BAUD
-   *
-   * NOTE: The system clock frequency value is defined in the board.h file
-   */
-
-   brg_divisor = (ez80_systemclock + (CONFIG_UART_BAUD << 3)) / (CONFIG_UART_BAUD << 4);
-
-   /* Set the DLAB bit to enable access to the BRG registers */
-
-   lctl = ez80_inp(EZ80_UART_LCTL);
-   lctl |= EZ80_UARTLCTL_DLAB;
-   ez80_outp(EZ80_UART_LCTL, lctl);
-
-   ez80_outp(EZ80_UART_BRGL, (uint8_t)(brg_divisor & 0xff));
-   ez80_outp(EZ80_UART_BRGH, (uint8_t)(brg_divisor >> 8));
-
-   lctl &= ~EZ80_UARTLCTL_DLAB;
-   ez80_outp(EZ80_UART_LCTL, lctl);
-}
-#endif /* HAVE_SERIALCONSOLE && !CONFIG_SUPPRESS_UART_CONFIG */
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: z80_lowserial_initialize
- ****************************************************************************/
-
-void z80_lowserial_initialize(void)
-{
-#ifdef HAVE_SERIAL
-  uint8_t regval;
-
-  /* Configure pins for usage of UARTs (whether or not we have a console) */
-
-#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);
-  regval |= 3;
-  outp(EZ80_PD_DDR, regval);
-
-  regval  = inp(EZ80_PD_ALT1);
-  regval &= ~3;
-  outp(EZ80_PD_ALT1, regval);
-
-  regval  = inp(EZ80_PD_ALT2);
-  regval |= 3;
-  outp(EZ80_PD_ALT2, regval);
-#endif
-
-#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);
-  regval |= 3;
-  outp(EZ80_PC_DDR, regval);
-
-  regval  = inp(EZ80_PC_ALT1);
-  regval &= ~3;
-  outp(EZ80_PC_ALT1, regval);
-
-  regval  = inp(EZ80_PC_ALT2);
-  regval |= 3;
-  outp(EZ80_PC_ALT2, regval);
-#endif
-
-#if defined(HAVE_SERIALCONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG)
-  /* Disable interrupts from the UART */
-
-  regval = ez80_inp(EZ80_UART_IER);
-  regval &= ~EZ80_UARTEIR_INTMASK;
-  ez80_outp(EZ80_UART_IER, regval);
-
-  /* Set the baud rate */
-
-  ez80_setbaud();
-  ez80_outp(EZ80_UART_MCTL, 0);
-
-  /* Set the character properties */
-
-  regval = ez80_inp(EZ80_UART_LCTL);
-  regval &= ~EZ80_UARTLCTL_MASK;
-  regval |= (CONFIG_UART_BITS | CONFIG_UART_2STOP | CONFIG_UART_PARITY);
-  ez80_outp(EZ80_UART_LCTL, regval);
-
-  /* Enable and flush the receive FIFO */
-
-  regval = EZ80_UARTFCTL_FIFOEN;
-  ez80_outp(EZ80_UART_FCTL, regval);
-  regval |= (EZ80_UARTFCTL_CLRTxF|EZ80_UARTFCTL_CLRRxF);
-  ez80_outp(EZ80_UART_FCTL, regval);
-
-  /* Set the receive trigger level to 1 */
-
-  regval |= EZ80_UARTTRIG_1;
-  ez80_outp(EZ80_UART_FCTL, regval);
-
-#endif /* HAVE_SERIALCONSOLE && !CONFIG_SUPPRESS_UART_CONFIG */
-#endif /* HAVE_SERIAL */
-}
-
-#endif /* USE_LOWSERIALINIT */
diff --git a/arch/z80/src/z180/z180_lowscc.c b/arch/z80/src/z180/z180_lowscc.c
index 1b281ff..b12ec3d 100644
--- a/arch/z80/src/z180/z180_lowscc.c
+++ b/arch/z80/src/z180/z180_lowscc.c
@@ -50,8 +50,6 @@
 #include "common/z80_internal.h"
 #include "z180_config.h"
 
-#if defined(USE_LOWSERIALINIT) && defined(HAVE_SCC)
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -95,24 +93,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: z180_scc_lowinit
- *
- * Description:
- *   Called early in the boot sequence to initialize the [E]SCC console
- *   channel (only).
- *
- ****************************************************************************/
-
-#ifdef USE_LOWSERIALINIT
-void z180_scc_lowinit(void)
-{
-#ifdef HAVE_SCC_CONSOLE
-#warning "Missing logic"
-#endif
-}
-#endif
-
-/****************************************************************************
  * Name: z180_putc
  *
  * Description:
@@ -135,5 +115,3 @@ txbe:
   __endasm;
 }
 #endif
-
-#endif /* USE_LOWSERIALINIT && HAVE_SCC*/
diff --git a/arch/z80/src/z180/z180_lowserial.c b/arch/z80/src/z180/z180_lowserial.c
index 68a40df..6e985de 100644
--- a/arch/z80/src/z180/z180_lowserial.c
+++ b/arch/z80/src/z180/z180_lowserial.c
@@ -63,24 +63,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: z80_lowserial_initialize
- *
- * Description:
- *   Called early in the boot sequence to initialize the serial ports
- *
- ****************************************************************************/
-
-#ifdef USE_LOWSERIALINIT
-void z80_lowserial_initialize(void)
-{
-  /* Initialize UART and [E]SCC serial devices */
-
-  z180_uart_lowinit();
-  z180_scc_lowinit();
-}
-#endif
-
-/****************************************************************************
  * Name: up_putc/up_lowputc
  *
  * Description:
diff --git a/arch/z80/src/z180/z180_lowuart.c b/arch/z80/src/z180/z180_lowuart.c
index 8ec775c..eeade15 100644
--- a/arch/z80/src/z180/z180_lowuart.c
+++ b/arch/z80/src/z180/z180_lowuart.c
@@ -50,8 +50,6 @@
 #include "common/z80_internal.h"
 #include "z180_config.h"
 
-#if defined(USE_LOWSERIALINIT) && defined(HAVE_UART)
-
 /****************************************************************************
  * Pre-processor Definitions
  ****************************************************************************/
@@ -88,24 +86,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: z180_uart_lowinit
- *
- * Description:
- *   Called early in the boot sequence to initialize the uart console
- *   channel (only).
- *
- ****************************************************************************/
-
-#ifdef USE_LOWSERIALINIT
-void z180_uart_lowinit(void)
-{
-#ifdef HAVE_UART_CONSOLE
-#warning "Missing logic"
-#endif
-}
-#endif
-
-/****************************************************************************
  * Name: z180_putc
  *
  * Description:
@@ -119,5 +99,3 @@ void z180_putc(uint8_t ch)
 #warning "Missing logic"
 }
 #endif
-
-#endif /* USE_LOWSERIALINIT && HAVE_UART*/
diff --git a/arch/z80/src/z180/z180_serial.h b/arch/z80/src/z180/z180_serial.h
index b07c644..c72079e 100644
--- a/arch/z80/src/z180/z180_serial.h
+++ b/arch/z80/src/z180/z180_serial.h
@@ -54,36 +54,6 @@
  ****************************************************************************/
 
 /****************************************************************************
- * Name: z180_uart_lowinit
- *
- * Description:
- *   Called early in the boot sequence to initialize the uart console
- *   channel (only).
- *
- ****************************************************************************/
-
-#if defined(HAVE_UART) && defined(USE_LOWSERIALINIT)
-void z180_uart_lowinit(void);
-#else
-#  define z180_uart_lowinit()
-#endif
-
-/****************************************************************************
- * Name: z180_scc_lowinit
- *
- * Description:
- *   Called early in the boot sequence to initialize the [E]SCC console
- *   channel (only).
- *
- ****************************************************************************/
-
-#if defined(HAVE_SCC) && defined(USE_LOWSERIALINIT)
-void z180_scc_lowinit(void);
-#else
-#  define z180_scc_lowinit()
-#endif
-
-/****************************************************************************
  * Name: z180_putc
  *
  * Description:
diff --git a/arch/z80/src/z8/Make.defs b/arch/z80/src/z8/Make.defs
index 4f19363..023e5bb 100644
--- a/arch/z80/src/z8/Make.defs
+++ b/arch/z80/src/z8/Make.defs
@@ -44,7 +44,7 @@ CMN_CSRCS += up_mdelay.c up_stackframe.c up_udelay.c up_usestack.c
 
 CHIP_SSRCS  = z8_vector.S z8_saveusercontext.S z8_restorecontext.S
 CHIP_CSRCS  = z8_initialstate.c z8_irq.c z8_saveirqcontext.c
-CHIP_CSRCS += z8_schedulesigaction.c z8_sigdeliver.c z8_lowuart.c
+CHIP_CSRCS += z8_schedulesigaction.c z8_sigdeliver.c
 CHIP_CSRCS += z8_serial.c z8_i2c.c z8_registerdump.c
 
 ifneq ($(CONFIG_SCHED_TICKLESS),y)
diff --git a/arch/z80/src/z8/z8_lowuart.c b/arch/z80/src/z8/z8_lowuart.c
deleted file mode 100644
index c1b3393..0000000
--- a/arch/z80/src/z8/z8_lowuart.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
- * arch/z80/src/z8/z8_loweruart.c
- *
- *   Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
- *   Author: Gregory Nutt <gn...@nuttx.org>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- * 3. Neither the name NuttX nor the names of its contributors may be
- *    used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
- * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- *
- ****************************************************************************/
-
-/****************************************************************************
- * Included Files
- ****************************************************************************/
-
-#include <nuttx/config.h>
-
-#include <stdint.h>
-#include <string.h>
-#include <ez8.h>
-
-#include <nuttx/arch.h>
-#include <nuttx/sched.h>
-
-#include "chip.h"
-#include "z80_internal.h"
-
-#ifdef USE_LOWSERIALINIT
-
-extern uint32_t get_freq(void);
-
-/****************************************************************************
- * Pre-processor Definitions
- ****************************************************************************/
-
-/****************************************************************************
- * Private Data
- ****************************************************************************/
-
-/****************************************************************************
- * Private Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Public Functions
- ****************************************************************************/
-
-/****************************************************************************
- * Name: z80_lowserial_initialize
- ****************************************************************************/
-
-void z80_lowserial_initialize(void)
-{
-#if defined(CONFIG_UART0_SERIAL_CONSOLE) || \
-   (defined(EZ8_UART1) && defined(CONFIG_UART1_SERIAL_CONSOLE))
-  uint32_t freq = get_freq();
-  uint16_t brg;
-  uint8_t  val;
-#endif
-
-#ifdef CONFIG_UART0_SERIAL_CONSOLE
-  /* Set the baudrate */
-
-  brg = (freq +(uint32_t)CONFIG_UART0_BAUD * 8) /((uint32_t)CONFIG_UART0_BAUD * 16) ;
-
-  putreg8(brg >> 8, U0BRH);
-  putreg8(brg & 0xff, U0BRL);
-
-  /* Configure GPIO Port A pins 4 & 5 for alternate function */
-
-  putreg8(0x02, PAADDR);
-  val = getreg8(PACTL) | 0x30;    /* Set bits in alternate function register */
-  putreg8(val, PACTL);
-  putreg8(0x07, PAADDR);
-  val = getreg8(PACTL) & 0xcf;    /* Reset bits in alternate function set-1 register */
-  putreg8(val, PACTL);
-  putreg8(0x08, PAADDR);
-  val = getreg8(PACTL) & 0xcf;    /* Reset bits in alternate function set-2 register */
-  putreg8(val, PACTL);
-  putreg8(0x00, PAADDR);
-
-  putreg8(0x00, U0CTL1);          /* no multi-processor operation mode */
-  putreg8(0xc0, U0CTL0);          /* Transmit enable, Receive enable, no Parity, 1 Stop bit */
-
-#elif defined(EZ8_UART1) && defined(CONFIG_UART1_SERIAL_CONSOLE)
-  /* Set the baudrate */
-
-  brg = (freq +(uint32_t)CONFIG_UART1_BAUD * 8) /((uint32_t)CONFIG_UART1_BAUD * 16) ;
-
-  putreg8(brg >> 8, U1BRH);
-  putreg8(brg & 0xff, U1BRL);
-
-  /* Configure GPIO Port D pins 4 & 5 for alternate function */
-
-  putreg8(0x02, PAADDR);
-  val = getreg8(PDCTL) | 0x30;    /* Set bits in alternate function register */
-  putreg8(val, PDCTL);
-  putreg8(0x07, PDADDR);
-  val = getreg8(PDCTL) & 0xcf;    /* Reset bits in alternate function set-1 register */
-  putreg8(val, PDCTL);
-  putreg8(0x08, PDADDR);
-  val = getreg8(PDCTL) & 0xcf;    /* Reset bits in alternate function set-2 register */
-  putreg8(val, PDCTL);
-  putreg8(0x00, PDADDR);
-
-  putreg8(0x00, U1CTL1);          /* no multi-processor operation mode */
-  putreg8(0xc0, U1CTL0);          /* Transmit enable, Receive enable, no Parity, 1 Stop bit */
-#endif
-}
-#endif /* USE_LOWSERIALINIT */