1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/mmu/d_memorytest.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,152 @@
1.4 +// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\mmu\d_memorytest.h
1.18 +//
1.19 +//
1.20 +
1.21 +#ifndef __D_MEMORYTEST_H__
1.22 +#define __D_MEMORYTEST_H__
1.23 +
1.24 +#include <e32cmn.h>
1.25 +#ifndef __KERNEL_MODE__
1.26 +#include <e32std.h>
1.27 +#endif
1.28 +
1.29 +_LIT(KMemoryTestLddName,"d_memorytest");
1.30 +
1.31 +const TInt KUCPageCount = 4;//Page count of user chunk used in physical pinning tests.
1.32 +
1.33 +class RMemoryTestLdd : public RBusLogicalChannel
1.34 + {
1.35 +public:
1.36 + enum TControl
1.37 + {
1.38 + EReadWriteMemory,
1.39 + EReadMemory,
1.40 + EWriteMemory,
1.41 + ETestAllocZerosMemory,
1.42 + ETestReAllocZerosMemory,
1.43 + ETestAllocPhysTest,
1.44 + ETestAllocPhysTest1,
1.45 + ECreateVirtualPinObject,
1.46 + EPinVirtualMemory,
1.47 + EUnpinVirtualMemory,
1.48 + EDestroyVirtualPinObject,
1.49 + ECreatePhysicalPinObject,
1.50 + EPinPhysicalMemory,
1.51 + EPinPhysicalMemoryRO,
1.52 + ECheckPageList,
1.53 + ESyncPinnedPhysicalMemory,
1.54 + EMovePinnedPhysicalMemory,
1.55 + EInvalidatePinnedPhysicalMemory,
1.56 + EUnpinPhysicalMemory,
1.57 + EDestroyPhysicalPinObject,
1.58 + EPinKernelPhysicalMemory,
1.59 + ESetPanicTrace,
1.60 + EIsMemoryPresent,
1.61 + ECreateKernelMapObject,
1.62 + EDestroyKernelMapObject,
1.63 + EKernelMapMemory,
1.64 + EKernelMapMemoryRO,
1.65 + EKernelMapMemoryInvalid,
1.66 + EKernelMapCheckPageList,
1.67 + EKernelMapSyncMemory,
1.68 + EKernelMapInvalidateMemory,
1.69 + EKernelMapMoveMemory,
1.70 + EKernelMapReadModifyMemory,
1.71 + EKernelUnmapMemory,
1.72 + };
1.73 +
1.74 +#ifndef __KERNEL_MODE__
1.75 +public:
1.76 + inline TInt Open()
1.77 + {
1.78 + TInt r=User::LoadLogicalDevice(KMemoryTestLddName);
1.79 + if(r==KErrNone || r==KErrAlreadyExists)
1.80 + r=DoCreate(KMemoryTestLddName,TVersion(),KNullUnit,NULL,NULL,EOwnerProcess,ETrue);
1.81 + return r;
1.82 + };
1.83 + inline TInt ReadWriteMemory(TAny* aPtr)
1.84 + { return DoControl(EReadWriteMemory,aPtr); }
1.85 + inline TInt ReadMemory(TAny* aPtr,TUint32& aValue)
1.86 + { return DoControl(EReadMemory,aPtr,&aValue); }
1.87 + inline TInt WriteMemory(TAny* aPtr,TUint32 aValue)
1.88 + { return DoControl(EWriteMemory,aPtr,(TAny*)aValue); }
1.89 + inline TInt TestAllocZerosMemory()
1.90 + { return DoControl(ETestAllocZerosMemory,NULL,NULL); }
1.91 + inline TInt TestReAllocZerosMemory()
1.92 + { return DoControl(ETestReAllocZerosMemory,NULL,NULL); }
1.93 + inline TInt AllocPhysTest(TUint32 aIters, TUint32 aSize)
1.94 + { return DoControl(ETestAllocPhysTest,(TAny*)aIters, (TAny*)aSize); }
1.95 + inline TInt AllocPhysTest1(TUint32 aIters, TUint32 aSize)
1.96 + { return DoControl(ETestAllocPhysTest1,(TAny*)aIters, (TAny*)aSize); }
1.97 + inline TInt CreateVirtualPinObject()
1.98 + { return DoControl(ECreateVirtualPinObject); }
1.99 + inline TInt PinVirtualMemory(TLinAddr aStart,TUint aSize)
1.100 + { return DoControl(EPinVirtualMemory,(TAny*)aStart,(TAny*)aSize); }
1.101 + inline TInt UnpinVirtualMemory()
1.102 + { return DoControl(EUnpinVirtualMemory); }
1.103 + inline TInt DestroyVirtualPinObject()
1.104 + { return DoControl(EDestroyVirtualPinObject); }
1.105 + inline TInt CreatePhysicalPinObject()
1.106 + { return DoControl(ECreatePhysicalPinObject); }
1.107 + inline TInt PinPhysicalMemory(TLinAddr aStart,TUint aSize)
1.108 + { return DoControl(EPinPhysicalMemory,(TAny*)aStart,(TAny*)aSize); }
1.109 + inline TInt PinPhysicalMemoryRO(TLinAddr aStart,TUint aSize)
1.110 + { return DoControl(EPinPhysicalMemoryRO,(TAny*)aStart,(TAny*)aSize); }
1.111 + inline TInt CheckPageList(TUint8* aStart)
1.112 + { return DoControl(ECheckPageList,(TAny*)aStart); }
1.113 + inline TInt SyncPinnedPhysicalMemory(TUint aOffset,TUint aSize)
1.114 + { return DoControl(ESyncPinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); }
1.115 + inline TInt MovePinnedPhysicalMemory(TInt aPageNumber)
1.116 + { return DoControl(EMovePinnedPhysicalMemory,(TAny*)aPageNumber); }
1.117 + inline TInt InvalidatePinnedPhysicalMemory(TUint aOffset,TUint aSize)
1.118 + { return DoControl(EInvalidatePinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); }
1.119 + inline TInt UnpinPhysicalMemory()
1.120 + { return DoControl(EUnpinPhysicalMemory); }
1.121 + inline TInt DestroyPhysicalPinObject()
1.122 + { return DoControl(EDestroyPhysicalPinObject); }
1.123 + inline TInt PinKernelPhysicalMemory()
1.124 + { return DoControl(EPinKernelPhysicalMemory); }
1.125 + inline TBool SetPanicTrace(TBool aEnable)
1.126 + { return DoControl(ESetPanicTrace,(TAny*)aEnable); }
1.127 + inline TInt IsMemoryPresent(const TAny* aPtr)
1.128 + { return DoControl(EIsMemoryPresent,(TAny*)aPtr); }
1.129 + inline TInt CreateKernelMapObject(TUint aReserveBytes)
1.130 + { return DoControl(ECreateKernelMapObject, (TAny*)aReserveBytes); }
1.131 + inline TInt DestroyKernelMapObject()
1.132 + { return DoControl(EDestroyKernelMapObject); }
1.133 + inline TInt KernelMapMemory(TLinAddr aStart, TUint aSize)
1.134 + { return DoControl(EKernelMapMemory,(TAny*)aStart, (TAny*)aSize); }
1.135 + inline TInt KernelMapMemoryRO(TLinAddr aStart, TUint aSize)
1.136 + { return DoControl(EKernelMapMemoryRO,(TAny*)aStart, (TAny*)aSize); }
1.137 + inline TInt KernelMapMemoryInvalid(TLinAddr aStart, TUint aSize)
1.138 + { return DoControl(EKernelMapMemoryInvalid,(TAny*)aStart, (TAny*)aSize); }
1.139 + inline TInt KernelMapCheckPageList(TUint8* aStart)
1.140 + { return DoControl(EKernelMapCheckPageList, (TAny*)aStart); }
1.141 + inline TInt KernelMapSyncMemory()
1.142 + { return DoControl(EKernelMapSyncMemory); }
1.143 + inline TInt KernelMapInvalidateMemory()
1.144 + { return DoControl(EKernelMapInvalidateMemory); }
1.145 + inline TInt KernelMapMoveMemory(TUint aIndex)
1.146 + { return DoControl(EKernelMapMoveMemory, (TAny*)aIndex); }
1.147 + inline TInt KernelMapReadAndModifyMemory()
1.148 + { return DoControl(EKernelMapReadModifyMemory); }
1.149 + inline TInt KernelUnmapMemory()
1.150 + { return DoControl(EKernelUnmapMemory); }
1.151 +#endif
1.152 + };
1.153 +
1.154 +
1.155 +#endif