Part Number:TMS320C6678
方案是用FPGA端采用NWIRTE-R格式向DSP端写入数据,DSP接收到数据采用REPSONE WITH DATA返回数据及运行状态。现在DSP端在裸核下采用SRIO的Direct I/O 方式控制LSU寄存器,其中设置了Ftype=Srio_Ftype_REPSONE;ttype=Srio_Ttype_Response_RESPONSE_PAYLOAD方式能否通过CSL的 CSL_SRIO_SetLSUTransfer(hSrio, LSU_Number, &tparams)函数实现RESPONE with data数据发送。
DSP在进行内回环测试过程,先通过进行NWIRTE-R的数据写入,然后再进行Srio_Ttype_Response_RESPONSE_PAYLOAD的写入,现在NWIRTE-R发送成功了,但是Response with data的事务发送时,CSL_SRIO_GetLSUCompletionCode(hSrio, LSU_Number, transactionID,&uiCompletionCode, &context)返回错误uiCompletionCod=-4状态,错误原因可能是是包类类型不支持,或者出现了对至少一个LSU的编码是无效的。
相关代码:
/* wait loopback complete time set as 10ms, base on cpu freq as 1000MHz */
timeout = 10000000;
/* 1.3 caculate the read and write buffer for srio transfer address */
//1.3计算srio传输地址的读写缓冲区
srio_trans_src = (uint32_t *)t_buff_global;
// srio_trans_dst = (uint32_t *)r_buff_global;
srio_trans_dst= (uint32_t *)TARGET_ADDRESS;
printf("NREAD srio_trans_src= %d,srio_trans_dst=%d\n",srio_trans_src , srio_trans_dst);
printf("NREAD srio_trans_src= 0x%x,srio_trans_dst=0x%x\n",srio_trans_src , srio_trans_dst);
//cuix add r_buff
/* 1.4 set transfer parameters, srio nread test, devmem_buff -> r_buff */
memset((void *)&tparams, 0, sizeof(tparams));
tparams.rapidIOLSB = (uint32_t)srio_trans_src;
tparams.dspAddress = (uint32_t)srio_trans_dst;
tparams.bytecount = transfer_size;
//Srio_Ftype_RESPONSE I/O Transaction
//Ftype:w_format_type=Srio_Ftype_RESPONSE (13) ttpye:Srio_Ttype_Response_RESPONSE_PAYLOAD(8)
tparams.ftype = Srio_Ftype_RESPONSE ; //Format fType
tparams.ttype =Srio_Ttype_Response_RESPONSE_PAYLOAD ;
//id of the target device to be sent
tparams.dstID = REMOTE_DEVICEID1_8BIT;
tparams.outPortID = SRIO_PORT;
tparams.idSize = 0;
/* wait LSU have available shadow register */
while(1) {
if (CSL_SRIO_IsLSUFull (hSrio, LSU_Number) == FALSE)
break;
}
/* Get the LSU Context and Transaction Information. */
CSL_SRIO_GetLSUContextTransaction(hSrio, LSU_Number,
&contextBit, &transactionID);
transStart = _itoll(TSCH, TSCL);
/* start srio transfer */
CSL_SRIO_SetLSUTransfer(hSrio, LSU_Number, &tparams);
/* wait for a transfer completion interrupt occur */
while(timeout) {
CSL_SRIO_GetLSUCompletionCode(hSrio, LSU_Number, transactionID,
&uiCompletionCode, &context);
if(context == contextBit) {
/* disable pending transactions */
transactionID = 0xFF;
contextBit = 0xFF;
if(uiCompletionCode != 0) {
status = -1;
printf("SRIO transfer have error completed code %d\r\n", -(uiCompletionCode));
goto err_transfer;
}
break;
} else {
timeout–;
/* delay 1 cpu cyle */
asm (" nop");
}
}
if(timeout == 0) {
/* if transfer timeout occurs, return error status */
status = -1;
printf("SRIO transfer timeout\r\n");
goto err_transfer;
}
/* Calculate srio transfer used time */
transCost = _itoll(TSCH, TSCL) – transStart;
r_time = transCost;
/* Calculate srio transfer read rate */
//Srio_Ttype_Request_NREAD 读取数据
r_rate = (float)transfer_size * main_pll_freq / r_time / 1024 / 1024 / 1024 * 8;
w_rate_total += w_rate;
r_rate_total += r_rate;
for(i = 0; i < transfer_size; i++) {
printf("test addr: 0x%x, dst addr: 0x%x\r\n", \
w_buff_global[i], r_buff_global[i]);
if(w_buff_global[i] != r_buff_global[i]) {
printf(" src addr: 0x%x, dst addr: 0x%x\r\n", \
(uint32_t)&w_buff_global[i], (uint32_t)&r_buff_global[i]);
err_count++;
if(err_count == 1) {
printf("Frist Err occurred src addr: 0x%x, dst addr: 0x%x\r\n", \
(uint32_t)&w_buff_global[i], (uint32_t)&r_buff_global[i]);
printf("dst val: 0x%x, ", r_buff_global[i]);
printf("expet val: 0x%x\r\n", w_buff_global[i]);
}
}
1.请教下,我们方案理论可行吗?但是TI的相关案例中,没有见过Response with data的事务发送的案例?
2.DSP端能采用SRIO采用Direct I/O的Srio_Ttype_Response_RESPONSE_PAYLOAD采用这个方式向FPGA的固定的地址写入数据?
3.如果可行,如何尝试修改uiCompletionCod=-4状态?
4.如果无法解答,能否帮我升级下可以?
Cherry Zhou:
您好,您的问题我们已升级到英文论坛寻求帮助,请看如下链接:
e2e.ti.com/…/tms320c6678-srio-communication-issue