2.6. WD_PcmciaGetCardInfo()

Purpose

Retrieves PCMCIA device's resource information (i.e., memory ranges, version, manufacturer and model strings, type of device, interrupt information).

Prototype
DWORD WD_PcmciaGetCardInfo(
    HANDLE hWD,
    WD_PCMCIA_CARD_INFO *pPcmciaCard);
Parameters
NameTypeInput/Output
hWDHANDLEInput
pPcmciaCardWD_PCMCIA_CARD_INFO* 
• pcmciaSlotWD_PCMCIA_SLOT 
 * uBusBYTEInput
 * uSocketBYTEInput
 * uFunctionBYTEInput
 * uPaddingBYTEN/A
• CardWD_CARD 
 * dwItemsDWORDOutput
 * ItemWD_ITEMS[WD_CARD_ITEMS] 
  • itemDWORDOutput
  • fNotSharableDWORDOutput
  • dwReservedDWORDN/A
  • dwOptionsDWORDN/A
  • Iunion 
   * Memstruct 
    • dwPhysicalAddrDWORDOutput
    • dwBytesDWORDOutput
    • dwTransAddrKPTRN/A
    • dwUserDirectAddrUPTRN/A
    • dwCpuPhysicalAddrDWORDN/A
    • dwBarDWORDOutput
   * IOstruct 
    • dwAddrKPTROutput
    • dwBytesDWORDOutput
    • dwBarDWORDOutput
   * Intstruct 
    • dwInterruptDWORDOutput
    • dwOptionsDWORDOutput
    • hInterruptDWORDN/A
   * BusWD_BUS 
    • dwBusTypeWD_BUS_TYPEOutput
    • dwBusNumDWORDOutput
    • dwSlotFuncDWORDOutput
   * ValstructN/A
• cVersionCHAR[WD_PCMCIA_VERSION_LEN]Output
• cManufacturerCHAR[WD_PCMCIA_MANUFACTURER_LEN]Output
• cProductNameCHAR[WD_PCMCIA_PRODUCTNAME_LEN]Output
• wManufacturerIdWORDInput
• wCardIdWORDInput
• wFuncIdWORDInput
• dwOptionsDWORDN/A
Description
NameDescription
hWDHandle to WinDriver's kernel-mode driver as received from WD_Open() [5.2]
pPcmciaCardPointer to a PCMCIA card information structure:
• PcmciaSlotPCMCIA slot information structure:
 * uBusBus number (0 based)
 * uSocketSocket number (0 based)
 * uFunctionFunction number (0 based)
• CardCard information structure:
 * dwItemsNumber of items detected on the card
 * ItemCard items information structure:
  • item Type of item. Can be ITEM_MEMORY, ITEM_IO, ITEM_INTERRUPT or ITEM_BUS.
  • fNotSharable
  • 1 — Non-sharable resource; should be locked for exclusive use
  • 0 — Sharable resource
Note: You can modify the value of this field before registering the card and its resources using WD_CardRegister() [2.8].
  • ISpecific data according to the item type:
   * MemDescribes a memory item (item = ITEM_MEMORY):
    • dwPhysicalAddrFirst address of the physical memory range
    • dwBytesLength of the memory range, in bytes
    • dwBarBase Address Register (BAR) number of the memory range
   * IODescribes an I/O item (item = ITEM_IO):
    • dwAddrFirst address of the I/O range
    • dwBytesLength of the I/O range, in bytes
    • dwBarBase Address Register (BAR) number for the I/O range
   * Int Describes an interrupt item (item = ITEM_INTERRUPT):
    • dwInterruptPhysical interrupt request (IRQ) number
    • dwOptions Interrupt options bit-mask, which is set by the function to indicate the interrupt types supported by the device. PCMCIA interrupts are edge triggered, therefore the function sets the INTERRUPT_LATCHED flag (value zero), which when used alone (i.e., when no other flag is set) indicates that the hardware uses legacy edge-triggered interrupts.
   * BusDescribes a bus item (item = ITEM_BUS):
    • dwBusType The card's bus type. For a PCMCIA card the bus type is WD_BUS_PCMCIA
    • dwBusNumThe card's bus number
    • dwSlotFunc A combination of the card's bus socket and function numbers: the lower three bits represent the function number and the remaining bits represent the socket number. For example: a value of 0x80 (<=> 10000000 binary) corresponds to a function number of 0 (lower 3 bits: 000) and a socket number of 0x10 (remaining bits: 10000).
• cVersionCard version string
• cManufacturerCard manufacturer string
• cProductNameCard product name string
• wManufacturerIdCard manufacturer ID
• wCardIdCard type and model ID
• wFuncIdCard function ID
• dwOptionsShould always be set to 0 (reserved for future use)
Return Value

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

Remarks
  • Resource information for PCMCIA cards is obtained by WinDriver from the Windows Plug-and-Play Manager.

Example
WD_PCMCIA_CARD_INFO pcmciaCardInfo;
WD_CARD Card;

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