Periodic Interrupts with QNX 4

Has anyone got an example of code which uses a/the timer in QNX to provide
a regular fairly small granularity interrupt (5ms), I have found examples
for
Neutrino but not QNX. I understand Interupt 0 can provide this facility -
how
often does it interrupt and is it related to ticksize ? Do we use signals ?

Previously, Bob miles wrote in comp.os.qnx:

Has anyone got an example of code which uses a/the timer in QNX to provide
a regular fairly small granularity interrupt (5ms), I have found examples
for
Neutrino but not QNX. I understand Interupt 0 can provide this facility -
how
often does it interrupt and is it related to ticksize ? Do we use signals ?

There are two approaches. You can create a timer that fires a proxy every
5ms. In order to insure that the system can give you this granularity, you
need to use clock_setres(). Take a look at the docs on timer_create() for
an example.

You could also attach an interrupt hander to interrupt 0.
If the work you need done is small or you need to minimize
jitter, you can do it in the handler. Otherwise you can
just cause the handler to trigger a proxy by returning the
proxy_id. Then your process in Receive() mode will wake up.
In this case you need to use clock_setres() to adjust the
rate at which Interrupt 0 fires.

\

Mitchell Schoenbrun --------- maschoen@pobox.com

I tried the interrupt to return the proxy with no luck. The interrupt was
firing (
tested it with a flag) but the
proxy (which was inthe return statement of the interrupt) was not waking up
my waiting main program. I compiled the int routine with
-zu and -s (WATCOM) but with no joy —

Any ideas ???

BOB

“Mitchell Schoenbrun” <maschoen@pobox.com> wrote in message
news:Voyager.010508210156.431B@schoenbrun.com

Previously, Bob miles wrote in comp.os.qnx:

Has anyone got an example of code which uses a/the timer in QNX to
provide
a regular fairly small granularity interrupt (5ms), I have found
examples
for
Neutrino but not QNX. I understand Interupt 0 can provide this
facility -
how
often does it interrupt and is it related to ticksize ? Do we use
signals ?

There are two approaches. You can create a timer that fires a proxy every
5ms. In order to insure that the system can give you this granularity,
you
need to use clock_setres(). Take a look at the docs on timer_create() for
an example.

You could also attach an interrupt hander to interrupt 0.
If the work you need done is small or you need to minimize
jitter, you can do it in the handler. Otherwise you can
just cause the handler to trigger a proxy by returning the
proxy_id. Then your process in Receive() mode will wake up.
In this case you need to use clock_setres() to adjust the
rate at which Interrupt 0 fires.

\

Mitchell Schoenbrun --------- > maschoen@pobox.com

Post your code, this does work.


Previously, Bob miles wrote in comp.os.qnx:

I tried the interrupt to return the proxy with no luck. The interrupt was
firing (
tested it with a flag) but the
proxy (which was inthe return statement of the interrupt) was not waking up
my waiting main program. I compiled the int routine with
-zu and -s (WATCOM) but with no joy —

Any ideas ???

Mitchell Schoenbrun --------- maschoen@pobox.com

This is the code that fails to come out of “Receive”


Bob

“Mitchell Schoenbrun” <maschoen@pobox.com> wrote in message
news:Voyager.010511133525.1948B@schoenbrun.com

Post your code, this does work.


Previously, Bob miles wrote in comp.os.qnx:
I tried the interrupt to return the proxy with no luck. The interrupt
was
firing (
tested it with a flag) but the
proxy (which was inthe return statement of the interrupt) was not waking
up
my waiting main program. I compiled the int routine with
-zu and -s (WATCOM) but with no joy —

Any ideas ???

Mitchell Schoenbrun --------- > maschoen@pobox.com

