SCO OpenServer
get_intr_arg(D3oddi)
get_intr_arg --
get value of argument passed to the interrupt routine
Synopsis
int get_intr_arg(bus, dev_func);
Description
The
get_intr_arg( )
function returns the value of the argument
that will be passed to the driver's interrupt handling routine.
Arguments
bus-
PCI bus number
dev_func-
PCI device and function number
This is formed as follows:
-
If the driver registers itself with the
idistributed(D3oddi)
function,
use the
IDIST_PCI_IRQ( )
macro.
-
If the driver registers itself with the
Sharegister(D3osdi)
with the SHAREG_EX structure,
use the
SHAREG_PCI_INTVEC( )
macro.
Both macros take two arguments
indicating the PCI device
and function numbers.
Return values
The value returned is the argument
that will be passed to the driver's interrupt handler
upon receipt of an interrupt from
the PCI device specified.
Usage
get_intr_arg( )
is used with drivers that use
idistributed(D3oddi)
or
Sharegister(D3osdi)
with the SHAREG_EX structure
to register themselves.
In these circumstances,
the argument passed to the interrupt handler
is not necessarily the same as
the IRQ line on which the device interrupted.
If the driver uses the argument passed to the interrupt handler,
the
get_intr_arg( )
function must be called
to determine the interrupt handler argument that is passed
when a particular PCI device interrupts.
get_intr_arg( )
function should only be called once
for each device controlled by the driver.
The value it returns should be stored internally
to be accessed when needed.
-
get_intr_arg( )
must not be called at driver init time.
-
If the driver registers itself with the
idistributed(D3oddi)
function,
call
get_intr_arg( )
on the first entry into the driver's
open(D2oddi)
routine.
-
If the driver registers itself with the
Sharegister(D3osdi)
function,
call
get_intr_arg( )
on the first entry into the driver's
_entry(D2osdi)
routine.
-
get_intr_arg( )
can be called on the first entry
into the driver's interrupt handler routine
although this is not generally the preferred practice.
All PCI devices
that share the same interrupt line
will have the same number passed
as the argument to the interrupt routine.
Context and synchronization
Blockable
context
Also the context of the
_entry(D2osdi)
entry point routine.
Hardware applicability
All
Version applicability
oddi:
3, 3mp, 4, 4mp, 5, 5mp, 6, 6mp
Differences between versions
Beginning with SCO OpenServer Release 5.0.5,
the return value of
get_intr_arg( )
is internally implemented differently than it was
in earlier SCO OpenServer releases.
As long as drivers treat this value as a ``cookie'',
they will not be affected by this change.
SVR5 DDI compatibility
There is no equivalent DDI function.
References
idistributed(D3oddi),
Sharegister(D3osdi)
Examples
The following code snippet illustrates
the calling sequence for
get_intr_arg( ):
int arg;
arg = get_intr_arg(bus, SHAREG_PCI_INTVEC(device, function));
After this code executes,
arg contains the value of the argument
that will be passed to the interrupt handler
when an interrupt is received
from that particular PCI device.
See the
idistributed(D3oddi)
and the
Sharegister(D3osdi)
manual pages for full examples of
get_intr_art( ).
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 5 HDK - June 2005