Interupt handler help

bridged with qdn.public.qnxrtp.x86
Post Reply
Chris Haidvogel

Interupt handler help

Post by Chris Haidvogel » Wed Sep 10, 2003 9:06 pm

Hello,

I could use some help on a piece of code. I am working with an interupt
handler. I need to find a way to have a function (FuncA) wait for the
interrupt handler (FuncB) to start. I wanted to use a Semaphore (post in
FuncB and wait in FuncA) but that just crashes QNX. Does anyone have any
suggestions?

Thanks,
Chris.

ed1k

Re: Interupt handler help

Post by ed1k » Wed Sep 10, 2003 9:10 pm

In article <bjo30p$sbf$1@inn.qnx.com>, cph@videk.com says...
Hello,

I could use some help on a piece of code. I am working with an interupt
handler. I need to find a way to have a function (FuncA) wait for the
interrupt handler (FuncB) to start. I wanted to use a Semaphore (post in
FuncB and wait in FuncA) but that just crashes QNX. Does anyone have any
suggestions?

Thanks,
Chris.
Hello,

You might want to read Programmer's Guide

http://www.qnx.com/developer/docs/momen ... ndler.html

Shortly, you need InterruptAttach() your ISR (FuncB) and when you return pointer to the event
structure from this ISR, FuncA, previously blocked on InterruptWait() will start its work. Bring
your attention, you're very limited in ISR (FuncB), you can use only interrupt safe operations. ISR
is supposed to deal with hardware (source of interrupt requests) mainly.

Best regards,
Eduard

Bill Caroselli

Re: Interupt handler help

Post by Bill Caroselli » Wed Sep 10, 2003 10:05 pm

ed1k <ed1k@humber.bay> wrote:
ek > In article <bjo30p$sbf$1@inn.qnx.com>, cph@videk.com says...
Hello,

I could use some help on a piece of code. I am working with an interupt
handler. I need to find a way to have a function (FuncA) wait for the
interrupt handler (FuncB) to start. I wanted to use a Semaphore (post in
FuncB and wait in FuncA) but that just crashes QNX. Does anyone have any
suggestions?

Thanks,
Chris.
ek > Hello,

ek > You might want to read Programmer's Guide

ek > http://www.qnx.com/developer/docs/momen ... ndler.html

ek > Shortly, you need InterruptAttach() your ISR (FuncB) and when you return pointer to the event
ek > structure from this ISR, FuncA, previously blocked on InterruptWait() will start its work. Bring
ek > your attention, you're very limited in ISR (FuncB), you can use only interrupt safe operations. ISR
ek > is supposed to deal with hardware (source of interrupt requests) mainly.

I caught one phrase that you said in your original post. Maybe I'm
making more of it than you intended. But you said you wanted FuncA
to wait until FuncB *started*. I don't think this can be done. You
will be notified when FuncB finishes.

David Kuechenmeister

Re: Interupt handler help

Post by David Kuechenmeister » Thu Sep 11, 2003 2:51 pm

This is something that threw me for a while. You can't do much in a QNX ISR.
If your term "interrupt handler" means ISR, then you can't get there. Spend
some time in the QNX programmer's guide and figure out what the architecture
permits. You will end up with an ISR that triggers an Interrupt Handler. The
Interrupt Handler will do most of the work that I would typically expect to
do in an ISR, without the restrictions on making blocking calls.

You probably want to post the sem, or better, send a pulse in the Interrupt
Handler(FcnB) and wait on that message in FcnA. It's kind of roundabout, but
it's what you have to do.

Regards,
Dave Kuechenmeister

"Chris Haidvogel" <cph@videk.com> wrote in message
news:bjo30p$sbf$1@inn.qnx.com...
Hello,

I could use some help on a piece of code. I am working with an interupt
handler. I need to find a way to have a function (FuncA) wait for the
interrupt handler (FuncB) to start. I wanted to use a Semaphore (post in
FuncB and wait in FuncA) but that just crashes QNX. Does anyone have any
suggestions?

Thanks,
Chris.

Chris Haidvogel

Re: Interupt handler help

Post by Chris Haidvogel » Mon Sep 15, 2003 5:13 pm

Thanks for all the good info.

This one is more of an opinion question. The driver I am working on
originally implemented the interrupt using InterruptAttach. This made the
method it called a true life ISR. I would like to rewrite it using an
additional thread and the InterruptAttachEvent funtion. Would I be taking a
performance hit if I reimplement the driver with InterruptAttachEvent?
Also, does anyone know of anywhere I can find a compare/contrast of
implementing a system with either of those commands?

Thanks again.

Chris.


"ed1k" <ed1k@humber.bay> wrote in message
news:MPG.19c96b3f8b302b109896f5@inn.qnx.com...
In article <bjo30p$sbf$1@inn.qnx.com>, cph@videk.com says...
Hello,

I could use some help on a piece of code. I am working with an interupt
handler. I need to find a way to have a function (FuncA) wait for the
interrupt handler (FuncB) to start. I wanted to use a Semaphore (post
in
FuncB and wait in FuncA) but that just crashes QNX. Does anyone have
any
suggestions?

Thanks,
Chris.

Hello,

You might want to read Programmer's Guide


http://www.qnx.com/developer/docs/momen ... ndler.html

Shortly, you need InterruptAttach() your ISR (FuncB) and when you return
pointer to the event
structure from this ISR, FuncA, previously blocked on InterruptWait() will
start its work. Bring
your attention, you're very limited in ISR (FuncB), you can use only
interrupt safe operations. ISR
is supposed to deal with hardware (source of interrupt requests) mainly.

Best regards,
Eduard

Rennie Allen

Re: Interupt handler help

Post by Rennie Allen » Sun Jan 11, 2004 8:00 pm

Chris Haidvogel wrote:
Thanks for all the good info.

This one is more of an opinion question. The driver I am working on
originally implemented the interrupt using InterruptAttach. This made the
method it called a true life ISR. I would like to rewrite it using an
additional thread and the InterruptAttachEvent funtion. Would I be taking a
performance hit if I reimplement the driver with InterruptAttachEvent?
There will be a performance hit in the form of scheduling latency in
addition to the interrupt latency that either approach would experience.
Also, does anyone know of anywhere I can find a compare/contrast of
implementing a system with either of those commands?
If the deadline specs for your app allow you to get away with using
InterruptAttachEvent, then I would recommend using it, since your
handler is then schedulable, permitting improved control.

Post Reply

Return to “qdn.public.qnxrtp.x86”