begin 666 INTERRUP.CPP
M(VEN8VQU9&4@(G1Y<&5S+F@B#0HC:6YC;'5D92 B8V]N:6\N:"(-“B-I;F-L
M=61E(”)S=&1I;RYH(@T*(VEN8VQU9&4@(F9C;G1L+F@B#0HC:6YC;'5D92 B
M:3@V+F@B#0HC:6YC;'5D92 B<V5N9&UX+F@B#0HC:6YC;'5D92 B:V5R;F5L
M+F@B#0HC:6YC;'5D92 B97)R;F\N:"(-"@T*(VEN8VQU9&4@(G!R;V-E<W,N
M:"(-"@T*(VEN8VQU9&4@(FUM86XN:"(-“B-I;F-L=61E(”)N86UE+F@B#0HC
M:6YC;‘5D92 B<’)O>'DN:"(-“B-I;F-L=61E(”)I<G%I;F9O+F@B#0HC:6YC
M;‘5D92 B<VEG;F%L+F@B#0H-"G9O:60@8VQI*"D[#0HC<’)A9VUA(&%U>"!C
M;&D@/2 B8VQI(CL-"@T*=F]I9"!S=&DH3L-“B-P<F%G;6$@875X(’-T:2 ]
M(”)S=&DB.PT
#0H-“F5X=&5R;B!U;G-I9VYE9”!C:&%R($EN=&5R<G5P=$9L
M86<[#0IE>‘1E<FX@<&ED7W0@(’!R;WAY.PT*#0IE>'1E<FX@=F]L871I;&4@
M=6YS:6=N960@26YT97)R=7!T0V]U;G0[#0H-“G!I9%]T(&9A<B!T:6UE<E]I
M;G1E<G)U<'0H0T>PT*#0H-@T*(" @("!);G1E<G)U<'1&;&%G(#T@,3L-
M"B @(" @(&EF(“A);G1E<G)U<'1#;W5N=“LK(#X@,3 I#0H@(” @(”![#0H@
M(" @(" @("!);G1E<G)U<‘1#;W5N=" ](# [#0H)"2 @(’)E=‘5R;B H<’)O
M>'DI.PT*(" @(" @('T-“B @(” @("!R971U<FX@’!R;WAY3L@(" @+R@
M9V%V92!U<" M('1R:65D(‘1O(’)E='5R;B!P<F]X>2!U;F-O;F1I=&EO;F%L
1;'D-"@T*?3L-"@T*#0H-"AH
end

begin 666 MAIN.CPP
M(VEN8VQU9&4@(G1Y<&5S+F@B#0HC:6YC;'5D92 B:3@V+F@B#0HC:6YC;'5D
M92 B<V5N9&UX+F@B#0HC:6YC;'5D92 B:7)Q:6YF;RYH(@T*(VEN8VQU9&4@
M(G-T9&EO+F@B#0HC:6YC;'5D92 B<VEG;F%L+F@B#0HC:6YC;‘5D92 B=&EM
M92YH(@T*(VEN8VQU9&4@(G!R;WAY+F@B#0HC:6YC;‘5D92 B:V5R;F5L+F@B
M#0HC:6YC;‘5D92 B=6YI<W1D+F@B#0H-“G5N<VEG;F5D(&-H87(@26YT97)R
M=7!T1FQA9SL-“FEN=”!704E45$E-12 ],3 P,# [(” @(" O+R!!;GD@;VQD
M(&QO;W @8V]U;G1E<@T*:6YT(&-O=6YT97([#0IP:61?=" @<’)O>‘D[#0IV
M;VQA=&EL92!U;G-I9VYE9" @26YT97)R=7!T0V]U;G0[#0IE>‘1E<FX@<&ED
M7W0@9F%R(‘1I;65R7VEN=&5R<G5P="@I.PT*#0H-"@T*=F]I9"!M86EN*"D-
M"GL-"B @(’!I9%]T("!P<F]X>3L-"@T*(" @=&EM97)?="!I9"QI.PT*(" @
M<W1R=6-T(&ET:6UE<G-P96,@=&EM97([#0H@("!S=’)U8W0@<VEG979E;G0@
M979E;G0[#0H@("!I;G0@<’)O>‘E?8V]U;G1E<CL-“B @('1O9V=L92 ](#$[
M#0H-”@T*(" @("!);G1E<G)U<‘1&;&%G(#T@,#L-“B @(”!P<F]X>2 ](’%N
M>%]P<F]X>5]A=‘1A8V@H,“PP+# L+3$I.PT*(” @:68@’!R;WAY(#T]("TQ
M
0T*(" @>PT*(" @(" @<’)I;G1F*")5;F%B;&4@=&@871T86-H(’!R;WAY
M(BD[#0H@(" @("!R971U<FX[#0H@("!]#0H-"B @(&EF(“AI9” ](’%N>%]H
M:6YT7V%T=&%C:"@P+" F=&EM97)?:6YT97)R=7!T+"!&4%]314<H)DEN=&5R
M<G5P=$-O=6YT2 I(#T]("TQ0T*(" @(‘L-“B @(” @(’!R:6YT9B@B56YA
M8FQE(‘1O(&%T=&%C:"!T;R!T:6UE<B(I.PT*(" @(" @<F5T=7)N.PT*(" @
M("!]#0H-“B @(” @("!W:&EL92 H,2D-“B @(” @("![#0H@(" @(" @(" @
M(&EF("@Q2 @+R]);G1E<G)U<'1&;&%G(#T](#$I#0H@(" @(" @(" @('L-
M"B @(" @(" @(" @(" @("!P<F]X>5]C;W5N=&5R
RL[#0H@(" @(" @(" @
M(" @(" @26YT97)R=7!T1FQA9R ](# [#0H-“B @(” @(" @(" @4F5C96EV
M92AP<F]X>2PP+# I.PT*#0H-“B @(” @(" @(" @?0T*(" @(" @(" @("!I
M9B H<’)O>‘E?8V]U;G1E<B ^(%=!251424U%0T(" @(" @(" @("![#0H-
M"B @(" @(" @(" @("!P<F]X>5]C;W5N=&5R(#T@,#L-“B @(” @(" @(" @
M("!P<FEN=&8H(E!A<F5N=" R(%-E8V]N9’,@96QA<’-E9" @)35D7&XB+&-O
M=6YT97(KRD[#0H@(" @(" @(" @('T-“B @(” @(" @?0T#0H-“GT-”@T*
(#0H-"@T*#0H
end

Re Local and Global Proxy

That fixed it - excellent

Thank You

BOB

“Mitchell Schoenbrun” <maschoen@pobox.com> wrote in message
news:Voyager.010511133525.1948B@schoenbrun.com

Post your code, this does work.


Previously, Bob miles wrote in comp.os.qnx:
I tried the interrupt to return the proxy with no luck. The interrupt
was
firing (
tested it with a flag) but the
proxy (which was inthe return statement of the interrupt) was not waking
up
my waiting main program. I compiled the int routine with
-zu and -s (WATCOM) but with no joy —

Any ideas ???

Mitchell Schoenbrun --------- > maschoen@pobox.com