54 test.Printf(_L("Allocate some memory & check RAM goes down")); |
54 test.Printf(_L("Allocate some memory & check RAM goes down")); |
55 #if !defined(__WINS__) |
55 #if !defined(__WINS__) |
56 TInt freeMem=memoryInfo.iFreeRamInBytes; |
56 TInt freeMem=memoryInfo.iFreeRamInBytes; |
57 #endif |
57 #endif |
58 TInt8* someMem = new TInt8[0x4000]; |
58 TInt8* someMem = new TInt8[0x4000]; |
59 // make an access to each page in order to get pages actually allocated also on data paged systems |
|
60 someMem[0]=1; |
|
61 someMem[0x1000]=2; |
|
62 someMem[0x2000]=3; |
|
63 someMem[0x3000]=4; |
|
64 UserHal::MemoryInfo(membuf); |
59 UserHal::MemoryInfo(membuf); |
65 delete someMem; |
60 delete someMem; |
66 #if !defined(__WINS__) |
61 #if !defined(__WINS__) |
67 if (!(freeMem>memoryInfo.iFreeRamInBytes)) |
62 test(freeMem>memoryInfo.iFreeRamInBytes); |
68 test.Printf(_L("Warning: free RAM value didn't go down")); |
|
69 #endif |
63 #endif |
70 |
64 |
71 test.Printf(_L("Total RAM size= %- 5dKBytes : Free RAM size = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024); |
65 test.Printf(_L("Total RAM size= %- 5dKBytes : Free RAM size = %- 5dKBytes\n"),memoryInfo.iTotalRamInBytes/1024,memoryInfo.iFreeRamInBytes/1024); |
72 test.Printf(_L("Max free RAM = %- 5dKBytes : ROM size = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024); |
66 test.Printf(_L("Max free RAM = %- 5dKBytes : ROM size = %- 5dKBytes\n"),memoryInfo.iMaxFreeRamInBytes/1024,memoryInfo.iTotalRomInBytes/1024); |
73 test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024); |
67 test.Printf(_L("RAM disk size = %- 5dKBytes\n"),memoryInfo.iInternalDiskRamInBytes/1024); |
74 |
68 |
75 test.Next(_L("Test UserHal::MachineInfo")); |
|
76 |
|
77 TMachineInfoV2Buf mbuf; |
69 TMachineInfoV2Buf mbuf; |
78 UserHal::MachineInfo(mbuf); |
70 UserHal::MachineInfo(mbuf); |
79 TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr(); |
71 TMachineInfoV2& machineInfo=*(TMachineInfoV2*)mbuf.Ptr(); |
80 |
72 |
81 TName tn = machineInfo.iRomVersion.Name(); |
73 TName tn = machineInfo.iRomVersion.Name(); |
82 test.Printf(_L("Page Size = %- 16d : Rom version = %- 16S\n"),pageSize,&tn); |
74 test.Printf(_L("Page Size = %- 16d : Rom version = %- 16S\n"),pageSize,&tn); |
83 test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY); |
75 test.Printf(_L("ScreenOffsetX = %- 16d : ScreenOffsetY = %- 16d\n"),machineInfo.iOffsetToDisplayInPixels.iX,machineInfo.iOffsetToDisplayInPixels.iY); |
84 |
76 |
85 TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__ |
77 TBool password=EFalse; // Password::IsEnabled(); This API was removed by __SECURE_API__ |
86 |
78 |
87 TPtrC t1=onOff(password); |
79 TPtrC t1=onOff(password); |
88 TPtrC t2=yesNo(machineInfo.iBacklightPresent); |
80 TPtrC t2=yesNo(machineInfo.iBacklightPresent); |
89 |
|
90 test.Printf(_L("Password = %- 16S : BacklightPresent= %S\n"),&t1,&t2); |
81 test.Printf(_L("Password = %- 16S : BacklightPresent= %S\n"),&t1,&t2); |
91 test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex); |
82 test.Printf(_L("LanguageIndex = %- 16d : KeyboardIndex = %d\n"),machineInfo.iLanguageIndex,machineInfo.iKeyboardIndex); |
92 |
83 |
93 test.Next(_L("Test deprecated UserHal::RomInfo API")); |
|
94 TRomInfoV1Buf rombuf; |
84 TRomInfoV1Buf rombuf; |
95 test(UserHal::RomInfo(rombuf)==KErrNotSupported); // kernel side API has been deprecated |
85 TRomInfoV1& rom=rombuf(); |
|
86 if (UserHal::RomInfo(rombuf)==KErrNone) // KErrNotSupported in WINS |
|
87 { |
|
88 test.Getch(); |
|
89 TInt i, j; |
|
90 j=0; |
|
91 for( i=2; i<8; i++ ) |
|
92 { |
|
93 j |= rom.iEntry[i].iSize; |
|
94 j |= rom.iEntry[i].iWidth; |
|
95 j |= rom.iEntry[i].iSpeed; |
|
96 j |= (TInt)rom.iEntry[i].iType; |
|
97 } |
|
98 test(j==0); // check that CS2-7 entries left blank |
|
99 test.Printf(_L("CS0 ROM size %08X\n"), rom.iEntry[0].iSize ); |
|
100 test.Printf(_L("CS0 ROM width %d\n"), rom.iEntry[0].iWidth ); |
|
101 test.Printf(_L("CS0 ROM speed %d\n"), rom.iEntry[0].iSpeed ); |
|
102 test.Printf(_L("CS0 ROM type %d\n"), rom.iEntry[0].iType ); |
|
103 test.Printf(_L("CS1 ROM size %08X\n"), rom.iEntry[1].iSize ); |
|
104 test.Printf(_L("CS1 ROM width %d\n"), rom.iEntry[1].iWidth ); |
|
105 test.Printf(_L("CS1 ROM speed %d\n"), rom.iEntry[1].iSpeed ); |
|
106 test.Printf(_L("CS1 ROM type %d\n"), rom.iEntry[1].iType ); |
|
107 } |
96 } |
108 } |
97 |
109 |
98 GLDEF_C TInt E32Main() |
110 GLDEF_C TInt E32Main() |
99 // |
111 // |
100 // Display system information |
112 // Display system information |
101 // |
113 // |
102 { |
114 { |
|
115 |
103 test.Title(); |
116 test.Title(); |
104 test.Start(_L("Test UserHal info APIs")); |
|
105 testInfo(); |
117 testInfo(); |
106 test.End(); |
118 test.Getch(); |
107 return(KErrNone); |
119 return(KErrNone); |
108 } |
120 } |
109 |
121 |
110 |
122 |