Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / include / ddk / usbscan.h
blobf22b0b56068d95877e76d04003acc5b529b09d8c
1 /*
2 * usbscan.h
4 * USB scanner definitions
6 * This file is part of the w32api package.
8 * Contributors:
9 * Created by Casper S. Hornstrup <chorns@users.sourceforge.net>
11 * THIS SOFTWARE IS NOT COPYRIGHTED
13 * This source code is offered for use in the public domain. You may
14 * use, modify or distribute it freely.
16 * This code is distributed in the hope that it will be useful but
17 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
18 * DISCLAIMED. This includes but is not limited to warranties of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
23 #ifndef __USBSCAN_H
24 #define __USBSCAN_H
26 #if __GNUC__ >=3
27 #pragma GCC system_header
28 #endif
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
34 #include "ntddk.h"
36 #define FILE_DEVICE_USB_SCAN 0x8000
37 #define IOCTL_INDEX 0x0800
39 #define IOCTL_CANCEL_IO \
40 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 1, METHOD_BUFFERED,FILE_ANY_ACCESS)
42 #define IOCTL_GET_VERSION \
43 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 0, METHOD_BUFFERED,FILE_ANY_ACCESS)
45 #define IOCTL_GET_CHANNEL_ALIGN_RQST \
46 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 5, METHOD_BUFFERED,FILE_ANY_ACCESS)
48 #define IOCTL_GET_DEVICE_DESCRIPTOR \
49 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 6, METHOD_BUFFERED,FILE_ANY_ACCESS)
51 #define IOCTL_GET_PIPE_CONFIGURATION \
52 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 10,METHOD_BUFFERED,FILE_ANY_ACCESS)
54 #define IOCTL_GET_USB_DESCRIPTOR \
55 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 8, METHOD_BUFFERED,FILE_ANY_ACCESS)
57 #define IOCTL_READ_REGISTERS \
58 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 3, METHOD_BUFFERED,FILE_ANY_ACCESS)
60 #define IOCTL_RESET_PIPE \
61 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 7, METHOD_BUFFERED,FILE_ANY_ACCESS)
63 #define IOCTL_SEND_USB_REQUEST \
64 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 9, METHOD_BUFFERED,FILE_ANY_ACCESS)
66 #define IOCTL_SET_TIMEOUT \
67 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 11,METHOD_BUFFERED,FILE_ANY_ACCESS)
69 #define IOCTL_WAIT_ON_DEVICE_EVENT \
70 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 2, METHOD_BUFFERED,FILE_ANY_ACCESS)
72 #define IOCTL_WRITE_REGISTERS \
73 CTL_CODE(FILE_DEVICE_USB_SCAN, IOCTL_INDEX + 4, METHOD_BUFFERED, FILE_ANY_ACCESS)
76 #define MAX_NUM_PIPES 8
78 #define BULKIN_FLAG 0x80
80 typedef struct _CHANNEL_INFO {
81 /*OUT*/ ULONG EventChannelSize;
82 /*OUT*/ ULONG uReadDataAlignment;
83 /*OUT*/ ULONG uWriteDataAlignment;
84 }CHANNEL_INFO, *PCHANNEL_INFO;
86 typedef struct _DEVICE_DESCRIPTOR {
87 /*OUT*/ USHORT usVendorId;
88 /*OUT*/ USHORT usProductId;
89 /*OUT*/ USHORT usBcdDevice;
90 /*OUT*/ USHORT usLanguageId;
91 } DEVICE_DESCRIPTOR, *PDEVICE_DESCRIPTOR;
93 typedef struct _DRV_VERSION {
94 /*OUT*/ ULONG major;
95 /*OUT*/ ULONG minor;
96 /*OUT*/ ULONG internal;
97 } DRV_VERSION, *PDRV_VERSION;
99 typedef struct _IO_BLOCK {
100 /*IN*/ ULONG uOffset;
101 /*IN*/ ULONG uLength;
102 /*IN OUT*/ PUCHAR pbyData;
103 /*IN*/ ULONG uIndex;
104 } IO_BLOCK, *PIO_BLOCK;
106 typedef struct _IO_BLOCK_EX {
107 /*IN*/ ULONG uOffset;
108 /*IN*/ ULONG uLength;
109 /*IN OUT*/ PUCHAR pbyData;
110 /*IN*/ ULONG uIndex;
111 /*IN*/ UCHAR bRequest;
112 /*IN*/ UCHAR bmRequestType;
113 /*IN*/ UCHAR fTransferDirectionIn;
114 } IO_BLOCK_EX, *PIO_BLOCK_EX;
116 typedef struct _USBSCAN_GET_DESCRIPTOR {
117 /*IN*/ UCHAR DescriptorType;
118 /*IN*/ UCHAR Index;
119 /*IN*/ USHORT LanguageId;
120 } USBSCAN_GET_DESCRIPTOR, *PUSBSCAN_GET_DESCRIPTOR;
122 typedef enum _RAW_PIPE_TYPE {
123 USBSCAN_PIPE_CONTROL,
124 USBSCAN_PIPE_ISOCHRONOUS,
125 USBSCAN_PIPE_BULK,
126 USBSCAN_PIPE_INTERRUPT
127 } RAW_PIPE_TYPE;
129 typedef struct _USBSCAN_PIPE_INFORMATION {
130 USHORT MaximumPacketSize;
131 UCHAR EndpointAddress;
132 UCHAR Interval;
133 RAW_PIPE_TYPE PipeType;
134 } USBSCAN_PIPE_INFORMATION, *PUSBSCAN_PIPE_INFORMATION;
136 typedef struct _USBSCAN_PIPE_CONFIGURATION {
137 /*OUT*/ ULONG NumberOfPipes;
138 /*OUT*/ USBSCAN_PIPE_INFORMATION PipeInfo[MAX_NUM_PIPES];
139 } USBSCAN_PIPE_CONFIGURATION, *PUSBSCAN_PIPE_CONFIGURATION;
141 typedef struct _USBSCAN_TIMEOUT {
142 /*IN*/ ULONG TimeoutRead;
143 /*IN*/ ULONG TimeoutWrite;
144 /*IN*/ ULONG TimeoutEvent;
145 } USBSCAN_TIMEOUT, *PUSBSCAN_TIMEOUT;
147 typedef enum _PIPE_TYPE {
148 EVENT_PIPE,
149 READ_DATA_PIPE,
150 WRITE_DATA_PIPE,
151 ALL_PIPE
152 } PIPE_TYPE;
154 #ifdef __cplusplus
156 #endif
158 #endif /* __USBSCAN_H */