More work on USB related definitions
authorAmine Khaldi <amine.khaldi@reactos.org>
Fri, 5 Mar 2010 12:25:38 +0000 (12:25 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Fri, 5 Mar 2010 12:25:38 +0000 (12:25 +0000)
svn path=/branches/header-work/; revision=45867

include/psdk/usb200.h
include/psdk/usbcamdi.h

index 6d86cb2..ad021d1 100644 (file)
@@ -24,6 +24,16 @@ typedef enum _USB_DEVICE_SPEED {
   UsbHighSpeed
 } USB_DEVICE_SPEED;
 
+#define USB_PORT_STATUS_CONNECT                       0x0001
+#define USB_PORT_STATUS_ENABLE                        0x0002
+#define USB_PORT_STATUS_SUSPEND                       0x0004
+#define USB_PORT_STATUS_OVER_CURRENT                  0x0008
+#define USB_PORT_STATUS_RESET                         0x0010
+#define USB_PORT_STATUS_POWER                         0x0100
+#define USB_PORT_STATUS_LOW_SPEED                     0x0200
+#define USB_PORT_STATUS_HIGH_SPEED                    0x0400
+
+
 typedef union _BM_REQUEST_TYPE {
   struct _BM {
     UCHAR Recipient:2;
@@ -56,6 +66,9 @@ typedef struct _USB_DEFAULT_PIPE_SETUP_PACKET {
 
 C_ASSERT(sizeof(USB_DEFAULT_PIPE_SETUP_PACKET) == 8);
 
+#define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE          0x06
+#define USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE 0x07
+
 typedef struct _USB_DEVICE_QUALIFIER_DESCRIPTOR {
   UCHAR bLength;
   UCHAR bDescriptorType;
@@ -77,6 +90,8 @@ typedef union _USB_HIGH_SPEED_MAXPACKET {
   USHORT us;
 } USB_HIGH_SPEED_MAXPACKET, *PUSB_HIGH_SPEED_MAXPACKET;
 
+#define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE     0x0B
+
 typedef struct _USB_INTERFACE_ASSOCIATION_DESCRIPTOR {
   UCHAR bLength;
   UCHAR bDescriptorType;
@@ -88,16 +103,4 @@ typedef struct _USB_INTERFACE_ASSOCIATION_DESCRIPTOR {
   UCHAR iFunction;
 } USB_INTERFACE_ASSOCIATION_DESCRIPTOR, *PUSB_INTERFACE_ASSOCIATION_DESCRIPTOR;
 
-#define USB_PORT_STATUS_CONNECT                       0x0001
-#define USB_PORT_STATUS_ENABLE                        0x0002
-#define USB_PORT_STATUS_SUSPEND                       0x0004
-#define USB_PORT_STATUS_OVER_CURRENT                  0x0008
-#define USB_PORT_STATUS_RESET                         0x0010
-#define USB_PORT_STATUS_POWER                         0x0100
-#define USB_PORT_STATUS_LOW_SPEED                     0x0200
-#define USB_PORT_STATUS_HIGH_SPEED                    0x0400
-#define USB_DEVICE_QUALIFIER_DESCRIPTOR_TYPE          0x06
-#define USB_OTHER_SPEED_CONFIGURATION_DESCRIPTOR_TYPE 0x07
-#define USB_INTERFACE_ASSOCIATION_DESCRIPTOR_TYPE     0x0B
-
 #include <poppack.h>
index 6eab8f4..31d7773 100644 (file)
 
 #pragma once
 
-#if !defined(__USB_H) && !defined(__USBDI_H)
-#error include usb.h or usbdi.h before usbcamdi.h
-#else
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -36,12 +32,10 @@ extern "C" {
   #define USBCAMAPI DECLSPEC_IMPORT
 #endif
 
-DEFINE_GUID(GUID_USBCAMD_INTERFACE,
-  0x2bcb75c0, 0xb27f, 0x11d1, 0xba, 0x41, 0x0, 0xa0, 0xc9, 0xd, 0x2b, 0x5);
-
-#define USBCAMD_PROCESSPACKETEX_DropFrame             0x0002
-#define USBCAMD_PROCESSPACKETEX_NextFrameIsStill      0x0004
-#define USBCAMD_PROCESSPACKETEX_CurrentFrameIsStill   0x0008
+typedef struct _pipe_config_descriptor {
+  CHAR StreamAssociation;
+  UCHAR PipeConfigFlags;
+} USBCAMD_Pipe_Config_Descriptor, *PUSBCAMD_Pipe_Config_Descriptor;
 
 #define USBCAMD_DATA_PIPE                 0x0001
 #define USBCAMD_MULTIPLEX_PIPE            0x0002
@@ -52,14 +46,13 @@ DEFINE_GUID(GUID_USBCAMD_INTERFACE,
 #define USBCAMD_STILL_STREAM              0x2
 #define USBCAMD_VIDEO_STILL_STREAM        (USBCAMD_VIDEO_STREAM | USBCAMD_STILL_STREAM)
 
+#define USBCAMD_PROCESSPACKETEX_DropFrame             0x0002
+#define USBCAMD_PROCESSPACKETEX_NextFrameIsStill      0x0004
+#define USBCAMD_PROCESSPACKETEX_CurrentFrameIsStill   0x0008
+
 #define USBCAMD_STOP_STREAM               0x00000001
 #define USBCAMD_START_STREAM              0x00000000
 
-typedef struct _pipe_config_descriptor {
-  CHAR StreamAssociation;
-  UCHAR PipeConfigFlags;
-} USBCAMD_Pipe_Config_Descriptor, *PUSBCAMD_Pipe_Config_Descriptor;
-
 typedef enum {
   USBCAMD_CamControlFlag_NoVideoRawProcessing = 1,
   USBCAMD_CamControlFlag_NoStillRawProcessing = 2,
@@ -68,19 +61,21 @@ typedef enum {
 } USBCAMD_CamControlFlags;
 
 typedef NTSTATUS
-(NTAPI *PCAM_ALLOCATE_BW_ROUTINE)(
-  IN PDEVICE_OBJECT BusDeviceObject,
+(NTAPI *PCOMMAND_COMPLETE_FUNCTION)(
   IN PVOID DeviceContext,
-  IN PULONG RawFrameLength,
-  IN PVOID Format);
+  IN OUT PVOID CommandContext,
+  IN NTSTATUS NtStatus);
 
-typedef NTSTATUS
-(NTAPI *PCAM_ALLOCATE_BW_ROUTINE_EX)(
-  IN PDEVICE_OBJECT BusDeviceObject,
+typedef VOID
+(NTAPI *PSTREAM_RECEIVE_PACKET)(
+  IN PVOID Srb,
   IN PVOID DeviceContext,
-  IN PULONG RawFrameLength,
-  IN PVOID Format,
-  IN ULONG StreamNumber);
+  IN PBOOLEAN Completed);
+
+typedef NTSTATUS
+(NTAPI *PCAM_INITIALIZE_ROUTINE)(
+  PDEVICE_OBJECT BusDeviceObject,
+  PVOID DeviceContext);
 
 typedef NTSTATUS
 (NTAPI *PCAM_CONFIGURE_ROUTINE)(
@@ -102,57 +97,55 @@ typedef NTSTATUS
   IN PUSB_DEVICE_DESCRIPTOR DeviceDescriptor);
 
 typedef NTSTATUS
-(NTAPI *PCAM_FREE_BW_ROUTINE)(
+(NTAPI *PCAM_START_CAPTURE_ROUTINE)(
   IN PDEVICE_OBJECT BusDeviceObject,
   IN PVOID DeviceContext);
 
 typedef NTSTATUS
-(NTAPI *PCAM_FREE_BW_ROUTINE_EX)(
+(NTAPI *PCAM_START_CAPTURE_ROUTINE_EX)(
   IN PDEVICE_OBJECT BusDeviceObject,
   IN PVOID DeviceContext,
   IN ULONG StreamNumber);
 
 typedef NTSTATUS
-(NTAPI *PCAM_INITIALIZE_ROUTINE)(
-  PDEVICE_OBJECT BusDeviceObject,
-  PVOID DeviceContext);
-
-typedef VOID
-(NTAPI *PCAM_NEW_FRAME_ROUTINE)(
+(NTAPI *PCAM_ALLOCATE_BW_ROUTINE)(
+  IN PDEVICE_OBJECT BusDeviceObject,
   IN PVOID DeviceContext,
-  IN PVOID FrameContext);
+  IN PULONG RawFrameLength,
+  IN PVOID Format);
 
-typedef VOID
-(NTAPI *PCAM_NEW_FRAME_ROUTINE_EX)(
+typedef NTSTATUS
+(NTAPI *PCAM_ALLOCATE_BW_ROUTINE_EX)(
+  IN PDEVICE_OBJECT BusDeviceObject,
   IN PVOID DeviceContext,
-  IN PVOID FrameContext,
-  IN ULONG StreamNumber,
-  OUT PULONG FrameLength);
+  IN PULONG RawFrameLength,
+  IN PVOID Format,
+  IN ULONG StreamNumber);
 
 typedef NTSTATUS
-(NTAPI *PCAM_PROCESS_RAW_FRAME_ROUTINE)(
+(NTAPI *PCAM_FREE_BW_ROUTINE)(
+  IN PDEVICE_OBJECT BusDeviceObject,
+  IN PVOID DeviceContext);
+
+typedef NTSTATUS
+(NTAPI *PCAM_FREE_BW_ROUTINE_EX)(
   IN PDEVICE_OBJECT BusDeviceObject,
   IN PVOID DeviceContext,
-  IN PVOID FrameContext,
-  IN PVOID FrameBuffer,
-  IN ULONG FrameLength,
-  OUT PVOID RawFrameBuffer,
-  IN ULONG RawFrameLength,
-  IN ULONG NumberOfPackets,
-  OUT PULONG BytesReturned);
+  IN ULONG StreamNumber);
+
+typedef VOID
+(NTAPI *PADAPTER_RECEIVE_PACKET_ROUTINE)(
+  IN OUT PHW_STREAM_REQUEST_BLOCK Srb);
 
 typedef NTSTATUS
-(NTAPI *PCAM_PROCESS_RAW_FRAME_ROUTINE_EX)(
+(NTAPI *PCAM_STOP_CAPTURE_ROUTINE)(
+  IN PDEVICE_OBJECT BusDeviceObject,
+  IN PVOID DeviceContext);
+
+typedef NTSTATUS
+(NTAPI *PCAM_STOP_CAPTURE_ROUTINE_EX)(
   IN PDEVICE_OBJECT BusDeviceObject,
   IN PVOID DeviceContext,
-  IN PVOID FrameContext,
-  IN PVOID FrameBuffer,
-  IN ULONG FrameLength,
-  OUT PVOID RawFrameBuffer,
-  IN ULONG RawFrameLength,
-  IN ULONG NumberOfPackets,
-  OUT PULONG BytesReturned,
-  IN ULONG ActualRawFrameLength,
   IN ULONG StreamNumber);
 
 typedef ULONG
@@ -180,32 +173,68 @@ typedef ULONG
   OUT PULONG PacketFlag,
   OUT PULONG ValidDataOffset);
 
-typedef NTSTATUS
-(NTAPI *PCAM_STATE_ROUTINE)(
-  IN PDEVICE_OBJECT BusDeviceObject,
-  IN PVOID DeviceContext);
+typedef VOID
+(NTAPI *PCAM_NEW_FRAME_ROUTINE)(
+  IN PVOID DeviceContext,
+  IN PVOID FrameContext);
+
+typedef VOID
+(NTAPI *PCAM_NEW_FRAME_ROUTINE_EX)(
+  IN PVOID DeviceContext,
+  IN PVOID FrameContext,
+  IN ULONG StreamNumber,
+  OUT PULONG FrameLength);
 
 typedef NTSTATUS
-(NTAPI *PCAM_START_CAPTURE_ROUTINE)(
+(NTAPI *PCAM_PROCESS_RAW_FRAME_ROUTINE)(
   IN PDEVICE_OBJECT BusDeviceObject,
-  IN PVOID DeviceContext);
+  IN PVOID DeviceContext,
+  IN PVOID FrameContext,
+  IN PVOID FrameBuffer,
+  IN ULONG FrameLength,
+  OUT PVOID RawFrameBuffer,
+  IN ULONG RawFrameLength,
+  IN ULONG NumberOfPackets,
+  OUT PULONG BytesReturned);
 
 typedef NTSTATUS
-(NTAPI *PCAM_START_CAPTURE_ROUTINE_EX)(
+(NTAPI *PCAM_PROCESS_RAW_FRAME_ROUTINE_EX)(
   IN PDEVICE_OBJECT BusDeviceObject,
   IN PVOID DeviceContext,
+  IN PVOID FrameContext,
+  IN PVOID FrameBuffer,
+  IN ULONG FrameLength,
+  OUT PVOID RawFrameBuffer,
+  IN ULONG RawFrameLength,
+  IN ULONG NumberOfPackets,
+  OUT PULONG BytesReturned,
+  IN ULONG ActualRawFrameLength,
   IN ULONG StreamNumber);
 
 typedef NTSTATUS
-(NTAPI *PCAM_STOP_CAPTURE_ROUTINE)(
+(NTAPI *PCAM_STATE_ROUTINE)(
   IN PDEVICE_OBJECT BusDeviceObject,
   IN PVOID DeviceContext);
 
-typedef NTSTATUS
-(NTAPI *PCAM_STOP_CAPTURE_ROUTINE_EX)(
-  IN PDEVICE_OBJECT BusDeviceObject,
-  IN PVOID DeviceContext,
-  IN ULONG StreamNumber);
+#if defined(DEBUG_LOG)
+
+USBCAMAPI
+VOID
+NTAPI
+USBCAMD_Debug_LogEntry(
+  IN CHAR *Name,
+  IN ULONG Info1,
+  IN ULONG Info2,
+  IN ULONG Info3);
+
+#define ILOGENTRY(sig, info1, info2, info3) \
+  USBCAMD_Debug_LogEntry(sig, (ULONG)info1, (ULONG)info2, (ULONG)info3)
+
+#else
+
+#define ILOGENTRY(sig, info1, info2, info3)
+
+#endif /* DEBUG_LOG */
 
 typedef struct _USBCAMD_DEVICE_DATA {
   ULONG Sig;
@@ -239,34 +268,23 @@ typedef struct _USBCAMD_DEVICE_DATA2 {
   PCAM_FREE_BW_ROUTINE_EX CamFreeBandwidthEx;
 } USBCAMD_DEVICE_DATA2, *PUSBCAMD_DEVICE_DATA2;
 
-USBCAMAPI
-ULONG
-NTAPI
-USBCAMD_InitializeNewInterface(
-  IN PVOID DeviceContext,
-  IN PVOID DeviceData,
-  IN ULONG Version,
-  IN ULONG CamControlFlag);
+DEFINE_GUID(GUID_USBCAMD_INTERFACE,
+  0x2bcb75c0, 0xb27f, 0x11d1, 0xba, 0x41, 0x0, 0xa0, 0xc9, 0xd, 0x2b, 0x5);
 
 typedef NTSTATUS
-(NTAPI *PCOMMAND_COMPLETE_FUNCTION)(
+(NTAPI *PFNUSBCAMD_SetVideoFormat)(
   IN PVOID DeviceContext,
-  IN OUT PVOID CommandContext,
-  IN NTSTATUS NtStatus);
+  IN PHW_STREAM_REQUEST_BLOCK pSrb);
 
 typedef NTSTATUS
-(NTAPI *PFNUSBCAMD_BulkReadWrite)(
+(NTAPI *PFNUSBCAMD_WaitOnDeviceEvent)(
   IN PVOID DeviceContext,
-  IN USHORT PipeIndex,
+  IN ULONG PipeIndex,
   IN PVOID Buffer,
   IN ULONG BufferLength,
-  IN PCOMMAND_COMPLETE_FUNCTION CommandComplete,
-  IN PVOID CommandContext);
-
-typedef NTSTATUS
-(NTAPI *PFNUSBCAMD_SetIsoPipeState)(
-  IN PVOID DeviceContext,
-  IN ULONG PipeStateFlags);
+  IN PCOMMAND_COMPLETE_FUNCTION EventComplete,
+  IN PVOID EventContext,
+  IN BOOLEAN LoopBack);
 
 typedef NTSTATUS
 (NTAPI *PFNUSBCAMD_CancelBulkReadWrite)(
@@ -274,23 +292,18 @@ typedef NTSTATUS
   IN ULONG PipeIndex);
 
 typedef NTSTATUS
-(NTAPI *PFNUSBCAMD_SetVideoFormat)(
+(NTAPI *PFNUSBCAMD_SetIsoPipeState)(
   IN PVOID DeviceContext,
-  IN PHW_STREAM_REQUEST_BLOCK pSrb);
+  IN ULONG PipeStateFlags);
 
 typedef NTSTATUS
-(NTAPI *PFNUSBCAMD_WaitOnDeviceEvent)(
+(NTAPI *PFNUSBCAMD_BulkReadWrite)(
   IN PVOID DeviceContext,
-  IN ULONG PipeIndex,
+  IN USHORT PipeIndex,
   IN PVOID Buffer,
   IN ULONG BufferLength,
-  IN PCOMMAND_COMPLETE_FUNCTION EventComplete,
-  IN PVOID EventContext,
-  IN BOOLEAN LoopBack);
-
-typedef VOID
-(NTAPI *PADAPTER_RECEIVE_PACKET_ROUTINE)(
-  IN OUT PHW_STREAM_REQUEST_BLOCK Srb);
+  IN PCOMMAND_COMPLETE_FUNCTION CommandComplete,
+  IN PVOID CommandContext);
 
 #define USBCAMD_VERSION_200               0x200
 
@@ -303,14 +316,18 @@ typedef struct _USBCAMD_INTERFACE {
   PFNUSBCAMD_CancelBulkReadWrite USBCAMD_CancelBulkReadWrite;
 } USBCAMD_INTERFACE, *PUSBCAMD_INTERFACE;
 
-typedef VOID
-(NTAPI *PSTREAM_RECEIVE_PACKET)(
-  IN PVOID Srb,
-  IN PVOID DeviceContext,
-  IN PBOOLEAN Completed);
-
 /* FIXME : Do we need USBCAMAPI here ? */
 
+USBCAMAPI
+ULONG
+NTAPI
+USBCAMD_DriverEntry(
+  IN PVOID Context1,
+  IN PVOID Context2,
+  IN ULONG DeviceContextSize,
+  IN ULONG FrameContextSize,
+  IN PADAPTER_RECEIVE_PACKET_ROUTINE ReceivePacket);
+
 USBCAMAPI
 PVOID
 NTAPI
@@ -335,14 +352,11 @@ USBCAMD_ControlVendorCommand(
   IN PVOID CommandContext OPTIONAL);
 
 USBCAMAPI
-ULONG
+NTSTATUS
 NTAPI
-USBCAMD_DriverEntry(
-  IN PVOID Context1,
-  IN PVOID Context2,
-  IN ULONG DeviceContextSize,
-  IN ULONG FrameContextSize,
-  IN PADAPTER_RECEIVE_PACKET_ROUTINE ReceivePacket);
+USBCAMD_SelectAlternateInterface(
+  IN PVOID DeviceContext,
+  IN OUT PUSBD_INTERFACE_INFORMATION RequestInterface);
 
 USBCAMAPI
 NTSTATUS
@@ -355,31 +369,13 @@ USBCAMD_GetRegistryKeyValue(
   IN ULONG DataLength);
 
 USBCAMAPI
-NTSTATUS
+ULONG
 NTAPI
-USBCAMD_SelectAlternateInterface(
+USBCAMD_InitializeNewInterface(
   IN PVOID DeviceContext,
-  IN OUT PUSBD_INTERFACE_INFORMATION RequestInterface);
-
-#if defined(DEBUG_LOG)
-
-USBCAMAPI
-VOID
-NTAPI
-USBCAMD_Debug_LogEntry(
-  IN CHAR *Name,
-  IN ULONG Info1,
-  IN ULONG Info2,
-  IN ULONG Info3);
-
-#define ILOGENTRY(sig, info1, info2, info3) \
-  USBCAMD_Debug_LogEntry(sig, (ULONG)info1, (ULONG)info2, (ULONG)info3)
-
-#else
-
-#define ILOGENTRY(sig, info1, info2, info3)
-
-#endif /* DEBUG_LOG */
+  IN PVOID DeviceData,
+  IN ULONG Version,
+  IN ULONG CamControlFlag);
 
 #ifdef __cplusplus
 }