⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 usbio_i.h

📁 reference about wireless design which is helpful to everyone
💻 H
📖 第 1 页 / 共 2 页
字号:
  PipeType_Force32bitEnum = 2000000000
} USBIO_PIPE_TYPE;


typedef enum _USBIO_REQUEST_RECIPIENT {
  RecipientDevice = 0,
  RecipientInterface,
  RecipientEndpoint,
  RecipientOther,
  // The following dummy value is included to force the compiler to make the 
  // size of the enum 4 bytes (32 bits). Some compilers, Borland C++ for 
  // instance, use the smallest possible integer for enums.
  Recipient_Force32bitEnum = 2000000000
} USBIO_REQUEST_RECIPIENT;


typedef enum _USBIO_REQUEST_TYPE {
  RequestTypeClass = 1,
  RequestTypeVendor,
  // The following dummy value is included to force the compiler to make the 
  // size of the enum 4 bytes (32 bits). Some compilers, Borland C++ for 
  // instance, use the smallest possible integer for enums.
  RequestType_Force32bitEnum = 2000000000
} USBIO_REQUEST_TYPE;


typedef enum _USBIO_DEVICE_POWER_STATE {
  DevicePowerStateD0 = 0,
  DevicePowerStateD1,
  DevicePowerStateD2,
  DevicePowerStateD3,
  // The following dummy value is included to force the compiler to make the 
  // size of the enum 4 bytes (32 bits). Some compilers, Borland C++ for 
  // instance, use the smallest possible integer for enums.
  DevicePowerState_Force32bitEnum = 2000000000
} USBIO_DEVICE_POWER_STATE;



//
// GET_BANDWIDTH_INFO
//
typedef struct _USBIO_BANDWIDTH_INFO {
  ULONG  TotalBandwidth;
  ULONG  ConsumedBandwidth;
  ULONG  reserved1;   // reserved for future use
  ULONG  reserved2;   // reserved for future use
} USBIO_BANDWIDTH_INFO;


//
// GET_DEVICE_INFO
//
typedef struct _USBIO_DEVICE_INFO {
  ULONG  Flags;       // 0 or any combination of USBIO_DEVICE_INFOFLAG_XXX
  ULONG  reserved1;   // reserved for future use
  ULONG  reserved2;   // reserved for future use
  ULONG  reserved3;   // reserved for future use
} USBIO_DEVICE_INFO;

#define USBIO_DEVICE_INFOFLAG_HIGH_SPEED 0x00100000


//
// GET_DRIVER_INFO
//
typedef struct _USBIO_DRIVER_INFO {
  USHORT APIVersion;    // [MAJOR][MINOR] (BCD format)
  USHORT DriverVersion; // [MAJOR][MINOR]
  ULONG  DriverBuildNumber;
  ULONG  Flags;         // 0 or any combination of USBIO_INFOFLAG_XXX
} USBIO_DRIVER_INFO;

#define USBIO_INFOFLAG_CHECKED_BUILD      0x00000010
#define USBIO_INFOFLAG_DEMO_VERSION       0x00000020
#define USBIO_INFOFLAG_LIGHT_VERSION      0x00000100
#define USBIO_INFOFLAG_VS_LIGHT_VERSION   0x00000200



//
// GET_DESCRIPTOR
// SET_DESCRIPTOR
//
typedef struct _USBIO_DESCRIPTOR_REQUEST {
  USBIO_REQUEST_RECIPIENT Recipient;
  UCHAR   DescriptorType;
  UCHAR   DescriptorIndex;
  USHORT  LanguageId;
} USBIO_DESCRIPTOR_REQUEST;

//
// SET_FEATURE
// CLEAR_FEATURE
//
typedef struct _USBIO_FEATURE_REQUEST {
  USBIO_REQUEST_RECIPIENT Recipient;
  USHORT  FeatureSelector;
  USHORT  Index;
} USBIO_FEATURE_REQUEST;


//
// GET_STATUS
//
typedef struct _USBIO_STATUS_REQUEST {
  USBIO_REQUEST_RECIPIENT Recipient;
  USHORT  Index;
} USBIO_STATUS_REQUEST;

typedef struct _USBIO_STATUS_REQUEST_DATA {
  USHORT  Status;
} USBIO_STATUS_REQUEST_DATA;


