|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // e32test\system\t_reason.cpp |
|
15 // Debugging aid which prints the ESHELL startup banner down the serial port, as an |
|
16 // aid to debugging repeated bleep-bleep-bleep restarting. |
|
17 // |
|
18 // |
|
19 |
|
20 #include "e32std.h" |
|
21 #include "e32std_private.h" |
|
22 #include "e32svr.h" |
|
23 #include "e32hal.h" |
|
24 |
|
25 TUint j; |
|
26 |
|
27 TInt E32Main() |
|
28 { |
|
29 |
|
30 FOREVER |
|
31 { |
|
32 TMachineStartupType reason; |
|
33 UserHal::StartupReason(reason); |
|
34 switch (reason) |
|
35 { |
|
36 case EStartupCold: RDebug::Print(_L("Cold Start ")); break; |
|
37 case EStartupColdReset: RDebug::Print(_L("Cold Reset ")); break; |
|
38 case EStartupNewOs: RDebug::Print(_L("New OS ")); break; |
|
39 case EStartupPowerFail: RDebug::Print(_L("Power failed ")); break; |
|
40 case EStartupWarmReset: RDebug::Print(_L("Warm Reset ")); break; |
|
41 case EStartupKernelFault: |
|
42 TInt faultno; |
|
43 UserHal::FaultReason(faultno); |
|
44 if (faultno == 0x10000000) |
|
45 RDebug::Print(_L("Kernel Exception ")); |
|
46 else |
|
47 if (faultno >= 0x10000) |
|
48 RDebug::Print(_L("Kernel PANIC: %d "), faultno-0x10000); |
|
49 else |
|
50 RDebug::Print(_L("Kernel FAULT: %d "), faultno); |
|
51 break; |
|
52 case EStartupSafeReset: RDebug::Print(_L("Safe Reset ")); break; |
|
53 default: |
|
54 RDebug::Print(_L("<?reason=%d> "), reason); |
|
55 break; |
|
56 } |
|
57 |
|
58 if (reason==EStartupWarmReset || reason==EStartupPowerFail || reason==EStartupKernelFault) |
|
59 { |
|
60 TInt exceptno; |
|
61 TExcInfo exceptInfo; |
|
62 UserHal::ExceptionId(exceptno); |
|
63 UserHal::ExceptionInfo(exceptInfo); |
|
64 RDebug::Print(_L("(last exception %d: code %08x data %08x) "), exceptno, exceptInfo.iCodeAddress,exceptInfo.iDataAddress); |
|
65 } |
|
66 |
|
67 RDebug::Print(_L("\r\n\nCopyright (C) 1997-1999 Symbian Ltd\r\n\n")); |
|
68 |
|
69 for (TInt i=0; i<1000000; i++) |
|
70 j=i%17; // waste some time |
|
71 } |
|
72 } |