Home   |   Jungo Corporate Web Site   |   Connectivity Software Store   |   Contact us   |   Search:
Home Connectivity Software Support WinDriver Support Technical Documents

Technical Document #21



Doc ID: 21
Product: WinDriver & KernelDriver
Version:  --

What is the significance of marking a resource as "shared" with WinDriver/KernelDriver and how can I verify the "shared" status of a specific resource on my card?

The "shared" status determines if the resource is locked exclusively or not.

If a memory, I/O or interrupt item is not defined as shared, the resource will be locked exclusively by the first call to WD_CardRegister() and all subsequent calls to this function, which attempt to lock the same resource - either from within the same application or from another WinDriver/KernelDriver application - will fail, until WD_CardUnregister() is called to free the handle that was received by the initial call to WD_CardRegister().
[Registers cannot be defined as shared].

Please note that PCI resources (and specifically interrupts) should generally be defined as sharable.

For memory and I/O, the share status defined with WinDriver effects only WinDriver/KernelDriver based applications.
However, for interrupts there is further significance, since the interrupt share status also determines if other drivers can lock the same interrupt.
Refer to Technical Document #104, which explains how to read the value of the PCI interrupt status register.
To check if the resource was defined as sharable, you can do one of the following:
  1. From your code, print the value of the fNotSharable flag for the memory/IO/interrupt item on the card (cardReg.Card.Item[i].fNotSharable). If the value is 0 - i.e. FALSE - this means that the resource is defined as shared (non-sharable = TRUE).

  2. If you have used the DriverWizard to generate your code, you can run the DriverWizard, open the *.wdp DriverWizard project file, which served as the basis for your application, select the 'Memory', 'I/O' or 'Interrupt' tab (respectively) and click on 'Edit'. Then look to see if the 'Shared' box in the Resource Information window is checked, to signify that the resource is defined as shared for this device.
    Please note that this test is only relevant when using the original *.wdp project file for your application code, and assuming your code does not modify the 'shared' status (since any changes made in the *.wdp file, via the DriverWizard, will only effect subsequent code generation, and will not effect the existing application code). Therefore, checking the "shared" values from the code is more accurate.
As a general guideline, avoid locking the same resource twice. It is always recommend to call WD_CardUnregister() to free the handle returned by a previous call to WD_CardRegister(), before recalling WD_CardRegister() to receive a handle to the same card (either from the same application or from different applications). If you need to access the resources from several applications, you can share the handle received from a single call to WD_CardRegister() - see Technical Document #98 for more information.

Back to Top