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 sdiocard.h
|
|
20 |
@internalTechnology
|
|
21 |
Class definitions for SDIO Card and Card Array objects
|
|
22 |
*/
|
|
23 |
|
|
24 |
#ifndef __SDIOCARD_H__
|
|
25 |
#define __SDIOCARD_H__
|
|
26 |
|
|
27 |
#include <kernel/kern_priv.h>
|
|
28 |
|
|
29 |
#include <drivers/sdio/interrupt.h>
|
|
30 |
#include <drivers/sdio/sdio.h>
|
|
31 |
#include <drivers/sdio/sdiopsu.h>
|
|
32 |
#include <drivers/sdio/function.h>
|
|
33 |
|
|
34 |
// Constants
|
|
35 |
|
|
36 |
const TUint32 KSDIOCardIsIOCard = KSDCardFirstCustomFlag;
|
|
37 |
const TUint32 KSDIOCardIsComboCard = KSDCardIsSDCard | KSDIOCardIsIOCard;
|
|
38 |
|
|
39 |
/**
|
|
40 |
@publishedPartner
|
|
41 |
@released
|
|
42 |
*/
|
|
43 |
const TUint32 KMaxSDIOFunctions = 7;
|
|
44 |
|
|
45 |
// Forward class declerations
|
|
46 |
|
|
47 |
class DSDIORegisterInterface;
|
|
48 |
class TSDIOFunction;
|
|
49 |
class TSDIOFunctionCaps;
|
|
50 |
|
|
51 |
// Classes
|
|
52 |
|
|
53 |
class TSDIOCardConfig
|
|
54 |
/**
|
|
55 |
TSDIOCardConfig Class
|
|
56 |
Contains the information on the card as obtained from the CCCR and CIS
|
|
57 |
*/
|
|
58 |
{
|
|
59 |
public:
|
|
60 |
IMPORT_C TSDIOCardConfig();
|
|
61 |
|
|
62 |
inline TUint MaxTranSpeedInKilohertz() const;
|
|
63 |
inline TUint16 ManufacturerID() const;
|
|
64 |
inline TUint16 CardID() const;
|
|
65 |
inline TUint16 Fn0MaxBlockSize() const;
|
|
66 |
inline TUint CisPtr() const;
|
|
67 |
inline TBool SupportsFullBusWidth() const;
|
|
68 |
inline TBool IsLowSpeedCard() const;
|
|
69 |
inline TBool SupportsInterruptBetweenBlocks() const;
|
|
70 |
inline TBool SupportsSuspendResume() const;
|
|
71 |
inline TBool SupportsReadWait() const;
|
|
72 |
inline TBool SupportsMultiBlock() const;
|
|
73 |
inline TBool SupportsDirectCommandsDuringMultiBlock() const;
|
|
74 |
inline TBool SupportsHighSpeed() const;
|
|
75 |
|
|
76 |
private:
|
|
77 |
inline void Reset();
|
|
78 |
|
|
79 |
private:
|
|
80 |
TUint16 iManufacturerID; // The Manufacturer ID
|
|
81 |
TUint16 iCardID; // The Card ID
|
|
82 |
TUint16 iFn0MaxBlockSize; // The maximum block size for Function 0
|
|
83 |
TUint8 iMaxTranSpeed; // The maximum transfer rate (encoded)
|
|
84 |
TUint16 iCurrentBlockSize; // The current block size (of function 0)
|
|
85 |
private:
|
|
86 |
TUint8 iRevision; // SDIO/CCCR Revision (as CCCR offset 0x00)
|
|
87 |
TUint8 iSDFormatVer; // SD Format Version (as CCCR offset 0x01)
|
|
88 |
TUint8 iCardCaps; // Card Capabilities (as CCCR offset 0x08)
|
|
89 |
TUint32 iCommonCisP; // Common CIS Pointer (as CCCR offset 0x09:0x0B)
|
|
90 |
TUint8 iHighSpeed; // Contains the contents of the high speed register
|
|
91 |
|
|
92 |
friend class DSDIOStack; // These friends have responsibility
|
|
93 |
friend class TSDIOCard; // for maintaining the consistency
|
|
94 |
friend class TCisReader; // of these configuration parameters
|
|
95 |
|
|
96 |
//
|
|
97 |
// Reserved members to maintain binary compatibility
|
|
98 |
TInt iReserved[4];
|
|
99 |
};
|
|
100 |
|
|
101 |
|
|
102 |
class TSDIOCard : public TSDCard
|
|
103 |
/**
|
|
104 |
TSDIOCard Class
|
|
105 |
*/
|
|
106 |
{
|
|
107 |
private:
|
|
108 |
enum TSDIOCardState
|
|
109 |
{
|
|
110 |
ECardNotReady, // Card is absent or is powered down
|
|
111 |
ECardInitialising, // Card is initialising
|
|
112 |
ECardReady // Card is initialised and ready for use
|
|
113 |
};
|
|
114 |
enum TSDIOCisState
|
|
115 |
{
|
|
116 |
ECisNotReady, // CIS has not been parsed
|
|
117 |
ECisParsing, // CIS is being parsed (To be used in Asynchronous Reader)
|
|
118 |
ECisCorrupt, // The CIS is corrupt
|
|
119 |
ECisReady // The CIS is ready and valid
|
|
120 |
};
|
|
121 |
public:
|
|
122 |
TSDIOCard();
|
|
123 |
virtual ~TSDIOCard();
|
|
124 |
|
|
125 |
inline TBool IsIOCard() const;
|
|
126 |
inline TBool IsComboCard() const;
|
|
127 |
inline TUint8 FunctionCount() const;
|
|
128 |
inline TSDIOFunction* IoFunction(TUint8 aFunctionNo) const;
|
|
129 |
inline DSDIORegisterInterface* CommonRegisterInterface() const;
|
|
130 |
inline TSDIOInterruptController& InterruptController();
|
|
131 |
inline TBool IsReady();
|
|
132 |
inline const TSDIOCardConfig& CommonConfig() const;
|
|
133 |
|
|
134 |
virtual TUint MaxTranSpeedInKilohertz() const;
|
|
135 |
|
|
136 |
IMPORT_C TSDIOFunction* FindFunction(TSDIOFunctionCaps& aCaps, TUint32 aMatchFlags, TSDIOFunction* aFunctionP = NULL) const;
|
|
137 |
|
|
138 |
IMPORT_C TInt CheckCIS();
|
|
139 |
|
|
140 |
private:
|
|
141 |
TInt Create(DMMCStack* aStackP);
|
|
142 |
|
|
143 |
TInt Open(TUint8 aFunctionCount);
|
|
144 |
TInt Close();
|
|
145 |
|
|
146 |
TInt CreateFunction(TUint8 aFunctionNumber);
|
|
147 |
|
|
148 |
inline void ClientRegistered();
|
|
149 |
inline void ClientDeregistered();
|
|
150 |
|
|
151 |
private:
|
|
152 |
TUint8 iFunctionCount;
|
|
153 |
TSDIOFunction* iFunctions[KMaxSDIOFunctions];
|
|
154 |
DSDIORegisterInterface* iCommonRegIfcP; // Common Register Interface (for function 0)
|
|
155 |
DMutex* iMutexLock; // Critical Access Mutex Lock
|
|
156 |
TSDIOInterruptController iInterruptController;
|
|
157 |
TSDIOCardState iCardState; // The state of the Card
|
|
158 |
TBool iCisState; // The state of the CIS
|
|
159 |
TInt iClientCount; // Keeps track of the number of registered clients
|
|
160 |
|
|
161 |
TSDIOCardConfig iCommonConfig;
|
|
162 |
|
|
163 |
protected:
|
|
164 |
DMMCStack* iStackP;
|
|
165 |
|
|
166 |
friend class TSDIOCardArray;
|
|
167 |
friend class DSDIOStack;
|
|
168 |
friend class DSDIORegisterInterface;
|
|
169 |
friend class TSDIOFunction;
|
|
170 |
friend class TSDIOInterruptController;
|
|
171 |
|
|
172 |
private:
|
|
173 |
//
|
|
174 |
// Reserved members to maintain binary compatibility
|
|
175 |
TInt iReserved[4];
|
|
176 |
};
|
|
177 |
|
|
178 |
class TSDIOCardArray : public TSDCardArray
|
|
179 |
/**
|
|
180 |
TSDIOCardArray Class
|
|
181 |
*/
|
|
182 |
{
|
|
183 |
public:
|
|
184 |
inline TSDIOCardArray(DSDIOStack* aOwningStack);
|
|
185 |
IMPORT_C virtual TInt AllocCards();
|
|
186 |
|
|
187 |
inline TSDIOCard& Card(TUint aCardNumber) const;
|
|
188 |
inline TSDIOCard& NewCard(TUint aCardNumber) const;
|
|
189 |
|
|
190 |
TInt AddSDIOCard(TUint aCardNumber, TRCA& anRCA, TUint8 aFunctionCount);
|
|
191 |
TInt AddSDCard(TUint aCardNumber, TRCA& anRCA);
|
|
192 |
|
|
193 |
IMPORT_C virtual void DeclareCardAsGone(TUint aCardNumber);
|
|
194 |
};
|
|
195 |
|
|
196 |
#include <drivers/sdio/sdiocard.inl>
|
|
197 |
|
|
198 |
#endif // #ifndef __SDIOCARD_H__
|