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 |
|
15 |
|
16 #include <drivers/d_sdapc.h> |
|
17 |
|
18 #define __E32TEST_EXTENSION__ |
|
19 |
|
20 #include <e32std.h> |
|
21 #include <e32test.h> |
|
22 #include <hal.h> |
|
23 |
|
24 LOCAL_D RTest test(_L("SDAPCTEST")); |
|
25 |
|
26 |
|
27 // This test is intended to simply load and free the associated LDD, |
|
28 // since the required funcionality is contained in the channel creation method (client registration, PSU locking) |
|
29 // and destructor (deregistration and unlocking). |
|
30 // |
|
31 // The waits are intended to allow a generous sample time for logging of KTRACE from the PSU code |
|
32 // with the driver loaded/unloaded, to verify that it is behaving as expected. |
|
33 |
|
34 GLDEF_C TInt E32Main() |
|
35 { |
|
36 #if !defined(__WINS__) |
|
37 test.Title(); |
|
38 |
|
39 RSDAuxiliaryPowerControlAPI TheDriver; |
|
40 |
|
41 test.Start(_L("SDAPCTEST - Main Test")); |
|
42 |
|
43 // Only test on platforms with SDIO support in all ROM configurations |
|
44 TInt machineuid; |
|
45 HAL::Get(HAL::EMachineUid, machineuid); |
|
46 if(machineuid != HAL::EMachineUid_OmapH2) |
|
47 { |
|
48 test.Printf(_L("Test not supported on this platform\n")); |
|
49 } |
|
50 else |
|
51 { |
|
52 TInt err = KErrGeneral; |
|
53 |
|
54 err = User::LoadLogicalDevice(_L("D_SDAPC")); |
|
55 test.Printf(_L("Value of err is %d\n"), err); |
|
56 test_Value(err, err==KErrNone || err==KErrAlreadyExists); |
|
57 |
|
58 err = TheDriver.Open(0,TheDriver.VersionRequired()); |
|
59 test_KErrNone(err); |
|
60 |
|
61 test.Printf(_L("Wait for 10 seconds with SD auxiliary power-control driver loaded...\n")); |
|
62 User::After(10000000); |
|
63 |
|
64 TheDriver.Close(); |
|
65 |
|
66 err = User::FreeLogicalDevice(_L("D_SDAPC")); |
|
67 test.Printf(_L("Value of err is %d\n"), err); |
|
68 |
|
69 test.Printf(_L("Wait for 10 seconds without SD auxiliary power-control driver loaded...\n")); |
|
70 |
|
71 User::After(10000000); |
|
72 } |
|
73 |
|
74 test.End(); |
|
75 #else |
|
76 test.Printf(_L("This test does not run on emulator.\n")); |
|
77 #endif |
|
78 return(KErrNone); |
|
79 } |
|
80 |
|
81 |
|