下面是个简单的例子 供参考 谢谢!
void Pcie_init_interrupt()
[
printf("**************************************************n");
printf("****************** PCIE MSI Testing ****************n");
printf("**************************************************n");
/************************************************
*************** INTC Configuration *************
************************************************/
printf("Debug: GEM-INTC Configuration...n");
/* INTC module initialization */
intcContext.eventhandlerRecord = EventHandler;
intcContext.numEvtEntries = 10;
if (CSL_intcInit(&intcContext) != CSL_SOK)
[
printf("Error: GEM-INTC initialization failedn");
return;
]
/* Enable NMIs */
if (CSL_intcGlobalNmiEnable() != CSL_SOK)
[
printf("Error: GEM-INTC global NMI enable failedn");
return;
]
/* Enable global interrupts */
if (CSL_intcGlobalEnable(&state) != CSL_SOK)
[
printf("Error: GEM-INTC global enable failedn");
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, 17, &vectId , NULL);
if (hTest == NULL)
[
printf("Error: GEM-INTC Open failedn");
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)
[
printf("Error: GEM-INTC Plug event handler failedn");
return;
]
/* Enabling the events. */
if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
[
printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failedn");
return;
]
printf("Debug: GEM-INTC Configuration Completedn");
]
/*
* ======== main ========
*/
void main()
[
//Task_Handle task;
//Error_Block eb;
pcieRet_e retVal;
printf("enter main()n");
#if 0
Error_init(&eb);
task = Task_create(taskFxn, NULL, &eb);
if (task == NULL) [
System_printf("Task_create() failed!n");
BIOS_exit(0);
]
#endif
Pcie_init_interrupt();
//Hwi_enableInterrupt(5);
//! initialize PCIe Module
/* Set the PCIe mode*/
if ((retVal = Pcie_setMode(PcieModeGbl)) != pcie_RET_OK) [
printf("Set PCIe Mode failed (%d)n", (int)retVal);
exit(1);
]
/* Power up PCIe Module */
if ((retVal = pciePowerCfg()) != pcie_RET_OK) [
printf("PCIe Power Up failed (%d)n", (int)retVal);
exit(1);
]
//enable PCIe MSI Interrupt
MSI0_IRQ_ENABLE_SET = 0xF; //enable MSI_0/8/16/24
MSI_IRQ = 0x8;
//BIOS_start(); /* enable interrupts and start SYS/BIOS */
]
下面是个简单的例子 供参考 谢谢!
void Pcie_init_interrupt()
[
printf("**************************************************n");
printf("****************** PCIE MSI Testing ****************n");
printf("**************************************************n");
/************************************************
*************** INTC Configuration *************
************************************************/
printf("Debug: GEM-INTC Configuration...n");
/* INTC module initialization */
intcContext.eventhandlerRecord = EventHandler;
intcContext.numEvtEntries = 10;
if (CSL_intcInit(&intcContext) != CSL_SOK)
[
printf("Error: GEM-INTC initialization failedn");
return;
]
/* Enable NMIs */
if (CSL_intcGlobalNmiEnable() != CSL_SOK)
[
printf("Error: GEM-INTC global NMI enable failedn");
return;
]
/* Enable global interrupts */
if (CSL_intcGlobalEnable(&state) != CSL_SOK)
[
printf("Error: GEM-INTC global enable failedn");
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, 17, &vectId , NULL);
if (hTest == NULL)
[
printf("Error: GEM-INTC Open failedn");
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)
[
printf("Error: GEM-INTC Plug event handler failedn");
return;
]
/* Enabling the events. */
if (CSL_intcHwControl(hTest,CSL_INTC_CMD_EVTENABLE, NULL) != CSL_SOK)
[
printf("Error: GEM-INTC CSL_INTC_CMD_EVTENABLE command failedn");
return;
]
printf("Debug: GEM-INTC Configuration Completedn");
]
/*
* ======== main ========
*/
void main()
[
//Task_Handle task;
//Error_Block eb;
pcieRet_e retVal;
printf("enter main()n");
#if 0
Error_init(&eb);
task = Task_create(taskFxn, NULL, &eb);
if (task == NULL) [
System_printf("Task_create() failed!n");
BIOS_exit(0);
]
#endif
Pcie_init_interrupt();
//Hwi_enableInterrupt(5);
//! initialize PCIe Module
/* Set the PCIe mode*/
if ((retVal = Pcie_setMode(PcieModeGbl)) != pcie_RET_OK) [
printf("Set PCIe Mode failed (%d)n", (int)retVal);
exit(1);
]
/* Power up PCIe Module */
if ((retVal = pciePowerCfg()) != pcie_RET_OK) [
printf("PCIe Power Up failed (%d)n", (int)retVal);
exit(1);
]
//enable PCIe MSI Interrupt
MSI0_IRQ_ENABLE_SET = 0xF; //enable MSI_0/8/16/24
MSI_IRQ = 0x8;
//BIOS_start(); /* enable interrupts and start SYS/BIOS */
]
举报