www.pudn.com > usbfx2lk_v1.1.zip > usbfx2lk.h


/////////////////////////////////////////////////////////////////////////////// 
// 
//    (C) Copyright 2005 OSR Open Systems Resources, Inc. 
//    All Rights Reserved 
// 
//    This sofware is supplied for instructional purposes only. 
// 
//    OSR Open Systems Resources, Inc. (OSR) expressly disclaims any warranty 
//    for this software.  THIS SOFTWARE IS PROVIDED  "AS IS" WITHOUT WARRANTY 
//    OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, 
//    THE IMPLIED WARRANTIES OF MECHANTABILITY OR FITNESS FOR A PARTICULAR 
//    PURPOSE.  THE ENTIRE RISK ARISING FROM THE USE OF THIS SOFTWARE REMAINS 
//    WITH YOU.  OSR's entire liability and your exclusive remedy shall not 
//    exceed the price paid for this material.  In no event shall OSR or its 
//    suppliers be liable for any damages whatsoever (including, without 
//    limitation, damages for loss of business profit, business interruption, 
//    loss of business information, or any other pecuniary loss) arising out 
//    of the use or inability to use this software, even if OSR has been 
//    advised of the possibility of such damages.  Because some states/ 
//    jurisdictions do not allow the exclusion or limitation of liability for 
//    consequential or incidental damages, the above limitation may not apply 
//    to you. 
// 
//    OSR Open Systems Resources, Inc. 
//    105 Route 101A Suite 19 
//    Amherst, NH 03031  (603) 595-6500 FAX: (603) 595-6503 
//    email bugs to: bugs@osr.com 
// 
// 
//    MODULE: 
// 
//        USBFX2LK.H 
// 
//    ABSTRACT: 
// 
//		This is the general include file for the OSR USB FX2 Learning Kit Driver. 
// 
//    AUTHOR(S): 
// 
//        OSR Open Systems Resources, Inc. 
//  
/////////////////////////////////////////////////////////////////////////////// 
#ifndef __USBFX2LK_H__ 
#define __USBFX2LK_H__ (1) // suppress duplicate loading of this file 
 
extern "C" { 
 
#include  
#include  
#include  
#include  
#include  
#include  
#include  
#include  
 
// 
// 4200: nonstandard extension used. 
// 
// We like to build with the .CPP suffix in order to 
//  get the strong type checking and various other benefits 
//  of the C++ compiler, but unforunately the USB headers 
//  don't compile correctly when included. We must disable 
//  this warning in order to make things work properly. 
// 
#pragma warning(push) 
#pragma warning(disable : 4200) 
#include  
#pragma warning(pop) 
 
#include  
 
#ifndef W2K 
#include  
#endif 
}; 
 
#include "usbfx2lk_ioctl.h" 
#include "usbfx2lk_mofdata.h" 
 
 
// 
// Define Driver Name to be used in outputting debug messages. 
// 
#define DRIVER_NAME "OSRUSBFX2" 
 
// 
// Debugging Output Levels 
// 
 
#ifndef TRACE_LEVEL_INFORMATION 
#define TRACE_LEVEL_NONE        0   // Tracing is not on 
#define TRACE_LEVEL_FATAL       1   // Abnormal exit or termination 
#define TRACE_LEVEL_ERROR       2   // Severe errors that need logging 
#define TRACE_LEVEL_WARNING     3   // Warnings such as allocation failure 
#define TRACE_LEVEL_INFORMATION 4   // Includes non-error cases(e.g.,Entry-Exit) 
#define TRACE_LEVEL_VERBOSE     5   // Detailed traces from intermediate steps 
#define TRACE_LEVEL_RESERVED6   6 
#define TRACE_LEVEL_RESERVED7   7 
#define TRACE_LEVEL_RESERVED8   8 
#define TRACE_LEVEL_RESERVED9   9 
#endif // TRACE_LEVEL_INFORMATION 
 
// 
// WPP_TRACING is enabled or disabled in the SOURCES file 
// 
#ifdef WPP_TRACING 
 
