Update contrib.
1 // Copyright (c) 1998-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 // e32test\pccd\t_lfsdrv.cpp
15 // Test the LFS media driver
20 #include <e32base_private.h>
27 const TInt KDriveNumber=8;
29 #define PDD_NAME _L("MEDLFS")
31 LOCAL_D RTest test(_L("T_LFSDRV"));
34 GLDEF_C TInt E32Main()
40 test.Start(_L("Check loader running"));
42 #if !defined (__WINS__)
43 test.Next(_L("Read machine information"));
45 r=HAL::Get(HAL::EMachineUid, muid);
47 if (muid != HAL::EMachineUid_Brutus)
49 test.Printf(_L("Test not supported on this platform"));
55 test.Next(_L("Load ATA Media Driver"));
56 r=User::LoadPhysicalDevice(PDD_NAME);
57 test(r==KErrNone||r==KErrAlreadyExists);
59 #if defined (__WINS__)
60 b.Format(_L("Connect to local drive %d (W)"),KDriveNumber);
62 b.Format(_L("Connect to local drive %d (K)"),KDriveNumber);
65 TBusLocalDrive theDrive;
66 TBool changeFlag=EFalse;
67 test(theDrive.Connect(KDriveNumber,changeFlag)==KErrNone);
69 test.Next(_L("LFS drive: Capabilities"));
70 TLocalDriveCapsV2Buf info;
71 test(theDrive.Caps(info)==KErrNone);
72 TInt diskSize=I64LOW(info().iSize);
73 test.Printf( _L("Check drive size: %d\r\n"),diskSize);
75 test(info().iType==EMediaFlash);
76 test(info().iConnectionBusType==EConnectionBusInternal);
77 test(info().iDriveAtt==(TUint)(KDriveAttLocal|KDriveAttInternal));
78 test(info().iMediaAtt==KMediaAttFormattable);
79 test(info().iFileSystemId==KDriveFileSysLFFS);
81 test.Next(_L("LFS drive: Read"));
83 test(theDrive.Read(0,4,rdBuf)==KErrNone);
84 test.Printf( _L("%x %x %x %x\r\n"),rdBuf[0],rdBuf[1],rdBuf[2],rdBuf[3]);
87 test.Next(_L("Free device"));
88 r=User::FreePhysicalDevice(_L("Media.Lfs"));