Update contrib.
1 // Copyright (c) 1997-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\drvdump.cpp
22 RTest test(_L("DriveDump"));
27 TBool SerialOut=ETrue;
32 TInt r=D.Connect(Drive, Changed);
38 return (TInt)C->Getch();
41 void Print(const TDesC& aDes)
45 RDebug::RawPrint(aDes);
48 void putc(TUint aChar)
61 void PrintLine(const TDesC& aDes)
67 void Dump(const TAny* aStart, TInt aLength, const TInt64& aAddr)
71 TUint a=(TUint)aStart;
77 out.AppendNum(I64HIGH(da),EHex);
78 out.AppendNumFixedWidth(I64LOW(da), EHex,8);
83 TUint8 c=*(TUint8*)(a+b);
84 out.AppendNumFixedWidth(c,EHex,2);
88 if (c<0x20 || c>=0x7f)
90 ascii.Append(TChar(c));
100 void ReadDrive(TAny* aDest, const TInt64& aPos, TInt aSize)
103 TPtr8 p((TUint8*)aDest, 0, aSize);
104 TInt r=D.Read(pos, aSize, p);
107 test.Printf(_L("r=%d\n"), r);
120 User::CommandLine(cmdBuf);
123 test(cmd.Val(Drive)==KErrNone);
125 test(cmd.Val(pos,EHex)==KErrNone);
127 test(cmd.Val(size,EHex)==KErrNone);
129 TUint8* buf=(TUint8*)User::Alloc(size);
134 out.Format(_L("Drive %d"),Drive);
137 ReadDrive(buf, pos, size);
138 Dump(buf, size, pos);