Update contrib.
1 // Copyright (c) 2008-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\e32test\demandpaging\d_pagingexample.h
15 // Examples for demand paging device driver migration
16 // This header defines the interface to four drivers:
17 // d_pagingexample_1_pre DLogicalChannel-dervied driver, pre-migration
18 // d_pagingexample_1_post DLogicalChannel-dervied driver, post-migration
19 // d_pagingexample_2_pre DLogicalChannelBase-dervied driver, pre-migration
20 // d_pagingexample_2_post DLogicalChannelBase-dervied driver, post-migration
24 #ifndef __D_PAGINGEXAMPLE_H__
25 #define __D_PAGINGEXAMPLE_H__
29 #ifndef __KERNEL_MODE__
33 _LIT(KPagingExample1PreLdd,"D_PAGINGEXAMPLE_1_PRE");
34 _LIT(KPagingExample1PostLdd,"D_PAGINGEXAMPLE_1_POST");
35 _LIT(KPagingExample2PreLdd,"D_PAGINGEXAMPLE_2_PRE");
36 _LIT(KPagingExample2PostLdd,"D_PAGINGEXAMPLE_2_POST");
38 const TInt KMaxTransferSize = 256;
39 const TInt KAsyncDelay = 100; // simulated async operations take 100ms
41 // Common interface to all versions of the example driver
42 class RPagingExample : public RBusLogicalChannel
59 ERequestAsyncGetValue,
60 ERequestAsyncGetValue2,
78 #ifndef __KERNEL_MODE__
80 inline TInt Open(const TDesC& aLddName)
81 { return DoCreate(aLddName, TVersion(), KNullUnit, NULL, NULL, EOwnerThread, EFalse); }
82 inline TInt SetDfcThreadRealtimeState(TBool aRealtime) // only supported on "1_pre" driver
83 { return DoControl(ESetRealtimeState, (TAny*)aRealtime); }
84 inline TInt GetConfig(TConfigData& aConfigOut)
85 { return DoControl(EGetConfig, (TAny*)&aConfigOut); }
86 inline TInt SetConfig(const TConfigData& aConfigIn)
87 { return DoControl(ESetConfig, (TAny*)&aConfigIn); }
88 inline void Notify(TRequestStatus& aStatus)
89 { DoRequest(ERequestNotify, aStatus); }
90 inline void AsyncGetValue(TRequestStatus& aStatus, TValueStruct& aValueOut)
91 { DoRequest(ERequestAsyncGetValue, aStatus, (TAny*)&aValueOut); }
92 inline void AsyncGetValue2(TRequestStatus& aStatus, TInt& aValueOut1, TInt& aValueOut2)
93 { DoRequest(ERequestAsyncGetValue2, aStatus, (TAny*)&aValueOut1, (TAny*)&aValueOut2); }
94 inline void Read(TRequestStatus& aStatus, TUint8* aBuffer, TInt aLength)
95 { DoRequest(ERequestRead, aStatus, aBuffer, (TAny*)aLength); }
96 inline void ReadDes(TRequestStatus& aStatus, TDes8& aDesOut)
97 { DoRequest(ERequestReadDes, aStatus, &aDesOut); }
98 inline void Write(TRequestStatus& aStatus, const TUint8* aBuffer, TInt aLength)
99 { DoRequest(ERequestWrite, aStatus, (TAny*)aBuffer, (TAny*)aLength); }
100 inline void WriteDes(TRequestStatus& aStatus, const TDesC8& aDesIn)
101 { DoRequest(ERequestWriteDes, aStatus, (TAny*)&aDesIn); }
103 { DoCancel(ERequestCancel); }