//
// GET_CONFIGURATION
//
typedef struct _USBIO_GET_CONFIGURATION_DATA {
  UCHAR ConfigurationValue;
} USBIO_GET_CONFIGURATION_DATA;


//
// GET_INTERFACE
//
typedef struct _USBIO_GET_INTERFACE {
  USHORT Interface;
} USBIO_GET_INTERFACE;

typedef struct _USBIO_GET_INTERFACE_DATA {
  UCHAR AlternateSetting;
} USBIO_GET_INTERFACE_DATA;



//
// SET_CONFIGURATION
// SET_INTERFACE
//
typedef struct _USBIO_INTERFACE_SETTING {
  USHORT  InterfaceIndex;
  USHORT  AlternateSettingIndex;
  ULONG   MaximumTransferSize;
} USBIO_INTERFACE_SETTING;

typedef struct _USBIO_SET_CONFIGURATION {
  USHORT ConfigurationIndex;
  USHORT NbOfInterfaces;
  USBIO_INTERFACE_SETTING InterfaceList[USBIO_MAX_INTERFACES];
} USBIO_SET_CONFIGURATION;



//
// CLASS_OR_VENDOR_IN_REQUEST
// CLASS_OR_VENDOR_OUT_REQUEST
//
typedef struct _USBIO_CLASS_OR_VENDOR_REQUEST {
  ULONG   Flags;
  USBIO_REQUEST_TYPE Type;
  USBIO_REQUEST_RECIPIENT Recipient;
  UCHAR   RequestTypeReservedBits;
  UCHAR   Request;
  USHORT  Value;
  USHORT  Index;
} USBIO_CLASS_OR_VENDOR_REQUEST;



//
// GET_DEVICE_PARAMETERS
// SET_DEVICE_PARAMETERS
//
typedef struct _USBIO_DEVICE_PARAMETERS {
  ULONG Options;
  ULONG RequestTimeout;   // in ms
} USBIO_DEVICE_PARAMETERS;



//
// GET_CONFIGURATION_INFO
//
typedef struct _USBIO_INTERFACE_CONFIGURATION_INFO {
  UCHAR InterfaceNumber;
  UCHAR AlternateSetting;
  UCHAR Class;
  UCHAR SubClass;
  UCHAR Protocol;
  UCHAR NumberOfPipes;
  UCHAR reserved1;  // reserved field, set to zero
  UCHAR reserved2;  // reserved field, set to zero
} USBIO_INTERFACE_CONFIGURATION_INFO;

typedef struct _USBIO_PIPE_CONFIGURATION_INFO {
  USBIO_PIPE_TYPE PipeType;  // type
  ULONG  MaximumTransferSize;// maximum Read/Write buffer size 
  USHORT MaximumPacketSize;  // FIFO size of the endpoint  
  UCHAR  EndpointAddress;    // including direction bit (bit 7)
  UCHAR  Interval;           // in ms, for interrupt pipe
  UCHAR  InterfaceNumber;    // interface that the EP belongs to
  UCHAR  reserved1;   // reserved field, set to zero
  UCHAR  reserved2;   // reserved field, set to zero
  UCHAR  reserved3;   // reserved field, set to zero
} USBIO_PIPE_CONFIGURATION_INFO;

typedef struct _USBIO_CONFIGURATION_INFO {
  ULONG NbOfInterfaces;
  ULONG NbOfPipes;
  USBIO_INTERFACE_CONFIGURATION_INFO InterfaceInfo[USBIO_MAX_INTERFACES];
  USBIO_PIPE_CONFIGURATION_INFO PipeInfo[USBIO_MAX_PIPES];
} USBIO_CONFIGURATION_INFO;



//
// GET_CURRENT_FRAME_NUMBER
//
typedef struct _USBIO_FRAME_NUMBER {
  ULONG FrameNumber;
} USBIO_FRAME_NUMBER;


//
// SET_DEVICE_POWER_STATE
// GET_DEVICE_POWER_STATE
//
typedef struct _USBIO_DEVICE_POWER {
  USBIO_DEVICE_POWER_STATE DevicePowerState;
} USBIO_DEVICE_POWER;



//
// BIND_PIPE
//
typedef struct _USBIO_BIND_PIPE {
  UCHAR EndpointAddress; // including direction bit
} USBIO_BIND_PIPE;


//
// GET_PIPE_PARAMETERS
// SET_PIPE_PARAMETERS
//
typedef struct _USBIO_PIPE_PARAMETERS {
  ULONG Flags;
} USBIO_PIPE_PARAMETERS;


