sl@0: // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32\drivers\medata\ata.h sl@0: // sl@0: // sl@0: sl@0: #include sl@0: sl@0: #if defined (SELECT_PRIMARY_IO_CONFIG) sl@0: // sl@0: // ATA Register addresses (for primary) sl@0: // sl@0: const TUint KAtaDataRdWr16=0x000001F0; sl@0: const TUint KAtaDataRdWr8=0x000001F0; sl@0: sl@0: const TUint KAtaErrorRd8=0x000001F1; sl@0: const TUint KAtaFeaturesWr8=0x000001F1; sl@0: sl@0: const TUint KAtaSectorCountRdWr8=0x000001F2; sl@0: sl@0: const TUint KAtaSectorNoRdWr8=0x000001F3; sl@0: const TUint KAtaLba7_0RdWr8=0x000001F3; sl@0: sl@0: const TUint KAtaCylinderLowRdWr8=0x000001F4; sl@0: const TUint KAtaLba15_8RdWr8=0x000001F4; sl@0: sl@0: const TUint KAtaCylinderHighRdWr8=0x000001F5; sl@0: const TUint KAtaLba23_16RdWr8=0x000001F5; sl@0: sl@0: const TUint KAtaSelectDriveHeadRdWr8=0x000001F6; sl@0: const TUint KAtaDriveLba27_24RdWr8=0x000001F6; sl@0: sl@0: const TUint KAtaStatusRd8=0x000001F7; sl@0: const TUint KAtaCommandWr8=0x000001F7; sl@0: sl@0: #else sl@0: // sl@0: // ATA Register addresses (for either contiguous I/O or memory mapped) sl@0: // sl@0: const TUint KAtaDataRdWr16=0x00000000; sl@0: const TUint KAtaDataRdWr8=0x00000000; sl@0: const TUint KAtaDataRdWrWinBase16=0x00000400; // Memory mapped only sl@0: const TUint KAtaDataRdWrWinBase8=0x00000400; // Memory mapped only sl@0: sl@0: const TUint KAtaErrorRd8=0x00000001; sl@0: const TUint KAtaFeaturesWr8=0x00000001; sl@0: sl@0: const TUint KAtaSectorCountRdWr8=0x00000002; sl@0: sl@0: const TUint KAtaSectorNoRdWr8=0x00000003; sl@0: const TUint KAtaLba7_0RdWr8=0x00000003; sl@0: sl@0: const TUint KAtaCylinderLowRdWr8=0x00000004; sl@0: const TUint KAtaLba15_8RdWr8=0x00000004; sl@0: sl@0: const TUint KAtaCylinderHighRdWr8=0x00000005; sl@0: const TUint KAtaLba23_16RdWr8=0x00000005; sl@0: sl@0: const TUint KAtaSelectDriveHeadRdWr8=0x00000006; sl@0: const TUint KAtaDriveLba27_24RdWr8=0x00000006; sl@0: sl@0: const TUint KAtaStatusRd8=0x00000007; sl@0: const TUint KAtaCommandWr8=0x00000007; sl@0: #endif sl@0: sl@0: // sl@0: // ATA Register addresses (for contiguous I/O or memory mapped) sl@0: // sl@0: const TUint KAtaDupEvenDataRdWr8=0x00000008; sl@0: const TUint KAtaDupOddDataRdWr8=0x00000009; sl@0: const TUint KAtaDupErrorRd8=0x0000000D; sl@0: const TUint KAtaDupFeaturesWr8=0x0000000D; sl@0: const TUint KAtaAltStatusRd8=0x0000000E; sl@0: const TUint KAtaDeviceCtlWr8=0x0000000E; sl@0: const TUint KAtaDriveAddressRd8=0x0000000F; sl@0: sl@0: // sl@0: // ATA Register bit fields sl@0: // sl@0: // KAtaErrorRd8 sl@0: const TUint8 KAtaErrorAmnf=0x01; sl@0: const TUint8 KAtaErrorAbort=0x04; sl@0: const TUint8 KAtaErrorIdnf=0x10; sl@0: const TUint8 KAtaErrorUnc=0x40; sl@0: const TUint8 KAtaErrorBbk=0x80; sl@0: sl@0: // KAtaSelectDriveHeadRdWr8 sl@0: // KAtaDriveLba27_24RdWr8 sl@0: const TUint8 KAtaDrvHeadLba27_24=0x0F; sl@0: const TUint8 KAtaDrvHeadDrive1=0x10; sl@0: const TUint8 KAtaDrvHeadLbaOn=0x40; sl@0: sl@0: // KAtaStatusRd8 sl@0: const TUint8 KAtaStatusErr=0x01; sl@0: const TUint8 KAtaStatusCorr=0x04; sl@0: const TUint8 KAtaStatusDrq=0x08; sl@0: const TUint8 KAtaStatusDsc=0x10; sl@0: const TUint8 KAtaStatusDwf=0x20; sl@0: const TUint8 KAtaStatusRdy=0x40; sl@0: const TUint8 KAtaStatusBusy=0x80; sl@0: sl@0: // KAtaDeviceCtlWr8 sl@0: const TUint8 KAtaDeviceCtlIntDis=0x02; sl@0: const TUint8 KAtaDeviceCtlSwRes=0x04; sl@0: sl@0: // sl@0: // ATA commands sl@0: // sl@0: const TUint8 KAtaCmdIdentifyDrive=0xEC; sl@0: const TUint8 KAtaCmdReadSectors=0x20; sl@0: const TUint8 KAtaCmdWriteSectors=0x30; sl@0: const TUint8 KAtaCmdSetFeatures=0xEF; sl@0: const TUint8 KAtaCmdRequestSense=0x03; sl@0: const TUint8 KAtaCmdFormatTrack=0x50; sl@0: const TUint8 KAtaCmdIdle=0xE3; sl@0: sl@0: // sl@0: // Defines for Identify Drive Command sl@0: // sl@0: const TInt KAtaIdDefaultCylinders=2; // Offset in bytes sl@0: const TInt KAtaIdDefaultHeads=6; sl@0: const TInt KAtaIdDefaultSectorsPerTrack=12; sl@0: const TInt KAtaIdCapabilities=98; sl@0: const TUint16 KAtaIdCapLbaSupported=0x0200; sl@0: const TInt KAtaIdTranslationParams=106; sl@0: const TUint16 KAtaIdTrParamsValid=0x0001; sl@0: const TInt KAtaIdCurrentCylinders=108; sl@0: const TInt KAtaIdCurrentHeads=110; sl@0: const TInt KAtaIdCurrentSectorsPerTrack=112; sl@0: const TInt KAtaIdCurrentTotalSectors=114; sl@0: const TInt KAtaIdTotalSectorsInLba=120; sl@0: sl@0: // sl@0: // Drive parameters sl@0: // sl@0: class TDriveParameters sl@0: { sl@0: public: sl@0: TInt iCylinders; sl@0: TInt iHeads; sl@0: TInt iSectorsPerTrack; sl@0: TInt iSectorsPerCylinder; sl@0: TBool iSupportsLba; sl@0: TInt iTotalSectorsInLba; sl@0: }; sl@0: sl@0: const TInt KAtaSectorSize=512; sl@0: const TInt KAtaSectorSizeMinusOne=(KAtaSectorSize-1); sl@0: const TInt KAtaSectorShift=9; sl@0: const TUint KAtaSectorMask=0xFFFFFE00; sl@0: sl@0: const TInt KMaxSectorsPerCmd=256; // Maximum sectors that can be transfered in single command sl@0: sl@0: enum TAtaDriveSelect sl@0: { sl@0: ESelectDrive1=KAtaDrvHeadDrive1, sl@0: ESelectDrive0=0x00 sl@0: }; sl@0: