|
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/rpmb/rpmb.h |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 @prototype |
|
22 */ |
|
23 |
|
24 #include <kernel/kern_priv.h> |
|
25 #include <drivers/rpmbdevice.h> |
|
26 #include <drivers/mmc.h> |
|
27 |
|
28 // banner for reporting progress of these tests |
|
29 _LIT(KDRpmbTestBanner,"RPMB TEST DRIVER: "); |
|
30 |
|
31 // RPMB test driver factory class |
|
32 class DRpmbTestFactory : public DLogicalDevice |
|
33 { |
|
34 public: |
|
35 DRpmbTestFactory(); |
|
36 ~DRpmbTestFactory(); |
|
37 virtual TInt Install(); |
|
38 virtual void GetCaps(TDes8& aDes) const; |
|
39 virtual TInt Create(DLogicalChannelBase*& aChannel); |
|
40 }; |
|
41 |
|
42 // RPMB test driver request handling class |
|
43 class DRpmbTest : public DLogicalChannelBase |
|
44 { |
|
45 public: |
|
46 DRpmbTest(); |
|
47 virtual ~DRpmbTest(); |
|
48 TInt DRpmbDeviceTests(); |
|
49 TInt RpmbStackTests(); |
|
50 protected: |
|
51 TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); |
|
52 TInt Request(TInt aFunction, TAny* a1, TAny* a2); |
|
53 private: |
|
54 TInt SendAccessRequestNotOpen(); |
|
55 TInt OpenWithBadIndex(); |
|
56 TInt MultipleOpen(); |
|
57 TInt SendAccessRequestBadParms(); |
|
58 TInt InvalidRequestId(); |
|
59 TInt IsKeyProgrammed(); |
|
60 TInt WriteKey(); |
|
61 TInt ReadWriteCounter(); |
|
62 TInt ReadData(); |
|
63 TUint DecodeResponse(TUint8 * aResp); |
|
64 TUint DecodeResult(TUint8 * aResp); |
|
65 TUint32 DecodeCounter(TUint8 * aResp); |
|
66 void DisplayReadData(TUint8 * aResp); |
|
67 static void BusCallBack(TAny* aPtr, TInt aReason, TAny* a1, TAny* a2); |
|
68 static void StackCallBack(TAny * aSelf); |
|
69 TInt StackBadIndex(); |
|
70 TInt SetupForStackTests(); |
|
71 TInt StackIsKeyProgrammed(); |
|
72 TInt StackWriteKey(); |
|
73 TInt StackReadWriteCounter(); |
|
74 TInt StackReadData(); |
|
75 TInt SendToStackAndWait(); |
|
76 private: |
|
77 DRpmbDevice iRpmb; |
|
78 DRpmbDevice iRpmbSecondInstance; |
|
79 TUint8 * iRequest; |
|
80 TUint8 * iResponse; |
|
81 TBool iKeySet; |
|
82 TUint8* iBufPtr; |
|
83 DSemaphore * iStackSemPtr; |
|
84 DSemaphore * iPowerSemPtr; |
|
85 TPBusCallBack iBusCallBack; |
|
86 TMMCCallBack iSessionEndCallBack; |
|
87 DMMCSocket* iSocket; |
|
88 DMMCSession* iSession; |
|
89 }; |