279
|
1 |
// Copyright (c) 2010 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_mmcinfo.cpp
|
|
15 |
// Display MMC Card register contents
|
|
16 |
//
|
|
17 |
//
|
|
18 |
|
|
19 |
#define __E32TEST_EXTENSION__
|
|
20 |
#include <e32test.h>
|
|
21 |
#include "d_mmctest.h"
|
|
22 |
|
|
23 |
LOCAL_D RTest test(_L("MMC INFO TEST"));
|
|
24 |
|
|
25 |
RMmcCntrlIf iDriver;
|
|
26 |
TInt iStack;
|
|
27 |
TInt iCard;
|
|
28 |
|
|
29 |
GLDEF_C TInt E32Main()
|
|
30 |
/**
|
|
31 |
* Test Entry Point for T_MMCINFO.
|
|
32 |
*
|
|
33 |
* This test uses the associated driver (D_mmctest)
|
|
34 |
* to gain access to the mmc stack configuration data
|
|
35 |
*/
|
|
36 |
{
|
|
37 |
test.Title();
|
|
38 |
|
|
39 |
test.Start(_L("Load D_MMCTEST Driver"));
|
|
40 |
TInt r;
|
|
41 |
r=User::LoadLogicalDevice(_L("D_MMCTEST"));
|
|
42 |
if(r==KErrNotFound)
|
|
43 |
{
|
|
44 |
test.Printf(_L("Test Driver not present on this platform \n"));
|
|
45 |
test.End();
|
|
46 |
return(0);
|
|
47 |
}
|
|
48 |
test(r==KErrNone || r==KErrAlreadyExists);
|
|
49 |
|
|
50 |
test.Next(_L("Connect to the test Driver"));
|
|
51 |
// Connect to the driver
|
|
52 |
iDriver.Close();
|
|
53 |
r=iDriver.Open(iStack,iDriver.VersionRequired());
|
|
54 |
if(r==KErrNotFound)
|
|
55 |
{
|
|
56 |
test.Printf(_L("Test not supported on this platform\n"));
|
|
57 |
test.End();
|
|
58 |
return(0);
|
|
59 |
}
|
|
60 |
test_KErrNone(r);
|
|
61 |
|
|
62 |
// Power the stack down & up to make sure the CardInfo is up to date
|
|
63 |
test.Next(_L("Powering Stack"));
|
|
64 |
iDriver.Reset();
|
|
65 |
iDriver.PwrDownStack();
|
|
66 |
TRequestStatus status = KRequestPending;
|
|
67 |
iDriver.PwrUpAndInitStack(status);
|
|
68 |
User::WaitForRequest(status);
|
|
69 |
r = status.Int();
|
|
70 |
if (r==KErrNotReady)
|
|
71 |
{
|
|
72 |
test.Printf(_L("Card not found on this platform \n"));
|
|
73 |
test.End();
|
|
74 |
return(0);
|
|
75 |
}
|
|
76 |
test_KErrNone(r);
|
|
77 |
|
|
78 |
test.Next(_L("Retrieve Stack Info"));
|
|
79 |
TUint cardsPresentMask;
|
|
80 |
r=iDriver.StackInfo(cardsPresentMask);
|
|
81 |
test_KErrNone(r);
|
|
82 |
|
|
83 |
test.Next(_L("Select Card - 0"));
|
|
84 |
iDriver.SelectCard(iCard);
|
|
85 |
TMmcCardInfo ci;
|
|
86 |
r=iDriver.CardInfo(ci);
|
|
87 |
test_KErrNone(r);
|
|
88 |
|
|
89 |
test.Next(_L("Print Card CSD & extended CSD registers"));
|
|
90 |
status = KRequestPending;
|
|
91 |
iDriver.PrintCardRegisters(status);
|
|
92 |
User::WaitForRequest(status);
|
|
93 |
r = status.Int();
|
|
94 |
test_KErrNone(r);
|
|
95 |
|
|
96 |
test.End();
|
|
97 |
return(0);
|
|
98 |
}
|
|
99 |
|