TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320C6678: 关于SRIO中断设置的问题

Part Number:TMS320C6678Other Parts Discussed in Thread:SYSBIOS

下面是SRIO例程中设置中断的部分代码:

 

/* SRIO DIO Interrupts need to be routed from the CPINTC0 to GEM Event.*  - We have configured DIO Interrupts to get routed to Interrupt Destination 0*(Refer to the CSL_SRIO_RouteLSUInterrupts API configuration in the SRIO Initialization)*  - We want this System Interrupt to mapped to Host Interrupt 8 *//* Disable Interrupt Pacing for INTDST0 */CSL_SRIO_DisableInterruptPacing (hSrioCSL, 0);/* Route LSU0 ICR0 to INTDST0 */CSL_SRIO_RouteLSUInterrupts (hSrioCSL, 0, 0);/* Route LSU0 ICR1 to INTDST0 */CSL_SRIO_RouteLSUInterrupts (hSrioCSL, 1, 0);/* Route LSU0 ICR2 to INTDST0 */CSL_SRIO_RouteLSUInterrupts (hSrioCSL, 2, 0);/* Map the System Interrupt i.e. the Interrupt Destination 0 interrupt to the DIO ISR Handler. */CpIntc_dispatchPlug(CSL_INTC0_INTDST0, (CpIntc_FuncPtr)myDioTxCompletionIsr, (UArg)hSrioDrv, TRUE);/* The configuration is for CPINTC0. We map system interrupt 112 to Host Interrupt 8. */CpIntc_mapSysIntToHostInt(0, CSL_INTC0_INTDST0, 8);/* Enable the Host Interrupt. */CpIntc_enableHostInt(0, 8);/* Enable the System Interrupt */CpIntc_enableSysInt(0, CSL_INTC0_INTDST0);/* Get the event id associated with the host interrupt. */eventId = CpIntc_getEventId(8);/* Plug the CPINTC Dispatcher. */EventCombiner_dispatchPlug (eventId, CpIntc_dispatch, 8, TRUE);

然后我在sysbios中也看到一个示例代码如下:

  Int i;Int eventId;Hwi_Params hwiParams;Int hostInt, sysInt;Error_Block eb;// Initialize the error blockError_init(&eb);// Map 3 System interrupts (33-35) to a single Host interrupt (1).sysInt = 33;hostInt = 1;for (i = 0; i < 3; i++) {// Map System interrupts to the Host interrupt on Intc 0CpIntc_mapSysIntToHostInt(0, sysInt + i, hostInt);// Plug and enable the function and argument for System interruptsCpIntc_dispatchPlug(sysInt + i, myIsr, sysInt + i, TRUE);}// Enable the Host interrupt on Intc 0CpIntc_enableHostInt(0, hostInt);// Get the eventId associated with the Host interrupteventId = CpIntc_getEventId(hostInt);// Plug the event associated with Host Interrupt.// The function must be 'CpIntc_dispatch' and argument 'hostInt'.EventCombiner_dispatchPlug(eventId, &CpIntc_dispatch, hostInt, TRUE);// Initialize the Hwi parametersHwi_Params_init(&hwiParams);// The eventId must be set to the combined eventhwiParams.eventId = (eventId / 32);// The arg must be set to hwiParams.eventIdhwiParams.arg = hwiParams.eventId;// Enable the interrupt.hwiParams.enableInt = TRUE;// Create the Hwi on interrupt 9 then specify 'EventCombiner_dispatch'// as the function.Hwi_create(9, &EventCombiner_dispatch, &hwiParams, NULL);

针对以上代码,我有几点不明白的地方:

1、SRIO例程中的CSL_SRIO_DisableInterruptPacing (hSrioCSL, 0)这个函数的作用不太理解;

2、SRIO例程中EventCombiner_dispatchPlug (eventId, CpIntc_dispatch, 8, TRUE)这个函数的第二个参数是CpIntc_dispatch,而sysbios示例代码中这个函数的第二个参数是&CpIntc_dispatch,这是为什么呢?

3、SRIO例程中没有调用Hwi_create来映射event id到可屏蔽中断号,而sysbios示例代码中是有的,这是为什么呢?
希望专家或前辈能够解答一下,谢谢!

Nancy Wang:

請問第一個SRIO代碼的具體在哪裏?

1、參考2.3.9.4 Interrupt Pacing

https://www.ti.com.cn/cn/lit/ug/sprugw1c/sprugw1c.pdf

2、取值應該是一樣的,建議還是參照函數原型定義。

Void CpIntc_dispatchPlug(UInt sysInt, CpIntc_FuncPtr fxn, UArg arg, Bool unmask);

typedef Void (*CpIntc_FuncPtr)(UArg);

software-dl.ti.com/…/CpIntc.html

,

user6501245:

非常感谢您的解答!

第一个SRIO代码在ti\pdk_C6678_1_1_2_6\packages\ti\drv\srio\example\SRIOLoopbackDioIsr路径下的loopbackDioIsr.c中

但是关于第2个问题我还是存疑,因为

Void CpIntc_dispatch(UInt hostInt);
CpIntc_dispatch和&CpIntc_dispatch不应该是两个东西吗?
另外还有第3个问题麻烦能解答一下

,

Nancy Wang:

user6501245 说:CpIntc_dispatch和&CpIntc_dispatch不应该是两个东西吗?

取函数的首地址,这两种写法应该都是可以的,这个例程是其它工程师编写的,详细情况我这边也不清楚,应该不会有问题。

关于第三个问题,您可以通过ROV工具看一下HWI的配置情况,cfg中也有HWI的配置。

* Enable Event Groups here and registering of ISR for specific GEM INTC is done * using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs */ECM.eventGroupHwiNum[0] = 7;ECM.eventGroupHwiNum[1] = 8;ECM.eventGroupHwiNum[2] = 9;ECM.eventGroupHwiNum[3] = 10;

pdk_c667x_2_0_16\packages\ti\drv\srio\example\SRIOLoopbackDioIsr\c6678\c66\bios\loopbackDioIsr.cfg 这个工程可能不是直接在代码中配置的。

赞(0)
未经允许不得转载:TI中文支持网 » TMS320C6678: 关于SRIO中断设置的问题
分享到: 更多 (0)

© 2024 TI中文支持网   网站地图 鲁ICP备2022002796号-1