ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

fbtusb.h
Go to the documentation of this file.
00001 // Copyright (c) 2004, Antony C. Roberts
00002 
00003 // Use of this file is subject to the terms
00004 // described in the LICENSE.TXT file that
00005 // accompanies this file.
00006 //
00007 // Your use of this file indicates your
00008 // acceptance of the terms described in
00009 // LICENSE.TXT.
00010 //
00011 // http://www.freebt.net
00012 
00013 #ifndef _FREEBT_H
00014 #define _FREEBT_H
00015 
00016 #include <initguid.h>
00017 #include <wdm.h>
00018 #include <wmilib.h>
00019 #include <wmistr.h>
00020 #include <windef.h>
00021 #include "usbdi.h"
00022 #include "usbdlib.h"
00023 
00024 // Pull in all the command, event and structure definitions
00025 #include "fbtHciDefs.h"
00026 
00027 // Standard USB Wireless/Bluetooth class, etc
00028 #define FREEBT_USB_STDCLASS     0xE0        // Wireless Controller
00029 #define FREEBT_USB_STDSUBCLASS  0x01        // RF Controller
00030 #define FREEBT_USB_STDPROTOCOL  0x01        // Bluetooth Programming
00031 
00032 // Recommended Bluetooth Endpoints
00033 #define FREEBT_STDENDPOINT_HCICMD   0x00    // HCI Command
00034 #define FREEBT_STDENDPOINT_HCIEVENT 0x81    // HCI Event
00035 #define FREEBT_STDENDPOINT_ACLIN    0x82    // HCI Data In
00036 #define FREEBT_STDENDPOINT_ACLOUT   0x02    // HCI Data Out
00037 #define FREEBT_STDENDPOINT_AUDIOIN  0x83    // SCO In
00038 #define FREEBT_STDENDPOINT_AUDIOOUT 0x03    // SCO Out
00039 
00040 
00041 #define OBTTAG (ULONG) 'OBTU'
00042 
00043 #undef ExAllocatePool
00044 #define ExAllocatePool(type, size) ExAllocatePoolWithTag(type, size, OBTTAG);
00045 
00046 #if DBG
00047 
00048 #define FreeBT_DbgPrint(level, _x_) \
00049             if((level) <= DebugLevel) { \
00050                 DbgPrint _x_; \
00051             }
00052 
00053 #else
00054 
00055 #define FreeBT_DbgPrint(level, _x_)
00056 
00057 #endif
00058 
00059 typedef struct _GLOBALS
00060 {
00061     UNICODE_STRING  FreeBT_RegistryPath;
00062 
00063 } GLOBALS;
00064 
00065 #define IDLE_INTERVAL 5000
00066 
00067 typedef enum _PIPETYPE
00068 {
00069     HciCommandPipe,
00070     HciEventPipe,
00071     AclDataIn,
00072     AclDataOut,
00073     SCODataIn,
00074     SCODataOut
00075 
00076 } FREEBT_PIPETYPE;
00077 
00078 typedef enum _DEVSTATE
00079 {
00080     NotStarted,         // not started
00081     Stopped,            // device stopped
00082     Working,            // started and working
00083     PendingStop,        // stop pending
00084     PendingRemove,      // remove pending
00085     SurpriseRemoved,    // removed by surprise
00086     Removed             // removed
00087 
00088 } DEVSTATE;
00089 
00090 typedef enum _QUEUE_STATE
00091 {
00092     HoldRequests,       // device is not started yet
00093     AllowRequests,      // device is ready to process
00094     FailRequests        // fail both existing and queued up requests
00095 
00096 } QUEUE_STATE;
00097 
00098 typedef enum _WDM_VERSION
00099 {
00100     WinXpOrBetter,
00101     Win2kOrBetter,
00102     WinMeOrBetter,
00103     Win98OrBetter
00104 
00105 } WDM_VERSION;
00106 
00107 #define INITIALIZE_PNP_STATE(_Data_)    \
00108         (_Data_)->DeviceState =  NotStarted;\
00109         (_Data_)->PrevDevState = NotStarted;
00110 
00111 #define SET_NEW_PNP_STATE(_Data_, _state_) \
00112         (_Data_)->PrevDevState =  (_Data_)->DeviceState;\
00113         (_Data_)->DeviceState = (_state_);
00114 
00115 #define RESTORE_PREVIOUS_PNP_STATE(_Data_)   \
00116         (_Data_)->DeviceState =   (_Data_)->PrevDevState;
00117 
00118 
00119 // registry path used for parameters
00120 // global to all instances of the driver
00121 #define FREEBT_REGISTRY_PARAMETERS_PATH  L"\\REGISTRY\\Machine\\System\\CurrentControlSet\\SERVICES\\BULKUSB\\Parameters"
00122 
00123 typedef struct _FREEBT_PIPE_CONTEXT
00124 {
00125     BOOLEAN         PipeOpen;
00126     FREEBT_PIPETYPE PipeType;
00127 
00128 } FREEBT_PIPE_CONTEXT, *PFREEBT_PIPE_CONTEXT;
00129 
00130 // A structure representing the instance information associated with
00131 // this particular device.
00132 typedef struct _DEVICE_EXTENSION
00133 {
00134     // Functional Device Object
00135     PDEVICE_OBJECT FunctionalDeviceObject;
00136 
00137     // Device object we call when submitting Urbs
00138     PDEVICE_OBJECT TopOfStackDeviceObject;
00139 
00140     // The bus driver object
00141     PDEVICE_OBJECT PhysicalDeviceObject;
00142 
00143     // Name buffer for our named Functional device object link
00144     // The name is generated based on the driver's class GUID
00145     UNICODE_STRING InterfaceName;
00146 
00147     // Bus drivers set the appropriate values in this structure in response
00148     // to an IRP_MN_QUERY_CAPABILITIES IRP. Function and filter drivers might
00149     // alter the capabilities set by the bus driver.
00150     DEVICE_CAPABILITIES DeviceCapabilities;
00151 
00152     // Configuration Descriptor
00153     PUSB_CONFIGURATION_DESCRIPTOR UsbConfigurationDescriptor;
00154 
00155     // Interface Information structure
00156     PUSBD_INTERFACE_INFORMATION UsbInterface;
00157 
00158     // Pipe context for the driver
00159     PFREEBT_PIPE_CONTEXT PipeContext;
00160 
00161     // current state of device
00162     DEVSTATE DeviceState;
00163 
00164     // state prior to removal query
00165     DEVSTATE PrevDevState;
00166 
00167     // obtain and hold this lock while changing the device state,
00168     // the queue state and while processing the queue.
00169     KSPIN_LOCK DevStateLock;
00170 
00171     // current system power state
00172     SYSTEM_POWER_STATE SysPower;
00173 
00174     // current device power state
00175     DEVICE_POWER_STATE DevPower;
00176 
00177     // Pending I/O queue state
00178     QUEUE_STATE QueueState;
00179 
00180     // Pending I/O queue
00181     LIST_ENTRY NewRequestsQueue;
00182 
00183     // I/O Queue Lock
00184     KSPIN_LOCK QueueLock;
00185 
00186     KEVENT RemoveEvent;
00187 
00188     KEVENT StopEvent;
00189 
00190     ULONG OutStandingIO;
00191 
00192     KSPIN_LOCK IOCountLock;
00193 
00194     // Selective Suspend variables
00195     LONG SSEnable;
00196     LONG SSRegistryEnable;
00197     PUSB_IDLE_CALLBACK_INFO IdleCallbackInfo;
00198     PIRP PendingIdleIrp;
00199     LONG IdleReqPend;
00200     LONG FreeIdleIrpCount;
00201     KSPIN_LOCK IdleReqStateLock;
00202     KEVENT NoIdleReqPendEvent;
00203 
00204     // Default power state to power down to on self-susped
00205     ULONG PowerDownLevel;
00206 
00207     // remote wakeup variables
00208     PIRP WaitWakeIrp;
00209     LONG FlagWWCancel;
00210     LONG FlagWWOutstanding;
00211     LONG WaitWakeEnable;
00212 
00213     // Open handle count
00214     LONG OpenHandleCount;
00215 
00216     // Selective suspend model uses timers, dpcs and work item.
00217     KTIMER Timer;
00218 
00219     KDPC DeferredProcCall;
00220 
00221     // This event is cleared when a DPC/Work Item is queued.
00222     // and signaled when the work-item completes.
00223     // This is essential to prevent the driver from unloading
00224     // while we have DPC or work-item queued up.
00225     KEVENT NoDpcWorkItemPendingEvent;
00226 
00227     // WMI information
00228     WMILIB_CONTEXT WmiLibInfo;
00229 
00230     // WDM version
00231     WDM_VERSION WdmVersion;
00232 
00233     // Pipe type
00234     FREEBT_PIPETYPE PipeType;
00235 
00236     // User accessible object name
00237     WCHAR wszDosDeviceName[50];
00238 
00239     // A never triggered event used for delaying execution
00240     KEVENT DelayEvent;
00241 
00242     // Significant pipes
00243     USBD_PIPE_INFORMATION EventPipe;
00244     USBD_PIPE_INFORMATION DataInPipe;
00245     USBD_PIPE_INFORMATION DataOutPipe;
00246     USBD_PIPE_INFORMATION AudioInPipe;
00247     USBD_PIPE_INFORMATION AudioOutPipe;
00248 
00249 } DEVICE_EXTENSION, *PDEVICE_EXTENSION;
00250 
00251 
00252 typedef struct _IRP_COMPLETION_CONTEXT
00253 {
00254     PDEVICE_EXTENSION DeviceExtension;
00255     PKEVENT Event;
00256 
00257 } IRP_COMPLETION_CONTEXT, *PIRP_COMPLETION_CONTEXT;
00258 
00259 extern GLOBALS Globals;
00260 extern ULONG DebugLevel;
00261 
00262 #endif

Generated on Sun May 27 2012 04:27:14 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.