The documentation for QNX 4.25, in the section on interrupt latency,
implies that it is possible for a QNX process to temporarily disable all
interrupts during the servicing of an interrupt request. I am
translating a driver from another operating system, and the code
requires this ability. Does anyone know how this is accomplished?
Thanks in advance.
Douglas Reed
“Douglas Reed” <dreed@guise.com> wrote in message
news:3BEB5500.46B74A32@guise.com…
The documentation for QNX 4.25, in the section on interrupt latency,
implies that it is possible for a QNX process to temporarily disable all
interrupts during the servicing of an interrupt request. I am
translating a driver from another operating system, and the code
requires this ability. Does anyone know how this is accomplished?
— cut from qdn.public.qnx4.devtools —
Actually, you can use these functions together with restore() to have
them nested.
From sys/inline.h:
#pragma aux restore = “push eax” “popfd” __parm [eax] __modify [];
Just do something like this:
unsigned flags = disable();
…
restore( flags );
Of course, it’s generally not a good idea to disable interrupts for a
long time. Even if you need interrupts disabled almost most of the
time for a while, you can improve overall interrupt latency by finding
places in the code where you can safely insert calls to enable() and
disable().
–
Wojtek Lerch QNX Software Systems Ltd.
— cut —
Thanks in advance.
Douglas Reed
// wbr
I have an additional question, having looked in the inline.h file. Why not use
the “enable” function instead of restore?
Doug
ian zagorskih wrote:
“Douglas Reed” <> dreed@guise.com> > wrote in message
news:> 3BEB5500.46B74A32@guise.com> …
The documentation for QNX 4.25, in the section on interrupt latency,
implies that it is possible for a QNX process to temporarily disable all
interrupts during the servicing of an interrupt request. I am
translating a driver from another operating system, and the code
requires this ability. Does anyone know how this is accomplished?
— cut from qdn.public.qnx4.devtools —
Actually, you can use these functions together with restore() to have
them nested.
From sys/inline.h:
#pragma aux restore = “push eax” “popfd” __parm [eax] __modify [];
Just do something like this:
unsigned flags = disable();
…
restore( flags );
Of course, it’s generally not a good idea to disable interrupts for a
long time. Even if you need interrupts disabled almost most of the
time for a while, you can improve overall interrupt latency by finding
places in the code where you can safely insert calls to enable() and
disable().
–
Wojtek Lerch QNX Software Systems Ltd.
— cut —
Thanks in advance.
Douglas Reed
// wbr
Consider:
fn1() calls disable
fn1() calls fn2
fn2() calls disable
fn2() calls enable <== RBT
fn2() return
fn1() assumes that interrupts are still disabled but their not
The disable() function not only disables interrupts but also increments a
count. The restore() function decrements that counter and only enable()s
interrupts if the count reaches 0.
–
Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net
“Douglas Reed” <dreed@guise.com> wrote in message
news:3BEC04B4.9D25A8B3@guise.com…
I have an additional question, having looked in the inline.h file. Why not
use
the “enable” function instead of restore?
Doug
ian zagorskih wrote:
“Douglas Reed” <> dreed@guise.com> > wrote in message
news:> 3BEB5500.46B74A32@guise.com> …
The documentation for QNX 4.25, in the section on interrupt latency,
implies that it is possible for a QNX process to temporarily disable
all
interrupts during the servicing of an interrupt request. I am
translating a driver from another operating system, and the code
requires this ability. Does anyone know how this is accomplished?
— cut from qdn.public.qnx4.devtools —
Actually, you can use these functions together with restore() to have
them nested.
From sys/inline.h:
#pragma aux restore = “push eax” “popfd” __parm [eax] __modify
[];
Just do something like this:
unsigned flags = disable();
…
restore( flags );
Of course, it’s generally not a good idea to disable interrupts for a
long time. Even if you need interrupts disabled almost most of the
time for a while, you can improve overall interrupt latency by finding
places in the code where you can safely insert calls to enable() and
disable().
–
Wojtek Lerch QNX Software Systems Ltd.
— cut —
Thanks in advance.
Douglas Reed
// wbr
I can’t see where there’s a counter involved. The interrupt enable state is
present in the CPU flags register. The disable() function returns the state
of the flags register prior to changing its state. The restore() function
just sets the flags register to whatever value you pass it. Thus the code
shown restores the interrupt state to what it was prior to the disable()
call.
Marty Doane
“Bill Caroselli” <qtps@earthlink.net> wrote in message
news:9sh2v6$hs5$1@inn.qnx.com…
Consider:
fn1() calls disable
fn1() calls fn2
fn2() calls disable
fn2() calls enable <== RBT
fn2() return
fn1() assumes that interrupts are still disabled but their not
The disable() function not only disables interrupts but also increments a
count. The restore() function decrements that counter and only enable()s
interrupts if the count reaches 0.
–
Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net
“Douglas Reed” <> dreed@guise.com> > wrote in message
news:> 3BEC04B4.9D25A8B3@guise.com> …
I have an additional question, having looked in the inline.h file. Why
not
use
the “enable” function instead of restore?
Doug
ian zagorskih wrote:
“Douglas Reed” <> dreed@guise.com> > wrote in message
news:> 3BEB5500.46B74A32@guise.com> …
The documentation for QNX 4.25, in the section on interrupt latency,
implies that it is possible for a QNX process to temporarily disable
all
interrupts during the servicing of an interrupt request. I am
translating a driver from another operating system, and the code
requires this ability. Does anyone know how this is accomplished?
— cut from qdn.public.qnx4.devtools —
Actually, you can use these functions together with restore() to
have
them nested.
From sys/inline.h:
#pragma aux restore = “push eax” “popfd” __parm [eax]
__modify
[];
Just do something like this:
unsigned flags = disable();
…
restore( flags );
Of course, it’s generally not a good idea to disable interrupts for a
long time. Even if you need interrupts disabled almost most of the
time for a while, you can improve overall interrupt latency by finding
places in the code where you can safely insert calls to enable() and
disable().
–
Wojtek Lerch QNX Software Systems
Ltd.
— cut —
Thanks in advance.
Douglas Reed
// wbr
OK. I replied without actually looking at the code. But I know that that’s
the way it’s suppoesed to work.
It appears to be that what I described is the way
InterruptEnable()/InterruptDisable() work.
–
Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net
“Marty Doane” <marty.doane@rapistan.com> wrote in message
news:9sh66u$jvo$1@inn.qnx.com…
I can’t see where there’s a counter involved. The interrupt enable state
is
present in the CPU flags register. The disable() function returns the
state
of the flags register prior to changing its state. The restore() function
just sets the flags register to whatever value you pass it. Thus the code
shown restores the interrupt state to what it was prior to the disable()
call.
Marty Doane
“Bill Caroselli” <> qtps@earthlink.net> > wrote in message
news:9sh2v6$hs5$> 1@inn.qnx.com> …
Consider:
fn1() calls disable
fn1() calls fn2
fn2() calls disable
fn2() calls enable <== RBT
fn2() return
fn1() assumes that interrupts are still disabled but their not
The disable() function not only disables interrupts but also increments
a
count. The restore() function decrements that counter and only
enable()s
interrupts if the count reaches 0.
–
Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net
“Douglas Reed” <> dreed@guise.com> > wrote in message
news:> 3BEC04B4.9D25A8B3@guise.com> …
I have an additional question, having looked in the inline.h file. Why
not
use
the “enable” function instead of restore?
Doug
ian zagorskih wrote:
“Douglas Reed” <> dreed@guise.com> > wrote in message
news:> 3BEB5500.46B74A32@guise.com> …
The documentation for QNX 4.25, in the section on interrupt
latency,
implies that it is possible for a QNX process to temporarily
disable
all
interrupts during the servicing of an interrupt request. I am
translating a driver from another operating system, and the code
requires this ability. Does anyone know how this is accomplished?
— cut from qdn.public.qnx4.devtools —
Actually, you can use these functions together with restore() to
have
them nested.
From sys/inline.h:
#pragma aux restore = “push eax” “popfd” __parm [eax]
__modify
[];
Just do something like this:
unsigned flags = disable();
…
restore( flags );
Of course, it’s generally not a good idea to disable interrupts for
a
long time. Even if you need interrupts disabled almost most of
the
time for a while, you can improve overall interrupt latency by
finding
places in the code where you can safely insert calls to enable() and
disable().
–
Wojtek Lerch QNX Software Systems
Ltd.
— cut —
Thanks in advance.
Douglas Reed
// wbr
\
“Bill Caroselli” <qtps@earthlink.net> wrote in message
news:9sh6v8$kbh$1@inn.qnx.com…
OK. I replied without actually looking at the code. But I know that
that’s
the way it’s suppoesed to work.
#pragma aux disable = “pushfd” “cli” “pop eax” __parm [] __modify [eax];
#pragma aux enable = “pushfd” “sti” “pop eax” __parm [] __modify [eax];
#pragma aux restore = “push eax” “popfd” __parm [eax] __modify [];
so using restore() instead of enable() is just a little trick to pass round
the lack of cpu interrupts management subsystem in qnx4 design.
It appears to be that what I described is the way
InterruptEnable()/InterruptDisable() work.
–
Bill Caroselli – 1(530) 510-7292
Q-TPS Consulting
QTPS@EarthLink.net
// wbr