TI中文支持网
TI专业的中文技术问题搜集分享网站

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

Shine:

一般中断子函数里做的事情越烧越好,这样防止丢中断。能否把SRIO传输的函数放到中断子程序外面运行?

user5301336:

回复 Shine:

那就是在中断中调用任务了,中断并不是执行一次,而是每次都要执行,如果调用任务的话怎么弄?

Shine:

回复 user5301336:

可以在中断子程序中置个标志位。

user5301336:

回复 user5301336:

请问是什么意思?我又试了试,DIO传输那个函数还是不行

user5301336:

回复 Shine:

请问是什么意思?我又试了试,DIO传输那个函数还是不行

Shine:

回复 user5301336:

在中断里flag=1, 主程序里通过判断flag是否执行功能函数。

user5301336:

回复 Shine:

明白您的意思了,我试试~~但是还有个问题呀,执行完BIOS_Start之后,程序等待上位机的信号,开始执行Task,我要功能函数写在什么地方呢?还是直接另外建一个文件,在里面自定义个功能函数?

user5301336:

回复 Shine:

我在上面的HWI中的ISR中调用SRIO的DIO程序,出现了,下面的错误,ti.sysbios.gates.GateMutex:line 97 assertion failure:A badcontext: bad calling context. See gateMutex API doc for detail 。
查了资料,好像是在HWI中调用了molloc,建议创建新的任务,执行任务,这个我要怎么弄?不太懂

赞(0)
未经允许不得转载:TI中文支持网 » DSP中断服务程序中,SRIO传输传输失败,之后不能接受doorbell信号,中断停止了,如果不加传输,中断没有问题
分享到: 更多 (0)