#define WPP_CONTROL_GUIDS \ 
  WPP_DEFINE_CONTROL_GUID(USBFX2LK,(AC072299,57FA,46e9,BF59,E9E649182794), \ 
    WPP_DEFINE_BIT(OSRDBG_PNP_INFO)                /*0x00000001*/ \ 
    WPP_DEFINE_BIT(OSRDBG_IOCTL_INFO)              /*0x00000002*/ \ 
    WPP_DEFINE_BIT(OSRDBG_CREATE_CLOSE_INFO)       /*0x00000004*/ \ 
    WPP_DEFINE_BIT(OSRDBG_POWER_INFO)              /*0x00000008*/ \ 
    WPP_DEFINE_BIT(OSRDBG_WMI_INFO)                /*0x00000010*/ \ 
    WPP_DEFINE_BIT(OSRDBG_READWRITE)               /*0x00000020*/ \ 
    WPP_DEFINE_BIT(OSRDBG_REFERENCE_COUNT)         /*0x00000040*/ \ 
    WPP_DEFINE_BIT(OSRDBG_USB)                     /*0x00000080*/ \ 
    WPP_DEFINE_BIT(OSRDBG_SELECTIVE_SUSPEND)       /*0x00000100*/ \ 
    WPP_DEFINE_BIT(OSRDBG_WAIT_WAKE)               /*0x00000200*/ \ 
    WPP_DEFINE_BIT(OSRDBG_WAIT_FOR_OBJECT)         /*0x00000400*/ \ 
    ) 
 
#define WPP_LEVEL_FLAGS_LOGGER(lvl,flags) \ 
    WPP_LEVEL_LOGGER(flags) 
 
