vxworks进入中断后程序就挂了,怎么回事?
#include "vxWorks.h"
//#include "cacheLib.h"
#include "memLib.h"
//#include "iv.h"
#include "intLib.h"
#include "sysLib.h"
#include "stdio.h"
//#include "m8260IntrCtl.h"
#include "ioLib.h"
#include "logLib.h"
#include "taskLib.h"
#include "ads8260.h"
//#defineM8260_SIMR_L(base)((volatile int *) ((base) + 0x010C20))
#defineM8260_SIMR_H(base)((volatile int *) ((base) + 0x010C1C))
#defineM8260_SIPNR_H(base)((volatile int *) ((base) + 0x010c08))
IMPORT int vxImmrGet(void);
int irq = 0;
void IRQ_6()
{
//int i = * M8260_SIMR_H(0xff000000);
//logMsg("IRQ_6! SIMR = %x \n",i,0,0,0,0,0);
int immrVal = 0xff000000;
logMsg("6",0,0,0,0,0,0);
irq = 6;
*M8260_SIPNR_H(0xff000000) = 0x00000200;
}
void IRQ_5()
{
//int i = * M8260_SIMR_H(0xff000000);
//logMsg("IRQ_5! SIMR = %x \n",i,0,0,0,0,0);
int immrVal = 0xff000000;
logMsg("5",0,0,0,0,0,0);
irq = 5;
*M8260_SIPNR_H(0xff000000) = 0x00000400;
}
void simr_h_read(void)
{
int simr = * M8260_SIMR_H(0xff000000);
printf("M8260_SIMR_H = %x\n",simr);
printf("irq = %d\n",irq);
}
void p_i(void)
{
while(1)
{
int simr = * M8260_SIMR_H(0xff000000);
printf("M8260_SIMR_H = %x\n",simr);
printf("irq = %d\n",irq);
taskDelay(10);
}
}
void test_irq(void)
{
int immrVal = 0xff000000;//vxImmrGet();
printf("test_irq.begin\n");
m8260IntDisable(INUM_IRQ6);
m8260IntDisable(INUM_IRQ5);
//immrVal = vxImmrGet();
/* * M8260_SIMR_H(immrVal) &= ~0x00000600;*/
intConnect (INUM_TO_IVEC(INUM_IRQ6), (VOIDFUNCPTR)IRQ_6, 0);
intConnect (INUM_TO_IVEC(INUM_IRQ5), (VOIDFUNCPTR)IRQ_5, 0);
/* * M8260_SIMR_H(immrVal) |= 0x00000600;*/
m8260IntEnable(INUM_IRQ6);
m8260IntEnable(INUM_IRQ5);
taskSpawn("002",100,0,50,(FUNCPTR)p_i,0,0,0,0,0,0,0,0,0,0);
printf("test_irq.end\n");
}
[解决办法]
进中断后,屏蔽中断试试
[解决办法]
进中断后,必须清中断,等待下一次中断的到来