sl@0: // Copyright (c) 1998-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: // template\template_assp\template_assp.cpp sl@0: // sl@0: // sl@0: sl@0: sl@0: #include sl@0: sl@0: //---------------------------------------------------------------------------- sl@0: // Initialisation sl@0: sl@0: void TTemplate::Init3() sl@0: // sl@0: // Phase 3 initialisation sl@0: // sl@0: { sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Initialise any TTemplate class data members here sl@0: // sl@0: sl@0: // Use assp-specific nano wait implementation sl@0: Kern::SetNanoWaitHandler(NanoWait); sl@0: } sl@0: sl@0: EXPORT_C TMachineStartupType TTemplate::StartupReason() sl@0: // sl@0: // Read and return the Startup reason of the Hardware sl@0: // sl@0: { sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Read the Reset reason from the hardware register map it to one of TMachineStartupType enumerated values sl@0: // and return this sl@0: // sl@0: return EStartupCold; // EXAMPLE ONLY sl@0: } sl@0: sl@0: EXPORT_C TInt TTemplate::CpuVersionId() sl@0: // sl@0: // Read and return the the CPU ID sl@0: // sl@0: { sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Read the CPU identification register (if one exists) mask off redundant bits and return this sl@0: // sl@0: return 0; // EXAMPLE ONLY sl@0: } sl@0: sl@0: EXPORT_C TUint TTemplate::DebugPortAddr() sl@0: // sl@0: // Return Linear base address of debug UART (as selected in obey file or with eshell debugport command). sl@0: // sl@0: { sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Read the iDebugPort field of the SuperPage, map the result to the corresponding Serial Port Linear sl@0: // address and return this, like the following EXAMPLE ONLY: sl@0: // sl@0: TUint debugPort; sl@0: switch (Kern::SuperPage().iDebugPort) sl@0: { sl@0: case 1: sl@0: debugPort=KHwBaseSerial1; sl@0: break; sl@0: case 2: sl@0: debugPort=KHwBaseSerial2; sl@0: break; sl@0: case 3: sl@0: debugPort=KHwBaseSerial3; sl@0: break; sl@0: default: sl@0: debugPort=KHwBaseSerial1; sl@0: break; sl@0: } sl@0: return debugPort; sl@0: } sl@0: sl@0: EXPORT_C TUint TTemplate::ProcessorPeriodInPs() sl@0: // sl@0: // Return CPU clock period in picoseconds sl@0: // sl@0: { sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Read the CPU clock speed and return its period in picoseconds. If only a limited range of speeds is possible sl@0: // it is preferable to use the masked speed reading as an index into a look up table containing the corresponding sl@0: // period sl@0: // sl@0: return 0; // EXAMPLE ONLY sl@0: } sl@0: sl@0: EXPORT_C void TTemplate::SetIntMask(TUint aValue) sl@0: // sl@0: // Set the Hardware Interrupt masks sl@0: // sl@0: { sl@0: // the following is EXAMPLE ONLY sl@0: TInt irq=NKern::DisableAllInterrupts(); sl@0: AsspRegister::Write32(KHwInterruptsMaskSet, aValue); sl@0: AsspRegister::Write32(KHwInterruptsMaskClear, ~aValue); sl@0: NKern::RestoreInterrupts(irq); sl@0: } sl@0: sl@0: EXPORT_C void TTemplate::ModifyIntMask(TUint aClearMask,TUint aSetMask) sl@0: // sl@0: // Modify the Hardware Interrupt masks sl@0: // sl@0: { sl@0: // the following is EXAMPLE ONLY sl@0: TInt irq=NKern::DisableAllInterrupts(); sl@0: AsspRegister::Write32(KHwInterruptsMaskSet, aSetMask); sl@0: AsspRegister::Write32(KHwInterruptsMaskClear, ~aClearMask); sl@0: NKern::RestoreInterrupts(irq); sl@0: } sl@0: sl@0: EXPORT_C TUint TTemplate::IntsPending() sl@0: // sl@0: // Return the state of pending interrupts sl@0: // sl@0: { sl@0: // the following is EXAMPLE ONLY sl@0: return(AsspRegister::Read32(KHwInterruptsIrqPending)); sl@0: } sl@0: sl@0: EXPORT_C TUint TTemplate::RtcData() sl@0: // sl@0: // Return the current time of the RTC sl@0: // sl@0: { sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Read the RTC current time register and return this time sl@0: // sl@0: return 0; // EXAMPLE ONLY sl@0: } sl@0: sl@0: EXPORT_C void TTemplate::SetRtcData(TUint aValue) sl@0: // sl@0: // Set the RTC time sl@0: // sl@0: { sl@0: // sl@0: // TO DO: (optional) sl@0: // sl@0: // Set the RTC current time with aValue (may need formatting appropriately) sl@0: // sl@0: } sl@0: sl@0: EXPORT_C TPhysAddr TTemplate::VideoRamPhys() sl@0: // sl@0: // Return the physical address of the video RAM sl@0: // sl@0: { sl@0: return TemplateAssp::VideoRamPhys; sl@0: }