#include "mainInclude.h"#include"lwip/init.h"#include"lwip/ip.h"#include"lwip/dhcp.h"#include"lwip/tcp_impl.h"#include"lwip/ip_frag.h"#include"lwip/dns.h"#include"netif/etharp.h"#include"netif/ethernetif.h"#include"arch/sys_arch.h"
#define CLOCKTICKS_PER_MS 10 //定义时钟节拍
static ip_addr_t ipaddr, netmask, gw; //定义IP地址
struct netif enc28j60_netif; //定义网络接口
u32_t input_time;
u32_t last_arp_time;
u32_t last_tcp_time;
u32_t last_ipreass_time;
u32_t last_dhcp_fine_time;
u32_t last_dhcp_coarse_time;
u32 dhcp_ip=0;//LWIP查询
void LWIP_Polling(void)
{if(timer_expired(&input_time,5)) //接收包,周期处理函数
{
ethernetif_input(&enc28j60_netif);
}if(timer_expired(&last_tcp_time,TCP_TMR_INTERVAL/CLOCKTICKS_PER_MS))//TCP处理定时器处理函数
{
tcp_tmr();
}if(timer_expired(&last_arp_time,ARP_TMR_INTERVAL/CLOCKTICKS_PER_MS))//ARP处理定时器
{
etharp_tmr();
}if(timer_expired(&last_ipreass_time,IP_TMR_INTERVAL/CLOCKTICKS_PER_MS))//IP重新组装定时器
{
ip_reass_tmr();
}
}int main(void)
{
u