sl@0
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// e32test\system\t_reason.cpp
|
sl@0
|
15 |
// Debugging aid which prints the ESHELL startup banner down the serial port, as an
|
sl@0
|
16 |
// aid to debugging repeated bleep-bleep-bleep restarting.
|
sl@0
|
17 |
//
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
#include "e32std.h"
|
sl@0
|
21 |
#include "e32std_private.h"
|
sl@0
|
22 |
#include "e32svr.h"
|
sl@0
|
23 |
#include "e32hal.h"
|
sl@0
|
24 |
|
sl@0
|
25 |
TUint j;
|
sl@0
|
26 |
|
sl@0
|
27 |
TInt E32Main()
|
sl@0
|
28 |
{
|
sl@0
|
29 |
|
sl@0
|
30 |
FOREVER
|
sl@0
|
31 |
{
|
sl@0
|
32 |
TMachineStartupType reason;
|
sl@0
|
33 |
UserHal::StartupReason(reason);
|
sl@0
|
34 |
switch (reason)
|
sl@0
|
35 |
{
|
sl@0
|
36 |
case EStartupCold: RDebug::Print(_L("Cold Start ")); break;
|
sl@0
|
37 |
case EStartupColdReset: RDebug::Print(_L("Cold Reset ")); break;
|
sl@0
|
38 |
case EStartupNewOs: RDebug::Print(_L("New OS ")); break;
|
sl@0
|
39 |
case EStartupPowerFail: RDebug::Print(_L("Power failed ")); break;
|
sl@0
|
40 |
case EStartupWarmReset: RDebug::Print(_L("Warm Reset ")); break;
|
sl@0
|
41 |
case EStartupKernelFault:
|
sl@0
|
42 |
TInt faultno;
|
sl@0
|
43 |
UserHal::FaultReason(faultno);
|
sl@0
|
44 |
if (faultno == 0x10000000)
|
sl@0
|
45 |
RDebug::Print(_L("Kernel Exception "));
|
sl@0
|
46 |
else
|
sl@0
|
47 |
if (faultno >= 0x10000)
|
sl@0
|
48 |
RDebug::Print(_L("Kernel PANIC: %d "), faultno-0x10000);
|
sl@0
|
49 |
else
|
sl@0
|
50 |
RDebug::Print(_L("Kernel FAULT: %d "), faultno);
|
sl@0
|
51 |
break;
|
sl@0
|
52 |
case EStartupSafeReset: RDebug::Print(_L("Safe Reset ")); break;
|
sl@0
|
53 |
default:
|
sl@0
|
54 |
RDebug::Print(_L("<?reason=%d> "), reason);
|
sl@0
|
55 |
break;
|
sl@0
|
56 |
}
|
sl@0
|
57 |
|
sl@0
|
58 |
if (reason==EStartupWarmReset || reason==EStartupPowerFail || reason==EStartupKernelFault)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
TInt exceptno;
|
sl@0
|
61 |
TExcInfo exceptInfo;
|
sl@0
|
62 |
UserHal::ExceptionId(exceptno);
|
sl@0
|
63 |
UserHal::ExceptionInfo(exceptInfo);
|
sl@0
|
64 |
RDebug::Print(_L("(last exception %d: code %08x data %08x) "), exceptno, exceptInfo.iCodeAddress,exceptInfo.iDataAddress);
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
RDebug::Print(_L("\r\n\nCopyright (C) 1997-1999 Symbian Ltd\r\n\n"));
|
sl@0
|
68 |
|
sl@0
|
69 |
for (TInt i=0; i<1000000; i++)
|
sl@0
|
70 |
j=i%17; // waste some time
|
sl@0
|
71 |
}
|
sl@0
|
72 |
}
|