1 /*++ 2 3 Copyright (c) Microsoft Corporation 4 5 Module Name: 6 7 FxDmaEnablerCallbacks.hpp 8 9 Abstract: 10 11 This module implements the FxDmaEnabler object callbacks 12 13 Environment: 14 15 kernel mode only 16 17 Revision History: 18 19 --*/ 20 21 #ifndef _FXDMAENABLERCALLBACKS_HPP 22 #define _FXDMAENABLERCALLBACKS_HPP 23 24 enum FxDmaEnablerCallbacks { 25 26 FxEvtDmaEnablerInvalid, 27 FxEvtDmaEnablerFill, 28 FxEvtDmaEnablerFlush, 29 FxEvtDmaEnablerEnable, 30 FxEvtDmaEnablerDisable, 31 FxEvtDmaEnablerSelfManagedIoStart, 32 FxEvtDmaEnablerSelfManagedIoStop, 33 34 }; 35 36 // 37 // EvtDmaEnablerFill callback delegate 38 // 39 class FxEvtDmaEnablerFillCallback : public FxCallback { 40 41 public: 42 PFN_WDF_DMA_ENABLER_FILL m_Method; 43 44 NTSTATUS m_Status; 45 46 FxEvtDmaEnablerFillCallback( 47 VOID 48 ) : 49 FxCallback(), 50 m_Method(NULL), 51 m_Status(STATUS_SUCCESS) 52 { 53 } 54 55 NTSTATUS 56 Invoke( 57 __in WDFDMAENABLER Handle 58 ) 59 { 60 if (m_Method) { 61 CallbackStart(); 62 m_Status = m_Method( Handle ); 63 CallbackEnd(); 64 } 65 else { 66 m_Status = STATUS_SUCCESS; 67 } 68 return m_Status; 69 } 70 }; 71 72 // 73 // EvtDmaEnablerFlush callback delegate 74 // 75 class FxEvtDmaEnablerFlushCallback : public FxCallback { 76 77 public: 78 PFN_WDF_DMA_ENABLER_FLUSH m_Method; 79 80 NTSTATUS m_Status; 81 82 FxEvtDmaEnablerFlushCallback( 83 VOID 84 ) : 85 FxCallback(), 86 m_Method(NULL), 87 m_Status(STATUS_SUCCESS) 88 { 89 } 90 91 NTSTATUS 92 Invoke( 93 __in WDFDMAENABLER Handle 94 ) 95 { 96 if (m_Method) { 97 CallbackStart(); 98 m_Status = m_Method( Handle ); 99 CallbackEnd(); 100 } 101 else { 102 m_Status = STATUS_SUCCESS; 103 } 104 return m_Status; 105 } 106 }; 107 108 // 109 // EvtDmaEnablerEnable callback delegate 110 // 111 class FxEvtDmaEnablerEnableCallback : public FxCallback { 112 113 public: 114 PFN_WDF_DMA_ENABLER_ENABLE m_Method; 115 116 NTSTATUS m_Status; 117 118 FxEvtDmaEnablerEnableCallback( 119 VOID 120 ) : 121 FxCallback(), 122 m_Method(NULL), 123 m_Status(STATUS_SUCCESS) 124 { 125 } 126 127 NTSTATUS 128 Invoke( 129 __in WDFDMAENABLER Handle 130 ) 131 { 132 if (m_Method) { 133 CallbackStart(); 134 m_Status = m_Method( Handle ); 135 CallbackEnd(); 136 } 137 else { 138 m_Status = STATUS_SUCCESS; 139 } 140 return m_Status; 141 } 142 }; 143 144 // 145 // EvtDmaEnablerDisable callback delegate 146 // 147 class FxEvtDmaEnablerDisableCallback : public FxCallback { 148 149 public: 150 PFN_WDF_DMA_ENABLER_DISABLE m_Method; 151 152 NTSTATUS m_Status; 153 154 FxEvtDmaEnablerDisableCallback( 155 VOID 156 ) : 157 FxCallback(), 158 m_Method(NULL), 159 m_Status(STATUS_SUCCESS) 160 { 161 } 162 163 NTSTATUS 164 Invoke( 165 __in WDFDMAENABLER Handle 166 ) 167 { 168 if (m_Method) { 169 CallbackStart(); 170 m_Status = m_Method( Handle ); 171 CallbackEnd(); 172 } 173 else { 174 m_Status = STATUS_SUCCESS; 175 } 176 return m_Status; 177 } 178 }; 179 180 // 181 // EvtDmaEnablerSelfManagedIoStart callback delegate 182 // 183 class FxEvtDmaEnablerSelfManagedIoStartCallback : public FxCallback { 184 185 public: 186 PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_START m_Method; 187 188 NTSTATUS m_Status; 189 190 FxEvtDmaEnablerSelfManagedIoStartCallback( 191 VOID 192 ) : 193 FxCallback(), 194 m_Method(NULL), 195 m_Status(STATUS_SUCCESS) 196 { 197 } 198 199 NTSTATUS 200 Invoke( 201 __in WDFDMAENABLER Handle 202 ) 203 { 204 if (m_Method) { 205 CallbackStart(); 206 m_Status = m_Method( Handle ); 207 CallbackEnd(); 208 } 209 else { 210 m_Status = STATUS_SUCCESS; 211 } 212 return m_Status; 213 } 214 }; 215 216 217 // 218 // EvtDmaEnablerSelfManagedIoStop callback delegate 219 // 220 class FxEvtDmaEnablerSelfManagedIoStopCallback : public FxCallback { 221 222 public: 223 PFN_WDF_DMA_ENABLER_SELFMANAGED_IO_STOP m_Method; 224 225 NTSTATUS m_Status; 226 227 FxEvtDmaEnablerSelfManagedIoStopCallback( 228 VOID 229 ) : 230 FxCallback(), 231 m_Method(NULL), 232 m_Status(STATUS_SUCCESS) 233 { 234 } 235 236 NTSTATUS 237 Invoke( 238 __in WDFDMAENABLER Handle 239 ) 240 { 241 if (m_Method) { 242 CallbackStart(); 243 m_Status = m_Method( Handle ); 244 CallbackEnd(); 245 } 246 else { 247 m_Status = STATUS_SUCCESS; 248 } 249 return m_Status; 250 } 251 }; 252 253 254 #endif // _FXDMAENABLERCALLBACKS_HPP 255