Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

intConnect

218 views
Skip to first unread message

aks

unread,
Nov 19, 2005, 6:46:36 PM11/19/05
to
/* includes */
#include "vxWorks.h"
#include "intLib.h"
#include "taskLib.h"
#include "arch/i86/intI86Lib.h"
#include "logLib.h"
#include "sysLib.h"

/* 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

krishna

unread,
Nov 24, 2005, 5:56:59 AM11/24/05
to
hi aks,
I think the error is in the inConnect line.The interrupt is
not getting properly associated to the interrupt handler.It should not
be:
intConnect(
(VOIDFUNCPTR*)INUM_TO_IVEC(INTERRUPT_LEVEL),
(VOIDFUNCPTR)interruptHandler,
i)
)
instead it should be :
inConnect(

(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.

bravo...@gmail.com

unread,
Nov 27, 2005, 6:21:17 AM11/27/05
to
hey Krishna... the problem still remains unsolved. the shell starts
executing the code and displays as follows:

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

krishna

unread,
Nov 28, 2005, 12:49:17 AM11/28/05
to
hi aks,
Clearly the error is in the interruptCatcher function.Can you
do the following to figure out which API is dying down and resulting in
the exception:
1.Check for the success of sysIntEnable.
2.Give a printf statement after every API and used inside the
interruptCatcher function and observe the output this time.Find out
after which printf statement the exception is arising.
3.Perfrom an objdump (vxWorks version shipped with vxWorks .Can find it
in the Tornado/host/<arch-OS>/bin directory.)on the final image created

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.

0 new messages