In article <b1tq1v$5f7$1@inn.qnx.com>, A_ENLEVER_y.leroux@actris.com says…
Hi,
I’m trying to port a little Dos code under Qnx
This code call the old isr handler in the new isr handler
using ( _chain_intr(old_isr)
How do i make the same thing under QNX ?
As Bill said you don’t need to do it. And some addition to Bill’s Note#1, you can’t control of order in which ISR are
called, but you can put your ISR in end of queue (see the last parameter Flags of InterruptAttach())
I suppose Qnx Call : InterruptAttach / Detach
save and restore the old isr.
No. It was common trick in DOS, but QNX makes a difference. For example, many programs in DOS setted their hot-keys
(keyboard’s shortcuts) in this way: own interrupts reads the scan code from keyboard’s controller, if it’s “hotkey” make
some out to kbd controller to release it and handle it, if not - call old ISR which will do usual things: place
scancode to kbd’s buffer, release kbd controller etc. You can’t do it in QNX. In DOS, old it’s usually BIOS ISR, and
QNX doesn’t use BIOS much (only during sturt-up, but does not if using custom IPL on BIOSless board).
Good place for start is:
http://www.qnx.com/developer/docs/momentics_nc_docs/neutrino/prog/inthandler.html
Here is the start of the translation :
// ----------------------------------
// DOS ISR handler
// ----------------------------------
/* Save the old interrupt vector */
old_isr = getvect(int_vector);
/* Install the new interrupt vector */
setvect(int_vector, PCI7200_isr0);
/* Restore old interrupt vector */
setvect(int_vector, old_isr);
Is it exactly sequence? Restore old ISR should be on exit from program (better in function declared by atexit()), in
DOS, of course ).
Good luck!
Eduard.
void interrupt PCI7200_isr0(void) {
// (…)
/* call the previous handler */
_chain_intr(old_isr);
// (…)
}
==========================================================
// ----------------------------------
// QNX ISR handler
// ----------------------------------
k= InterruptAttach (int_vector, PCI7200_isr0, NULL, 0, 0);
InterruptDetach( k);
const struct sigevent *PCI7200_isr0 (void *arg, int id)
{
}
Thanks for your help