Update contrib.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\drivers\medata\ata.h
18 #include <partitions.h>
20 #if defined (SELECT_PRIMARY_IO_CONFIG)
22 // ATA Register addresses (for primary)
24 const TUint KAtaDataRdWr16=0x000001F0;
25 const TUint KAtaDataRdWr8=0x000001F0;
27 const TUint KAtaErrorRd8=0x000001F1;
28 const TUint KAtaFeaturesWr8=0x000001F1;
30 const TUint KAtaSectorCountRdWr8=0x000001F2;
32 const TUint KAtaSectorNoRdWr8=0x000001F3;
33 const TUint KAtaLba7_0RdWr8=0x000001F3;
35 const TUint KAtaCylinderLowRdWr8=0x000001F4;
36 const TUint KAtaLba15_8RdWr8=0x000001F4;
38 const TUint KAtaCylinderHighRdWr8=0x000001F5;
39 const TUint KAtaLba23_16RdWr8=0x000001F5;
41 const TUint KAtaSelectDriveHeadRdWr8=0x000001F6;
42 const TUint KAtaDriveLba27_24RdWr8=0x000001F6;
44 const TUint KAtaStatusRd8=0x000001F7;
45 const TUint KAtaCommandWr8=0x000001F7;
49 // ATA Register addresses (for either contiguous I/O or memory mapped)
51 const TUint KAtaDataRdWr16=0x00000000;
52 const TUint KAtaDataRdWr8=0x00000000;
53 const TUint KAtaDataRdWrWinBase16=0x00000400; // Memory mapped only
54 const TUint KAtaDataRdWrWinBase8=0x00000400; // Memory mapped only
56 const TUint KAtaErrorRd8=0x00000001;
57 const TUint KAtaFeaturesWr8=0x00000001;
59 const TUint KAtaSectorCountRdWr8=0x00000002;
61 const TUint KAtaSectorNoRdWr8=0x00000003;
62 const TUint KAtaLba7_0RdWr8=0x00000003;
64 const TUint KAtaCylinderLowRdWr8=0x00000004;
65 const TUint KAtaLba15_8RdWr8=0x00000004;
67 const TUint KAtaCylinderHighRdWr8=0x00000005;
68 const TUint KAtaLba23_16RdWr8=0x00000005;
70 const TUint KAtaSelectDriveHeadRdWr8=0x00000006;
71 const TUint KAtaDriveLba27_24RdWr8=0x00000006;
73 const TUint KAtaStatusRd8=0x00000007;
74 const TUint KAtaCommandWr8=0x00000007;
78 // ATA Register addresses (for contiguous I/O or memory mapped)
80 const TUint KAtaDupEvenDataRdWr8=0x00000008;
81 const TUint KAtaDupOddDataRdWr8=0x00000009;
82 const TUint KAtaDupErrorRd8=0x0000000D;
83 const TUint KAtaDupFeaturesWr8=0x0000000D;
84 const TUint KAtaAltStatusRd8=0x0000000E;
85 const TUint KAtaDeviceCtlWr8=0x0000000E;
86 const TUint KAtaDriveAddressRd8=0x0000000F;
89 // ATA Register bit fields
92 const TUint8 KAtaErrorAmnf=0x01;
93 const TUint8 KAtaErrorAbort=0x04;
94 const TUint8 KAtaErrorIdnf=0x10;
95 const TUint8 KAtaErrorUnc=0x40;
96 const TUint8 KAtaErrorBbk=0x80;
98 // KAtaSelectDriveHeadRdWr8
99 // KAtaDriveLba27_24RdWr8
100 const TUint8 KAtaDrvHeadLba27_24=0x0F;
101 const TUint8 KAtaDrvHeadDrive1=0x10;
102 const TUint8 KAtaDrvHeadLbaOn=0x40;
105 const TUint8 KAtaStatusErr=0x01;
106 const TUint8 KAtaStatusCorr=0x04;
107 const TUint8 KAtaStatusDrq=0x08;
108 const TUint8 KAtaStatusDsc=0x10;
109 const TUint8 KAtaStatusDwf=0x20;
110 const TUint8 KAtaStatusRdy=0x40;
111 const TUint8 KAtaStatusBusy=0x80;
114 const TUint8 KAtaDeviceCtlIntDis=0x02;
115 const TUint8 KAtaDeviceCtlSwRes=0x04;
120 const TUint8 KAtaCmdIdentifyDrive=0xEC;
121 const TUint8 KAtaCmdReadSectors=0x20;
122 const TUint8 KAtaCmdWriteSectors=0x30;
123 const TUint8 KAtaCmdSetFeatures=0xEF;
124 const TUint8 KAtaCmdRequestSense=0x03;
125 const TUint8 KAtaCmdFormatTrack=0x50;
126 const TUint8 KAtaCmdIdle=0xE3;
129 // Defines for Identify Drive Command
131 const TInt KAtaIdDefaultCylinders=2; // Offset in bytes
132 const TInt KAtaIdDefaultHeads=6;
133 const TInt KAtaIdDefaultSectorsPerTrack=12;
134 const TInt KAtaIdCapabilities=98;
135 const TUint16 KAtaIdCapLbaSupported=0x0200;
136 const TInt KAtaIdTranslationParams=106;
137 const TUint16 KAtaIdTrParamsValid=0x0001;
138 const TInt KAtaIdCurrentCylinders=108;
139 const TInt KAtaIdCurrentHeads=110;
140 const TInt KAtaIdCurrentSectorsPerTrack=112;
141 const TInt KAtaIdCurrentTotalSectors=114;
142 const TInt KAtaIdTotalSectorsInLba=120;
147 class TDriveParameters
152 TInt iSectorsPerTrack;
153 TInt iSectorsPerCylinder;
155 TInt iTotalSectorsInLba;
158 const TInt KAtaSectorSize=512;
159 const TInt KAtaSectorSizeMinusOne=(KAtaSectorSize-1);
160 const TInt KAtaSectorShift=9;
161 const TUint KAtaSectorMask=0xFFFFFE00;
163 const TInt KMaxSectorsPerCmd=256; // Maximum sectors that can be transfered in single command
167 ESelectDrive1=KAtaDrvHeadDrive1,