//
// SETUP_PIPE_STATISTICS
//
typedef struct _USBIO_SETUP_PIPE_STATISTICS {
  ULONG AveragingInterval;  // in ms, max: 5000, 0 = statistics off
  ULONG reserved1;          // reserved for future use, set to zero
  ULONG reserved2;          // reserved for future use, set to zero
} USBIO_SETUP_PIPE_STATISTICS;


//
// QUERY_PIPE_STATISTICS
//
typedef struct _USBIO_QUERY_PIPE_STATISTICS {
  ULONG Flags;      // 0 or any combination of USBIO_QPS_FLAG_XXX
} USBIO_QUERY_PIPE_STATISTICS;

#define USBIO_QPS_FLAG_RESET_BYTES_TRANSFERRED    0x00000001
#define USBIO_QPS_FLAG_RESET_REQUESTS_SUCCEEDED   0x00000002
#define USBIO_QPS_FLAG_RESET_REQUESTS_FAILED      0x00000004
#define USBIO_QPS_FLAG_RESET_ALL_COUNTERS ( USBIO_QPS_FLAG_RESET_BYTES_TRANSFERRED | \
                                            USBIO_QPS_FLAG_RESET_REQUESTS_SUCCEEDED | \
                                            USBIO_QPS_FLAG_RESET_REQUESTS_FAILED \
                                          )

typedef struct _USBIO_PIPE_STATISTICS {
  ULONG ActualAveragingInterval;  // in ms, 0 = statistics off
  ULONG AverageRate;              // in bytes/s
  ULONG BytesTransferred_L; // total number of bytes transferred, lower 32 bits
  ULONG BytesTransferred_H; // total number of bytes transferred, upper 32 bits
  ULONG RequestsSucceeded;  // total number of I/O requests succeeded
  ULONG RequestsFailed;     // total number of I/O requests failed
  ULONG reserved1;          // reserved for future use
  ULONG reserved2;          // reserved for future use
} USBIO_PIPE_STATISTICS;


//
// PIPE_CONTROL_TRANSFER_IN
// PIPE_CONTROL_TRANSFER_OUT
//
typedef struct _USBIO_PIPE_CONTROL_TRANSFER {
  ULONG Flags;
  UCHAR SetupPacket[8];
} USBIO_PIPE_CONTROL_TRANSFER;



//
// Isochronous Transfers
//
// The data buffer passed to ReadFile/WriteFile has to contain a
// predefined header that describes the size and location of the 
// packets to be transferred. The USBIO_ISO_TRANSFER_HEADER consists
// of a fixed size part, that is USBIO_ISO_TRANSFER, and a variable size array
// of USBIO_ISO_PACKET descriptors.
//

typedef struct _USBIO_ISO_TRANSFER {
  ULONG NumberOfPackets;
  ULONG Flags;
  ULONG StartFrame;
  ULONG ErrorCount;
} USBIO_ISO_TRANSFER;

typedef struct _USBIO_ISO_PACKET {
  ULONG Offset;
  ULONG Length;
  ULONG Status;   
} USBIO_ISO_PACKET;

typedef struct _USBIO_ISO_TRANSFER_HEADER {
  USBIO_ISO_TRANSFER  IsoTransfer;
  USBIO_ISO_PACKET    IsoPacket[1]; // variably sized array
} USBIO_ISO_TRANSFER_HEADER;



// restore packing
#include <POPPACK.H>


/********************** END OF INTERFACE ********************************/

//
// Define the device type value. Note that values used by Microsoft
// are in the range 0-32767, and 32768-65535 are reserved for use
// by customers.
//
#define FILE_DEVICE_USBIO       0x8094

//
// Macros to generate IOCTL codes.
// Note that function codes 0-2047 are reserved for Microsoft, and
// 2048-4095 are reserved for customers.
//
#define _USBIO_IOCTL_BASE       0x800

#define _USBIO_IOCTL_CODE(FnCode,Method)    \
   ( (ULONG)CTL_CODE(                       \
      (ULONG)FILE_DEVICE_USBIO,             \
      (ULONG)(_USBIO_IOCTL_BASE+(FnCode)),  \
      (ULONG)(Method),                      \
      (ULONG)FILE_ANY_ACCESS                \
      ) )


#endif  // _USBIO_I_H_

/*************************** EOF **************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -