TI论坛
直播中

刘羽扬

7年用户 201经验值
私信 关注
[问答]

pcie中断

如何在CCS5.3自带的例程,就是挂bios的那个例程里加一个数据的中断啊。比如RC发送完数据以中断的方式告诉EP

回帖(5)

高欢

2018-6-19 05:08:05
下面是个简单的例子 供参考 谢谢!
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 */
]
举报

刘羽扬

2018-6-19 05:19:33
引用: liuqin123 发表于 2018-6-19 05:08
下面是个简单的例子 供参考 谢谢!
void Pcie_init_interrupt()
[

谢谢
举报

李常杰

2018-6-19 05:35:43
引用: liuqin123 发表于 2018-6-19 05:08
下面是个简单的例子 供参考 谢谢!
void Pcie_init_interrupt()
[

Thomas Yang1 你好,
请问我在收到这个中断之后,我把数据完成了处理,想回发一个中断给PC端,怎么回发一个中断呢?
我使用的是c6678,请问c6678是作为EP端是吧?PC是RC端?
举报

王玉珍

2018-6-19 05:44:49
引用: liuqin123 发表于 2018-6-19 05:08
下面是个简单的例子 供参考 谢谢!
void Pcie_init_interrupt()
[

您好@Thomas Yang1 
能否将这个例子的工程发上来,目前本人正在调试这个MSI功能,遇到了点困难,感谢!
举报

更多回帖

发帖
×
20
完善资料,
赚取积分