Jungo WinDriver  
Official Documentation

◆ WD_CardRegister

#define WD_CardRegister (   h,
  pCard 
)
Value:
#define FALSE
Definition: kpstdlib.h:260
#define IOCTL_WD_CARD_REGISTER
Definition: windrvr.h:1628
#define WD_FUNCTION
Definition: windrvr.h:1838

Card registration function.

The function: Maps the physical memory ranges to be accessed by kernel-mode processes and user-mode applications.

Verifies that none of the registered device resources (set in pCardReg->Card.Item) are already locked for exclusive use. A resource can be locked for exclusive use by setting the fNotSharable field of its WD_ITEMS structure (pCardReg->Card.Item[i]) to 1, before calling WD_CardRegister().

Saves data regarding the interrupt request (IRQ) number and the interrupt type in internal data structures; this data will later be used by InterruptEnable() and/or WD_IntEnable()

Parameters
[in]hHandle to WinDriver's kernel-mode driver as received from WD_Open()
[in,out]pCardPointer to a card registration information structure
Returns
Returns WD_STATUS_SUCCESS (0) on success, or an appropriate error code otherwise
Remarks
  1. For PCI the cardReg.Card input resources information should be retrieved from the Plug-and-Play Manager via WD_PciGetCardInfo()
  2. If your card has a large memory range that cannot be fully mapped to the kernel address space, you can set the WD_ITEM_MEM_DO_NOT_MAP_KERNEL flag in the I.Mem.dwOptions field of the relevant WD_ITEMS memory resource structure that you pass to the card registration function (pCardReg->Card.Item[i].I.Mem.dwOptions). This flag instructs the function to map the memory range only to the user-mode virtual address space, and not to the kernel address space. (For PCI devices, you can modify the relevant item in the card information structure (pCard) that you received from WD_PciGetCardInfo() before passing this structure to WD_CardRegister().)

    Note that if you select to set the WD_ITEM_MEM_DO_NOT_MAP_KERNEL flag, WD_CardRegister() will not update the item's pTransAddr field with a kernel mapping of the memory's base address, and you will therefore not be able to rely on this mapping in calls to WinDriver APIs namely interrupt handling APIs or any API called from a Kernel PlugIn driver

  3. WD_CardRegister() enables the user to map the card memory resources into virtual memory and access them as regular pointers.
  4. WD_CardRegister() will only work with the first item being defined as an ITEM_BUS (see example below).
BZERO(cardReg);
cardReg.Card.dwItems = 2;
cardReg.Card.Item[0].item = ITEM_BUS;
cardReg.Card.Item[0].I.Bus.dwBusNum = 0x0;
cardReg.Card.Item[0].I.Bus.dwSlotFunc = 0x0;
cardReg.Card.Item[1].item = ITEM_IO;
cardReg.Card.Item[1].fNotSharable = 1;
cardReg.Card.Item[1].I.IO.pAddr = 0x378;
cardReg.Card.Item[1].I.IO.dwBytes = 8;
WD_CardRegister(hWD, &cardReg);
if (cardReg.hCard == 0)
{
printf("Failed locking device\n");
return FALSE;
}
DWORD dwSlotFunc
Slot number on the bus.
Definition: windrvr.h:688
WD_BUS_TYPE dwBusType
Bus Type: WD_BUS_PCI/ISA/EISA.
Definition: windrvr.h:685
DWORD dwBusNum
Bus number.
Definition: windrvr.h:687
DWORD hCard
Handle of card.
Definition: windrvr.h:777
WD_CARD Card
Card to register.
Definition: windrvr.h:774
WD_ITEMS Item[WD_CARD_ITEMS]
Definition: windrvr.h:769
DWORD dwItems
Definition: windrvr.h:767
KPTR pAddr
Beginning of I/O address.
Definition: windrvr.h:740
DWORD dwBytes
I/O range.
Definition: windrvr.h:741
DWORD fNotSharable
Definition: windrvr.h:714
union WD_ITEMS::I I
DWORD item
ITEM_TYPE.
Definition: windrvr.h:713
struct WD_ITEMS::I::IO IO
WD_BUS Bus
ITEM_BUS.
Definition: windrvr.h:759
@ ITEM_BUS
Bus.
Definition: windrvr.h:697
@ ITEM_IO
I/O.
Definition: windrvr.h:696
#define WD_CardRegister(h, pCard)
Card registration function.
Definition: windrvr.h:2220
#define BZERO(buf)
Definition: windrvr.h:1548
@ WD_BUS_PCI
PCI.
Definition: windrvr.h:679

Definition at line 2220 of file windrvr.h.