bjab
驱动牛犊
驱动牛犊
  • 注册日期2002-04-06
  • 最后登录2011-06-07
  • 粉丝0
  • 关注0
  • 积分12分
  • 威望35点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
阅读:1754回复:10

谁有DOS下NE2000的驱动原码?

楼主#
更多 发布于:2002-10-16 17:56
谢谢
silan
驱动小牛
驱动小牛
  • 注册日期2002-02-04
  • 最后登录2004-03-22
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2002-11-04 14:26
我也在找这个,这方面的东东简直就是古董的的平方,太难找了!!!找到了可别忘了兄弟我啊,email:zhangba@cmmail.com,你也给我一个email吧,互相帮助。
/***************************/ 认认真真学好三个代表,踏踏实实做好无产阶级接班人。 /***************************/
gz818
驱动小牛
驱动小牛
  • 注册日期2002-02-26
  • 最后登录2008-11-15
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望22点
  • 贡献值0点
  • 好评度21点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-11-05 12:22
知道这个是不是,在google上一查就有,是源码,我粗看了一下!
如果是请给分!
Windows for Workgroups v3.11 and DIS_PKT9.DOS

Joe R. Doupnik
jrd@cc.usu.edu
Utah State University
 3 Feb 1994

Windows for Workgroups v3.11 introduces major changes to the
network support material. If you wish to use a Packet Driver program,
such as MS-DOS Kermit or one of the winsock DLLs, while within WFW then
two supporting shims will be need to be loaded before WFW starts. There
are at least two situations to consider and different shims are involved.

Situation 1: WFW runs over a lan adapter dedicated to WFW.
-----------
This is the case we explore in detail below. The two shims needed
are DIS_PKT9.DOS and WINPKT.COM, both available by anonymous ftp from
netlab2.usu.edu [129.123.1.44] in directory \\anonftp\\drivers and from
sites carrying the Crynwr Collection of Packet Drivers. The important
points are that a version 2 NDIS driver is required, not the newer
version 3 32-bit protected mode NDIS kind, and that small edits will
be needed to WFW text files protocol.ini and system.ini.

Situation 2: WFW runs over a Novell ODI handler.
------------
The two shims needed are ODIPKT.COM and WINPKT.COM, both available
from netlab2 above. Both are installed independently of WFW and no changes
to WFW are needed. Dis_pkt9 will not run in this environment because no
NDIS v2 interface is provided by WFW when using ODI. Instead ODIPKT
provides the Packet Driver interface on the top of ODI.

Situation other: WFW runs over another network\'s handler.
----------------
We can\'t say much because the environment is not known to us.
The general guidlines about NDIS v2 support still apply.


Please notice that we deal only with dis_pkt9.dos and winpkt.com.
If you have another variation of dis_pkt you will need to contact the
persons responsible for your variation. Similarly, people have circulated
modified copies of winpkt without source code or external identifying
markings. The winpkt referred to here uses two command line arguments and
the entire package is bundled in winpkt.zip as source code, doc,
and executable. Both are available from netlab2 as cited above. If in doubt
get these.
ODIPKT prime site is hsdndev.harvard.edu, and Dan Lanciani
ddl@harvard.edu, is the author and responsible person. Please contact
him on details of using ODIPKT.


Steps to follow after installing network support in WFW v3.11. This
presumes that WFW owns the network adapter (Situation 1 above).

1. Ensure that both PROTMAN.EXE and PROTMAN.DOS are in the WFW directory.
   You may have to uncompress them from the WFW distribution media. Copy
   files dis_pkt9.dos and winpkt.com there too.

2. Edit protocol.ini to insert the [pktdrv] section as shown below.
   Changes to the intvec= and novell= lines are permitted. An NE2000
   NDIS v2 board driver, MS$NE2000, is used in this example.

[pktdrv]
DriverName=PKTDRV$
bindings=MS$NE2000
intvec=0x63
novell=no

3. Edit system.ini [network drivers] section to add \",dis_pkt9.dos\" to the
   transport= line, and to ensure a NDIS v2 netcard= driver has been given.
   Please do not confuse this transport= line with a similar one in the
   [enhanced] section; the [enhanced] section refers to 32 bit protected
   mode material. An NE2000 board is used in this example.

[network drivers]
devdir=C:\\WFW
LoadRMDrivers=Yes
transport=ndishlp.sys,*netbeui,dis_pkt9.dos
netcard=ne2000.dos

4. Before starting Windows issue DOS commands (once only)

