DSP中断服务程序中,SRIO传输传输失败,之后不能接受doorbell信号,中断停止了,如果不加传输,中断没有问题

中断服务程序ISR:

Void FpgaDioTxCompletionIsr
(
UArg argument
//UArg arg0, UArg arg1
)
{
//使主机中断失效
//CpIntc_disableHostInt(1,8);
//清除系中断
//CpIntc_clearSysInt(1,112);
//使能主机中断
//CpIntc_enableHostInt(1,8);


g_InterruptCount++;
Uint16 doorbellStatus;
DEVICE_REG32_W(0x10800080,g_InterruptCount);


//FPGA中断足够快的话是否会丢失中断?

// gpCGEM_regs->EVTCLR[0] = 0x00100000;
CSL_SRIO_GetDoorbellPendingInterrupt (hSrioCSL, 0, &doorbellStatus);
//CSL_SRIO_SetInterruptPacing (hSrio, 2, 0xFFFFFFFF);

//UInt32 uiSegNum;
// switch(doorbellStatus)
// {
// case 1:
// DEVICE_REG32_W(0x10800084,0xABAB4141);
// //printf("doorbell 1 ok!");
// break;
// default:
// DEVICE_REG32_W(0x108000A4,0XABAB4154);
// //printf("doorbell not ok!");
// break;
//// }
DEVICE_REG32_W(0x10800090,DSP_GPS_Data_Addr);
// DEVICE_REG32_W(0x10800094,&GPS_SRIO_DATA[0][0]);
// count = WriteFpgaByDioSockets_nwrite_mk(0x00000000,(Uint8*) DSP_GPS_Data_Addr,1024);    //传输
/* Pass the control to the driver DIO Tx Completion ISR handler */
Srio_dioTxCompletionIsr ((Srio_DrvHandle)argument, hSrioCSL);//该行代码DSP应用程序通过直接io方式发送数据时,由中断ISR调用
DEVICE_REG32_W(0x1080008C,count);
if(fifo_flag>9){
DEVICE_REG32_W(0x10800100,fifo_flag);
GPS_CalculateFW();
}
else{
GPS_Navfifo();
fifo_flag++;
DEVICE_REG32_W(0x10800104,fifo_flag);
}
TransmitGPSDataBuffer((Uint64*)DSP_GPS_Data_Addr, PROTOCOL_DATA_LEN, CHANNEL);

// System_printf("waiting for doorbell!\n");
CSL_SRIO_ClearDoorbellPendingInterrupt(hSrioCSL, 0, doorbellStatus);

return;
}

传输文件:

Int32 WriteFpgaByDioSockets_nwrite_mk (Uint32 uiAddr,Void* hBuffer,Uint32 uiSize)
{
Srio_SockHandle srioSocket;
Srio_SockBindAddrInfo bindInfo;
Srio_SockAddrInfo to;
//UInt8 *srcDataBufPtr = NULL;

/* Open DIO SRIO Non-Blocking Socket */
srioSocket = Srio_sockOpen (hDrvManagedSrioDrv, Srio_SocketType_DIO, FALSE);
if (srioSocket == NULL)
{
System_printf ("Error: Unable to open the DIO socket \n");
return -1;
}

/* DIO Binding Information: Use 16 bit identifiers and we are bound to the first source id.
* and we are using 16 bit device identifiers. */
bindInfo.dio.doorbellValid = 0;
bindInfo.dio.intrRequest = 0;
bindInfo.dio.supInt = 0;
bindInfo.dio.xambs = 0;
bindInfo.dio.priority = 0;
bindInfo.dio.outPortID = 0;
bindInfo.dio.idSize = 1;
bindInfo.dio.srcIDMap = 0;
bindInfo.dio.hopCount = 0;
bindInfo.dio.doorbellReg = 0;
bindInfo.dio.doorbellBit = 0;

/* Bind the SRIO socket: DIO sockets do not need any binding information. */
if (Srio_sockBind_DIO (srioSocket, &bindInfo) < 0)
{
System_printf ("Error: Binding the SIO socket failed.\n");
return -1;
}

to.dio.rapidIOMSB = 0x0;
to.dio.rapidIOLSB = uiAddr;
to.dio.dstID = srioDeviceInfo.uiDeviceID4_16Bit;
to.dio.ttype = Srio_Ttype_Write_NWRITE;
to.dio.ftype = Srio_Ftype_WRITE;

UInt8 *srcBuf = hBuffer;
/* Send the DIO Information. */
if (Srio_sockSend_DIO (srioSocket, (Srio_DrvBuffer)srcBuf, uiSize, (Srio_SockAddrInfo*)&to) < 0)
{
return -1;
}

if(Srio_sockClose (srioSocket) < 0)
{
return -1;
}

return 0;SrioInterface.c

8 个回复