author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Sat, 20 Feb 2010 00:10:51 +0200 | |
branch | RCL_3 |
changeset 19 | 4a8fed1c0ef6 |
parent 0 | a41df078684a |
permissions | -rw-r--r-- |
0 | 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 |
// e32\include\kernel\x86\assp.h |
|
15 |
// Standard ASIC-level header |
|
16 |
// |
|
17 |
// WARNING: This file contains some APIs which are internal and are subject |
|
18 |
// to change without notice. Such APIs should therefore not be used |
|
19 |
// outside the Kernel and Hardware Services package. |
|
20 |
// |
|
21 |
||
22 |
/** |
|
23 |
@file |
|
24 |
@internalTechnology |
|
25 |
*/ |
|
26 |
||
27 |
#ifndef __A32STD_H__ |
|
28 |
#define __A32STD_H__ |
|
29 |
#include <platform.h> |
|
30 |
||
31 |
/************************************************* |
|
32 |
* Interrupt handling |
|
33 |
*************************************************/ |
|
34 |
typedef void (*TIsr)(TAny*); |
|
35 |
||
36 |
||
37 |
||
38 |
||
39 |
/** |
|
40 |
A class that exports interrupt functionality to device drivers and |
|
41 |
other kernel-side code. |
|
42 |
||
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
43 |
Although Symbian OS defines this class, it does not implement the majority |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
of it; an implementation for each of the functions defined by this class, |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
45 |
with the exception of AddTimingEntropy, must be provided by the Variant in |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
46 |
the baseport. |
0 | 47 |
|
48 |
Note that the class only provides the public API for using interrupts, |
|
49 |
not for dispatching them. |
|
50 |
*/ |
|
51 |
class Interrupt |
|
52 |
{ |
|
53 |
public: |
|
54 |
||
55 |
||
56 |
/** |
|
57 |
Associates the specified interrupt service routine (ISR) function with |
|
58 |
the specified interrupt Id. |
|
59 |
||
60 |
This is also known as binding the interrupt. |
|
61 |
||
62 |
When the ISR is called, the value aPtr is passed as the argument. |
|
63 |
The ISR must be a static void function, taking a single TAny* parameter: |
|
64 |
@code |
|
65 |
void Isr(TAny* aParam) |
|
66 |
@endcode |
|
67 |
||
68 |
Note that you must call Interrupt::Enable() before you can start |
|
69 |
receiving interrupts. |
|
70 |
||
71 |
@param anId The interrupt Id. |
|
72 |
@param anIsr The address of the ISR function. |
|
73 |
@param aPtr 32-bit value that is passed to the ISR. |
|
74 |
This is designated a TAny* type as it is usually a pointer to |
|
75 |
the owning class or data to be used in the ISR, although |
|
76 |
it can be any 32-bit value. |
|
77 |
||
78 |
@return KErrNone, if successful; KErrArgument, if anId is invalid; |
|
79 |
KErrInUse, if the ISR is already bound to this interrupt. |
|
80 |
*/ |
|
81 |
IMPORT_C static TInt Bind(TInt anId, TIsr anIsr, TAny* aPtr); |
|
82 |
||
83 |
||
84 |
/** |
|
85 |
Unbinds the interrupt service routine (ISR) function from |
|
86 |
the specified interrupt id. |
|
87 |
||
88 |
@param anId The interrupt Id. |
|
89 |
||
90 |
@return KErrNone, if successful; KErrArgument, if anId is invalid; |
|
91 |
KErrGeneral, if there is no ISR bound to this interrupt. |
|
92 |
*/ |
|
93 |
IMPORT_C static TInt Unbind(TInt anId); |
|
94 |
||
95 |
||
96 |
/** |
|
97 |
Enables the specified interrupt. |
|
98 |
||
99 |
After enabling the interrupt, the ISR will run if the interrupt signals. |
|
100 |
||
101 |
@param anId The interrupt Id. |
|
102 |
||
103 |
@return KErrNone, if successful; KErrArgument, if anId is invalid; |
|
104 |
KErrGeneral, if there is no ISR bound to this interrupt. |
|
105 |
*/ |
|
106 |
IMPORT_C static TInt Enable(TInt anId); |
|
107 |
||
108 |
||
109 |
/** |
|
110 |
Disables the specified interrupt. |
|
111 |
||
112 |
After calling this function, the interrupt source cannot generate |
|
113 |
an interrupt to the CPU. |
|
114 |
||
115 |
@param anId The interrupt Id. |
|
116 |
||
117 |
@return KErrNone, if successful; KErrArgument, if anId is invalid; |
|
118 |
KErrGeneral, if there is no ISR bound to this interrupt. |
|
119 |
*/ |
|
120 |
IMPORT_C static TInt Disable(TInt anId); |
|
121 |
||
122 |
||
123 |
/** |
|
124 |
Clears any pending signal on the specified interrupt. |
|
125 |
||
126 |
@param anId The interrupt Id. |
|
127 |
||
128 |
@return KErrNone, if successful; KErrArgument, if anId is invalid; |
|
129 |
KErrGeneral, if there is no ISR bound to this interrupt. |
|
130 |
*/ |
|
131 |
IMPORT_C static TInt Clear(TInt anId); |
|
132 |
||
133 |
||
134 |
/** |
|
135 |
Changes the priority of the specified interrupt to the new specified value. |
|
136 |
||
137 |
The meaning of the priority value is determined by the baseport. |
|
138 |
The function returns KErrNotSupported if the hardware or the baseport |
|
139 |
does not support configurable interrupt priorities. |
|
140 |
||
141 |
@param anId The interrupt Id. |
|
142 |
@param aPriority The new priority value. |
|
143 |
||
144 |
@return KErrNone, if successful; KErrArgument, if anId is invalid; |
|
145 |
KErrNotSuppported, if configurable interrupt priorities |
|
146 |
are not supported. |
|
147 |
*/ |
|
148 |
IMPORT_C static TInt SetPriority(TInt anId, TInt aPriority); |
|
19
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
149 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
150 |
/** |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
151 |
This function is implemented by the kernel. It adds the current, highest |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
152 |
resolution timestamp to the secure RNG's entropy pool. |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
153 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
154 |
It should be called from the ISR of any device where the timing of interrupts |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
155 |
would be considered random, for example the keyboard or digitiser drivers. |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
156 |
*/ |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
157 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
158 |
IMPORT_C static void AddTimingEntropy(); |
0 | 159 |
}; |
160 |
||
161 |
struct SInterruptHandler |
|
162 |
{ |
|
163 |
TAny* iPtr; |
|
164 |
TIsr iIsr; |
|
165 |
}; |
|
166 |
||
167 |
/************************************************* |
|
168 |
* Hardware-dependent stuff used by the kernel. |
|
169 |
*************************************************/ |
|
170 |
#ifdef __SMP__ |
|
171 |
struct SCpuBootData; |
|
172 |
#endif |
|
173 |
||
174 |
class Asic |
|
175 |
{ |
|
176 |
public: |
|
177 |
// initialisation |
|
178 |
virtual TMachineStartupType StartupReason()=0; |
|
179 |
virtual void Init1()=0; |
|
180 |
#ifdef __SMP__ |
|
181 |
virtual void GetCpuBootData(SCpuBootData* aInfo)=0; |
|
182 |
virtual void Init2AP()=0; |
|
183 |
#endif |
|
184 |
virtual void Init3()=0; |
|
185 |
||
186 |
// debug |
|
187 |
virtual void DebugOutput(TUint aChar)=0; |
|
188 |
||
189 |
// power management |
|
190 |
virtual void Idle()=0; |
|
191 |
||
192 |
// timing |
|
193 |
virtual TInt MsTickPeriod()=0; |
|
194 |
virtual TInt SystemTimeInSecondsFrom2000(TInt& aTime)=0; |
|
195 |
virtual TInt SetSystemTimeInSecondsFrom2000(TInt aTime)=0; |
|
196 |
virtual TUint32 NanoWaitCalibration()=0; |
|
197 |
||
198 |
// HAL |
|
199 |
virtual TInt VariantHal(TInt aFunction, TAny* a1, TAny* a2)=0; |
|
200 |
||
201 |
// Machine configuration |
|
202 |
virtual TPtr8 MachineConfiguration()=0; |
|
203 |
}; |
|
204 |
||
205 |
typedef Asic* (*TVariantInitialise)(void); |
|
206 |
typedef TAny* (*TVariantInitialise2)(TInt); |
|
207 |
||
208 |
class Arch |
|
209 |
{ |
|
210 |
public: |
|
211 |
IMPORT_C static Asic* TheAsic(); |
|
212 |
}; |
|
213 |
||
214 |
#endif |