sl@0: // Copyright (c) 1998-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: // e32test\pccd\t_lfsdrv.cpp sl@0: // Test the LFS media driver sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: const TInt KDriveNumber=8; sl@0: sl@0: #define PDD_NAME _L("MEDLFS") sl@0: sl@0: LOCAL_D RTest test(_L("T_LFSDRV")); sl@0: sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: TBuf<64> b; sl@0: TInt r; sl@0: sl@0: test.Title(); sl@0: test.Start(_L("Check loader running")); sl@0: sl@0: #if !defined (__WINS__) sl@0: test.Next(_L("Read machine information")); sl@0: TInt muid; sl@0: r=HAL::Get(HAL::EMachineUid, muid); sl@0: test(r==KErrNone); sl@0: if (muid != HAL::EMachineUid_Brutus) sl@0: { sl@0: test.Printf(_L("Test not supported on this platform")); sl@0: test.End(); sl@0: return(0); sl@0: } sl@0: #endif sl@0: sl@0: test.Next(_L("Load ATA Media Driver")); sl@0: r=User::LoadPhysicalDevice(PDD_NAME); sl@0: test(r==KErrNone||r==KErrAlreadyExists); sl@0: sl@0: #if defined (__WINS__) sl@0: b.Format(_L("Connect to local drive %d (W)"),KDriveNumber); sl@0: #else sl@0: b.Format(_L("Connect to local drive %d (K)"),KDriveNumber); sl@0: #endif sl@0: test.Next(b); sl@0: TBusLocalDrive theDrive; sl@0: TBool changeFlag=EFalse; sl@0: test(theDrive.Connect(KDriveNumber,changeFlag)==KErrNone); sl@0: sl@0: test.Next(_L("LFS drive: Capabilities")); sl@0: TLocalDriveCapsV2Buf info; sl@0: test(theDrive.Caps(info)==KErrNone); sl@0: TInt diskSize=I64LOW(info().iSize); sl@0: test.Printf( _L("Check drive size: %d\r\n"),diskSize); sl@0: // test.Getch(); sl@0: test(info().iType==EMediaFlash); sl@0: test(info().iConnectionBusType==EConnectionBusInternal); sl@0: test(info().iDriveAtt==(TUint)(KDriveAttLocal|KDriveAttInternal)); sl@0: test(info().iMediaAtt==KMediaAttFormattable); sl@0: test(info().iFileSystemId==KDriveFileSysLFFS); sl@0: sl@0: test.Next(_L("LFS drive: Read")); sl@0: TBuf8<0x10> rdBuf; sl@0: test(theDrive.Read(0,4,rdBuf)==KErrNone); sl@0: test.Printf( _L("%x %x %x %x\r\n"),rdBuf[0],rdBuf[1],rdBuf[2],rdBuf[3]); sl@0: // test.Getch(); sl@0: sl@0: test.Next(_L("Free device")); sl@0: r=User::FreePhysicalDevice(_L("Media.Lfs")); sl@0: test(r==KErrNone); sl@0: sl@0: test.End(); sl@0: return(0); sl@0: } sl@0: