sl@0
|
1 |
// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32\e32test\demandpaging\d_pagingexample.h
|
sl@0
|
15 |
// Examples for demand paging device driver migration
|
sl@0
|
16 |
// This header defines the interface to four drivers:
|
sl@0
|
17 |
// d_pagingexample_1_pre DLogicalChannel-dervied driver, pre-migration
|
sl@0
|
18 |
// d_pagingexample_1_post DLogicalChannel-dervied driver, post-migration
|
sl@0
|
19 |
// d_pagingexample_2_pre DLogicalChannelBase-dervied driver, pre-migration
|
sl@0
|
20 |
// d_pagingexample_2_post DLogicalChannelBase-dervied driver, post-migration
|
sl@0
|
21 |
//
|
sl@0
|
22 |
//
|
sl@0
|
23 |
|
sl@0
|
24 |
#ifndef __D_PAGINGEXAMPLE_H__
|
sl@0
|
25 |
#define __D_PAGINGEXAMPLE_H__
|
sl@0
|
26 |
|
sl@0
|
27 |
#include <e32cmn.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
#ifndef __KERNEL_MODE__
|
sl@0
|
30 |
#include <e32std.h>
|
sl@0
|
31 |
#endif
|
sl@0
|
32 |
|
sl@0
|
33 |
_LIT(KPagingExample1PreLdd,"D_PAGINGEXAMPLE_1_PRE");
|
sl@0
|
34 |
_LIT(KPagingExample1PostLdd,"D_PAGINGEXAMPLE_1_POST");
|
sl@0
|
35 |
_LIT(KPagingExample2PreLdd,"D_PAGINGEXAMPLE_2_PRE");
|
sl@0
|
36 |
_LIT(KPagingExample2PostLdd,"D_PAGINGEXAMPLE_2_POST");
|
sl@0
|
37 |
|
sl@0
|
38 |
const TInt KMaxTransferSize = 256;
|
sl@0
|
39 |
const TInt KAsyncDelay = 100; // simulated async operations take 100ms
|
sl@0
|
40 |
|
sl@0
|
41 |
// Common interface to all versions of the example driver
|
sl@0
|
42 |
class RPagingExample : public RBusLogicalChannel
|
sl@0
|
43 |
{
|
sl@0
|
44 |
public:
|
sl@0
|
45 |
enum TControl
|
sl@0
|
46 |
{
|
sl@0
|
47 |
ESetRealtimeState,
|
sl@0
|
48 |
EGetConfig,
|
sl@0
|
49 |
ESetConfig,
|
sl@0
|
50 |
};
|
sl@0
|
51 |
|
sl@0
|
52 |
enum TRequest
|
sl@0
|
53 |
{
|
sl@0
|
54 |
ERequestRead,
|
sl@0
|
55 |
ERequestReadDes,
|
sl@0
|
56 |
ERequestWrite,
|
sl@0
|
57 |
ERequestWriteDes,
|
sl@0
|
58 |
ERequestNotify,
|
sl@0
|
59 |
ERequestAsyncGetValue,
|
sl@0
|
60 |
ERequestAsyncGetValue2,
|
sl@0
|
61 |
ERequestCancel,
|
sl@0
|
62 |
};
|
sl@0
|
63 |
|
sl@0
|
64 |
struct TConfigData
|
sl@0
|
65 |
{
|
sl@0
|
66 |
TInt iParam1;
|
sl@0
|
67 |
TInt iParam2;
|
sl@0
|
68 |
TInt iParam3;
|
sl@0
|
69 |
TInt iParam4;
|
sl@0
|
70 |
};
|
sl@0
|
71 |
|
sl@0
|
72 |
struct TValueStruct
|
sl@0
|
73 |
{
|
sl@0
|
74 |
TInt iValue1;
|
sl@0
|
75 |
TBuf8<4> iValue2;
|
sl@0
|
76 |
};
|
sl@0
|
77 |
|
sl@0
|
78 |
#ifndef __KERNEL_MODE__
|
sl@0
|
79 |
public:
|
sl@0
|
80 |
inline TInt Open(const TDesC& aLddName)
|
sl@0
|
81 |
{ return DoCreate(aLddName, TVersion(), KNullUnit, NULL, NULL, EOwnerThread, EFalse); }
|
sl@0
|
82 |
inline TInt SetDfcThreadRealtimeState(TBool aRealtime) // only supported on "1_pre" driver
|
sl@0
|
83 |
{ return DoControl(ESetRealtimeState, (TAny*)aRealtime); }
|
sl@0
|
84 |
inline TInt GetConfig(TConfigData& aConfigOut)
|
sl@0
|
85 |
{ return DoControl(EGetConfig, (TAny*)&aConfigOut); }
|
sl@0
|
86 |
inline TInt SetConfig(const TConfigData& aConfigIn)
|
sl@0
|
87 |
{ return DoControl(ESetConfig, (TAny*)&aConfigIn); }
|
sl@0
|
88 |
inline void Notify(TRequestStatus& aStatus)
|
sl@0
|
89 |
{ DoRequest(ERequestNotify, aStatus); }
|
sl@0
|
90 |
inline void AsyncGetValue(TRequestStatus& aStatus, TValueStruct& aValueOut)
|
sl@0
|
91 |
{ DoRequest(ERequestAsyncGetValue, aStatus, (TAny*)&aValueOut); }
|
sl@0
|
92 |
inline void AsyncGetValue2(TRequestStatus& aStatus, TInt& aValueOut1, TInt& aValueOut2)
|
sl@0
|
93 |
{ DoRequest(ERequestAsyncGetValue2, aStatus, (TAny*)&aValueOut1, (TAny*)&aValueOut2); }
|
sl@0
|
94 |
inline void Read(TRequestStatus& aStatus, TUint8* aBuffer, TInt aLength)
|
sl@0
|
95 |
{ DoRequest(ERequestRead, aStatus, aBuffer, (TAny*)aLength); }
|
sl@0
|
96 |
inline void ReadDes(TRequestStatus& aStatus, TDes8& aDesOut)
|
sl@0
|
97 |
{ DoRequest(ERequestReadDes, aStatus, &aDesOut); }
|
sl@0
|
98 |
inline void Write(TRequestStatus& aStatus, const TUint8* aBuffer, TInt aLength)
|
sl@0
|
99 |
{ DoRequest(ERequestWrite, aStatus, (TAny*)aBuffer, (TAny*)aLength); }
|
sl@0
|
100 |
inline void WriteDes(TRequestStatus& aStatus, const TDesC8& aDesIn)
|
sl@0
|
101 |
{ DoRequest(ERequestWriteDes, aStatus, (TAny*)&aDesIn); }
|
sl@0
|
102 |
inline void Cancel()
|
sl@0
|
103 |
{ DoCancel(ERequestCancel); }
|
sl@0
|
104 |
#endif
|
sl@0
|
105 |
};
|
sl@0
|
106 |
|
sl@0
|
107 |
#endif
|