os/kernelhwsrv/kerneltest/e32test/mmu/d_memorytest.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     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 KUCPageCount = 4;//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 		ECreateKernelMapObject,
    59 		EDestroyKernelMapObject,
    60 		EKernelMapMemory,
    61 		EKernelMapMemoryRO,
    62 		EKernelMapMemoryInvalid,
    63 		EKernelMapCheckPageList,
    64 		EKernelMapSyncMemory,
    65 		EKernelMapInvalidateMemory,
    66 		EKernelMapMoveMemory,
    67 		EKernelMapReadModifyMemory,
    68 		EKernelUnmapMemory,
    69 		};
    70 
    71 #ifndef __KERNEL_MODE__
    72 public:
    73 	inline TInt Open()
    74 		{
    75 		TInt r=User::LoadLogicalDevice(KMemoryTestLddName);
    76 		if(r==KErrNone || r==KErrAlreadyExists)
    77 			r=DoCreate(KMemoryTestLddName,TVersion(),KNullUnit,NULL,NULL,EOwnerProcess,ETrue);
    78 		return r;
    79 		};
    80 	inline TInt ReadWriteMemory(TAny* aPtr)
    81 		{ return DoControl(EReadWriteMemory,aPtr); }
    82 	inline TInt ReadMemory(TAny* aPtr,TUint32& aValue)
    83 		{ return DoControl(EReadMemory,aPtr,&aValue); }
    84 	inline TInt WriteMemory(TAny* aPtr,TUint32 aValue)
    85 		{ return DoControl(EWriteMemory,aPtr,(TAny*)aValue); }
    86 	inline TInt TestAllocZerosMemory()
    87 		{ return DoControl(ETestAllocZerosMemory,NULL,NULL); }
    88 	inline TInt TestReAllocZerosMemory()
    89 		{ return DoControl(ETestReAllocZerosMemory,NULL,NULL); }
    90 	inline TInt AllocPhysTest(TUint32 aIters, TUint32 aSize)
    91 		{ return DoControl(ETestAllocPhysTest,(TAny*)aIters, (TAny*)aSize); } 
    92 	inline TInt AllocPhysTest1(TUint32 aIters, TUint32 aSize)
    93 		{ return DoControl(ETestAllocPhysTest1,(TAny*)aIters, (TAny*)aSize); } 
    94 	inline TInt CreateVirtualPinObject()
    95 		{ return DoControl(ECreateVirtualPinObject); }
    96 	inline TInt PinVirtualMemory(TLinAddr aStart,TUint aSize)
    97 		{ return DoControl(EPinVirtualMemory,(TAny*)aStart,(TAny*)aSize); }
    98 	inline TInt UnpinVirtualMemory()
    99 		{ return DoControl(EUnpinVirtualMemory); }
   100 	inline TInt DestroyVirtualPinObject()
   101 		{ return DoControl(EDestroyVirtualPinObject); }
   102 	inline TInt CreatePhysicalPinObject()
   103 		{ return DoControl(ECreatePhysicalPinObject); }
   104 	inline TInt PinPhysicalMemory(TLinAddr aStart,TUint aSize)
   105 		{ return DoControl(EPinPhysicalMemory,(TAny*)aStart,(TAny*)aSize); }
   106 	inline TInt PinPhysicalMemoryRO(TLinAddr aStart,TUint aSize)
   107 		{ return DoControl(EPinPhysicalMemoryRO,(TAny*)aStart,(TAny*)aSize); }
   108 	inline TInt CheckPageList(TUint8* aStart)
   109 		{ return DoControl(ECheckPageList,(TAny*)aStart); }
   110 	inline TInt SyncPinnedPhysicalMemory(TUint aOffset,TUint aSize)
   111 		{ return DoControl(ESyncPinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); }
   112 	inline TInt MovePinnedPhysicalMemory(TInt aPageNumber)
   113 		{ return DoControl(EMovePinnedPhysicalMemory,(TAny*)aPageNumber); }
   114 	inline TInt InvalidatePinnedPhysicalMemory(TUint aOffset,TUint aSize)
   115 		{ return DoControl(EInvalidatePinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); }
   116 	inline TInt UnpinPhysicalMemory()
   117 		{ return DoControl(EUnpinPhysicalMemory); }
   118 	inline TInt DestroyPhysicalPinObject()
   119 		{ return DoControl(EDestroyPhysicalPinObject); }
   120 	inline TInt PinKernelPhysicalMemory()
   121 		{ return DoControl(EPinKernelPhysicalMemory); }
   122 	inline TBool SetPanicTrace(TBool aEnable)
   123 		{ return DoControl(ESetPanicTrace,(TAny*)aEnable); }
   124 	inline TInt IsMemoryPresent(const TAny* aPtr)
   125 		{ return DoControl(EIsMemoryPresent,(TAny*)aPtr); }
   126 	inline TInt CreateKernelMapObject(TUint aReserveBytes)
   127 		{ return DoControl(ECreateKernelMapObject, (TAny*)aReserveBytes); }
   128 	inline TInt DestroyKernelMapObject()
   129 		{ return DoControl(EDestroyKernelMapObject); }
   130 	inline TInt KernelMapMemory(TLinAddr aStart, TUint aSize)
   131 		{ return DoControl(EKernelMapMemory,(TAny*)aStart, (TAny*)aSize); }
   132 	inline TInt KernelMapMemoryRO(TLinAddr aStart, TUint aSize)
   133 		{ return DoControl(EKernelMapMemoryRO,(TAny*)aStart, (TAny*)aSize); }
   134 	inline TInt KernelMapMemoryInvalid(TLinAddr aStart, TUint aSize)
   135 		{ return DoControl(EKernelMapMemoryInvalid,(TAny*)aStart, (TAny*)aSize); }
   136 	inline TInt KernelMapCheckPageList(TUint8* aStart)
   137 		{ return DoControl(EKernelMapCheckPageList, (TAny*)aStart); }
   138 	inline TInt KernelMapSyncMemory()
   139 		{ return DoControl(EKernelMapSyncMemory); }
   140 	inline TInt KernelMapInvalidateMemory()
   141 		{ return DoControl(EKernelMapInvalidateMemory); }
   142 	inline TInt KernelMapMoveMemory(TUint aIndex)
   143 		{ return DoControl(EKernelMapMoveMemory, (TAny*)aIndex); }
   144 	inline TInt KernelMapReadAndModifyMemory()
   145 		{ return DoControl(EKernelMapReadModifyMemory); }
   146 	inline TInt KernelUnmapMemory()
   147 		{ return DoControl(EKernelUnmapMemory); }
   148 #endif
   149 	};
   150 
   151 
   152 #endif