This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

使用一个中断号来创建多个timer

Other Parts Discussed in Thread: SYSBIOS

我在使用c6670的timer时,想将4个64位的timer都关联到同一个中断向量上,我通过对寄存器直接操作,将66,68,70,72这四个System event绑定到了system event 2上,然后调用Hwi_create将event 2和中断向量7,以及一个ISR映射到一起。

在这种方式下,可以同时创建4个timer。但是如果我只在核0上创建了timer,当timer计时完成进入ISR时,其他的核也会进入这个ISR。有没有什么方法可以让只有创建timer的核才能进入ISR吗?

谢谢。

我还尝试过使用

var EventCombiner = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');

//var ti_sysbios_family_c64p_EventCombiner = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
EventCombiner.events[66].unmask = true;
EventCombiner.events[66].fxn = '&event66Fxn';
EventCombiner.events[66].arg = 0x66;
EventCombiner.events[68].unmask = true;
EventCombiner.events[68].fxn = '&event68Fxn';
EventCombiner.events[68].arg = 0x68;
EventCombiner.events[70].unmask = true;
EventCombiner.events[70].fxn = '&event66Fxn';
EventCombiner.events[70].arg = 0x70;
EventCombiner.events[72].unmask = true;
EventCombiner.events[72].fxn = '&event68Fxn';
EventCombiner.events[72].arg = 0x72;
// Map event 0 (combined-events 0-31) to vector 4
EventCombiner.dispatchEventGroup(2, 7);

这种不对寄存器直接操作的方式来将多个event映射到一个中断向量上,但是采用这种方式时,如果我只在核0上创建timer,其他的核会

报这种错误

[TMS320C66x_2] ti.sysbios.gates.GateMutex: line 97: assertion failure: A_badContext: bad calling context. See GateMutex API doc for details.
[TMS320C66x_2] xdc.runtime.Error.raise: terminating execution

请问我对中断的用法是不是有什么问题呢?有没有什么方式可以让多个event映射到同一个中断向量上,又能保证当事件触发时,只有一个核会进ISR的方式呢?

  • 按你这种设计,66,68,70,72事件都会输入到4个core上,所以只要有一个事件,每个core都会进入ISR。

    你这里的66,68,70,72是分别由4个core产生事件么?由于每个事件是分别由不同的core产生并响应,所以不需要将这4个事件combiner在一起作为system event2输入到INTC,可以分别将4个事件直接输入到每个core,在每个core上配置将timer事件与相应core的中断向量7映射,这样每个core的中断向量7只会收到本core的timer事件触发。

     

  • 我希望每个核都可以创建四个timer,并且核之间的timer可以相互独立,不出现一个core上的timer产生中断,4个core都进ISR的问题。这可不可以实现呢?

    你所说的“在每个core上配置将timer事件与相应core的中断向量7映射”,具体怎么实现呢?是在各个核的cfg文件里面指定一个timer的事件号和中断向量7绑定吗?