author | William Roberts <williamr@symbian.org> |
Thu, 08 Oct 2009 20:49:04 +0100 | |
changeset 10 | 1cf69c2c2bbd |
parent 2 | d55eb581a87c |
permissions | -rw-r--r-- |
0
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
1 |
/* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
3 |
* All rights reserved. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
5 |
* under the terms of the License "Eclipse Public License v1.0" |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
8 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
9 |
* Initial Contributors: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
10 |
* Nokia Corporation - initial contribution. |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
11 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
12 |
* Contributors: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
13 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
14 |
* Description: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
15 |
* |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
16 |
*/ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
17 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
18 |
#ifndef __SYBORG_H__ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
19 |
#define __SYBORG_H__ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
20 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
21 |
#include <e32const.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
22 |
#include <platform.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
23 |
#include <e32hal.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
24 |
#include <assp.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
25 |
#include <kern_priv.h> |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
26 |
#include <mmboot.h> // KPrimaryIOBase |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
27 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
28 |
#ifndef __SYBORG__ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
29 |
#define __SYBORG__ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
30 |
#endif |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
31 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
32 |
const TUint KHwBasePeripherals = KPrimaryIOBase; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
33 |
const TUint KHwLinSeparation = 0x1000; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
34 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
35 |
const TUint KHwBaseSic = KHwBasePeripherals + 0x00*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
36 |
// intended for use as a free-running counter. Reading the value register of a free-running syborg counter returns a microsec value |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
37 |
const TUint KHwBaseRtc = KHwBasePeripherals + 0x01*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
38 |
// intended for use as an alarm generating timer with a resolution of 1 microsecond |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
39 |
const TUint KHwBaseCounterTimer = KHwBasePeripherals + 0x02*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
40 |
const TUint KHwBaseKmiKeyboard = KHwBasePeripherals + 0x03*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
41 |
const TUint KHwBaseKmiMouse = KHwBasePeripherals + 0x04*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
42 |
const TUint KHwBaseKmiPointer = KHwBasePeripherals + 0x04*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
43 |
const TUint KHwBaseClcd = KHwBasePeripherals + 0x05*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
44 |
const TUint KHwBaseUart0 = KHwBasePeripherals + 0x06*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
45 |
const TUint KHwBaseUart1 = KHwBasePeripherals + 0x07*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
46 |
const TUint KHwBaseUart2 = KHwBasePeripherals + 0x08*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
47 |
const TUint KHwBaseUart3 = KHwBasePeripherals + 0x09*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
48 |
const TUint KHwSVPHostFileSystemDevice = KHwBasePeripherals + 0x0a*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
49 |
const TUint KHwSVPSnapDevice = KHwBasePeripherals + 0x0b*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
50 |
const TUint KHwSVPNetDevice = KHwBasePeripherals + 0x0c*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
51 |
const TUint KHwSVPNandDevice = KHwBasePeripherals + 0x0d*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
52 |
const TUint KHwSVPAudioDevice = KHwBasePeripherals + 0x0e*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
53 |
const TUint KHwSVPPlatformDevice = KHwBasePeripherals + 0x0f*KHwLinSeparation; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
54 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
55 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
56 |
enum TSyborgInterruptId |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
57 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
58 |
EIntTimer0 = 0, /* RTC -- not used */ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
59 |
EIntTimer1 = 1, /* Interval Timer */ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
60 |
EIntKeyboard = 2, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
61 |
EIntPointer = 3, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
62 |
// EIntMouse = 3, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
63 |
EIntFb = 4, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
64 |
EIntSerial0 = 5, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
65 |
EIntSerial1 = 6, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
66 |
EIntSerial2 = 7, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
67 |
EIntSerial3 = 8 |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
68 |
}; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
69 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
70 |
// Timer Mode |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
71 |
const TUint KPeriodic = 0x0; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
72 |
const TUint KOneShot = 0x1; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
73 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
74 |
class TSyborg |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
75 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
76 |
public: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
77 |
// generic enums |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
78 |
enum TState |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
79 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
80 |
EEnable, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
81 |
EDisable |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
82 |
}; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
83 |
enum TLock |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
84 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
85 |
ELocked=0, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
86 |
EUnlocked=0xA05F |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
87 |
}; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
88 |
enum TTimerMode |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
89 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
90 |
ETimerModePeriodic=KPeriodic, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
91 |
ETimerModeOneShot=KOneShot, |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
92 |
}; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
93 |
public: |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
94 |
// Initialisation of class |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
95 |
static void Init3(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
96 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
97 |
// Accessor methods for timers |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
98 |
IMPORT_C static void EnableTimerInterrupt(TUint aTimerBase); // Enable the timer interrupt |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
99 |
IMPORT_C static void DisableTimerInterrupt(TUint aTimerBase); // Disable the timer interrupt |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
100 |
IMPORT_C static void SetTimerLoad(TUint aTimerBase, TUint32 aValue); // Set the starting count value for a timer |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
101 |
IMPORT_C static TUint TimerLoad(TUint aTimerBase); // Read the load register (starting count value) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
102 |
IMPORT_C static TUint TimerValue(TUint aTimerBase); // Read the actual timer value |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
103 |
IMPORT_C static void ClearTimerInt(TUint aTimerBase); // Clear the timer interrupt |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
104 |
IMPORT_C static TBool IsTimerEnabled(TUint aTimerBase); // Enquire as to whether the timer is enabled |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
105 |
IMPORT_C static void EnableTimer(TUint aTimerBase, TState aState); // Enable/disable the timer (start/stop it running) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
106 |
IMPORT_C static TTimerMode TimerMode(TUint aTimerBase); // Find out what mode the timer is running in |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
107 |
IMPORT_C static void SetTimerMode(TUint aTimerBase, TTimerMode aValue); // Set the timer mode (periodic or free running) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
108 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
109 |
// Accessor methods for interrupts |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
110 |
IMPORT_C static void EnableInt(TUint anId); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
111 |
IMPORT_C static void DisableInt(TUint anId); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
112 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
113 |
IMPORT_C static TInt VideoRamSize(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
114 |
IMPORT_C static TPhysAddr VideoRamPhys(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
115 |
IMPORT_C static TPhysAddr VideoRamPhysSecure(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
116 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
117 |
// Debug Port Specific |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
118 |
IMPORT_C static TUint32 DebugPortAddr(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
119 |
IMPORT_C static void MarkDebugPortOff(); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
120 |
}; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
121 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
122 |
static inline TUint32 ReadReg(TUint32 base, TUint8 aReg) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
123 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
124 |
return *(volatile TUint32 *)(base + (aReg << 2)); |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
125 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
126 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
127 |
static inline void WriteReg(TUint32 base, TUint8 aReg, TUint32 aVal) |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
128 |
{ |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
129 |
*(volatile TUint32*)(base + (aReg<<2)) = aVal; |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
130 |
} |
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
131 |
|
ffa851df0825
Initial syborg (baseport) and documentation import
martin.trojer@nokia.com
parents:
diff
changeset
|
132 |
#endif // __SYBORG_H__ |