First public contribution.
1 // Copyright (c) 1998-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\misc\t_mem.cpp
20 #include "../misc/prbs.h"
22 RTest test(_L("T_MEM"));
27 test.Start(_L("Create chunk"));
29 TPckg<TMemoryInfoV1> infoPckg(minfo);
30 TInt r = UserHal::MemoryInfo(infoPckg);
32 test.Printf(_L("MaxFree = %08x\n"), minfo.iMaxFreeRamInBytes);
33 test.Printf(_L("Free = %08x\n"), minfo.iFreeRamInBytes);
34 TInt overhead = ((minfo.iFreeRamInBytes + 0x003FFFFF)>>22)<<12;
35 test.Printf(_L("Overhead = %08x\n"), overhead);
36 TInt size = Min(minfo.iFreeRamInBytes-0x00100000, minfo.iFreeRamInBytes-overhead);
37 test.Printf(_L("Initial = %08x\n"), size);
39 r=c.CreateLocal(size, minfo.iFreeRamInBytes);
43 r = c.Adjust(size + 0x1000);
47 test.Printf(_L("Final = %08x\n"), size);
50 seed[0]=User::NTickCount();
53 test.Printf(_L("Chunk Base %08x\n"),p);
55 TInt sizepg = size>>12;
62 TUint init=Random(seed);
66 TUint* pW=(TUint*)(p+offset);
69 for (i=1; i<1024; i++)
77 pW=(TUint*)(p+offset);
80 for (i=1; i<1024; i++)
83 TUint expected=Random(seed2);
84 TUint diff = actual ^ expected;
87 test.Printf(_L("Address %08x: Got %08x Expected %08x Diff %08x\n"),pW-1,actual,expected,diff);
95 if ((iterations & 0x3ff)==0)
96 test.Printf(_L("%u\n"),iterations);