Update contrib.
2 * Copyright (c) 2003 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
21 Class definitions for SDIO Card and Card Array objects
24 #ifndef __SDIOCARD_H__
25 #define __SDIOCARD_H__
27 #include <kernel/kern_priv.h>
29 #include <drivers/sdio/interrupt.h>
30 #include <drivers/sdio/sdio.h>
31 #include <drivers/sdio/sdiopsu.h>
32 #include <drivers/sdio/function.h>
36 const TUint32 KSDIOCardIsIOCard = KSDCardFirstCustomFlag;
37 const TUint32 KSDIOCardIsComboCard = KSDCardIsSDCard | KSDIOCardIsIOCard;
43 const TUint32 KMaxSDIOFunctions = 7;
45 // Forward class declerations
47 class DSDIORegisterInterface;
49 class TSDIOFunctionCaps;
56 Contains the information on the card as obtained from the CCCR and CIS
60 IMPORT_C TSDIOCardConfig();
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;
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)
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
92 friend class DSDIOStack; // These friends have responsibility
93 friend class TSDIOCard; // for maintaining the consistency
94 friend class TCisReader; // of these configuration parameters
97 // Reserved members to maintain binary compatibility
102 class TSDIOCard : public TSDCard
110 ECardNotReady, // Card is absent or is powered down
111 ECardInitialising, // Card is initialising
112 ECardReady // Card is initialised and ready for use
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
123 virtual ~TSDIOCard();
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;
134 virtual TUint MaxTranSpeedInKilohertz() const;
136 IMPORT_C TSDIOFunction* FindFunction(TSDIOFunctionCaps& aCaps, TUint32 aMatchFlags, TSDIOFunction* aFunctionP = NULL) const;
138 IMPORT_C TInt CheckCIS();
141 TInt Create(DMMCStack* aStackP);
143 TInt Open(TUint8 aFunctionCount);
146 TInt CreateFunction(TUint8 aFunctionNumber);
148 inline void ClientRegistered();
149 inline void ClientDeregistered();
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
161 TSDIOCardConfig iCommonConfig;
166 friend class TSDIOCardArray;
167 friend class DSDIOStack;
168 friend class DSDIORegisterInterface;
169 friend class TSDIOFunction;
170 friend class TSDIOInterruptController;
174 // Reserved members to maintain binary compatibility
178 class TSDIOCardArray : public TSDCardArray
184 inline TSDIOCardArray(DSDIOStack* aOwningStack);
185 IMPORT_C virtual TInt AllocCards();
187 inline TSDIOCard& Card(TUint aCardNumber) const;
188 inline TSDIOCard& NewCard(TUint aCardNumber) const;
190 TInt AddSDIOCard(TUint aCardNumber, TRCA& anRCA, TUint8 aFunctionCount);
191 TInt AddSDCard(TUint aCardNumber, TRCA& anRCA);
193 IMPORT_C virtual void DeclareCardAsGone(TUint aCardNumber);
196 #include <drivers/sdio/sdiocard.inl>
198 #endif // #ifndef __SDIOCARD_H__