author | Mike Kinghan <mikek@symbian.org> |
Thu, 25 Nov 2010 14:35:45 +0000 | |
branch | GCC_SURGE |
changeset 305 | 1ba12ef4ef89 |
parent 33 | 0173bcd7697c |
permissions | -rw-r--r-- |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32test\pccd\t_lfsdrv.cpp |
|
15 |
// Test the LFS media driver |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
#include <e32base.h> |
|
20 |
#include <e32base_private.h> |
|
21 |
#include <e32test.h> |
|
22 |
#include <e32svr.h> |
|
23 |
#include <e32hal.h> |
|
24 |
#include <e32uid.h> |
|
25 |
#include <hal.h> |
|
26 |
||
27 |
const TInt KDriveNumber=8; |
|
28 |
||
29 |
#define PDD_NAME _L("MEDLFS") |
|
30 |
||
31 |
LOCAL_D RTest test(_L("T_LFSDRV")); |
|
32 |
||
33 |
||
34 |
GLDEF_C TInt E32Main() |
|
35 |
{ |
|
36 |
TBuf<64> b; |
|
37 |
TInt r; |
|
38 |
||
39 |
test.Title(); |
|
40 |
test.Start(_L("Check loader running")); |
|
41 |
||
42 |
#if !defined (__WINS__) |
|
43 |
test.Next(_L("Read machine information")); |
|
44 |
TInt muid; |
|
45 |
r=HAL::Get(HAL::EMachineUid, muid); |
|
46 |
test(r==KErrNone); |
|
47 |
if (muid != HAL::EMachineUid_Brutus) |
|
48 |
{ |
|
49 |
test.Printf(_L("Test not supported on this platform")); |
|
50 |
test.End(); |
|
51 |
return(0); |
|
52 |
} |
|
53 |
#endif |
|
54 |
||
55 |
test.Next(_L("Load ATA Media Driver")); |
|
56 |
r=User::LoadPhysicalDevice(PDD_NAME); |
|
57 |
test(r==KErrNone||r==KErrAlreadyExists); |
|
58 |
||
59 |
#if defined (__WINS__) |
|
60 |
b.Format(_L("Connect to local drive %d (W)"),KDriveNumber); |
|
61 |
#else |
|
62 |
b.Format(_L("Connect to local drive %d (K)"),KDriveNumber); |
|
63 |
#endif |
|
64 |
test.Next(b); |
|
65 |
TBusLocalDrive theDrive; |
|
66 |
TBool changeFlag=EFalse; |
|
67 |
test(theDrive.Connect(KDriveNumber,changeFlag)==KErrNone); |
|
68 |
||
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); |
|
74 |
// test.Getch(); |
|
75 |
test(info().iType==EMediaFlash); |
|
33
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
test(info().iConnectionBusType==EConnectionBusInternal); |
0 | 77 |
test(info().iDriveAtt==(TUint)(KDriveAttLocal|KDriveAttInternal)); |
78 |
test(info().iMediaAtt==KMediaAttFormattable); |
|
79 |
test(info().iFileSystemId==KDriveFileSysLFFS); |
|
80 |
||
81 |
test.Next(_L("LFS drive: Read")); |
|
82 |
TBuf8<0x10> rdBuf; |
|
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]); |
|
85 |
// test.Getch(); |
|
86 |
||
87 |
test.Next(_L("Free device")); |
|
88 |
r=User::FreePhysicalDevice(_L("Media.Lfs")); |
|
89 |
test(r==KErrNone); |
|
90 |
||
91 |
test.End(); |
|
92 |
return(0); |
|
93 |
} |
|
94 |