|
日照
上午看了看栈底层接口,主要有这样几个功能:
1:eth_input(struct pbuf *p, struct netif *inp);
2:ethernetif_output(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
3:rt_err_t eth_device_init(struct eth_device* dev, const char* name)
第一个是用来把网络上的数据预分拣,分成IP包和ARP包,大体的步骤流程是:首先取出以太网层的类型数据,然后判断是IP还是ARP,然后对应着各自的处理程序,
第二个是用来把TCP/IP的上层封装数据加入ARP头之后放入BUFF中,然后分拣是IP包还是ARP包然后加入各自的头,最后通过PHY上传到以太网,基本上是输入的逆运算,
第三个是 初始化, 加载结构类的几个方法地址,比如说底层的收发,标志,MAC长度等一堆,最后:Set a network interface as the default network interface。
|
|