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
UnmaskPciIrq
Go to RapidDriver Main Page Installs a hardware interrupt handler for the PCI device and unmasks the Irq at hardware level. UnmaskPciIrq allows to handle the
"shared" and "level sensitive" interrupts as well as the "non-shared" and "edge triggered".

Language

Description

C/C++
void UnmaskPciIrq( HANDLE hPci, IRQ_SHARE_REC * ShareRec, IRQ_CLEAR_REC * ClearRec, TOnHwInterrupt InterruptHandler );
Delphi
procedure UnmaskPciIrq ( hPci: THandle; var ShareRec: IRQ_SHARE_REC; var ClearRec: IRQ_CLEAR_REC; InterruptHandler: TOnHwInterruptHandler ); stdcall;
VB
Sub UnmaskPciIrq ( ByVal hPci As Long, ByRef ShareRec As IRQ_SHARE_REC, ByRef ClearRec As IRQ_CLEAR_REC, ByVal HWHandler As Long)


Parameters:

hPci - the handle returned by a successful call to OpenRapidPci ;
ShareRec - points to the structure of type IRQ_SHARE_REC, which describes how to determine if it is our interruption or not;
ClearRec - points to the structure of type IRQ_CLEAR_REC, which describes how to acknowledge an interruption inside of the driver.
InterruptHandler - address of the callback procedure that handles hardware interrupts for this Irq (use AddressOf specification in VB)

Return Value : None.

Comments:

1. The interrupt handler function must be declared as follows:

C/C++: typedef void (__stdcall * TOnHwInterrupt)(ULONG TimeStampLoPart, ULONG TimeStampHiPart);
Delphi: procedure OnHwInterrupt(TimeStampLoPart: Longword; TimeStampHiPart: Longword); stdcall;
VB: Sub OnHwInterrupt(ByVal TimeStampLoPart As Long, ByVal TimeStampHiPart As Long)

The TimeStampLoPart/TimeStampHiPart values are parts of value returned by the kernel equivalent of QueryPerformaceCounter() API function.

2. This function helps to handle the "level sensitive" interrupts rather than "edge triggered" ones. If the interrupt level at the bus is not dropped at the end of an interrupt handling, the system calls the interrupt handler again and again and this will cause the system to hang. By calling the UnmaskPciIrq function you can provide the information for how the RapidPci driver should clear an interruption inside of the primary interrupt handler. Note: You do not need to clear the interrupt level in your user-level interrupt handler since this was already done by the RapidPci driver!



See also: MaskPciIrq GetInterruptCounter