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 |
// Class definitions for SDIO Function
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file function.h
|
|
20 |
@internalTechnology
|
|
21 |
*/
|
|
22 |
|
|
23 |
#ifndef __FUNCTION_H__
|
|
24 |
#define __FUNCTION_H__
|
|
25 |
|
|
26 |
#include <kernel/kernel.h>
|
|
27 |
#include <drivers/sdio/interrupt.h>
|
|
28 |
|
|
29 |
class DSDIORegisterInterface;
|
|
30 |
class TSDIOCard;
|
|
31 |
|
|
32 |
#ifdef _DEBUG
|
|
33 |
#define TRACE_FUNCTION_INFO(pThis) pThis->TraceFunctionInfo();
|
|
34 |
#else
|
|
35 |
#define TRACE_FUNCTION_INFO(pThis) {};
|
|
36 |
#endif
|
|
37 |
|
|
38 |
const TUint32 KDefaultFunctionEnableTimeout = 200; // 2 Seconds (specified in 10mS steps)
|
|
39 |
|
|
40 |
enum TSdioFunctionType
|
|
41 |
/**
|
|
42 |
@publishedPartner
|
|
43 |
@released
|
|
44 |
|
|
45 |
These define the standard SDIO Function Types
|
|
46 |
These are defined by the SDA and provide a standard, common
|
|
47 |
register interface for each class of peripheral.
|
|
48 |
*/
|
|
49 |
{
|
|
50 |
/** Not an SDIO standard interface */
|
|
51 |
ESdioFunctionTypeUnknown = 0,
|
|
52 |
/** SDIO UART standard interface */
|
|
53 |
ESdioFunctionTypeUART = 1,
|
|
54 |
/** SDIO 'thin' Bluetooth standard interface */
|
|
55 |
ESdioFunctionTypeThinBT = 2,
|
|
56 |
/** SDIO 'complete' Bluetooth standard interface */
|
|
57 |
ESdioFunctionTypeFullBT = 3,
|
|
58 |
/** SDIO GPS standard interface */
|
|
59 |
ESdioFunctionTypeGPS = 4,
|
|
60 |
/** SDIO Camera standard interface */
|
|
61 |
ESdioFunctionTypeCamera = 5,
|
|
62 |
/** SDIO PHS Radio standard interface */
|
|
63 |
ESdioFunctionTypePHS = 6,
|
|
64 |
/** SDIO WLAN standard interface (Introduced in SDIO Rev. 1.10f) */
|
|
65 |
ESdioFunctionTypeWLAN = 7,
|
|
66 |
/** Extended SDIO standard interface (Introduced in SDIO Rev. 1.10f) */
|
|
67 |
ESdioFunctionTypeExtended = 15,
|
|
68 |
};
|
|
69 |
|
|
70 |
class TSDIOFunctionCaps
|
|
71 |
/**
|
|
72 |
@publishedPartner
|
|
73 |
@released
|
|
74 |
|
|
75 |
Contains the capabilities of a function.
|
|
76 |
*/
|
|
77 |
{
|
|
78 |
public:
|
|
79 |
inline TSDIOFunctionCaps();
|
|
80 |
|
|
81 |
IMPORT_C TBool CapabilitiesMatch(TSDIOFunctionCaps& aCaps, TUint32 aMatchFlags);
|
|
82 |
|
|
83 |
public:
|
|
84 |
//
|
|
85 |
// The following data is obtained from the functions FBR
|
|
86 |
//
|
|
87 |
|
|
88 |
/** Function number within the card */
|
|
89 |
TUint8 iNumber;
|
|
90 |
/** Extended devide code */
|
|
91 |
TUint8 iDevCodeEx;
|
|
92 |
/** Type of function */
|
|
93 |
TSdioFunctionType iType;
|
|
94 |
/** Function contains Code Storage Area */
|
|
95 |
TBool iHasCSA;
|
|
96 |
/** High-Power Requirements */
|
|
97 |
TUint8 iPowerFlags;
|
|
98 |
|
|
99 |
//
|
|
100 |
// The following data is obtained from the functions CIS
|
|
101 |
//
|
|
102 |
|
|
103 |
/** Function Info */
|
|
104 |
TUint8 iFunctionInfo;
|
|
105 |
/** Function revision of standard function */
|
|
106 |
TUint8 iRevision;
|
|
107 |
/** Product Serial Number */
|
|
108 |
TUint32 iSerialNumber;
|
|
109 |
/** CSA Size */
|
|
110 |
TUint32 iCSASize;
|
|
111 |
/** CSA Properties */
|
|
112 |
TUint8 iCSAProperties;
|
|
113 |
/** Maximum Block Size */
|
|
114 |
TUint16 iMaxBlockSize;
|
|
115 |
/** 32-Bit SD OCR */
|
|
116 |
TUint32 iOCR;
|
|
117 |
/** Minimum standby current (mA) */
|
|
118 |
TUint8 iMinPwrStby;
|
|
119 |
/** Average standby current (mA) */
|
|
120 |
TUint8 iAvePwrStby;
|
|
121 |
/** Maximum standby current (mA) */
|
|
122 |
TUint8 iMaxPwrStby;
|
|
123 |
/** Minumum operating current (mA) */
|
|
124 |
TUint8 iMinPwrOp;
|
|
125 |
/** Average operating current (mA) */
|
|
126 |
TUint8 iAvePwrOp;
|
|
127 |
/** Maximum operating current (mA) */
|
|
128 |
TUint8 iMaxPwrOp;
|
|
129 |
/** Minimum Bandwidth */
|
|
130 |
TUint16 iMinBandwidth;
|
|
131 |
/** Optimum Bandwidth */
|
|
132 |
TUint16 iOptBandwidth;
|
|
133 |
/** Enable Timeout (Added in SDIO Rev 1.1) */
|
|
134 |
TUint16 iEnableTimeout;
|
|
135 |
/** Average operating current required in High Power mode (mA) (Added in SDIO Rev 1.1) */
|
|
136 |
TUint16 iAveHiPwr;
|
|
137 |
/** Maximum operating current required in High Power mode (mA) (Added in SDIO Rev 1.1) */
|
|
138 |
TUint16 iMaxHiPwr;
|
|
139 |
|
|
140 |
/** Standard Function ID */
|
|
141 |
TUint8 iStandardFunctionID;
|
|
142 |
/** Standard Function Type */
|
|
143 |
TUint8 iStandardFunctionType;
|
|
144 |
|
|
145 |
enum TSDIOCapsMatch
|
|
146 |
/** These bits define the capabilities to match when enumerating SDIO functions.
|
|
147 |
@see TSDIOFunctionCaps::CapabilitiesMatch
|
|
148 |
@see TSDIOCard::FindFunction
|
|
149 |
*/
|
|
150 |
{
|
|
151 |
/** Specify EDontCare to match functions without specific properties */
|
|
152 |
EDontCare = KClear32,
|
|
153 |
/** Find functions with a specific function number */
|
|
154 |
EFunctionNumber = KBit0,
|
|
155 |
/** Find functions with a specific device code */
|
|
156 |
EFunctionType = KBit1,
|
|
157 |
/** Find functions that have a Code Storage Area */
|
|
158 |
EHasCSA = KBit2,
|
|
159 |
/** Find functions with specific High-Power support */
|
|
160 |
EPowerFlags = KBit3,
|
|
161 |
/** Find functions with specific capabilities (Currently only Wake-Up Supported) */
|
|
162 |
EFunctionInfo = KBit4,
|
|
163 |
/** Find functions with a specific revision code */
|
|
164 |
ERevision = KBit5,
|
|
165 |
/** Find functions with a specific serial number */
|
|
166 |
ESerialNumber = KBit6,
|
|
167 |
/** Find functions with a CSA size greater than or equal to that specified */
|
|
168 |
ECSASize = KBit7,
|
|
169 |
/** Find functions with specific CSA properties (re-formattable, write-protected) */
|
|
170 |
ECSAProperties = KBit8,
|
|
171 |
/** Find functions that support a block size greater than or equal to that specified */
|
|
172 |
EMaxBlockSize = KBit9,
|
|
173 |
/** Find functions that support a subset of the requested OCR */
|
|
174 |
EOcr = KBit10,
|
|
175 |
/** Find functions where the minimum standby current does not exceed that specified */
|
|
176 |
EMinPwrStby = KBit11,
|
|
177 |
/** Find functions where the average standby current does not exceed that specified */
|
|
178 |
EAvePwrStby = KBit12,
|
|
179 |
/** Find functions where the maximum standby current does not exceed that specified */
|
|
180 |
EMaxPwrStby = KBit13,
|
|
181 |
/** Find functions where the minimum operating current does not exceed that specified */
|
|
182 |
EMinPwrOp = KBit14,
|
|
183 |
/** Find functions where the average operating current does not exceed that specified */
|
|
184 |
EAvePwrOp = KBit15,
|
|
185 |
/** Find functions where the maximum operating current does not exceed that specified */
|
|
186 |
EMaxPwrOp = KBit16,
|
|
187 |
/** Find functions where the average operating current in high-power mode does not exceed that specified */
|
|
188 |
EAveHiPwr = KBit17,
|
|
189 |
/** Find functions where the maximum operating current in high-power mode does not exceed that specified */
|
|
190 |
EMaxHiPwr = KBit18,
|
|
191 |
/** Find functions that support bandwidth greater than or equal to that specified*/
|
|
192 |
EMinBandwidth = KBit19,
|
|
193 |
/** Find functions that support an optimum bandwidth greater than or equal to that specified*/
|
|
194 |
EOptBandwidth = KBit20,
|
|
195 |
/** Find functions with a specific standard function ID */
|
|
196 |
EStandardFunctionID = KBit21,
|
|
197 |
/** Find functions with a specific standard function type */
|
|
198 |
EStandardFunctionType = KBit22,
|
|
199 |
};
|
|
200 |
|
|
201 |
private:
|
|
202 |
//
|
|
203 |
// Reserved members to maintain binary compatibility
|
|
204 |
TInt iReserved[2];
|
|
205 |
};
|
|
206 |
|
|
207 |
enum TSDIOFunctionPriority
|
|
208 |
/**
|
|
209 |
@publishedPartner
|
|
210 |
@released
|
|
211 |
|
|
212 |
SDIO Function Priorities (used by the Suspend/Resume protocol and Interrupts)
|
|
213 |
@see TSDIOFunction::SetPriority
|
|
214 |
@todo How many priorities do we need??
|
|
215 |
*/
|
|
216 |
{
|
|
217 |
/** Low Priority */
|
|
218 |
ESdioPriorityLow,
|
|
219 |
/** Normal Priority */
|
|
220 |
ESdioPriorityNormal,
|
|
221 |
/** High Priority */
|
|
222 |
ESdioPriorityHigh,
|
|
223 |
};
|
|
224 |
|
|
225 |
class TSDIOFunction
|
|
226 |
/**
|
|
227 |
TSDIOFunction Class
|
|
228 |
|
|
229 |
The TSDIOFunction class provides access to functionality that is common to all SDIO Function classes.
|
|
230 |
It is intended that this class be used to create more complex function interfaces.
|
|
231 |
|
|
232 |
For example, an implementation of a UART function could be provided, exposing a common API
|
|
233 |
(similar to the SOC interface for the Integrator).
|
|
234 |
*/
|
|
235 |
{
|
|
236 |
public:
|
|
237 |
enum TPanic
|
|
238 |
{
|
|
239 |
ESDIOFunctionBadClientHandle,
|
|
240 |
ESDIOFunctionBadDeletion,
|
|
241 |
};
|
|
242 |
public:
|
|
243 |
IMPORT_C TSDIOFunction(TSDIOCard* aCardP, TUint8 aFunctionNumber);
|
|
244 |
IMPORT_C ~TSDIOFunction();
|
|
245 |
|
|
246 |
IMPORT_C TInt Enable(TBool aPollReady = ETrue);
|
|
247 |
IMPORT_C TInt Disable();
|
|
248 |
IMPORT_C TInt IsReady(TBool& aIsReady);
|
|
249 |
IMPORT_C TInt RegisterClient(DBase* aHandle, DMutex* aMutexLockP = NULL);
|
|
250 |
IMPORT_C TInt DeregisterClient(DBase* aHandle);
|
|
251 |
IMPORT_C TInt SetPriority(TSDIOFunctionPriority aPriority);
|
|
252 |
|
|
253 |
inline DSDIORegisterInterface* RegisterInterface(DBase* aHandle) const;
|
|
254 |
inline TSDIOInterrupt& Interrupt();
|
|
255 |
inline const TSDIOFunctionCaps& Capabilities() const;
|
|
256 |
|
|
257 |
inline TUint CisPtr() const;
|
|
258 |
inline TUint CsaPtr() const;
|
|
259 |
|
|
260 |
inline TUint8 FunctionNumber() const;
|
|
261 |
|
|
262 |
TInt ParseCIS();
|
|
263 |
|
|
264 |
private:
|
|
265 |
static TBool PollFunctionReady(TAny* aSelfP);
|
|
266 |
|
|
267 |
static void Panic(TSDIOFunction::TPanic aPanic);
|
|
268 |
|
|
269 |
void Close();
|
|
270 |
|
|
271 |
#ifdef _DEBUG
|
|
272 |
void TraceFunctionInfo();
|
|
273 |
#endif
|
|
274 |
|
|
275 |
private:
|
|
276 |
DBase* iClientHandle;
|
|
277 |
DSDIORegisterInterface* iRegisterInterfaceP;
|
|
278 |
TUint8 iFunctionNumber;
|
|
279 |
TUint32 iCisPtr;
|
|
280 |
TUint32 iCsaPtr;
|
|
281 |
TSDIOInterrupt iInterrupt;
|
|
282 |
TSDIOFunctionCaps iCapabilities;
|
|
283 |
TSDIOCard* iCardP;
|
|
284 |
TUint16 iCurrentBlockSize;
|
|
285 |
TInt iInstanceCount;
|
|
286 |
|
|
287 |
friend class TSDIOCard;
|
|
288 |
friend class DSDIOStack;
|
|
289 |
|
|
290 |
//
|
|
291 |
// Reserved members to maintain binary compatibility
|
|
292 |
TInt iReserved[4];
|
|
293 |
};
|
|
294 |
|
|
295 |
#include <drivers/sdio/function.inl>
|
|
296 |
|
|
297 |
#endif
|