|
|
- 关于中断的问题
作者:ANITAZ 时间:2006-5-24 16:51:36
那位大侠帮我看看下面这个中断程序具体的执行顺序是什么啊?我写到机子里,编译老出错。
注:我是新手
/*includes*/
#include "vxWorks.h"
#include "intLib.h"
#include "taskLib.h"
#include "logLib.h"
#include "iv.h"
#include "stdio.h"
/*function prototypes*/
void interruptHandler(int);
void interruptCatcher(void);
/*global*/
#define INTERRUPT_NUM 2
#define INTERRUPT_LEVEL 65
#define ITER1 40
#define LONG_TIME 1000000
#define PRIORITY 100
#define ONE_SECOND 100
void interruptGenerator(void)
{
int i,taskId;
STATUS taskAlive;
if((taskId=taskSpawn("interruptCatcher",PRIORITY,0x100,20000,(FUNCPTR)interruptCatcher,0,0,0,0,0,0,0,0,0,0))==ERROR)
logMsg("taskSpawn interruptCatcher failed\n",0,0,0,0,0,0);
for(i=0;i<ITER1;i++)
{
taskDelay(ONE_SECOND);
if((taskAlive=taskIdVerify(taskId))==OK)
{
logMsg("+++++++++++++++++++++Interrupt generated\n",0,0,0,0,0,0);
}
else
break;
}
logMsg("\n***************interruptGenerator Exited****************\n\n\n\n",0,0,0,0,0,0);
}
void interruptCatcher(void)
{
int i=0,j=0;
STATUS connectId;
//if((connectId=intConnect(INUM_TO_IVEC(INTERRUPT_LEVEL),(VOIDFUNCPTR)interruptHandler,i))==ERROR)
if(intConnect(INUM_TO_IVEC(INTERRUPT_LEVEL),(VOIDFUNCPTR)interruptHandler,0) == ERROR)
logMsg("intConnect failed\n",0,0,0,0,0,0);
for(i=0;i<ITER1;i++)
{
for(j=0;j<LONG_TIME;j++);
logMsg("Normal processing in interruptCatcher\n",0,0,0,0,0,0);
}
logMsg("+++++++++++++++++++++InterruptCatcher Exited\n",0,0,0,0,0,0);
}
void interruptHandler(int arg)
{
int i;
logMsg("-----------------------interrupt caught\n",0,0,0,0,0,0);
for(i=0;i<5;i++)
logMsg("interrupt processing\n",0,0,0,0,0,0);
}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
作者:月下苍狼 时间:2006-5-24 17:12:42
编译出错就查看出错信息
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|