os/kernelhwsrv/kerneltest/e32test/mmu/d_memorytest.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2004-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_memorytest.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#ifndef __D_MEMORYTEST_H__
sl@0
    19
#define __D_MEMORYTEST_H__
sl@0
    20
sl@0
    21
#include <e32cmn.h>
sl@0
    22
#ifndef __KERNEL_MODE__
sl@0
    23
#include <e32std.h>
sl@0
    24
#endif
sl@0
    25
sl@0
    26
_LIT(KMemoryTestLddName,"d_memorytest");
sl@0
    27
sl@0
    28
const TInt KUCPageCount = 4;//Page count of user chunk used in physical pinning tests.
sl@0
    29
sl@0
    30
class RMemoryTestLdd : public RBusLogicalChannel
sl@0
    31
	{
sl@0
    32
public:
sl@0
    33
	enum TControl
sl@0
    34
		{
sl@0
    35
		EReadWriteMemory,
sl@0
    36
		EReadMemory,
sl@0
    37
		EWriteMemory,
sl@0
    38
		ETestAllocZerosMemory,
sl@0
    39
		ETestReAllocZerosMemory,
sl@0
    40
		ETestAllocPhysTest,
sl@0
    41
		ETestAllocPhysTest1,
sl@0
    42
		ECreateVirtualPinObject,
sl@0
    43
		EPinVirtualMemory,
sl@0
    44
		EUnpinVirtualMemory,
sl@0
    45
		EDestroyVirtualPinObject,
sl@0
    46
		ECreatePhysicalPinObject,
sl@0
    47
		EPinPhysicalMemory,
sl@0
    48
		EPinPhysicalMemoryRO,
sl@0
    49
		ECheckPageList,
sl@0
    50
		ESyncPinnedPhysicalMemory,
sl@0
    51
		EMovePinnedPhysicalMemory,
sl@0
    52
		EInvalidatePinnedPhysicalMemory,
sl@0
    53
		EUnpinPhysicalMemory,
sl@0
    54
		EDestroyPhysicalPinObject,
sl@0
    55
		EPinKernelPhysicalMemory,
sl@0
    56
		ESetPanicTrace,
sl@0
    57
		EIsMemoryPresent,
sl@0
    58
		ECreateKernelMapObject,
sl@0
    59
		EDestroyKernelMapObject,
sl@0
    60
		EKernelMapMemory,
sl@0
    61
		EKernelMapMemoryRO,
sl@0
    62
		EKernelMapMemoryInvalid,
sl@0
    63
		EKernelMapCheckPageList,
sl@0
    64
		EKernelMapSyncMemory,
sl@0
    65
		EKernelMapInvalidateMemory,
sl@0
    66
		EKernelMapMoveMemory,
sl@0
    67
		EKernelMapReadModifyMemory,
sl@0
    68
		EKernelUnmapMemory,
sl@0
    69
		};
sl@0
    70
sl@0
    71
#ifndef __KERNEL_MODE__
sl@0
    72
public:
sl@0
    73
	inline TInt Open()
sl@0
    74
		{
sl@0
    75
		TInt r=User::LoadLogicalDevice(KMemoryTestLddName);
sl@0
    76
		if(r==KErrNone || r==KErrAlreadyExists)
sl@0
    77
			r=DoCreate(KMemoryTestLddName,TVersion(),KNullUnit,NULL,NULL,EOwnerProcess,ETrue);
sl@0
    78
		return r;
sl@0
    79
		};
sl@0
    80
	inline TInt ReadWriteMemory(TAny* aPtr)
sl@0
    81
		{ return DoControl(EReadWriteMemory,aPtr); }
sl@0
    82
	inline TInt ReadMemory(TAny* aPtr,TUint32& aValue)
sl@0
    83
		{ return DoControl(EReadMemory,aPtr,&aValue); }
sl@0
    84
	inline TInt WriteMemory(TAny* aPtr,TUint32 aValue)
sl@0
    85
		{ return DoControl(EWriteMemory,aPtr,(TAny*)aValue); }
sl@0
    86
	inline TInt TestAllocZerosMemory()
sl@0
    87
		{ return DoControl(ETestAllocZerosMemory,NULL,NULL); }
sl@0
    88
	inline TInt TestReAllocZerosMemory()
sl@0
    89
		{ return DoControl(ETestReAllocZerosMemory,NULL,NULL); }
sl@0
    90
	inline TInt AllocPhysTest(TUint32 aIters, TUint32 aSize)
sl@0
    91
		{ return DoControl(ETestAllocPhysTest,(TAny*)aIters, (TAny*)aSize); } 
sl@0
    92
	inline TInt AllocPhysTest1(TUint32 aIters, TUint32 aSize)
sl@0
    93
		{ return DoControl(ETestAllocPhysTest1,(TAny*)aIters, (TAny*)aSize); } 
sl@0
    94
	inline TInt CreateVirtualPinObject()
sl@0
    95
		{ return DoControl(ECreateVirtualPinObject); }
sl@0
    96
	inline TInt PinVirtualMemory(TLinAddr aStart,TUint aSize)
sl@0
    97
		{ return DoControl(EPinVirtualMemory,(TAny*)aStart,(TAny*)aSize); }
sl@0
    98
	inline TInt UnpinVirtualMemory()
sl@0
    99
		{ return DoControl(EUnpinVirtualMemory); }
sl@0
   100
	inline TInt DestroyVirtualPinObject()
sl@0
   101
		{ return DoControl(EDestroyVirtualPinObject); }
sl@0
   102
	inline TInt CreatePhysicalPinObject()
sl@0
   103
		{ return DoControl(ECreatePhysicalPinObject); }
sl@0
   104
	inline TInt PinPhysicalMemory(TLinAddr aStart,TUint aSize)
sl@0
   105
		{ return DoControl(EPinPhysicalMemory,(TAny*)aStart,(TAny*)aSize); }
sl@0
   106
	inline TInt PinPhysicalMemoryRO(TLinAddr aStart,TUint aSize)
sl@0
   107
		{ return DoControl(EPinPhysicalMemoryRO,(TAny*)aStart,(TAny*)aSize); }
sl@0
   108
	inline TInt CheckPageList(TUint8* aStart)
sl@0
   109
		{ return DoControl(ECheckPageList,(TAny*)aStart); }
sl@0
   110
	inline TInt SyncPinnedPhysicalMemory(TUint aOffset,TUint aSize)
sl@0
   111
		{ return DoControl(ESyncPinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); }
sl@0
   112
	inline TInt MovePinnedPhysicalMemory(TInt aPageNumber)
sl@0
   113
		{ return DoControl(EMovePinnedPhysicalMemory,(TAny*)aPageNumber); }
sl@0
   114
	inline TInt InvalidatePinnedPhysicalMemory(TUint aOffset,TUint aSize)
sl@0
   115
		{ return DoControl(EInvalidatePinnedPhysicalMemory,(TAny*)aOffset,(TAny*)aSize); }
sl@0
   116
	inline TInt UnpinPhysicalMemory()
sl@0
   117
		{ return DoControl(EUnpinPhysicalMemory); }
sl@0
   118
	inline TInt DestroyPhysicalPinObject()
sl@0
   119
		{ return DoControl(EDestroyPhysicalPinObject); }
sl@0
   120
	inline TInt PinKernelPhysicalMemory()
sl@0
   121
		{ return DoControl(EPinKernelPhysicalMemory); }
sl@0
   122
	inline TBool SetPanicTrace(TBool aEnable)
sl@0
   123
		{ return DoControl(ESetPanicTrace,(TAny*)aEnable); }
sl@0
   124
	inline TInt IsMemoryPresent(const TAny* aPtr)
sl@0
   125
		{ return DoControl(EIsMemoryPresent,(TAny*)aPtr); }
sl@0
   126
	inline TInt CreateKernelMapObject(TUint aReserveBytes)
sl@0
   127
		{ return DoControl(ECreateKernelMapObject, (TAny*)aReserveBytes); }
sl@0
   128
	inline TInt DestroyKernelMapObject()
sl@0
   129
		{ return DoControl(EDestroyKernelMapObject); }
sl@0
   130
	inline TInt KernelMapMemory(TLinAddr aStart, TUint aSize)
sl@0
   131
		{ return DoControl(EKernelMapMemory,(TAny*)aStart, (TAny*)aSize); }
sl@0
   132
	inline TInt KernelMapMemoryRO(TLinAddr aStart, TUint aSize)
sl@0
   133
		{ return DoControl(EKernelMapMemoryRO,(TAny*)aStart, (TAny*)aSize); }
sl@0
   134
	inline TInt KernelMapMemoryInvalid(TLinAddr aStart, TUint aSize)
sl@0
   135
		{ return DoControl(EKernelMapMemoryInvalid,(TAny*)aStart, (TAny*)aSize); }
sl@0
   136
	inline TInt KernelMapCheckPageList(TUint8* aStart)
sl@0
   137
		{ return DoControl(EKernelMapCheckPageList, (TAny*)aStart); }
sl@0
   138
	inline TInt KernelMapSyncMemory()
sl@0
   139
		{ return DoControl(EKernelMapSyncMemory); }
sl@0
   140
	inline TInt KernelMapInvalidateMemory()
sl@0
   141
		{ return DoControl(EKernelMapInvalidateMemory); }
sl@0
   142
	inline TInt KernelMapMoveMemory(TUint aIndex)
sl@0
   143
		{ return DoControl(EKernelMapMoveMemory, (TAny*)aIndex); }
sl@0
   144
	inline TInt KernelMapReadAndModifyMemory()
sl@0
   145
		{ return DoControl(EKernelMapReadModifyMemory); }
sl@0
   146
	inline TInt KernelUnmapMemory()
sl@0
   147
		{ return DoControl(EKernelUnmapMemory); }
sl@0
   148
#endif
sl@0
   149
	};
sl@0
   150
sl@0
   151
sl@0
   152
#endif