This section described the WDC types and preprocessor definitions defined in
the
WinDriver/include/wdc_defs.h
header file.
WDC device ID information union type (used for PCI and PCMCIA
devices):
B.4.2 WDC_ADDR_DESC Structure
PCI/PCMCIA/ISA device memory or I/O address space information structure type:
B.4.3 WDC_DEVICE Structure
PCI/PCMCIA/ISA device information structure type.
The
WDC_xxxDeviceOpen functions (PCI [
B.3.10] /
PCMCIA [
B.3.11] / ISA [
B.3.12]) allocate and return device structures of this type.
Pointer to a
WDC_DEVICE structure [
B.4.3] type:
typedef WDC_DEVICE *PWDC_DEVICE
B.4.5 WDC_MEM_DIRECT_ADDR Macro
PURPOSE
• Utility macro that returns a pointer that can be used for direct
access to a specified memory address space from the context of the calling
process.
PROTOTYPE
WDC_MEM_DIRECT_ADDR(pAddrDesc)
PARAMETERS
DESCRIPTION
RETURN VALUE
When called from the user mode, returns the user-mode mapping of the physical
memory address (
pAddrDesc->dwUserDirectMemAddr);
When called from the kernel mode, returns the kernel-mode mapping of the
physical memory address (
pAddrDesc->kptAddr).
The returned pointer can be used for accessing the memory directly from the
user mode or kernel mode, respectively.
B.4.6 WDC_ADDR_IS_MEM Macro
PURPOSE
• Utility macro that checks if a given address space is a memory or
I/O address space.
PROTOTYPE
WDC_ADDR_IS_MEM(pAddrDesc)
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
pAddrDesc->fIsMemory, which is set to
TRUE
for a memory address space and to
FALSE otherwise.
B.4.7 WDC_GET_ADDR_DESC Macro
PURPOSE
• Utility macro that retrieves a WDC address space information
structure (
WDC_ADDR_DESC [
B.4.2]), which complies to the specified address space
number.
PROTOTYPE
WDC_GET_ADDR_DESC(
pDev,
dwAddrSpace)
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns a pointer to the device's address information structure
(
WDC_ADDR_DESC [
B.4.2]) for the
specified address space number –
pDev->pAddrDesc[dwAddrSpace].
B.4.8 WDC_GET_ENABLED_INT_TYPE Macro
PURPOSE
• Utility macro for retrieving the value of a WDC device's
dwEnabledIntTypeWD_INTERRUPT field. This field
is updated by
WDC_IntEnable [
B.3.46] to indicate the interrupt type enabled for the
device, as detailed in the description of the macro's return value below.
PROTOTYPE
WDC_GET_ENABLED_INT_TYPE(pDev)
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns the interrupt type enabled for the device:
INTERRUPT_MESSAGE_X: Extended Message-Signaled Interrupts (MSI-X).
INTERRUPT_MESSAGE: Message-Signaled Interrupts (MSI).
INTERRUPT_LEVEL_SENSITIVE: Legacy level-sensitive
interrupts.
INTERRUPT_LATCHED: Legacy edge-triggered interrupts.
The value of this flag is zero and it is applicable only when no other
interrupt flag is set.
REMARKS
-
The Windows APIs do not distinguish between MSI and
MSI-X; therefore, on this OS the WinDriver functions set the
INTERRUPT_MESSAGE flag for both MSI and MSI-X.
-
Call this macro only after calling
WDC_IntEnable [B.3.46] to enable interrupts on your PCI card.
-
This macro is normally relevant only in the case of PCI devices that
support more than one type of interrupt.
-
You can pass the returned value to the
WDC_INT_IS_MSI macro to
check if MSI or MSI-X was enabled [B.4.10].
B.4.9 WDC_GET_INT_OPTIONS Macro
PURPOSE
• Utility macro for retrieving the value of a WDC device's
interrupt options, which indicate the types of interrupts supported by the
device, as detailed in the description of the macro's return value below.
PROTOTYPE
WDC_GET_INT_OPTIONS(pDev)
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns a bit-mask indicating the types of interrupts supported by the device:
INTERRUPT_MESSAGE_X: Extended Message-Signaled Interrupts (MSI-X).
INTERRUPT_MESSAGE: Message-Signaled Interrupts (MSI).
INTERRUPT_LEVEL_SENSITIVE: Legacy level-sensitive
interrupts.
INTERRUPT_LATCHED: Legacy edge-triggered interrupts.
The value of this flag is zero and it is applicable only when no other
interrupt flag is set.
REMARKS
-
You can pass the returned options to the
WDC_INT_IS_MSI macro
to check whether they include the INTERRUPT_MESSAGE (MSI)
and/or INTERRUPT_MESSAGE_X (MSI-X) flags [B.4.10].
B.4.10 WDC_INT_IS_MSI Macro
PURPOSE
• Utility macro that checks whether a given interrupt type bit-mask
contains the Message-Signaled Interrupts (MSI) or Extended Message-Signaled Interrupts (MSI-X) interrupt type flags.
PROTOTYPE
WDC_INT_IS_MSI(dwIntType)
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
TRUE if the provided interrupt type bit-mask includes the
INTERRUPT_MESSAGE (MSI) and/or
INTERRUPT_MESSAGE_X (MSI-X) flags; otherwise returns
FALSE.
B.4.11 WDC_GET_ENABLED_INT_LAST_MSG Macro
PURPOSE
• Utility macro that retrieves the message data of the last received
interrupt for the Message-Signaled Interrupts (MSI) / Extended Message-Signaled Interrupts (MSI-X) enabled for the device
(Windows Vista and higher only).
PROTOTYPE
WDC_GET_ENABLED_INT_LAST_MSG(pDev)
PARAMETERS
DESCRIPTION
RETURN VALUE
If MSI or MSI-X was enabled for the given device, the macro returns the message
data of the last message received for the device's interrupt; otherwise
returns zero.
PURPOSE
• Utility macro that checks if a WDC device uses a Kernel PlugIn
driver.
PROTOTYPE
WDC_IS_KP(pDev)
PARAMETERS
DESCRIPTION
RETURN VALUE
Returns
TRUE if the device uses a Kernel PlugIn driver; otherwise
returns
FALSE.