0
|
1 |
// Copyright (c) 2003-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 |
//
|
|
15 |
|
|
16 |
#include <drivers/sdio/sdio.h>
|
|
17 |
#include <drivers/sdio/function.h>
|
|
18 |
#include <drivers/sdio/regifc.h>
|
|
19 |
#include <drivers/sdio/sdiocard.h>
|
|
20 |
#include <drivers/sdio/cisreader.h>
|
|
21 |
#include "utraceepbussdio.h"
|
|
22 |
|
|
23 |
EXPORT_C TSDIOFunction::TSDIOFunction(TSDIOCard* aCardP, TUint8 aFunctionNumber) :
|
|
24 |
/**
|
|
25 |
Contructs a TSDIOFunction for the specified card and function number.
|
|
26 |
|
|
27 |
@param aCardP A pointer to the card object containing the required function.
|
|
28 |
@param aFunctionNumber The number of the function upon which the register interface operates.
|
|
29 |
*/
|
|
30 |
iClientHandle(NULL),
|
|
31 |
iRegisterInterfaceP(NULL),
|
|
32 |
iFunctionNumber(aFunctionNumber),
|
|
33 |
iCisPtr(0),
|
|
34 |
iCsaPtr(0),
|
|
35 |
iInterrupt(&aCardP->InterruptController(), aFunctionNumber),
|
|
36 |
iCapabilities(),
|
|
37 |
iCardP(aCardP),
|
|
38 |
iInstanceCount(1)
|
|
39 |
{
|
|
40 |
TRACE3(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionConstructor, reinterpret_cast<TUint32>(this), reinterpret_cast<TUint32>(aCardP), aFunctionNumber); // @SymTraceDataPublishedTvk
|
|
41 |
|
|
42 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionConstructorReturning, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
43 |
}
|
|
44 |
|
|
45 |
EXPORT_C TSDIOFunction::~TSDIOFunction()
|
|
46 |
/**
|
|
47 |
Destroys the TSDIOFunction instance.
|
|
48 |
*/
|
|
49 |
{
|
|
50 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionDestructor, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
51 |
|
|
52 |
__ASSERT_ALWAYS(iInstanceCount == 0, TSDIOFunction::Panic(TSDIOFunction::ESDIOFunctionBadDeletion));
|
|
53 |
delete iRegisterInterfaceP;
|
|
54 |
|
|
55 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionDestructorReturning, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
56 |
}
|
|
57 |
|
|
58 |
void TSDIOFunction::Close()
|
|
59 |
/**
|
|
60 |
Destroys the DSDIORegisterInterface instance.
|
|
61 |
*/
|
|
62 |
{
|
|
63 |
TInt oldCount = __e32_atomic_tas_ord32(&iInstanceCount, 1, -1, 0);
|
|
64 |
if (oldCount == 1)
|
|
65 |
delete(this);
|
|
66 |
}
|
|
67 |
|
|
68 |
EXPORT_C TInt TSDIOFunction::RegisterClient(DBase* aClientHandle, DMutex* aMutexLockP)
|
|
69 |
/**
|
|
70 |
@publishedPartner
|
|
71 |
@released
|
|
72 |
|
|
73 |
Registers the client with the function.
|
|
74 |
|
|
75 |
@param aClientHandle The unique Client ID
|
|
76 |
@param aMutexLock The client's data access mutex
|
|
77 |
|
|
78 |
@return KErrNone if successful, otherwise a standard Symbian OS error code.
|
|
79 |
|
|
80 |
@see TSDIOFunction::DeregisterClient
|
|
81 |
*/
|
|
82 |
{
|
|
83 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionRegisterClient, reinterpret_cast<TUint32>(this), reinterpret_cast<TUint32>(aClientHandle)); // @SymTraceDataPublishedTvk
|
|
84 |
|
|
85 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), ">TSDIOFunction::RegisterClient()");) // @SymTraceDataInternalTechnology
|
|
86 |
|
|
87 |
__ASSERT_DEBUG(aClientHandle != NULL, TSDIOFunction::Panic(TSDIOFunction::ESDIOFunctionBadClientHandle));
|
|
88 |
|
|
89 |
if(iClientHandle != NULL)
|
|
90 |
{
|
|
91 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "ERR:KErrAlreadyExists");) // @SymTraceDataInternalTechnology
|
|
92 |
return(KErrAlreadyExists); // Already registered with a Client
|
|
93 |
}
|
|
94 |
|
|
95 |
iClientHandle = aClientHandle;
|
|
96 |
|
|
97 |
if((iRegisterInterfaceP = new DSDIORegisterInterface(iCardP, iFunctionNumber, aMutexLockP)) == NULL)
|
|
98 |
{
|
|
99 |
TRACE1(TTraceContext(EError), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionRegisterClientOOM, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
100 |
return(KErrNoMemory);
|
|
101 |
}
|
|
102 |
|
|
103 |
__e32_atomic_tas_ord32(&iInstanceCount, 1, 1, 0);
|
|
104 |
iCardP->ClientRegistered();
|
|
105 |
|
|
106 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "<TSDIOFunction::RegisterClient()")); // @SymTraceDataInternalTechnology
|
|
107 |
|
|
108 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionRegisterClient, reinterpret_cast<TUint32>(this), KErrNone); // @SymTraceDataPublishedTvk
|
|
109 |
|
|
110 |
return(KErrNone);
|
|
111 |
}
|
|
112 |
|
|
113 |
EXPORT_C TInt TSDIOFunction::DeregisterClient(DBase* aClientHandle)
|
|
114 |
/**
|
|
115 |
@publishedPartner
|
|
116 |
@released
|
|
117 |
|
|
118 |
Deregisters the client from the function.
|
|
119 |
|
|
120 |
@param aClientHandle The unique Client ID
|
|
121 |
|
|
122 |
@return KErrNone if successful, otherwise a standard Symbian OS error code.
|
|
123 |
|
|
124 |
@see TSDIOFunction::RegisterClient
|
|
125 |
|
|
126 |
@todo Need to ensure that all outstanding sessions have completed
|
|
127 |
*/
|
|
128 |
{
|
|
129 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionDeregisterClient, reinterpret_cast<TUint32>(this), reinterpret_cast<TUint32>(aClientHandle)); // @SymTraceDataPublishedTvk
|
|
130 |
|
|
131 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), ">TSDIOFunction::DeregisterClient()");) // @SymTraceDataInternalTechnology
|
|
132 |
|
|
133 |
__ASSERT_DEBUG(aClientHandle != NULL, TSDIOFunction::Panic(TSDIOFunction::ESDIOFunctionBadClientHandle));
|
|
134 |
|
|
135 |
TInt ret = KErrPermissionDenied;
|
|
136 |
if(iClientHandle != NULL && (iClientHandle == aClientHandle))
|
|
137 |
{
|
|
138 |
delete iRegisterInterfaceP;
|
|
139 |
iRegisterInterfaceP = NULL;
|
|
140 |
|
|
141 |
iClientHandle = NULL;
|
|
142 |
|
|
143 |
iInterrupt.Unbind();
|
|
144 |
|
|
145 |
iCardP->ClientDeregistered();
|
|
146 |
|
|
147 |
Close();
|
|
148 |
|
|
149 |
ret = KErrNone;
|
|
150 |
}
|
|
151 |
|
|
152 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "<TSDIOFunction::DeregisterClient()")); // @SymTraceDataInternalTechnology
|
|
153 |
|
|
154 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionDeregisterClientReturning, reinterpret_cast<TUint32>(this), ret); // @SymTraceDataPublishedTvk
|
|
155 |
|
|
156 |
return(ret);
|
|
157 |
}
|
|
158 |
|
|
159 |
EXPORT_C TInt TSDIOFunction::Enable(TBool aPollReady)
|
|
160 |
/**
|
|
161 |
@publishedPartner
|
|
162 |
@released
|
|
163 |
|
|
164 |
Enables the function by writing to the appropriate register in the CCCR.
|
|
165 |
|
|
166 |
This function has two modes of operation. If aPollReady == ETrue, then the
|
|
167 |
function shall attempt to enable the function, then poll for the recommended
|
|
168 |
enable period until the function is enabled, or times out. Otherwise, flow
|
|
169 |
returns control to the calling function who should be responsible for polling
|
|
170 |
the IO_READY bit (using TSDIOFunction::IsReady)
|
|
171 |
|
|
172 |
@param aPollReady Specify ETrue to perform timeout and polling on behalf of the client.
|
|
173 |
|
|
174 |
@return KErrNone if successful, otherwise a standard Symbian OS error code.
|
|
175 |
|
|
176 |
@see TSDIOFunction::Disable
|
|
177 |
@see TSDIOFunction::IsReady
|
|
178 |
*/
|
|
179 |
{
|
|
180 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionEnable, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
181 |
|
|
182 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "TSDIOFunction::Enable");) // @SymTraceDataInternalTechnology
|
|
183 |
//
|
|
184 |
// The FBR SHP[1:0] bits determine the power requirements of this function.
|
|
185 |
// If the function 'Requires' high power, then the EHP bit must be set prior
|
|
186 |
// to enabling the function otherwise the function shall not be enabled.
|
|
187 |
//
|
|
188 |
// TODO: This needs to be a little more complex to support 'Optional' HP
|
|
189 |
//
|
|
190 |
TBool enableHighPower = EFalse;
|
|
191 |
switch(iCapabilities.iPowerFlags & KFBRRegPowerSupportMask)
|
|
192 |
{
|
|
193 |
case KFBRRegHighPowerRequired:
|
|
194 |
enableHighPower = ETrue;
|
|
195 |
break;
|
|
196 |
case KFBRRegHighPowerSupported:
|
|
197 |
enableHighPower = ETrue;
|
|
198 |
break;
|
|
199 |
case KFBRRegStandardPower:
|
|
200 |
enableHighPower = EFalse;
|
|
201 |
break;
|
|
202 |
default:
|
|
203 |
enableHighPower = EFalse;
|
|
204 |
break;
|
|
205 |
}
|
|
206 |
|
|
207 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "Enable High Power: %X",(iCapabilities.iPowerFlags & KFBRRegPowerSupportMask));) // @SymTraceDataInternalTechnology
|
|
208 |
|
|
209 |
TInt err = KErrNone;
|
|
210 |
if(enableHighPower)
|
|
211 |
{
|
|
212 |
err = iCardP->CommonRegisterInterface()->Modify8((KFBRFunctionOffset * iFunctionNumber) + KFBRRegPowerFlags, KFBRRegEnableHighPower, 0);
|
|
213 |
|
|
214 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "Enabled High Power err:%d",err);) // @SymTraceDataInternalTechnology
|
|
215 |
}
|
|
216 |
|
|
217 |
|
|
218 |
if(err == KErrNone)
|
|
219 |
{
|
|
220 |
// Write to IO Enable Registers
|
|
221 |
err = iCardP->CommonRegisterInterface()->Modify8(KCCCRRegIoEnable, (TUint8)(0x01 << iFunctionNumber), 0x00);
|
|
222 |
|
|
223 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "Write to IO Enable Registers err:%d",err);) // @SymTraceDataInternalTechnology
|
|
224 |
}
|
|
225 |
|
|
226 |
if((err == KErrNone) && aPollReady)
|
|
227 |
{
|
|
228 |
// Determine the timeout period (this is expressed in 10mS steps)
|
|
229 |
TUint32 timeout = iCapabilities.iEnableTimeout ? iCapabilities.iEnableTimeout : KDefaultFunctionEnableTimeout;
|
|
230 |
|
|
231 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "Timeout period:%d",timeout);) // @SymTraceDataInternalTechnology
|
|
232 |
|
|
233 |
// Synchronous enable polls here, returning to the calling function
|
|
234 |
// after the function is initialise, or timeout has been exceeded
|
|
235 |
const TUint32 pollPeriod = 100; // 100mS poll period
|
|
236 |
const TUint32 pollCount = (10*timeout) / pollPeriod;
|
|
237 |
|
|
238 |
err = Kern::PollingWait(PollFunctionReady, this, pollPeriod, pollCount); // KErrNone or KErrTimedOut
|
|
239 |
}
|
|
240 |
|
|
241 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "TSDIOFunction::Enable err:%d", err);) // @SymTraceDataInternalTechnology
|
|
242 |
|
|
243 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionEnableReturning, reinterpret_cast<TUint32>(this), err); // @SymTraceDataPublishedTvk
|
|
244 |
|
|
245 |
return(err);
|
|
246 |
}
|
|
247 |
|
|
248 |
TBool TSDIOFunction::PollFunctionReady(TAny* aSelfP)
|
|
249 |
/**
|
|
250 |
Poll function used to determine the state of the function after enable.
|
|
251 |
@see TSDIOFunction::Enable
|
|
252 |
*/
|
|
253 |
{
|
|
254 |
TSDIOFunction& self = *(TSDIOFunction*)aSelfP;
|
|
255 |
|
|
256 |
TBool isReady = EFalse;
|
|
257 |
(void)self.IsReady(isReady);
|
|
258 |
|
|
259 |
return(isReady);
|
|
260 |
}
|
|
261 |
|
|
262 |
EXPORT_C TInt TSDIOFunction::Disable()
|
|
263 |
/**
|
|
264 |
@publishedPartner
|
|
265 |
@released
|
|
266 |
|
|
267 |
Disables the function by writing to the appropriate register in the CCCR.
|
|
268 |
|
|
269 |
@return KErrNone if successful, otherwise a standard Symbian OS error code.
|
|
270 |
|
|
271 |
@see TSDIOFunction::Enable
|
|
272 |
@see TSDIOFunction::IsReady
|
|
273 |
*/
|
|
274 |
{
|
|
275 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionDisable, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
276 |
|
|
277 |
// Write to IO Enable Registers
|
|
278 |
TInt err = iCardP->CommonRegisterInterface()->Modify8(KCCCRRegIoEnable, 0, TUint8(0x01 << iFunctionNumber));
|
|
279 |
if(err == KErrNone)
|
|
280 |
{
|
|
281 |
err = iCardP->CommonRegisterInterface()->Modify8((KFBRFunctionOffset * iFunctionNumber) + KFBRRegPowerFlags, 0, KFBRRegEnableHighPower);
|
|
282 |
}
|
|
283 |
|
|
284 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionDisable, reinterpret_cast<TUint32>(this), err); // @SymTraceDataPublishedTvk
|
|
285 |
return(err);
|
|
286 |
}
|
|
287 |
|
|
288 |
EXPORT_C TInt TSDIOFunction::IsReady(TBool& aIsReady)
|
|
289 |
/**
|
|
290 |
@publishedPartner
|
|
291 |
@released
|
|
292 |
|
|
293 |
Used to determine if the function is powered up and ready.
|
|
294 |
|
|
295 |
Reads the state of the functions IO_READY to determine if the function is enabled.
|
|
296 |
|
|
297 |
@param aIsReady Returns the current state of the function.
|
|
298 |
|
|
299 |
@return KErrNone if successful, otherwise a standard Symbian OS error code.
|
|
300 |
|
|
301 |
@see TSDIOFunction::Enable
|
|
302 |
@see TSDIOFunction::Disable
|
|
303 |
*/
|
|
304 |
{
|
|
305 |
TRACE1(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionIsReady, reinterpret_cast<TUint32>(this)); // @SymTraceDataPublishedTvk
|
|
306 |
|
|
307 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "Checking whether the function is ready")); // @SymTraceDataInternalTechnology
|
|
308 |
|
|
309 |
TInt err;
|
|
310 |
|
|
311 |
TUint8 ioRdy = EFalse;
|
|
312 |
if((err = iCardP->CommonRegisterInterface()->Read8(KCCCRRegIoReady, &ioRdy)) == KErrNone)
|
|
313 |
{
|
|
314 |
aIsReady = (ioRdy & (0x01 << iFunctionNumber)) != 0;
|
|
315 |
}
|
|
316 |
|
|
317 |
TRACE3(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionIsReadyReturning, reinterpret_cast<TUint32>(this), static_cast<TUint32>(aIsReady), err); // @SymTraceDataPublishedTvk
|
|
318 |
|
|
319 |
return(err);
|
|
320 |
}
|
|
321 |
|
|
322 |
EXPORT_C TInt TSDIOFunction::SetPriority(TSDIOFunctionPriority aPriority)
|
|
323 |
/**
|
|
324 |
This sets the priority of accesses to this function.
|
|
325 |
|
|
326 |
This is intended to allow the suspend/resume protocol to determine whether an access to a lower
|
|
327 |
priority function should become suspended while a higher priority function is accessed.
|
|
328 |
|
|
329 |
Note that the Suspend/Resume protocol is not currently implemented, but may be in a future release.
|
|
330 |
|
|
331 |
@param aPriority The requested function priority.
|
|
332 |
|
|
333 |
@return KErrNone if successful, otherwise a standard Symbian OS error code.
|
|
334 |
|
|
335 |
@see TSDIOFunctionPriority
|
|
336 |
*/
|
|
337 |
{
|
|
338 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionSetPriority, reinterpret_cast<TUint32>(this), static_cast<TUint32>(aPriority)); // @SymTraceDataPublishedTvk
|
|
339 |
|
|
340 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionSetPriorityReturning, reinterpret_cast<TUint32>(this), KErrNone); // @SymTraceDataPublishedTvk
|
|
341 |
|
|
342 |
return(KErrNone);
|
|
343 |
}
|
|
344 |
|
|
345 |
|
|
346 |
void TSDIOFunction::Panic(TSDIOFunction::TPanic aPanic)
|
|
347 |
/**
|
|
348 |
Function Panic
|
|
349 |
*/
|
|
350 |
{
|
|
351 |
Kern::Fault("SDIO_FN", aPanic);
|
|
352 |
}
|
|
353 |
|
|
354 |
|
|
355 |
TInt TSDIOFunction::ParseCIS()
|
|
356 |
{
|
|
357 |
TCisReader iCisRd;
|
|
358 |
|
|
359 |
TInt err = KErrNone;
|
|
360 |
|
|
361 |
const TInt socketNum = iCardP->iStackP->MMCSocket()->iSocketNumber;
|
|
362 |
|
|
363 |
if((err = iCisRd.SelectCis(socketNum,0,0,iFunctionNumber)) == KErrNone)
|
|
364 |
{
|
|
365 |
err = iCisRd.FindReadFunctionConfig(iCapabilities);
|
|
366 |
}
|
|
367 |
|
|
368 |
return err;
|
|
369 |
}
|
|
370 |
|
|
371 |
|
|
372 |
EXPORT_C TBool TSDIOFunctionCaps::CapabilitiesMatch(TSDIOFunctionCaps& aCaps, TUint32 aMatchFlags)
|
|
373 |
/**
|
|
374 |
@publishedPartner
|
|
375 |
@released
|
|
376 |
|
|
377 |
Compares the capabilities provided in aCaps with the capabilities of the function.
|
|
378 |
|
|
379 |
@param aCaps The capabilities provided by the user.
|
|
380 |
@param aMatchFlags A bitmask of specific capabilities to match.
|
|
381 |
|
|
382 |
@return ETrue if the capabilities match.
|
|
383 |
|
|
384 |
@see TSDIOCard::FindFunction
|
|
385 |
@see TSDIOFunctionCaps
|
|
386 |
@see TSDIOCapsMatch
|
|
387 |
*/
|
|
388 |
{
|
|
389 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionCapabilitiesMatch, reinterpret_cast<TUint32>(this), aMatchFlags); // @SymTraceDataPublishedTvk
|
|
390 |
|
|
391 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "TSDIOFunctionCaps::CapabilitiesMatch - aMatchFlags: %d",aMatchFlags);) // @SymTraceDataInternalTechnology
|
|
392 |
|
|
393 |
if(aMatchFlags == TSDIOFunctionCaps::EDontCare)
|
|
394 |
{
|
|
395 |
// Always match if EDontCare is specified
|
|
396 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "TSDIOFunctionCaps::CapabilitiesMatch - EDontCare Specified!");) // @SymTraceDataInternalTechnology
|
|
397 |
return(ETrue);
|
|
398 |
}
|
|
399 |
if(aMatchFlags & TSDIOFunctionCaps::EFunctionNumber)
|
|
400 |
{
|
|
401 |
// Function numbers must match
|
|
402 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "TSDIOFunctionCaps - Match Function Numbers");) // @SymTraceDataInternalTechnology
|
|
403 |
aMatchFlags = (iNumber == aCaps.iNumber) ? aMatchFlags : 0;
|
|
404 |
}
|
|
405 |
if(aMatchFlags & TSDIOFunctionCaps::EFunctionType)
|
|
406 |
{
|
|
407 |
// Function type must match
|
|
408 |
aMatchFlags = (iType == aCaps.iType) ? aMatchFlags : 0;
|
|
409 |
}
|
|
410 |
if(aMatchFlags & TSDIOFunctionCaps::EHasCSA)
|
|
411 |
{
|
|
412 |
// Must contain a Code Storage Area
|
|
413 |
aMatchFlags = (iHasCSA == aCaps.iHasCSA) ? aMatchFlags : 0;
|
|
414 |
}
|
|
415 |
if(aMatchFlags & TSDIOFunctionCaps::EPowerFlags)
|
|
416 |
{
|
|
417 |
// High-Power support requirements must match
|
|
418 |
aMatchFlags = (iPowerFlags == aCaps.iPowerFlags) ? aMatchFlags : 0;
|
|
419 |
}
|
|
420 |
if(aMatchFlags & EFunctionInfo)
|
|
421 |
{
|
|
422 |
// Specified bits in TPLFE_FUNCTION_INFO definition must match
|
|
423 |
aMatchFlags = ((iFunctionInfo && aCaps.iFunctionInfo) == aCaps.iFunctionInfo) ? aMatchFlags : 0;
|
|
424 |
}
|
|
425 |
if(aMatchFlags & TSDIOFunctionCaps::ERevision)
|
|
426 |
{
|
|
427 |
// Revision code must match
|
|
428 |
aMatchFlags = (iRevision == aCaps.iRevision) ? aMatchFlags : 0;
|
|
429 |
}
|
|
430 |
if(aMatchFlags & TSDIOFunctionCaps::ESerialNumber)
|
|
431 |
{
|
|
432 |
// Serial number must match
|
|
433 |
aMatchFlags = (iSerialNumber == aCaps.iSerialNumber) ? aMatchFlags : 0;
|
|
434 |
}
|
|
435 |
if(aMatchFlags & ECSASize)
|
|
436 |
{
|
|
437 |
// Size of CSA must be greater than or equal to that requested
|
|
438 |
aMatchFlags = (iCSASize >= aCaps.iCSASize) ? aMatchFlags : 0;
|
|
439 |
}
|
|
440 |
if(aMatchFlags & ECSAProperties)
|
|
441 |
{
|
|
442 |
// Specified bits in TPLFE_CSA_PROPERTY definition must match
|
|
443 |
aMatchFlags = ((iCSAProperties && aCaps.iCSAProperties) == aCaps.iCSAProperties) ? aMatchFlags : 0;
|
|
444 |
}
|
|
445 |
if(aMatchFlags & EMaxBlockSize)
|
|
446 |
{
|
|
447 |
// Maximum block size must be greater than or equal to that specified
|
|
448 |
aMatchFlags = (iMaxBlockSize >= aCaps.iMaxBlockSize) ? aMatchFlags : 0;
|
|
449 |
}
|
|
450 |
if(aMatchFlags & TSDIOFunctionCaps::EOcr)
|
|
451 |
{
|
|
452 |
// Requested OCR is must be a subset of the card's supported OCR.
|
|
453 |
aMatchFlags = (iOCR & aCaps.iOCR) ? aMatchFlags : 0;
|
|
454 |
}
|
|
455 |
if(aMatchFlags & EMinPwrStby)
|
|
456 |
{
|
|
457 |
// Minimum Standby Power must not exceed that specified
|
|
458 |
aMatchFlags = (iMinPwrStby <= aCaps.iMinPwrStby) ? aMatchFlags : 0;
|
|
459 |
}
|
|
460 |
if(aMatchFlags & TSDIOFunctionCaps::EAvePwrStby)
|
|
461 |
{
|
|
462 |
// Average Standby Power must not exceed that specified
|
|
463 |
aMatchFlags = (iAvePwrStby <= aCaps.iAvePwrStby) ? aMatchFlags : 0;
|
|
464 |
}
|
|
465 |
if(aMatchFlags & EMaxPwrStby)
|
|
466 |
{
|
|
467 |
// Maximum Standby Power must not exceed that specified
|
|
468 |
aMatchFlags = (iMaxPwrStby <= aCaps.iMaxPwrStby) ? aMatchFlags : 0;
|
|
469 |
}
|
|
470 |
if(aMatchFlags & EMinPwrOp)
|
|
471 |
{
|
|
472 |
// Minimum Operating Power must not exceed that specified
|
|
473 |
aMatchFlags = (iMinPwrOp <= aCaps.iMinPwrOp) ? aMatchFlags : 0;
|
|
474 |
}
|
|
475 |
if(aMatchFlags & TSDIOFunctionCaps::EAvePwrOp)
|
|
476 |
{
|
|
477 |
// Average Operating Power must not exceed that specified
|
|
478 |
aMatchFlags = (iAvePwrOp <= aCaps.iAvePwrOp) ? aMatchFlags : 0;
|
|
479 |
}
|
|
480 |
if(aMatchFlags & EMaxPwrOp)
|
|
481 |
{
|
|
482 |
// Maximum Operating Power must not exceed that specified
|
|
483 |
aMatchFlags = (iMaxPwrOp <= aCaps.iMaxPwrOp) ? aMatchFlags : 0;
|
|
484 |
}
|
|
485 |
if(aMatchFlags & EAveHiPwr)
|
|
486 |
{
|
|
487 |
// Average High Power must not exceed that specified
|
|
488 |
aMatchFlags = (iAveHiPwr <= aCaps.iAveHiPwr) ? aMatchFlags : 0;
|
|
489 |
}
|
|
490 |
if(aMatchFlags & EMaxHiPwr)
|
|
491 |
{
|
|
492 |
// Maximum High Power must not exceed that specified
|
|
493 |
aMatchFlags = (iMaxHiPwr <= aCaps.iMaxHiPwr) ? aMatchFlags : 0;
|
|
494 |
}
|
|
495 |
if(aMatchFlags & EMinBandwidth)
|
|
496 |
{
|
|
497 |
// Minumum bandwidth must be less than or equal to that specified
|
|
498 |
aMatchFlags = (iMinBandwidth <= aCaps.iMinBandwidth) ? aMatchFlags : 0;
|
|
499 |
}
|
|
500 |
if(aMatchFlags & EOptBandwidth)
|
|
501 |
{
|
|
502 |
// Optimum bandwidth must be less than or equal to that specified
|
|
503 |
aMatchFlags = (iOptBandwidth <= aCaps.iOptBandwidth) ? aMatchFlags : 0;
|
|
504 |
}
|
|
505 |
if(aMatchFlags & EStandardFunctionID)
|
|
506 |
{
|
|
507 |
// The standard function ID must match
|
|
508 |
aMatchFlags = (iStandardFunctionID == aCaps.iStandardFunctionID) ? aMatchFlags : 0;
|
|
509 |
}
|
|
510 |
if(aMatchFlags & EStandardFunctionType)
|
|
511 |
{
|
|
512 |
// The standard function type must match
|
|
513 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "TSDIOFunctionCaps - Match standard function type");) // @SymTraceDataInternalTechnology
|
|
514 |
aMatchFlags = (iStandardFunctionType == aCaps.iStandardFunctionType) ? aMatchFlags : 0;
|
|
515 |
}
|
|
516 |
|
|
517 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "TSDIOFunctionCaps::CapabilitiesMatch aMatchFlags: 0x%x",aMatchFlags);) // @SymTraceDataInternalTechnology
|
|
518 |
TRACE2(TTraceContext(EBorder), UTraceModuleEPBusSDIO::ESDIOTSDIOFunctionCapabilitiesMatchReturning, reinterpret_cast<TUint32>(this), static_cast<TUint32>(aMatchFlags ? ETrue : EFalse)); // @SymTraceDataPublishedTvk
|
|
519 |
|
|
520 |
return(aMatchFlags ? ETrue : EFalse);
|
|
521 |
}
|
|
522 |
|
|
523 |
#ifdef _DEBUG
|
|
524 |
void TSDIOFunction::TraceFunctionInfo()
|
|
525 |
/**
|
|
526 |
Debug function to output the contents of the FBR
|
|
527 |
*/
|
|
528 |
{
|
|
529 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iNumber: 0x%02X", iCapabilities.iNumber)); // @SymTraceDataInternalTechnology
|
|
530 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iDevCodeEx: 0x%02X", iCapabilities.iDevCodeEx)); // @SymTraceDataInternalTechnology
|
|
531 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iType: 0x%02X", iCapabilities.iType)); // @SymTraceDataInternalTechnology
|
|
532 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iHasCSA: %d", iCapabilities.iHasCSA)); // @SymTraceDataInternalTechnology
|
|
533 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iPowerFlags: 0x%02X", iCapabilities.iPowerFlags)); // @SymTraceDataInternalTechnology
|
|
534 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iFunctionInfo: 0x%02X", iCapabilities.iFunctionInfo)); // @SymTraceDataInternalTechnology
|
|
535 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iRevision: 0x%02X", iCapabilities.iRevision)); // @SymTraceDataInternalTechnology
|
|
536 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iSerialNumber: 0x%08X", iCapabilities.iSerialNumber)); // @SymTraceDataInternalTechnology
|
|
537 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iCSASize: 0x%08X", iCapabilities.iCSASize)); // @SymTraceDataInternalTechnology
|
|
538 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iCSAProperties: 0x%02X", iCapabilities.iCSAProperties)); // @SymTraceDataInternalTechnology
|
|
539 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iMaxBlockSize: 0x%04X", iCapabilities.iMaxBlockSize)); // @SymTraceDataInternalTechnology
|
|
540 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iOCR: 0x%08X", iCapabilities.iOCR)); // @SymTraceDataInternalTechnology
|
|
541 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iMinPwrStby: 0x%02X", iCapabilities.iMinPwrStby)); // @SymTraceDataInternalTechnology
|
|
542 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iAvePwrStby: 0x%02X", iCapabilities.iAvePwrStby)); // @SymTraceDataInternalTechnology
|
|
543 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iMaxPwrStby: 0x%02X", iCapabilities.iMaxPwrStby)); // @SymTraceDataInternalTechnology
|
|
544 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iMinPwrOp: 0x%02X", iCapabilities.iMinPwrOp)); // @SymTraceDataInternalTechnology
|
|
545 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iAvePwrOp: 0x%02X", iCapabilities.iAvePwrOp)); // @SymTraceDataInternalTechnology
|
|
546 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iMaxPwrOp: 0x%02X", iCapabilities.iMaxPwrOp)); // @SymTraceDataInternalTechnology
|
|
547 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iMinBandwidth: 0x%04X", iCapabilities.iMinBandwidth)); // @SymTraceDataInternalTechnology
|
|
548 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iOptBandwidth: 0x%04X", iCapabilities.iOptBandwidth)); // @SymTraceDataInternalTechnology
|
|
549 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iEnableTimeout: 0x%02X", iCapabilities.iEnableTimeout)); // @SymTraceDataInternalTechnology
|
|
550 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iAveHiPwr: 0x%02X", iCapabilities.iAveHiPwr)); // @SymTraceDataInternalTechnology
|
|
551 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iMaxHiPwr: 0x%02X", iCapabilities.iMaxHiPwr)); // @SymTraceDataInternalTechnology
|
|
552 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iCisPtr: 0x%08X", iCisPtr)); // @SymTraceDataInternalTechnology
|
|
553 |
SYMBIAN_TRACE_SDIO_VERBOSE_ONLY(Printf(TTraceContext(EInternals), "iCsaPtr: 0x%08X", iCsaPtr)); // @SymTraceDataInternalTechnology
|
|
554 |
}
|
|
555 |
#endif
|