Jungo WinDriver  
Official Documentation

◆ WD_CardRegister

#define WD_CardRegister ( h,
pCard )
Value:
#define FALSE
Definition kpstdlib.h:261
#define IOCTL_WD_CARD_REGISTER
Definition windrvr.h:1665
#define WD_FUNCTION
Definition windrvr.h:1867

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;
}

Definition at line 2249 of file windrvr.h.