》 测试内容
利用下面pdk的例程实现两片TMS320c6678le间通信
测试从RC送信到EP返回的时间
使用例程
C:\ti\pdk_C6678_1_0_0_21\packages\ti\drv\pcie\example\sample
》 结果
通信成功
得到的测试时间30ms左右
不明白在哪里花费了这么长时间
》 问题
1 需要HW 或者SW的特殊设置吗
2 通信时间过长的理由
》 ps
时间测试方法
... ...
System_printf ("Link is up.\n");
if(PcieModeGbl == pcie_RC_MODE) /* RC送信 */
{
/**********************************************************************/
/* Push a single message to the EP then verify that it is echoed back */
/**********************************************************************/
/* Write from RC to EP */
if ((retVal = Pcie_getMemSpaceRange (handle, &pcieBase, NULL)) != pcie_RET_OK) {
System_printf ("getMemSpaceRange failed\n", (int)retVal);
exit(1);
}
for (i=0; i<PCIE_BUFSIZE_APP; i++)
{
*((volatile uint32_t *)pcieBase + i) = srcBuf[i];
}
prevCnt = TSCL; ←←←←←←←←←←←←←←←←←←←←←←←←←←←读送信前时间
/* Mark that the buffer is full, so EP can process it */
*((volatile uint32_t *)pcieBase + PCIE_BUFSIZE_APP) = PCIE_EXAMPLE_BUF_FULL;
/* Note on cache coherence: Write back is not necessary because pcieBase is in
peripheral address space instead of physical memory*/
/* Data sent to EP.
RC waits for the loopback to be completed and
receive data back from EP */
do {prevCnt2++;
unsigned int key;
/* Disable Interrupts */
key = _disable_interrupts();
/* Cleanup the prefetch buffer also. */
CSL_XMC_invalidatePrefetchBuffer();
CACHE_invL1d ((void *)dstBuf.buf, PCIE_EXAMPLE_DSTBUF_BYTES, CACHE_FENCE_WAIT);
CACHE_invL2 ((void *)dstBuf.buf, PCIE_EXAMPLE_DSTBUF_BYTES, CACHE_FENCE_WAIT);
/* Reenable Interrupts. */
_restore_interrupts(key);
} while(dstBuf.buf[PCIE_BUFSIZE_APP] != PCIE_EXAMPLE_BUF_FULL);
prevCnt1 = TSCL; ←←←←←←←←←←←←←←←←←←←←←←←←←←←读收信后时间
Cnt = prevCnt1 - prevCnt; ←←←←←←←←←←←←←←←←←←←←←←←←←←←计算送收信时间
/* check all the data */
for (i=0; i<PCIE_BUFSIZE_APP; i++)
{
if(dstBuf.buf[i] != srcBuf[i])
{
System_printf ("Received data = %d\nTransmited data = %d\nIndex = %d.\n\nTest failed.\n",
dstBuf.buf[i], srcBuf[i], i);
exit(1);
}
}
System_printf ("Root Complex received data.\nTest passed.\n");
}
else
{ /* EP收信 */
}
》 ps
结果
Cnt = 2931335
prevCnt = 253694
prevCnt1= 3185029