移植u-boot-2010.03问题 --- 网卡DM9000

移植u-boot-2010.03问题 --- 网卡DM9000

1,找到u-boot-2010.03/include/configs/smdk6410.h

移植u-boot-2010.03问题 --- 网卡DM9000
//#define CONFIG_NET_MULTI
//#define CONFIG_CS8900 /*we have aCS8900on-board*/
//#define CONFIG_CS8900_BASE 0x18800300
//#define CONFIG_CS8900_BUS16 /*follow the Linux driver*/

/**然后添加DM9000网卡的宏定义---ip以及子网掩码等根据自己的需要修改***/

#defineCONFIG_NET_MULTI 1
#defineCONFIG_DM9000_NO_SROM 1
#defineCONFIG_dm9000
#defineCONFIG_DRIVER_DM9000 1
#defineCONFIG_DM9000_BASE 0x18800300
#defineDM9000_IO CONFIG_DM9000_BASE
#defineDM9000_DATA (CONFIG_DM9000_BASE+4)
#defineCONFIG_DM9000_USE_16BIT
#defineCONFIG_ETHADDR 00:40:5c:26:0a:5b
#defineCONFIG_NETMASK 255.255.255.0
#defineCONFIG_IPADDR 192.168.1.20
#defineCONFIG_SERVERIP 192.168.1.10
#defineCONFIG_GATEWAYIP 192.168.1.1
//#define CONFIG_DM9000_DEBUG
移植u-boot-2010.03问题 --- 网卡DM9000

 

2,打开u-boot-2010.03/net/eth.c,找到int eth_initialize(bd_t *bis)函数:

移植u-boot-2010.03问题 --- 网卡DM9000
#if defined(CONFIG_DB64460) || defined(CONFIG_P3Mx)
    mv6446x_eth_initialize(bis);
#endif
/**
add here
*/
#if defined(CONFIG_DRIVER_DM9000)
    dm9000_initialize(bis);
#endif
/**
add over
*/
移植u-boot-2010.03问题 --- 网卡DM9000

 

3,打开u-boot-2010.03/net/net.c:

第一处:

//# define ARP_TIMEOUT        5000UL    /* Milliseconds before trying ARP again */
# define ARP_TIMEOUT        5    /* Milliseconds before trying ARP again */

第二处:

//  if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT) {
    if ((t - NetArpWaitTimerStart) > ARP_TIMEOUT*CONFIG_SYS_HZ) {

第三处:

//  NetSetTimeout (10000UL, PingTimeout);
    NetSetTimeout (10*CONFIG_SYS_HZ, PingTimeout);

 

4,打开u-boot-2010.03/net/tftp.c,找到void TftpStart (void)函数:

移植u-boot-2010.03问题 --- 网卡DM9000
#if 0
    /*
     * Allow the user to choose TFTP blocksize and timeout.
     * TFTP protocol has a minimal timeout of 1 second.
     */
    if ((ep = getenv("tftpblocksize")) != NULL)
        TftpBlkSizeOption = simple_strtol(ep, NULL, 10);

    if ((ep = getenv("tftptimeout")) != NULL)
        TftpTimeoutMSecs = simple_strtol(ep, NULL, 10);

    if (TftpTimeoutMSecs < 1000) {
        printf("TFTP timeout (%ld ms) too low, "
            "set minimum = 1000 ms\n",
            TftpTimeoutMSecs);
        TftpTimeoutMSecs = 1000;
    }

    debug("TFTP blocksize = %i, timeout = %ld ms\n",
        TftpBlkSizeOption, TftpTimeoutMSecs);
#endif
移植u-boot-2010.03问题 --- 网卡DM9000

 

完成后重新编译。

5,测试网卡

在开发板上通过命令 printenv 查看网卡信息。

 

移植u-boot-2010.03问题 --- 网卡DM9000
WU_SMDK6410 # printenv                                                          
bootargs=console=ttySAC,115200                                                  
bootcmd=nand read 0x50018000 0x60000 0x1c0000;bootm 0x50018000                  
bootdelay=10                                                                    
baudrate=115200                                                                 
ethaddr=00:40:5c:26:0a:5b                                                       
ipaddr=192.168.1.123                                                            
serverip=192.168.1.127                                                          
gatewayip=192.168.1.1                                                           
netmask=255.255.255.0                                                           
stdin=serial                                                                    
stdout=serial                                                                   
stderr=serial                                                                   
ethact=dm9000    
移植u-boot-2010.03问题 --- 网卡DM9000

 

这时,我主机的ip:192.168.1.127,通过ping命令测试是否能连通:

移植u-boot-2010.03问题 --- 网卡DM9000
WU_SMDK6410 # ping 192.168.1.127                                                
dm9000 i/o: 0x18800300, id: 0x90000a46                                          
DM9000: running in 16 bit mode                                                  
MAC: 00:40:5c:26:0a:5b                                                          
operating at 100M full duplex mode                                              
Using dm9000 device                                                             
host 192.168.1.127 is alive         
移植u-boot-2010.03问题 --- 网卡DM9000

这里成功连通,但也有时会出现开发板能ping通主机,但是主机却ping不通开发板的奇怪现象,但不影响开发板通过tftp下载主机上的文件,暂时没想通。

移植u-boot-2010.03问题 --- 网卡DM9000

上一篇:struts解决form提交的中文参数乱码问题


下一篇:bzoj 2819 博弈论