你好!
本人想通过SGMII来实现两片C6678DSP之间的数据通信,程序采用的是CCS安装目录下的EmacExample过程,该例程实现了10包UDP数据报的发送,但现在发现将发送的报数增加,比如发送20、50、100包等,接收端都只能收到开头发送的13包,而且将发送的数据包再增加,比如3000包,接收端只能收到开头13包数据,中间跳过一段后,又连续接收到后后面发送的13包数,但位置不确定,简单点说就是间断性的接收数据,每次收到的数据包数一定。这里我初始化发送端数据是递增值。请问这是怎么回事?是不是我还要修改接收端的某些配置,因为我只修改了发送的报数大小;还是说发送端的问题?
还有一个问题,由于我使用TI的MCSDK PDK TMS320C6678 的1.0.0.16版本,不知道现在改用1.1.2.5版本,不知道会有影响吗?
Thanks for any idea!
Shi
Allen35065:
例子仅供演示如何初始化EMAC,并没有考虑到更多的包的兼容性,你还是需要修改一下发送接收函数以能符合你的需求。
Shi Firo:
回复 Allen35065:
你好,Allen!
感谢你的回复,关于你说的包的兼容性,我不是很理解,你的意思难道是因为包的兼容性而导致了只能收到部分数据?至于发送函数我直接使用的是例程里的
SendPacket ()函数,只是将其参数添加为发数的源地址,即SendPacket (sendbuf) ,在该函数里通过DMA搬移到pktMatch中,其它都一样,请问该怎么改,我实在没地方下手。发送端的源代码如下:
Int32 SendPacket (Void){ Cppi_Desc* pCppiDesc; UInt32 dataBufferSize; char psFlags = (cpswSimTest)?pa_EMAC_PORT_0:pa_EMAC_PORT_1;
/* Get a free descriptor from the global free queue we setup * during initialization. */ if ((pCppiDesc = Qmss_queuePop (gTxFreeQHnd)) == NULL) { System_printf ("No Tx free descriptor. Cant run send/rcv test \n"); return -1; }
/* The descriptor address returned from the hardware has the * descriptor size appended to the address in the last 4 bits. * * To get the true descriptor size, always mask off the last * 4 bits of the address. */ pCppiDesc = (Ptr) ((UInt32) pCppiDesc & 0xFFFFFFF0);
dataBufferSize = sizeof (pktMatch); Cppi_setData ( Cppi_DescType_HOST, (Cppi_Desc *) pCppiDesc, (UInt8 *) Convert_CoreLocal2GlobalAddr((UInt32)pktMatch), dataBufferSize ); Cppi_setPacketLen (Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, dataBufferSize); if (cpswLpbkMode != CPSW_LOOPBACK_NONE) { /* Force the packet to the specific EMAC port if loopback is enabled */ Cppi_setPSFlags(Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, psFlags); } else { Cppi_setPSFlags(Cppi_DescType_HOST, (Cppi_Desc *)pCppiDesc, 0); } /* Send the packet out the mac. It will loop back to PA if the mac/switch * have been configured properly */ Qmss_queuePush (gPaTxQHnd[8], pCppiDesc, dataBufferSize, SIZE_HOST_DESC, Qmss_Location_TAIL);
/* Increment the application transmit counter */ gTxCounter ++;
/* Give some time for the PA to process the packet */ CycleDelay (10000);
return 0; }
至于接收端,由于它采用中断服务函数Cpsw_RxISR()来接收数据,也只是在该函数中添加了DMA搬移的函数,源代码如下:
Void Cpsw_RxISR (Void){ Cppi_Desc* pCppiDesc; UInt32 count, i; /* Process ISR. * * Get the number of entries in accumulator list. * The hardware enqueues data alternatively to Ping/Pong buffer lists in * the accumulator. Hence, we need to track which list (Ping/Pong) * we serviced the last time and accordingly process the other one * this time around. */ if (!gIsPingListUsed) { /* Serviced Pong list last time. So read off the Ping list now */ count = gHiPriAccumList[0]; } else { /* Serviced Ping list last time. So read off the Pong list now */ count = gHiPriAccumList[RX_INT_THRESHOLD + 1]; } /* Process all the Results received * * Skip the first entry in the list that contains the * entry count and proceed processing results. */ for (i = 1; i <= count; i ++) { /* Get the result descriptor. * * The hardware enqueues data alternatively to Ping/Pong buffer lists in * the accumulator. Hence, we need to track which list (Ping/Pong) * we serviced the last time and accordingly process the other one * this time around. */ if (!gIsPingListUsed) { /* Serviced Pong list last time. So read off the Ping list now */ pCppiDesc = (Cppi_Desc *) gHiPriAccumList [i]; } else { /* Serviced Ping list last time. So read off the Pong list now * * Skip over Ping list length to arrive at Pong list start. */ pCppiDesc = (Cppi_Desc *) gHiPriAccumList [i + RX_INT_THRESHOLD + 1]; }
/* Descriptor size appended to the address in the last 4 bits. * * To get the true descriptor size, always mask off the last * 4 bits of the address. */ pCppiDesc = (Ptr) ((UInt32) pCppiDesc & 0xFFFFFFF0);
VerifyPacket (pCppiDesc); }
/* Clear the accumulator list and save whether we used Ping/Pong * list information for next time around. */ if (!gIsPingListUsed) { /* Just processed Ping list */ gIsPingListUsed = 1; /* Clear the accumulator list after processing */ memset ((Void *) &gHiPriAccumList [0], 0, sizeof (UInt32) * (RX_INT_THRESHOLD + 1)); } else { /* Just processed Pong list */ gIsPingListUsed = 0;
/* Clear the accumulator list after processing */ memset ((Void *) &gHiPriAccumList[RX_INT_THRESHOLD + 1], 0, sizeof (UInt32) * (RX_INT_THRESHOLD + 1)); }
/* Clear INTD */ Qmss_ackInterrupt(PA_ACC_CHANNEL_NUM, 1); Qmss_setEoiVector(Qmss_IntdInterruptType_HIGH, PA_ACC_CHANNEL_NUM); /* Done processing interrupt. Return */ return;}
本人看来看去还是发现不了与之有关的部分,麻烦你帮我看下,万分感谢!
Shi