u-boot-1.1.6移植之dm9000
2015-08-25 17:07
387 查看
网卡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设置寄存器
在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设置寄存器
相关文章推荐
- cache目录没有权限
- 安防报警系统--门禁系统图
- 深入理解计算机操作系统——第8章:进程控制
- 字符编码 ASCII UNICODE UTF-8
- Windows用户模式下的线程同步之CRITICAL_SECTION(关键字)
- 构造函数不能是虚函数的原因
- Xcode Precompile Prefix Header浅析
- Action与JSP之间值传递的问题
- DevExpress学习系列(控件篇):GridControl的基本应用
- 四川挂面品牌有哪些
- sort命令
- C# 跨线程操作UI元素
- MD5加密不满足公安部安全等级要求
- re,re.search,
- Linux中tar命令详解
- Unity使用Animator实现人物头部朝向鼠标
- MODIS 数据及产品下载地址
- 欧拉角与方向余弦矩阵之间的转换
- 关于VBA对数据透视表的操作使用
- 技术工具