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.

299 lines
10 KiB

  1. /*++
  2. Copyright (c) 1990-1998 Microsoft Corporation
  3. Module Name:
  4. ntddfdc.h
  5. Abstract:
  6. This is the include file that defines all constants and types for
  7. accessing the fdc.sys port adapter.
  8. Revision History:
  9. --*/
  10. //
  11. // Floppy Drive Motor Enable
  12. //
  13. #define FDC_MOTOR_A 0x10
  14. #define FDC_MOTOR_B 0x20
  15. #define FDC_MOTOR_C 0x40
  16. #define FDC_MOTOR_D 0x80
  17. //
  18. // Floppy Drive Select
  19. //
  20. #define FDC_SELECT_A 0x00
  21. #define FDC_SELECT_B 0x01
  22. #define FDC_SELECT_C 0x02
  23. #define FDC_SELECT_D 0x03
  24. //
  25. // Floppy commands.
  26. //
  27. #define COMMND_READ_DATA 0x00
  28. #define COMMND_READ_DELETED_DATA 0x01
  29. #define COMMND_WRITE_DATA 0x02
  30. #define COMMND_WRITE_DELETED_DATA 0x03
  31. #define COMMND_READ_TRACK 0x04
  32. #define COMMND_VERIFY 0x05
  33. #define COMMND_VERSION 0x06
  34. #define COMMND_FORMAT_TRACK 0x07
  35. #define COMMND_SCAN_EQUAL 0x08
  36. #define COMMND_SCAN_LOW_OR_EQUAL 0x09
  37. #define COMMND_SCAN_HIGH_OR_EQUAL 0x0A
  38. #define COMMND_RECALIBRATE 0x0B
  39. #define COMMND_SENSE_INTERRUPT_STATUS 0x0C
  40. #define COMMND_SPECIFY 0x0D
  41. #define COMMND_SENSE_DRIVE_STATUS 0x0E
  42. #define COMMND_DRIVE_SPECIFICATION 0x0F
  43. #define COMMND_SEEK 0x10
  44. #define COMMND_CONFIGURE 0x11
  45. #define COMMND_RELATIVE_SEEK 0x12
  46. #define COMMND_DUMPREG 0x13
  47. #define COMMND_READ_ID 0x14
  48. #define COMMND_PERPENDICULAR_MODE 0x15
  49. #define COMMND_LOCK 0x16
  50. #define COMMND_PART_ID 0x17
  51. #define COMMND_POWERDOWN_MODE 0x18
  52. #define COMMND_OPTION 0x19
  53. #define COMMND_SAVE 0x1A
  54. #define COMMND_RESTORE 0x1B
  55. #define COMMND_FORMAT_AND_WRITE 0x1C
  56. #ifdef TOSHIBA
  57. #define TOSHIBA_COMMND_MODE 0x1D
  58. #endif
  59. //
  60. // Optional bits used with the commands.
  61. //
  62. #define COMMND_OPTION_MULTI_TRACK 0x80 //
  63. #define COMMND_OPTION_MFM 0x40 /// Used in read and write commands
  64. #define COMMND_OPTION_SKIP 0x20 //
  65. #define COMMND_OPTION_CLK48 0x80 // Used in configure command
  66. #define COMMND_OPTION_DIRECTION 0x40 // Used in relative seek command
  67. #define COMMND_OPTION_LOCK 0x80 // Used in lock command
  68. #define COMMND_DRIVE_SPECIFICATION_DONE 0x80 // Done bit in the Drive Specification argument string
  69. //
  70. // Floppy controler data rates (to be OR'd together)
  71. //
  72. #define FDC_SPEED_250KB 0x0001
  73. #define FDC_SPEED_300KB 0x0002
  74. #define FDC_SPEED_500KB 0x0004
  75. #define FDC_SPEED_1MB 0x0008
  76. #define FDC_SPEED_2MB 0x0010
  77. //
  78. // Dma Width supported
  79. //
  80. #define FDC_8_BIT_DMA 0x0001
  81. #define FDC_16_BIT_DMA 0x0002
  82. //
  83. // Clock Rate to the FDC (FDC_82078 only)
  84. //
  85. #define FDC_CLOCK_NORMAL 0x0000 // Use this for non 82078 parts
  86. #define FDC_CLOCK_48MHZ 0x0001 // 82078 with a 48MHz clock
  87. #define FDC_CLOCK_24MHZ 0x0002 // 82078 with a 24MHz clock
  88. //
  89. // Floppy controler types
  90. //
  91. #define FDC_TYPE_UNKNOWN 0
  92. #define FDC_TYPE_NORMAL 2
  93. #define FDC_TYPE_ENHANCED 3
  94. #define FDC_TYPE_82077 4
  95. #define FDC_TYPE_82077AA 5
  96. #define FDC_TYPE_82078_44 6
  97. #define FDC_TYPE_82078_64 7
  98. #define FDC_TYPE_NATIONAL 8
  99. //
  100. // Internal floppy disk driver device controls.
  101. //
  102. #define IOCTL_DISK_INTERNAL_ACQUIRE_FDC CTL_CODE(IOCTL_DISK_BASE, 0x300, METHOD_NEITHER, FILE_ANY_ACCESS)
  103. #define IOCTL_DISK_INTERNAL_RELEASE_FDC CTL_CODE(IOCTL_DISK_BASE, 0x301, METHOD_NEITHER, FILE_ANY_ACCESS)
  104. #define IOCTL_DISK_INTERNAL_GET_FDC_INFO CTL_CODE(IOCTL_DISK_BASE, 0x302, METHOD_NEITHER, FILE_ANY_ACCESS)
  105. #define IOCTL_DISK_INTERNAL_ISSUE_FDC_COMMAND CTL_CODE(IOCTL_DISK_BASE, 0x303, METHOD_NEITHER, FILE_ANY_ACCESS)
  106. #define IOCTL_DISK_INTERNAL_ISSUE_FDC_COMMAND_QUEUED CTL_CODE(IOCTL_DISK_BASE, 0x304, METHOD_NEITHER, FILE_ANY_ACCESS)
  107. #define IOCTL_DISK_INTERNAL_RESET_FDC CTL_CODE(IOCTL_DISK_BASE, 0x305, METHOD_NEITHER, FILE_ANY_ACCESS)
  108. #define IOCTL_DISK_INTERNAL_ENABLE_FDC_DEVICE CTL_CODE(IOCTL_DISK_BASE, 0x306, METHOD_NEITHER, FILE_ANY_ACCESS)
  109. #define IOCTL_DISK_INTERNAL_DISABLE_FDC_DEVICE CTL_CODE(IOCTL_DISK_BASE, 0x307, METHOD_NEITHER, FILE_ANY_ACCESS)
  110. #define IOCTL_DISK_INTERNAL_GET_FDC_DISK_CHANGE CTL_CODE(IOCTL_DISK_BASE, 0x308, METHOD_NEITHER, FILE_ANY_ACCESS)
  111. #define IOCTL_DISK_INTERNAL_SET_FDC_DATA_RATE CTL_CODE(IOCTL_DISK_BASE, 0x309, METHOD_NEITHER, FILE_ANY_ACCESS)
  112. #define IOCTL_DISK_INTERNAL_SET_FDC_TAPE_MODE CTL_CODE(IOCTL_DISK_BASE, 0x30a, METHOD_NEITHER, FILE_ANY_ACCESS)
  113. #define IOCTL_DISK_INTERNAL_SET_FDC_PRECOMP CTL_CODE(IOCTL_DISK_BASE, 0x30b, METHOD_NEITHER, FILE_ANY_ACCESS)
  114. #define IOCTL_DISK_INTERNAL_GET_ADAPTER_BUFFER CTL_CODE(IOCTL_DISK_BASE, 0x30c, METHOD_NEITHER, FILE_ANY_ACCESS)
  115. #define IOCTL_DISK_INTERNAL_FLUSH_ADAPTER_BUFFER CTL_CODE(IOCTL_DISK_BASE, 0x30d, METHOD_NEITHER, FILE_ANY_ACCESS)
  116. #define IOCTL_DISK_INTERNAL_FDC_START_READ CTL_CODE(IOCTL_DISK_BASE, 0x30e, METHOD_NEITHER, FILE_ANY_ACCESS)
  117. #define IOCTL_DISK_INTERNAL_FDC_START_WRITE CTL_CODE(IOCTL_DISK_BASE, 0x30f, METHOD_NEITHER, FILE_ANY_ACCESS)
  118. #define IOCTL_DISK_INTERNAL_GET_ENABLER CTL_CODE(IOCTL_DISK_BASE, 0x310, METHOD_NEITHER, FILE_ANY_ACCESS)
  119. #define IOCTL_DISK_INTERNAL_SET_HD_BIT CTL_CODE(IOCTL_DISK_BASE, 0x311, METHOD_NEITHER, FILE_ANY_ACCESS)
  120. #ifdef TOSHIBA
  121. /* 3 mode support */
  122. #define IOCTL_DISK_INTERNAL_ENABLE_3_MODE CTL_CODE(IOCTL_DISK_BASE, 0xb01, METHOD_NEITHER, FILE_ANY_ACCESS)
  123. #define IOCTL_DISK_INTERNAL_AVAILABLE_3_MODE CTL_CODE(IOCTL_DISK_BASE, 0xb02, METHOD_NEITHER, FILE_ANY_ACCESS)
  124. typedef struct _enable_3_mode
  125. { UCHAR DeviceUnit;
  126. BOOLEAN Enable3Mode;
  127. } ENABLE_3_MODE, *PENABLE_3_MODE;
  128. #endif
  129. //
  130. // Transfer Buffer Array. Contains the number of buffers allocated and a
  131. // virtual address for each of the allocated buffers.
  132. //
  133. typedef struct _TRANSFER_BUFFER {
  134. PHYSICAL_ADDRESS Logical;
  135. PVOID Virtual;
  136. } TRANSFER_BUFFER, *PTRANSFER_BUFFER;
  137. //
  138. // Parameters for communicating with fdc.sys
  139. //
  140. //
  141. // Floppy Device Data returned from the ACPI _FDI method. This data is
  142. // very nearly identical to the CM_FLOPPY_DEVICE_DATA retured via
  143. // IoQueryDeviceDescription.
  144. //
  145. // Refer to x86 BIOS documentation for Int13, function 8 for definitions of
  146. // these fields.
  147. //
  148. typedef struct _ACPI_FDI_DATA {
  149. ULONG DriveNumber;
  150. ULONG DeviceType;
  151. ULONG MaxCylinderNumber;
  152. ULONG MaxSectorNumber;
  153. ULONG MaxHeadNumber;
  154. ULONG StepRateHeadUnloadTime;
  155. ULONG HeadLoadTime;
  156. ULONG MotorOffTime;
  157. ULONG SectorLengthCode;
  158. ULONG SectorPerTrack;
  159. ULONG ReadWriteGapLength;
  160. ULONG DataTransferLength;
  161. ULONG FormatGapLength;
  162. ULONG FormatFillCharacter;
  163. ULONG HeadSettleTime; // in 1ms units, typically 15ms
  164. ULONG MotorSettleTime; // in 1/8ms units, typically 8=1ms
  165. } ACPI_FDI_DATA, *PACPI_FDI_DATA;
  166. typedef enum _ACPI_FDI_DEVICE_TYPE {
  167. CmosProblem = 0,
  168. Form525Capacity360,
  169. Form525Capacity1200,
  170. Form35Capacity720,
  171. Form35Capacity1440,
  172. Form35Capacity2880
  173. } ACPI_FDI_DEVICE_TYPE ;
  174. typedef struct _FDC_INFO {
  175. UCHAR FloppyControllerType; // Should be any ONE of type FDC_TYPE_XXXX
  176. UCHAR SpeedsAvailable; // Any combination of FDC_SPEED_xxxx or'd together
  177. ULONG AdapterBufferSize; // number of bytes available in the adapters buffer
  178. // If zero, then no limit on amount of data pending
  179. // in get/flush adapter buffer
  180. INTERFACE_TYPE BusType;
  181. ULONG BusNumber; // These are used by floppy.sys to query
  182. ULONG ControllerNumber; // its device description.
  183. ULONG PeripheralNumber;
  184. ULONG UnitNumber; // NEC98: Indicate device unit number.
  185. ULONG MaxTransferSize;
  186. BOOLEAN AcpiBios;
  187. BOOLEAN AcpiFdiSupported;
  188. ACPI_FDI_DATA AcpiFdiData;
  189. ULONG BufferCount;
  190. ULONG BufferSize;
  191. TRANSFER_BUFFER BufferAddress[];
  192. } FDC_INFO, *PFDC_INFO;
  193. //
  194. // TurnOnMotor
  195. //
  196. typedef struct _FDC_ENABLE_PARMS {
  197. UCHAR DriveOnValue; // FDC_MOTOR_X + FDC_SELECT_X
  198. USHORT TimeToWait;
  199. BOOLEAN MotorStarted;
  200. } FDC_ENABLE_PARMS;
  201. typedef FDC_ENABLE_PARMS *PFDC_ENABLE_PARMS;
  202. //
  203. // DiskChange
  204. //
  205. typedef struct _FDC_DISK_CHANGE_PARMS {
  206. UCHAR DriveStatus;
  207. UCHAR DriveOnValue;
  208. } FDC_DISK_CHANGE_PARMS, *PFDC_DISK_CHANGE_PARMS;
  209. //
  210. // IssueCommand
  211. //
  212. typedef struct _ISSUE_FDC_COMMAND_PARMS {
  213. PUCHAR FifoInBuffer;
  214. PUCHAR FifoOutBuffer;
  215. PVOID IoHandle; // Must be "Handle" from ISSUE_FDC_ADAPTER_BUFFER_PARMS or Mdl
  216. ULONG IoOffset;
  217. ULONG TransferBytes; // Must be return value from ISSUE_FDC_ADAPTER_BUFFER_PARMS "TransferBytes"
  218. ULONG TimeOut;
  219. } ISSUE_FDC_COMMAND_PARMS, *PISSUE_FDC_COMMAND_PARMS;
  220. //
  221. // Fill/Flush Adapter Buffer
  222. //
  223. typedef struct _ISSUE_FDC_ADAPTER_BUFFER_PARMS {
  224. PVOID IoBuffer; // Pointer to caller's data buffer (if NULL, no data is copied
  225. // to (GET) /from (FLUSH) the adapter buffer)
  226. USHORT TransferBytes; // amount of data to transfer (could be less on return
  227. // if insufficient space to copy buffer). Could be Zero
  228. // if no buffers are available
  229. PVOID Handle; // used to pass in the IoBuffer field of the ISSUE_FDC_COMMAND_PARMS
  230. // structure.
  231. } ISSUE_FDC_ADAPTER_BUFFER_PARMS, *PISSUE_FDC_ADAPTER_BUFFER_PARMS;
  232. //
  233. // NEC98: Set a HD bit or a FDD EXC bit.
  234. //
  235. typedef struct _SET_HD_BIT_PARMS {
  236. BOOLEAN DriveType144MB; // Indicate drive Type is 1.44MB.
  237. BOOLEAN Media144MB; // Indicate media is 1.44MB
  238. BOOLEAN More120MB; // Indicate capacity of media is 1.2MB or more
  239. UCHAR DeviceUnit; // Indicate device unit number
  240. BOOLEAN ChangedHdBit; // Indicate HD Bit have been changed
  241. } SET_HD_BIT_PARMS, *PSET_HD_BIT_PARMS;