Поделиться через


NDIS-Supplied Synchronization Functions (NDIS 5.1)

Note   NDIS 5. x has been deprecated and is superseded by NDIS 6. x. For new NDIS driver development, see Network Drivers Starting with Windows Vista. For information about porting NDIS 5. x drivers to NDIS 6. x, see Porting NDIS 5.x Drivers to NDIS 6.0.

The timer functions allow the miniport driver to implement an operation that occurs at a driver-requested interval. For instance, a driver can use a timer to poll its NIC. Events can be used to synchronize operations between two threads, at least one of which is running at IRQL = PASSIVE_LEVEL. Spin locks are used to synchronize access to shared resources.

The following synchronization functions are supplied by the NDIS Library for miniport drivers:

  • NdisMSetTimer
    Sets a timer to go off after a specified interval.
  • NdisMSetPeriodicTimer
    Sets a timer to go off at a specified interval or until canceled with a call to NdisMCancelTimer.
  • NdisMSleep
    Causes the caller's thread to block for the specified interval. A driver calls NdisMSleep during initialization or when halting the adapter; for instance, while waiting for the NIC to complete initialization. NdisMSleep is only called at IRQL = PASSIVE_LEVEL.
  • NdisStallExecution
    Causes the caller's thread to stall for a specified interval not to exceed 50 milliseconds. NdisStallExecution is only called at raised IRQL when NdisMSleep cannot be used.
  • NdisInitializeEvent
    Creates and initializes an event which can be used to synchronize driver operations.
  • NdisWaitEvent
    Causes the caller to wait until the specified event is signaled or the specified time interval expires.
  • NdisAllocateSpinLock
    Initializes a variable of type NDIS_SPIN_LOCK, used to synchronize access to resources shared among non-ISR driver functions.
  • NdisFreeSpinLock
    Releases a spin lock initialized in a preceding call to NdisAllocateSpinLock.
  • NdisAcquireSpinLock
    Acquires a spin lock to protect access to shared resources between non-ISR driver functions in an SMP-safe way. Miniport drivers that are running at IRQL < DISPATCH_LEVEL call this function to acquire a spin lock.
  • NdisDprAcquireSpinLock
    Acquires a spin lock at IRQL = DISPATCH_LEVEL. Protects access to shared resources between non-ISR driver functions in an SMP-safe way. Faster than calling NdisAcquireSpinLock for driver functions running at IRQL = DISPATCH_LEVEL.
  • NdisInitializeReadWriteLock
    Initializes a variable of type NDIS_RW_LOCK. An NDIS_RW_LOCK variable is used to limit write access to shared resources to one non-ISR-driver thread at a time. This NDIS_RW_LOCK can allow multiple non-ISR-driver threads concurrent read access to those resources. Such read access is not permitted during a write access.
  • NdisAcquireReadWriteLock
    Acquires a lock that the caller uses for either write or read access to the resources that are shared among driver threads. Miniport drivers that are running at IRQL < DISPATCH_LEVEL call this function to acquire a read-write lock. Read-write locks are used for resources that are frequently accessed for reading and infrequently accessed for writing.
  • NdisReleaseReadWriteLock
    Releases a read-write lock that was acquired in a preceding call to NdisAcquireReadWriteLock.
  • NdisMSynchronizeWithInterrupt
    Any NIC driver function that shares resources with the MiniportISR or MiniportDisableInterrupt functions must synchronize access to resources with these two functions to prevent race conditions. Functions that must synchronize with MiniportISR and MiniportDisableInterrupt do so by calling NdisMSynchronizeWithInterrupt with a MiniportSynchronizeISR function that also runs at DIRQL while it accesses the shared resource.

 

 

Send comments about this topic to Microsoft