你好!在C6670 SPn_LM_RESP寄存器中的0~4bit位为link_status,但其中00000为reserved.我想问一下reserved是代表link不成功吗?但我发现我可以向连接设备发送数据,但link_status状态仍未00000,请问是怎么回事?谢谢。
dejiang pi:
回复 Thomas Yang1:
你好!我发现有一个SPn_LM_RQ寄存器,其中的command位描述显示:当command写入11时才会发出link request,是否是我自己要写?我的代码中并未对此寄存器进行编辑,是不是如果代码不写这个寄存器的话就不会触发link request,也就不会有相应的link response?谢谢
dejiang pi:
回复 Thomas Yang1:
你好!我发现有一个SPn_LM_RQ寄存器,其中的command位描述显示:当command写入11时才会发出link request,是否是我自己要写?我的代码中并未对此寄存器进行编辑,是不是如果代��不写这个寄存器的话就不会触发link request,也就不会有相应的link response?谢谢
Richard Zhang:
回复 Thomas Yang1:
我在SRIO测试例子中有一段子程序是关于用RQ和RESP和AckID测试连接的,实在没看懂。。能不能说说这段子程序是啥意思。。代码如下
void ackID_sync (CSL_SrioHandle hSrio)
{
CSL_SrioPortData responseSrio;
Uint32 count, response, ackID, response_valid;
volatile Int32LSUNO = SELECTED_LSU;
Uint32rcvAddress;
Uint32partner_inbound_ackid;
CSL_SrioLsuCompStat completionCode;
CSL_DevRegs* devRegs = (CSL_DevRegs*)CSL_DEV_REGS;
response_valid = 0;
while (!response_valid)
{
/***** Send Link Request Control Symbols *****/
hSrio->regs->PORT[SRIO_PORT_NUMBER].SP_LM_REQ = 0x04;
for (count=0; count<1000; count++)
asm(" nop 5");
response = hSrio->regs->PORT[SRIO_PORT_NUMBER].SP_LM_RESP;
printf ("Response = 0x%08x\n", response);
response_valid = (response & 0x80000000) >> 31;
}
ackID = (response & 0x3E0) >> 5;
/***** Copy the expected INBOUND_ACKID sent by other device into OUTBOUND_ACKID *****/
hSrio->regs->PORT[SRIO_PORT_NUMBER].SP_ACKID_STAT = (hSrio->regs->PORT[SRIO_PORT_NUMBER].SP_ACKID_STAT & 0xFFFFFFE0) | ackID;
/***** Send Maintenance packet to link partner to set his OUTBOUND/INBOUND ACKID *****/
/***Value written should be: outstanding = outbound = DSP抯 expected inbound ACKID
value, and the inbound = 1 + ACKID from the LM response above***/
/* Write the Inbound AckID */
partner_inbound_ackid = ackID + 1;
if(CSL_FEXT(devRegs->DEVSTAT, DEV_DEVSTAT_LENDIAN) == 0)
partner_inbound_ackid = partner_inbound_ackid << 24;
/* SPn_ACKID_STAT register offset is 0x1148+0x20*n. When we are writing the Maintenance packet which
* will not reach to the logical layer but will be addressed at physical layer, we need to remove
* 0x1000 offset since in actual physical layer the registers are starting from address offset 0x000 */
rcvAddress = 0x00000148 + 0x20 * SRIO_PORT_NUMBER;
srio_start_maintenance(hSrio, (int) &partner_inbound_ackid,(int) rcvAddress, 4, REQ_MAINT_WR, SRIO_PORT_NUMBER, LSUNO);
responseSrio.index = LSUNO;
while (1)
{
/* Poll and check if the LSU has completed */
CSL_srioGetHwStatus (hSrio, CSL_SRIO_QUERY_LSU_BSY_STAT, &responseSrio);
/* Is the LSU not busy */
if (responseSrio.data == 0)
break;
}
/* Get the completion Code for the specific LSU. */
completionCode.lsuNum = LSUNO;
CSL_srioLsuCompCodeStat(hSrio, &completionCode);
if (completionCode.lsuCompCode != 0x0)
{
/* Failed Transfer. */
printf ("Error: Maintenance has a completion code of %d\n", completionCode.lsuCompCode);
return;
}
printf ("Partner_Inbound_AckID = 0x%08x\n", partner_inbound_ackid);
}