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.

144 lines
4.5 KiB

  1. /*
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. ntddjoy.h
  5. Abstract:
  6. Definitions of all constants and types for the joystick driver.
  7. */
  8. #ifndef __NTDDJOY_H__
  9. #define __NTDDJOY_H__
  10. #if _MSC_VER > 1000
  11. #pragma once
  12. #endif
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. // Device Name
  17. #define JOY_DD_DEVICE_NAME "\\Device\\IBMJOY"
  18. #define JOY_DD_DEVICE_NAME_U L"\\Device\\IBMJOY"
  19. // Device Parameters
  20. #define JOY_DD_NAXES "NumberOfAxes"
  21. #define JOY_DD_NAXES_U L"NumberOfAxes"
  22. #define JOY_DD_DEVICE_ADDRESS "DeviceAddress"
  23. #define JOY_DD_DEVICE_ADDRESS_U L"DeviceAddress"
  24. #define JOY_DD_TWOSTICKS "Two Joysticks"
  25. #define JOY_DD_TWOSTICKS_U L"Two Joysticks"
  26. // Device I/O Port Address
  27. #define JOY_IO_PORT_ADDRESS 0x201
  28. // Device specific bitmasks
  29. #define X_AXIS_BITMASK 0x01
  30. // Analog joystick bitmasks
  31. #define JOYSTICK2_BUTTON2 0x80
  32. #define JOYSTICK2_BUTTON1 0x40
  33. #define JOYSTICK1_BUTTON2 0x20
  34. #define JOYSTICK1_BUTTON1 0x10
  35. #define JOYSTICK2_Y_MASK 0x08
  36. #define JOYSTICK2_X_MASK 0x04
  37. #define JOYSTICK1_R_MASK 0x08
  38. #define JOYSTICK1_Z_MASK 0x04
  39. #define JOYSTICK1_Y_MASK 0x02
  40. #define JOYSTICK1_X_MASK 0x01
  41. #define JOY_START_TIMERS 0
  42. // Device specific timer values
  43. #define ANALOG_POLL_TIMEOUT 16000 // 16 mS upper bound on analog polling, 8ms largest expected value, use 16 for safety
  44. #define ANALOG_POLL_RESOLUTION 100 // 100 uS accuracy on polling time
  45. // Joystick position information is transfered from the device driver to other
  46. // drivers or applications using the JOY_DD_INPUT_DATA structure. Since
  47. // the type of data returned varies whether the device is in analog mode or
  48. // digital mode, a union is formed to convey both types of data. The Mode
  49. // variable allows the recipient of the data to determing how to interpret
  50. // the data.
  51. typedef struct {
  52. // True if the device is unplugged. This is determined by a timeout mechanism
  53. BOOL Unplugged;
  54. // The number of axi configured for this device (specified in the registry).
  55. DWORD Axi;
  56. // current button state bitmask
  57. DWORD Buttons;
  58. // X, Y, Z, and T axi positioning information contained below. The
  59. // values are expressed interms of microseconds. The values are
  60. // generated by measuring the duration of a pulse supplied by
  61. // the IBM compatable or Soundblaster game port. This is the raw
  62. // data, and it is the caller's responsibility to perform
  63. // calibration, ranging, hysteresis, etc.
  64. //
  65. // Because of inaccuracies in sampling this data, there is some
  66. // variation in readings of a stationary joystick.
  67. //
  68. // Analog Positioning information for typical joystick
  69. // values as follows (range information measured using a
  70. // Soundblaster analog game port).
  71. //
  72. // apprx
  73. // name range direction
  74. // ---- ----- ---------
  75. //
  76. // XTime 20..1600 uS 20 = leftmost, 1600 = rightmost
  77. // YTime 20..1600 uS 20 = up, 1600 = down
  78. // ZTime 20..1600 uS 20 = left, 1600 = right
  79. // TTime 20..1600 uS 20 = forward 1600 = back
  80. //
  81. DWORD XTime; // Time in microseconds for X
  82. DWORD YTime; // Time in microseconds for Y
  83. DWORD ZTime; // Time in microseconds for Z if 3-axis
  84. DWORD TTime; // Time in microseconds for Throttle if 4 axis
  85. // return 3rd axis for 3 axis joysticks as TTime.
  86. } JOY_DD_INPUT_DATA, *PJOY_DD_INPUT_DATA;
  87. #define JOY_TYPE 40001
  88. // The following IOCTL code is used to obtain statistical information for
  89. // debugging and performance testing the joystick driver.
  90. #define IOCTL_JOY_GET_STATISTICS \
  91. CTL_CODE( JOY_TYPE, 0x903, METHOD_BUFFERED, FILE_READ_ACCESS)
  92. // The following IOCTL code is used by the user-mode driver to determine
  93. // the capabilities which the kernel-mode driver is capable of supporting.
  94. #define IOCTL_JOY_GET_JOYREGHWCONFIG \
  95. CTL_CODE( JOY_TYPE, 0x906, METHOD_BUFFERED, FILE_READ_ACCESS)
  96. // These stats are used for performance testing and debugging
  97. typedef struct
  98. {
  99. DWORD Polls;
  100. DWORD Timeouts;
  101. DWORD Frequency;
  102. DWORD dwQPCLatency;
  103. LONG nQuiesceLoop;
  104. DWORD Version;
  105. DWORD PolledTooSoon;
  106. DWORD NumberOfAxes;
  107. BOOL bTwoSticks;
  108. DWORD Redo;
  109. } JOY_STATISTICS, *PJOY_STATISTICS;
  110. #ifdef __cplusplus
  111. }
  112. #endif
  113. #endif // __NTDDJOY_H__