sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // e32test\mmu\d_memorytest.h sl@0: // sl@0: // sl@0: sl@0: #ifndef __D_MEMORYTEST_H__ sl@0: #define __D_MEMORYTEST_H__ sl@0: sl@0: #include sl@0: #ifndef __KERNEL_MODE__ sl@0: #include sl@0: #endif sl@0: sl@0: _LIT(KMemoryTestLddName,"d_memorytest"); sl@0: sl@0: const TInt KUCPageCount = 4;//Page count of user chunk used in physical pinning tests. sl@0: sl@0: class RMemoryTestLdd : public RBusLogicalChannel sl@0: { sl@0: public: sl@0: enum TControl sl@0: { sl@0: EReadWriteMemory, sl@0: EReadMemory, sl@0: EWriteMemory, sl@0: ETestAllocZerosMemory, sl@0: ETestReAllocZerosMemory, sl@0: ETestAllocPhysTest, sl@0: ETestAllocPhysTest1, sl@0: ECreateVirtualPinObject, sl@0: EPinVirtualMemory, sl@0: EUnpinVirtualMemory, sl@0: EDestroyVirtualPinObject, sl@0: ECreatePhysicalPinObject, sl@0: EPinPhysicalMemory, sl@0: EPinPhysicalMemoryRO, sl@0: ECheckPageList, sl@0: ESyncPinnedPhysicalMemory, sl@0: EMovePinnedPhysicalMemory, sl@0: EInvalidatePinnedPhysicalMemory, sl@0: EUnpinPhysicalMemory, sl@0: EDestroyPhysicalPinObject, sl@0: EPinKernelPhysicalMemory, sl@0: ESetPanicTrace, sl@0: EIsMemoryPresent, sl@0: ECreateKernelMapObject, sl@0: EDestroyKernelMapObject, sl@0: EKernelMapMemory, sl@0: EKernelMapMemoryRO, sl@0: EKernelMapMemoryInvalid, sl@0: EKernelMapCheckPageList, sl@0: EKernelMapSyncMemory, sl@0: EKernelMapInvalidateMemory, sl@0: EKernelMapMoveMemory, sl@0: EKernelMapReadModifyMemory, sl@0: EKernelUnmapMemory, sl@0: }; sl@0: sl@0: #ifndef __KERNEL_MODE__ sl@0: public: sl@0: inline TInt Open() sl@0: { sl@0: TInt r=User::LoadLogicalDevice(KMemoryTestLddName); sl@0: if(r==KErrNone || r==KErrAlreadyExists) sl@0: r=DoCreate(KMemoryTestLddName,TVersion(),KNullUnit,NULL,NULL,EOwnerProcess,ETrue); sl@0: return r; sl@0: }; sl@0: inline TInt ReadWriteMemory(TAny* aPtr) sl@0: { return DoControl(EReadWriteMemory,aPtr); } sl@0: inline TInt ReadMemory(TAny* aPtr,TUint32& aValue) sl@0: { return DoControl(EReadMemory,aPtr,&aValue); } sl@0: inline TInt WriteMemory(TAny* aPtr,TUint32 aValue) sl@0: { return DoControl(EWriteMemory,aPtr,(TAny*)aValue); } sl@0: inline TInt TestAllocZerosMemory() sl@0: { return DoControl(ETestAllocZerosMemory,NULL,NULL); } sl@0: inline TInt TestReAllocZerosMemory() sl@0: { return DoControl(ETestReAllocZerosMemory,NULL,NULL); } sl@0: inline TInt AllocPhysTest(TUint32 aIters, TUint32 aSize) sl@0: { return DoControl(ETestAllocPhysTest,(TAny*)aIters, (TAny*)aSize); } sl@0: inline TInt AllocPhysTest1(TUint32 aIters, TUint32 aSize) sl@0: { return DoControl(ETestAllocPhysTest1,(TAny*)aIters, (TAny*)aSize); } sl@0: inline TInt CreateVirtualPinObject() sl@0: { return DoControl(ECreateVirtualPinObject); } sl@0: inline TInt PinVirtualMemory(TLinAddr aStart,TUint aSize) sl@0: { return DoControl(EPinVirtualMemory,(TAny*)aStart,(TAny*)aSize); } sl@0: inline TInt UnpinVirtualMemory() sl@0: { return DoControl(EUnpinVirtualMemory); } sl@0: inline TInt DestroyVirtualPinObject() sl@0: { return DoControl(EDestroyVirtualPinObject); } sl@0: inline TInt CreatePhysicalPinObject() sl@0: { return DoControl(ECreatePhysicalPinObject); } sl@0: inline TInt PinPhysicalMemory(TLinAddr aStart,TUint aSize) sl@0: { return DoControl(EPinPhysicalMemory,(TAny*)aStart,(TAny*)aSize); } sl@0: inline TInt PinPhysicalMemoryRO(TLinAddr aStart,TUint aSize) sl@0: { return DoControl(EPinPhysicalMemoryRO,(TAny*)aStart,(TAny*)aSize); } sl@0: inline TInt CheckPageList(TUint8* aStart) sl@0: { return DoControl(ECheckPageList,(TAny*)aStart); } sl@0: inline TInt SyncPinnedPhysicalMemory(TUint aOffset,TUint aSize) sl@0: { return DoControl(ESyncPinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); } sl@0: inline TInt MovePinnedPhysicalMemory(TInt aPageNumber) sl@0: { return DoControl(EMovePinnedPhysicalMemory,(TAny*)aPageNumber); } sl@0: inline TInt InvalidatePinnedPhysicalMemory(TUint aOffset,TUint aSize) sl@0: { return DoControl(EInvalidatePinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); } sl@0: inline TInt UnpinPhysicalMemory() sl@0: { return DoControl(EUnpinPhysicalMemory); } sl@0: inline TInt DestroyPhysicalPinObject() sl@0: { return DoControl(EDestroyPhysicalPinObject); } sl@0: inline TInt PinKernelPhysicalMemory() sl@0: { return DoControl(EPinKernelPhysicalMemory); } sl@0: inline TBool SetPanicTrace(TBool aEnable) sl@0: { return DoControl(ESetPanicTrace,(TAny*)aEnable); } sl@0: inline TInt IsMemoryPresent(const TAny* aPtr) sl@0: { return DoControl(EIsMemoryPresent,(TAny*)aPtr); } sl@0: inline TInt CreateKernelMapObject(TUint aReserveBytes) sl@0: { return DoControl(ECreateKernelMapObject, (TAny*)aReserveBytes); } sl@0: inline TInt DestroyKernelMapObject() sl@0: { return DoControl(EDestroyKernelMapObject); } sl@0: inline TInt KernelMapMemory(TLinAddr aStart, TUint aSize) sl@0: { return DoControl(EKernelMapMemory,(TAny*)aStart, (TAny*)aSize); } sl@0: inline TInt KernelMapMemoryRO(TLinAddr aStart, TUint aSize) sl@0: { return DoControl(EKernelMapMemoryRO,(TAny*)aStart, (TAny*)aSize); } sl@0: inline TInt KernelMapMemoryInvalid(TLinAddr aStart, TUint aSize) sl@0: { return DoControl(EKernelMapMemoryInvalid,(TAny*)aStart, (TAny*)aSize); } sl@0: inline TInt KernelMapCheckPageList(TUint8* aStart) sl@0: { return DoControl(EKernelMapCheckPageList, (TAny*)aStart); } sl@0: inline TInt KernelMapSyncMemory() sl@0: { return DoControl(EKernelMapSyncMemory); } sl@0: inline TInt KernelMapInvalidateMemory() sl@0: { return DoControl(EKernelMapInvalidateMemory); } sl@0: inline TInt KernelMapMoveMemory(TUint aIndex) sl@0: { return DoControl(EKernelMapMoveMemory, (TAny*)aIndex); } sl@0: inline TInt KernelMapReadAndModifyMemory() sl@0: { return DoControl(EKernelMapReadModifyMemory); } sl@0: inline TInt KernelUnmapMemory() sl@0: { return DoControl(EKernelUnmapMemory); } sl@0: #endif sl@0: }; sl@0: sl@0: sl@0: #endif