sl@0: // Copyright (c) 1998-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\misc\t_ramuse.cpp sl@0: // sl@0: // sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: LOCAL_D RTest test(_L("T_ROMCHK")); sl@0: sl@0: TUint Check(const TUint32* aPtr, TInt aSize) sl@0: { sl@0: TUint sum=0; sl@0: aSize/=4; sl@0: while (aSize-->0) sl@0: sum+=*aPtr++; sl@0: return sum; sl@0: } sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: test.Title(); sl@0: test.Start(_L("Checking ROM contents...")); sl@0: sl@0: const TRomHeader* romHdr = (const TRomHeader*)UserSvr::RomHeaderAddress(); sl@0: if(!romHdr) sl@0: test.Printf(_L("No ROM Header found!")); sl@0: else sl@0: { sl@0: TInt size = romHdr->iUncompressedSize; sl@0: const TUint32* addr = (TUint32*)romHdr; sl@0: test.Printf(_L("ROM at %x, size %x\n"),addr,size); sl@0: sl@0: TUint checkSum = Check(addr,size); sl@0: sl@0: // hack the checksum because ROMBUILD is broken sl@0: checkSum -= (romHdr->iRomSize-size)/4; // adjust for missing 0xffffffff sl@0: checkSum -= romHdr->iCompressionType; sl@0: checkSum -= romHdr->iCompressedSize; sl@0: checkSum -= romHdr->iUncompressedSize; sl@0: sl@0: TUint expectedChecksum = 0x12345678; sl@0: test.Printf(_L("Checksum = %8x, expected %8x\n"),checkSum,expectedChecksum); sl@0: test(checkSum==expectedChecksum); sl@0: } sl@0: sl@0: test.End(); sl@0: return 0; sl@0: }