diff -r 000000000000 -r 96e5fb8b040d kerneltest/e32test/mmu/t_ramall.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kerneltest/e32test/mmu/t_ramall.cpp Thu Dec 17 09:24:54 2009 +0200 @@ -0,0 +1,155 @@ +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: +// e32test\mmu\t_ramall.cpp +// +// + +#define __E32TEST_EXTENSION__ + +#include +#include +#include +#include "d_shadow.h" +#include "mmudetect.h" +#include "freeram.h" + +LOCAL_D RTest test(_L("T_RAMALL")); + +_LIT(KLddFileName,"D_SHADOW.LDD"); + +TInt PageSize; +TInt PageShift; +RShadow Shadow; +TInt InitFreeRam; + +TInt AllocPhysicalRam(TUint32& aAddr, TInt aSize, TInt aAlign) + { + return Shadow.AllocPhysicalRam(aAddr,aSize,aAlign); + } + +TInt FreePhysicalRam(TUint32 aAddr, TInt aSize) + { + return Shadow.FreePhysicalRam(aAddr,aSize); + } + +TInt ClaimPhysicalRam(TUint32 aAddr, TInt aSize) + { + return Shadow.ClaimPhysicalRam(aAddr,aSize); + } + +void TestAlignedAllocs() + { + TInt align; + TInt size; + for (align=PageShift; align<=20; ++align) + { + for (size=PageSize; size<=0x100000; size+=PageSize) + { + TInt free=FreeRam(); + TUint32 pa=0; + TInt r=AllocPhysicalRam(pa,size,align); + test.Printf(_L("Size %08x Align %d r=%d pa=%08x\n"),size,align,r,pa); + if (r==KErrNone) + { + TUint32 as=1u<>=1, ++PageShift); + + InitFreeRam=FreeRam(); + test.Printf(_L("Free RAM=%08x, Page size=%x, Page shift=%d\n"),InitFreeRam,PageSize,PageShift); + + test.Next(_L("Open test LDD")); + r=Shadow.Open(); + test(r==KErrNone); + + test.Next(_L("TestAlignedAllocs")); + TestAlignedAllocs(); + + test.Next(_L("TestClaimPhys")); + TestClaimPhys(); + + Shadow.Close(); + test.End(); + return(KErrNone); + } +