Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
5.2 KiB

  1. /*++
  2. Copyright (C) 1997, Logitech Inc.
  3. Module Name:
  4. UsbScan.h
  5. Abstract:
  6. Interface with UsbScan kernel driver
  7. Environment:
  8. User and kernel mode use
  9. Notes:
  10. Interface definition for USB still image driver.
  11. --*/
  12. #ifndef _USBSCAN_H_
  13. #define _USBSCAN_H_
  14. #ifndef MAX_NUM_PIPES
  15. #define MAX_NUM_PIPES 8
  16. #endif
  17. #define BULKIN_FLAG 0x80
  18. typedef struct _DRV_VERSION {
  19. OUT unsigned major;
  20. OUT unsigned minor;
  21. OUT unsigned internal;
  22. } DRV_VERSION, *PDRV_VERSION;
  23. typedef struct _IO_BLOCK {
  24. IN unsigned uOffset;
  25. IN unsigned uLength;
  26. IN OUT PUCHAR pbyData;
  27. IN unsigned uIndex;
  28. } IO_BLOCK, *PIO_BLOCK;
  29. typedef struct _IO_BLOCK_EX {
  30. IN unsigned uOffset;
  31. IN unsigned uLength;
  32. IN OUT PUCHAR pbyData;
  33. IN unsigned uIndex;
  34. //
  35. // Following two fields are described in sec. 9.3.1,2 USB specification
  36. //
  37. IN UCHAR bRequest; // Specific request
  38. IN UCHAR bmRequestType; // Bitmap - charateristics of request
  39. IN UCHAR fTransferDirectionIn; // TRUE - Device-->Host; FALSE - Host-->Device
  40. } IO_BLOCK_EX, *PIO_BLOCK_EX;
  41. typedef struct _CHANNEL_INFO {
  42. OUT unsigned EventChannelSize;
  43. OUT unsigned uReadDataAlignment;
  44. OUT unsigned uWriteDataAlignment;
  45. } CHANNEL_INFO, *PCHANNEL_INFO;
  46. typedef enum {
  47. EVENT_PIPE,
  48. READ_DATA_PIPE,
  49. WRITE_DATA_PIPE,
  50. ALL_PIPE
  51. } PIPE_TYPE;
  52. typedef struct _USBSCAN_GET_DESCRIPTOR {
  53. IN UCHAR DescriptorType; // high byte of wValue field in USB spec.
  54. IN UCHAR Index; // low byte of wValue field in USB spec.
  55. IN USHORT LanguageId; // wIndex field in USB spec.
  56. } USBSCAN_GET_DESCRIPTOR, *PUSBSCAN_GET_DESCRIPTOR;
  57. //
  58. // The device descriptor structure reports information define in the hardware.
  59. // If there is enough space to copy the strings, it will be done otherwise
  60. // only the three first fields:
  61. //
  62. // USHORT usVendorId;
  63. // USHORT usProductId;
  64. // USHORT usBcdDevice;
  65. //
  66. // will contain valid data. Remember: The strings are UNICODE format.
  67. //
  68. typedef struct _DEVICE_DESCRIPTOR {
  69. OUT USHORT usVendorId;
  70. OUT USHORT usProductId;
  71. OUT USHORT usBcdDevice;
  72. OUT USHORT usLanguageId;
  73. // IN OUT PWCHAR pszManufacturer;
  74. // IN OUT unsigned uManufacturerStrSize;
  75. // IN OUT PWCHAR pszProduct;
  76. // IN OUT unsigned uProductStrSize;
  77. // IN OUT PWCHAR pszSerialNb;
  78. // IN OUT unsigned uSerialNbStrSize;
  79. } DEVICE_DESCRIPTOR, *PDEVICE_DESCRIPTOR;
  80. typedef enum _RAW_PIPE_TYPE {
  81. USBSCAN_PIPE_CONTROL,
  82. USBSCAN_PIPE_ISOCHRONOUS,
  83. USBSCAN_PIPE_BULK,
  84. USBSCAN_PIPE_INTERRUPT
  85. } RAW_PIPE_TYPE;
  86. typedef struct _USBSCAN_PIPE_INFORMATION {
  87. USHORT MaximumPacketSize; // Maximum packet size for this pipe
  88. UCHAR EndpointAddress; // 8 bit USB endpoint address (includes direction)
  89. UCHAR Interval; // Polling interval in ms if interrupt pipe
  90. RAW_PIPE_TYPE PipeType; // PipeType identifies type of transfer valid for this pipe
  91. } USBSCAN_PIPE_INFORMATION, *PUSBSCAN_PIPE_INFORMATION;
  92. typedef struct _USBSCAN_PIPE_CONFIGURATION {
  93. OUT ULONG NumberOfPipes;
  94. OUT USBSCAN_PIPE_INFORMATION PipeInfo[MAX_NUM_PIPES];
  95. } USBSCAN_PIPE_CONFIGURATION, *PUSBSCAN_PIPE_CONFIGURATION;
  96. typedef struct _USBSCAN_TIMEOUT {
  97. ULONG TimeoutRead;
  98. ULONG TimeoutWrite;
  99. ULONG TimeoutEvent;
  100. } USBSCAN_TIMEOUT, *PUSBSCAN_TIMEOUT;
  101. #define FILE_DEVICE_USB_SCAN 0x8000
  102. #define IOCTL_INDEX 0x0800
  103. #define IOCTL_GET_VERSION CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX, METHOD_BUFFERED,FILE_ANY_ACCESS)
  104. #define IOCTL_CANCEL_IO CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+1, METHOD_BUFFERED,FILE_ANY_ACCESS)
  105. #define IOCTL_WAIT_ON_DEVICE_EVENT CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+2, METHOD_BUFFERED,FILE_ANY_ACCESS)
  106. #define IOCTL_READ_REGISTERS CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+3, METHOD_BUFFERED,FILE_ANY_ACCESS)
  107. #define IOCTL_WRITE_REGISTERS CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+4, METHOD_BUFFERED,FILE_ANY_ACCESS)
  108. #define IOCTL_GET_CHANNEL_ALIGN_RQST CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+5, METHOD_BUFFERED,FILE_ANY_ACCESS)
  109. #define IOCTL_GET_DEVICE_DESCRIPTOR CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+6, METHOD_BUFFERED,FILE_ANY_ACCESS)
  110. #define IOCTL_RESET_PIPE CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+7, METHOD_BUFFERED,FILE_ANY_ACCESS)
  111. #define IOCTL_GET_USB_DESCRIPTOR CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+8, METHOD_BUFFERED,FILE_ANY_ACCESS)
  112. #define IOCTL_SEND_USB_REQUEST CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+9, METHOD_BUFFERED,FILE_ANY_ACCESS)
  113. #define IOCTL_GET_PIPE_CONFIGURATION CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+10,METHOD_BUFFERED,FILE_ANY_ACCESS)
  114. #define IOCTL_SET_TIMEOUT CTL_CODE(FILE_DEVICE_USB_SCAN,IOCTL_INDEX+11,METHOD_BUFFERED,FILE_ANY_ACCESS)
  115. //
  116. // Temporary to avoid breaking LOGISCAN code
  117. //
  118. #define ALL ALL_PIPE
  119. #define IOCTL_ABORT_PIPE IOCTL_CANCEL_IO
  120. //
  121. //
  122. #endif // _USBSCAN_H_