This is the mail archive of the
ecos-patches@sources.redhat.com
mailing list for the eCos project.
Simple RTL8019 (NE2000 compatible) patch
- From: Iztok Zupet <iz at vsr dot si>
- To: ecos-patches at sources dot redhat dot com
- Date: Sat, 6 Jul 2002 18:26:01 +0200
- Subject: Simple RTL8019 (NE2000 compatible) patch
- Organization: VSR d.o.o.
- Reply-to: iz at vsr dot si
This is rather a hack and not a patch but it works fine and it's usefull. The
download and some instructions are also available at
<http://www.vsr.si/ecos/patches>.
Regards
iz
diff -C2 -N -P -r -x '.*' /ecoscvs/orig/ecos/packages/ChangeLog ./ChangeLog
*** /ecoscvs/orig/ecos/packages/ChangeLog Fri Jun 21 01:11:09 2002
--- ./ChangeLog Sat Jul 6 13:00:20 2002
***************
*** 1,2 ****
--- 1,7 ----
+ 2002-07-06 Iztok Zupet <iz@vsr.si>
+
+ * ecos.db: Add RTL8019 PC ethernet driver support,
+ esentially a NE2000 clone (CYGPKG_DEVS_ETH_RTL8019)
+
2002-06-20 Gary Thomas <gary@chez-thomas.org>
diff -C2 -N -P -r -x '.*' /ecoscvs/orig/ecos/packages/devs/eth/i386/pc/rtl8019/current/ChangeLog ./devs/eth/i386/pc/rtl8019/current/ChangeLog
*** /ecoscvs/orig/ecos/packages/devs/eth/i386/pc/rtl8019/current/ChangeLog Thu Jan 1 01:00:00 1970
--- ./devs/eth/i386/pc/rtl8019/current/ChangeLog Sat Jul 6 11:42:43 2002
***************
*** 0 ****
--- 1,43 ----
+ 2002-07-06 Iztok Zupet <iz@vsr.si>
+
+ * src/if_pc_RTL8019.c: include from cyg/io/eth/*.h to be
+ in accordance vith current CVS repository
+
+ 2001-09-05 Iztok Zupet <iz@vsr.si>
+
+ * all: Initial version.
+
+ //===========================================================================
+ //####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####
+ //===========================================================================
diff -C2 -N -P -r -x '.*' /ecoscvs/orig/ecos/packages/devs/eth/i386/pc/rtl8019/current/cdl/pc_eth_RTL8019.cdl ./devs/eth/i386/pc/rtl8019/current/cdl/pc_eth_RTL8019.cdl
*** /ecoscvs/orig/ecos/packages/devs/eth/i386/pc/rtl8019/current/cdl/pc_eth_RTL8019.cdl Thu Jan 1 01:00:00 1970
--- ./devs/eth/i386/pc/rtl8019/current/cdl/pc_eth_RTL8019.cdl Sat Jul 6 11:34:21 2002
***************
*** 0 ****
--- 1,145 ----
+ # ====================================================================
+ #
+ # pc_eth_RTL8019.cdl
+ #
+ # Ethernet drivers - device support for RTL8019AS
+ # Realtek NE2000 compatible 10-baseT chip
+ #
+ # ====================================================================
+ #####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): iz
+ # Contributors:
+ # Date: 2001-09-05
+ #
+ #####DESCRIPTIONEND####
+ #
+ # ====================================================================
+
+ cdl_package CYGPKG_DEVS_ETH_RTL8019 {
+ display "PC RTL8019 ethernet driver"
+
+ parent CYGPKG_IO_ETH_DRIVERS
+ active_if CYGPKG_IO_ETH_DRIVERS
+ requires CYGPKG_DEVS_ETH_NS_DP83902A
+
+ implements CYGHWR_NET_DRIVERS
+ implements CYGHWR_NET_DRIVER_ETH0
+ include_dir cyg/io
+ description "Ethernet driver for various RTL8019 16 or 8 bit boards."
+ compile -library=libextras.a if_pc_RTL8019.c
+
+ # FIXME: This really belongs in the NS DP83902A package
+ cdl_interface CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED {
+ display "NS DP83902A ethernet driver required"
+ }
+
+ define_proc {
+ puts $::cdl_system_header "/***** ethernet driver proc output start *****/"
+ puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_INL <cyg/io/devs_eth_RTL8019.inl>"
+ puts $::cdl_system_header "#define CYGDAT_DEVS_ETH_NS_DP83902A_CFG <pkgconf/devs_eth_rtl8019.h>"
+ puts $::cdl_system_header "/***** ethernet driver proc output end *****/"
+ }
+
+ cdl_component CYGPKG_DEVS_ETH_RTL8019_ETH0 {
+ display "RTL8019 ethernet port driver"
+ flavor bool
+ default_value 1
+ description "
+ This option includes the ethernet device driver for a
+ RTL8019AS chip"
+
+ implements CYGINT_DEVS_ETH_NS_DP83902A_REQUIRED
+
+ cdl_option CYGDAT_DEVS_ETH_RTL8019_ETH0_NAME {
+ display "Device name for the ETH0 ethernet driver"
+ flavor data
+ default_value {"\"eth0\""}
+ description "
+ This option sets the name of the ethernet device."
+ }
+
+ cdl_component CYGSEM_DEVS_ETH_RTL8019_ETH0_SET_DEFINES {
+ display "Set the ethernet station address..."
+ flavor bool
+ default_value 1
+ description "Defines the RTL8019 instalation options such as
+ port address, IRQ line and MAC address."
+
+ cdl_option CYGDAT_DEVS_ETH_RTL8019_ETH0_ESA {
+ display "The ethernet station address"
+ flavor data
+ default_value {"{0x08, 0x88, 0x12, 0x34, 0x56, 0x78}"}
+ description "The ethernet station address"
+ }
+ cdl_option CYGNUM_DEVS_ETH_RTL8019_ETH0_BASE_PORT {
+ display "Base port adreess of RTL8019"
+ flavor data
+ default_value 0x300
+ }
+ cdl_option CYGNUM_DEVS_ETH_RTL8019_ETH0_IRQ {
+ display "RTL8019 IRQ line"
+ flavor data
+ default_value 5
+ }
+ cdl_option CYGNUM_DEVS_ETH_RTL8019_ETH0_VECTOR {
+ display "RTL8091 interrupt vector"
+ flavor data
+ calculated CYGNUM_DEVS_ETH_RTL8019_ETH0_IRQ+32
+ }
+ }
+
+ }
+
+ cdl_component CYGPKG_DEVS_ETH_RTL8019_OPTIONS {
+ display "RTL8019 ethernet driver build options"
+ flavor none
+ no_define
+
+ cdl_option CYGPKG_DEVS_ETH_RTL8019_CFLAGS_ADD {
+ display "Additional compiler flags"
+ flavor data
+ no_define
+ default_value { "-D_KERNEL -D__ECOS" }
+ description "
+ This option modifies the set of compiler flags for
+ building the RTL8019 ethernet driver package.
+ These flags are used in addition
+ to the set of global flags."
+ }
+ }
+ }
+
diff -C2 -N -P -r -x '.*' /ecoscvs/orig/ecos/packages/devs/eth/i386/pc/rtl8019/current/include/devs_eth_RTL8019.inl ./devs/eth/i386/pc/rtl8019/current/include/devs_eth_RTL8019.inl
*** /ecoscvs/orig/ecos/packages/devs/eth/i386/pc/rtl8019/current/include/devs_eth_RTL8019.inl Thu Jan 1 01:00:00 1970
--- ./devs/eth/i386/pc/rtl8019/current/include/devs_eth_RTL8019.inl Sat Jul 6 12:08:26 2002
***************
*** 0 ****
--- 1,101 ----
+ //==========================================================================
+ //
+ // devs_eth_RTL8019.inl
+ //
+ // RTL8019 (NE2000 clone) ethernet 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): iz,jskov
+ // Contributors:jskov
+ // Date: 2001-09-05
+ // Purpose: RTL8019(NE2000 clone) ethernet defintions
+ //
+ //####DESCRIPTIONEND####
+ //==========================================================================
+
+ #include <cyg/hal/hal_intr.h> // CYGNUM_HAL_INTERRUPT_ETHR
+ #include <cyg/hal/hal_if.h>
+ #include <cyg/infra/cyg_type.h>
+
+ #ifdef __WANT_CONFIG
+ // Should define this if RTL8019AS is 16 bit wired
+ //#define CYGHWR_NS_DP83902A_PLF_16BIT_DATA
+ #endif // __WANT_CONFIG
+
+ #ifdef __WANT_DEVS
+
+ externC int cyg_rtl8019_int_vector(struct eth_drv_sc *sc);
+ externC bool cyg_rtl8019_init(struct cyg_netdevtab_entry *tab);
+
+ #ifdef CYGPKG_DEVS_ETH_RTL8019_ETH0
+
+ static dp83902a_priv_data_t dp83902a_eth0_priv_data = {
+ tx_buf1: 0x40,
+ tx_buf2: 0x48,
+ rx_buf_start: 0x50,
+ rx_buf_end: 0x80,
+ #ifdef CYGSEM_DEVS_ETH_RTL8019_ETH0_SET_ESA
+ esa : CYGDAT_DEVS_ETH_RTL8019_ETH0_ESA,
+ hardwired_esa : true,
+ #else
+ hardwired_esa : false,
+ #endif
+ };
+
+ ETH_DRV_SC(dp83902a_sc,
+ &dp83902a_eth0_priv_data, // Driver specific data
+ CYGDAT_DEVS_ETH_RTL8019_ETH0_NAME,
+ dp83902a_start,
+ dp83902a_stop,
+ dp83902a_control,
+ dp83902a_can_send,
+ dp83902a_send,
+ dp83902a_recv,
+ dp83902a_deliver, // "pseudoDSR" called from fast net thread
+ dp83902a_poll, // poll function, encapsulates ISR and DSR
+ cyg_rtl8019_int_vector);
+
+ NETDEVTAB_ENTRY(dp83902a_netdev,
+ "dp83902a_" CYGDAT_DEVS_ETH_RTL8019_ETH0_NAME,
+ cyg_rtl8019_init,
+ &dp83902a_sc);
+ #endif // CYGPKG_DEVS_ETH_RTL8019_ETH0
+
+ #endif // __WANT_DEVS
+
+ // EOF devs_eth_RTL8019.inl
diff -C2 -N -P -r -x '.*' /ecoscvs/orig/ecos/packages/devs/eth/i386/pc/rtl8019/current/src/if_pc_RTL8019.c ./devs/eth/i386/pc/rtl8019/current/src/if_pc_RTL8019.c
*** /ecoscvs/orig/ecos/packages/devs/eth/i386/pc/rtl8019/current/src/if_pc_RTL8019.c Thu Jan 1 01:00:00 1970
--- ./devs/eth/i386/pc/rtl8019/current/src/if_pc_RTL8019.c Sat Jul 6 12:12:13 2002
***************
*** 0 ****
--- 1,156 ----
+ //==========================================================================
+ //
+ // dev/if_pc_RTL8019.c
+ //
+ // Ethernet device driver hack for RTL8019 or a NE2000 clone
+ //
+ //==========================================================================
+ //####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####
+ //####BSDCOPYRIGHTBEGIN####
+ //
+ // -------------------------------------------
+ //
+ // Portions of this software may have been derived from OpenBSD or other sources,
+ // and are covered by the appropriate copyright disclaimers included herein.
+ //
+ // -------------------------------------------
+ //
+ //####BSDCOPYRIGHTEND####
+ //==========================================================================
+ //#####DESCRIPTIONBEGIN####
+ //
+ // Author(s): iz
+ // Contributors:
+ // Date: 2001-09-05
+ // Purpose:
+ // Description: hardware driver (hack) for RTL8019AS or NE2000 clone ethernet
+ //
+ //
+ //####DESCRIPTIONEND####
+ //
+ //==========================================================================
+
+ #include <pkgconf/system.h>
+ #include <cyg/infra/cyg_type.h>
+ #include <cyg/hal/hal_arch.h>
+ #include <cyg/infra/diag.h>
+ #include <cyg/hal/drv_api.h>
+ #include <cyg/io/eth/eth_drv.h>
+ #include <cyg/io/eth/netdev.h>
+
+ #ifdef CYGPKG_NET
+ #include <pkgconf/net.h>
+ #else
+ #include <cyg/hal/hal_if.h>
+ #endif
+
+ #include <cyg/io/dp83902a.h>
+
+ #define DP_DATA 0x10
+ #define DP_CARD_RESET 0x1f
+
+ #define SC_LPE_MANUF 0x0104
+
+
+
+ #ifdef CYGPKG_NET
+ #define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL
+ static char sc_lpe_card_handler_stack[STACK_SIZE];
+ static cyg_thread sc_lpe_card_handler_thread_data;
+ static cyg_handle_t sc_lpe_card_handler_thread_handle;
+ #endif // CYGPKG_NET
+
+ static void
+ do_delay(int ticks)
+ {
+ #ifdef CYGPKG_KERNEL
+ cyg_thread_delay(ticks);
+ #else
+ CYGACC_CALL_IF_DELAY_US(10000*ticks);
+ #endif
+ }
+
+ static int
+ sc_rtl8019_card_handler(cyg_addrword_t param)
+ {
+ // To be done : Handle the RTL8019 ISA PnP interface,
+ // to setup/determine the IO and IRQ
+
+ struct eth_drv_sc *sc = (struct eth_drv_sc *)param;
+ dp83902a_priv_data_t *dp = (dp83902a_priv_data_t*)sc->driver_private;
+ int i;
+ cyg_uint8* base;
+ unsigned char tmp;
+ unsigned char sc_lpe_addr[] = CYGDAT_DEVS_ETH_RTL8019_ETH0_ESA ;
+ // Initialize dp83902a IO details
+ dp->base = base = CYGNUM_DEVS_ETH_RTL8019_ETH0_BASE_PORT;
+ dp->data = base + DP_DATA;
+ dp->interrupt = CYGNUM_DEVS_ETH_RTL8019_ETH0_VECTOR;
+ // Reset chip/card (read issues RESET, write clears it)
+ HAL_READ_UINT8(base+DP_CARD_RESET, tmp);
+ HAL_WRITE_UINT8(base+DP_CARD_RESET, tmp);
+ // Wait for chip/card
+ do {
+ DP_IN(base, DP_ISR, tmp);
+ }
+ while (0 == (tmp & DP_ISR_RESET));
+
+ // To be done : Fetch hardware address from RTL8019 I2C eeprom
+ for (i = 0; i < 6; i++) {
+ dp->esa[i] = sc_lpe_addr[i];
+ }
+
+ // Initialize upper level driver
+ (sc->funs->eth_drv->init)(sc, dp->esa);
+ // Tell system card is ready to talk
+ dp->tab->status = CYG_NETDEVTAB_STATUS_AVAIL;
+ cyg_drv_dsr_unlock();
+ return true;
+ }
+
+ bool
+ cyg_rtl8019_init(struct cyg_netdevtab_entry *tab)
+ {
+ struct eth_drv_sc *sc = (struct eth_drv_sc *)tab->device_instance;
+ dp83902a_priv_data_t *dp = (dp83902a_priv_data_t *)sc->driver_private;
+
+ // Initialize card
+ return sc_rtl8019_card_handler((cyg_addrword_t)sc);
+ }
+
+ int
+ cyg_rtl8019_int_vector(struct eth_drv_sc *sc)
+ {
+ return CYGNUM_DEVS_ETH_RTL8019_ETH0_VECTOR;
+ }
diff -C2 -N -P -r -x '.*' /ecoscvs/orig/ecos/packages/ecos.db ./ecos.db
*** /ecoscvs/orig/ecos/packages/ecos.db Fri Jun 21 01:11:12 2002
--- ./ecos.db Sat Jul 6 12:56:23 2002
***************
*** 1244,1247 ****
--- 1244,1257 ----
}
+ package CYGPKG_DEVS_ETH_RTL8019 {
+ alias { "Standard PC with Realtek RTL8019 ethernet device"
+ devs_eth_i386_pc_rtl8019 pc_rtl8019 }
+ hardware
+ directory devs/eth/i386/pc/rtl8019
+ script pc_eth_RTL8019.cdl
+ description "Ethernet driver for standard PC with Realtek RTL8019. This is
+ essentially support for an NE2000 clone."
+ }
+
package CYGPKG_DEVS_ETH_I386_PC_I82544 {
alias { "Standard PC with Intel Gigabit ethernet device"