|
1 /* |
|
2 * Copyright (c) 2008-2009 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 * naviengine_assp\naviengine.cpp |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 #include <naviengine_priv.h> |
|
22 #include "uart/uart16550_ne.h" |
|
23 |
|
24 //---------------------------------------------------------------------------- |
|
25 // Initialisation |
|
26 |
|
27 void TNaviEngine::Init1() |
|
28 // |
|
29 // Phase 1 initialisation |
|
30 // |
|
31 { |
|
32 // Use assp-specific nano wait implementation |
|
33 Kern::SetNanoWaitHandler(&NanoWait); |
|
34 } |
|
35 |
|
36 void TNaviEngine::Init3() |
|
37 // |
|
38 // Phase 3 initialisation |
|
39 // |
|
40 { |
|
41 // |
|
42 // TO DO: (optional) |
|
43 // |
|
44 // Initialise any TNaviEngine class data members here |
|
45 // |
|
46 } |
|
47 |
|
48 EXPORT_C TMachineStartupType TNaviEngine::StartupReason() |
|
49 // |
|
50 // Read and return the Startup reason of the Hardware |
|
51 // |
|
52 { |
|
53 // |
|
54 // TO DO: (optional) |
|
55 // |
|
56 // Read the Reset reason from the hardware register map it to one of TMachineStartupType enumerated values |
|
57 // and return this |
|
58 // |
|
59 return EStartupCold; // EXAMPLE ONLY |
|
60 } |
|
61 |
|
62 EXPORT_C TInt TNaviEngine::CpuVersionId() |
|
63 // |
|
64 // Read and return the the CPU ID |
|
65 // |
|
66 { |
|
67 // |
|
68 // TO DO: (optional) |
|
69 // |
|
70 // Read the CPU identification register (if one exists) mask off redundant bits and return this |
|
71 // |
|
72 return 0; // EXAMPLE ONLY |
|
73 } |
|
74 |
|
75 EXPORT_C TUint TNaviEngine::DebugPortAddr() |
|
76 // |
|
77 // Return Linear base address of debug UART (as selected in obey file or with eshell debugport command). |
|
78 // |
|
79 { |
|
80 TUint debugPort; |
|
81 switch (Kern::SuperPage().iDebugPort) |
|
82 { |
|
83 case Arm::EDebugPortJTAG: debugPort = 0; break; //indicates JTAG debugging |
|
84 case 0x101: |
|
85 case 1: debugPort=KHwBaseUart1; break; |
|
86 case 2: debugPort=KHwBaseUart2; break; |
|
87 default: debugPort=KHwBaseUart0; break; |
|
88 } |
|
89 return debugPort; |
|
90 } |
|
91 |
|
92 EXPORT_C TUint TNaviEngine::ProcessorPeriodInPs() |
|
93 // |
|
94 // Return CPU clock period in picoseconds |
|
95 // |
|
96 { |
|
97 // |
|
98 // TO DO: (optional) |
|
99 // |
|
100 // Read the CPU clock speed and return its period in picoseconds. If only a limited range of speeds is possible |
|
101 // it is preferable to use the masked speed reading as an index into a look up table containing the corresponding |
|
102 // period |
|
103 // |
|
104 return 0; // EXAMPLE ONLY |
|
105 } |
|
106 |
|
107 EXPORT_C TUint TNaviEngine::RtcData() |
|
108 // |
|
109 // Return the current time of the RTC |
|
110 // |
|
111 { |
|
112 // |
|
113 // TO DO: (optional) |
|
114 // |
|
115 // Read the RTC current time register and return this time |
|
116 // |
|
117 return 0; // EXAMPLE ONLY |
|
118 } |
|
119 |
|
120 EXPORT_C void TNaviEngine::SetRtcData(TUint aValue) |
|
121 // |
|
122 // Set the RTC time |
|
123 // |
|
124 { |
|
125 // |
|
126 // TO DO: (optional) |
|
127 // |
|
128 // Set the RTC current time with aValue (may need formatting appropriately) |
|
129 // |
|
130 } |
|
131 |
|
132 EXPORT_C TPhysAddr TNaviEngine::VideoRamPhys() |
|
133 // |
|
134 // Return the physical address of the video RAM |
|
135 // |
|
136 { |
|
137 return NaviEngineAssp::VideoRamPhys; |
|
138 } |
|
139 |
|
140 |
|
141 |
|
142 void TNaviEngine::InitDebugOutput() |
|
143 { |
|
144 TUint baseAddr = DebugPortAddr(); |
|
145 if (baseAddr) //baseAddr is NULL in case og jtag logging |
|
146 { |
|
147 TUint32 dp = Kern::SuperPage().iDebugPort; |
|
148 TBool highSpeed = (dp==0x100 || dp==0x101); |
|
149 |
|
150 // Baud Rate = 115200 or 230400 (highspeed); 8 bits, no parity, 1 stop bit |
|
151 *((volatile TInt*) (baseAddr+K16550LCROffset)) = 0x83; |
|
152 *((volatile TInt*) (baseAddr+K16550BDLoOffset)) = highSpeed ? KBaudRateDiv_230400 : KBaudRateDiv_default; |
|
153 *((volatile TInt*) (baseAddr+K16550BDHiOffset)) = 0; |
|
154 *((volatile TInt*) (baseAddr+K16550LCROffset)) = 3; |
|
155 } |
|
156 } |
|
157 |
|
158 void TNaviEngine::DoDebugOutput(TUint aLetter) |
|
159 { |
|
160 TUint baseAddr = DebugPortAddr(); |
|
161 if (baseAddr) |
|
162 {//serial port logging |
|
163 volatile TInt* status = (volatile TInt*) (baseAddr+K16550LSROffset); |
|
164 while ((*status & K16550LSR_TXHREmpty) == 0); //wait till TXR is empty |
|
165 *((volatile TInt*) (baseAddr+K16550TXHROffset)) = aLetter; |
|
166 } |
|
167 else |
|
168 Arm::DebugOutJTAG((TUint8)aLetter); // jtag logging |
|
169 } |
|
170 |
|
171 |
|
172 |