00001
00002
00003
00004
00005
00006 #ifndef _IOW_KIT_H_
00007 #define _IOW_KIT_H_
00008
00009 #ifndef _IOWKIT_BUILD_RUN
00010 #ifdef _IOWKIT2_H_
00011 #error "including both iowkit2.h and iowkit.h is not allowed"
00012 #endif // _IOWKIT2_H_
00013 #endif // _IOWKIT_BUILD_RUN
00014
00015 #ifdef _WIN32
00016
00017 #define IOWKIT_API __stdcall
00018
00019 #else
00020
00021 #define IOWKIT_API
00022
00023
00024 #ifndef _IOW_WINTYPES_H_
00025 #define _IOW_WINTYPES_H_
00026
00027
00028
00029
00030 typedef unsigned long ULONG;
00031 typedef long LONG;
00032 typedef unsigned short USHORT;
00033 typedef unsigned short WORD;
00034 typedef unsigned char UCHAR;
00035 typedef unsigned char BYTE;
00036 typedef char * PCHAR;
00037 typedef unsigned short * PWCHAR;
00038 typedef int BOOL;
00039 typedef unsigned char BOOLEAN;
00040 typedef unsigned long DWORD;
00041 typedef DWORD * PDWORD;
00042 typedef void * PVOID;
00043 typedef DWORD HANDLE;
00044 typedef ULONG * PULONG;
00045 typedef const char * PCSTR;
00046 typedef const unsigned short * PWCSTR;
00047
00048 #define FALSE 0
00049 #define TRUE 1
00050
00051 #endif // _IOW_WINTYPES_H_
00052
00053 #endif // _WIN32
00054
00055
00056 #define IOWKIT_VENDOR_ID 0x07c0
00057 #define IOWKIT_VID IOWKIT_VENDOR_ID
00058
00059 #define IOWKIT_PRODUCT_ID_IOW40 0x1500
00060 #define IOWKIT_PID_IOW40 IOWKIT_PRODUCT_ID_IOW40
00061
00062 #define IOWKIT_PRODUCT_ID_IOW24 0x1501
00063 #define IOWKIT_PID_IOW24 IOWKIT_PRODUCT_ID_IOW24
00064
00065 #define IOWKIT_PRODUCT_ID_IOWPV1 0x1511
00066 #define IOWKIT_PID_IOWPV1 IOWKIT_PRODUCT_ID_IOWPV1
00067 #define IOWKIT_PRODUCT_ID_IOWPV2 0x1512
00068 #define IOWKIT_PID_IOWPV2 IOWKIT_PRODUCT_ID_IOWPV2
00069
00070 #define IOWKIT_PRODUCT_ID_IOW56 0x1503
00071 #define IOWKIT_PID_IOW56 IOWKIT_PRODUCT_ID_IOW56
00072
00073
00074 #define IOWKIT_MAX_PIPES 2
00075
00076
00077 #define IOW_PIPE_IO_PINS 0
00078 #define IOW_PIPE_SPECIAL_MODE 1
00079
00080
00081 #define IOWKIT_MAX_DEVICES 16
00082
00083 #define IOW_OPEN_SIMPLE 1
00084 #define IOW_OPEN_COMPLEX 2
00085
00086
00087 #define IOW_NON_LEGACY_REVISION 0x1010
00088
00089
00090 #pragma pack(push, 1)
00091
00092 typedef struct _IOWKIT_REPORT
00093 {
00094 UCHAR ReportID;
00095 union
00096 {
00097 DWORD Value;
00098 BYTE Bytes[4];
00099 };
00100 }
00101 IOWKIT_REPORT, *PIOWKIT_REPORT;
00102
00103 typedef struct _IOWKIT40_IO_REPORT
00104 {
00105 UCHAR ReportID;
00106 union
00107 {
00108 DWORD Value;
00109 BYTE Bytes[4];
00110 };
00111 }
00112 IOWKIT40_IO_REPORT, *PIOWKIT40_IO_REPORT;
00113
00114 typedef struct _IOWKIT24_IO_REPORT
00115 {
00116 UCHAR ReportID;
00117 union
00118 {
00119 WORD Value;
00120 BYTE Bytes[2];
00121 };
00122 }
00123 IOWKIT24_IO_REPORT, *PIOWKIT24_IO_REPORT;
00124
00125 typedef struct _IOWKIT_SPECIAL_REPORT
00126 {
00127 UCHAR ReportID;
00128 UCHAR Bytes[7];
00129 }
00130 IOWKIT_SPECIAL_REPORT, *PIOWKIT_SPECIAL_REPORT;
00131
00132 typedef struct _IOWKIT56_IO_REPORT
00133 {
00134 UCHAR ReportID;
00135 UCHAR Bytes[7];
00136 }
00137 IOWKIT56_IO_REPORT, *PIOWKIT56_IO_REPORT;
00138
00139 typedef struct _IOWKIT56_SPECIAL_REPORT
00140 {
00141 UCHAR ReportID;
00142 UCHAR Bytes[63];
00143 }
00144 IOWKIT56_SPECIAL_REPORT, *PIOWKIT56_SPECIAL_REPORT;
00145
00146 #define IOWKIT_REPORT_SIZE sizeof(IOWKIT_REPORT)
00147 #define IOWKIT40_IO_REPORT_SIZE sizeof(IOWKIT40_IO_REPORT)
00148 #define IOWKIT24_IO_REPORT_SIZE sizeof(IOWKIT24_IO_REPORT)
00149 #define IOWKIT_SPECIAL_REPORT_SIZE sizeof(IOWKIT_SPECIAL_REPORT)
00150 #define IOWKIT56_IO_REPORT_SIZE sizeof(IOWKIT56_IO_REPORT)
00151 #define IOWKIT56_SPECIAL_REPORT_SIZE sizeof(IOWKIT56_SPECIAL_REPORT)
00152
00153 #pragma pack(pop)
00154
00155
00156 typedef PVOID IOWKIT_HANDLE;
00157
00158
00159
00160 #ifdef __cplusplus
00161 extern "C" {
00162 #endif // __cplusplus
00163
00164 IOWKIT_HANDLE IOWKIT_API IowKitOpenDevice(void);
00165 void IOWKIT_API IowKitCloseDevice(IOWKIT_HANDLE devHandle);
00166 ULONG IOWKIT_API IowKitWrite(IOWKIT_HANDLE devHandle, ULONG numPipe,
00167 PCHAR buffer, ULONG length);
00168 ULONG IOWKIT_API IowKitRead(IOWKIT_HANDLE devHandle, ULONG numPipe,
00169 PCHAR buffer, ULONG length);
00170 ULONG IOWKIT_API IowKitReadNonBlocking(IOWKIT_HANDLE devHandle, ULONG numPipe,
00171 PCHAR buffer, ULONG length);
00172 BOOL IOWKIT_API IowKitReadImmediate(IOWKIT_HANDLE devHandle, PDWORD value);
00173 ULONG IOWKIT_API IowKitGetNumDevs(void);
00174 IOWKIT_HANDLE IOWKIT_API IowKitGetDeviceHandle(ULONG numDevice);
00175 BOOL IOWKIT_API IowKitSetLegacyOpenMode(ULONG legacyOpenMode);
00176 ULONG IOWKIT_API IowKitGetProductId(IOWKIT_HANDLE devHandle);
00177 ULONG IOWKIT_API IowKitGetRevision(IOWKIT_HANDLE devHandle);
00178 HANDLE IOWKIT_API IowKitGetThreadHandle(IOWKIT_HANDLE devHandle);
00179 BOOL IOWKIT_API IowKitGetSerialNumber(IOWKIT_HANDLE devHandle, PWCHAR serialNumber);
00180 BOOL IOWKIT_API IowKitSetTimeout(IOWKIT_HANDLE devHandle, ULONG timeout);
00181 BOOL IOWKIT_API IowKitSetWriteTimeout(IOWKIT_HANDLE devHandle, ULONG timeout);
00182 BOOL IOWKIT_API IowKitCancelIo(IOWKIT_HANDLE devHandle, ULONG numPipe);
00183 PCSTR IOWKIT_API IowKitVersion(void);
00184
00185 #ifdef __cplusplus
00186 }
00187 #endif // __cplusplus
00188
00189 #endif // _IOW_KIT_H_