u-boot-1.1.6移植之dm9000

网卡dm9000的执行过程(u-boot版本:u-boot-1.1.6):

在board.c里面有eth_initialize(gd->bd);

eth_initialize的实现在eth.c里面,但是eth_initialize函数里面没有dm9000的初始化eth_init

 

常见有nfs,tftp,ping命令会用到网络设备,可以从这里入手。

U_BOOT_CMD(

                ping,      2,            1,            do_ping,

                "ping\t- send ICMP ECHO_REQUEST to network host\n",

                "pingAddress\n"

);

 

而其处理函数do_ping如下:

int do_ping (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])

{

                if (argc < 2)

                                return -1;

 

                NetPingIP = string_to_ip(argv[1]);

                if (NetPingIP == 0) {

                                printf ("Usage:\n%s\n", cmdtp->usage);

                                return -1;

                }

 

                if (NetLoop(PING) < 0) {

                                printf("ping failed; host %s is not alive\n", argv[1]);

                                return 1;

                }

 

                printf("host %s is alive\n", argv[1]);

                return 0;

}

 

看上面红色标注的NetLoop,在net.c里面实现

eth_halt();            //Stop the interface.

#ifdef CONFIG_NET_MULTI

                eth_set_current();

#endif

                if (eth_init(bd) < 0) {                    //调用初始化函数,如果定义了cs8900,则使用cs8900的eth_init函数,这里使用dm9000

                                eth_halt();

                                return(-1);

                }

 

NetLoop函数的原型,参数是proto_t结构体指针

int NetLoop(proto_t protocol)

而proto_t有:

typedef enum { BOOTP, RARP, ARP, TFTP, DHCP, PING, DNS, NFS, CDP, NETCONS, SNTP } proto_t;

以上表明,当使用bootp,tftp,ping,nfs等命令的时候会调用NetLoop,进而对各种网卡进行对应于配置的初始化。

以上,是顶层对dm9000的调用过程,下面再看dm9000x.c执行过程

入口eth_init

                1、RESET device 复位 ,检测网络连接类型

                2、NIC Type: FASTETHER, HOMERUN, LONGRUN    NIC类型

                3、GPIO0 on pre-activate PHY  设置GPIO

                4、Set PHY   设置工作模式

                5、Program operating register设置寄存器       

 

转载于:https://www.cnblogs.com/hulig7/p/4758005.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值