各位好!
我在测试中断过程中遇到了一些问题,希望牛人能给出一点建议!问题描述如下:
1.我参考CSL中断配置事件,如下所示:
/************************************************
*************** INTC Configuration *************
************************************************/
// write_uart("Debug: GEM-INTC Configuration…\n\r");
/* INTC module initialization */
intcContext.eventhandlerRecord = EventHandler;
intcContext.numEvtEntries = 10;
if (CSL_intcInit(&intcContext) != CSL_SOK)
{
// write_uart("Error: GEM-INTC initialization failed n\r");
return;
}
/* Enable NMIs */
if (CSL_intcGlobalNmiEnable() != CSL_SOK)
{
// write_uart("Error: GEM-INTC global NMI enable failed n\r");
return;
}
/* Enable global interrupts */
if (CSL_intcGlobalEnable(&state) != CSL_SOK)
{
// write_uart("Error: GEM-INTC global enable failed \n\r");
return;
}
/* Open the INTC Module for Vector ID: 4 and Event ID: 63 (C6678) 59 (C6670)
* Refer to the interrupt architecture and mapping document for the Event ID (INTC0_OUT3)*/
vectId = CSL_INTC_VECTID_4;
hTest = CSL_intcOpen (&intcObj, INTC0_OUT3, &vectId , NULL);
if (hTest == NULL)
{
// write_uart("Error: GEM-INTC Open failed\n\r");
return;
}
/* Register an call-back handler which is invoked when the event occurs. */
EventRecord.handler = &test_isr_handler;
EventRecord.arg = 0;
if (CSL_intcPlugEventHandler(hTest,&EventRecord) != CSL_SOK)
{
// write_uart("Error: GEM-INTC Plug event handler failed\n\r");
return;
}
/* Enabling the events. */
if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
{
// write_uart("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failed\n\r");
return;
}
// write_uart("Debug: GEM-INTC Configuration Completed \n\r");
/**************************************************
************* CPINTC-0 Configuration *************
**************************************************/
// write_uart("Debug: CPINTC-0 Configuration…\n\r");
/* Open the handle to the CPINT Instance */
hnd = CSL_CPINTC_open(0);
if (hnd == 0)
{
// write_uart("Error: Unable to open CPINTC-0\n\r");
return;
}
/* Disable all host interrupts. */
CSL_CPINTC_disableAllHostInterrupt(hnd);
/* Configure no nesting support in the CPINTC Module. */
CSL_CPINTC_setNestingMode (hnd, CPINTC_NO_NESTING);
/* We now map System Interrupt 0 – 3 to channel 3 */
CSL_CPINTC_mapSystemIntrToChannel (hnd, PCIEXpress_Legacy_INTA, 3);
CSL_CPINTC_mapSystemIntrToChannel (hnd, PCIEXpress_Legacy_INTB, 3);
CSL_CPINTC_mapSystemIntrToChannel (hnd, PCIEXpress_Legacy_INTC, 3);
CSL_CPINTC_mapSystemIntrToChannel (hnd, PCIEXpress_Legacy_INTD, 3);
/* We now enable system interrupt 0 – 3 */
CSL_CPINTC_enableSysInterrupt (hnd, PCIEXpress_Legacy_INTA);
CSL_CPINTC_enableSysInterrupt (hnd, PCIEXpress_Legacy_INTB);
CSL_CPINTC_enableSysInterrupt (hnd, PCIEXpress_Legacy_INTC);
CSL_CPINTC_enableSysInterrupt (hnd, PCIEXpress_Legacy_INTD);
/* We enable host interrupts. */
CSL_CPINTC_enableHostInterrupt (hnd, 3);
/* Enable all host interrupts also. */
CSL_CPINTC_enableAllHostInterrupt(hnd);
该配置能正常进入中断服务函数。
2.当我在该配置后面加上SRIO_Interrupts_Init()时,发现CSL配置的中断(1中所述)发生后不能进入中断服务函数,其中SRIO_Interrupts_Init()函数如下:
void SRIO_Interrupts_Init(void)
{
/*map SRIO doorbell interrupts to INT4.
map message descriptor accumulation low priority channel 0 interrupt to INT5*/
CGEM_regs->INTMUX1 = (CSL_GEM_INTDST_N_PLUS_16<<CSL_CGEM_INTMUX1_INTSEL4_SHIFT)|
(CSL_GEM_QM_INT_LOW_0<<CSL_CGEM_INTMUX1_INTSEL5_SHIFT);
/*Clear all DSP core events*/
CGEM_regs->EVTCLR[0]= 0xFFFFFFFF;
CGEM_regs->EVTCLR[1]= 0xFFFFFFFF;
CGEM_regs->EVTCLR[2]= 0xFFFFFFFF;
CGEM_regs->EVTCLR[3]= 0xFFFFFFFF;
//clear DSP core interrupt flag
ICR= IFR;
//enable INT4, 5
IER = 3|(1<<4)|(1<<5);
/*Interrupt Service Table Pointer to begining of LL2 memory*/
//ISTP= 0x800000;
ISTP= 0x820000;
//enable GIE
TSR = TSR|1;
interrupt_cfg.interrupt_map = interrupt_map;
interrupt_cfg.uiNumInterruptMap = sizeof(interrupt_map)/sizeof(SRIO_Interrupt_Map);
/*interrupt rate control is not used in this test*/
interrupt_cfg.interrupt_rate= NULL;
interrupt_cfg.uiNumInterruptRateCfg= 0;
interrupt_cfg.doorbell_route_ctl= SRIO_DOORBELL_ROUTE_TO_DEDICATE_INT;
srio_cfg.interrupt_cfg = &interrupt_cfg;
}
我调试了很久都不行,不知道哪位能给出建议?
谢谢!
aichen wang:
各位好!
我上面的帖子在1中有个地方写错了,我将vectId = CSL_INTC_VECTID_4 改成了vectId = CSL_INTC_VECTID_9
希望能得到一些帮助!
谢谢!
Shine:
回复 aichen wang:
请问你用的是哪款DSP器件?C5000系列不带SRIO口,请到相应的论坛提问。