First public contribution.
1 // Copyright (c) 1998-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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // template\template_assp\template_assp.cpp
19 #include <template_assp_priv.h>
21 //----------------------------------------------------------------------------
24 void TTemplate::Init3()
26 // Phase 3 initialisation
32 // Initialise any TTemplate class data members here
35 // Use assp-specific nano wait implementation
36 Kern::SetNanoWaitHandler(NanoWait);
39 EXPORT_C TMachineStartupType TTemplate::StartupReason()
41 // Read and return the Startup reason of the Hardware
47 // Read the Reset reason from the hardware register map it to one of TMachineStartupType enumerated values
50 return EStartupCold; // EXAMPLE ONLY
53 EXPORT_C TInt TTemplate::CpuVersionId()
55 // Read and return the the CPU ID
61 // Read the CPU identification register (if one exists) mask off redundant bits and return this
63 return 0; // EXAMPLE ONLY
66 EXPORT_C TUint TTemplate::DebugPortAddr()
68 // Return Linear base address of debug UART (as selected in obey file or with eshell debugport command).
74 // Read the iDebugPort field of the SuperPage, map the result to the corresponding Serial Port Linear
75 // address and return this, like the following EXAMPLE ONLY:
78 switch (Kern::SuperPage().iDebugPort)
81 debugPort=KHwBaseSerial1;
84 debugPort=KHwBaseSerial2;
87 debugPort=KHwBaseSerial3;
90 debugPort=KHwBaseSerial1;
96 EXPORT_C TUint TTemplate::ProcessorPeriodInPs()
98 // Return CPU clock period in picoseconds
104 // Read the CPU clock speed and return its period in picoseconds. If only a limited range of speeds is possible
105 // it is preferable to use the masked speed reading as an index into a look up table containing the corresponding
108 return 0; // EXAMPLE ONLY
111 EXPORT_C void TTemplate::SetIntMask(TUint aValue)
113 // Set the Hardware Interrupt masks
116 // the following is EXAMPLE ONLY
117 TInt irq=NKern::DisableAllInterrupts();
118 AsspRegister::Write32(KHwInterruptsMaskSet, aValue);
119 AsspRegister::Write32(KHwInterruptsMaskClear, ~aValue);
120 NKern::RestoreInterrupts(irq);
123 EXPORT_C void TTemplate::ModifyIntMask(TUint aClearMask,TUint aSetMask)
125 // Modify the Hardware Interrupt masks
128 // the following is EXAMPLE ONLY
129 TInt irq=NKern::DisableAllInterrupts();
130 AsspRegister::Write32(KHwInterruptsMaskSet, aSetMask);
131 AsspRegister::Write32(KHwInterruptsMaskClear, ~aClearMask);
132 NKern::RestoreInterrupts(irq);
135 EXPORT_C TUint TTemplate::IntsPending()
137 // Return the state of pending interrupts
140 // the following is EXAMPLE ONLY
141 return(AsspRegister::Read32(KHwInterruptsIrqPending));
144 EXPORT_C TUint TTemplate::RtcData()
146 // Return the current time of the RTC
152 // Read the RTC current time register and return this time
154 return 0; // EXAMPLE ONLY
157 EXPORT_C void TTemplate::SetRtcData(TUint aValue)
165 // Set the RTC current time with aValue (may need formatting appropriately)
169 EXPORT_C TPhysAddr TTemplate::VideoRamPhys()
171 // Return the physical address of the video RAM
174 return TemplateAssp::VideoRamPhys;