1 /*++ 2 3 Copyright (c) Microsoft Corporation 4 5 Module Name: 6 7 FxUsbRequestContext.hpp 8 9 Abstract: 10 11 Author: 12 13 Environment: 14 15 kernel mode only 16 17 Revision History: 18 19 --*/ 20 21 #ifndef _FXUSBREQUESTCONTEXT_H_ 22 #define _FXUSBREQUESTCONTEXT_H_ 23 24 #if (FX_CORE_MODE == FX_CORE_USER_MODE) 25 #include <umusb.h> 26 #endif 27 28 struct FxUsbRequestContext : public FxRequestContext { 29 FxUsbRequestContext( 30 __in FX_REQUEST_CONTEXT_TYPE Type 31 ) : 32 FxRequestContext(Type) 33 { 34 InitUsbParameters(); 35 SetUsbType(WdfUsbRequestTypeNoFormat); 36 } 37 38 virtual 39 USBD_STATUS 40 GetUsbdStatus( 41 VOID 42 ) = 0; 43 44 virtual 45 VOID 46 CopyParameters( 47 __in FxRequestBase* Request 48 ) 49 { 50 m_UsbParameters.UsbdStatus = GetUsbdStatus(); 51 FxRequestContext::CopyParameters(Request); // __super call 52 } 53 54 VOID 55 SetUsbType( 56 __in WDF_USB_REQUEST_TYPE Type 57 ) 58 { 59 // 60 // The completion params are set every time we set the type 61 // 62 m_CompletionParams.Type = WdfRequestTypeUsb; 63 m_CompletionParams.Parameters.Usb.Completion = &m_UsbParameters; 64 65 m_UsbParameters.Type = Type; 66 } 67 68 VOID 69 __inline 70 InitUsbParameters( 71 VOID 72 ) 73 { 74 RtlZeroMemory(&m_UsbParameters, sizeof(m_UsbParameters)); 75 } 76 77 public: 78 WDF_USB_REQUEST_COMPLETION_PARAMS m_UsbParameters; 79 80 #if (FX_CORE_MODE == FX_CORE_USER_MODE) 81 // 82 // UMURB we send to the WUDF USB Dispatcher. The dispatcher 83 // extracts the encoded data and passes it to WinUsb APIs. 84 // 85 UMURB m_UmUrb; 86 #endif 87 }; 88 89 #endif // _FXUSBREQUESTCONTEXT_H_ 90