sl@0
|
1 |
// Copyright (c) 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 |
// e32test/mmu/d_shbuf.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#ifndef D_SHBUF_H
|
sl@0
|
19 |
#define D_SHBUF_H
|
sl@0
|
20 |
|
sl@0
|
21 |
#include <e32cmn.h>
|
sl@0
|
22 |
#include <e32ver.h>
|
sl@0
|
23 |
#include <e32shbufcmn.h>
|
sl@0
|
24 |
|
sl@0
|
25 |
class TShPoolInfo;
|
sl@0
|
26 |
class TShPoolCreateInfo;
|
sl@0
|
27 |
|
sl@0
|
28 |
// Device driver names
|
sl@0
|
29 |
_LIT(KTestShBufClient, "d_shbuf_client"); // Driver 0
|
sl@0
|
30 |
_LIT(KTestShBufOwn, "d_shbuf_own"); // Driver 1
|
sl@0
|
31 |
|
sl@0
|
32 |
// Some test data
|
sl@0
|
33 |
_LIT8(KTestData1, "QTWHEIRSTTYEUSITOAPPAPSIDSFAGFHUJCKKLIZNXGCPVIBLNEMOQFWCERRATPEA");
|
sl@0
|
34 |
_LIT8(KTestData2, "8297382917319823712893719824737644563284328746372468732643287463");
|
sl@0
|
35 |
|
sl@0
|
36 |
const TInt KTestMinimumAlignmentLog2 = 5;
|
sl@0
|
37 |
const TInt KTestPoolSizeInBufs = 10;
|
sl@0
|
38 |
const TInt KDefaultPoolHandleFlags = EShPoolWriteable | EShPoolAllocate;
|
sl@0
|
39 |
|
sl@0
|
40 |
class RShBufTestChannel : public RBusLogicalChannel
|
sl@0
|
41 |
{
|
sl@0
|
42 |
public:
|
sl@0
|
43 |
enum TTestControl
|
sl@0
|
44 |
{
|
sl@0
|
45 |
ETestOpenUserPool,
|
sl@0
|
46 |
ETestOpenKernelPool,
|
sl@0
|
47 |
ETestCloseUserPool,
|
sl@0
|
48 |
ETestCloseKernelPool,
|
sl@0
|
49 |
ETestManipulateUserBuffer,
|
sl@0
|
50 |
ETestAllocateKernelBuffer,
|
sl@0
|
51 |
ETestCreatePoolPhysAddrCont,
|
sl@0
|
52 |
ETestCreatePoolPhysAddrNonCont,
|
sl@0
|
53 |
ETestAllocateMax,
|
sl@0
|
54 |
ETestBufferAlignmentKernel,
|
sl@0
|
55 |
ETestNegativeTestsKernel,
|
sl@0
|
56 |
ETestCreatePoolContiguousPool,
|
sl@0
|
57 |
ETestPinBuffer,
|
sl@0
|
58 |
// Performance tests
|
sl@0
|
59 |
EFromRShBufProcessAndReturn = 100,
|
sl@0
|
60 |
EFromRShBufProcessAndRelease,
|
sl@0
|
61 |
EFromTPtr8ProcessAndReturn,
|
sl@0
|
62 |
EFromTPtr8ProcessAndRelease
|
sl@0
|
63 |
};
|
sl@0
|
64 |
|
sl@0
|
65 |
enum { EClientThread = 0, EOwnThread = 1 };
|
sl@0
|
66 |
|
sl@0
|
67 |
#ifndef __KERNEL_MODE__
|
sl@0
|
68 |
inline TInt Open(TInt aDriverNo); // driver 0 executes in client thread, driver 1 has its own thread
|
sl@0
|
69 |
inline TInt OpenUserPool(TInt aHandle, const TShPoolInfo& aPoolInfo);
|
sl@0
|
70 |
inline TInt OpenKernelPool(TShPoolCreateInfo& aInfo, TInt& aHandle);
|
sl@0
|
71 |
inline TInt CloseUserPool();
|
sl@0
|
72 |
inline TInt CloseKernelPool();
|
sl@0
|
73 |
inline TInt ManipulateUserBuffer(TInt aHandle);
|
sl@0
|
74 |
inline TInt AllocateKernelBuffer(TInt aPoolIndex, TInt& aHandle);
|
sl@0
|
75 |
inline TInt CreatePoolPhysAddrCont(TInt aBufSize);
|
sl@0
|
76 |
inline TInt CreatePoolPhysAddrNonCont(TInt aBufSize);
|
sl@0
|
77 |
inline TInt AllocateMax(TInt aPoolIndex, TInt& aAllocated);
|
sl@0
|
78 |
inline TInt BufferAlignmentKernel(TInt aBufSize, TInt aAlignment);
|
sl@0
|
79 |
inline TInt NegativeTestsKernel();
|
sl@0
|
80 |
inline TInt ContiguousPoolKernel(TShPoolCreateInfo& aInfo);
|
sl@0
|
81 |
inline TInt PinBuffer(TInt aPoolHandle, TInt aBufferHandle);
|
sl@0
|
82 |
// Performance tests
|
sl@0
|
83 |
inline TInt FromRShBufProcessAndReturn(TUint aBufSize);
|
sl@0
|
84 |
inline TInt FromRShBufProcessAndRelease(TInt aHandle);
|
sl@0
|
85 |
inline TInt FromTPtr8ProcessAndReturn(TDes8& aBuf, TUint bufferSize);
|
sl@0
|
86 |
inline TInt FromTPtr8ProcessAndRelease(TDes8& aBuf);
|
sl@0
|
87 |
#endif // __KERNEL_MODE__
|
sl@0
|
88 |
};
|
sl@0
|
89 |
|
sl@0
|
90 |
#ifndef __KERNEL_MODE__
|
sl@0
|
91 |
inline TInt RShBufTestChannel::Open(TInt aDriverNo)
|
sl@0
|
92 |
{
|
sl@0
|
93 |
if (aDriverNo!=0&&aDriverNo!=1)
|
sl@0
|
94 |
{
|
sl@0
|
95 |
return KErrArgument;
|
sl@0
|
96 |
}
|
sl@0
|
97 |
return (DoCreate((aDriverNo)?(KTestShBufOwn()):(KTestShBufClient()),TVersion(1,0,KE32BuildVersionNumber),KNullUnit,NULL,NULL,EOwnerThread));
|
sl@0
|
98 |
}
|
sl@0
|
99 |
inline TInt RShBufTestChannel::OpenUserPool(TInt aHandle, const TShPoolInfo& aPoolInfo)
|
sl@0
|
100 |
{return DoControl(ETestOpenUserPool, (TAny*) aHandle, (TAny*) &aPoolInfo);}
|
sl@0
|
101 |
inline TInt RShBufTestChannel::OpenKernelPool(TShPoolCreateInfo& aInfo, TInt& aHandle)
|
sl@0
|
102 |
{return DoControl(ETestOpenKernelPool, (TAny*) &aInfo, (TAny*) &aHandle);}
|
sl@0
|
103 |
inline TInt RShBufTestChannel::CloseUserPool()
|
sl@0
|
104 |
{return DoControl(ETestCloseUserPool);}
|
sl@0
|
105 |
inline TInt RShBufTestChannel::CloseKernelPool()
|
sl@0
|
106 |
{return DoControl(ETestCloseKernelPool);}
|
sl@0
|
107 |
inline TInt RShBufTestChannel::ManipulateUserBuffer(TInt aHandle)
|
sl@0
|
108 |
{return DoControl(ETestManipulateUserBuffer, (TAny*) aHandle);}
|
sl@0
|
109 |
inline TInt RShBufTestChannel::AllocateKernelBuffer(TInt aPoolIndex, TInt& aHandle)
|
sl@0
|
110 |
{return DoControl(ETestAllocateKernelBuffer, (TAny*) aPoolIndex, (TAny*) &aHandle);}
|
sl@0
|
111 |
inline TInt RShBufTestChannel::CreatePoolPhysAddrCont(TInt aBufSize)
|
sl@0
|
112 |
{return DoControl(ETestCreatePoolPhysAddrCont, (TAny*) aBufSize);}
|
sl@0
|
113 |
inline TInt RShBufTestChannel::CreatePoolPhysAddrNonCont(TInt aBufSize)
|
sl@0
|
114 |
{return DoControl(ETestCreatePoolPhysAddrNonCont, (TAny*) aBufSize);}
|
sl@0
|
115 |
inline TInt RShBufTestChannel::AllocateMax(TInt aPoolIndex, TInt& aAllocated)
|
sl@0
|
116 |
{return DoControl(ETestAllocateMax, (TAny*) aPoolIndex, (TAny*) &aAllocated);}
|
sl@0
|
117 |
inline TInt RShBufTestChannel::BufferAlignmentKernel(TInt aBufSize, TInt aAlignment)
|
sl@0
|
118 |
{return DoControl(ETestBufferAlignmentKernel, (TAny*) aBufSize, (TAny*) aAlignment);}
|
sl@0
|
119 |
inline TInt RShBufTestChannel::NegativeTestsKernel()
|
sl@0
|
120 |
{return DoControl(ETestNegativeTestsKernel);}
|
sl@0
|
121 |
inline TInt RShBufTestChannel::ContiguousPoolKernel(TShPoolCreateInfo& aInfo)
|
sl@0
|
122 |
{return DoControl(ETestCreatePoolContiguousPool, (TAny*)&aInfo);}
|
sl@0
|
123 |
inline TInt RShBufTestChannel::PinBuffer(TInt aPoolHandle, TInt aBufferHandle)
|
sl@0
|
124 |
{return DoControl(ETestPinBuffer, (TAny*) aPoolHandle, (TAny*) aBufferHandle);}
|
sl@0
|
125 |
// Performance tests
|
sl@0
|
126 |
inline TInt RShBufTestChannel::FromRShBufProcessAndReturn(TUint aBufSize)
|
sl@0
|
127 |
{return DoControl(EFromRShBufProcessAndReturn, (TAny*) aBufSize);}
|
sl@0
|
128 |
inline TInt RShBufTestChannel::FromRShBufProcessAndRelease(TInt aHandle)
|
sl@0
|
129 |
{return DoControl(EFromRShBufProcessAndRelease,(TAny*)aHandle);}
|
sl@0
|
130 |
inline TInt RShBufTestChannel::FromTPtr8ProcessAndReturn(TDes8& aBuf, TUint aBufSize)
|
sl@0
|
131 |
{return DoControl(EFromTPtr8ProcessAndReturn,(TAny*)&aBuf, (TAny*) aBufSize);}
|
sl@0
|
132 |
inline TInt RShBufTestChannel::FromTPtr8ProcessAndRelease(TDes8& aBuf)
|
sl@0
|
133 |
{return DoControl(EFromTPtr8ProcessAndRelease,(TAny*)&aBuf);}
|
sl@0
|
134 |
#endif // __KERNEL_MODE__
|
sl@0
|
135 |
#endif // D_SHBUF_H
|