一、在main()函數中
1 /* check if any packet received */ 2 if (ETH_CheckFrameReceived()) 3 { 4 /* process received ethernet packet */ 5 LwIP_Pkt_Handle(); 6 }
二、
1 /** 2 * @brief Called when a frame is received 3 * @param None 4 * @retval None 5 */ 6 void LwIP_Pkt_Handle(void) 7 { 8 /* Read a received packet from the Ethernet buffers and send it to the lwIP for handling */ 9 ethernetif_input(&netif); 10 }
三、在函數ethernetif_input()主要完成兩個工作
1、調用low_level_input();得到實際的接收數據pbuf
2、調用netif->input();
四、在LwIP_Init()中的調用netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ðernetif_init, ðernet_input);
可知,當執行到netif->input();時,函數ethernet_input()被調用;
五、ethernet_input()
1、原型:err_t ethernet_input(struct pbuf *p, struct netif *netif)
2、功能:處理接收到的網絡數據幀;
這個函數並沒有直接調用ip_input;
在並發訪問時,ARP高速緩存被保護
3、實現:
-