NET START
WINPKT \\x060 0x63 (example interrupts)

   The first command energizes the NDIS v2 handlers, and the dis_pkt9
   banner should be displayed ending with the Ethernet address of your
   board. NET.EXE is in the WFW directory; also see next paragraph.
   The second command starts Windows helper shim winpkt, and that needs
   the Packet Driver (dis_pkt9) active beforehand.
  
   A comment on the line \"LoadRMDrivers=Yes.\" NET START reads file
   system.ini to obtain loading information, and the answer \"Yes\"
   tells it to run protman.exe which loads the drivers with protocol.ini
   supplying details. If the answer were \"No\" then the real mode drivers
   would not be loaded or available. However, if \"No\" were stated then we
   could give command NET START NETBIND to run protman.exe and achieve the
   same results as the \"Yes\" case.


Sample WFW 3.11 Protocol.ini file using an NE2000 Ethernet board -
----------------------------------------------------------------

[network.setup]
version=0x3110
netcard=ms$ne2000,1,MS$NE2000,3
transport=ms$ndishlp,MS$NDISHLP
transport=ms$netbeui,NETBEUI
lana0=ms$ne2000,1,ms$ndishlp
lana1=ms$ne2000,1,ms$netbeui

[protman]
DriverName=PROTMAN$
PRIORITY=MS$NDISHLP

[MS$NDISHLP]
DriverName=ndishlp$
BINDINGS=MS$NE2000

[NETBEUI]
DriverName=netbeui$
SESSIONS=10
NCBS=12
BINDINGS=MS$NE2000
LANABASE=0

[pktdrv] (dis_pkt9 section, use as shown)
DriverName=PKTDRV$ (spelling must be correct here)
bindings=MS$NE2000 (use board driver section name)
intvec=0x63 (Packet Driver interrupt to use)
novell=no (use novell=y if Ethernet_802.3)

[MS$NE2000] (NDIS v2 board driver section)
DriverName=MS2000$
INTERRUPT=5
IOBASE=0x360

[NE2000]
Adapters=MS$NE2000



Section from WFW 3.11 system.ini file -
-------------------------------------

[network drivers] (You need to edit this section)
devdir=C:\\WFW
LoadRMDrivers=Yes
transport=ndishlp.sys,*netbeui,dis_pkt9.dos
netcard=ne2000.dos            ^^^^^^^^^^^^^--+
^^^^^^^^^^^^^^^^^^     |
|     |
ensure a netcard= line like this     |- add this by hand
exists right here. It chooses the
NDIS v2 level board driver.

(end of document)

antspower
驱动中牛
驱动中牛
  • 注册日期2002-10-17
  • 最后登录2010-08-03
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值2点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地板#
发布于:2002-11-05 17:50
联系我:
QQ 34138008
mail: huguozhong@hotmail.com
 :)
放弃瘟草,现吃李草
silan
驱动小牛
驱动小牛
  • 注册日期2002-02-04
  • 最后登录2004-03-22
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2002-11-08 16:31
我们要的是驱动程序的源程序代码,不是上面那些
/***************************/ 认认真真学好三个代表,踏踏实实做好无产阶级接班人。 /***************************/
gz818
驱动小牛
驱动小牛
  • 注册日期2002-02-26
  • 最后登录2008-11-15
  • 粉丝0
  • 关注0
  • 积分3分
  • 威望22点
  • 贡献值0点
  • 好评度21点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2002-11-08 18:01
自己去下载!
解包后有全部的源程序!
请看一下再下结论!
silan
驱动小牛
驱动小牛
  • 注册日期2002-02-04
  • 最后登录2004-03-22
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2002-11-09 19:18
ftp不可以匿名登陆,http上只有pktdrv和odi驱动,太可惜
/***************************/ 认认真真学好三个代表,踏踏实实做好无产阶级接班人。 /***************************/
antspower
驱动中牛
驱动中牛
  • 注册日期2002-10-17
  • 最后登录2010-08-03
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值2点
  • 好评度0点
  • 原创分0分
  • 专家分0分
7楼#
发布于:2003-02-22 10:07
//这是源程序文件
#include <string.h>
#include <io.h>

#include \"rtlregs.h\"
#include \"util.h\"
#include \"eboot.h\"
#include \"arp.h\"
#include \"ether.h\"

/*!
 * \\addtogroup xgStack
 */
/*@{*/

#define NIC_PAGE_SIZE       0x100
#define NIC_START_PAGE      0x40
#define NIC_STOP_PAGE       0x60
#define NIC_TX_PAGES        6
#define NIC_TX_BUFFERS      2
#define NIC_FIRST_TX_PAGE   NIC_START_PAGE
#define NIC_FIRST_RX_PAGE   (NIC_FIRST_TX_PAGE + NIC_TX_PAGES * NIC_TX_BUFFERS)
#define TX_PAGES            12

