This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Dreamcast Broadband Adapter Driver
- From: Yoshinori Sato <ysato at users dot sourceforge dot jp>
- To: eCos patches <ecos-patches at sources dot redhat dot com>
- Date: Thu, 22 Apr 2004 22:45:56 +0900
- Subject: Dreamcast Broadband Adapter Driver
this patch is Sega Dreamcast Broadband Adapter (Realtek 8139 Ethernet Interface)
support driver.
--
Yoshinori Sato
<ysato@users.sourceforge.jp>
Index: ChangeLog
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/ChangeLog,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ChangeLog 4 Apr 2004 12:02:08 -0000 1.8
+++ ChangeLog 21 Apr 2004 11:57:40 -0000 1.9
@@ -1,3 +1,8 @@
+2004-04-21 Yoshinori Sato <ysato@users.sourceforge.jp>
+
+ * ecos.db: New Packages:
+ CYGPKG_DEVS_ETH_DREAMCAST_RLTK8139 - SEGA Dreamcast Broadband Adapter support
+
2004-04-02 Yoshinori Sato <ysato@users.sourceforge.jp>
* ecos.db: New Packages:
Index: ecos.db
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/ecos.db,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- ecos.db 4 Apr 2004 12:02:08 -0000 1.17
+++ ecos.db 21 Apr 2004 11:57:40 -0000 1.18
@@ -4374,6 +4374,8 @@
CYGPKG_HAL_SH_SH4
CYGPKG_HAL_SH_SH7750_DREAMCAST
CYGPKG_IO_PCI
+ CYGPKG_DEVS_ETH_RLTK_8139
+ CYGPKG_DEVS_ETH_SH_DREAMCAST_RLTK8139
CYGPKG_IO_SERIAL_SH_SCIF }
description "
The sh7750 target provides the packages needed to run
@@ -5437,6 +5439,14 @@
directory devs/eth/i386/pc/rltk8139
script i386_pc_rltk8139_eth_drivers.cdl
description "Intel PC using Realtek 8139 (PCI) card."
+}
+
+package CYGPKG_DEVS_ETH_SH_DREAMCAST_RLTK8139 {
+ alias { "SEGA Dreamcast with BroadBandAdapter driver" dreamcast_rltk8139_eth_driver }
+ hardware
+ directory devs/eth/sh/dreamcast
+ script sh_dreamcast_rltk8139_eth_drivers.cdl
+ description "SEGA Dreamcast with BroadBandAdapter."
}
target pc_rltk8139 {
Index: devs/eth/rltk/8139/current/ChangeLog
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/devs/eth/rltk/8139/current/ChangeLog,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ChangeLog
--- devs/eth/rltk/8139/current/ChangeLog 27 Nov 2003 14:22:39 -0000 1.1.1.1
+++ devs/eth/rltk/8139/current/ChangeLog 22 Apr 2004 13:25:08 -0000
@@ -1,3 +1,9 @@
+2004-04-21 Yoshinori Sato <ysato@users.sourceforge.jp>
+
+ * src/if_8139.c:
+ add known device 0x11db/0x1234 from Dreamcast Broadband Adapter.
+ add Platform depend Initialize entry.
+
2003-11-21 Gary Thomas <gary@mlbassoc.com>
* src/if_8139.c: Use cyg_drv_isr_lock/unlock functions for ISR
Index: devs/eth/rltk/8139/current/src/if_8139.c
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/devs/eth/rltk/8139/current/src/if_8139.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 if_8139.c
--- devs/eth/rltk/8139/current/src/if_8139.c 27 Nov 2003 14:22:40 -0000 1.1.1.1
+++ devs/eth/rltk/8139/current/src/if_8139.c 22 Apr 2004 13:25:08 -0000
@@ -136,6 +136,10 @@
#include CYGDAT_DEVS_ETH_RLTK_8139_INL
#endif
+#ifndef CYGHWR_RLTK_8139_PLF_INIT
+#define CYGHWR_RLTK_8139_PLF_INIT(sc) do {} while(0)
+#endif
+
/*
* If software cache coherency is required, the HAL_DCACHE_INVALIDATE
* hal macro must be defined as well.
@@ -270,10 +274,11 @@
* Table of all known PCI device/vendor ID combinations for the RealTek 8139.
* Add them as you get to know them.
*/
-#define CYGNUM_DEVS_ETH_RLTK_8139_KNOWN_ALIASES 1
+#define CYGNUM_DEVS_ETH_RLTK_8139_KNOWN_ALIASES 2
static pci_identifier_t
known_8139_aliases[CYGNUM_DEVS_ETH_RLTK_8139_KNOWN_ALIASES] = {
- { 0x10ec, 0x8139, NULL } /* This is the offical RealTek vendor/device code */
+ { 0x10ec, 0x8139, NULL }, /* This is the offical RealTek vendor/device code */
+ { 0x11db, 0x1234, NULL} /* SEGA DreamCast BroadBandAdapter */
};
@@ -610,6 +615,9 @@
return false;
}
+ /* platform depends initialize */
+ CYGHWR_RLTK_8139_PLF_INIT(sc);
+
/*
* The initial tx threshold is set here to prevent it from being reset
* with every _start().
Index: devs/eth/rltk/8139/current/ChangeLog
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/devs/eth/rltk/8139/current/ChangeLog,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ChangeLog
--- devs/eth/rltk/8139/current/ChangeLog 27 Nov 2003 14:22:39 -0000 1.1.1.1
+++ devs/eth/rltk/8139/current/ChangeLog 22 Apr 2004 13:26:10 -0000
@@ -1,3 +1,9 @@
+2004-04-21 Yoshinori Sato <ysato@users.sourceforge.jp>
+
+ * src/if_8139.c:
+ add known device 0x11db/0x1234 from Dreamcast Broadband Adapter.
+ add Platform depend Initialize entry.
+
2003-11-21 Gary Thomas <gary@mlbassoc.com>
* src/if_8139.c: Use cyg_drv_isr_lock/unlock functions for ISR
Index: devs/eth/rltk/8139/current/src/if_8139.c
===================================================================
RCS file: /cvsroot/ecos-h8/ecos/packages/devs/eth/rltk/8139/current/src/if_8139.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 if_8139.c
--- devs/eth/rltk/8139/current/src/if_8139.c 27 Nov 2003 14:22:40 -0000 1.1.1.1
+++ devs/eth/rltk/8139/current/src/if_8139.c 22 Apr 2004 13:26:10 -0000
@@ -136,6 +136,10 @@
#include CYGDAT_DEVS_ETH_RLTK_8139_INL
#endif
+#ifndef CYGHWR_RLTK_8139_PLF_INIT
+#define CYGHWR_RLTK_8139_PLF_INIT(sc) do {} while(0)
+#endif
+
/*
* If software cache coherency is required, the HAL_DCACHE_INVALIDATE
* hal macro must be defined as well.
@@ -270,10 +274,11 @@
* Table of all known PCI device/vendor ID combinations for the RealTek 8139.
* Add them as you get to know them.
*/
-#define CYGNUM_DEVS_ETH_RLTK_8139_KNOWN_ALIASES 1
+#define CYGNUM_DEVS_ETH_RLTK_8139_KNOWN_ALIASES 2
static pci_identifier_t
known_8139_aliases[CYGNUM_DEVS_ETH_RLTK_8139_KNOWN_ALIASES] = {
- { 0x10ec, 0x8139, NULL } /* This is the offical RealTek vendor/device code */
+ { 0x10ec, 0x8139, NULL }, /* This is the offical RealTek vendor/device code */
+ { 0x11db, 0x1234, NULL} /* SEGA DreamCast BroadBandAdapter */
};
@@ -610,6 +615,9 @@
return false;
}
+ /* platform depends initialize */
+ CYGHWR_RLTK_8139_PLF_INIT(sc);
+
/*
* The initial tx threshold is set here to prevent it from being reset
* with every _start().
Index: devs/eth/sh/dreamcast/current/ChangeLog
===================================================================
RCS file: devs/eth/sh/dreamcast/current/ChangeLog
diff -N devs/eth/sh/dreamcast/current/ChangeLog
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ devs/eth/sh/dreamcast/current/ChangeLog 21 Apr 2004 12:03:15 -0000 1.1
@@ -0,0 +1,41 @@
+2004-04-21 Yoshinori Sato <ysato@users.sourceforge.jp>
+
+ * src/if_dreamcast.c
+ * include/devs_eth_sh_dreamcast_rltk8139.inl
+ * cdl/sh_dreamcast_rltk_8139_eth_drivers.cdl:
+ New package - SEGA Dreamcast Broadband Adapter Support.
+
+//===========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// 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
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//===========================================================================
Index: devs/eth/sh/dreamcast/current/cdl/sh_dreamcast_rltk8139_eth_drivers.cdl
===================================================================
RCS file: devs/eth/sh/dreamcast/current/cdl/sh_dreamcast_rltk8139_eth_drivers.cdl
diff -N devs/eth/sh/dreamcast/current/cdl/sh_dreamcast_rltk8139_eth_drivers.cdl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ devs/eth/sh/dreamcast/current/cdl/sh_dreamcast_rltk8139_eth_drivers.cdl 22 Apr 2004 13:23:55 -0000 1.2
@@ -0,0 +1,92 @@
+# ====================================================================
+#
+# sh_dreamcast_rltk8139_eth_drivers.cdl
+#
+# Ethernet drivers - support for Dreamcast BroadBandAdapter
+#
+# ====================================================================
+#####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+##
+## 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
+## Software Foundation; either version 2 or (at your option) any later version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+## WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License along
+## with eCos; if not, write to the Free Software Foundation, Inc.,
+## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+##
+## As a special exception, if other files instantiate templates or use macros
+## or inline functions from this file, or you compile this file and link it
+## with other works to produce a work based on this file, this file does not
+## by itself cause the resulting work to be covered by the GNU General Public
+## License. However the source code for this file must still be made available
+## in accordance with section (3) of the GNU General Public License.
+##
+## This exception does not invalidate any other reasons why a work based on
+## this file might be covered by the GNU General Public License.
+##
+## Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+## at http://sources.redhat.com/ecos/ecos-license/
+## -------------------------------------------
+#####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s): Yoshinori Sato
+# Contributors:
+# Date: 2004-04-22
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_DEVS_ETH_SH_DREAMCAST_RLTK8139 {
+ display "Dreamcast BbA driver"
+ description "Ethernet driver for Dreamcast Broadband Adapter"
+
+ parent CYGPKG_IO_ETH_DRIVERS
+ active_if CYGPKG_IO_ETH_DRIVERS
+ active_if CYGPKG_HAL_SH_SH7750_DREAMCAST
+ compile -library=libextras.a if_dreamcast.c
+
+ include_dir cyg/io
+
+ # FIXME: This really belongs in the RealTek_8139 package ?
+ cdl_interface CYGINT_DEVS_ETH_RLTK_8139_REQUIRED {
+ display "RealTek 8139 ethernet driver required"
+ }
+
+ define_proc {
+ puts $::cdl_system_header "/***** ethernet driver proc output start *****/"
+ puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_RLTK_8139_INL <cyg/io/devs_eth_sh_dreamcast_rltk8139.inl>"
+ puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_RLTK_8139_CFG <pkgconf/devs_eth_sh_dreamcast_rltk8139.h>"
+ puts $::cdl_system_header "/***** ethernet driver proc output end *****/"
+ }
+
+ cdl_component CYGPKG_DEVS_ETH_SH_DREAMCAST_RLTK8139_ETH0 {
+ display "Ethernet port 0 driver"
+ flavor bool
+ default_value 1
+
+ implements CYGHWR_NET_DRIVERS
+ implements CYGHWR_NET_DRIVER_ETH0
+ implements CYGINT_DEVS_ETH_RLTK_8139_REQUIRED
+
+ cdl_option CYGDAT_DEVS_ETH_SH_DREAMCAST_RLTK8139_ETH0_NAME {
+ display "Device name for the ETH0 ethernet port 0 driver"
+ flavor data
+ default_value {"\"eth0\""}
+ description "
+ This option sets the name of the ethernet device for the
+ RealTek 8139 ethernet port 0."
+ }
+ }
+}
Index: devs/eth/sh/dreamcast/current/include/devs_eth_sh_dreamcast_rltk8139.inl
===================================================================
RCS file: devs/eth/sh/dreamcast/current/include/devs_eth_sh_dreamcast_rltk8139.inl
diff -N devs/eth/sh/dreamcast/current/include/devs_eth_sh_dreamcast_rltk8139.inl
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ devs/eth/sh/dreamcast/current/include/devs_eth_sh_dreamcast_rltk8139.inl 22 Apr 2004 13:23:55 -0000 1.2
@@ -0,0 +1,80 @@
+//==========================================================================
+//
+// devs/eth/sh/dreamcast/include/devs_eth_sh_dreamcast_rltk8139.inl
+//
+// SEGA Dreamcast Broadband Adapter I/O definitions.
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// 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
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): Yoshinori Sato
+// Contributors:
+// Date: 2004-04-22
+// Purpose: SEGA Dreamcast Broadband Adapter definitions
+//####DESCRIPTIONEND####
+//==========================================================================
+
+#ifdef CYGPKG_DEVS_ETH_SH_DREAMCAST_RLTK8139_ETH0
+
+static Rltk8139_t rltk8139_eth0_priv_data = {
+ 0, 0, 0
+};
+
+ETH_DRV_SC(rltk8139_sc0,
+ &rltk8139_eth0_priv_data,
+ CYGDAT_DEVS_ETH_SH_DREAMCAST_RLTK8139_ETH0_NAME,
+ rltk8139_start,
+ rltk8139_stop,
+ rltk8139_control,
+ rltk8139_can_send,
+ rltk8139_send,
+ rltk8139_recv,
+ rltk8139_deliver,
+ rltk8139_poll,
+ rltk8139_int_vector
+ );
+
+NETDEVTAB_ENTRY(rltk8139_netdev0,
+ "rltk8139_" CYGDAT_DEVS_ETH_SH_DREAMCAST_RLTK8139_ETH0_NAME,
+ rltk8139_init,
+ &rltk8139_sc0);
+
+void dreamcast_bba_init(struct eth_drv_sc *sc);
+#define CYGHWR_RLTK_8139_PLF_INIT(sc) dreamcast_bba_init(sc);
+
+#endif // CYGPKG_DEVS_ETH_SH_DREAMCAST_RLTK8139_ETH0
+
+// EOF devs_eth_sh_dreamcast_rltk8139.inl
Index: devs/eth/sh/dreamcast/current/src/if_dreamcast.c
===================================================================
RCS file: devs/eth/sh/dreamcast/current/src/if_dreamcast.c
diff -N devs/eth/sh/dreamcast/current/src/if_dreamcast.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ devs/eth/sh/dreamcast/current/src/if_dreamcast.c 22 Apr 2004 13:23:55 -0000 1.2
@@ -0,0 +1,91 @@
+//==========================================================================
+//
+// devs/eth/sh/dreamcast/src/devs_eth_sh_dreamcast_rltk8139.c
+//
+// Dreamcast Broadband Adapter initialize functions.
+//
+//==========================================================================
+//####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
+//
+// 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
+// Software Foundation; either version 2 or (at your option) any later version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
+// WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with eCos; if not, write to the Free Software Foundation, Inc.,
+// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+//
+// As a special exception, if other files instantiate templates or use macros
+// or inline functions from this file, or you compile this file and link it
+// with other works to produce a work based on this file, this file does not
+// by itself cause the resulting work to be covered by the GNU General Public
+// License. However the source code for this file must still be made available
+// in accordance with section (3) of the GNU General Public License.
+//
+// This exception does not invalidate any other reasons why a work based on
+// this file might be covered by the GNU General Public License.
+//
+// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
+// at http://sources.redhat.com/ecos/ecos-license/
+// -------------------------------------------
+//####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): Yoshiori Sato
+// Contributors:
+// Date: 2004-04-21
+// Purpose: dreamcast BbA initialize functions
+//####DESCRIPTIONEND####
+//==========================================================================
+
+#include <cyg/infra/cyg_type.h>
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/drv_api.h>
+#include <cyg/io/eth/eth_drv.h>
+#include <cyg/io/pci.h>
+#include <cyg/infra/diag.h>
+
+#include <cyg/devs/eth/src/if_8139.h>
+
+/* DMA BASE address */
+#define GAPSPCI_DMA_BASE 0x01840000
+#define GAPSPCI_DMA_SIZE 32768
+#define BBA_BASE 0x01001700
+
+#define P2BASE 0xa0000000
+
+static cyg_uint32 gapspci_dma_alloc(int size)
+{
+ static cyg_uint32 top = GAPSPCI_DMA_BASE;
+ cyg_uint32 r;
+ if ((GAPSPCI_DMA_SIZE - (top - GAPSPCI_DMA_BASE)) < size)
+ r = 0;
+ else {
+ r = top;
+ top += size;
+ }
+ return r;
+}
+
+void dreamcast_bba_init(struct eth_drv_sc *sc)
+{
+ Rltk8139_t *rltk8139_info = (Rltk8139_t *)(sc->driver_private);
+ int i;
+
+ rltk8139_info->base_address = (BBA_BASE | P2BASE);
+
+ rltk8139_info->tx_buffer = (cyg_uint8 *)(gapspci_dma_alloc(TX_BUF_TOT_LEN) | P2BASE);
+ rltk8139_info->rx_ring = (cyg_uint8 *)(gapspci_dma_alloc(RX_BUF_TOT_LEN) | P2BASE);
+
+ for (i = 0; i < 6; ++i)
+ HAL_READ_UINT8(rltk8139_info->base_address + IDR0 + i, rltk8139_info->mac[i]);
+}