Interrupt Attach

Dear All,
Sorry for troubling again but I am having some serious problems with driver
I have been posting so long
The driver got some working but two main points are there

  1. Open entry point. Currently I am initializing device registers in my init
    module (init module (called from io_net_dll_entry_t))
    It is not correct point to do it. My HDLC card has 8 channels and channels
    each of them must be initialized in separate open call. The interrupt must
    be enabled only once not eight times but each channel should share interrupt
    and must know which is the interrupt descriptor. Where is the correct entry
    point?
    My requirement is that each channel should be opened on demand not at
    initialization point. The above layer should tell me which channel to open.
    How do I do that and where?

  2. How do I debug my driver. I use old gold gdb (ver 2.95). Since I am
    debugging my network (HDLC or High Level Data Link Control )driver.
    I give command gdb io-net
    then on gdb prompt
    (gdb) set arg -d /lib/dll/devn-mydev.so
    (gdb) r
    (gdb)c

It displays output of every fprintf till my init module (called from
io_net_dll_entry_t) exits. The module is named init_module
Now
in my driver, I have created a thread that calls my driver’s send function.
This thread is able to call send function successfully (returns no error).
However my problem is that all this happens when I have masked my interrupt
after attaching it. If I do not mask, the system hangs after some time
(whole system just not gdb or terminal window whole QNX). Can anybody tell
me why?
The call to InterruptAttach is
InterruptAttach(pciDev0->Irq, &test_interrupt, &devArea,sizeof(struct
device),SA_SHIRQ )
where pciDev0 is pointer to PCI device structure
test_interrupt is my handler
devArea is a structure that contains device area pointer to my device
structure
#define SA_SHIRQ
(_NTO_INTR_FLAGS_END|_NTO_INTR_FLAGS_PROCESS|_NTO_INTR_FLAGS_TRK_MSK)
my interrupt handler right now just executes
return NULL
Even then the whole system hangs
why