u_char mac[6] = { 0x00,0x06,0x98,0x00,0x00,0x00 };

volatile u_char *base = (u_char *)0x8300;

/*!
 * Realtek packet header.
 */
struct nic_pkt_header {
    u_char ph_status;     /*!< \\brief Status, contents of RSR register */
    u_char ph_nextpg;     /*!< \\brief Page for next packet */
    u_short ph_size;      /*!< \\brief Size of header and packet in octets */
};

/*!
 * \\brief Reset the NIC.
 *
 * \\return 0 on success, -1 otherwise.
 */
static int NicReset(void)
{
    u_char i;
    u_char j;

    for(j = 0; j < 20; j++) {
        i = nic_read(NIC_RESET);
        Delay(500);
        nic_write(NIC_RESET, i);
        for(i = 0; i < 20; i++) {
            Delay(5000);
            if(nic_read(NIC_PG0_ISR) & NIC_ISR_RST)
                return 0;
        }
    }
    return -1;
}

/*!
 * \\brief Initialize the NIC.
 *
 * For further description of the initialization
 * please refer to the original Ethernut code.
 */
void NicInit(void)
{
    u_short i;

    /*
     * Enable external data and address
     * bus.
     */
    outp(BV(SRE) | BV(SRW), MCUCR);


    if(NicReset())
        return;

    nic_write(NIC_PG0_IMR, 0);
    nic_write(NIC_PG0_ISR, 0xff);
    nic_write(NIC_CR, NIC_CR_STP | NIC_CR_RD2 | NIC_CR_PS0 | NIC_CR_PS1);
    nic_write(NIC_PG3_EECR, NIC_EECR_EEM0 | NIC_EECR_EEM1);
    nic_write(NIC_PG3_CONFIG3, 0);
    nic_write(NIC_PG3_CONFIG2, NIC_CONFIG2_BSELB);
    nic_write(NIC_PG3_EECR, 0);
    Delay(50000);
    nic_write(NIC_CR, NIC_CR_STP | NIC_CR_RD2);
    nic_write(NIC_PG0_DCR, NIC_DCR_LS | NIC_DCR_FT1);
    nic_write(NIC_PG0_RBCR0, 0);
    nic_write(NIC_PG0_RBCR1, 0);
    nic_write(NIC_PG0_RCR, NIC_RCR_MON);
    nic_write(NIC_PG0_TCR, NIC_TCR_LB0);
    nic_write(NIC_PG0_TPSR, NIC_FIRST_TX_PAGE);
    nic_write(NIC_PG0_BNRY, NIC_STOP_PAGE - 1);
    nic_write(NIC_PG0_PSTART, NIC_FIRST_RX_PAGE);
    nic_write(NIC_PG0_PSTOP, NIC_STOP_PAGE);
    nic_write(NIC_PG0_ISR, 0xff);
    nic_write(NIC_CR, NIC_CR_STP | NIC_CR_RD2 | NIC_CR_PS0);
    for(i = 0; i < 6; i++)
        nic_write(NIC_PG1_PAR0 + i, mac);
    for(i = 0; i < 8; i++)
        nic_write(NIC_PG1_MAR0 + i, 0);
    nic_write(NIC_PG1_CURR, NIC_START_PAGE + TX_PAGES);
    nic_write(NIC_CR, NIC_CR_STP | NIC_CR_RD2);
    nic_write(NIC_PG0_RCR, NIC_RCR_AB);
    nic_write(NIC_PG0_ISR, 0xff);
    nic_write(NIC_PG0_IMR, 0);
    nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD2);
    nic_write(NIC_PG0_TCR, 0);
    Delay(2000000);
}

/*!
 * \\brief Send an Ethernet frame.
 *
 * \\param dmac Destination MAC address.
 * \\param type Frame type.
 * \\param len  Frame size.
 *
 * \\return 0 on success, -1 otherwise.
 */
