kerneltest/e32test/mmu/d_memorytest.h
changeset 0 a41df078684a
child 39 5d2844f35677
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2004-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".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32test\mmu\d_memorytest.h
       
    15 // 
       
    16 //
       
    17 
       
    18 #ifndef __D_MEMORYTEST_H__
       
    19 #define __D_MEMORYTEST_H__
       
    20 
       
    21 #include <e32cmn.h>
       
    22 #ifndef __KERNEL_MODE__
       
    23 #include <e32std.h>
       
    24 #endif
       
    25 
       
    26 _LIT(KMemoryTestLddName,"d_memorytest");
       
    27 
       
    28 const TInt UCPageCount = 2;//Page count of user chunk used in physical pinning tests.
       
    29 
       
    30 class RMemoryTestLdd : public RBusLogicalChannel
       
    31 	{
       
    32 public:
       
    33 	enum TControl
       
    34 		{
       
    35 		EReadWriteMemory,
       
    36 		EReadMemory,
       
    37 		EWriteMemory,
       
    38 		ETestAllocZerosMemory,
       
    39 		ETestReAllocZerosMemory,
       
    40 		ETestAllocPhysTest,
       
    41 		ETestAllocPhysTest1,
       
    42 		ECreateVirtualPinObject,
       
    43 		EPinVirtualMemory,
       
    44 		EUnpinVirtualMemory,
       
    45 		EDestroyVirtualPinObject,
       
    46 		ECreatePhysicalPinObject,
       
    47 		EPinPhysicalMemory,
       
    48 		EPinPhysicalMemoryRO,
       
    49 		ECheckPageList,
       
    50 		ESyncPinnedPhysicalMemory,
       
    51 		EMovePinnedPhysicalMemory,
       
    52 		EInvalidatePinnedPhysicalMemory,
       
    53 		EUnpinPhysicalMemory,
       
    54 		EDestroyPhysicalPinObject,
       
    55 		EPinKernelPhysicalMemory,
       
    56 		ESetPanicTrace,
       
    57 		EIsMemoryPresent
       
    58 		};
       
    59 
       
    60 #ifndef __KERNEL_MODE__
       
    61 public:
       
    62 	inline TInt Open()
       
    63 		{
       
    64 		TInt r=User::LoadLogicalDevice(KMemoryTestLddName);
       
    65 		if(r==KErrNone || r==KErrAlreadyExists)
       
    66 			r=DoCreate(KMemoryTestLddName,TVersion(),KNullUnit,NULL,NULL,EOwnerProcess,ETrue);
       
    67 		return r;
       
    68 		};
       
    69 	inline TInt ReadWriteMemory(TAny* aPtr)
       
    70 		{ return DoControl(EReadWriteMemory,aPtr); }
       
    71 	inline TInt ReadMemory(TAny* aPtr,TUint32& aValue)
       
    72 		{ return DoControl(EReadMemory,aPtr,&aValue); }
       
    73 	inline TInt WriteMemory(TAny* aPtr,TUint32 aValue)
       
    74 		{ return DoControl(EWriteMemory,aPtr,(TAny*)aValue); }
       
    75 	inline TInt TestAllocZerosMemory()
       
    76 		{ return DoControl(ETestAllocZerosMemory,NULL,NULL); }
       
    77 	inline TInt TestReAllocZerosMemory()
       
    78 		{ return DoControl(ETestReAllocZerosMemory,NULL,NULL); }
       
    79 	inline TInt AllocPhysTest(TUint32 aIters, TUint32 aSize)
       
    80 		{ return DoControl(ETestAllocPhysTest,(TAny*)aIters, (TAny*)aSize); } 
       
    81 	inline TInt AllocPhysTest1(TUint32 aIters, TUint32 aSize)
       
    82 		{ return DoControl(ETestAllocPhysTest1,(TAny*)aIters, (TAny*)aSize); } 
       
    83 	inline TInt CreateVirtualPinObject()
       
    84 		{ return DoControl(ECreateVirtualPinObject); }
       
    85 	inline TInt PinVirtualMemory(TLinAddr aStart,TUint aSize)
       
    86 		{ return DoControl(EPinVirtualMemory,(TAny*)aStart,(TAny*)aSize); }
       
    87 	inline TInt UnpinVirtualMemory()
       
    88 		{ return DoControl(EUnpinVirtualMemory); }
       
    89 	inline TInt DestroyVirtualPinObject()
       
    90 		{ return DoControl(EDestroyVirtualPinObject); }
       
    91 	inline TInt CreatePhysicalPinObject()
       
    92 		{ return DoControl(ECreatePhysicalPinObject); }
       
    93 	inline TInt PinPhysicalMemory(TLinAddr aStart,TUint aSize)
       
    94 		{ return DoControl(EPinPhysicalMemory,(TAny*)aStart,(TAny*)aSize); }
       
    95 	inline TInt PinPhysicalMemoryRO(TLinAddr aStart,TUint aSize)
       
    96 		{ return DoControl(EPinPhysicalMemoryRO,(TAny*)aStart,(TAny*)aSize); }
       
    97 	inline TInt CheckPageList(TUint8* aStart)
       
    98 		{ return DoControl(ECheckPageList,(TAny*)aStart); }
       
    99 	inline TInt SyncPinnedPhysicalMemory(TUint aOffset,TUint aSize)
       
   100 		{ return DoControl(ESyncPinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); }
       
   101 	inline TInt MovePinnedPhysicalMemory(TInt aPageNumber)
       
   102 		{ return DoControl(EMovePinnedPhysicalMemory,(TAny*)aPageNumber); }
       
   103 	inline TInt InvalidatePinnedPhysicalMemory(TUint aOffset,TUint aSize)
       
   104 		{ return DoControl(EInvalidatePinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); }
       
   105 	inline TInt UnpinPhysicalMemory()
       
   106 		{ return DoControl(EUnpinPhysicalMemory); }
       
   107 	inline TInt DestroyPhysicalPinObject()
       
   108 		{ return DoControl(EDestroyPhysicalPinObject); }
       
   109 	inline TInt PinKernelPhysicalMemory()
       
   110 		{ return DoControl(EPinKernelPhysicalMemory); }
       
   111 	inline TBool SetPanicTrace(TBool aEnable)
       
   112 		{ return DoControl(ESetPanicTrace,(TAny*)aEnable); }
       
   113 	inline TInt IsMemoryPresent(const TAny* aPtr)
       
   114 		{ return DoControl(EIsMemoryPresent,(TAny*)aPtr); }
       
   115 #endif
       
   116 	};
       
   117 
       
   118 
       
   119 #endif