programming4us
programming4us
ENTERPRISE

Windows 7 : Programming KMDF Hardware Driver - Handling Interrupts (part 2) - Deferred Processing for Interrupts

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

2. Deferred Processing for Interrupts

When the DPC runs, KMDF calls the driver’s EvtInterruptDpc callback. This function performs device-specific interrupt processing and reenables the interrupt for the device. It runs at DISPATCH_LEVEL and therefore must not attempt any operations that might cause a page fault (or wait on any dispatcher objects).

2.1. Code for EvtInterruptDpc Callback

The following is the PCIDRV sample’s EvtInterruptDpc callback:

VOID
NICEvtInterruptDpc(
IN WDFINTERRUPT WdfInterrupt,
IN WDFOBJECT WdfDevice
)
{
PFDO_DATA fdoData = NULL;

fdoData = FdoGetData (WdfDevice);

WdfSpinLockAcquire (fdoData->RcvLock);
NICHandleRecvInterrupt (fdoData);
WdfSpinLockRelease (fdoData->RcvLock);

//
// Handle send interrupt.
//

WdfSpinLockAcquire (fdoData->SendLock);
NICHandleSendInterrupt (fdoData);
WdfSpinLockRelease (fdoData->SendLock);

//
// Check if any queued sends need to be reprocessed.
//
NICCheckForQueuedSends (fdoData);

//
// Start the receive unit if it was stopped
//

WdfSpinLockAcquire (fdoData->RcvLock);
NICStartRecv (fdoData);
WdfSpinLockRelease (fdoData->RcvLock);

//
// Reenable the interrupt.
//

WdfInterruptSynchronize (
WdfInterrupt,
NICEnableInterrupt,
fdoData);

return;
}


Most of the code in this callback is device specific. However, its use of spin locks is worth noting.

When the driver created its I/O queues, it also created two spin locks and stored their handles in its device context area. One (RcvLock) protects read-related buffers and operations, and the (SendLock) protects write-related buffers and operations. In this function, it uses these spin locks to protect against preemption and concurrent users while it processes the results of the I/O operation. The driver calls WdfSpinLockAcquire and WdfSpinLockRelease to acquire and release the locks.

When the driver has completed all device-specific processing, it reenables the interrupt. The function that reenables the interrupt (NICEnableInterrupt) must run at DIRQL, so the driver calls WdfInterruptSynchronize to run it. WdfInterruptSynchronize takes a handle to the interrupt object, a pointer to the function to be run (NICEnableInterrupt), and a pointer to the device context area, which it passed as an argument to NICEnableInterrupt. WdfInterruptSynchronize raises IRQL to DIRQL and calls NICEnableInterrupt. When NICEnableInterrupt completes, KMDF lowers the IRQL to DISPATCH_LEVEL and returns.

Other  
  •  Windows 7 : Programming KMDF Hardware Driver - Support Device Interrupts (part 2) - Post-Interrupt Enable and Pre-Interrupt Disable Processing
  •  Windows 7 : Programming KMDF Hardware Driver - Support Device Interrupts (part 1) - Creating an Interrupt Object,Enabling and Disabling Interrupts
  •  Microsoft Exchange Server 2010 : Managing Data and Database Availability Groups - Content Indexing
  •  Microsoft Exchange Server 2010 : Creating and Managing Database Availability Groups (part 5) - Switching over Servers and Databases
  •  Microsoft Exchange Server 2010 : Creating and Managing Database Availability Groups (part 4) - Configuring Database Availability Group Properties
  •  Microsoft Exchange Server 2010 : Creating and Managing Database Availability Groups (part 3) - Managing Database Availability Group Networks
  •  Microsoft Exchange Server 2010 : Creating and Managing Database Availability Groups (part 2) - Managing Availability Group Membership
  •  Microsoft Exchange Server 2010 : Creating and Managing Database Availability Groups (part 1) - Creating Database Availability Groups
  •  Microsoft Exchange Server 2010 : Navigating the Information Store (part 2) - Improving Availability, Introducing Active Manager
  •  Microsoft Exchange Server 2010 : Navigating the Information Store (part 1) - Using Databases, Understanding Database Structures
  •  
    Top 10
    Free Mobile And Desktop Apps For Accessing Restricted Websites
    MASERATI QUATTROPORTE; DIESEL : Lure of Italian limos
    TOYOTA CAMRY 2; 2.5 : Camry now more comely
    KIA SORENTO 2.2CRDi : Fuel-sipping slugger
    How To Setup, Password Protect & Encrypt Wireless Internet Connection
    Emulate And Run iPad Apps On Windows, Mac OS X & Linux With iPadian
    Backup & Restore Game Progress From Any Game With SaveGameProgress
    Generate A Facebook Timeline Cover Using A Free App
    New App for Women ‘Remix’ Offers Fashion Advice & Style Tips
    SG50 Ferrari F12berlinetta : Prancing Horse for Lion City's 50th
    - Messages forwarded by Outlook rule go nowhere
    - Create and Deploy Windows 7 Image
    - How do I check to see if my exchange 2003 is an open relay? (not using a open relay tester tool online, but on the console)
    - Creating and using an unencrypted cookie in ASP.NET
    - Directories
    - Poor Performance on Sharepoint 2010 Server
    - SBS 2008 ~ The e-mail alias already exists...
    - Public to Private IP - DNS Changes
    - Send Email from Winform application
    - How to create a .mdb file from ms sql server database.......
    programming4us programming4us
    programming4us
     
     
    programming4us