int EtherOutput(u_char *dmac, u_short type, u_short len)
{
    u_short i;
    u_short sz;
    u_char *cp;
    ETHERHDR *eh;
#if 0
    u_char isr;
#endif

    if(type == ETHERTYPE_ARP) {
        eh = &arpframe.eth_hdr;
        cp = (u_char *)&arpframe;
    }
    else {
        eh = &sframe.eth_hdr;
        cp = (u_char *)&sframe;
    }

    for(i = 0; i < 6; i++)
        eh->ether_shost = mac;
    if(dmac) {
        for(i = 0; i < 6; i++)
            eh->ether_dhost = dmac;
    }
    else {
        for(i = 0; i < 6; i++)
            eh->ether_dhost = 0xFF;
    }
    eh->ether_type = type;
    if((len += sizeof(ETHERHDR)) < 60)
        sz = 60;
    else
        sz = len;

    nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD2);  
    nic_write(NIC_PG0_RBCR0, (u_char)sz);
    nic_write(NIC_PG0_RBCR1, (u_char)(sz >> 8));
    nic_write(NIC_PG0_RSAR0, 0);
    nic_write(NIC_PG0_RSAR1, NIC_FIRST_TX_PAGE);
    
    nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD1);
    
    /*
     * Transfer frame.
     */
    for(i = 0; i < len; i++, cp++)
        nic_write(NIC_IOPORT, *cp);
    for(i = len; i < sz; i++)
        nic_write(NIC_IOPORT, 0);
    
    /*
     * Complete remote dma.
     */
    nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD2);
    for(i = 0; i <= 20; i++)
        if(nic_read(NIC_PG0_ISR) & NIC_ISR_RDC)
            break;
    nic_write(NIC_PG0_ISR, NIC_ISR_RDC);
        
    /*
     * Number of bytes to be transmitted.
     */
    nic_write(NIC_PG0_TBCR0, (sz & 0xff));
    nic_write(NIC_PG0_TBCR1, ((sz >> 8) & 0xff));
        
    /*
     * First page of packet to be transmitted.
     */
    nic_write(NIC_PG0_TPSR, NIC_FIRST_TX_PAGE);
        
    /*
     * Start transmission.
     */
    nic_write(NIC_CR, NIC_CR_STA | NIC_CR_TXP | NIC_CR_RD2);

    /*
     * Wait until transmission is completed or aborted.
     */

    while(nic_read(NIC_CR) & NIC_CR_TXP);

    return 0;
}

/*!
 * \\brief Receive an Ethernet frame.
 *
 * \\param tms  Return with timeout after the specified
 *             number of waiting loops. On a 14 Mhz ATmega
 *             this value represents approximately the number
 *             of milliseconds to wait.
 *
 * \\return The number of bytes received, 0 on timeout
 *         or -1 in case of a failure.
 */
