Texas Instruments TNETE100A Network Card User Manual


 
Loading and Unloading an Interrupt Service Routine (ISR)
4-4
Cleanup uses the same HwSetIntVector routine to restore the old value. This
time, the parameter is the old value and the interim value returned by the func-
tion is ignored. Only the three interrupts that were asserted are restored, and
only if the structure for the NIC instance has had old values saved in it.
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––
// cleanup() – cleanup in preparation for exiting to dos
//––––––––––––––––––––––––––––––––––––––––––––––––––––––––
static void cleanup(void)
{
if (nic.Irq)
HwSetIntMask((BYTE)nic.Irq,1);
if (nic.OldNic)
HwSetIntVector((BYTE)nic.Irq,nic.OldNic);
if (nic.OldTimer) HwSetIntVector(0x1C,nic.OldTimer);
if (nic.OldAbort) HwSetIntVector(0x23,nic.OldAbort);
}
The next interrupt to be intercepted corresponds to the actual hardware inter-
rupt. Since the original installation for a ThunderLAN controller is a PCI slot,
its interrupt in the PC is assigned by the PCI BIOS code. You must interrogate
the PCI configuration space to find it. This was done in the previous section
as part of GetPciConfig(). It uses the same function call as the two intercept
installs below:
nic.OldNic = HwSetIntVector((BYTE)nic.Irq, NicIsr);
Note that the actual interrupt request (IRQ) is passed as a variable, not a
constant as in the interrupts installed above. As in most interrupt service rou-
tines, make sure that stack space is available for calls and protect the informa-
tion currently in the registers.