changeset 382:0f9e057c8163

Mostly cosmetic cleanups. TS1000 FLASH package renamed. Remove some old cruft in Viper & TS1000 ports.
author gthomas
date Fri, 18 Oct 2002 16:56:52 +0000
parents 6131849116d0
children bdc60f8839c8
files packages/ChangeLog packages/NEWS packages/devs/eth/powerpc/fec/current/ChangeLog packages/devs/eth/powerpc/fec/current/src/if_fec.c packages/devs/flash/powerpc/ts1000/current/ChangeLog packages/devs/flash/powerpc/ts1000/current/cdl/flash_ts1000.cdl packages/devs/flash/powerpc/ts1000/current/src/ts1000_flash.c packages/ecos.db packages/hal/powerpc/ts1000/current/ChangeLog packages/hal/powerpc/ts1000/current/include/hal_diag.h packages/hal/powerpc/ts1000/current/include/plf_cache.h packages/hal/powerpc/ts1000/current/misc/redboot_RAM.ecm packages/hal/powerpc/ts1000/current/misc/redboot_ROM.ecm packages/hal/powerpc/ts1000/current/misc/redboot_ROMRAM.ecm packages/hal/powerpc/ts1000/current/src/hal_diag.c packages/hal/powerpc/viper/current/ChangeLog packages/hal/powerpc/viper/current/include/hal_diag.h packages/hal/powerpc/viper/current/include/plf_cache.h packages/hal/powerpc/viper/current/src/hal_diag.c
diffstat 19 files changed, 56 insertions(+), 478 deletions(-) [+]
line wrap: on
line diff
--- a/packages/ChangeLog
+++ b/packages/ChangeLog
@@ -1,3 +1,9 @@
+2002-10-18  Gary Thomas  <gthomas@ecoscentric.com>
+
+	* ecos.db: Change package name for TS1000 flash part (consistency).
+
+	* NEWS: Add note about Allied Telesyn TS1000 port.
+
 2002-10-15  Iztok Zupet <iz@vsr.si>
 
 	* pkgconf/rules.doc: modified for pdf target
--- a/packages/NEWS
+++ b/packages/NEWS
@@ -1,3 +1,4 @@
+* Support for Allied Telesyn TS1000 (PowerPC 855T based design)
 * Yoshinori Sato has contributed a watchdog driver for the Hitachi H8/300H.
 * Add AT91 watchdog driver. Contributed by Thomas Koeller of Basler Vision
   Technologies.
--- a/packages/devs/eth/powerpc/fec/current/ChangeLog
+++ b/packages/devs/eth/powerpc/fec/current/ChangeLog
@@ -1,3 +1,7 @@
+2002-10-18  Gary Thomas  <gthomas@ecoscentric.com>
+
+	* src/if_fec.c: Reduce warnings when PHY code is not used.
+
 2002-10-11  Gary Thomas  <gthomas@ecoscentric.com> [inspired by]
 2002-10-11  Wolfgang Heppner <hep@iis.fhg.de>	
 
--- a/packages/devs/eth/powerpc/fec/current/src/if_fec.c
+++ b/packages/devs/eth/powerpc/fec/current/src/if_fec.c
@@ -208,6 +208,7 @@ fec_eth_deliver(struct eth_drv_sc * sc)
 #endif
 }
 
+#ifdef CYGSEM_DEVS_ETH_POWERPC_FEC_RESET_PHY
 //
 // PHY unit access (via MII channel)
 //
@@ -240,6 +241,7 @@ phy_read(int reg, int addr, unsigned sho
     *val = fec->MiiData & 0x0000FFFF;
     return true;
 }
+#endif // CYGSEM_DEVS_ETH_POWERPC_FEC_RESET_PHY
 
 //
 // [re]Initialize the ethernet controller
