|
我想把skyeye中的lwip移到我的44b0板子上,就是那块公板的44b0,应该很多人有见过。不过我却出现了问题。
我以前移植了一个ucos在我的44b0的板子,然后我想把lwip放在上面,lwip移植的代码基本是照搬skyeye的,包括8019的驱动,
我现在的现象是这个样子,当我ping我的网卡的时候,
uCOS-II Running on a SAMSUNG 44b0x board
Initialising target board
Timer init
targetInit() complete
System initialized.
hello
hello2
TCP/IP initialized.
Applications started.
tcpecho created!Starting target
!!!NET_ISR_BreakPoint.
tcpip_thread
tcpip_thread
tcpip_thread
tcpecho_thread
hello
hello2
hello
hello2
hello
hello2
!!!NET_ISR_BreakPoint.got a packet from low_level_receive
ETHTYPE_ARP
arp_arp_input: ARP request
!!!Enter UNDEFINED. !!!Enter break point.!!!Enter UNDEFINED. !!!Enter break point.
从这个log上看好像网卡已经把包给收进来了,而且判断是ARP的包,然后把包发给p = arp_arp_input(netif, rtl8019if->ethaddr, p);
就出问题,可是我看了看arp_arp_input(netif, rtl8019if->ethaddr, p);这个函数,好像没有什么可能会造成我ucos系统崩溃的因素啊,
struct pbuf *
arp_arp_input(struct netif *netif, struct eth_addr *ethaddr, struct pbuf *p)
{
struct arp_hdr *hdr;
u8_t i;
if(p->tot_len < sizeof(struct arp_hdr)) {
DEBUGF(ARP_DEBUG, ("arp_arp_input: packet too short (%d/%d)\n", p->tot_len, sizeof(struct arp_hdr)));
pbuf_free(p);
return NULL;
}
hdr = p->payload;
switch(htons(hdr->opcode)) {
case ARP_REQUEST:
/* ARP request. If it asked for our address, we send out a
reply. */
uHALr_Printf("arp_arp_input: ARP request\n ");
DEBUGF(ARP_DEBUG, ("arp_arp_input: ARP request\n"));
if(ip_addr_cmp(&(hdr->dipaddr), &(netif->ip_addr))) {
//好像就是在这里死掉的,可是这里的任何处理好像都和我的ucos系统没有多大关系啊??
hdr->opcode = htons(ARP_REPLY);
ip_addr_set(&(hdr->dipaddr), &(hdr->sipaddr));
ip_addr_set(&(hdr->sipaddr), &(netif->ip_addr));
for(i = 0; i < 6; ++i) {
hdr->dhwaddr.addr = hdr->shwaddr.addr;
hdr->shwaddr.addr = ethaddr->addr;
hdr->ethhdr.dest.addr = hdr->dhwaddr.addr;
hdr->ethhdr.src.addr = ethaddr->addr;
}
hdr->hwtype = htons(HWTYPE_ETHERNET);
ARPH_HWLEN_SET(hdr, 6);
hdr->proto = htons(ETHTYPE_IP);
ARPH_PROTOLEN_SET(hdr, sizeof(struct ip_addr));
hdr->ethhdr.type = htons(ETHTYPE_ARP);
uHALr_Printf("return p\n ");
return p;
}
break;
case ARP_REPLY:
/* ARP reply. We insert or update the ARP table. */
DEBUGF(ARP_DEBUG, ("arp_arp_input: ARP reply\n"));
if(ip_addr_cmp(&(hdr->dipaddr), &(netif->ip_addr))) {
add_arp_entry(&(hdr->sipaddr), &(hdr->shwaddr));
#if (LWIP_DHCP && DHCP_DOES_ARP_CHECK)
dhcp_arp_reply(&hdr->sipaddr);
#endif
}
break;
default:
DEBUGF(ARP_DEBUG, ("arp_arp_input: unknown type %d\n", htons(hdr->opcode)));
break;
}
pbuf_free(p);
return NULL;
}
我如果把//arp_arp_input函数屏蔽掉的话,我的ucos好像是正常的啊,l
og如下:
uCOS-II Running on a SAMSUNG 44b0x board
Initialising target board
Timer init
targetInit() complete
System initialized.
hello
hello2
TCP/IP initialized.
Applications started.
tcpecho created!Starting target
!!!NET_ISR_BreakPoint.
tcpip_thread
tcpip_thread
tcpip_thread
tcpecho_thread
!!!NET_ISR_BreakPoint.got a packet from low_level_receive
hello
hello2
hello
hello2
hello
hello2
!!!NET_ISR_BreakPoint.got a packet from low_level_receive
ETHTYPE_ARP
pbuf_free(p)
!!!NET_ISR_BreakPoint.//我很奇怪的是我已经把中断给屏蔽了为什么还有这个网卡中断。
hello
hello2
我本来考虑是不是中断嵌套的因素,可是我已经在void ne2k_isr(void)中
void ne2k_isr{
rINTMSK=( BIT_TIMER0 | BIT_GLOBAL|BIT_EINT1);
....
rINTMSK=~( BIT_TIMER0 | BIT_GLOBAL|BIT_EINT1);
}
可是问题还是一样的啊,??
大侠,给点指点吧,我已经在这个上面耗了一个多月,一点进展都没有啊。 |
|