next up previous contents
Next: 2.4 WD_PciConfigDump() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.2 WD_PciScanCards()   Contents


2.3 WD_PciGetCardInfo()


PURPOSE

$\bullet$Retrieves PCI device's resource information (i.e., Memory ranges, I/O ranges, Interrupt lines).


PROTOTYPE

DWORD WD_PciGetCardInfo(
    HANDLE hWD,
    WD_PCI_CARD_INFO *pPciCard);


PARAMETERS

Name Type Input/Output
$\bullet$hWD HANDLE Input
$\bullet$pPciCard WD_PCI_CARD_INFO*  
$\gg$pciSlot WD_PCI_SLOT  
$\diamond$dwBus DWORD Input
$\diamond$dwSlot DWORD Input
$\diamond$dwFunction DWORD Input
$\gg$Card WD_CARD  
$\diamond$dwItems DWORD Output
$\diamond$Item WD_ITEMS[WD_CARD_ITEMS]  
$\triangleright$item DWORD Output
$\triangleright$fNotSharable DWORD Output
$\triangleright$dwReserved DWORD N/A
$\triangleright$dwOptions DWORD N/A
$\triangleright$I union  
$\rightarrow$Mem struct  
$\star$dwPhysicalAddr DWORD Output
$\star$dwBytes DWORD Output
$\star$dwTransAddr DWORD N/A
$\star$dwUserDirectAddr DWORD N/A
$\star$dwCpuPhysicalAddr DWORD N/A
$\star$dwBar DWORD Output
$\rightarrow$IO struct  
$\star$dwAddr KPTR Output
$\star$dwBytes DWORD Output
$\star$dwBar DWORD Output
$\rightarrow$Int struct  
$\star$dwInterrupt DWORD Output
$\star$dwOptions DWORD Output
$\star$hInterrupt DWORD N/A
$\rightarrow$Bus WD_BUS  
$\star$dwBusType WD_BUS_TYPE Output
$\star$dwBusNum DWORD Output
$\star$dwSlotFunc DWORD Output
$\rightarrow$Val struct N/A


DESCRIPTION

Name Description
hWD The handle to WinDriver's kernel-mode driver received from WD_Open() [5.2]
pPciCard Pointer to a PCI card information structure:
pciSlot PCI slot information structure:
pciSlot.dwBus PCI bus number (0 based)
pciSlot.dwSlot PCI slot number (0 based)
pciSlot.dwFunction PCI function number (0 based)
Card Card information structure:
dwItems Number of items detected on the card
Item Card items information structure:
item Type of item. Can be ITEM_MEMORY, ITEM_IO, ITEM_INTERRUPT or ITEM_BUS.
fNotSharable If TRUE, only one application at a time can access the mapped memory range, or monitor this card's interrupts
I Specific data according to the item type:
I.Mem Describes a memory item (item = ITEM_MEMORY):
I.Mem.dwPhysicalAddr First address of the physical memory range
I.Mem.dwBytes Length of the memory range, in bytes
I.Mem.dwBar Base Address Register (BAR) number of the memory range
I.IO Describes an I/O item (item = ITEM_IO):
I.IO.dwAddr First address of the I/O range
I.IO.dwBytes Length of the I/O range, in bytes
I.IO.dwBar Base Address Register (BAR) number for the I/O range
I.Int Describes an interrupt item (item = ITEM_INTERRUPT):
I.Int.dwInterrupt Physical interrupt request (IRQ) number
I.Int.dwOptions Interrupt bit-mask, which includes the interrupt type (the default type is edge triggered). For level sensitive interrupts (such as PCI interrupts), the function sets the INTERRUPT_LEVEL_SENSITIVE flag in this field.
I.Bus Describes a bus item (item = ITEM_BUS):
I.Bus.dwBusType The card's bus type. For a PCI card the bus type is WD_BUS_PCI
I.Bus.dwBusNum The card's bus number
I.Bus.dwSlotFunc A combination of the card's bus slot and function numbers: the lower three bits represent the function number and the remaining bits represent the slot number. For example: a value of 0x80 (<=> 10000000 binary) corresponds to a function number of 0 (lower 3 bits: 000) and a slot number of 0x10 (remaining bits: 10000).


RETURN VALUE

Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise [A].


REMARKS


EXAMPLE

WD_PCI_CARD_INFO pciCardInfo;
WD_CARD Card;

BZERO(pciCardInfo);
pciCardInfo.pciSlot = pciSlot;
WD_PciGetCardInfo(hWD, &pciCardInfo);
if (pciCardInfo.Card.dwItems!=0) /* At least one item was found */
{
    Card = pciCardInfo.Card;
}
else
{
    printf("Failed fetching PCI card information\n");
}


next up previous contents
Next: 2.4 WD_PciConfigDump() Up: 2. WD_xxx PCI/PCMCIA/ISA Functions Previous: 2.2 WD_PciScanCards()   Contents