#define WPP_LEVEL_FLAGS_ENABLED(lvl, flags) \ 
    (WPP_LEVEL_ENABLED(flags) && WPP_CONTROL(WPP_BIT_ ## flags).Level >= lvl) 
 
#else // WPP_TRACING 
 
#define OSRDBG_PNP_INFO                0x00000001 
#define OSRDBG_IOCTL_INFO              0x00000002 
#define OSRDBG_CREATE_CLOSE_INFO       0x00000004 
#define OSRDBG_POWER_INFO              0x00000008 
#define OSRDBG_WMI_INFO                0x00000010 
#define OSRDBG_READWRITE               0x00000020 
#define OSRDBG_REFERENCE_COUNT         0x00000040 
#define OSRDBG_USB                     0x00000080 
#define OSRDBG_SELECTIVE_SUSPEND       0x00000100 
#define OSRDBG_WAIT_WAKE               0x00000200 
#define OSRDBG_WAIT_FOR_OBJECT         0x00000400 
 
#define OsrTracePrint(_level,_flag_,_msg_)      \ 
    if (OsrDebugLevel & (_flag_)) {     \ 
        DbgPrint (DRIVER_NAME": ");    \ 
        DbgPrint _msg_;                 \ 
    } 
 
#endif //WPP_TRACING 
 
 
//////////////////// 
// Shared Globals // 
//////////////////// 
 
extern UNICODE_STRING GlobalRegistryPath; 
extern ULONG          OsrDebugLevel; 
 
// 
// Handy Dandy Time Macros 
// 
 
#define ABSOLUTE(wait) (wait) 
 
#define RELATIVE(wait) (-(wait)) 
 
#define NANOSECONDS(nanos) \ 
(((signed __int64)(nanos)) / 100L) 
 
#define MICROSECONDS(micros) \ 
(((signed __int64)(micros)) * NANOSECONDS(1000L)) 
 
#define MILLISECONDS(milli) \ 
(((signed __int64)(milli)) * MICROSECONDS(1000L)) 
 
#define SECONDS(seconds) \ 
(((signed __int64)(seconds)) * MILLISECONDS(1000L)) 
 
#define IRP_MN_BOGUS 0xFF 
 
 
// 
// We are using a quad buffered buffer for bulk  
//  transfers on the USBFX2LK firmware. Therefore, 
//  we'll limit our bulk transfers to the maximum 
//  packet size returned from the device * 4 
// 
#define USBFX2LK_BULK_TRANSFER_FW_BUFFERING 4 
 
 
typedef struct _USBFX2LK_PIPE_CONTEXT { 
 
    USBD_PIPE_INFORMATION   PipeInformation;    // Information about Pipe 
 
} USBFX2LK_PIPE_CONTEXT, *PUSBFX2LK_PIPE_CONTEXT; 
 
// 
// PnP Device States used by Driver. 
// 
typedef enum _PNP_DEVICE_STATE { 
 
    // 
    // In STATE_REMOVED, we immediately fail any received I/O requests 
    // 
    STATE_REMOVED                   = 0x00000000, 
 
    // 
    // In STATE_SURPRISE_REMOVED, we immediately fail all incoming requests 
    // 
    STATE_SURPRISE_REMOVED          = 0x00010000, 
 
    // 
    // In STATE_NEVER_STARTED, we immediately fail all incoming requests 
    // 
    STATE_NEVER_STARTED             = 0x00020000, 
 
    // 
    // Dummy State -- When the state is < this value, no H/W access is 
    // allowed 
    // 
    STATE_ALL_BELOW_NO_HW           = 0x00030000,   // ****************** 
 
    // 
    // Dummy state -- When an IRP arrives at the driver, if the current 
    // device state is below this value, it is immediately failed 
    // 
    STATE_ALL_BELOW_FAIL            = 0x00FF0000,   // ****************** 
 
    // 
    // In STATE_STARTED, requests are processed and removed from the 
    // queues normally 
    // 
    STATE_STARTED                   = 0x01210000, 
 
    // 
    // Dummy state -- When an IRP arrives at the driver, if the current 
    // device state is above this value, it is queued, not initiated on 
    // the device (even if the device is free) 
    // 
    STATE_ALL_ABOVE_QUEUE           = 0x0FFF0000,   // ****************** 
 
    // 
    // Dummy State -- When an IRP is COMPLETED on the device, if 
    // the device state is below this value, we'll start another 
    // IRP in an attempt to drain the queue of pending requests. 
    // 
    STATE_ALL_BELOW_DRAIN           = STATE_ALL_ABOVE_QUEUE,    // ****************** 
 
    // 
    // In STATE_STOP_PENDING, we queue incoming requests 
    // 
    STATE_STOP_PENDING              = 0x10000000, 
 
 
    // 
    // In STATE_REMOVE_PENDING, we queue incoming requests 
    // 
    STATE_REMOVE_PENDING            = 0x10010000, 
 
 
    // 
    // In STATE_STOPPED, we queue incoming requests 
    // 
    STATE_STOPPED                   = 0x10100000, 
 
    // 
    // In STATE_POWER_PROCESSING, we queue incoming requests 
    // 
    STATE_POWER_PROCESSING          = 0x11000000, 
 
} PNP_DEVICESTATE, *PPNPDEVICE_STATE; 
 
// 
// Define the vendor commands supported by our device 
// 
#define USBFX2LK_READ_7SEGMENT_DISPLAY      0xD4 
#define USBFX2LK_READ_SWITCHES              0xD6 
#define USBFX2LK_READ_BARGRAPH_DISPLAY      0xD7 
#define USBFX2LK_SET_BARGRAPH_DISPLAY       0xD8 
#define USBFX2LK_IS_HIGH_SPEED              0xD9 
#define USBFX2LK_REENUMERATE                0xDA 
#define USBFX2LK_SET_7SEGMENT_DISPLAY       0xDB 
 
// 
// Define the features that we can clear 
//  and set on our device 
// 
#define USBFX2LK_FEATURE_EPSTALL            0x00 
#define USBFX2LK_FEATURE_WAKE               0x01 
 
// 
// Define the constants used in selective  
//  suspend 
// 
 
// 
// Our selective suspend states 
// 
#define SS_NOT_STARTED              0x7777 
#define SS_PROCESSING               0x8888 
#define SS_SUSPENDED                0x9999 
 
// 
// The amount of time that the device should 
//  be idle before suspending 
//   
// We'll use 5 seconds 
// 
#define SS_DEVICE_IDLE_DELAY        (ABSOLUTE(SECONDS(5))) 
 
 
 
 
// 
// USBFx2Lk Device Extension 
// 
typedef struct _USBFX2LK_EXT { 
    ULONG                           MagicNumber; 
 
    //  
    // Address of Our Device Object 
    // 
    PDEVICE_OBJECT                  FunctionalDeviceObject; 
 
    // 
    // Address of PDO that was passed to our AddDevice Entry Point 
    // 
    PDEVICE_OBJECT                  PhysicalDeviceObject; 
 
    // 
    // Address of PDO that we actually attached to in our 
    // AddDevice Entry Point.  This is who we forward PnP and Power 
    // Irps to. 
    // 
    PDEVICE_OBJECT                  DeviceToSendIrpsTo; 
 
    // 
    // Name buffer for our named Functional device object link 
    // The name is generated based on the driver's class GUID 
    // 
    UNICODE_STRING                  InterfaceName; 
    ULONG                           InstanceNumber; 
    BOOLEAN                         Opened; 
 
    // 
    // Bus drivers set the appropriate values in this structure in response 
    // to an IRP_MN_QUERY_CAPABILITIES IRP. Function and filter drivers might 
    // alter the capabilities set by the bus driver. 
    // 
    DEVICE_CAPABILITIES             DeviceCapabilities; 
    BOOLEAN                         DeviceCapabilitiesInitialized; 
 
    // 
    // Device descriptor 
    // 
    PUSB_DEVICE_DESCRIPTOR          UsbDeviceDescriptor; 
 
    // 
    // Configuration Descriptor 
    // 
    PUSB_CONFIGURATION_DESCRIPTOR   UsbConfigurationDescriptor; 
 
    // 
    // Interface Information structure 
    // 
    PUSBD_INTERFACE_INFORMATION     UsbInterface; 
 
    // 
    // Pipe Information 
    // 
    PUSBFX2LK_PIPE_CONTEXT          PipeContext; 
 
    // 
    // The PUSBFX2LK_PIPE_CONTEXT PipeContext pointer 
    //  above is allocated as an array of PUSBFX2LK_PIPE_CONTEXT 
    //  pointers. In our driver, there will be 3 pipes: 
    //  1) Bulk In 
    //  2) Bulk Out 
    //  3) Interrupt 
    // 
    //  Because we'll need to access these individual 
    //  pipes in different places, below are three pointers 
    //  into the above array to reference each individual 
    //  pipe. These should NOT be individually freed, 
    //  only PipeContext need be freed 
    // 
    PUSBFX2LK_PIPE_CONTEXT          BulkInPipe; 
    PUSBFX2LK_PIPE_CONTEXT          BulkOutPipe; 
    PUSBFX2LK_PIPE_CONTEXT          InterruptPipe; 
 
    // 
    // The number of pipes that we found 
    // 
    ULONG                           NumberOfPipes; 
 
    // 
    // IO_CSQ for our cancel safe Io queue 
    // 
    IO_CSQ                          CancelSafeIoQueue; 
 
    // 
    // KSPIN_LOCK for protecting our cancel safe  
    //  IO queue 
    // 
    KSPIN_LOCK                      CancelSafeIoLock; 
    KSPIN_LOCK                      IoStateLock; 
 
    // 
    // LIST_ENTRY for the head of our pending write irp queue 
    // 
    LIST_ENTRY                      IoQueue; 
 
    // 
    // Set to True if Device is Running at High Speed. 
    // This is really only needed for W2k. 
    // 
    BOOLEAN                         RunningAtHighSpeed; 
 
    // 
    // WMI Information 
    // 
    WMILIB_CONTEXT                  WmiLibInfo; 
    BOOLEAN                         WmiRegistered; 
    USBFX2LK_STATISTICS             WmiStatistics; 
 
    // 
    // PnP State Variables 
    // 
    PNP_DEVICESTATE                 DevicePnPState; 
 
    // 
    // Number of Outstanding I/O requests queued to Driver Below 
    // 
    LONG                            OutStandingIoCount; 
    KEVENT                          StopEvent;  // Signaled when no outstanding I/O 
                                                // requests queued to driver 
    KEVENT                          RemoveEvent;// Signaled when no outstanding 
                                                // requests are queued to driver. 
 
    // 
    // Wait Wake Information. 
    // 
    PIRP                            WaitWakeIrp;    // Address of Irp  
    LONG                            FlagWWCancel;   // Cancel 
    LONG                            FlagWWOutstanding; 
    BOOLEAN                         WaitWakeEnable; 
    ULONG                           PowerDownLevel; 
 
 
    // 
    // DEVICE_POWER_STATE the current device power state 
    // 
    DEVICE_POWER_STATE              DevicePowerState; 
 
    // 
    // SYSTEM_POWER_STATE the current system power state 
    // 
    SYSTEM_POWER_STATE              SystemPowerState; 
 
    // 
    // DEVICE_POWER_STATE[PowerSystemMaximum] array of system 
    //  to device power mappings 
    // 
    DEVICE_POWER_STATE              SystemToDevicePowerMappings[PowerSystemMaximum]; 
 
    // 
    // PIRP System power IRP temporary storage 
    // 
    PIRP                            SystemPowerIrp; 
 
    // 
    // Definitions for Selective Suspend support 
    // 
 
    // 
    // KSPIN_LOCK used to protect all fields of the device extension 
    //  used in selective suspend 
    // 
    KSPIN_LOCK                      SSLock; 
 
    // 
    // BOOLEAN indicating if the user wishes to allow the device 
    //  to suspend when idle 
    // 
    BOOLEAN                         SSEnabledByUser; 
 
    // 
    // BOOLEAN indicating that the selective suspend 
    //  members of our device extension have been initialized. 
    // 
    BOOLEAN                         SSInitialized; 
 
    // 
    // BOOLEAN indicating whether or not the device can suspend 
    //  at this moment in time.  
    // 
    BOOLEAN                         SSDeviceCanNowSuspend; 
 
    // 
    // ULONG current state of the selective suspend process 
    // 
    ULONG                           SSState; 
 
    // 
    // HANDLE to a thread that will monitor the activity 
    //  on the device and will suspend the device when  
    //  appropriate 
    // 
    HANDLE                          SSSubmissionThread; 
 
    // 
    // PVOID pointer to the thread object of the  
    //  SS submission thread 
    // 
    PVOID                           SSSubmissionThreadObject; 
 
    // 
    // KEVENT to signal that the SSSubmissionThread should 
    //  terminate itself 
    // 
    KEVENT                          SSSubmissionThreadTerminateEvent; 
 
    // 
    // KEVENT that is signalled when the device powers itself 
    //  out of selective suspend.  
    // 
    KEVENT                          SSDeviceNotSuspendedEvent; 
 
    // 
    // LARGE_INTEGER indicating the system time when the device 
    //  was last marked as idle 
    // 
    LARGE_INTEGER                   SSTimeOfLastActivity; 
 
#ifndef W2K 
 
    // 
    // USB_IDLE_CALLBACK_INFO used for idle callback notification 
    // 
    USB_IDLE_CALLBACK_INFO          SSIdleCallbackInfo; 
 
    // 
    // We need some extra state to avoid numerous race 
    //  conditions within the idle notification callback 
    //  scheme used on XP and later 
    // 
 
    // 
    // KEVENT indicating whether or not the idle notification 
    //  callback has fired 
    // 
    KEVENT                           SSIdleCallbackCalled; 
 
    // 
    // KEVENT indicating whether or not the completion 
    //  routine for the IRP used to submit the idle notification 
    //  callback has fired 
    // 
    KEVENT                           SSIdleCompletionRoutineCalled; 
 
    // 
    // PIRP for the outstanding IDLE request, if there is one 
    // 
    PIRP                             SSIdleIrp; 
 
#endif 
 
} USBFX2LK_EXT, *PUSBFX2LK_EXT; 
 
#define USBFX2LK_EXT_MAGIC_NUMBER 0xFFEEFF00 
 
#define VALID_DEVEXT(x) \ 
    ASSERT(x->MagicNumber == USBFX2LK_EXT_MAGIC_NUMBER); 
 
// 
// Context used to track I/O Requests. 
// 
typedef struct _USBFX2LK_IO_CONTEXT { 
 
    PURB            Urb; 
    PIRP            Irp; 
    PMDL            Mdl; 
    ULONG           RemainingLength; // remaining to xfer 
    ULONG           Numxfer;        // cumulate xfer 
    PUCHAR          VirtualAddress; // va for next segment of xfer. 
    PUSBFX2LK_EXT   DevExt; 
    ULONG           MaxmimumStageSize; 
    ULONG           TotalLength; 
    PIO_WORKITEM    PWorkItem; 
 
} USBFX2LK_IO_CONTEXT, *PUSBFX2LK_IO_CONTEXT; 
 
 
 
// 
// Forward definitions 
// 
 
// 
// In UsbFx2Lk.cpp 
// 
VOID UsbFx2LkUnload(PDRIVER_OBJECT DriverObject); 
#ifdef WPP_TRACING 
#ifdef W2K 
VOID W2KInitializeWPPTracing(PDEVICE_OBJECT DeviceObject, 
                             PUNICODE_STRING RegistryPath); 
VOID W2KCleanupWPPTracing(PDEVICE_OBJECT DeviceObject); 
#endif // W2K_BUILD 
#endif //WPP_TRACING 
 
// 
// In UsbFx2Lk_CreateClose.cpp 
// 
NTSTATUS UsbFx2LkCreate(PDEVICE_OBJECT DeviceObject,PIRP Irp); 
NTSTATUS UsbFx2LkClose(PDEVICE_OBJECT DeviceObject,PIRP Irp); 
 
// 
// In UsbFx2Lk_io.cpp 
// 
NTSTATUS UsbFx2LkRead(PDEVICE_OBJECT DeviceObject,PIRP Irp); 
NTSTATUS UsbFx2LkWrite(PDEVICE_OBJECT DeviceObject,PIRP Irp); 
VOID OsrProcessQueuedRequests(PUSBFX2LK_EXT DevExt); 
VOID ProcessNextIrpInQueue(PUSBFX2LK_EXT DevExt); 
 
// 
// In UsbFx2Lk_devctrl.cpp 
// 
NTSTATUS UsbFx2LkDeviceControl(PDEVICE_OBJECT DeviceObject,PIRP Irp); 
 
// 
// In UsbFx2Lk_sysctrl.cpp 
// 
NTSTATUS UsbFx2LkSystemControl(PDEVICE_OBJECT DeviceObject,PIRP Irp); 
 
// 
// In UsbFx2Lk_pnp.cpp 
// 
NTSTATUS UsbFx2LkPnp(PDEVICE_OBJECT DeviceObject,PIRP Irp); 
NTSTATUS UsbFx2LkAddDevice(PDRIVER_OBJECT PDriverObject,PDEVICE_OBJECT PPdo); 
CONST PCHAR OsrPrintState(PUSBFX2LK_EXT PDevExt);  
VOID OsrWaitForStop(PUSBFX2LK_EXT DevExt);  
VOID OsrUpdateDeviceState(PUSBFX2LK_EXT DevExt,PNP_DEVICESTATE State); 
VOID OsrDecrementOutstandingIoCount(PUSBFX2LK_EXT PDevExt,const char* FileName,ULONG LineNumber); 
VOID OsrIncrementOutstandingIoCount(PUSBFX2LK_EXT PDevExt,const char* FileName,ULONG LineNumber); 
NTSTATUS OsrWaitForSingleObject(PVOID Object); 
NTSTATUS OsrWaitForMultipleObjects(ULONG ObjectCount, PVOID *Objects,  
                                   WAIT_TYPE WaitType,  
                                   PKWAIT_BLOCK WaitBlockArray); 
 
 
 
// 
// In UsbFx2Lk_power.cpp 
// 
NTSTATUS UsbFx2LkPower(PDEVICE_OBJECT DeviceObject,PIRP Irp); 
NTSTATUS IssueWaitWake(PUSBFX2LK_EXT DevExt); 
VOID CancelWaitWake(PUSBFX2LK_EXT DevExt); 
VOID PrintDeviceCapabilities(PDEVICE_CAPABILITIES PParentCapabilities,PUCHAR Title); 
PCHAR OsrPrintSystemPowerState(SYSTEM_POWER_STATE State); 
PCHAR OsrPrintPowerAction(POWER_ACTION Action); 
PCHAR OsrPrintDevicePowerState(DEVICE_POWER_STATE State); 
PCHAR OsrPrintPowerStateType(POWER_STATE_TYPE Type); 
 
// 
// In UsbFx2Lk_Queue.cpp 
// 
#ifdef W2K3 
NTSTATUS OsrCsqInsertIoIrpEx(PIO_CSQ Csq,PIRP Irp,PVOID InsertContext); 
#else // W2K3 
VOID OsrCsqInsertIoIrp(PIO_CSQ Csq,PIRP Irp); 
#endif // W2K3 
VOID OsrCsqRemoveIoIrp(PIO_CSQ Csq,PIRP Irp); 
PIRP OsrCsqPeekNextIoIrp(PIO_CSQ Csq,PIRP Irp,PVOID PeekContext); 
VOID OsrCsqAcquireIoLock(PIO_CSQ Csq,PKIRQL Irql); 
VOID OsrCsqReleaseIoLock(PIO_CSQ Csq,KIRQL Irql); 
VOID OsrCsqCompleteCancelledIoIrp(PIO_CSQ Csq,PIRP Irp); 
VOID OsrClearQueues(PUSBFX2LK_EXT DevExt); 
 
// 
// In UsbFx2Lk_SelSusp.cpp 
// 
VOID EnableSelectiveSuspend(PUSBFX2LK_EXT DevExt); 
VOID DisableSelectiveSuspend(PUSBFX2LK_EXT DevExt); 
VOID SSPowerDeviceIfSuspended(PUSBFX2LK_EXT DevExt); 
BOOLEAN SSPowerDeviceIfSuspendedAsync(PUSBFX2LK_EXT DevExt); 
VOID SSSubmissionThreadRoutine(PVOID Context); 
VOID SSPowerUpDevice(PUSBFX2LK_EXT DevExt); 
VOID SSPowerUpDeviceAsync(PUSBFX2LK_EXT DevExt); 
VOID SSSuspendDevice(PUSBFX2LK_EXT DevExt); 
#ifndef WIN2K 
VOID SSSuspendDeviceWithCallback(PUSBFX2LK_EXT DevExt); 
#endif 
 
// 
// In UsbFx2Lk_SysCtrl.cpp 
// 
NTSTATUS UsbFx2LkWmiRegistration(PUSBFX2LK_EXT PDevExt); 
NTSTATUS UsbFx2LkWmiDeRegistration(PUSBFX2LK_EXT PDevExt); 
 
// 
// In NtStatStr.cpp 
// 
CONST PCHAR OsrMinorFunctionToString(UCHAR MajorFunction,UCHAR MinorFunction); 
CONST PCHAR OsrNtStatusToString(NTSTATUS Status); 
 
// 
// In UsbFx2Lk_Usb.cpp 
// 
NTSTATUS ReadandSelectUsbDescriptors(PUSBFX2LK_EXT PDevExt); 
NTSTATUS DeconfigureUsbDevice(PUSBFX2LK_EXT PDevExt); 
NTSTATUS SubmitResetPipe(PUSBFX2LK_EXT DevExt, PIRP Irp, USBFX2_PIPE_ENUM Pipe); 
NTSTATUS SubmitGetBarGraphState(PUSBFX2LK_EXT DevExt, PIRP Irp); 
NTSTATUS SubmitSetBarGraphState(PUSBFX2LK_EXT DevExt, PIRP Irp); 
NTSTATUS SubmitGetSevenSegmentState(PUSBFX2LK_EXT DevExt, PIRP Irp); 
NTSTATUS SubmitSetSevenSegmentState(PUSBFX2LK_EXT DevExt, PIRP Irp); 
NTSTATUS SubmitGetSwitchState(PUSBFX2LK_EXT DevExt, PIRP Irp); 
NTSTATUS GetDeviceDescriptor(PUSBFX2LK_EXT DevExt, PUSB_DEVICE_DESCRIPTOR DeviceDescriptor, 
                             PULONG BytesTransferred); 
NTSTATUS GetConfigurationDescriptor(PUSBFX2LK_EXT DevExt, PUSB_CONFIGURATION_DESCRIPTOR ConfigDescriptor, 
                                    PULONG BytesTransferred); 
NTSTATUS GetPipeInformation(PUSBFX2LK_EXT DevExt, USBFX2_PIPE_ENUM Pipe, PUSBD_PIPE_INFORMATION PipeInformation, 
                            PULONG BytesTransferred); 
NTSTATUS GetInterfaceInformation(PUSBFX2LK_EXT DevExt, PUSBD_INTERFACE_INFORMATION InterfaceDescriptor, 
                                 PULONG BytesTransferred); 
NTSTATUS SubmitInterruptDataRequest(PUSBFX2LK_EXT DevExt, PIRP Irp); 
 
#endif //__USBFX2LK_H__