Leaked source code of windows server 2003
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.

276 lines
7.8 KiB

  1. /****************************************************************************
  2. MODULE: VXDIOCTL.HPP
  3. Tab stops 5 9
  4. Copyright 1995-1997, Microsoft Corporation, All Rights Reserved.
  5. PURPOSE: Header file for VXDIOCTL.CPP
  6. FUNCTIONS:
  7. Author(s): Name:
  8. ---------- ----------------
  9. MEA Manolito E. Adan
  10. Revision History:
  11. -----------------
  12. Version Date Author Comments
  13. ------- ------ ----- -------------------------------------------
  14. 1.0 03-Jan-97 MEA Original
  15. 1.1 14-Apr-97 MEA Added SetMidiPort IOCTL
  16. 11-Jun-97 MEA Added JoltHWReset IOCTL
  17. 20-Mar-99 waltw Nuked VxDCommunicator, this is NT5 only!
  18. ****************************************************************************/
  19. #ifndef __VXDIOCTL_HPP__
  20. #define __VXDIOCTL_HPP__
  21. #include <windows.h>
  22. #include "FFeature.h"
  23. #ifndef override
  24. #define override
  25. #endif
  26. //--------------------- Host converted AckNack,Effect Status Structure ------
  27. typedef struct _ACKNACK {
  28. DWORD cBytes;
  29. DWORD dwAckNack; //ACK, NACK
  30. DWORD dwErrorCode;
  31. DWORD dwEffectStatus; //SWDEV_STS_EFFECT_RUNNING||SWDEV_STS_EFFECT_STOPPED
  32. } ACKNACK, *PACKNACK;
  33. //--------------------- Host converted Channel ID Structure -----------------
  34. struct LOCAL_PRODUCT_ID {
  35. DWORD cBytes;
  36. DWORD dwProductID;
  37. DWORD dwFWMajVersion;
  38. DWORD dwFWMinVersion;
  39. };
  40. // Bitmasks for Response Status - 1.xx (we don't support version 1 - informational only)
  41. //#define STATUS_GATE_1XX 0x08
  42. //#define RUNNING_MASK_1XX 0x04
  43. //#define ACKNACK_MASK_1XX 0x02
  44. //#define SCLK_MASK_1XX 0x01
  45. // Bitmasks for Response Status - Version 2
  46. #define STATUS_GATE_200 0x80
  47. #define RUNNING_MASK_200 0x40
  48. #define ACKNACK_MASK_200 0x20
  49. #define SCLK_MASK_200 0x10
  50. /************************************************************************
  51. **
  52. ** @class DriverCommunicator |
  53. ** This is the interface for driver communications
  54. **
  55. *************************************************************************/
  56. class DriverCommunicator
  57. {
  58. //@access Constructor/Destructor
  59. public:
  60. //@cmember constructor
  61. DriverCommunicator() {};
  62. //@cmember destructor
  63. virtual ~DriverCommunicator() {};
  64. virtual HRESULT ResetDevice() { return E_NOTIMPL; }
  65. virtual HRESULT GetDriverVersion(DWORD& rdwMajor, DWORD& rdwMinor) { return E_NOTIMPL; }
  66. virtual HRESULT GetID(LOCAL_PRODUCT_ID& rProductID) { return E_NOTIMPL; }
  67. virtual HRESULT GetStatus(JOYCHANNELSTATUS& rChannelStatus) { return E_NOTIMPL; }
  68. virtual HRESULT GetAckNack(ACKNACK& rAckNack, USHORT usRegIndex) { return E_NOTIMPL; }
  69. virtual HRESULT GetStatusGateData(DWORD& dwGateData) { return E_NOTIMPL; }
  70. virtual HRESULT SetBackdoorPort(ULONG ulPortAddress) { return E_NOTIMPL; }
  71. virtual HRESULT SendBackdoorShortMidi(DWORD dwMidiMessage) { return E_NOTIMPL; }
  72. virtual HRESULT SendBackdoorLongMidi(BYTE* pMidiData) { return E_NOTIMPL; }
  73. };
  74. /************************************************************************
  75. **
  76. ** @class HIDFeatureCommunicator |
  77. ** Communicates with the HID driver via HID Features (NT5)
  78. **
  79. *************************************************************************/
  80. class HIDFeatureCommunicator :
  81. public DriverCommunicator
  82. {
  83. //@access Constructor/Destructor
  84. public:
  85. //@cmember constructor
  86. HIDFeatureCommunicator();
  87. //@cmember destructor
  88. override ~HIDFeatureCommunicator();
  89. BOOL Initialize(UINT uJoystickId);
  90. override HRESULT ResetDevice();
  91. override HRESULT GetDriverVersion(DWORD& rdwMajor, DWORD& rdwMinor);
  92. override HRESULT GetID(LOCAL_PRODUCT_ID& rProductID);
  93. override HRESULT GetStatus(JOYCHANNELSTATUS& rChannelStatus);
  94. override HRESULT GetAckNack(ACKNACK& rAckNack, USHORT usRegIndex);
  95. override HRESULT GetStatusGateData(DWORD& rdwGateData);
  96. override HRESULT SendBackdoorShortMidi(DWORD dwMidiMessage);
  97. override HRESULT SendBackdoorLongMidi(BYTE* pMidiData);
  98. //@access Private Data Members
  99. private:
  100. CForceFeatures m_ForceFeature;
  101. };
  102. extern DriverCommunicator* g_pDriverCommunicator;
  103. /********************************** Old dead code ***********************************/
  104. #if 0
  105. #define NT_VXD
  106. #ifdef NT_VXD
  107. // REVIEW: swforce.sys should use _JOYCHANNELID instead of _PRODUCT_ID
  108. #define _PRODUCT_ID _JOYCHANNELID
  109. #define PRODUCT_ID JOYCHANNELID
  110. #define PPRODUCT_ID PJOYCHANNELID
  111. #include "swforce.h"
  112. #undef _PRODUCT_ID
  113. #undef PRODUCT_ID
  114. #undef PPRODUCT_ID
  115. #endif
  116. #define IOCTL_OPEN 0
  117. #define IOCTL_GET_DRIVERVERSION 1
  118. #define IOCTL_GET_DATAPACKET 2
  119. #define IOCTL_GET_STATUSPACKET 3
  120. #define IOCTL_GET_IDPACKET 4
  121. #define IOCTL_GET_DIAGNOSTICS 5
  122. #define IOCTL_MIDISENDSHORTMSG 6
  123. #define IOCTL_GET_ACKNACK 7
  124. #define IOCTL_SET_MIDIPORT 8
  125. #define IOCTL_MIDISENDLONGMSG 9
  126. #define IOCTL_HW_RESET 10
  127. #define COMM_DEFAULT_MIDI_PORT 0
  128. #define COMM_COM1 1
  129. #define COMM_COM2 2
  130. #define COMM_COM3 3
  131. #define COMM_COM4 4
  132. #define COMM_MIDI300 0x300
  133. //----------------------- Joystick Diagnostics Counters Data Structure ---
  134. typedef struct _DIAGNOSTIC_COUNTER {
  135. DWORD cBytes;
  136. DWORD DataFailCount; // GetData
  137. DWORD StatusFailCount; // GetStatus
  138. DWORD IDFailCount; // GetID
  139. DWORD AckNackFailCount; // Get Ack/Nack
  140. DWORD DataPacketCount;
  141. DWORD StatusPacketCount;
  142. DWORD IDPacketCount;
  143. DWORD AckNackPacketCount;
  144. DWORD TotalPktFails;
  145. } DIAGNOSTIC_COUNTER, *PDIAGNOSTIC_COUNTER;
  146. //--------------------- Joystick Channel Data Structure --------------------
  147. typedef struct _JOYCHANNELDATA {
  148. DWORD cBytes;
  149. DWORD dwXAxis;
  150. DWORD dwYAxis;
  151. DWORD dwThrottle;
  152. DWORD dwRudder;
  153. DWORD dwHatSwitch;
  154. DWORD dwButtons;
  155. } JOYCHANNELDATA, *PJOYCHANNELDATA;
  156. //--------------------- Joystick Channel Status Structure --------------------
  157. #ifndef NT_VXD
  158. typedef struct _JOYCHANNELSTATUS {
  159. DWORD cBytes;
  160. LONG dwXVel;
  161. LONG dwYVel;
  162. LONG dwXAccel;
  163. LONG dwYAccel;
  164. DWORD dwDeviceStatus;
  165. } JOYCHANNELSTATUS, *PJOYCHANNELSTATUS;
  166. #endif !NT_VXD
  167. //--------------------- Joystick Channel ID Structure -----------------------
  168. #ifndef NT_VXD
  169. typedef struct _JOYCHANNELID {
  170. DWORD cBytes;
  171. DWORD dwProductID;
  172. DWORD dwFWVersion;
  173. } JOYCHANNELID, *PJOYCHANNELID;
  174. #endif !NT_VXD
  175. //--------------------- Host converted Channel ID Structure -----------------
  176. typedef struct _PRODUCT_ID {
  177. DWORD cBytes;
  178. DWORD dwProductID;
  179. DWORD dwFWMajVersion;
  180. DWORD dwFWMinVersion;
  181. } PRODUCT_ID, *PPRODUCT_ID;
  182. //--------------------- Host converted AckNack,Effect Status Structure ------
  183. typedef struct _ACKNACK {
  184. DWORD cBytes;
  185. DWORD dwAckNack; //ACK, NACK
  186. DWORD dwErrorCode;
  187. DWORD dwEffectStatus; //SWDEV_STS_EFFECT_RUNNING||SWDEV_STS_EFFECT_STOPPED
  188. } ACKNACK, *PACKNACK;
  189. //
  190. // --- IOCTL interface to Digital OverDrive mini-driver ---------------------
  191. //
  192. HANDLE WINAPI GetDevice(
  193. IN const char* vxdName);
  194. BOOL WINAPI CloseDevice(
  195. IN HANDLE hVxD);
  196. HRESULT QueryDriverVersion(DWORD& major, DWORD& minor);
  197. HRESULT WINAPI GetDataPacket(
  198. IN HANDLE hDevice,
  199. IN OUT PJOYCHANNELDATA pDataPacket);
  200. HRESULT WINAPI GetStatusPacket(
  201. IN HANDLE hDevice,
  202. IN OUT PJOYCHANNELSTATUS pStatusPacket);
  203. HRESULT WINAPI GetIDPacket(
  204. IN HANDLE hDevice,
  205. IN OUT PPRODUCT_ID pID);
  206. HRESULT WINAPI GetDiagnostics(
  207. IN HANDLE hDevice,
  208. IN OUT PDIAGNOSTIC_COUNTER pDiagnostics);
  209. HRESULT WINAPI GetAckNack(
  210. IN HANDLE hDevice,
  211. IN OUT PACKNACK pAckNack,
  212. IN USHORT regindex);
  213. HRESULT WINAPI GetStatusGateData(
  214. IN HANDLE hDevice,
  215. IN OUT DWORD *pdwStatusGateData);
  216. HRESULT WINAPI SendBackDoorShortMidi(
  217. IN HANDLE hDevice,
  218. IN ULONG ulData);
  219. HRESULT WINAPI SendBackDoorLongMidi(
  220. IN HANDLE hDevice,
  221. IN PBYTE pData);
  222. HRESULT WINAPI SetMidiPort(
  223. IN HANDLE hDevice,
  224. IN ULONG ulPort);
  225. HRESULT WINAPI JoltHWReset(
  226. IN HANDLE hDevice);
  227. #endif
  228. #endif __VXDIOCTL_HPP__