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 // LDD for testing SDIO functions |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __D_SDIOIF_H__ |
|
19 #define __D_SDIOIF_H__ |
|
20 #include <e32cmn.h> |
|
21 |
|
22 #ifdef __KERNEL_MODE__ |
|
23 #include "function.h" |
|
24 #else |
|
25 #include <e32std.h> |
|
26 #endif |
|
27 #include "sdiotests.h" |
|
28 |
|
29 /** |
|
30 Defines the type of media. |
|
31 |
|
32 @internal |
|
33 @test |
|
34 */ |
|
35 enum TMmcMediaType |
|
36 { |
|
37 /** An MMC ROM card.*/ |
|
38 EMmcROM, |
|
39 /** An MMC Flash card.*/ |
|
40 EMmcFlash, |
|
41 /** An SDIO card.*/ |
|
42 EMmcIO, |
|
43 /** Another type of supported card.*/ |
|
44 EMmcOther, |
|
45 /** A non-supported card.*/ |
|
46 EMmcNotSupported |
|
47 }; |
|
48 |
|
49 /** |
|
50 Defines the SDIO Card Status. |
|
51 |
|
52 @internal |
|
53 @test |
|
54 @test |
|
55 */ |
|
56 enum TSdioCardStatus |
|
57 { |
|
58 /** An SDIO card is not present.*/ |
|
59 ESdioCardNotPresent, |
|
60 /** An SDIO card is present but is not ready to be accessed.*/ |
|
61 ESdioCardNotReady, |
|
62 /** An SDIO card is present but is not valid.*/ |
|
63 ESdioCardBad, |
|
64 /** An SDIO card is present and ready to be used.*/ |
|
65 ESdioCardReady |
|
66 }; |
|
67 |
|
68 typedef TInt TSocket; |
|
69 |
|
70 class TSdioFunctionInfo |
|
71 /** |
|
72 Class to encapsulate function information. |
|
73 |
|
74 @internal |
|
75 @test |
|
76 */ |
|
77 { |
|
78 public: |
|
79 inline TSdioFunctionInfo() |
|
80 /** |
|
81 Constructor. |
|
82 |
|
83 Sets the function type to unknown. |
|
84 */ |
|
85 : iType(ESdioFunctionTypeUnknown) { /* Empty */ } |
|
86 public: |
|
87 TSdioFunctionType iType; |
|
88 }; |
|
89 |
|
90 /** |
|
91 Defines the maximum number of functions an SDIO card can support. |
|
92 */ |
|
93 const TUint KMaxCardFunc=8; |
|
94 |
|
95 class TSdioCardInfo |
|
96 /** |
|
97 Class to encapsulate the SDIO card CCCR information. |
|
98 |
|
99 @internal |
|
100 @test |
|
101 */ |
|
102 { |
|
103 public: |
|
104 inline TSdioCardInfo() |
|
105 /** |
|
106 Constructor. |
|
107 |
|
108 Clears the memory and sets the media type to not supported. |
|
109 */ |
|
110 {memset(this, 0, sizeof(TSdioCardInfo)); iMediaType=EMmcNotSupported;} |
|
111 public: |
|
112 /** The ready status for the card.*/ |
|
113 TBool iIsReady; |
|
114 /** The lock status for the card.*/ |
|
115 TBool iIsLocked; |
|
116 /** The CID (Card Identification number) buffer.*/ |
|
117 TUint8 iCID[16]; |
|
118 /** The CSD (Card Specific Data register) buffer.*/ |
|
119 TUint8 iCSD[16]; |
|
120 /** The RCA (Relative Card Address).*/ |
|
121 TUint16 iRCA; |
|
122 /** The Media Type.*/ |
|
123 TMmcMediaType iMediaType; |
|
124 /** The SDIO card speed.*/ |
|
125 TUint iCardSpeed; |
|
126 /** Whether the SDIO card is a combo card i.e. has a memory portion.*/ |
|
127 TBool isComboCard; |
|
128 /** The number of function this card supports.*/ |
|
129 TInt iFuncCount; |
|
130 /** Information for each function.*/ |
|
131 TSdioFunctionInfo iFunction[KMaxCardFunc]; |
|
132 }; |
|
133 |
|
134 /** |
|
135 Package the TSdioCardInfo |
|
136 |
|
137 @internal |
|
138 @test |
|
139 */ |
|
140 typedef TPckgBuf<TSdioCardInfo> TSdioCardInfoPckg; |
|
141 |
|
142 /** |
|
143 Class to encapsulate the LDD version |
|
144 |
|
145 @internal |
|
146 @test |
|
147 */ |
|
148 class TCapsTestV01 |
|
149 { |
|
150 public: |
|
151 /** Version information.*/ |
|
152 TVersion iVersion; |
|
153 }; |
|
154 |
|
155 class TReadDirectData |
|
156 /** |
|
157 Class to encapsulate data read from the SDIO card |
|
158 |
|
159 @internal |
|
160 @test |
|
161 */ |
|
162 { |
|
163 public: |
|
164 inline TReadDirectData(TInt aAddr,TUint8 *aVal) |
|
165 /** |
|
166 Constructor. Sets the address and value buffer. |
|
167 |
|
168 @param aAddr The address of the register to read |
|
169 @param aVal The address to read the contents of the register into. |
|
170 */ |
|
171 : iAddr(aAddr), iVal(aVal) |
|
172 {} |
|
173 public: |
|
174 /** The register address.*/ |
|
175 TInt iAddr; |
|
176 /** The memory location to read data into.*/ |
|
177 TUint8* iVal; |
|
178 }; |
|
179 |
|
180 class RSdioCardCntrlIf : public RBusLogicalChannel |
|
181 /** |
|
182 Class for the user side logical device channel to the kernel side device driver (LDD). |
|
183 |
|
184 @internal |
|
185 @test |
|
186 */ |
|
187 { |
|
188 public: |
|
189 /** |
|
190 Defines the version information. |
|
191 |
|
192 @internal |
|
193 @test |
|
194 */ |
|
195 enum |
|
196 { |
|
197 /** The major version number.*/ |
|
198 EMajorVersionNumber=1, |
|
199 /** The minor version number.*/ |
|
200 EMinorVersionNumber=0, |
|
201 /** The build number.*/ |
|
202 EBuildVersionNumber=1 |
|
203 }; |
|
204 |
|
205 /** |
|
206 Defines the type of media. |
|
207 |
|
208 @internal |
|
209 @test |
|
210 */ |
|
211 enum |
|
212 { |
|
213 /** Retrieve the card information.*/ |
|
214 ESvCardInfo, |
|
215 |
|
216 /** Request the card to power up.*/ |
|
217 EReqPwrUp, |
|
218 /** Retrieve to read data from the card's registers.*/ |
|
219 ERequestReadDirect, |
|
220 /** Reset the CIS (Card information Structure) pointer.*/ |
|
221 ERequestResetCis, |
|
222 /** Retrieve the CCCR data.*/ |
|
223 ERequestGetCommonConfig, |
|
224 /** Retrieve the function information.*/ |
|
225 ERequestGetFunctionConfig, |
|
226 }; |
|
227 |
|
228 public: |
|
229 /** |
|
230 Cancel the current request. |
|
231 */ |
|
232 inline void Cancel(); |
|
233 |
|
234 /** |
|
235 Open a channel to the device driver. |
|
236 |
|
237 @param aSocket The socket number to open a channel for. |
|
238 @param aVer The version of the LDD required. |
|
239 |
|
240 @return One of the system wide codes. |
|
241 */ |
|
242 inline TInt Open(TInt aSocket, const TVersion& aVer) |
|
243 {return(DoCreate(_L("D_SDIOIF"),aVer,(TInt)aSocket,NULL,NULL));} |
|
244 |
|
245 /** |
|
246 Return the version required. |
|
247 |
|
248 @return The version required. |
|
249 */ |
|
250 inline TVersion VersionRequired() const |
|
251 {return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));} |
|
252 |
|
253 // |
|
254 // DoControl... |
|
255 // |
|
256 |
|
257 /** |
|
258 Return the card information. |
|
259 |
|
260 @param aInfo A pointer to a TSdioCardInfo class which will contain card information on completion. |
|
261 |
|
262 @return One of the system wide codes. |
|
263 */ |
|
264 inline TInt CardInfo(TSdioCardInfo *aInfo) |
|
265 {return(DoControl(ESvCardInfo, (TAny*)aInfo));} |
|
266 |
|
267 // |
|
268 // DoRequest... |
|
269 // |
|
270 |
|
271 /** |
|
272 Power up the SDIO card and the stack and stop it from powering down. |
|
273 |
|
274 @param aStatus On completion, the power up system wide error code. |
|
275 */ |
|
276 inline void PwrUpAndInitStack(TRequestStatus& aStatus) |
|
277 {DoRequest(EReqPwrUp,aStatus);} |
|
278 |
|
279 /** |
|
280 Read data from the SDIO card |
|
281 |
|
282 @param aStatus On completion, the power up system wide error code. |
|
283 @param aAddr The register address to read. |
|
284 @param aVal On completion, the value of the register. A TUint rather than TUint8 for alignment purposes. |
|
285 */ |
|
286 inline void ReadDirect(TRequestStatus& aStatus, TInt aAddr, TUint &aVal) |
|
287 { |
|
288 DoRequest(ERequestReadDirect, aStatus, (TAny*)aAddr, (TAny*)&aVal); |
|
289 } |
|
290 |
|
291 /** |
|
292 Reset the CIS pointer. |
|
293 |
|
294 @param aStatus On completion, the power up system wide error code. |
|
295 @param aFunc The function number to address on the card. |
|
296 */ |
|
297 inline void ResetCis(TRequestStatus& aStatus, TInt aFunc) |
|
298 { |
|
299 DoRequest(ERequestResetCis, aStatus, (TAny*)aFunc); |
|
300 } |
|
301 |
|
302 /** |
|
303 Get the SDIO card Common config. |
|
304 |
|
305 @param aStatus On completion, the power up system wide error code. |
|
306 @param aFunc The function number to address on the card. |
|
307 @param anInfo A pointer to a TSDIOCardConfig class which will contain coomon config information on completion. |
|
308 */ |
|
309 inline void GetCommonConfig(TRequestStatus& aStatus, TInt aFunc,TSDIOCardConfigTest *anInfo) |
|
310 { |
|
311 DoRequest(ERequestGetCommonConfig, aStatus, (TAny*)aFunc, (TAny*)anInfo); |
|
312 } |
|
313 |
|
314 /** |
|
315 Get the FBR (Function Basic Registers) data . |
|
316 |
|
317 @param aStatus On completion, the power up system wide error code. |
|
318 @param aFunc The function number to address on the card. |
|
319 @param anInfo A pointer to a TSDIOFunctionCaps class which will contain FBR information on completion. |
|
320 */ |
|
321 inline void GetFunctionConfig(TRequestStatus& aStatus, TInt aFunc, TSDIOFunctionCapsTest *anInfo) |
|
322 { |
|
323 DoRequest(ERequestGetFunctionConfig, aStatus, (TAny*)aFunc, (TAny*)anInfo); |
|
324 } |
|
325 }; |
|
326 |
|
327 #endif |
|