The minidriver is called based on the following sequences:
Usually, there is a need to do more with the hardware than what the minidriver is set up to do. There will be a transition or handoff to the real driver that will attach to the real interrupt.
To do this properly, here are the sequences of events that should be done:
The real driver attaches to the shared memory area that is owned by the minidriver. For example:
dptr = mmap_device_memory(0, 65536, PROT_READ | PROT_WRITE | PROT_NOCACHE, 0, SYSPAGE_ENTRY(mdriver)->data_paddr);
Since the minidriver is still running at this point, it continues to run whenever the interrupt is triggered until the real driver attaches to the same interrupt. Depending on the design, it may be necessary to do some processing of the existing data that has been stored by the minidriver before the real driver takes control.
The real driver calls the function InterruptAttach() or InterruptAttachEvent() (the latter is preferred over InterruptAttach()). When this call is made, the minidriver receives a message of type MDRIVER_INTR_ATTACH. The minidriver returns a value of 1.
From now onwards, the minidriver will no longer be called on the interrupt. Only the real driver will receive the interrupt. The shared memory area will continue to exist until you remove it.