int EtherInput(u_short type, u_short tms)
{
    int rc = 0;
    u_char isr = 0;
    struct nic_pkt_header hdr;
    u_char *buf;
    u_char nextpg;
    u_char bnry;
    u_char curr;
    u_short i;
    u_char wtc;
    
    while(tms && rc == 0) {
        for(wtc = 1; tms; wtc++) {
            isr = nic_read(NIC_PG0_ISR);
            if(isr & NIC_ISR_RXE) {
                return -1;
            }
            if(isr & NIC_ISR_PRX) {
                break;
            }
            if(wtc == 0)
                tms--;
        }
        
        /*
         * Any frame received?
         */
        if((isr & NIC_ISR_PRX) == 0) {
            nic_write(NIC_PG0_ISR, isr);
            break;
        }
        
        /*
         * Get the current page pointer. It points to the page where the NIC
         * will start saving the next incoming packet.
         */
        nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD2 | NIC_CR_PS0);
        curr = nic_read(NIC_PG1_CURR);
        nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD2);
        
        /*
         * Get the pointer to the last page we read from. The following page
         * is the one where we start reading. If it\'s equal to the current
         * page pointer, then there\'s nothing to read. In this case we return
         * a null pointer.
         */
        if((bnry = nic_read(NIC_PG0_BNRY) + 1) >= NIC_STOP_PAGE)
            bnry = NIC_FIRST_RX_PAGE;
        if(bnry == curr) {
            nic_write(NIC_PG0_ISR, isr);
            continue;
        }
        
        /*
         * Read the NIC specific packet header.
         */
        nic_write(NIC_PG0_RBCR0, sizeof(struct nic_pkt_header));
        nic_write(NIC_PG0_RBCR1, 0);
        nic_write(NIC_PG0_RSAR0, 0);
        nic_write(NIC_PG0_RSAR1, bnry);
        buf = (u_char *)&hdr;
        nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD0);
        for(i = 0; i < sizeof(struct nic_pkt_header); i++)
            *buf++ = nic_read(NIC_IOPORT);
        
        /*
         * Complete remote dma.
         */
        nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD2);
        for(i = 0; i <= 20; i++) {
            if(nic_read(NIC_PG0_ISR) & NIC_ISR_RDC)
                break;
        }
        nic_write(NIC_PG0_ISR, NIC_ISR_RDC);
        
        /*
         *  Check packet length.
         */
        if(hdr.ph_size < 60 + sizeof(struct nic_pkt_header) ||
            hdr.ph_size > 1518 + sizeof(struct nic_pkt_header)) {
            return 0;
        }
        
        /*
         * Calculate the page of the next packet. If it differs from the
         * pointer in the packet header, we discard the whole buffer
         * and return a null pointer.
         */
        nextpg = bnry + (hdr.ph_size >> 8) + ((hdr.ph_size & 0xFF) != 0);
        if(nextpg >= NIC_STOP_PAGE) {
            nextpg -= NIC_STOP_PAGE;
            nextpg += NIC_FIRST_RX_PAGE;
        }
        if(nextpg != hdr.ph_nextpg) {
            u_char nextpg1 = nextpg + 1;
            
            if(nextpg1 >= NIC_STOP_PAGE) {
                nextpg1 -= NIC_STOP_PAGE;
                nextpg1 += NIC_FIRST_RX_PAGE;
            }
            if(nextpg1 != hdr.ph_nextpg) {
                nic_write(NIC_PG0_ISR, isr);
                break;
            }
            nextpg = nextpg1;
        }
        
        /*
         * Check packet status.
         */
        if((hdr.ph_status & 0x0F) == 1) {
            rc = hdr.ph_size - sizeof(struct nic_pkt_header);
            
            /*
             * Set remote dma byte count and
             * start address. Don\'t read the
             * header again.
             */
            nic_write(NIC_PG0_RBCR0, (u_char)rc);
            nic_write(NIC_PG0_RBCR1, (u_char)((u_short)rc >> 8));
            nic_write(NIC_PG0_RSAR0, sizeof(struct nic_pkt_header));
            nic_write(NIC_PG0_RSAR1, bnry);
            
            /*
            * Perform the read.
            */
            nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD0);
            buf = (u_char *)&rframe;
            for(i = 0; i < rc; i++)
                *buf++ = nic_read(NIC_IOPORT);
            
            /*
             * Complete remote dma.
             */
            nic_write(NIC_CR, NIC_CR_STA | NIC_CR_RD2);
            for(i = 0; i <= 20; i++) {
                if(nic_read(NIC_PG0_ISR) & NIC_ISR_RDC)
                    break;
            }
            nic_write(NIC_PG0_ISR, NIC_ISR_RDC);
        }
        
        /*
         * Set boundary register to the last page we read.
         */
        if(--nextpg < NIC_FIRST_RX_PAGE)
            nextpg = NIC_STOP_PAGE - 1;
        nic_write(NIC_PG0_BNRY, nextpg);        
        
        /*
         * Handle incoming ARP requests.
         */
        if(rframe.eth_hdr.ether_type != type) {
            if(rframe.eth_hdr.ether_type == ETHERTYPE_ARP)
                ArpRespond();
            rc = 0;
        }
    }
    return rc;
}

/*@}*/
放弃瘟草,现吃李草
antspower
驱动中牛
驱动中牛
  • 注册日期2002-10-17
  • 最后登录2010-08-03
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值2点
  • 好评度0点
  • 原创分0分
  • 专家分0分
8楼#
发布于:2003-02-22 10:09
//这是头文件:
#include \"types.h\"

/*!
 * \\addtogroup xgStack
 */
/*@{*/

/*
 * All types in network byte order.
 */
#define ETHERTYPE_IP    0x0008  /*!< \\brief IP protocol */
#define ETHERTYPE_ARP   0x0608  /*!< \\brief Address resolution protocol */

typedef struct ether_header {
    u_char  ether_dhost[6];     /*!< \\brief Destination MAC address. */
    u_char  ether_shost[6];     /*!< \\brief Source MAC address. */
    u_short ether_type;         /*!< \\brief Protocol type. */
} ETHERHDR;

/*@}*/

extern u_char mac[6];

extern void NicInit(void);
extern int EtherOutput(u_char *dest, u_short type, u_short len);
extern int EtherInput(u_short type, u_short tms);

#endif
放弃瘟草,现吃李草
antspower
驱动中牛
驱动中牛
  • 注册日期2002-10-17
  • 最后登录2010-08-03
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值2点
  • 好评度0点
  • 原创分0分
  • 专家分0分
9楼#
发布于:2003-02-22 10:13
我在纯DOS下实现的TCP/IP协议栈,靠的就是这个老网卡的支持啊!
放弃瘟草,现吃李草
antspower
驱动中牛
驱动中牛
  • 注册日期2002-10-17
  • 最后登录2010-08-03
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值2点
  • 好评度0点
  • 原创分0分
  • 专家分0分
10楼#
发布于:2003-02-23 22:33
我不要很多分,但你还是要记得给这个老古董点面子吧――给分吧
放弃瘟草,现吃李草
游客

返回顶部