nios ii网络驱动程序分析

nios ii网络驱动程序分析

ID:14804211

大小:39.00 KB

页数:6页

时间:2018-07-30

nios ii网络驱动程序分析_第1页
nios ii网络驱动程序分析_第2页
nios ii网络驱动程序分析_第3页
nios ii网络驱动程序分析_第4页
nios ii网络驱动程序分析_第5页
资源描述:

《nios ii网络驱动程序分析》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、NIOSII网络驱动程序分析  网络是嵌入式应用的常备功能,在NIOSII中集成了UCOSII和LWIP,分析网络设备在NIOSII中的来龙去脉对学习NIOSII设备驱动程序有典型的意义。设备的定义和系统设备联表管理。1.  驱动程序提供的freedev_rtl8019.h中定义一个freedev_rtl8019_if结构的全局变量dev#defineFREEDEV_RTL8019_INSTANCE(name,dev)freedev_rtl8019_ifdev={ {   ALT_LLIST_ENTRY,   {     0,     name##_NAME,

2、     freedev_rtl8019_init,     freedev_rtl8019_rx,   }, }, name##_BASE, name##_IRQ, 8, 0, 0}结构freedev_rtl8019_if定义如下:typedefstruct{ alt_lwip_dev_list   lwip_dev_list; int                base_addr; int                irq; int                bus_width; sys_sem_t          semaphore;

3、 sys_sem_t          arp_semaphore; alt_u8             tx_packet_no;/*NumberofpacketallocatedforTx*/}freedev_rtl8019_if;相关结构定义如下:typedefstruct{ alt_llist    llist;    /*forinternaluse*/ alt_lwip_dev dev;}alt_lwip_dev_list;structalt_lwip_dev{ /*ThenetifpointerMUSTbethefirstelementinthestruct

4、ure*/ structnetif      `      *netif; constchar*      name; err_t(*init_routine)(structnetif*); void(*rx_routine)();};structnetif{ /**pointertonextinlinkedlist*/ structnetif*next;  /**IPaddressconfigurationinnetworkbyteorder*/ structip_addrip_addr; structip_addrnetmask; structip_addrgw; /*

5、*Thisfunctioniscalledbythenetworkdevicedriver  * topassapacketuptheTCP/IPstack.*/ err_t(*input)(structpbuf*p,structnetif*inp); /**ThisfunctioniscalledbytheIPmodulewhenitwants  * tosendapacketontheinterface.Thisfunctiontypically  * firstresolvesthehardwareaddress,thensendsthepacket.*/ err_t

6、(*output)(structnetif*netif,structpbuf*p,structip_addr*ipaddr); /**ThisfunctioniscalledbytheARPmodulewhenitwants  * tosendapacketontheinterface.Thisfunctionoutputs  * thepbufas-isonthelinkmedium.*/ err_t(*linkoutput)(structnetif*netif,structpbuf*p); /**Thisfieldcanbesetbythedevicedriverand

7、couldpoint  * tostateinformationforthedevice.*/ void*state;#ifLWIP_DHCP /**theDHCPclientstateinformationforthisnetif*/ structdhcp*dhcp;#endif /**numberofbytesusedinhwaddr*/ unsignedcharhwaddr_len; /**linklevelhardwareaddressofthisinterface*/ unsignedcharhwaddr

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。