程序本来是用来进行SRIO doorbell中断的,但是接收到doorbell信息后,程序没有进入相应的中断,调试的时候写了一个直接触发映射到的INT4程序,发现该程序确实无法进入相应的中断,请求协助~。不知道是不是CSL_intcPlugEventHandler这一块出了问题,调试的时候,触发中断之后,程序就跑飞了。还有请问CSL_IntcContext intcContext; 这个参数的意义,以及后面数值的设置有没有什么道理。看了一些设置好像都是自己想怎么弄怎么弄的。
void main(void)
{
volatile int i;
int *ptrRcvData;
InitPLL1();
EnablePeripheral(); // 打开SRIO等外设
initInt();
ptrRcvData = (int *)DSP1_SRIO_RCV_ADDR;
for(i=0; i<(DSP1_SRIO_DATA_BYTES/4); i++)
{
*(ptrRcvData + i) = 0; // 清空内存空间
}
//void InitSRIO(unsigned int srio_source_id,unsigned int portCfg)
// portCfg=14: 1p4x
// portCfg=41: 4p1x
//InitSRIO_1(0x006f0001,41); //初始化SRIO
DSP1InitSRIO(0x00000001,41); //初始化SRIO
enableISR();
while(1)
{
asm(" NOP 9");
// RIO_INTDST0_RATE_CNTL = 0xffffffff;
// RIO_INTDST1_RATE_CNTL = 0xffffffff;
}
}
/*-----------------------------------------------------------------------*/
void eventSrioHandler(void *handle)
{
volatile int i;
int *ptrRcvData;
ptrRcvData = (int *)DSP1_SRIO_RCV_ADDR;
for(i=0; i<(DSP1_SRIO_DATA_BYTES/4); i++)
{
*(ptrRcvData + i) = 0x55555555; // 清空内存空间
}
// initInt();
RIO_INTDST0_RATE_CNTL = 0x1;
RIO_INTDST1_RATE_CNTL = 0x1;
}
void initInt()
{
CSL_IntcContext intcContext;
CSL_IntcGlobalEnableState state;
CSL_IntcEventHandlerRecord EventRecord;
CSL_IntcParam vectId;
CSL_Status status;
CSL_IntcObj SrioIntcObj;
CSL_IntcHandle SrioIntcHandle;
CSL_IntcEventHandlerRecord record[11];
RIO_DOORBELL0_ICCR = 0xffffffff;
RIO_DOORBELL1_ICCR = 0xffffffff;
RIO_DOORBELL2_ICCR = 0xffffffff;
RIO_DOORBELL3_ICCR = 0xffffffff;
DSP_EVTCLR0 = 0xffffffff;
DSP_EVTCLR1 = 0xffffffff;
DSP_EVTCLR2 = 0xffffffff;
DSP_EVTCLR3 = 0xffffffff;
intcContext.eventhandlerRecord = record;
intcContext.numEvtEntries = 11;
status = CSL_intcInit(&intcContext);
if (status != CSL_SOK) {
printf("Intc initialization failed\n");
return;
}
/* Enable NMIs */
status = CSL_intcGlobalNmiEnable();
if (status != CSL_SOK) {
printf("Intc global NMI enable failed\n");
return;
}
/* Enable global interrupts */
status = CSL_intcGlobalEnable(&state);
if (status != CSL_SOK) {
printf ("Intc global enable failed\n");
return;
}
/* Opening intc module */
vectId = CSL_INTC_VECTID_4;
SrioIntcHandle = CSL_intcOpen (&SrioIntcObj, 21, \
&vectId , NULL);
if (SrioIntcHandle == NULL) {
printf("Intc open failed\n");
return;
}
EventRecord.handler = &eventSrioHandler;
EventRecord.arg = (void*)(SrioIntcHandle);
status = CSL_intcPlugEventHandler(SrioIntcHandle,&EventRecord);
if (status != CSL_SOK) {
printf("Intc plug event handler failed\n");
return;
}
status = CSL_intcHwControl(SrioIntcHandle, CSL_INTC_CMD_EVTCLEAR, NULL);
if (status != CSL_SOK) {
printf("Intc plug event handler failed\n");
return;
}
status = CSL_intcHwControl(SrioIntcHandle, CSL_INTC_CMD_EVTENABLE, NULL);
if (status != CSL_SOK) {
printf("Intc plug event handler failed\n");
return;
}
}
void enableISR()
{
asm(" MVK 10h, B1");
asm(" MVC B1, ISR");
asm(" NOP");
}