1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kerneltest/e32test/system/t_inf.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,122 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// e32test\system\t_inf.cpp
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32test.h>
1.22 +#include <e32hal.h>
1.23 +
1.24 +LOCAL_D RTest test(_L("T_INF"));
1.25 +
1.26 +LOCAL_C const TPtrC onOff(TBool aSwitch)
1.27 +//
1.28 +// Convert to On/Off text.
1.29 +//
1.30 + {
1.31 +
1.32 + return(aSwitch ? _L("On") : _L("Off"));
1.33 + }
1.34 +
1.35 +LOCAL_C const TPtrC yesNo(TBool aSwitch)
1.36 +//
1.37 +// Convert to Yes/No text.
1.38 +//
1.39 + {
1.40 +
1.41 + return(aSwitch ? _L("Yes") : _L("No"));
1.42 + }
1.43 +
1.44 +LOCAL_C void testInfo()
1.45 +//
1.46 +// Test the HAL info.
1.47 +//
1.48 + {
1.49 +
1.50 + TInt pageSize=0;
1.51 + UserHal::PageSizeInBytes(pageSize);
1.52 +
1.53 + TMemoryInfoV1Buf membuf;
1.54 + UserHal::MemoryInfo(membuf);
1.55 + TMemoryInfoV1& memoryInfo=*(TMemoryInfoV1*)membuf.Ptr();
1.56 +
1.57 + test.Printf(_L("Allocate some memory & check RAM goes down"));
1.58 +#if !defined(__WINS__)
1.59 + TInt freeMem=memoryInfo.iFreeRamInBytes;
1.60 +#endif
1.61 + TInt8* someMem = new TInt8[0x4000];
1.62 + UserHal::MemoryInfo(membuf);
1.63 + delete someMem;
1.64 +#if !defined(__WINS__)
1.65 + test(freeMem>memoryInfo.iFreeRamInBytes);
1.66 +#endif
1.67 +
1.68 + test.Printf(_L("Total RAM size= %- 5dKBytes : Free RAM size = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024);
1.69 + test.Printf(_L("Max free RAM = %- 5dKBytes : ROM size = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024);
1.70 + test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024);
1.71 +
1.72 + TMachineInfoV2Buf mbuf;
1.73 + UserHal::MachineInfo(mbuf);
1.74 + TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr();
1.75 +
1.76 + TName tn = machineInfo.iRomVersion.Name();
1.77 + test.Printf(_L("Page Size = %- 16d : Rom version = %- 16S\n"),pageSize,&tn);
1.78 + test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY);
1.79 +
1.80 + TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__
1.81 +
1.82 + TPtrC t1=onOff(password);
1.83 + TPtrC t2=yesNo(machineInfo.iBacklightPresent);
1.84 + test.Printf(_L("Password = %- 16S : BacklightPresent= %S\n"),&t1,&t2);
1.85 + test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex);
1.86 +
1.87 + TRomInfoV1Buf rombuf;
1.88 + TRomInfoV1& rom=rombuf();
1.89 + if (UserHal::RomInfo(rombuf)==KErrNone) // KErrNotSupported in WINS
1.90 + {
1.91 + test.Getch();
1.92 + TInt i, j;
1.93 + j=0;
1.94 + for( i=2; i<8; i++ )
1.95 + {
1.96 + j |= rom.iEntry[i].iSize;
1.97 + j |= rom.iEntry[i].iWidth;
1.98 + j |= rom.iEntry[i].iSpeed;
1.99 + j |= (TInt)rom.iEntry[i].iType;
1.100 + }
1.101 + test(j==0); // check that CS2-7 entries left blank
1.102 + test.Printf(_L("CS0 ROM size %08X\n"), rom.iEntry[0].iSize );
1.103 + test.Printf(_L("CS0 ROM width %d\n"), rom.iEntry[0].iWidth );
1.104 + test.Printf(_L("CS0 ROM speed %d\n"), rom.iEntry[0].iSpeed );
1.105 + test.Printf(_L("CS0 ROM type %d\n"), rom.iEntry[0].iType );
1.106 + test.Printf(_L("CS1 ROM size %08X\n"), rom.iEntry[1].iSize );
1.107 + test.Printf(_L("CS1 ROM width %d\n"), rom.iEntry[1].iWidth );
1.108 + test.Printf(_L("CS1 ROM speed %d\n"), rom.iEntry[1].iSpeed );
1.109 + test.Printf(_L("CS1 ROM type %d\n"), rom.iEntry[1].iType );
1.110 + }
1.111 + }
1.112 +
1.113 +GLDEF_C TInt E32Main()
1.114 +//
1.115 +// Display system information
1.116 +//
1.117 + {
1.118 +
1.119 + test.Title();
1.120 + testInfo();
1.121 + test.Getch();
1.122 + return(KErrNone);
1.123 + }
1.124 +
1.125 +