Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenide.h
Go to the documentation of this file.
00001 /* 00002 * ide.h 00003 * 00004 * IDE driver interface 00005 * 00006 * This file is part of the w32api package. 00007 * 00008 * Contributors: 00009 * Created by Hervé Poussineau <hpoussin@reactos.org> 00010 * 00011 * THIS SOFTWARE IS NOT COPYRIGHTED 00012 * 00013 * This source code is offered for use in the public domain. You may 00014 * use, modify or distribute it freely. 00015 * 00016 * This code is distributed in the hope that it will be useful but 00017 * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY 00018 * DISCLAIMED. This includes but is not limited to warranties of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00020 * 00021 */ 00022 00023 #ifndef __IDE_H 00024 #define __IDE_H 00025 00026 #ifdef __cplusplus 00027 extern "C" { 00028 #endif 00029 00030 #define MAX_IDE_CHANNEL 2 00031 #define MAX_IDE_LINE 2 00032 #define MAX_IDE_DEVICE 2 00033 00034 #include <pshpack1.h> 00035 typedef struct _IDENTIFY_DATA { 00036 USHORT GeneralConfiguration; /* 00 */ 00037 USHORT NumCylinders; /* 02 */ 00038 USHORT Reserved1; /* 04 */ 00039 USHORT NumHeads; /* 06 */ 00040 USHORT UnformattedBytesPerTrack; /* 08 */ 00041 USHORT UnformattedBytesPerSector; /* 10 */ 00042 USHORT NumSectorsPerTrack; /* 12 */ 00043 USHORT VendorUnique1[3]; /* 14 */ 00044 UCHAR SerialNumber[20]; /* 20 */ 00045 USHORT BufferType; /* 40 */ 00046 USHORT BufferSectorSize; /* 42 */ 00047 USHORT NumberOfEccBytes; /* 44 */ 00048 UCHAR FirmwareRevision[8]; /* 46 */ 00049 UCHAR ModelNumber[40]; /* 54 */ 00050 UCHAR MaximumBlockTransfer; /* 94 */ 00051 UCHAR VendorUnique2; /* 95 */ 00052 USHORT DoubleWordIo; /* 96 */ 00053 USHORT Capabilities; /* 98 */ 00054 USHORT Reserved2; /* 100 */ 00055 UCHAR VendorUnique3; /* 102 */ 00056 UCHAR PioCycleTimingMode; /* 103 */ 00057 UCHAR VendorUnique4; /* 104 */ 00058 UCHAR DmaCycleTimingMode; /* 105 */ 00059 USHORT TranslationFieldsValid:3; /* 106 */ 00060 USHORT Reserved3:13; /* - */ 00061 USHORT NumberOfCurrentCylinders; /* 108 */ 00062 USHORT NumberOfCurrentHeads; /* 110 */ 00063 USHORT CurrentSectorsPerTrack; /* 112 */ 00064 ULONG CurrentSectorCapacity; /* 114 */ 00065 USHORT CurrentMultiSectorSetting; /* 118 */ 00066 ULONG UserAddressableSectors; /* 120 */ 00067 USHORT SingleWordDMASupport:8; /* 124 */ 00068 USHORT SingleWordDMAActive:8; /* - */ 00069 USHORT MultiWordDMASupport:8; /* 126 */ 00070 USHORT MultiWordDMAActive:8; /* - */ 00071 USHORT AdvancedPIOModes:8; /* 128 */ 00072 USHORT Reserved4:8; /* - */ 00073 USHORT MinimumMWXferCycleTime; /* 130 */ 00074 USHORT RecommendedMWXferCycleTime; /* 132 */ 00075 USHORT MinimumPIOCycleTime; /* 134 */ 00076 USHORT MinimumPIOCycleTimeIORDY; /* 136 */ 00077 USHORT Reserved5[11]; /* 138 */ 00078 USHORT MajorRevision; /* 160 */ 00079 USHORT MinorRevision; /* 162 */ 00080 USHORT Reserved6; /* 164 */ 00081 USHORT CommandSetSupport; /* 166 */ 00082 USHORT Reserved6a[2]; /* 168 */ 00083 USHORT CommandSetActive; /* 172 */ 00084 USHORT Reserved6b; /* 174 */ 00085 USHORT UltraDMASupport:8; /* 176 */ 00086 USHORT UltraDMAActive:8; /* - */ 00087 USHORT Reserved7[11]; /* 178 */ 00088 ULONG Max48BitLBA[2]; /* 200 */ 00089 USHORT Reserved7a[22]; /* 208 */ 00090 USHORT LastLun:3; /* 252 */ 00091 USHORT Reserved8:13; /* - */ 00092 USHORT MediaStatusNotification:2; /* 254 */ 00093 USHORT Reserved9:6; /* - */ 00094 USHORT DeviceWriteProtect:1; /* - */ 00095 USHORT Reserved10:7; /* - */ 00096 USHORT Reserved11[128]; /* 256 */ 00097 } IDENTIFY_DATA, *PIDENTIFY_DATA; 00098 00099 typedef struct _EXTENDED_IDENTIFY_DATA { 00100 USHORT GeneralConfiguration; /* 00 */ 00101 USHORT NumCylinders; /* 02 */ 00102 USHORT Reserved1; /* 04 */ 00103 USHORT NumHeads; /* 06 */ 00104 USHORT UnformattedBytesPerTrack; /* 08 */ 00105 USHORT UnformattedBytesPerSector; /* 10 */ 00106 USHORT NumSectorsPerTrack; /* 12 */ 00107 __GNU_EXTENSION union 00108 { 00109 USHORT VendorUnique1[3]; /* 14 */ 00110 struct 00111 { 00112 UCHAR InterSectorGap; /* 14 */ 00113 UCHAR InterSectorGapSize; /* - */ 00114 UCHAR Reserved16; /* 16 */ 00115 UCHAR BytesInPLO; /* - */ 00116 USHORT VendorUniqueCnt; /* 18 */ 00117 } u; 00118 }; 00119 UCHAR SerialNumber[20]; /* 20 */ 00120 USHORT BufferType; /* 40 */ 00121 USHORT BufferSectorSize; /* 42 */ 00122 USHORT NumberOfEccBytes; /* 44 */ 00123 UCHAR FirmwareRevision[8]; /* 46 */ 00124 UCHAR ModelNumber[40]; /* 54 */ 00125 UCHAR MaximumBlockTransfer; /* 94 */ 00126 UCHAR VendorUnique2; /* 95 */ 00127 USHORT DoubleWordIo; /* 96 */ 00128 USHORT Capabilities; /* 98 */ 00129 USHORT Reserved2; /* 100 */ 00130 UCHAR VendorUnique3; /* 102 */ 00131 UCHAR PioCycleTimingMode; /* 103 */ 00132 UCHAR VendorUnique4; /* 104 */ 00133 UCHAR DmaCycleTimingMode; /* 105 */ 00134 USHORT TranslationFieldsValid:3; /* 106 */ 00135 USHORT Reserved3:13; /* - */ 00136 USHORT NumberOfCurrentCylinders; /* 108 */ 00137 USHORT NumberOfCurrentHeads; /* 110 */ 00138 USHORT CurrentSectorsPerTrack; /* 112 */ 00139 ULONG CurrentSectorCapacity; /* 114 */ 00140 USHORT CurrentMultiSectorSetting; /* 118 */ 00141 ULONG UserAddressableSectors; /* 120 */ 00142 USHORT SingleWordDMASupport:8; /* 124 */ 00143 USHORT SingleWordDMAActive:8; /* - */ 00144 USHORT MultiWordDMASupport:8; /* 126 */ 00145 USHORT MultiWordDMAActive:8; /* - */ 00146 USHORT AdvancedPIOModes:8; /* 128 */ 00147 USHORT Reserved4:8; /* - */ 00148 USHORT MinimumMWXferCycleTime; /* 130 */ 00149 USHORT RecommendedMWXferCycleTime; /* 132 */ 00150 USHORT MinimumPIOCycleTime; /* 134 */ 00151 USHORT MinimumPIOCycleTimeIORDY; /* 136 */ 00152 USHORT Reserved5[11]; /* 138 */ 00153 USHORT MajorRevision; /* 160 */ 00154 USHORT MinorRevision; /* 162 */ 00155 USHORT Reserved6; /* 164 */ 00156 USHORT CommandSetSupport; /* 166 */ 00157 USHORT Reserved6a[2]; /* 168 */ 00158 USHORT CommandSetActive; /* 172 */ 00159 USHORT Reserved6b; /* 174 */ 00160 USHORT UltraDMASupport:8; /* 176 */ 00161 USHORT UltraDMAActive:8; /* - */ 00162 USHORT Reserved7[11]; /* 178 */ 00163 ULONG Max48BitLBA[2]; /* 200 */ 00164 USHORT Reserved7a[22]; /* 208 */ 00165 USHORT LastLun:3; /* 252 */ 00166 USHORT Reserved8:13; /* - */ 00167 USHORT MediaStatusNotification:2; /* 254 */ 00168 USHORT Reserved9:6; /* - */ 00169 USHORT DeviceWriteProtect:1; /* - */ 00170 USHORT Reserved10:7; /* - */ 00171 USHORT Reserved11[128]; /* 256 */ 00172 } EXTENDED_IDENTIFY_DATA, *PEXTENDED_IDENTIFY_DATA; 00173 #include <poppack.h> 00174 00175 typedef struct _PCIIDE_TRANSFER_MODE_SELECT 00176 { 00177 ULONG Channel; 00178 BOOLEAN DevicePresent[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00179 BOOLEAN FixedDisk[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00180 BOOLEAN IoReadySupported[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00181 ULONG DeviceTransferModeSupported[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00182 ULONG BestPioCycleTime[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00183 ULONG BestSwDmaCycleTime[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00184 ULONG BestMwDmaCycleTime[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00185 ULONG BestUDmaCycleTime[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00186 ULONG DeviceTransferModeCurrent[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00187 ULONG UserChoiceTransferMode[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00188 ULONG EnableUDMA66; 00189 IDENTIFY_DATA IdentifyData[MAX_IDE_DEVICE]; 00190 ULONG DeviceTransferModeSelected[MAX_IDE_DEVICE * MAX_IDE_LINE]; 00191 PULONG TransferModeTimingTable; 00192 ULONG TransferModeTableLength; 00193 } PCIIDE_TRANSFER_MODE_SELECT, *PPCIIDE_TRANSFER_MODE_SELECT; 00194 00195 typedef enum 00196 { 00197 ChannelDisabled = 0, 00198 ChannelEnabled, 00199 ChannelStateUnknown 00200 } IDE_CHANNEL_STATE; 00201 00202 typedef IDE_CHANNEL_STATE 00203 (NTAPI *PCIIDE_CHANNEL_ENABLED)( 00204 IN PVOID DeviceExtension, 00205 IN ULONG Channel); 00206 00207 typedef BOOLEAN 00208 (NTAPI *PCIIDE_SYNC_ACCESS_REQUIRED)( 00209 IN PVOID DeviceExtension); 00210 00211 typedef NTSTATUS 00212 (NTAPI *PCIIDE_TRANSFER_MODE_SELECT_FUNC)( 00213 IN PVOID DeviceExtension, 00214 IN OUT PPCIIDE_TRANSFER_MODE_SELECT XferMode); 00215 00216 typedef ULONG 00217 (NTAPI *PCIIDE_USEDMA_FUNC)( 00218 IN PVOID DeviceExtension, 00219 IN PUCHAR CdbCommand, 00220 IN PUCHAR Slave); 00221 00222 typedef NTSTATUS 00223 (NTAPI *PCIIDE_UDMA_MODES_SUPPORTED)( 00224 IN IDENTIFY_DATA IdentifyData, 00225 OUT PULONG BestXferMode, 00226 OUT PULONG CurrentXferMode); 00227 00228 typedef struct _IDE_CONTROLLER_PROPERTIES 00229 { 00230 ULONG Size; 00231 ULONG ExtensionSize; 00232 ULONG SupportedTransferMode[MAX_IDE_CHANNEL][MAX_IDE_DEVICE]; 00233 PCIIDE_CHANNEL_ENABLED PciIdeChannelEnabled; 00234 PCIIDE_SYNC_ACCESS_REQUIRED PciIdeSyncAccessRequired; 00235 PCIIDE_TRANSFER_MODE_SELECT_FUNC PciIdeTransferModeSelect; 00236 BOOLEAN IgnoreActiveBitForAtaDevice; 00237 BOOLEAN AlwaysClearBusMasterInterrupt; 00238 PCIIDE_USEDMA_FUNC PciIdeUseDma; 00239 ULONG AlignmentRequirement; 00240 ULONG DefaultPIO; 00241 PCIIDE_UDMA_MODES_SUPPORTED PciIdeUdmaModesSupported; 00242 } IDE_CONTROLLER_PROPERTIES, *PIDE_CONTROLLER_PROPERTIES; 00243 00244 typedef NTSTATUS 00245 (NTAPI *PCONTROLLER_PROPERTIES)( 00246 IN PVOID DeviceExtension, 00247 IN PIDE_CONTROLLER_PROPERTIES ControllerProperties); 00248 00249 NTSTATUS NTAPI 00250 PciIdeXInitialize( 00251 IN PDRIVER_OBJECT DriverObject, 00252 IN PUNICODE_STRING RegistryPath, 00253 IN PCONTROLLER_PROPERTIES HwGetControllerProperties, 00254 IN ULONG ExtensionSize); 00255 00256 NTSTATUS NTAPI 00257 PciIdeXGetBusData( 00258 IN PVOID DeviceExtension, 00259 IN PVOID Buffer, 00260 IN ULONG ConfigDataOffset, 00261 IN ULONG BufferLength); 00262 00263 NTSTATUS NTAPI 00264 PciIdeXSetBusData( 00265 IN PVOID DeviceExtension, 00266 IN PVOID Buffer, 00267 IN PVOID DataMask, 00268 IN ULONG ConfigDataOffset, 00269 IN ULONG BufferLength); 00270 00271 /* Bit field values for 00272 * PCIIDE_TRANSFER_MODE_SELECT.DeviceTransferModeSupported and 00273 * IDE_CONTROLLER_PROPERTIES.SupportedTransferMode 00274 */ 00275 // PIO Modes 00276 #define PIO_MODE0 (1 << 0) 00277 #define PIO_MODE1 (1 << 1) 00278 #define PIO_MODE2 (1 << 2) 00279 #define PIO_MODE3 (1 << 3) 00280 #define PIO_MODE4 (1 << 4) 00281 // Single-word DMA Modes 00282 #define SWDMA_MODE0 (1 << 5) 00283 #define SWDMA_MODE1 (1 << 6) 00284 #define SWDMA_MODE2 (1 << 7) 00285 // Multi-word DMA Modes 00286 #define MWDMA_MODE0 (1 << 8) 00287 #define MWDMA_MODE1 (1 << 9) 00288 #define MWDMA_MODE2 (1 << 10) 00289 // Ultra DMA Modes 00290 #define UDMA_MODE0 (1 << 11) 00291 #define UDMA_MODE1 (1 << 12) 00292 #define UDMA_MODE2 (1 << 13) 00293 #define UDMA_MODE3 (1 << 14) 00294 #define UDMA_MODE4 (1 << 15) 00295 #define UDMA_MODE5 (1 << 16) 00296 00297 #ifdef __cplusplus 00298 } 00299 #endif 00300 00301 #endif /* __IDE_H */ Generated on Thu May 24 2012 04:29:02 for ReactOS by
1.7.6.1
|