/* function prototypes */
void interruptHandler(int);
void interruptCatcher(void);
/* globals */
#define INTERRUPT_NUM 0x60
#define INTERRUPT_LEVEL 4
#define ITER1 5
#define LONG_TIME 1000000
#define PRIORITY 100
#define ONE_SECOND 100
void interruptGenerator(void) /* task to generate the SIGINT signal */{
int i, j, taskId, priority;
STATUS taskAlive;
if((taskId =
taskSpawn("interruptCatcher",PRIORITY,0x100,200,(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);/* suspend interruptGenerator for one second
*/
/* check to see if interruptCatcher task is alive! */
if ((taskAlive = taskIdVerify(taskId)) == OK){
//logMsg("++++++++++++++++++++++++++Interrupt
generated\n",0,0,0,0,0,0);
/* generate hardware interrupt 2 */
if(sysIntEnable(INTERRUPT_LEVEL)== ERROR)
logMsg("level not enabled...\n",0,0,0,0,0,0);
else
logMsg("int level enabled...\n",0,0,0,0,0,0);
if((sysBusIntGen(0x60,INTERRUPT_LEVEL)) == ERROR)
logMsg("Interrupt not generated\n",0,0,0,0,0,0);
else
logMsg("interrupt generated.\n",0,0,0,0,0,0);
}
else /* interruptCatcher is dead */{
logMsg("interruptCatcher is dead,,,:( \n",0,0,0,0,0,0);
break;
}
taskDelay(ONE_SECOND);/* suspend interruptGenerator for one second */
}
logMsg("\n***************interruptGenerator
Exited***************\n\n\n\n",0,0,0,0,0,0);
}
void interruptCatcher(void) /* task to handle the interrupt */ {
int i, j;
STATUS connected;
/* connect the interrupt vector, INTERRUPT_LEVEL, to a specific
interrupt
handler routine ,interruptHandler, and pass an argument, i */
sysIntEnable(INTERRUPT_LEVEL);
if((connected =
intConnect((VOIDFUNCPTR*)INUM_TO_IVEC(INTERRUPT_LEVEL),(VOIDFUNCPTR)interruptHandler,i))
== ERROR)
logMsg("intConnect failed\n",0,0,0,0,0,0);
else {
sysIntEnable(INTERRUPT_LEVEL);
logMsg("connected .\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("\n+++++++++++++++interruptCatcher
Exited+++++++++++++++\n",0,0,0,0,0,0);
}
void interruptHandler(int arg) /* signal handler code */{
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);
}
Hi all,
I am using the code above to call the interruptHandler(...).
interruptCatcher catches interrupt but it doesn't call
intHandler(...)...
Help me with whatever I am doing wrong while using this code...
needed immediate suggestion ...I will apreciate your help
Thanks in advance
(VOIDFUNCPTR*)INUM_TO_IVEC(INT_VEC_GET(INTERRUPT_LEVEL)),
(VOIDFUNCPTR)interruptHandler,
i
)
INT_VEC_GET takes the input as interrupt level and returns the line
number ie,the NUMber corresponding to the VECtor.
INUM_TO_IVEC is used to convert this number(=row no in the IVT) to the
corresponding
ISR vector address.
Enjoy.
cheers-
kaushal.
ector 5 : Illegal Instruction
Program Counter: 0x108f0307
Status Register: 0x00010246
Task: 0x116faff8 "interruptCatcher"
0x116faff8 (interruptCatcher): task 0x116faff8 has had a failure and
has been stopped.
0x116faff8 (interruptCatcher): fatal kernel task-level exception!
then it executed till interrupt generated and iterates in the loop.
the catcher is still not catching the interrupt.
any suggestions...
lookin fwd for some help
Regards
aevi
and mail the instructions in and around that exception one.
printf is undisputedly the best way to solve these problems.
and lastly,you are not trying it out on a simulator are you?
cheers-
kaushal.