1 2 /*++ 3 4 Copyright (c) Microsoft. All rights reserved. 5 6 Module Name: 7 8 IFxHasCallbacks.hpp 9 10 Abstract: 11 12 Interface that objects with device driver callbacks and 13 constraints implement 14 15 Author: 16 17 18 19 Environment: 20 21 Both kernel and user mode 22 23 Revision History: 24 25 --*/ 26 27 #ifndef __IFX_HASCALLBACKS_HPP 28 #define __IFX_HASCALLBACKS_HPP 29 30 // 31 // Objects that have callbacks into the device driver 32 // (implemented by deriving a delegate from FxCallback), may 33 // have constraints specified by the device driver when the object 34 // or driver was created. 35 // 36 // These constraints control synchronization, and execution (IRQL) level 37 // on callbacks to the device driver. 38 // 39 // To provide synchronization an FxCallbackLock may be implemented, at 40 // either DISPATCH (spinlock) or PASSIVE (mutex lock) level depending 41 // on whether a passive level constraint is in effect. 42 // 43 // This interface allows the constraints, and any associated locks 44 // to be retrieved in a generic fashion from the object, such as 45 // for implementing the WdfObjectAcquireLock/WdfObjectReleaseLock APIs. 46 // 47 48 class IFxHasCallbacks { 49 50 public: 51 52 // 53 // Returns the constraints in effect for the object. 54 // 55 virtual 56 VOID 57 GetConstraints( 58 __out WDF_EXECUTION_LEVEL* ExecutionLevel, 59 __out WDF_SYNCHRONIZATION_SCOPE* SynchronizationScope 60 ) = 0; 61 62 // 63 // This returns the callback lock in effect for the object that 64 // will serialize with its event callbacks to the device driver. 65 // 66 // If no callback locks are in effect, the return value is NULL. 67 // 68 // The type of FxCallbackLock returned may be a spinlock, or mutex 69 // type depending on whether the object has a passive level callback 70 // constraint in effect. 71 // 72 // In addition, optionally returns the object that contains the lock 73 // providing any serialization constraint. This allows reference counting 74 // the object who owns the lock, which may not be the target 75 // object. An example would be a child object sharing its parent 76 // FxDevice's synchronziation lock. 77 // 78 _Must_inspect_result_ 79 virtual 80 FxCallbackLock* 81 GetCallbackLockPtr( 82 __out_opt FxObject** LockObject 83 ) = 0; 84 }; 85 86 #endif // __IFX_HASCALLBACKS_HPP 87 88 89