Home    Prev Next    
Contents
Programming For PCI Device
Overview
Programmers Guide
Scenario
Access to PCI devices information
How to work with PCI header
Accessing PCI registers
Accessing BAR0-BAR5 areas
I/O Ports control
Single read/write operations
Data array read/write operations
Accessing Physical Memory Addresses
Memory Mapping
Additional Functions
Hardware interrupts handling at user level
Common Issues
Extended options of hardware interrupt handling
PCI Support Routines And Structures
Common Procedures
OpenRapidPci
IsRapidPciOpened
CloseRapidPci
GetHardwareConfiguration
GetPciLocation
PCI specific functions
PCI Header
GetPciHeader
SetPciHeader
ReadFromPci
WriteToPci
PCI BAR Areas
GetNumOfPciBars
GetPciBarLength
GetPciBarPhysicalAddress
GetPciBarLinearAddress
ReadPciBarByte
ReadPciBarWord
ReadPciBarLong
WritePciBarByte
WritePciBarWord
WritePciBarLong
PCI Registers
ReadPciCommandReg
WritePciCommandReg
ControlPciCommandRegBits
ReadPciStatusReg
Memory Access
MapPhysToLinear
UnmapMemory
GetMem
GetMemW
GetMemL
SetMem
SetMemW
SetMemL
Direct Port I/O
GetPortByte
GetPortWord
GetPortLong
SetPortByte
SetPortWord
SetPortLong
ReadPortBuffer
WritePortBuffer
Hardware Interrupts
UnmaskPciIrq
MaskPciIrq
GetInterruptCounter
Common Issues
Go to RapidDriver Main Page


Function UnmaskPciIrq installs a hardware interrupt handler. It works as follows:

ULONG IrqCounter = 0;
PIRQ_SHARE_REC ShareRec;
PIRQ_CLEAR_REC ClearRec;

// Interrupt handler
void __stdcall MyInterruptHandler(
ULONG TimeStampLoPart, ULONG TimeStampHiPart)
{
    ++ IrqCounter; 
}

// Main program
hPci = 
OpenRapidPci( 0 );
if (
IsRapidPciOpened(hPci)) {
    ...
    set ClearRec and ShareRec structures, see below 
    ...
    
UnmaskPciIrq( hPci, &ShareRec, &ClearRec, MyInterruptHandler );
}
else 
  ... // failed


Calling the function MaskPciIrq stops hardware interrupt processing:

MaskPciIrq ( hPci );

Counter value for the number of handled interrupts is returned by function GetInterruptCounter.
.