# HG changeset patch # User jlarmour # Date 1083211886 0 # Node ID 72d9b04de01a9c0bc8264cf24090cb7346b19884 # Parent 003a3db955cdb05776ffc5f468f68b552fd73f9e * 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. diff --git a/packages/devs/eth/sh/dreamcast/current/ChangeLog b/packages/devs/eth/sh/dreamcast/current/ChangeLog new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/dreamcast/current/ChangeLog @@ -0,0 +1,38 @@ +2004-04-21 Yoshinori Sato + + * 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) 2004 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. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//=========================================================================== diff --git a/packages/devs/eth/sh/dreamcast/current/cdl/sh_dreamcast_rltk8139_eth_drivers.cdl b/packages/devs/eth/sh/dreamcast/current/cdl/sh_dreamcast_rltk8139_eth_drivers.cdl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/dreamcast/current/cdl/sh_dreamcast_rltk8139_eth_drivers.cdl @@ -0,0 +1,91 @@ +# ==================================================================== +# +# 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) 2004 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. +## ------------------------------------------- +#####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 " + puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_RLTK_8139_CFG " + 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." + } + } +} + +# EOF sh_dreamcast_rltk8139_eth_drivers.cdl diff --git a/packages/devs/eth/sh/dreamcast/current/include/devs_eth_sh_dreamcast_rltk8139.inl b/packages/devs/eth/sh/dreamcast/current/include/devs_eth_sh_dreamcast_rltk8139.inl new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/dreamcast/current/include/devs_eth_sh_dreamcast_rltk8139.inl @@ -0,0 +1,77 @@ +//========================================================================== +// +// 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) 2004 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. +// ------------------------------------------- +//####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 diff --git a/packages/devs/eth/sh/dreamcast/current/src/if_dreamcast.c b/packages/devs/eth/sh/dreamcast/current/src/if_dreamcast.c new file mode 100644 --- /dev/null +++ b/packages/devs/eth/sh/dreamcast/current/src/if_dreamcast.c @@ -0,0 +1,90 @@ +//========================================================================== +// +// 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) 2004 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. +// ------------------------------------------- +//####ECOSGPLCOPYRIGHTEND#### +//========================================================================== +//#####DESCRIPTIONBEGIN#### +// +// Author(s): Yoshiori Sato +// Contributors: +// Date: 2004-04-21 +// Purpose: dreamcast BbA initialize functions +//####DESCRIPTIONEND#### +//========================================================================== + +#include +#include +#include +#include +#include +#include + +#include + +/* 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]); +} + +// EOF if_dreamcast.c