0
|
1 |
/*
|
|
2 |
* Copyright (c) 2003 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 the License "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 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#ifndef __SDIOCARD_INL__
|
|
20 |
#define __SDIOCARD_INL__
|
|
21 |
|
|
22 |
#include <drivers/sdio/sdiodefs.h>
|
|
23 |
|
|
24 |
// ======== TSDIOCard ========
|
|
25 |
|
|
26 |
inline TBool TSDIOCard::IsIOCard() const
|
|
27 |
/**
|
|
28 |
@publishedPartner
|
|
29 |
@released
|
|
30 |
|
|
31 |
Returns ETrue if the card is an SDIO Card
|
|
32 |
|
|
33 |
@return ETrue if the card is an SDIO Card
|
|
34 |
*/
|
|
35 |
{ return(iFlags&KSDIOCardIsIOCard); }
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
inline TBool TSDIOCard::IsComboCard() const
|
|
41 |
/**
|
|
42 |
@publishedPartner
|
|
43 |
@released
|
|
44 |
|
|
45 |
Returns ETrue if the card is a Combo Card
|
|
46 |
|
|
47 |
@return ETrue if the card is a Combo Card
|
|
48 |
*/
|
|
49 |
{ return((iFlags&KSDIOCardIsComboCard) == KSDIOCardIsComboCard); }
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
inline TSDIOFunction* TSDIOCard::IoFunction(TUint8 aFunctionNo) const
|
|
56 |
/**
|
|
57 |
@publishedPartner
|
|
58 |
@released
|
|
59 |
|
|
60 |
Returns a pointer to IO Function object for the specified function number
|
|
61 |
|
|
62 |
@param aFunctionNo The function number (1 to 7)
|
|
63 |
|
|
64 |
@return A pointer to IO Function object for the specified function number
|
|
65 |
*/
|
|
66 |
{ return(iFunctionCount && aFunctionNo && (aFunctionNo <= KMaxSDIOFunctions) ? iFunctions[aFunctionNo-1] : NULL); };
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
inline TUint8 TSDIOCard::FunctionCount() const
|
|
72 |
/**
|
|
73 |
@publishedPartner
|
|
74 |
@released
|
|
75 |
|
|
76 |
Returns the number of IO functions present on the card
|
|
77 |
|
|
78 |
@return The number of IO functions present on the card
|
|
79 |
*/
|
|
80 |
{ return iFunctionCount; };
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
inline DSDIORegisterInterface* TSDIOCard::CommonRegisterInterface() const
|
|
86 |
/**
|
|
87 |
@publishedPartner
|
|
88 |
@released
|
|
89 |
|
|
90 |
Returns a pointer to the common register interface object
|
|
91 |
|
|
92 |
@return A pointer to the common register interface object
|
|
93 |
*/
|
|
94 |
{ return(iCommonRegIfcP); };
|
|
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
inline TSDIOInterruptController& TSDIOCard::InterruptController()
|
|
100 |
/**
|
|
101 |
Returns a reference to the interrupt controller
|
|
102 |
|
|
103 |
@return A reference to the interrupt controller
|
|
104 |
*/
|
|
105 |
{ return(iInterruptController); }
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
inline TBool TSDIOCard::IsReady()
|
|
111 |
/**
|
|
112 |
@publishedPartner
|
|
113 |
@released
|
|
114 |
|
|
115 |
Returns if the card is ready.
|
|
116 |
|
|
117 |
@return ETrue is the card is ready.
|
|
118 |
*/
|
|
119 |
{ return(iCardState == ECardReady); }
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
inline const TSDIOCardConfig& TSDIOCard::CommonConfig() const
|
|
125 |
/**
|
|
126 |
@publishedPartner
|
|
127 |
@released
|
|
128 |
|
|
129 |
Returns information about the common configuration of the SDIO card (Manufacturer ID etc.).
|
|
130 |
|
|
131 |
@return A reference to the TSDIOCardConfig containing the capabilities of the card.
|
|
132 |
|
|
133 |
@see TSDIOCardConfig
|
|
134 |
*/
|
|
135 |
{ return(iCommonConfig); }
|
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
inline void TSDIOCard::ClientRegistered()
|
|
141 |
/**
|
|
142 |
Called when a client registers with a function on the card
|
|
143 |
*/
|
|
144 |
{
|
|
145 |
TInt oldVal = __e32_atomic_add_ord32(&iClientCount, 1);
|
|
146 |
if(oldVal == 0)
|
|
147 |
{
|
|
148 |
((DSDIOPsu*)(iStackP->MMCSocket()->iVcc))->Lock();
|
|
149 |
}
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
inline void TSDIOCard::ClientDeregistered()
|
|
156 |
/**
|
|
157 |
Called when a client de-registers with a function on the card
|
|
158 |
*/
|
|
159 |
{
|
|
160 |
TInt oldVal = __e32_atomic_add_ord32(&iClientCount, TUint32(-1));
|
|
161 |
if(oldVal == 1)
|
|
162 |
{
|
|
163 |
((DSDIOPsu*)(iStackP->MMCSocket()->iVcc))->Unlock();
|
|
164 |
}
|
|
165 |
}
|
|
166 |
|
|
167 |
|
|
168 |
// ======== TSDIOCardArray ========
|
|
169 |
|
|
170 |
inline TSDIOCardArray::TSDIOCardArray(DSDIOStack* aOwningStack)
|
|
171 |
: TSDCardArray((DStackBase *)(aOwningStack))
|
|
172 |
{ /* empty */ }
|
|
173 |
|
|
174 |
|
|
175 |
|
|
176 |
/**
|
|
177 |
@publishedPartner
|
|
178 |
@released
|
|
179 |
|
|
180 |
Returns a TSDIOCard object for an available card
|
|
181 |
@param aCardNumber The card number
|
|
182 |
@return The TSDIOCard object
|
|
183 |
*/
|
|
184 |
inline TSDIOCard& TSDIOCardArray::Card(TUint aCardNumber) const
|
|
185 |
{ return *static_cast<TSDIOCard*>(iCards[aCardNumber]); }
|
|
186 |
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
inline TSDIOCard& TSDIOCardArray::NewCard(TUint aCardNumber) const
|
|
191 |
{ return *static_cast<TSDIOCard*>(iNewCards[aCardNumber]); }
|
|
192 |
|
|
193 |
|
|
194 |
// ======== TSDIOCardConfig ========
|
|
195 |
|
|
196 |
inline void TSDIOCardConfig::Reset()
|
|
197 |
/**
|
|
198 |
Resets the configuration values to a default state
|
|
199 |
*/
|
|
200 |
{ memclr(this, sizeof(TSDIOCardConfig)); }
|
|
201 |
|
|
202 |
|
|
203 |
|
|
204 |
|
|
205 |
inline TUint TSDIOCardConfig::MaxTranSpeedInKilohertz() const
|
|
206 |
/**
|
|
207 |
@publishedPartner
|
|
208 |
@released
|
|
209 |
|
|
210 |
The maximum transfer speed per data line (in KHz)
|
|
211 |
@return The maximum transfer speed per data line (in KHz)
|
|
212 |
*/
|
|
213 |
{
|
|
214 |
// tranRateUnits entries are all divided by ten so tranRateValues can be integers
|
|
215 |
static const TUint tranRateUnits[8] = {10,100,1000,10000,10,10,10,10};
|
|
216 |
static const TUint8 tranRateValues[16] = {10,10,12,13,15,20,25,30,35,40,45,50,55,60,70,80};
|
|
217 |
return( tranRateUnits[iMaxTranSpeed & 0x07] * tranRateValues[(iMaxTranSpeed >> 3) & 0x0F] );
|
|
218 |
}
|
|
219 |
|
|
220 |
|
|
221 |
|
|
222 |
|
|
223 |
inline TUint16 TSDIOCardConfig::ManufacturerID() const
|
|
224 |
/**
|
|
225 |
@publishedPartner
|
|
226 |
@released
|
|
227 |
|
|
228 |
Returns the Manufacturer ID as obtained from the CIS.
|
|
229 |
@return The Manufacturer ID as obtained from the CIS.
|
|
230 |
*/
|
|
231 |
{ return(iManufacturerID); }
|
|
232 |
|
|
233 |
|
|
234 |
|
|
235 |
|
|
236 |
inline TUint16 TSDIOCardConfig::CardID() const
|
|
237 |
/**
|
|
238 |
@publishedPartner
|
|
239 |
@released
|
|
240 |
|
|
241 |
Returns the Card ID as obtained from the CIS.
|
|
242 |
@return The Card ID as obtained from the CIS.
|
|
243 |
*/
|
|
244 |
{ return(iCardID); }
|
|
245 |
|
|
246 |
|
|
247 |
|
|
248 |
|
|
249 |
inline TUint16 TSDIOCardConfig::Fn0MaxBlockSize() const
|
|
250 |
/**
|
|
251 |
@publishedPartner
|
|
252 |
@released
|
|
253 |
|
|
254 |
Returns the maximum block size of Function 0 as obtained from the CIS.
|
|
255 |
@return The maximum block size of Function 0 as obtained from the CIS.
|
|
256 |
*/
|
|
257 |
{ return(iFn0MaxBlockSize); }
|
|
258 |
|
|
259 |
|
|
260 |
|
|
261 |
|
|
262 |
inline TUint TSDIOCardConfig::CisPtr() const
|
|
263 |
/**
|
|
264 |
@publishedPartner
|
|
265 |
@released
|
|
266 |
|
|
267 |
Returns the address of the Common CIS
|
|
268 |
@return The address of the Common CIS
|
|
269 |
*/
|
|
270 |
{ return(iCommonCisP); }
|
|
271 |
|
|
272 |
|
|
273 |
|
|
274 |
|
|
275 |
inline TBool TSDIOCardConfig::SupportsFullBusWidth() const
|
|
276 |
/**
|
|
277 |
@publishedPartner
|
|
278 |
@released
|
|
279 |
|
|
280 |
Returns ETrue if the card supports the full 4-bit bus.
|
|
281 |
This is manditory for Full-Speed cards, and optional for Low-Speed.
|
|
282 |
|
|
283 |
@return ETrue if the card supports the full 4-bit bus, EFalse otherwise.
|
|
284 |
*/
|
|
285 |
{
|
|
286 |
const TUint8 lowSpeed4BitMask = KSDIOCardCapsBitLSC | KSDIOCardCapsBit4BLS;
|
|
287 |
|
|
288 |
if(((iCardCaps & lowSpeed4BitMask) == lowSpeed4BitMask) || (IsLowSpeedCard() == EFalse))
|
|
289 |
{
|
|
290 |
return(ETrue);
|
|
291 |
}
|
|
292 |
else
|
|
293 |
{
|
|
294 |
return(EFalse);
|
|
295 |
}
|
|
296 |
}
|
|
297 |
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
inline TBool TSDIOCardConfig::IsLowSpeedCard() const
|
|
302 |
/**
|
|
303 |
@publishedPartner
|
|
304 |
@released
|
|
305 |
|
|
306 |
Returns ETrue if the card is a Low Speed Device.
|
|
307 |
@return ETrue if the card is a Low Speed Device, EFalse otherwise.
|
|
308 |
*/
|
|
309 |
{ return((iCardCaps & KSDIOCardCapsBitLSC) == KSDIOCardCapsBitLSC); }
|
|
310 |
|
|
311 |
|
|
312 |
|
|
313 |
|
|
314 |
inline TBool TSDIOCardConfig::SupportsInterruptBetweenBlocks() const
|
|
315 |
/**
|
|
316 |
@publishedPartner
|
|
317 |
@released
|
|
318 |
|
|
319 |
Returns ETrue if the card supports interrupts between Multi-Block data transfer.
|
|
320 |
@return ETrue if the card supports interrupts between Multi-Block data transfer, EFalse otherwise.
|
|
321 |
*/
|
|
322 |
{ return((iCardCaps & KSDIOCardCapsBitS4MI) == KSDIOCardCapsBitS4MI); }
|
|
323 |
|
|
324 |
|
|
325 |
|
|
326 |
|
|
327 |
inline TBool TSDIOCardConfig::SupportsSuspendResume() const
|
|
328 |
/**
|
|
329 |
@publishedPartner
|
|
330 |
@released
|
|
331 |
|
|
332 |
Returns ETrue if the card supports the Suspend/Resume Protocol.
|
|
333 |
@return ETrue if the card supports the Suspend/Resume Protocol, EFalse otherwise.
|
|
334 |
*/
|
|
335 |
{ return((iCardCaps & KSDIOCardCapsBitSBS) == KSDIOCardCapsBitSBS); }
|
|
336 |
|
|
337 |
|
|
338 |
|
|
339 |
|
|
340 |
inline TBool TSDIOCardConfig::SupportsReadWait() const
|
|
341 |
/**
|
|
342 |
@publishedPartner
|
|
343 |
@released
|
|
344 |
|
|
345 |
Returns ETrue if the card supports the Read/Wait Protocol.
|
|
346 |
@return ETrue if the card supports the the Read/Wait Protocol, EFalse otherwise.
|
|
347 |
*/
|
|
348 |
{ return((iCardCaps & KSDIOCardCapsBitSRW) == KSDIOCardCapsBitSRW); }
|
|
349 |
|
|
350 |
|
|
351 |
|
|
352 |
|
|
353 |
inline TBool TSDIOCardConfig::SupportsMultiBlock() const
|
|
354 |
/**
|
|
355 |
@publishedPartner
|
|
356 |
@released
|
|
357 |
|
|
358 |
Returns ETrue if the card supports the Multi-Block mode of data transfer.
|
|
359 |
@return ETrue if the card supports the Multi-Block mode of data transfer, EFalse otherwise.
|
|
360 |
*/
|
|
361 |
{ return((iCardCaps & KSDIOCardCapsBitSMB) == KSDIOCardCapsBitSMB); }
|
|
362 |
|
|
363 |
|
|
364 |
|
|
365 |
|
|
366 |
inline TBool TSDIOCardConfig::SupportsDirectCommandsDuringMultiBlock() const
|
|
367 |
/**
|
|
368 |
@publishedPartner
|
|
369 |
@released
|
|
370 |
|
|
371 |
Returns ETrue if the card supports the issuing of Direct Commands during DAT[3:0] transfer.
|
|
372 |
@return ETrue if the card supports the issuing of Direct Commands during DAT[3:0] transfer, EFalse otherwise.
|
|
373 |
*/
|
|
374 |
{ return((iCardCaps & KSDIOCardCapsBitSDC) == KSDIOCardCapsBitSDC); }
|
|
375 |
|
|
376 |
|
|
377 |
inline TBool TSDIOCardConfig::SupportsHighSpeed() const
|
|
378 |
/**
|
|
379 |
@publishedPartner
|
|
380 |
@released
|
|
381 |
|
|
382 |
Returns ETrue if the card supports High Speed Mode.
|
|
383 |
@return ETrue if the card supports High Speed Mode, EFalse otherwise.
|
|
384 |
*/
|
|
385 |
{ return((iHighSpeed & KSDIOCardHighSpeedEHS) == KSDIOCardHighSpeedEHS); }
|
|
386 |
|
|
387 |
|
|
388 |
|
|
389 |
#endif // #ifndef __SDIOCARD_INL__
|
|
390 |
|