idep.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __IDEP_H__
00041 #define __IDEP_H__
00042
00043 #include <dev/ide.h>
00044 #include <fs/typedefs.h>
00045
00046
00047
00048
00049
00050
00051
00052
00053 #define IDE_SUPPORT_CHS 0
00054
00055 #define IDE_BASE_ADDRESS 0xE000
00056 #define IDECS0 0x0000
00057 #define IDECS1 0x0500
00058
00059 #define DATA_WRITE_REG_LOW (IDECS0 + 0x0100)
00060 #define DATA_WRITE_REG_HIGH (IDECS0 + 0x0200)
00061
00062 #define DATA_READ_REG_LOW (IDECS0 + 0x0300)
00063 #define DATA_READ_REG_HIGH (IDECS0 + 0x0400)
00064
00065 #define ERROR_REG (IDECS0 + 1)
00066 #define FEATURE_REG (IDECS0 + 1)
00067 #define SECTOR_COUNT_REG (IDECS0 + 2)
00068 #define SECTOR_REG (IDECS0 + 3)
00069 #define CYLINDER_LOW_REG (IDECS0 + 4)
00070 #define CYLINDER_HIGH_REG (IDECS0 + 5)
00071 #define DISK_HEAD_REG (IDECS0 + 6)
00072 #define COMMAND_REG (IDECS0 + 7)
00073 #define STATUS_REG (IDECS0 + 7)
00074
00075 #define LBA_0_7 (IDECS0 + 3)
00076 #define LBA_8_15 (IDECS0 + 4)
00077 #define LBA_16_23 (IDECS0 + 5)
00078
00079 #define CF_ERROR_REG (IDECS1 + 0)
00080
00081 #define CONTROL_REG (IDECS1 + 6)
00082 #define ALTERNATE_STATUS (IDECS1 + 6)
00083
00084 #define STATUS_BUSY 0x80
00085 #define STATUS_DRIVE_READY 0x40
00086 #define STATUS_DEVIDE_FAULT 0x20
00087 #define STATUS_SEEK_COMPLETE 0x10
00088 #define STATUS_DATA_REQUEST 0x08
00089 #define STATUS_CORRECTED_DATA 0x04
00090 #define STATUS_INDEX 0x02
00091 #define STATUS_ERROR 0x01
00092
00093 #define ERROR_CRC 0x80
00094 #define ERROR_UNC 0x40
00095 #define ERROR_IDN 0x10
00096 #define ERROR_ABT 0x04
00097 #define ERROR_T0N 0x02
00098 #define ERROR_AMN 0x01
00099
00100 #define COMMAND_DEVICE_INFO 0xEC
00101 #define COMMAND_DEVICE_INFO_P 0xA1
00102 #define COMMAND_READ_SECTORS 0x20
00103 #define COMMAND_WRITE_SECTORS 0x30
00104 #define COMMAND_RECALIBRATE 0x10
00105 #define COMMAND_DIAG 0x90
00106
00107 #define SERIAL_SIZE 20
00108 #define REV_SIZE 8
00109 #define MODEL_SIZE 40
00110
00111
00112
00113
00114 #define ATAPI_CMD_READ_CAPACITY 0x25
00115 #define ATAPI_CMD_MODE_SELECT 0x55
00116 #define ATAPI_CMD_MODE_SENSE 0x5A
00117 #define ATAPI_CMD_READ12 0xA8
00118 #define ATAPI_CMD_SET_CD_SPEED 0xBB
00119
00120
00121
00122
00123
00124
00125 typedef struct {
00126 unsigned UnUsed0:1;
00127 unsigned HardSector_O:1;
00128 unsigned SoftSector_O:1;
00129 unsigned MFM_O:1;
00130 unsigned SlowHead_O:1;
00131 unsigned SynchDriveMotor_O:1;
00132 unsigned FixedDevice:1;
00133 unsigned RemoveableDevice:1;
00134 unsigned DiskTransferRate_O:3;
00135 unsigned InaccurateSpeed_O:1;
00136 unsigned DataStrobeOffset_O:1;
00137 unsigned TrackOffsetOption_O:1;
00138 unsigned FormatGapRequired_O:1;
00139 unsigned ATAPI:1;
00140
00141 WORD Cylinders;
00142 WORD UnUsed1;
00143 WORD Heads;
00144 WORD BytesPerTrack_O;
00145 WORD BytesPerSector_O;
00146 WORD SectorsPerTrack;
00147 WORD VendorSpecific[3];
00148 char SerialNumber[SERIAL_SIZE];
00149 WORD BufferType_O;
00150 WORD BufferSizeSectors_O;
00151 WORD ECCBytes;
00152 char FirmwareRevision[REV_SIZE];
00153 char Model[MODEL_SIZE];
00154 BYTE MaxMultipleSectors;
00155 BYTE UnUsed2;
00156 WORD Can32Bit_O;
00157
00158 unsigned CanDMA_O:1;
00159 unsigned UnUsed3:9;
00160 unsigned CanDisableIORDY:1;
00161 unsigned IORDYSupported:1;
00162 unsigned AdvancedTransferMode:1;
00163 unsigned ATA3StandbyTimer:1;
00164 unsigned UnUsed4:2;
00165
00166 WORD UnUsed5;
00167
00168 BYTE UnUsed6;
00169 BYTE PIOTransferSpeed;
00170 BYTE UnUsed7;
00171 BYTE DMATransferSpeed;
00172
00173 unsigned Fields_6C_75_Valid:1;
00174 unsigned Fields_80_8C_Valid:1;
00175 unsigned UnUsed8:14;
00176
00177 WORD Cylinders2;
00178 WORD Heads2;
00179 WORD SectorsPerTrack2;
00180 DWORD Sectors;
00181
00182 BYTE MaxSectorsPerInt;
00183 unsigned MaxSectorsPerIntIsValid:1;
00184 unsigned UnUsed9:7;
00185
00186 DWORD LBASectors;
00187
00188 WORD UnUsed10;
00189
00190 BYTE SupportedDMAModes;
00191 BYTE ActiveDMAModes;
00192
00193 BYTE PIOModesSupported;
00194 BYTE UnUsed11;
00195
00196 WORD DMACycleTime;
00197 WORD RecommendedDMACycleTime;
00198 WORD PIOCycleTime;
00199 WORD IORDYPIOCycleTime;
00200
00201 WORD Reserved1[2];
00202 WORD Reserved2[4];
00203
00204 WORD QueueDepth;
00205
00206 WORD Reserved3[4];
00207
00208 WORD ATAVersionMajor;
00209 WORD ATAVersionMinor;
00210
00211 WORD CommandSetSupported[2];
00212 WORD CommandSetSupportedExtension;
00213 WORD CommandSetEnabled[2];
00214 WORD CommandSetDefault;
00215
00216 WORD UltraDMAMode;
00217
00218 WORD SecurityStatus[2];
00219
00220 WORD AdvancedPowerManagement;
00221 WORD MasterPasswordRevisionCode;
00222
00223 WORD HardwareResetResult;
00224
00225 WORD AcousticManagementValue;
00226
00227 WORD Reserved4[5];
00228
00229 WORD MaximumUserLBA48[4];
00230
00231 WORD Reserved5[23];
00232
00233 } IDEDEVICEINFO;
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 #endif