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 |
@file sdio.inl
|
|
20 |
@internalTechnology
|
|
21 |
Inline functions for the DSDIOSession and DSDIOStack classes
|
|
22 |
*/
|
|
23 |
|
|
24 |
#ifndef __SDIO_INL__
|
|
25 |
#define __SDIO_INL__
|
|
26 |
|
|
27 |
// -------- class TSDIOResponseR5 --------
|
|
28 |
|
|
29 |
inline TSDIOResponseR5::TSDIOResponseR5(const TUint8* aPtr)
|
|
30 |
/**
|
|
31 |
Constructs a TSDIOResponseR5 from the supplied response.
|
|
32 |
@param aPtr A pointer to the Little-Endian Response to the IO command.
|
|
33 |
*/
|
|
34 |
: iData(TMMC::BigEndian32(aPtr))
|
|
35 |
{}
|
|
36 |
|
|
37 |
inline TSDIOResponseR5::TSDIOResponseR5(const TUint32& aData)
|
|
38 |
/**
|
|
39 |
Constructs a TSDIOResponseR5 from the supplied response.
|
|
40 |
@param aData A reference to the Big-Endian Response to the IO command.
|
|
41 |
*/
|
|
42 |
: iData(aData)
|
|
43 |
{}
|
|
44 |
|
|
45 |
inline TSDIOResponseR5::operator TUint32() const
|
|
46 |
/**
|
|
47 |
TUint32 Conversion Operator.
|
|
48 |
@return The response in Big-Endian format.
|
|
49 |
*/
|
|
50 |
{ return(iData); }
|
|
51 |
|
|
52 |
inline TUint32 TSDIOResponseR5::Error() const
|
|
53 |
/**
|
|
54 |
Returns the error contained within the R5 response.
|
|
55 |
@return The error contained within the R5 response.
|
|
56 |
*/
|
|
57 |
{ return(iData & KSDIOErrorMask); }
|
|
58 |
|
|
59 |
inline TSDIOCardStateEnum TSDIOResponseR5::State() const
|
|
60 |
/**
|
|
61 |
Returns the current state of the SDIO bus.
|
|
62 |
@return The current state of the SDIO bus.
|
|
63 |
*/
|
|
64 |
{ return((TSDIOCardStateEnum)(iData & KSDIOCurrentStateMask)); }
|
|
65 |
|
|
66 |
|
|
67 |
inline TUint8 TSDIOResponseR5::Data() const
|
|
68 |
/**
|
|
69 |
Returns the data field contained in the R5 response.
|
|
70 |
@return The data field contained in the R5 response.
|
|
71 |
*/
|
|
72 |
{ return((TUint8)(iData & KSDIODataMask)); }
|
|
73 |
|
|
74 |
|
|
75 |
// ======== DSDIOSession ========
|
|
76 |
|
|
77 |
inline DSDIOSession::DSDIOSession(const TMMCCallBack& aCallBack)
|
|
78 |
: DSessionBase(aCallBack),
|
|
79 |
iFunctionNumber(0)
|
|
80 |
/**
|
|
81 |
@publishedPartner
|
|
82 |
@released
|
|
83 |
|
|
84 |
Constructs a DSDIOSession object using the specified client callback.
|
|
85 |
|
|
86 |
@param aCallBack Completion Callback
|
|
87 |
*/
|
|
88 |
{}
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
inline DSDIOSession::DSDIOSession(const TMMCCallBack& aCallBack, TUint8 aFunctionNumber)
|
|
94 |
: DSessionBase(aCallBack),
|
|
95 |
iFunctionNumber(aFunctionNumber)
|
|
96 |
/**
|
|
97 |
@publishedPartner
|
|
98 |
@released
|
|
99 |
|
|
100 |
Constructs a DSDIOSession object using the specified client callback and function number.
|
|
101 |
|
|
102 |
@param aCallBack Completion callback
|
|
103 |
@param aFunctionNumber Function number
|
|
104 |
*/
|
|
105 |
{}
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
inline void DSDIOSession::SetCallback(const TMMCCallBack& aCallBack)
|
|
111 |
/**
|
|
112 |
Returns the function number upon which this session operates
|
|
113 |
|
|
114 |
@return The function number
|
|
115 |
*/
|
|
116 |
{ iCallBack = aCallBack; }
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
inline TUint8 DSDIOSession::FunctionNumber() const
|
|
122 |
/**
|
|
123 |
Returns the function number upon which this session operates
|
|
124 |
|
|
125 |
@return The function number
|
|
126 |
*/
|
|
127 |
{ return(iFunctionNumber); }
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
inline void DSDIOSession::SetFunctionNumber(TUint8 aFunctionNumber)
|
|
133 |
/**
|
|
134 |
Sets the function number upon which this session operates
|
|
135 |
*/
|
|
136 |
{ iFunctionNumber = aFunctionNumber; }
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
141 |
inline void DSDIOSession::FillAddressParam(TUint32& aParam, TUint8 aFunction, TUint32 aAddr)
|
|
142 |
/**
|
|
143 |
Fills the address and function number parameters into the 32-bit command parameter
|
|
144 |
(Assumes that the function and address bits are already stuffed with zero's)
|
|
145 |
*/
|
|
146 |
{
|
|
147 |
aParam |= (aFunction & KSdioCmdFunctionMask) << KSdioCmdFunctionShift;
|
|
148 |
aParam |= (aAddr & KSdioCmdAddressMask) << KSdioCmdAddressShift;
|
|
149 |
}
|
|
150 |
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
inline void DSDIOSession::ModifyBits(TUint8& aValue)
|
|
155 |
/**
|
|
156 |
Modifies the parameter aValue using iSetBits/iClrBits
|
|
157 |
*/
|
|
158 |
{
|
|
159 |
aValue &= ~iClrBits;
|
|
160 |
aValue |= iSetBits;
|
|
161 |
}
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
|
166 |
inline void DSDIOSession::UnblockInterrupt(TMMCErr aReason)
|
|
167 |
/**
|
|
168 |
Unblocks the session with the KMMCBlockOnInterrupt flag
|
|
169 |
*/
|
|
170 |
{
|
|
171 |
iState |= KMMCSessStateDoDFC;
|
|
172 |
UnBlock(KMMCBlockOnInterrupt, aReason);
|
|
173 |
}
|
|
174 |
|
|
175 |
|
|
176 |
|
|
177 |
|
|
178 |
// ======== DSDIOStack ========
|
|
179 |
|
|
180 |
inline DSDIOStack::DSDIOStack(TInt aBus, DMMCSocket* aSocketP)
|
|
181 |
: DStackBase(aBus, aSocketP)
|
|
182 |
/**
|
|
183 |
@publishedPartner
|
|
184 |
@released
|
|
185 |
|
|
186 |
Constructs a DSDIOStack object
|
|
187 |
|
|
188 |
@param aBus Unused
|
|
189 |
@param aSocketP A pointer to the associated socket.
|
|
190 |
*/
|
|
191 |
{}
|
|
192 |
|
|
193 |
|
|
194 |
|
|
195 |
inline DSDIOSession& DSDIOStack::SDIOSession()
|
|
196 |
/**
|
|
197 |
@publishedPartner
|
|
198 |
@released
|
|
199 |
|
|
200 |
Returns a reference to the current session
|
|
201 |
|
|
202 |
@return A reference to the current session
|
|
203 |
*/
|
|
204 |
{ return static_cast<DSDIOSession&>(Session()); }
|
|
205 |
|
|
206 |
|
|
207 |
inline DSDIOSession* DSDIOStack::CommandSessionP()
|
|
208 |
/**
|
|
209 |
Returns the pointer to the current Command Session.
|
|
210 |
Valid if the Variant has blocked using BlockIOSession specifying ESDIOBlockOnCommand.
|
|
211 |
|
|
212 |
@return The pointer to the current Command Session
|
|
213 |
|
|
214 |
@see DSDIOStack::BlockIOSession
|
|
215 |
@see DSDIOStack::DataSessionP
|
|
216 |
*/
|
|
217 |
{ return(iCmdSessionP); }
|
|
218 |
|
|
219 |
|
|
220 |
inline DSDIOSession* DSDIOStack::DataSessionP()
|
|
221 |
/**
|
|
222 |
Returns the pointer to the current Data Session.
|
|
223 |
Valid if the Variant has blocked using BlockIOSession specifying ESDIOBlockOnData.
|
|
224 |
|
|
225 |
@return The pointer to the current Data Session
|
|
226 |
|
|
227 |
@see DSDIOStack::BlockIOSession
|
|
228 |
@see DSDIOStack::CommandSessionP
|
|
229 |
*/
|
|
230 |
{ return(iDataSessionP); }
|
|
231 |
|
|
232 |
inline TMMCErr DSDIOStack::BaseModifyCardCapabilitySMST( TAny* aStackP )
|
|
233 |
{ return( static_cast<DSDIOStack *>(aStackP)->DSDIOStack::ModifyCardCapabilitySM() ); }
|
|
234 |
|
|
235 |
inline TSDIOCardArray& DSDIOStack::CardArray() const
|
|
236 |
/**
|
|
237 |
@publishedPartner
|
|
238 |
@released
|
|
239 |
|
|
240 |
Returns a reference to the card array
|
|
241 |
|
|
242 |
@return A reference to the card array
|
|
243 |
*/
|
|
244 |
{ return *(TSDIOCardArray*)iCardArray; }
|
|
245 |
|
|
246 |
#endif // #ifndef __SDIO_INL__
|
|
247 |
|