@@ -394,12 +396,14 @@ fec_eth_init(struct cyg_netdevtab_entry 
     struct fec_eth_info *qi = (struct fec_eth_info *)sc->driver_private;
     volatile EPPC *eppc = (volatile EPPC *)eppc_base();
     volatile struct fec *fec = (volatile struct fec *)((unsigned char *)eppc + FEC_OFFSET);
+    int cache_state;
+    unsigned long proc_rev;
+    bool esa_ok;
+#ifdef CYGSEM_DEVS_ETH_POWERPC_FEC_RESET_PHY
+    int phy_timeout = 5*1000;  // Wait 5 seconds max for link to clear
+    bool phy_ok;
     unsigned short phy_state = 0;
-    int cache_state;
-    int i;
-    unsigned long proc_rev;
-    bool esa_ok, phy_ok;
-    int phy_timeout = 5*1000;  // Wait 5 seconds max for link to clear
+#endif
 
     // Ensure consistent state between cache and what the FEC sees
     HAL_DCACHE_IS_ENABLED(cache_state);
@@ -480,6 +484,7 @@ fec_eth_init(struct cyg_netdevtab_entry 
     if (phy_read(PHY_BMSR, FEC_ETH_PHY, &phy_state)) {
         if ((phy_state & PHY_BMSR_LINK) !=  PHY_BMSR_LINK) {
             unsigned short reset_mode;
+            int i;
             phy_write(PHY_BMCR, FEC_ETH_PHY, PHY_BMCR_RESET);
             for (i = 0;  i < 10;  i++) {
                 phy_ok = phy_read(PHY_BMCR, FEC_ETH_PHY, &phy_state);
--- a/packages/devs/flash/powerpc/ts1000/current/ChangeLog
+++ b/packages/devs/flash/powerpc/ts1000/current/ChangeLog
@@ -1,3 +1,7 @@
+2002-10-18  Gary Thomas  <gthomas@ecoscentric.com>
+
+	* cdl/flash_ts1000.cdl: Package renamed for consistency.
+
 2002-09-19  Gary Thomas  <gary@mlbassoc.com>
 
 	* cdl/flash_ts1000.cdl: Part is AM29DL640D (not LV640D).
--- a/packages/devs/flash/powerpc/ts1000/current/cdl/flash_ts1000.cdl
+++ b/packages/devs/flash/powerpc/ts1000/current/cdl/flash_ts1000.cdl
@@ -50,7 +50,7 @@
 #
 # ====================================================================
 
-cdl_package CYGPKG_DEVS_FLASH_TS1000 {
+cdl_package CYGPKG_DEVS_FLASH_POWERPC_TS1000 {
     display       "Allied Telesyn TS1000 (PPC855) FLASH memory support"
 
     parent        CYGPKG_IO_FLASH
--- a/packages/devs/flash/powerpc/ts1000/current/src/ts1000_flash.c
+++ b/packages/devs/flash/powerpc/ts1000/current/src/ts1000_flash.c
@@ -9,6 +9,7 @@
 // -------------------------------------------
 // This file is part of eCos, the Embedded Configurable Operating System.
 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+// Copyright (C) 2002 Gary Thomas
 //
 // eCos is free software; you can redistribute it and/or modify it under
 // the terms of the GNU General Public License as published by the Free
@@ -55,13 +56,10 @@
 //--------------------------------------------------------------------------
 // Device properties
 
-#define CYGNUM_FLASH_INTERLEAVE	(1)
-#define CYGNUM_FLASH_SERIES	(1)
+#define CYGNUM_FLASH_INTERLEAVE (1)
+#define CYGNUM_FLASH_SERIES     (1)
 #define CYGNUM_FLASH_WIDTH      (16)
-#define CYGNUM_FLASH_BASE 	(0xFE000000)
-// #define CYGNUM_FLASH_16AS8      (0)
-
-//static cyg_uint32 plf_flash_base;
+#define CYGNUM_FLASH_BASE       (0xFE000000)
 
 //--------------------------------------------------------------------------
 // Platform specific extras
--- a/packages/ecos.db
+++ b/packages/ecos.db
@@ -3982,7 +3982,7 @@ package CYGPKG_HAL_POWERPC_TS1000 {
             eCos on a Allied Telesyn TS1000 board equipped with a PowerPC processor."
 }
 
-package CYGPKG_DEVS_FLASH_TS1000 {
+package CYGPKG_DEVS_FLASH_POWERPC_TS1000 {
 	alias 		{ "FLASH memory support for Allied Telesyn TS1000 (PPC855) board" flash_ts1000 }
 	directory	devs/flash/powerpc/ts1000
 	script		flash_ts1000.cdl
@@ -4006,7 +4006,7 @@ target ts1000 {
                           CYGPKG_HAL_POWERPC_MPC8xx
                           CYGPKG_HAL_POWERPC_TS1000
                           CYGPKG_HAL_QUICC 
-                          CYGPKG_DEVS_FLASH_TS1000
+                          CYGPKG_DEVS_FLASH_POWERPC_TS1000
                           CYGPKG_DEVS_FLASH_AMD_AM29XXXXX
                           CYGPKG_DEVS_ETH_POWERPC_FEC
                           CYGPKG_DEVS_ETH_POWERPC_TS1000
--- a/packages/hal/powerpc/ts1000/current/ChangeLog
+++ b/packages/hal/powerpc/ts1000/current/ChangeLog
@@ -1,3 +1,14 @@
+2002-10-18  Gary Thomas  <gthomas@ecoscentric.com>
+
+	* misc/redboot_ROMRAM.ecm: 
+	* misc/redboot_ROM.ecm: 
+	* misc/redboot_RAM.ecm: FLASH package name change.
+
+	* include/plf_cache.h: No need for "old" FLASH cache support.
+
+	* src/hal_diag.c: 
+	* include/hal_diag.h: Remove old !VIRTUAL_VECTORS cruft.
+
 2002-10-15  Gary Thomas  <gary@mlbassoc.com>
 
 	* src/ts1000.S: Don't reset PHY on RAM startup.
--- a/packages/hal/powerpc/ts1000/current/include/hal_diag.h
+++ b/packages/hal/powerpc/ts1000/current/include/hal_diag.h
@@ -58,36 +58,12 @@
 #include <pkgconf/hal.h>
 
 #include <cyg/infra/cyg_type.h>
-
-#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG)
-
 #include <cyg/hal/hal_if.h>
 
 #define HAL_DIAG_INIT() hal_if_diag_init()
 #define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_)
 #define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_)
 
-#else // everything by steam
-
-//-----------------------------------------------------------------------------
-// functions implemented in hal_diag.c
-
-externC void hal_diag_init(void);
-
-externC void hal_diag_write_char(char c);
-
-externC void hal_diag_read_char(char *c);
-
-//-----------------------------------------------------------------------------
-
-#define HAL_DIAG_INIT() hal_diag_init()
-
-#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_)
-
-#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_)
-
-#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
-
 //-----------------------------------------------------------------------------
 // end of hal_diag.h
 #endif // CYGONCE_HAL_HAL_DIAG_H
--- a/packages/hal/powerpc/ts1000/current/include/plf_cache.h
+++ b/packages/hal/powerpc/ts1000/current/include/plf_cache.h
@@ -61,18 +61,5 @@
 // Initial cache enabling - controlled by common CDL
 
 //-----------------------------------------------------------------------------
-// FIXME: This definition forces the IO flash driver to use a
-// known-good procedure for fiddling flash before calling flash device
-// driver functions. The procedure breaks on other platform/driver
-// combinations though so is depricated. Hence this definition.
-//
-// If you work on this target, please try to remove this definition
-// and verify that the flash driver still works (both from RAM and
-// flash). If it does, remove the definition and this comment for good
-// [and the old macro definition if this happens to be the last client
-// of that code].
-#define HAL_FLASH_CACHES_OLD_MACROS
-
-//-----------------------------------------------------------------------------
 #endif // ifndef CYGONCE_PLF_CACHE_H
 // End of plf_cache.h
--- a/packages/hal/powerpc/ts1000/current/misc/redboot_RAM.ecm
+++ b/packages/hal/powerpc/ts1000/current/misc/redboot_RAM.ecm
@@ -15,7 +15,7 @@ cdl_configuration eCos {
     package -hardware CYGPKG_HAL_POWERPC_MPC8xx current ;
     package -hardware CYGPKG_HAL_POWERPC_TS1000 current ;
     package -hardware CYGPKG_HAL_QUICC current ;
-    package -hardware CYGPKG_DEVS_FLASH_TS1000 current ;
+    package -hardware CYGPKG_DEVS_FLASH_POWERPC_TS1000 current ;
     package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ;
     package -hardware CYGPKG_DEVS_ETH_POWERPC_FEC current ;
     package -hardware CYGPKG_DEVS_ETH_POWERPC_TS1000 current ;
--- a/packages/hal/powerpc/ts1000/current/misc/redboot_ROM.ecm
+++ b/packages/hal/powerpc/ts1000/current/misc/redboot_ROM.ecm
@@ -15,7 +15,7 @@ cdl_configuration eCos {
     package -hardware CYGPKG_HAL_POWERPC_MPC8xx current ;
     package -hardware CYGPKG_HAL_POWERPC_TS1000 current ;
     package -hardware CYGPKG_HAL_QUICC current ;
-    package -hardware CYGPKG_DEVS_FLASH_TS1000 current ;
+    package -hardware CYGPKG_DEVS_FLASH_POWERPC_TS1000 current ;
     package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ;
     package -hardware CYGPKG_DEVS_ETH_POWERPC_FEC current ;
     package -hardware CYGPKG_DEVS_ETH_POWERPC_TS1000 current ;
--- a/packages/hal/powerpc/ts1000/current/misc/redboot_ROMRAM.ecm
+++ b/packages/hal/powerpc/ts1000/current/misc/redboot_ROMRAM.ecm
@@ -15,7 +15,7 @@ cdl_configuration eCos {
     package -hardware CYGPKG_HAL_POWERPC_MPC8xx current ;
     package -hardware CYGPKG_HAL_POWERPC_TS1000 current ;
     package -hardware CYGPKG_HAL_QUICC current ;
-    package -hardware CYGPKG_DEVS_FLASH_TS1000 current ;
+    package -hardware CYGPKG_DEVS_FLASH_POWERPC_TS1000 current ;
     package -hardware CYGPKG_DEVS_FLASH_AMD_AM29XXXXX current ;
     package -hardware CYGPKG_DEVS_ETH_POWERPC_FEC current ;
     package -hardware CYGPKG_DEVS_ETH_POWERPC_TS1000 current ;
--- a/packages/hal/powerpc/ts1000/current/src/hal_diag.c
+++ b/packages/hal/powerpc/ts1000/current/src/hal_diag.c
@@ -42,7 +42,7 @@
 //#####DESCRIPTIONBEGIN####
 //
 // Author(s):   hmt
-// Contributors:hmt
+// Contributors:hmt, gthomas
 // Date:        1999-06-08
 // Purpose:     HAL diagnostic output
 // Description: Implementations of HAL diagnostic output support.
@@ -68,7 +68,6 @@
 #include <cyg/hal/ppc_regs.h>
 #include <cyg/hal/quicc/quicc_smc1.h>
 
-
 void
 cyg_hal_plf_comms_init(void)
 {
@@ -78,199 +77,7 @@ cyg_hal_plf_comms_init(void)
         return;
     initialized = 1;
 
-    cyg_hal_plf_serial_init();
-}
-
-
-#if !defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG)
-
-//-----------------------------------------------------------------------------
-// Select default diag channel to use
-
-//#define CYG_KERNEL_DIAG_ROMART
-//#define CYG_KERNEL_DIAG_SERIAL
-
-#if !defined(CYG_KERNEL_DIAG_SERIAL)
-#define CYG_KERNEL_DIAG_SERIAL
-#endif
-
-#ifdef CYGDBG_DIAG_BUF
-// Keep diag messages in a buffer for later [re]display
-
-int enable_diag_uart = 1;
-int enable_diag_buf = 1;
-static char diag_buf[40960*4];
-static int  diag_buf_ptr = 0;
-
-static void
-diag_putc(char c)
-{
-    if (enable_diag_buf) {
-        diag_buf[diag_buf_ptr++] = c;
-        if (diag_buf_ptr == sizeof(diag_buf)) diag_buf_ptr--;
-    }
-}
-
-void
-dump_diag_buf(int start, int len)
-{
-    int i;
-    enable_diag_uart = 1;
-    enable_diag_buf = 0;
-    if (len == 0) len = diag_buf_ptr;
-    diag_printf("\nDiag buf\n");
-    for (i = start;  i < len;  i++) {
-        hal_diag_write_char(diag_buf[i]);
-    }
-}
-#endif // CYGDBG_DIAG_BUF
-
-
-//-----------------------------------------------------------------------------
-// Board specific serial output; using GDB protocol by default:
-
-
-#if defined(CYG_KERNEL_DIAG_SERIAL)
-
-EPPC *eppc;
-
-void hal_diag_init(void)
-{
-    static int init = 0;
-    if (init) return;
-    init++;
-
-    // hardwired base
-    eppc = eppc_base();
-
-    // init the actual serial port
-    cyg_hal_plf_serial_init_channel();
-#ifdef CYGSEM_HAL_DIAG_MANGLER_GDB
-#ifndef CYG_HAL_STARTUP_ROM
-    // We are talking to GDB; ack the "go" packet!
-    cyg_hal_plf_serial_putc(eppc, '+');
-#endif
-#endif
-}
-
-void hal_diag_write_char_serial( char c )
-{
-    unsigned long __state;
-    HAL_DISABLE_INTERRUPTS(__state);
-    cyg_hal_plf_serial_putc(eppc, c);
-    HAL_RESTORE_INTERRUPTS(__state);
-}
-
-#if defined(CYG_HAL_STARTUP_ROM) || !defined(CYGDBG_HAL_DIAG_TO_DEBUG_CHAN)
-void hal_diag_write_char(char c)
-{
-#ifdef CYGDBG_DIAG_BUF
-    diag_putc(c);
-    if (!enable_diag_uart) return;
-#endif // CYGDBG_DIAG_BUF
-    hal_diag_write_char_serial(c);
+    cyg_hal_plf_serial_init();  // Defined in hal/powerpc/quicc/...
 }
 
-#else // RAM start so encode for GDB
-
-void hal_diag_write_char(char c)
-{
-    static char line[100];
-    static int pos = 0;
-
-#ifdef CYGDBG_DIAG_BUF
-    diag_putc(c);
-    if (!enable_diag_uart) return;
-#endif // CYGDBG_DIAG_BUF
-
-    // No need to send CRs
-    if( c == '\r' ) return;
-
-    line[pos++] = c;
-
-    if( c == '\n' || pos == sizeof(line) )
-    {
-        CYG_INTERRUPT_STATE old;
-
-        // Disable interrupts. This prevents GDB trying to interrupt us
-        // while we are in the middle of sending a packet. The serial
-        // receive interrupt will be seen when we re-enable interrupts
-        // later.
-        
-#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
-        CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old);
-#else
-        HAL_DISABLE_INTERRUPTS(old);
-#endif
-        
-        while(1)
-        {
-            static char hex[] = "0123456789ABCDEF";
-            cyg_uint8 csum = 0;
-            int i;
-        
-            hal_diag_write_char_serial('$');
-            hal_diag_write_char_serial('O');
-            csum += 'O';
-            for( i = 0; i < pos; i++ )
-            {
-                char ch = line[i];
-                char h = hex[(ch>>4)&0xF];
-                char l = hex[ch&0xF];
-                hal_diag_write_char_serial(h);
-                hal_diag_write_char_serial(l);
-                csum += h;
-                csum += l;
-            }
-            hal_diag_write_char_serial('#');
-            hal_diag_write_char_serial(hex[(csum>>4)&0xF]);
-            hal_diag_write_char_serial(hex[csum&0xF]);
-
-#ifndef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
-            // only gobble characters if no interrupt handler to grab ^Cs
-            // is installed (which is exclusive with device driver use)
-
-            // Wait for the ACK character '+' from GDB here and handle
-            // receiving a ^C instead.  This is the reason for this clause
-            // being a loop.
-            c = cyg_hal_plf_serial_getc(eppc);
-
-            if( c == '+' )
-                break;              // a good acknowledge
-#if 0
-            if( c1 == 3 ) {
-                // Ctrl-C: breakpoint.
-                breakpoint();
-                break;
-            }
-#endif
-            // otherwise, loop round again
-#else
-            break;
-#endif
-        }
-        
-        pos = 0;
-
-        // And re-enable interrupts
-#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
-        CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old);
-#else
-        HAL_RESTORE_INTERRUPTS(old);
-#endif
-        
-    }
-}
-#endif // NOT def CYG_HAL_STARTUP_ROM
-
-
-void hal_diag_read_char(char *c)
-{
-    *c = cyg_hal_plf_serial_getc(eppc);
-}
-
-#endif // CYG_KERNEL_DIAG_SERIAL
-
-#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
-
 // EOF hal_diag.c
--- a/packages/hal/powerpc/viper/current/ChangeLog
+++ b/packages/hal/powerpc/viper/current/ChangeLog
@@ -1,3 +1,10 @@
+2002-10-18  Gary Thomas  <gthomas@ecoscentric.com>
+
+	* include/plf_cache.h: No need for old FLASH cache support.
+
+	* src/hal_diag.c: 
+	* include/hal_diag.h: Remove old !VIRTUAL_VECTOR cruft.
+
 2002-09-02  Gary Thomas  <gthomas@ecoscentric.com>
 
 	* cdl/hal_powerpc_viper.cdl: Fix descriptions for serial ports 
--- a/packages/hal/powerpc/viper/current/include/hal_diag.h
+++ b/packages/hal/powerpc/viper/current/include/hal_diag.h
@@ -58,35 +58,12 @@
 
 #include <cyg/infra/cyg_type.h>
 
-#if defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG)
-
 #include <cyg/hal/hal_if.h>
 
 #define HAL_DIAG_INIT() hal_if_diag_init()
 #define HAL_DIAG_WRITE_CHAR(_c_) hal_if_diag_write_char(_c_)
 #define HAL_DIAG_READ_CHAR(_c_) hal_if_diag_read_char(&_c_)
 
-#else // everything by steam
-
-//-----------------------------------------------------------------------------
-// functions implemented in hal_diag.c
-
-externC void hal_diag_init(void);
-
-externC void hal_diag_write_char(char c);
-
-externC void hal_diag_read_char(char *c);
-
-//-----------------------------------------------------------------------------
-
-#define HAL_DIAG_INIT() hal_diag_init()
-
-#define HAL_DIAG_WRITE_CHAR(_c_) hal_diag_write_char(_c_)
-
-#define HAL_DIAG_READ_CHAR(_c_) hal_diag_read_char(&_c_)
-
-#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
-
 //-----------------------------------------------------------------------------
 // end of hal_diag.h
 #endif // CYGONCE_HAL_HAL_DIAG_H
--- a/packages/hal/powerpc/viper/current/include/plf_cache.h
+++ b/packages/hal/powerpc/viper/current/include/plf_cache.h
@@ -60,18 +60,5 @@
 // Initial cache enabling - controlled by common CDL
 
 //-----------------------------------------------------------------------------
-// FIXME: This definition forces the IO flash driver to use a
-// known-good procedure for fiddling flash before calling flash device
-// driver functions. The procedure breaks on other platform/driver
-// combinations though so is depricated. Hence this definition.
-//
-// If you work on this target, please try to remove this definition
-// and verify that the flash driver still works (both from RAM and
-// flash). If it does, remove the definition and this comment for good
-// [and the old macro definition if this happens to be the last client
-// of that code].
-#define HAL_FLASH_CACHES_OLD_MACROS
-
-//-----------------------------------------------------------------------------
 #endif // ifndef CYGONCE_PLF_CACHE_H
 // End of plf_cache.h
--- a/packages/hal/powerpc/viper/current/src/hal_diag.c
+++ b/packages/hal/powerpc/viper/current/src/hal_diag.c
@@ -77,199 +77,7 @@ cyg_hal_plf_comms_init(void)
         return;
     initialized = 1;
 
-    cyg_hal_plf_serial_init();
-}
-
-
-#if !defined(CYGSEM_HAL_VIRTUAL_VECTOR_DIAG)
-
-//-----------------------------------------------------------------------------
-// Select default diag channel to use
-
-//#define CYG_KERNEL_DIAG_ROMART
-//#define CYG_KERNEL_DIAG_SERIAL
-
-#if !defined(CYG_KERNEL_DIAG_SERIAL)
-#define CYG_KERNEL_DIAG_SERIAL
-#endif
-
-#ifdef CYGDBG_DIAG_BUF
-// Keep diag messages in a buffer for later [re]display
-
-int enable_diag_uart = 1;
-int enable_diag_buf = 1;
-static char diag_buf[40960*4];
-static int  diag_buf_ptr = 0;
-
-static void
-diag_putc(char c)
-{
-    if (enable_diag_buf) {
-        diag_buf[diag_buf_ptr++] = c;
-        if (diag_buf_ptr == sizeof(diag_buf)) diag_buf_ptr--;
-    }
-}
-
-void
-dump_diag_buf(int start, int len)
-{
-    int i;
-    enable_diag_uart = 1;
-    enable_diag_buf = 0;
-    if (len == 0) len = diag_buf_ptr;
-    diag_printf("\nDiag buf\n");
-    for (i = start;  i < len;  i++) {
-        hal_diag_write_char(diag_buf[i]);
-    }
-}
-#endif // CYGDBG_DIAG_BUF
-
-
-//-----------------------------------------------------------------------------
-// MBX board specific serial output; using GDB protocol by default:
-
-
-#if defined(CYG_KERNEL_DIAG_SERIAL)
-
-EPPC *eppc;
-
-void hal_diag_init(void)
-{
-    static int init = 0;
-    if (init) return;
-    init++;
-
-    // hardwired base
-    eppc = eppc_base();
-
-    // init the actual serial port
-    cyg_hal_plf_serial_init_channel();
-#ifdef CYGSEM_HAL_DIAG_MANGLER_GDB
-#ifndef CYG_HAL_STARTUP_ROM
-    // We are talking to GDB; ack the "go" packet!
-    cyg_hal_plf_serial_putc(eppc, '+');
-#endif
-#endif
-}
-
-void hal_diag_write_char_serial( char c )
-{
-    unsigned long __state;
-    HAL_DISABLE_INTERRUPTS(__state);
-    cyg_hal_plf_serial_putc(eppc, c);
-    HAL_RESTORE_INTERRUPTS(__state);
-}
-
-#if defined(CYG_HAL_STARTUP_ROM) || !defined(CYGDBG_HAL_DIAG_TO_DEBUG_CHAN)
-void hal_diag_write_char(char c)
-{
-#ifdef CYGDBG_DIAG_BUF
-    diag_putc(c);
-    if (!enable_diag_uart) return;
-#endif // CYGDBG_DIAG_BUF
-    hal_diag_write_char_serial(c);
+    cyg_hal_plf_serial_init();  // Defined in hal/powerpc/quicc/...
 }
 
-#else // RAM start so encode for GDB
-
-void hal_diag_write_char(char c)
-{
-    static char line[100];
-    static int pos = 0;
-
-#ifdef CYGDBG_DIAG_BUF
-    diag_putc(c);
-    if (!enable_diag_uart) return;
-#endif // CYGDBG_DIAG_BUF
-
-    // No need to send CRs
-    if( c == '\r' ) return;
-
-    line[pos++] = c;
-
-    if( c == '\n' || pos == sizeof(line) )
-    {
-        CYG_INTERRUPT_STATE old;
-
-        // Disable interrupts. This prevents GDB trying to interrupt us
-        // while we are in the middle of sending a packet. The serial
-        // receive interrupt will be seen when we re-enable interrupts
-        // later.
-        
-#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
-        CYG_HAL_GDB_ENTER_CRITICAL_IO_REGION(old);
-#else
-        HAL_DISABLE_INTERRUPTS(old);
-#endif
-        
-        while(1)
-        {
-            static char hex[] = "0123456789ABCDEF";
-            cyg_uint8 csum = 0;
-            int i;
-        
-            hal_diag_write_char_serial('$');
-            hal_diag_write_char_serial('O');
-            csum += 'O';
-            for( i = 0; i < pos; i++ )
-            {
-                char ch = line[i];
-                char h = hex[(ch>>4)&0xF];
-                char l = hex[ch&0xF];
-                hal_diag_write_char_serial(h);
-                hal_diag_write_char_serial(l);
-                csum += h;
-                csum += l;
-            }
-            hal_diag_write_char_serial('#');
-            hal_diag_write_char_serial(hex[(csum>>4)&0xF]);
-            hal_diag_write_char_serial(hex[csum&0xF]);
-
-#ifndef CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT
-            // only gobble characters if no interrupt handler to grab ^Cs
-            // is installed (which is exclusive with device driver use)
-
-            // Wait for the ACK character '+' from GDB here and handle
-            // receiving a ^C instead.  This is the reason for this clause
-            // being a loop.
-            c = cyg_hal_plf_serial_getc(eppc);
-
-            if( c == '+' )
-                break;              // a good acknowledge
-#if 0
-            if( c1 == 3 ) {
-                // Ctrl-C: breakpoint.
-                breakpoint();
-                break;
-            }
-#endif
-            // otherwise, loop round again
-#else
-            break;
-#endif
-        }
-        
-        pos = 0;
-
-        // And re-enable interrupts
-#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
-        CYG_HAL_GDB_LEAVE_CRITICAL_IO_REGION(old);
-#else
-        HAL_RESTORE_INTERRUPTS(old);
-#endif
-        
-    }
-}
-#endif // NOT def CYG_HAL_STARTUP_ROM
-
-
-void hal_diag_read_char(char *c)
-{
-    *c = cyg_hal_plf_serial_getc(eppc);
-}
-
-#endif // CYG_KERNEL_DIAG_SERIAL
-
-#endif // CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
-
 // EOF hal_diag.c