|
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". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // template\template_assp\template_assp.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 #include <template_assp_priv.h> |
|
20 |
|
21 //---------------------------------------------------------------------------- |
|
22 // Initialisation |
|
23 |
|
24 void TTemplate::Init3() |
|
25 // |
|
26 // Phase 3 initialisation |
|
27 // |
|
28 { |
|
29 // |
|
30 // TO DO: (optional) |
|
31 // |
|
32 // Initialise any TTemplate class data members here |
|
33 // |
|
34 |
|
35 // Use assp-specific nano wait implementation |
|
36 Kern::SetNanoWaitHandler(NanoWait); |
|
37 } |
|
38 |
|
39 EXPORT_C TMachineStartupType TTemplate::StartupReason() |
|
40 // |
|
41 // Read and return the Startup reason of the Hardware |
|
42 // |
|
43 { |
|
44 // |
|
45 // TO DO: (optional) |
|
46 // |
|
47 // Read the Reset reason from the hardware register map it to one of TMachineStartupType enumerated values |
|
48 // and return this |
|
49 // |
|
50 return EStartupCold; // EXAMPLE ONLY |
|
51 } |
|
52 |
|
53 EXPORT_C TInt TTemplate::CpuVersionId() |
|
54 // |
|
55 // Read and return the the CPU ID |
|
56 // |
|
57 { |
|
58 // |
|
59 // TO DO: (optional) |
|
60 // |
|
61 // Read the CPU identification register (if one exists) mask off redundant bits and return this |
|
62 // |
|
63 return 0; // EXAMPLE ONLY |
|
64 } |
|
65 |
|
66 EXPORT_C TUint TTemplate::DebugPortAddr() |
|
67 // |
|
68 // Return Linear base address of debug UART (as selected in obey file or with eshell debugport command). |
|
69 // |
|
70 { |
|
71 // |
|
72 // TO DO: (optional) |
|
73 // |
|
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: |
|
76 // |
|
77 TUint debugPort; |
|
78 switch (Kern::SuperPage().iDebugPort) |
|
79 { |
|
80 case 1: |
|
81 debugPort=KHwBaseSerial1; |
|
82 break; |
|
83 case 2: |
|
84 debugPort=KHwBaseSerial2; |
|
85 break; |
|
86 case 3: |
|
87 debugPort=KHwBaseSerial3; |
|
88 break; |
|
89 default: |
|
90 debugPort=KHwBaseSerial1; |
|
91 break; |
|
92 } |
|
93 return debugPort; |
|
94 } |
|
95 |
|
96 EXPORT_C TUint TTemplate::ProcessorPeriodInPs() |
|
97 // |
|
98 // Return CPU clock period in picoseconds |
|
99 // |
|
100 { |
|
101 // |
|
102 // TO DO: (optional) |
|
103 // |
|
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 |
|
106 // period |
|
107 // |
|
108 return 0; // EXAMPLE ONLY |
|
109 } |
|
110 |
|
111 EXPORT_C void TTemplate::SetIntMask(TUint aValue) |
|
112 // |
|
113 // Set the Hardware Interrupt masks |
|
114 // |
|
115 { |
|
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); |
|
121 } |
|
122 |
|
123 EXPORT_C void TTemplate::ModifyIntMask(TUint aClearMask,TUint aSetMask) |
|
124 // |
|
125 // Modify the Hardware Interrupt masks |
|
126 // |
|
127 { |
|
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); |
|
133 } |
|
134 |
|
135 EXPORT_C TUint TTemplate::IntsPending() |
|
136 // |
|
137 // Return the state of pending interrupts |
|
138 // |
|
139 { |
|
140 // the following is EXAMPLE ONLY |
|
141 return(AsspRegister::Read32(KHwInterruptsIrqPending)); |
|
142 } |
|
143 |
|
144 EXPORT_C TUint TTemplate::RtcData() |
|
145 // |
|
146 // Return the current time of the RTC |
|
147 // |
|
148 { |
|
149 // |
|
150 // TO DO: (optional) |
|
151 // |
|
152 // Read the RTC current time register and return this time |
|
153 // |
|
154 return 0; // EXAMPLE ONLY |
|
155 } |
|
156 |
|
157 EXPORT_C void TTemplate::SetRtcData(TUint aValue) |
|
158 // |
|
159 // Set the RTC time |
|
160 // |
|
161 { |
|
162 // |
|
163 // TO DO: (optional) |
|
164 // |
|
165 // Set the RTC current time with aValue (may need formatting appropriately) |
|
166 // |
|
167 } |
|
168 |
|
169 EXPORT_C TPhysAddr TTemplate::VideoRamPhys() |
|
170 // |
|
171 // Return the physical address of the video RAM |
|
172 // |
|
173 { |
|
174 return TemplateAssp::VideoRamPhys; |
|
175 } |