<firstname.lastname@example.org> pí¹e v diskusním pøíspìvku:email@example.com…
David Brdicka <> firstname.lastname@example.org> > wrote:
I have question, about resource manager and incoming pulse from ISR.
I’m writing driver for pci card, and the cards has associated one irq
/* frame of resource manager */
dpp = dispatch_create();
tpp = thread_pool_create());
event.sigev_code = pulse_attach(dpp, MSG_FLAG_ALLOC_PULSE,
event.sigev_notify = SIGEV_PULSE;
event.sigev_priority = EVENT_PRIORITY;
event.sigev_value.sival_int = IRQ_PULSE_EVTVAL;
event.sigev_coid = message_connect(dpp, MSG_FLAG_SIDE_CHANNEL);
Every (20ms) occurs irq, and I do in ISR: “return (&event);”.
I have also special case, that occurs only rarely, described bellow.
int pulse_handler(message_context_t *ctp, int code, unsigned flags,
//… every 20ms I do some useful stuff
// special case
for(idx = 0; idx < 3; idx++)
*pcicardreg = val + idx;
// this causes irq during 2mikro sec and in
MsgReceivePulse(chid, &pulse, sizeof(pulse),
/ / !! QUESTION !! is it possible to receive
event here? and not to
// create another channel, establish a
connection, and for the special
// case returned another “event1”, where I
I temporary resolve it, that I create another channel, establish a
and for the special case I return another pulse “event1”.
chid1 = ChannelCreate();
event1.sigev_coid = ConnectAttach(ND_LOCAL_NODE, 0, chid1, 0, 0));
I think, that it must be possible to do via channel and connection that
creates Resource manager (above).
If I understand you correctly you want to do another
MsgReceivePulse() in your pulse handler and then
based on that fire off another event to the same
based on that fire off not another event, but the same event (“event”) to
channel instead of creating a new channel.
My idea is that I will have two receive function. First receive function is
(from my opinion) in body of thread_poll_start() function, and second
receive function (MsgReceivePulse()) is in pulse_handler. And now I want to
receive still the same “event” from ISR, but only on various places
If that is right then yes you can do that by using
the message_connect() again for event1 and send
In this solution I have one channel, that is created by resource manger
(but I still don’t know its “chid”) and two events (“event”, and “event1”).
Question is, where I find “chid”, that is needed by fce MsgReceivePulse() if
I don’t want to use second channel (chid1 = ChannelCreate()
Note that it is “odd” that you would do a MsgReceivePulse
in this pulse_handler() since if you were multi-threaded
you wouldn’t have any guarantee that some other thread
wouldn’t have already processed/received the pulse.
Perhaps this isn’t the case with your design, but something
to watch for.
At the beginning (3 weeks ago), I used the function for multi thread
resource manager, but week ago I decided, use only one thread, also I
pool_attr.lo_water = 0;
pool_attr.hi_water = 1;
pool_attr.increment = 0;
pool_attr.maximum = 1;
and want to use resmgr_context_alloc() for single thread.
Thomas (toe-mah) Fletcher QNX Software Systems
email@example.com > Neutrino Development Group
(613)-591-0931 > http://www.qnx.com/~thomasf