在技术手册 PRUGW4A (CIC )
中的中断初始化函数中,有些地方请教各位!CSL 中有介绍或者手册中有讲大概都明白!
这三个宏定义不知道定义的是什么作用?
#define QPEND_IDX 5
#define FIRST_QPEND_QUEUE 662
#define FIRST_QPEND_CIC0_OUT_EVENT 56
void setup_qpend_interrupt(Uint16 qnum, Uint16 CorePac_event)
{
Int16 chan;
Int16 sys_event;
Int16 host_event;
CSL_IntcParam vectId1;
/* These are event input index of CIC0 for Que_pend events from Que Manager */ // QMSS 的技术手册在TI 网站没找到,哪里有分享一下。
Uint8 events[10] = {134, 135, 136, 137, 138, 139, 140, 141, 142, 175}; // 这行代码就不知道在干嘛?
/* Step 1: Translate the queue number into the CIC input event. */
/* qnum is expected to be 662..671 */
chan = (qnum – FIRST_QPEND_QUEUE);
if ((chan < 0) || (chan > 10))
{
printf("Invalid Queue Pend queue %d\n", qnum);
return;
}
sys_event = events[chan];
/* Step 2: Map the CIC input event to the CorePac input event
* (which are 56 to 63). */
CSL_CPINTC_disableAllHostInterrupt(cphnd);
CSL_CPINTC_setNestingMode(cphnd, CPINTC_NO_NESTING);
/* Map the input system event to a channel. Note, the
* mapping from channel to Host event is fixed.*/
CSL_CPINTC_mapSystemIntrToChannel(cphnd, sys_event, 0);
/* Enable the system interrupt */
CSL_CPINTC_enableSysInterrupt(cphnd, sys_event);
host_event = CorePac_event – FIRST_QPEND_CIC0_OUT_EVENT; //这是神马意思?
/* Enable the channel (output). */
CSL_CPINTC_enableHostInterrupt(cphnd, host_event);
/* Enable all host interrupts. */
CSL_CPINTC_enableAllHostInterrupt(cphnd);
/* Step 3: Hook an ISR to the CorePac input event. */
vectId1 = CSL_INTC_VECTID_12; //4 through 15 are available
hIntcQmss[QPEND_IDX] = CSL_intcOpen(&intcQmss,
CorePac_event, // selected event ID
&vectId1,
NULL);
/* Hook the ISR */
Record[QPEND_IDX].handler = (CSL_IntcEventHandler)&UartInterrupt;
Record[QPEND_IDX].arg = (void *)CorePac_event;
CSL_intcPlugEventHandler(hIntcQmss[QPEND_IDX],&(Record[QPEND_IDX]));
/* Clear the Interrupt */
CSL_intcHwControl(hIntcQmss[QPEND_IDX],CSL_INTC_CMD_EVTCLEAR,NULL);
/* Enable the Event & the interrupt */
CSL_intcHwControl(hIntcQmss[QPEND_IDX],CSL_INTC_CMD_EVTENABLE,NULL);
return;
}
Allen35065:
你看的这段代码用于C6670对Navigator的QPEND信号的CIC中断映射。
查C6670数据手册,QPEND信号对应CIC0事件134-142,175。查Navigator手册C6670 QPEND QUEUE起始于662。
配置好CIC映射以后,把CIC输出的时间映射到中断12上。
QMSS就是现在的Navigator的手册,可以到网站上下载。