|
1 /* |
|
2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <e32hal.h> |
|
19 #include <s32file.h> |
|
20 #include "eiksvprv.h" |
|
21 #include <eiksrvui.rsg> |
|
22 #include "eiksrv.hrh" |
|
23 #include <hal.h> |
|
24 #include <hal_data.h> |
|
25 #include <aknnotecontrol.h> |
|
26 |
|
27 // =================== |
|
28 // CEikServPanicScreen |
|
29 // =================== |
|
30 |
|
31 CEikServPanicScreen::CEikServPanicScreen(RThread& aThread) : iThread(aThread) |
|
32 { |
|
33 SetGloballyCapturing(ETrue); |
|
34 } |
|
35 |
|
36 void CEikServPanicScreen::PreLayoutDynInitL() |
|
37 { |
|
38 CAknNoteControl* note = STATIC_CAST(CAknNoteControl*, Control(EESrvDlgPanicName)); |
|
39 TBuf<64> programName; |
|
40 TBuf<64> reasonCategory; |
|
41 TBuf<64> reasonCode; |
|
42 iEikonEnv->ReadResource(programName, R_EIKSERV_PANIC_DIALOG_NAME); |
|
43 iEikonEnv->ReadResource(reasonCategory, R_EIKSERV_PANIC_DIALOG_CATEGORY); |
|
44 iEikonEnv->ReadResource(reasonCode, R_EIKSERV_PANIC_DIALOG_CODE); |
|
45 programName.Append(iThread.Name()); |
|
46 reasonCategory.Append(iThread.ExitCategory()); |
|
47 reasonCode.AppendNum(iThread.ExitReason()); |
|
48 note->UpdateLabelsL(programName, reasonCategory, reasonCode); |
|
49 } |
|
50 |
|
51 // ========================= |
|
52 // CEikServResetReasonDialog |
|
53 // ========================= |
|
54 |
|
55 // Populate the dialog with reset info. |
|
56 // Debug & tech support use only - hence hard coded text. |
|
57 void CEikServResetReasonDialog::PreLayoutDynInitL() |
|
58 { |
|
59 TInt reason; |
|
60 HAL::Get(HAL::ESystemStartupReason,reason); |
|
61 TBuf<80> reasonBuf; |
|
62 TExcInfo exceptInfo; |
|
63 UserHal::ExceptionInfo(exceptInfo); |
|
64 _LIT(KReasonColdStart,"Cold Start"); |
|
65 _LIT(KReasonColdReset,"Cold Reset"); |
|
66 _LIT(KReasonNewOs,"New OS"); |
|
67 _LIT(KReasonPowerFail,"Power failed"); |
|
68 _LIT(KReasonarmReset,"Warm Reset"); |
|
69 switch (reason) |
|
70 { |
|
71 case EStartupCold: |
|
72 reasonBuf = KReasonColdStart; |
|
73 break; |
|
74 case EStartupColdReset: |
|
75 reasonBuf = KReasonColdReset; |
|
76 break; |
|
77 case EStartupNewOs: |
|
78 reasonBuf = KReasonNewOs; |
|
79 break; |
|
80 case EStartupPowerFail: |
|
81 reasonBuf = KReasonPowerFail; |
|
82 break; |
|
83 case EStartupWarmReset: |
|
84 reasonBuf = KReasonarmReset; |
|
85 break; |
|
86 case EStartupKernelFault: |
|
87 { |
|
88 TUint32 decode[3]; |
|
89 decode[0] = TUint32(exceptInfo.iCodeAddress); |
|
90 decode[1] = TUint32(exceptInfo.iDataAddress); |
|
91 decode[2] = 0; |
|
92 |
|
93 // Interpret decode as a null-terminated string. |
|
94 TPtrC category((TText*)&decode[0]); |
|
95 TInt faultno; |
|
96 UserHal::FaultReason(faultno); |
|
97 |
|
98 if (faultno == 0x10000000) |
|
99 { |
|
100 _LIT(KReason,"Kernel Exception"); |
|
101 reasonBuf=(KReason); |
|
102 } |
|
103 else if (faultno >= 0x10000) |
|
104 { |
|
105 _LIT(KReason,"Kernel PANIC: %d %S "); |
|
106 reasonBuf.Format(KReason, faultno-0x10000,&category); |
|
107 } |
|
108 else |
|
109 { |
|
110 _LIT(KReason,"Kernel FAULT: %d %S "); |
|
111 reasonBuf.Format(KReason, faultno,&category); |
|
112 } |
|
113 } |
|
114 break; |
|
115 default: |
|
116 reasonBuf.Num((TInt)reason); |
|
117 break; |
|
118 } |
|
119 |
|
120 SetLabelL(EESrvResetInfoReason, reasonBuf); |
|
121 |
|
122 // Last exception. |
|
123 if (reason >= EStartupPowerFail) |
|
124 { |
|
125 TBuf<80> lastExceptBuf; |
|
126 TInt exceptno; |
|
127 UserHal::ExceptionId(exceptno); |
|
128 _LIT(KFormat,"(No. %d: Code 0x%08x Data 0x%08x) "); |
|
129 lastExceptBuf.Format(KFormat, exceptno, exceptInfo.iCodeAddress, exceptInfo.iDataAddress); |
|
130 SetLabelL(EESrvResetInfoLastException, lastExceptBuf); |
|
131 } |
|
132 else |
|
133 { |
|
134 SetLineDimmedNow(EESrvResetInfoLastException, ETrue); |
|
135 } |
|
136 } |
|
137 |
|
138 // End of file |