sl@0: // Copyright (c) 1997-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\system\t_reason.cpp sl@0: // Debugging aid which prints the ESHELL startup banner down the serial port, as an sl@0: // aid to debugging repeated bleep-bleep-bleep restarting. sl@0: // sl@0: // sl@0: sl@0: #include "e32std.h" sl@0: #include "e32std_private.h" sl@0: #include "e32svr.h" sl@0: #include "e32hal.h" sl@0: sl@0: TUint j; sl@0: sl@0: TInt E32Main() sl@0: { sl@0: sl@0: FOREVER sl@0: { sl@0: TMachineStartupType reason; sl@0: UserHal::StartupReason(reason); sl@0: switch (reason) sl@0: { sl@0: case EStartupCold: RDebug::Print(_L("Cold Start ")); break; sl@0: case EStartupColdReset: RDebug::Print(_L("Cold Reset ")); break; sl@0: case EStartupNewOs: RDebug::Print(_L("New OS ")); break; sl@0: case EStartupPowerFail: RDebug::Print(_L("Power failed ")); break; sl@0: case EStartupWarmReset: RDebug::Print(_L("Warm Reset ")); break; sl@0: case EStartupKernelFault: sl@0: TInt faultno; sl@0: UserHal::FaultReason(faultno); sl@0: if (faultno == 0x10000000) sl@0: RDebug::Print(_L("Kernel Exception ")); sl@0: else sl@0: if (faultno >= 0x10000) sl@0: RDebug::Print(_L("Kernel PANIC: %d "), faultno-0x10000); sl@0: else sl@0: RDebug::Print(_L("Kernel FAULT: %d "), faultno); sl@0: break; sl@0: case EStartupSafeReset: RDebug::Print(_L("Safe Reset ")); break; sl@0: default: sl@0: RDebug::Print(_L(" "), reason); sl@0: break; sl@0: } sl@0: sl@0: if (reason==EStartupWarmReset || reason==EStartupPowerFail || reason==EStartupKernelFault) sl@0: { sl@0: TInt exceptno; sl@0: TExcInfo exceptInfo; sl@0: UserHal::ExceptionId(exceptno); sl@0: UserHal::ExceptionInfo(exceptInfo); sl@0: RDebug::Print(_L("(last exception %d: code %08x data %08x) "), exceptno, exceptInfo.iCodeAddress,exceptInfo.iDataAddress); sl@0: } sl@0: sl@0: RDebug::Print(_L("\r\n\nCopyright (C) 1997-1999 Symbian Ltd\r\n\n")); sl@0: sl@0: for (TInt i=0; i<1000000; i++) sl@0: j=i%17; // waste some time sl@0: } sl@0: }