程序:IPC_example_on_C6678
疑问:为什么这个程序中没有中断向量(即.asm文件)?
个人的一些理解:查阅了相关问题贴,有技术人员说是使用了csl文件进行了中断映射。我看了程序,猜想函数ipcregisterInterrupt()与中断向量的功能是等价的,对于这个仅仅是猜想,还不确定,所以向各位技术大佬求证一下。如果等价,那么我是否可以把这一段注释,然后在中断向量中写呢?
附录:函数ipcregisterInterrupt() 的代码
int32_t ipcregisterInterrupt()
{
uint32_t i;
uint32_t event;
uint32_t vector;
uint32_t core;
uint32_t coreID = CSL_chipReadReg (CSL_CHIP_DNUM);
CSL_IntcEventHandler isr;
for (i=0; i<MAX_CORE_NUM; i++)
{
coreVector[i] = 0;
}
for (i=0; i<MAX_SYSTEM_VECTOR; i++)
{
core = intInfo[i].core;
if (coreID == core)
{
event = intInfo[i].event;
vector = intInfo[i].vect;
isr = intInfo[i].isr;
if (MAX_CORE_VECTOR <= coreVector[core])
{
printf("Core %d Vector Number Exceed\n");
}
//该语句就是将CIC送给Core的system event x绑定Corepac的中断序号
//intcObj[vector]中就是eventID与绑定的INTID
// CSL_intcOpen()的返回值
// CSL_SOK Valid intc handle is returned
// CSL_ESYS_FAIL The open command failed
hintc[vector] = CSL_intcOpen (&intcObj[vector], event, (CSL_IntcParam*)&vector , NULL);
if (hintc[vector] == NULL)
{
printf("Error: GEM-INTC Open failed\n");
return -1;
}
/* Register an call-back handler which is invoked when the event occurs. */
EventRecord.handler = isr;
EventRecord.arg = 0;
if (CSL_intcPlugEventHandler(hintc[vector],&EventRecord) != CSL_SOK)
//将一个event-handler分配给event,所以当event产生时就会生成一个event-handler
{
printf("Error: GEM-INTC Plug event handler failed\n");
return -1;
}
/* clear the events. */
if (CSL_intcHwControl(hintc[vector],CSL_INTC_CMD_EVTCLEAR, NULL) != CSL_SOK)
{
printf("Error: GEM-INTC CSL_INTC_CMD_EVTCLEAR command failed\n");
return -1;
}
/* Enabling the events. */
if (CSL_intcHwControl(hintc[vector],CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
{
printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failed\n");
return -1;
}
coreVector[core]++;
}
}
return 0;
}
