sl@0
|
1 |
// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// template\template_assp\template_assp.h
|
sl@0
|
15 |
// Definitions for Template ASSP
|
sl@0
|
16 |
//
|
sl@0
|
17 |
// WARNING: This file contains some APIs which are internal and are subject
|
sl@0
|
18 |
// to change without notice. Such APIs should therefore not be used
|
sl@0
|
19 |
// outside the Kernel and Hardware Services package.
|
sl@0
|
20 |
//
|
sl@0
|
21 |
|
sl@0
|
22 |
#ifndef __A32TEMPLATEV1_H__
|
sl@0
|
23 |
#define __A32TEMPLATEV1_H__
|
sl@0
|
24 |
#include <e32const.h>
|
sl@0
|
25 |
#include <platform.h>
|
sl@0
|
26 |
#include <e32hal.h>
|
sl@0
|
27 |
#include <assp.h>
|
sl@0
|
28 |
#include <kernel/kern_priv.h>
|
sl@0
|
29 |
|
sl@0
|
30 |
//----------------------------------------------------------------------------
|
sl@0
|
31 |
// Constant conventions:
|
sl@0
|
32 |
//----------------------------------------------------------------------------
|
sl@0
|
33 |
|
sl@0
|
34 |
// KH Hardware definition
|
sl@0
|
35 |
// KHw 4-byte word definition prefix
|
sl@0
|
36 |
// KHb Byte definition prefix
|
sl@0
|
37 |
// KHt Bit definition prefix
|
sl@0
|
38 |
// KHm Mask definition prefix
|
sl@0
|
39 |
// KHs Shift definition prefix
|
sl@0
|
40 |
// KHo Offset definition prefix
|
sl@0
|
41 |
// KHwRo Read-only register
|
sl@0
|
42 |
// KHwWo Write-only register
|
sl@0
|
43 |
// KHwRw Read/write register
|
sl@0
|
44 |
// KHwBase Base address within memory map
|
sl@0
|
45 |
// _i Input suffix
|
sl@0
|
46 |
// _o Output suffix
|
sl@0
|
47 |
// _b Input/output suffix
|
sl@0
|
48 |
|
sl@0
|
49 |
//----------------------------------------------------------------------------
|
sl@0
|
50 |
// Memory map: physical addresses
|
sl@0
|
51 |
//----------------------------------------------------------------------------
|
sl@0
|
52 |
// NB: these are just examples
|
sl@0
|
53 |
|
sl@0
|
54 |
const TUint KHwBaseCs0 = 0x00000000;
|
sl@0
|
55 |
const TUint KHwBaseCs1 = KHwBaseCs0 + 128*KMega;
|
sl@0
|
56 |
const TUint KHwBaseCs2 = KHwBaseCs1 + 128*KMega;
|
sl@0
|
57 |
const TUint KHwBaseCs3 = KHwBaseCs2 + 128*KMega;
|
sl@0
|
58 |
|
sl@0
|
59 |
const TUint KHwBaseMemBank0 = 0x20000000;
|
sl@0
|
60 |
const TUint KHwBaseMemBank1 = KHwBaseMemBank0 + 256*KMega;
|
sl@0
|
61 |
|
sl@0
|
62 |
const TUint KHwBaseRegisters = 0x80000000;
|
sl@0
|
63 |
const TUint KHwBasePeripherals = KHwBaseRegisters; // 8000.0000
|
sl@0
|
64 |
const TUint KHwBasePeripheralsA = KHwBasePeripherals + 256*KMega; // 9000.0000
|
sl@0
|
65 |
const TUint KHwBasePeripheralsB = KHwBasePeripheralsA + 256*KMega; // A000.0000
|
sl@0
|
66 |
const TUint KHwBasePeripheralsC = KHwBasePeripheralsB + 256*KMega; // B000.0000
|
sl@0
|
67 |
|
sl@0
|
68 |
// etc...
|
sl@0
|
69 |
|
sl@0
|
70 |
//----------------------------------------------------------------------------
|
sl@0
|
71 |
// Memory map: linear addresses
|
sl@0
|
72 |
//----------------------------------------------------------------------------
|
sl@0
|
73 |
|
sl@0
|
74 |
#if defined (__MEMMODEL_MULTIPLE__)
|
sl@0
|
75 |
const TUint KHwLinBaseRegisters = 0xc6000000; // as mapped by bootstrap
|
sl@0
|
76 |
const TUint KHwLinSeparation = 0x1000;
|
sl@0
|
77 |
#elif defined(__MEMMODEL_DIRECT__)
|
sl@0
|
78 |
const TUint KHwLinBaseRegisters = 0x10000000; // physical address (example only)
|
sl@0
|
79 |
const TUint KHwLinSeparation = 0x01000000; // physical offsets (example only)
|
sl@0
|
80 |
#else
|
sl@0
|
81 |
const TUint KHwLinBaseRegisters = 0x63000000; // as mapped by bootstrap
|
sl@0
|
82 |
const TUint KHwLinSeparation = 0x1000;
|
sl@0
|
83 |
#endif
|
sl@0
|
84 |
|
sl@0
|
85 |
// EXAMPLE ONLY:
|
sl@0
|
86 |
const TUint KHwLinBasePeriphGroupA = KHwLinBaseRegisters;
|
sl@0
|
87 |
const TUint KHwLinBasePeripheral1 = KHwLinBasePeriphGroupA + 0x00*KHwLinSeparation;
|
sl@0
|
88 |
const TUint KHwLinBasePeripheral2 = KHwLinBasePeriphGroupA + 0x01*KHwLinSeparation;
|
sl@0
|
89 |
const TUint KHwLinBasePeripheral3 = KHwLinBasePeriphGroupA + 0x02*KHwLinSeparation;
|
sl@0
|
90 |
const TUint KHwLinBasePeripheral4 = KHwLinBasePeriphGroupA + 0x03*KHwLinSeparation;
|
sl@0
|
91 |
|
sl@0
|
92 |
const TUint KHwLinBasePeriphGroupB = KHwLinBaseRegisters + 0x20*KHwLinSeparation;
|
sl@0
|
93 |
|
sl@0
|
94 |
const TUint KHwBaseSerial1 = KHwLinBasePeriphGroupB + 0x00*KHwLinSeparation;
|
sl@0
|
95 |
const TUint KHwBaseSerial2 = KHwLinBasePeriphGroupB + 0x01*KHwLinSeparation;
|
sl@0
|
96 |
const TUint KHwBaseSerial3 = KHwLinBasePeriphGroupB + 0x02*KHwLinSeparation;
|
sl@0
|
97 |
|
sl@0
|
98 |
const TUint KHwLinBasePeriphGroupC = KHwLinBaseRegisters + 0x30*KHwLinSeparation;
|
sl@0
|
99 |
|
sl@0
|
100 |
const TUint KHwBaseInterrupts = KHwLinBasePeriphGroupC + 0x00*KHwLinSeparation;
|
sl@0
|
101 |
const TUint KHwInterruptsMaskRo = KHwBaseInterrupts + 0x00;
|
sl@0
|
102 |
const TUint KHwInterruptsMaskSet = KHwBaseInterrupts + 0x04;
|
sl@0
|
103 |
const TUint KHwInterruptsMaskClear = KHwBaseInterrupts + 0x08;
|
sl@0
|
104 |
const TUint KHoInterruptsIrqPending = 0x0C;
|
sl@0
|
105 |
const TUint KHwInterruptsIrqPending = KHwBaseInterrupts + KHoInterruptsIrqPending;
|
sl@0
|
106 |
const TUint KHoInterruptsFiqPending = 0x10;
|
sl@0
|
107 |
const TUint KHwInterruptsFiqending = KHwBaseInterrupts + KHoInterruptsFiqPending;
|
sl@0
|
108 |
|
sl@0
|
109 |
|
sl@0
|
110 |
// Other device specifc constants, register offsets, bit masks, general-purpose I/O allocations,
|
sl@0
|
111 |
// interrupt sources, Memory settings and geometries, etc
|
sl@0
|
112 |
|
sl@0
|
113 |
|
sl@0
|
114 |
class TTemplate
|
sl@0
|
115 |
{
|
sl@0
|
116 |
/**
|
sl@0
|
117 |
* Accessor functions to hardware resources managed by ASSP (ASIC). Auxiliary and information functions which
|
sl@0
|
118 |
* are commonly used by Device Drivers or ASSP/Variant code.
|
sl@0
|
119 |
* Some examples below. These examples assume that the hardware blocks they access (e.g. Interrupt controller
|
sl@0
|
120 |
* RTC, Clock Control Module, UART, etc) are part of the ASSP.
|
sl@0
|
121 |
*/
|
sl@0
|
122 |
public:
|
sl@0
|
123 |
/**
|
sl@0
|
124 |
* initialisation
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
static void Init3();
|
sl@0
|
127 |
/**
|
sl@0
|
128 |
* Active waiting loop (not to be used after System Tick timer has been set up - Init3()
|
sl@0
|
129 |
* @param aDuration A wait time in milliseconds
|
sl@0
|
130 |
*/
|
sl@0
|
131 |
IMPORT_C static void BootWaitMilliSeconds(TInt aDuration);
|
sl@0
|
132 |
/**
|
sl@0
|
133 |
* Read and return the Startup reason of the Hardware
|
sl@0
|
134 |
* @return A TMachineStartupType enumerated value
|
sl@0
|
135 |
*/
|
sl@0
|
136 |
IMPORT_C static TMachineStartupType StartupReason();
|
sl@0
|
137 |
/**
|
sl@0
|
138 |
* Read and return the the CPU ID
|
sl@0
|
139 |
* @return An integer containing the CPU ID string read off the hardware
|
sl@0
|
140 |
*/
|
sl@0
|
141 |
IMPORT_C static TInt CpuVersionId();
|
sl@0
|
142 |
/**
|
sl@0
|
143 |
* Read Linear base address of debug UART (as selected in obey file or with eshell debugport command).
|
sl@0
|
144 |
* @return An integer containing the Linear address of debug Serial Port
|
sl@0
|
145 |
*/
|
sl@0
|
146 |
IMPORT_C static TUint DebugPortAddr();
|
sl@0
|
147 |
/**
|
sl@0
|
148 |
* Read CPU clock period in picoseconds
|
sl@0
|
149 |
* @return An integer containing the CPU clock period in picoseconds
|
sl@0
|
150 |
*/
|
sl@0
|
151 |
IMPORT_C static TUint ProcessorPeriodInPs();
|
sl@0
|
152 |
/**
|
sl@0
|
153 |
* Set the Hardware Interrupt masks
|
sl@0
|
154 |
* @param aValue A new interrupt mask value
|
sl@0
|
155 |
*/
|
sl@0
|
156 |
IMPORT_C static void SetIntMask(TUint aValue);
|
sl@0
|
157 |
/**
|
sl@0
|
158 |
* Modify the Hardware Interrupt masks
|
sl@0
|
159 |
* @param aClearMask A mask with interrupt source bits to clear (disable)
|
sl@0
|
160 |
* @param aSetMask A mask with interrupt source bits to set (enable)
|
sl@0
|
161 |
*/
|
sl@0
|
162 |
IMPORT_C static void ModifyIntMask(TUint aClearMask,TUint aSetMask);
|
sl@0
|
163 |
/**
|
sl@0
|
164 |
* Read the state of pending interrupts
|
sl@0
|
165 |
* @return A mask containing bits set for all pending interrupts
|
sl@0
|
166 |
*/
|
sl@0
|
167 |
IMPORT_C static TUint IntsPending();
|
sl@0
|
168 |
/**
|
sl@0
|
169 |
* Read the current time of the RTC
|
sl@0
|
170 |
* @return A value that is the real time as given by a RTC
|
sl@0
|
171 |
*/
|
sl@0
|
172 |
IMPORT_C static TUint RtcData();
|
sl@0
|
173 |
/**
|
sl@0
|
174 |
* Set the RTC time
|
sl@0
|
175 |
* @param aValue The real time to set the RTC
|
sl@0
|
176 |
*/
|
sl@0
|
177 |
IMPORT_C static void SetRtcData(TUint aValue);
|
sl@0
|
178 |
/**
|
sl@0
|
179 |
* Obtain the physical start address of Video Buffer
|
sl@0
|
180 |
* @return the physical start address of Video Buffer
|
sl@0
|
181 |
*/
|
sl@0
|
182 |
IMPORT_C static TPhysAddr VideoRamPhys();
|
sl@0
|
183 |
private:
|
sl@0
|
184 |
/**
|
sl@0
|
185 |
* Assp-specific implementation for Kern::NanoWait function
|
sl@0
|
186 |
*/
|
sl@0
|
187 |
static void NanoWait(TUint32 aInterval);
|
sl@0
|
188 |
};
|
sl@0
|
189 |
|
sl@0
|
190 |
// TO DO: (optional)
|
sl@0
|
191 |
//
|
sl@0
|
192 |
// Enumerate here all ASSP interrupt souces. It could be a good idea to enumerate them in a way that facilitates
|
sl@0
|
193 |
// operating on the corresponding interrupt controller registers (e.g using their value as a shift count)
|
sl@0
|
194 |
//
|
sl@0
|
195 |
// EXAMPLE ONLY
|
sl@0
|
196 |
enum TTemplateAsspInterruptId
|
sl@0
|
197 |
{
|
sl@0
|
198 |
// ASSP or first-level Interrupt IDs
|
sl@0
|
199 |
EAsspIntIdA=0,
|
sl@0
|
200 |
EAsspIntIdB=1,
|
sl@0
|
201 |
EAsspIntIdC=2,
|
sl@0
|
202 |
EAsspIntIdD=3,
|
sl@0
|
203 |
EAsspIntIdE=4,
|
sl@0
|
204 |
// ...
|
sl@0
|
205 |
EAsspIntIdUsb=11,
|
sl@0
|
206 |
EAsspIntIdDma=12,
|
sl@0
|
207 |
// ...
|
sl@0
|
208 |
EAsspIntIdZ=25
|
sl@0
|
209 |
};
|
sl@0
|
210 |
|
sl@0
|
211 |
//
|
sl@0
|
212 |
// TO DO: (optional)
|
sl@0
|
213 |
//
|
sl@0
|
214 |
// Define here some commonly used ASSP interrupts
|
sl@0
|
215 |
//
|
sl@0
|
216 |
// EXAMPLE ONLY
|
sl@0
|
217 |
const TInt KIntIdExpansion=EAsspIntIdA; // this is the ASSP interrupt which connects to second-level (Variant)
|
sl@0
|
218 |
// Interrupt controller: all 2nd level interrupts come through this interrupt
|
sl@0
|
219 |
const TInt KIntIdOstMatchMsTimer=EAsspIntIdB;
|
sl@0
|
220 |
const TInt KIntIdDigitiser=EAsspIntIdC;
|
sl@0
|
221 |
const TInt KIntIdSound=EAsspIntIdD;
|
sl@0
|
222 |
const TInt KIntIdTimer1=EAsspIntIdE;
|
sl@0
|
223 |
|
sl@0
|
224 |
|
sl@0
|
225 |
#endif
|
sl@0
|
226 |
|