Hwi_create()创建两个Hwi对象,出现错误。

#include <xdc/std.h>

#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/hal/Hwi.h>
#include<ti/sysbios/BIOS.h>

Bool Hwi5 = FALSE;
Bool Hwi6 = FALSE;

main(Void){
Hwi_Params hwiParams;
Hwi_Handle myHwi;
Error_Block eb;
Error_init(&eb);
Hwi_Params_init(&hwiParams);

hwiParams.arg = 12;
hwiParams.enableInt = FALSE;

myHwi = Hwi_create(6,myIsr6,&hwiParams,&eb);
if(myHwi == NULL){
System_abort("Hwi create failed");
}
Hwi_enableInterrupt(5);
Hwi_enableInterrupt(6);

BIOS_start();

}

Void myIsr5(UArg arg)
{
if(arg == 10){
Hwi5 = TRUE;
}
}
Void myIsr6(UArg arg)
{
if(arg == 12){
Hwi6 = TRUE;
}
}

Void myIdleFunc()
{
if(Hwi5 && Hwi6){
System_printf("Both interrupts have occurred");
System_exit(0);
}
}

部分配置函数:

xdc.useModule('ti.sysbios.BIOS');
xdc.useModule('xdc.runtime.System');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
var hwiParams = new Hwi.Params;
hwiParams.arg = 10;
hwiParams.enableInt = false;

Hwi.create(5,"&myIsr5",hwiParams);
var Idle = xdc.useModule(ti.sysbios.knl.Idle);

Idle.addFunc('&myIdleFunc');

采用静态创建和动态创建的方式创建了两个中断,一个是中断5,一个是中断6.在编译时出现如下错误:

Description Resource Path Location Type
#20 identifier "myIsr6" is undefined main.c /Hwi_interrupt line 25 C/C++ Problem
wrong type of argument: hwiFxn .xdchelp /Hwi_interrupt line 103 C/C++ Problem

是我对Hwi_create()函数的理解有错误嘛?myIsr5,myIsr6需要重新定义吗?怎么样才能解决这个问题呢?谢谢大家的帮助!

1 个回复