**
**
**  VIA Rhine Family Fast Ethernet Adapter
**
**  Ethernet Downloader/Debugger package for Windows CE 5.0
**
**  v1.02   Jun, 2004
**
**


Introduction:
=============

  This document shows you how to enables VIA Rhine Family Fast Ethernet Adapter
  to be adopted as a download/debug card for WINCE platform builder 5.0.


Contents of the Subdirectory:
=============================

    \DEBUG\FETDBG.LIB             fetdbg library debug version
    \DEBUG\FETDBG.PDB             fetdbg library debug pdb file
    \RETAIL\FETDBG.LIB            fetdbg library retail version
    \RETAIL\FETDBG.PDB            fetdbg library retail pdb file
    SOURCES                       sample SOURCES File
    OAL_ETHDRV.H                  sample OAL Header File
    KITLDRV.C                     sample KITL Source Code
    MAKEFILE                      sample MAKEFILE File
    HALETHER.H                    sample HAL Header File
    EBOOT.BIN                     ethernet boot loader file
    LOADCEPC.EXE                  Windows CE boot loader 
    FETDBG.TXT                    this file


Installation:
=============

  Assume your target platform is equipped with 
  VIA Rhine Family Fast Ethernet Adapter, the platform is "CEPC:X86".
  Installation and test instructions are described below.


  1. Copy binary library files

    (1) Retail build:
       Copy the following files to directory
       \WINCE500\public\common\oak\LIB\X86\RETAIL

            \Retail\fetdbg.lib
            \Retail\fetdbg.pdb

    (2) Debug build:
       Copy the following files to directory
       \WINCE500\public\common\oak\LIB\X86\DEBUG

            \Debug\fetdbg.lib
            \Debug\fetdbg.pdb


  2. Modify oal_ethdrv.h

    Locate the "oal_ethdrv.h" file in directory \WINCE5000\PLATFORM\COMMON\SRC\INC
    and add the following lines below into "#ifndef _HALETHER_H_" section:
     
       //------------------------------------------------------------------------------
       // Prototypes for VIA FET

       BOOL   FETInitDMABuffer(UINT32 address, UINT32 size);
       BOOL   FETInit(UINT8 *pAddress, UINT32 offset, UINT16 mac[3]);
       UINT16 FETSendFrame(UINT8 *pData, UINT32 length);
       UINT16 FETGetFrame(UINT8 *pData, UINT16 *pLength);
       VOID   FETEnableInts();
       VOID   FETDisableInts();
       VOID   FETCurrentPacketFilter(UINT32 filter);
       BOOL   FETMulticastList(UINT8 *pAddresses, UINT32 count);

       #define OAL_ETHDRV_FET      { \
           FETInit, FETInitDMABuffer, NULL, FETSendFrame, FETGetFrame, \
           FETEnableInts, FETDisableInts, \
           NULL, NULL, FETCurrentPacketFilter, FETMulticastList \
       }

    Also add the following lines below into "#else // _HALETHER_H" section:

       #define OAL_ETHDRV_FET      { \
           (OAL_KITLETH_INIT)FETInit, \
           (OAL_KITLETH_INIT_DMABUFFER)FETInitDMABuffer, \
           NULL, \
           (OAL_KITLETH_SEND_FRAME)FETSendFrame, \
           FETGetFrame, \
           FETEnableInts, \
           FETDisableInts, \
           NULL, \
           NULL, \
           (OAL_KITLETH_CURRENT_PACKET_FILTER)FETCurrentPacketFilter, \
           (OAL_KITLETH_MULTICAST_LIST)FETMulticastList \
       }

    Sample "oal_ethdrv.h" file is included for your reference.


  3. Modify kitldrv.c

    Locate the "kitldrv.c" file in directory \WINCE5000\PLATFORM\COMMON\SRC\X86\COMMON\KITL
    and add the following line:

       static OAL_KITL_ETH_DRIVER DrvFET   = OAL_ETHDRV_FET;        // VIA FET

    Also add the following lines below into "g_NicSupported" structure:

       {0x1106, 0x3065, 0xABCDEF, EDBG_ADAPTER_FET,     "VT", &DrvFET   }, /* VIA */\
       {0x1106, 0x3106, 0xABCDEF, EDBG_ADAPTER_FET,     "VT", &DrvFET   }, /* VIA */\
       {0x1106, 0x3053, 0xABCDEF, EDBG_ADAPTER_FET,     "VT", &DrvFET   }, /* VIA */\

    Sample "kitldrv.c" file is included for your reference.


  4. Modify halether.h

    Locate the halether.h file in directory \WINCE500\public\common\oak\INC
    and add the following lines:

       #define EDBG_ADAPTER_FET   65

       // Prototypes for FETDBG.LIB functions
       BOOL   FETInitDMABuffer(DWORD dwStartAddress, DWORD dwSize);
       BOOL   FETInit( BYTE *pbBaseAddress, DWORD dwMultiplier, USHORT MacAddr[3]);
       void   FETEnableInts(void);
       void   FETDisableInts(void);
       DWORD  FETGetPendingInts(void);
       UINT16 FETGetFrame( BYTE *pbData, UINT16 *pwLength );
       UINT16 FETSendFrame( BYTE *pbData, DWORD dwLength );
       BOOL   FETReadEEPROM( UINT16 EEPROMAddress, UINT16 *pwVal);
       BOOL   FETWriteEEPROM( UINT16 EEPROMAddress, UINT16 Data );
       DWORD  FETSetOptions(DWORD dwOptions);
       void   FETCurrentPacketFilter(DWORD	dwFilter);
       BOOL   FETMulticastList(PUCHAR pucMulticastAddresses, DWORD dwNoOfAddresses);

    Also add the following lines into the SUPPORTED_COMMON_NIC #define section:

       {0x1106, 0x3065, 0xABCDEF, EDBG_ADAPTER_FET,     "VT" }, /* VIA */\
       {0x1106, 0x3106, 0xABCDEF, EDBG_ADAPTER_FET,     "VT" }, /* VIA */\
       {0x1106, 0x3053, 0xABCDEF, EDBG_ADAPTER_FET,     "VT" }, /* VIA */\

    Sample "halether.h" file is included for your reference.


  5. Modify KERNEL SOURCES

    Locate the "Sources" file respectively in directories
       \WINCE500\PLATFORM\CEPC\SRC\KERNEL\KERNKITL
       \WINCE500\PLATFORM\CEPC\SRC\KERNEL\KERNKITLPROF

    and add one extra line below for the TARGETLIBS environment variable:

       $(_COMMONOAKROOT)\lib\$(_CPUDEPPATH)\fetdbg.lib  \

    Sample "sources" file is included for your reference.


  6. Modify MAKEFILE file

    Locate the MAKEFILE file in directory \WINCE500\public\common\CESYSGEN
    and add "fetdbg" for the tools and httpftp segments.

    Sample "MAKEFILE" file is included for your reference.


  7. Build CEPC platform

    Choose "Sysgen" from the "Build OS" menu to make a new OS image.


  8. Basic testing

    A file named EBOOT.BIN is included in this package. Copy this file to your boot disk.

    If you need to specify IRQ or IOPORT for ethernet debug card, a setup utility is 
    included in this package. Run this setup utility on your target platform to check 
    the IRQ and IOPORT assignments of the card.

    Then run loadcepc.exe to download the OS image.

    Usage,
       loadcepc /e:<IOPORT in HEX>:<IRQ in hex>:[<dotted IP address, optional>] eboot.bin

    Where <IOPORT> and <IRQ> could be found by the setup utility.

    Typical examples,
        In case of static IP assignment,
           loadcepc /e:E000:B:192.168.1.123 eboot.bin 
    
        In case of IP assignment through DHCP,         
            loadcepc /e:E000:B eboot.bin


  9. IDE platform builder ethernet download/debug settings

    In order to configure a connection for downloading and debugging, choose
    "Connectivity Options" from the Target menu to select the device name to be 
    used for image downloading and debugging.

