Quantcast
Channel: C6000™多核 - 最近的话题
Viewing all articles
Browse latest Browse all 5545

c6678 GE添加TCP/ip协议问题

$
0
0

我在c6678 GE例程里添加TCP/IP协议,使用的是LWIP这个协议包,在添加协议的过程中需要在中断的parserRxPacket函数中添加tcp/ip接收程序,我添加的源程序如下,黄色部分为我添加的接收程序:

void parserRxPacket(HostPacketDescriptor * hostDescriptor)
{
Uint32 length;
Ethernet_Packet_Type type;
unsigned long long sourceMAC, destMAC;
Uint8 lastData;
volatile struct pbuf *q;
struct netif *netif;
netif=&sitaraNetIF[0];
/*invalid cache before read descriptor RAM*/
InvalidCache((void *)hostDescriptor, 64);
q = pbuf_alloc(PBUF_RAW, PBUF_LEN_MAX, PBUF_POOL);
if(q == NULL)
{
pbuf_free((struct pbuf *)q);
}
length= hostDescriptor->packet_length- EMAC_HEADER_LEN- EMAC_CRC_LEN;

Get_EMAC_header((Uint8 *)hostDescriptor->buffer_ptr,
&type, &sourceMAC, &destMAC);

//check the last lastData
lastData= *(Uint8 *)(hostDescriptor->buffer_ptr+length+EMAC_HEADER_LEN-1);

printf("received %d bytes (last byte=0x%x), packet type = 0x%04x, from srouce address 0x%012llx to destination address 0x%012llx\n",
length, lastData, type, sourceMAC, destMAC);

//此处开始添加tcp/ip协议,先讲描述符内容进行类型转换的pbuf类型中然后将得到的数据传入协议上层
q->len = (unsigned short)(hostDescriptor->packet_length);
q->tot_len = (unsigned short)(hostDescriptor->packet_length);
q->payload = (void *)hostDescriptor->buffer_ptr;
q->next = NULL;

/* Adjust the link statistics */
LINK_STATS_INC(link.recv);

/* Process the packet */
if(ethernet_input((struct pbuf *)q, netif) != ERR_OK) {
/* Adjust the link statistics */
LINK_STATS_INC(link.memerr);
LINK_STATS_INC(link.drop);
}


if(q != NULL)
{
pbuf_free((struct pbuf *)q);
}

return;
}

程序运行之后结果如下,正常运行一段结果后出现如下问题(黄色部分),这个问题是什么导致的?在实际调试的过程中我在程序中的“if(ethernet_input((struct pbuf *)q, netif) != ERR_OK) ”处打断点,程序每次都能正常接收数据,不会触发上述存储问题,请问这种现象该怎么解决啊,求大神帮助


[C66xx_0] Ethernet PHY1 link up. TSCL= 0x1227598b
[C66xx_0] SGMII1 Link Partner Advertised Ability 1000Mbps Full Duplex
[C66xx_0] External exception happened. MEXPFLAG[3]=0x14000000.
[C66xx_0] Event 122: DMC_CMPA CPU memory protection fault for L1D (and other memory read finally goes through the L1D controller)
[C66xx_0] memory protection exception caused by local access at 0x4
[C66xx_0] Supervisor Read violation
[C66xx_0] Event 124: UMC_CMPA CPU memory protection fault for L2
[C66xx_0] memory protection exception caused by local access at 0x0
[C66xx_0] Supervisor Write violation
[C66xx_0] NRP=0xc0873c8, NTSR=0x1000d, IRP=0xc0873c8, ITSR=0xd, TSCH= 0x0, TSCL= 0x1227abb7
[C66xx_0] B3=0xc08762c, A4=0x0, B4= 0xe15ef22, B14= 0x8136dc, B15= 0x8126c8
[C66xx_0] received 46 bytes (last byte=0x0), packet type = 0x0800, from srouce address 0x4487fc4df8a0 to destination address 0xffffffffffff
[C66xx_0] Ethernet PHY1 link up. TSCL= 0x1229330f
[C66xx_0] SGMII1 Link Partner Advertised Ability 1000Mbps Full Duplex
[C66xx_0] External exception happened. MEXPFLAG[3]=0x14000000.
[C66xx_0] Event 122: DMC_CMPA CPU memory protection fault for L1D (and other memory read finally goes through the L1D controller)
[C66xx_0] memory protection exception caused by local access at 0x4
[C66xx_0] Supervisor Read violation
[C66xx_0] Event 124: UMC_CMPA CPU memory protection fault for L2
[C66xx_0] memory protection exception caused by local access at 0x0
[C66xx_0] Supervisor Write violation
[C66xx_0] NRP=0xc0873c8, NTSR=0x1000d, IRP=0xc0873c8, ITSR=0xd, TSCH= 0x0, TSCL= 0x1229853f
[C66xx_0] B3=0xc08762c, A4=0x0, B4= 0xe15ef22, B14= 0x8136dc, B15= 0x8126c8
[C66xx_0] received 46 bytes (last byte=0x0), packet type = 0x0800, from srouce address 0x4487fc4df8a0 to destination address 0xffffffffffff
[C66xx_0] received 46 bytes (last byte=0x0), packet type = 0x0800, from srouce


Viewing all articles
Browse latest Browse all 5545

Trending Articles