sl@0: // Copyright (c) 1997-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\t_ramall.cpp sl@0: // sl@0: // sl@0: sl@0: #define __E32TEST_EXTENSION__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include "d_shadow.h" sl@0: #include "mmudetect.h" sl@0: #include "freeram.h" sl@0: sl@0: LOCAL_D RTest test(_L("T_RAMALL")); sl@0: sl@0: _LIT(KLddFileName,"D_SHADOW.LDD"); sl@0: sl@0: TInt PageSize; sl@0: TInt PageShift; sl@0: RShadow Shadow; sl@0: TInt InitFreeRam; sl@0: sl@0: TInt AllocPhysicalRam(TUint32& aAddr, TInt aSize, TInt aAlign) sl@0: { sl@0: return Shadow.AllocPhysicalRam(aAddr,aSize,aAlign); sl@0: } sl@0: sl@0: TInt FreePhysicalRam(TUint32 aAddr, TInt aSize) sl@0: { sl@0: return Shadow.FreePhysicalRam(aAddr,aSize); sl@0: } sl@0: sl@0: TInt ClaimPhysicalRam(TUint32 aAddr, TInt aSize) sl@0: { sl@0: return Shadow.ClaimPhysicalRam(aAddr,aSize); sl@0: } sl@0: sl@0: void TestAlignedAllocs() sl@0: { sl@0: TInt align; sl@0: TInt size; sl@0: for (align=PageShift; align<=20; ++align) sl@0: { sl@0: for (size=PageSize; size<=0x100000; size+=PageSize) sl@0: { sl@0: TInt free=FreeRam(); sl@0: TUint32 pa=0; sl@0: TInt r=AllocPhysicalRam(pa,size,align); sl@0: test.Printf(_L("Size %08x Align %d r=%d pa=%08x\n"),size,align,r,pa); sl@0: if (r==KErrNone) sl@0: { sl@0: TUint32 as=1u<>=1, ++PageShift); sl@0: sl@0: InitFreeRam=FreeRam(); sl@0: test.Printf(_L("Free RAM=%08x, Page size=%x, Page shift=%d\n"),InitFreeRam,PageSize,PageShift); sl@0: sl@0: test.Next(_L("Open test LDD")); sl@0: r=Shadow.Open(); sl@0: test(r==KErrNone); sl@0: sl@0: test.Next(_L("TestAlignedAllocs")); sl@0: TestAlignedAllocs(); sl@0: sl@0: test.Next(_L("TestClaimPhys")); sl@0: TestClaimPhys(); sl@0: sl@0: Shadow.Close(); sl@0: test.End(); sl@0: return(KErrNone); sl@0: } sl@0: