Function UnmaskLptIrq installs a hardware interrupt handler. It works as follows:
ULONG IrqCounter = 0;
ULONG LowTimeStamp = 0;
ULONG HighTimeStamp = 0;
PIRQ_SHARE_REC ShareRec;
PIRQ_CLEAR_REC ClearRec;
// Interrupt handler
void __stdcall OnHardwareInterrupt(ULONG LowPart, ULONG HighPart)
{
++ IrqCounter;
ULONG LowTimeStamp = LowPart;
ULONG HighTimeStamp = HighPart;
}
// Main program
hLpt = OpenRapidLpt( 0 );
if (IsRapidLptOpened(hLpt)) {
...
set ClearRec and ShareRec structures, see below
...
UnmaskLptIrq( hLpt, MyInterruptHandler );
}
else
... // failed
Calling the function MaskLptIrq stops hardware interrupt processing:
MaskLptIrq ( hLpt );
Counter value for the number of handled interrupts is returned by function GetInterruptCounter.
|