resource manager - urgent help please.

Hi all!

I’m currently busy programming a resource manager for a digital io card
using QNX 6.1.
I am using the resource manager READ to read the state of the digital inputs
and the WRITE to write to the
digital outputs.

Heres the problem: The digital io card generates an interrupt when a digital
input changes state and I need to propagate this
asyncronous event through to the client application which is using my
resource manager.

I would really like to use the interrupt feature of this card to prevent
constant polling.

How / Would / Could I use a pulse, message or other method to signal to the
client process that an interrupt has occurred?

Any ideas will be greatly appreciated!

Yours sincerely,
Grant Kruger

I’m currently busy programming a resource manager for a digital io card
using QNX 6.1.
I am using the resource manager READ to read the state of the digital inputs
and the WRITE to write to the
digital outputs.

Heres the problem: The digital io card generates an interrupt when a digital
input changes state and I need to propagate this
asyncronous event through to the client application which is using my
resource manager.

I would really like to use the interrupt feature of this card to prevent
constant polling.

How / Would / Could I use a pulse, message or other method to signal to the
client process that an interrupt has occurred?

Any ideas will be greatly appreciated!

If you are using read() and write() for data transfer I would be
very tempted to use ionotify() for notification. I have done it for
a couple of smaller projects. As well you could use MsgDeliverEvent().


regards,
Tom

Thanks a lot! I got the multithreaded resource manager working using
MsgDeliverEvent!
The client uses a DEVCTL command to initialiate the notifiction scheme and
passes its connection id to the resource manager.

The resource manager records all the clients connection id’s and reply id’s
in a list which have requested notifiction on the digital io cards ISR.

When an ISR occurres, it generates a pulse (InterruptAttachEvent) - which is
received by a blocked thread, which then sends notifiction pulses to all the
clients in the list.

how does that sound? A bit long winded? Hey, but it works!.. the only
question is - how well?
I guess a better way would be to use IONOTIFY. What function do you call to
use the IONOTIFY of the resource manager?
(eg: (cid = open ("/dev/…", O_RDONLY); causes the OPEN function of the
resource manager to execute.)

Anyway, thanks once again for all your help.

Regards,
Grant Kruger



Thomas Emberson <temberson@softwareremodeling.com> wrote in message
news:ajeh1q$re5$1@inn.qnx.com

I’m currently busy programming a resource manager for a digital io card
using QNX 6.1.
I am using the resource manager READ to read the state of the digital
inputs
and the WRITE to write to the
digital outputs.

Heres the problem: The digital io card generates an interrupt when a
digital
input changes state and I need to propagate this
asyncronous event through to the client application which is using my
resource manager.

I would really like to use the interrupt feature of this card to
prevent
constant polling.

How / Would / Could I use a pulse, message or other method to signal to
the
client process that an interrupt has occurred?

Any ideas will be greatly appreciated!


If you are using read() and write() for data transfer I would be
very tempted to use ionotify() for notification. I have done it for
a couple of smaller projects. As well you could use MsgDeliverEvent().


regards,
Tom

grant kruger <a@b.c> wrote:

Thanks a lot! I got the multithreaded resource manager working using
MsgDeliverEvent!
The client uses a DEVCTL command to initialiate the notifiction scheme and
passes its connection id to the resource manager.

The resource manager records all the clients connection id’s and reply id’s
in a list which have requested notifiction on the digital io cards ISR.

When an ISR occurres, it generates a pulse (InterruptAttachEvent) - which is
received by a blocked thread, which then sends notifiction pulses to all the
clients in the list.

how does that sound? A bit long winded? Hey, but it works!.. the only
question is - how well?
I guess a better way would be to use IONOTIFY. What function do you call to
use the IONOTIFY of the resource manager?
(eg: (cid = open ("/dev/…", O_RDONLY); causes the OPEN function of the
resource manager to execute.)

For handling ionotify, check out
http://www.qnx.com/developer/docs/momentics_nc_docs/neutrino/prog/resmgr.html
There is a decent section titled Handling ionotify() and
select().

As far as which approach is better, my gut feel is the devctl()
and MsgDeliverEvent are probably the most effecient, assuming
the way you deal with clients lists is as, or more effecient
than the way the resmgr handles the ionotify client list. I
picked the ionotify since it was the quickest and resmge did
more work. I only have very sparse events to worry about.


regards,
Tom

grant kruger <a@b.c> wrote:

Thanks a lot! I got the multithreaded resource manager working using
MsgDeliverEvent!
The client uses a DEVCTL command to initialiate the notifiction scheme and
passes its connection id to the resource manager.

The resource manager records all the clients connection id’s and reply id’s
in a list which have requested notifiction on the digital io cards ISR.

When an ISR occurres, it generates a pulse (InterruptAttachEvent) - which is
received by a blocked thread, which then sends notifiction pulses to all the
clients in the list.

how does that sound? A bit long winded? Hey, but it works!.. the only
question is - how well?
I guess a better way would be to use IONOTIFY. What function do you call to
use the IONOTIFY of the resource manager?
(eg: (cid = open ("/dev/…", O_RDONLY); causes the OPEN function of the
resource manager to execute.)

I’m not sure that an IONOTIFY will gain you anything. It is a set of
convenience functions for handling adding/removing notifications
dynamically, and having a pseudo-automatic way of deciding and handling
different types of notifications.

Most of that is baggage that you probably don’t need, so you are probably
better off with your own custom way of doing it here.

(Well, IONOTIFY does buy you select() handling if that is important to
you.)

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

Thanks for the comments.

The ISR events i am checking for are VERY sparse(int on limit sw) so as far
as simplicity & time to code goes, I gained a few points there :wink: of course
the list class I wrote is VERY basic, but then the list is VERY short (I’ve
limited it to 10 clients max)… so overall I feel everything is nicely
balanced and performance should be good. :slight_smile:

Thanks again for all your help.

Regards,
-Grant