where is interrupt handler program

Hi, everyone
I’m reading a piece of sample program which handles a printer. Once paper is
inserted in it causes a interrupt and send out an event pulse. The program
works well but I can not find the interrrupt handle program anywhere. Can
anyone give me a clue about this? This seems a stupid question :frowning:

SIGEV_PULSE_INIT( &event_paperin, coid, SIGEV_PULSE_PRIO_INHERIT, 0x01,
NULL );

intr_id_paperin = InterruptAttachEvent( 42, &event_paperin,
_NTO_INTR_FLAGS_TRK_MSK | _NTO_INTR_FLAGS_PROCESS );

while ( 1 )
{
printf( “Waiting for Interrupt\n” );
MsgReceivePulse( chid, &pulse, sizeof( pulse ), NULL );
printf( “Recived pulse code: %d\n”, pulse.code );
InterruptUnmask( 42, intr_id_paperin );
}


Thanks,

Jack

The interrupt handler is in the kernel. The InterruptAttachEvent tells the
kernel that upon the IRQ if must deliver the registered event.

“Jack Li” <jli@cardiogenics.com> wrote in message
news:cdmdc1$qg3$1@inn.qnx.com

Hi, everyone
I’m reading a piece of sample program which handles a printer. Once paper
is
inserted in it causes a interrupt and send out an event pulse. The program
works well but I can not find the interrrupt handle program anywhere. Can
anyone give me a clue about this? This seems a stupid question > :frowning:

SIGEV_PULSE_INIT( &event_paperin, coid, SIGEV_PULSE_PRIO_INHERIT, 0x01,
NULL );

intr_id_paperin = InterruptAttachEvent( 42, &event_paperin,
_NTO_INTR_FLAGS_TRK_MSK | _NTO_INTR_FLAGS_PROCESS );

while ( 1 )
{
printf( “Waiting for Interrupt\n” );
MsgReceivePulse( chid, &pulse, sizeof( pulse ), NULL );
printf( “Recived pulse code: %d\n”, pulse.code );
InterruptUnmask( 42, intr_id_paperin );
}


Thanks,

Jack

Thanks, It’s still wierd to me because this interrupt is caused by a printer
connected to a serial port. As in InterruptAttachEvent( 42, &event_paperin,
_NTO_INTR_FLAGS_TRK_MSK | _NTO_INTR_FLAGS_PROCESS ); the interrupt number
is 42, since it is not a soft interrupt there should be a user programmed
handler to cope with the specific interrupt signal. or is there anything
special with interrupt 42?

The interrupt handler is in the kernel. The InterruptAttachEvent tells
the
kernel that upon the IRQ if must deliver the registered event.

“Jack Li” <> jli@cardiogenics.com> > wrote in message
news:cdmdc1$qg3$> 1@inn.qnx.com> …
Hi, everyone
I’m reading a piece of sample program which handles a printer. Once
paper
is
inserted in it causes a interrupt and send out an event pulse. The
program
works well but I can not find the interrrupt handle program anywhere.
Can
anyone give me a clue about this? This seems a stupid question > :frowning:

SIGEV_PULSE_INIT( &event_paperin, coid, SIGEV_PULSE_PRIO_INHERIT, 0x01,
NULL );

intr_id_paperin = InterruptAttachEvent( 42, &event_paperin,
_NTO_INTR_FLAGS_TRK_MSK | _NTO_INTR_FLAGS_PROCESS );

while ( 1 )
{
printf( “Waiting for Interrupt\n” );
MsgReceivePulse( chid, &pulse, sizeof( pulse ), NULL );
printf( “Recived pulse code: %d\n”, pulse.code );
InterruptUnmask( 42, intr_id_paperin );
}


Thanks,

Jack
\

Jack Li wrote:

Thanks, It’s still wierd to me because this interrupt is caused by a printer
connected to a serial port. As in InterruptAttachEvent( 42, &event_paperin,
_NTO_INTR_FLAGS_TRK_MSK | _NTO_INTR_FLAGS_PROCESS ); the interrupt number
is 42, since it is not a soft interrupt there should be a user programmed
handler to cope with the specific interrupt signal. or is there anything
special with interrupt 42?

There is an ISR, it’s internal to the OS. It’s sole job is to mask the
interrupt, and dispatch the event associated with it to the thread which
did the InterruptAttachEvent(). You could accomplish the same thing
with a user defined ISR (ie. via InterruptAttach()), returning an event
to wake up a user thread - but then why bother if all you care about is
notification?


Cheers,
Adam

QNX Software Systems Ltd.
[ amallory@qnx.com ]

With a PC, I always felt limited by the software available.
On Unix, I am limited only by my knowledge.
–Peter J. Schoenster <pschon@baste.magibox.net>