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.

185 lines
6.0 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1999 - 1999
  3. Module Name:
  4. ideuser.h
  5. Abstract:
  6. These are the structures and defines that are used in the
  7. PCI IDE mini drivers.
  8. Revision History:
  9. --*/
  10. #if !defined (___ideuser_h___)
  11. #define ___ideuser_h___
  12. //@@BEGIN_DDKSPLIT
  13. typedef enum {
  14. DeviceUnknown = 0,
  15. DeviceIsAta,
  16. DeviceIsAtapi,
  17. DeviceNotExist
  18. } IDE_DEVICETYPE;
  19. typedef enum {
  20. DdlPioOnly = 0,
  21. DdlFirmwareOk,
  22. DdlAlways
  23. } DMADETECTIONLEVEL;
  24. #define DMA_DETECTION_LEVEL_REG_KEY L"DmaDetectionLevel"
  25. #define PCMCIA_IDE_CONTROLLER_HAS_SLAVE L"PcmciaIdeHasSlaveDevice"
  26. #define MASTER_DEVICE_TIMEOUT L"MasterDeviceDetectionTimeout"
  27. #define SLAVE_DEVICE_TIMEOUT L"SlaveDeviceDetectionTimeout"
  28. #define MASTER_DEVICE_TYPE_REG_KEY L"MasterDeviceType"
  29. #define SLAVE_DEVICE_TYPE_REG_KEY L"SlaveDeviceType"
  30. #define MASTER_DEVICE_TYPE2_REG_KEY L"MasterDeviceType2"
  31. #define SLAVE_DEVICE_TYPE2_REG_KEY L"SlaveDeviceType2"
  32. #define USER_MASTER_DEVICE_TYPE_REG_KEY L"UserMasterDeviceType"
  33. #define USER_SLAVE_DEVICE_TYPE_REG_KEY L"UserSlaveDeviceType"
  34. #define USER_MASTER_DEVICE_TYPE2_REG_KEY L"UserMasterDeviceType2"
  35. #define USER_SLAVE_DEVICE_TYPE2_REG_KEY L"UserSlaveDeviceType2"
  36. #define MASTER_DEVICE_TIMING_MODE L"MasterDeviceTimingMode"
  37. #define SLAVE_DEVICE_TIMING_MODE L"SlaveDeviceTimingMode"
  38. #define MASTER_DEVICE_TIMING_MODE2 L"MasterDeviceTimingMode2"
  39. #define SLAVE_DEVICE_TIMING_MODE2 L"SlaveDeviceTimingMode2"
  40. #define MASTER_DEVICE_TIMING_MODE_ALLOWED L"MasterDeviceTimingModeAllowed"
  41. #define SLAVE_DEVICE_TIMING_MODE_ALLOWED L"SlaveDeviceTimingModeAllowed"
  42. #define MASTER_DEVICE_TIMING_MODE_ALLOWED2 L"MasterDeviceTimingModeAllowed2"
  43. #define SLAVE_DEVICE_TIMING_MODE_ALLOWED2 L"SlaveDeviceTimingModeAllowed2"
  44. #define USER_MASTER_DEVICE_TIMING_MODE_ALLOWED L"UserMasterDeviceTimingModeAllowed"
  45. #define USER_SLAVE_DEVICE_TIMING_MODE_ALLOWED L"UserSlaveDeviceTimingModeAllowed"
  46. #define USER_MASTER_DEVICE_TIMING_MODE_ALLOWED2 L"UserMasterDeviceTimingModeAllowed2"
  47. #define USER_SLAVE_DEVICE_TIMING_MODE_ALLOWED2 L"UserSlaveDeviceTimingModeAllowed2"
  48. #define MASTER_IDDATA_CHECKSUM L"MasterIdDataCheckSum"
  49. #define SLAVE_IDDATA_CHECKSUM L"SlaveIdDataCheckSum"
  50. #define MASTER_IDDATA_CHECKSUM2 L"MasterIdDataCheckSum2"
  51. #define SLAVE_IDDATA_CHECKSUM2 L"SlaveIdDataCheckSum2"
  52. //@@END_DDKSPLIT
  53. #define PIO_MODE0 (1 << 0)
  54. #define PIO_MODE1 (1 << 1)
  55. #define PIO_MODE2 (1 << 2)
  56. #define PIO_MODE3 (1 << 3)
  57. #define PIO_MODE4 (1 << 4)
  58. #define SWDMA_MODE0 (1 << 5)
  59. #define SWDMA_MODE1 (1 << 6)
  60. #define SWDMA_MODE2 (1 << 7)
  61. #define MWDMA_MODE0 (1 << 8)
  62. #define MWDMA_MODE1 (1 << 9)
  63. #define MWDMA_MODE2 (1 << 10)
  64. #define UDMA_MODE0 (1 << 11)
  65. #define UDMA_MODE1 (1 << 12)
  66. #define UDMA_MODE2 (1 << 13)
  67. #define UDMA_MODE3 (1 << 14)
  68. #define UDMA_MODE4 (1 << 15)
  69. #define UDMA_MODE5 (1 << 16)
  70. #define PIO_SUPPORT (PIO_MODE0 | PIO_MODE1 | PIO_MODE2 | PIO_MODE3 | PIO_MODE4)
  71. #define SWDMA_SUPPORT (SWDMA_MODE0 | SWDMA_MODE1 | SWDMA_MODE2)
  72. #define MWDMA_SUPPORT (MWDMA_MODE0 | MWDMA_MODE1 | MWDMA_MODE2)
  73. #define UDMA33_SUPPORT (UDMA_MODE0 | UDMA_MODE1 | UDMA_MODE2)
  74. #define UDMA66_SUPPORT (UDMA_MODE3 | UDMA_MODE4)
  75. #define UDMA100_SUPPORT (UDMA_MODE5 )
  76. #define UDMA_SUPPORT (UNINITIALIZED_TRANSFER_MODE & (~(PIO_SUPPORT | SWDMA_SUPPORT | MWDMA_SUPPORT)))
  77. #define DMA_SUPPORT (SWDMA_SUPPORT | MWDMA_SUPPORT | UDMA_SUPPORT)
  78. #define ALL_MODE_SUPPORT (PIO_SUPPORT | DMA_SUPPORT)
  79. #define PIO0 0
  80. #define PIO1 1
  81. #define PIO2 2
  82. #define PIO3 3
  83. #define PIO4 4
  84. #define SWDMA0 5
  85. #define SWDMA1 6
  86. #define SWDMA2 7
  87. #define MWDMA0 8
  88. #define MWDMA1 9
  89. #define MWDMA2 10
  90. #define UDMA0 11
  91. #define MAX_XFER_MODE 18
  92. #define UNINITIALIZED_CYCLE_TIME 0xffffffff
  93. #define UNINITIALIZED_TRANSFER_MODE 0x7fffffff
  94. #define IS_DEFAULT(mode) (!(mode & 0x80000000))
  95. #define GenTransferModeMask(i, mode) {\
  96. ULONG temp=0xffffffff; \
  97. mode |= (temp >> (31-(i)));\
  98. }
  99. //
  100. // mode should not be 0
  101. //
  102. #define GetHighestTransferMode(mode, i) {\
  103. ULONG temp=(mode); \
  104. ASSERT(temp); \
  105. i=0; \
  106. while ( temp) { \
  107. temp = (temp >> 1);\
  108. i++;\
  109. } \
  110. i--; \
  111. }
  112. #define GetHighestDMATransferMode(mode, i) {\
  113. ULONG temp=mode >> 5;\
  114. i=5; \
  115. while ( temp) { \
  116. temp = (temp >> 1); \
  117. i++; \
  118. } \
  119. i--; \
  120. }
  121. #define GetHighestPIOTransferMode(mode, i) { \
  122. ULONG temp = (mode & PIO_SUPPORT); \
  123. i=0; \
  124. temp = temp >> 1; \
  125. while (temp) { \
  126. temp = temp >> 1; \
  127. i++; \
  128. } \
  129. }
  130. #define SetDefaultTiming(timingTable, length) {\
  131. timingTable[0]=PIO_MODE0_CYCLE_TIME; \
  132. timingTable[1]=PIO_MODE1_CYCLE_TIME; \
  133. timingTable[2]=PIO_MODE2_CYCLE_TIME; \
  134. timingTable[3]=PIO_MODE3_CYCLE_TIME; \
  135. timingTable[4]=PIO_MODE4_CYCLE_TIME; \
  136. timingTable[5]=SWDMA_MODE0_CYCLE_TIME; \
  137. timingTable[6]=SWDMA_MODE1_CYCLE_TIME; \
  138. timingTable[7]=SWDMA_MODE2_CYCLE_TIME; \
  139. timingTable[8]=MWDMA_MODE0_CYCLE_TIME; \
  140. timingTable[9]=MWDMA_MODE1_CYCLE_TIME; \
  141. timingTable[10]=MWDMA_MODE2_CYCLE_TIME; \
  142. timingTable[11]=UDMA_MODE0_CYCLE_TIME; \
  143. timingTable[12]=UDMA_MODE1_CYCLE_TIME; \
  144. timingTable[13]=UDMA_MODE2_CYCLE_TIME; \
  145. timingTable[14]=UDMA_MODE3_CYCLE_TIME; \
  146. timingTable[15]=UDMA_MODE4_CYCLE_TIME; \
  147. timingTable[16]=UDMA_MODE5_CYCLE_TIME; \
  148. timingTable[17]=UDMA_MODE6_CYCLE_TIME; \
  149. length = MAX_XFER_MODE; \
  150. }
  151. #endif // ___ideuser_h___