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 |
// e32\drivers\pbus\mmc\sdcard\sdio\cisreader.h
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
/**
|
|
19 |
@file cisreader.h
|
|
20 |
@publishedPartner
|
|
21 |
*/
|
|
22 |
|
|
23 |
#ifndef __CISREADER_H__
|
|
24 |
#define __CISREADER_H__
|
|
25 |
|
|
26 |
#include <drivers/sdio/sdio.h>
|
|
27 |
#include <drivers/sdio/function.h>
|
|
28 |
|
|
29 |
//
|
|
30 |
// General tuple parsing definitions
|
|
31 |
//
|
|
32 |
const TInt KSmallTplBufSize=16;
|
|
33 |
const TInt KLargeTplBufSize=257;
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
//// SDIO Tuple Definitions (Refer to SDIO Specification 16.5)
|
|
38 |
//// (CM - Common Mandatory, FM - Function Mandatory)
|
|
39 |
|
|
40 |
const TUint8 KSdioCisTplNull =0x00; // Null tuple
|
|
41 |
const TUint8 KSdioCisTplCheckSum =0x10; // Checksum control
|
|
42 |
const TUint8 KSdioCisTplVers1 =0x15; // Level 1 version/product information
|
|
43 |
const TUint8 KSdioCisTplAltStr =0x16; // Alternate Language String tuple
|
|
44 |
const TUint8 KSdioCisTplManfId =0x20; // Manufacturer Identification String tuple (CM)
|
|
45 |
const TUint8 KSdioCisTplFuncId =0x21; // Function Identification Tuple (FM)
|
|
46 |
const TUint8 KSdioCisTplFunce =0x22; // Function Extensions (FM)
|
|
47 |
const TUint8 KSdioCisTplVendorSpecificS =0x80; // Vendor Unique Tuple (Start)
|
|
48 |
const TUint8 KSdioCisTplVendorSpecificE =0x8F; // Vendor Unique Tuple (End)
|
|
49 |
const TUint8 KSdioCisTplSdioStd =0x91; // Adittional information for Standard Functions (FM)
|
|
50 |
const TUint8 KSdioCisTplSdioExt =0x92; // Reserved
|
|
51 |
const TUint8 KSdioCisTplEnd =0xFF; // End Of Chain Tuple (CM, FM)
|
|
52 |
|
|
53 |
//// Common Tuple Offsets
|
|
54 |
|
|
55 |
const TUint32 KSdioTupleOffsetType =0x00; // Offset to Tuple ID code
|
|
56 |
const TUint32 KSdioTupleOffsetLink =0x01; // Offset to Tuple Link
|
|
57 |
const TUint32 KSdioTupleOffsetData =0x02; // Offset to Tuple Specific Data
|
|
58 |
|
|
59 |
//
|
|
60 |
const TUint8 KNonSpecificTpl = 0xff;
|
|
61 |
const TUint8 KInvalidConfOpt = 0xff;
|
|
62 |
//
|
|
63 |
|
|
64 |
//
|
|
65 |
// SDIO Specific Tuple Information
|
|
66 |
//
|
|
67 |
|
|
68 |
// ...for KSdioCisTplManfId
|
|
69 |
const TUint8 KSdioManfIdOffManfIdLo = 0x02;
|
|
70 |
const TUint8 KSdioManfIdOffManfIdHi = 0x03;
|
|
71 |
const TUint8 KSdioManfIdOffCardIdLo = 0x04;
|
|
72 |
const TUint8 KSdioManfIdOffCardIdHi = 0x05;
|
|
73 |
|
|
74 |
// ...for KSdioCisTplStd
|
|
75 |
const TUint8 KSdioStdOffFunctionId = 0x02;
|
|
76 |
const TUint8 KSdioStdOffFunctionType = 0x03;
|
|
77 |
|
|
78 |
// ...for KSdioCisTplExt (Common and Function)
|
|
79 |
const TUint8 KSdioExtOffIdent = 0x02;
|
|
80 |
const TUint8 KSdioExtCmnIdent = 0x00; // Identifier for Common Extension
|
|
81 |
const TUint8 KSdioExtFuncIdent = 0x01; // Identifier for Function Extension
|
|
82 |
|
|
83 |
// ...for KSdioCisTplExt (Common)
|
|
84 |
const TUint8 KSdioCisTplExtCmnLen = 0x04;
|
|
85 |
|
|
86 |
const TUint8 KSdioExtCmnOffFn0MBSLo = 0x03;
|
|
87 |
const TUint8 KSdioExtCmnOffFn0MBSHi = 0x04;
|
|
88 |
const TUint8 KSdioExtCmnOffMaxTranSpeed = 0x05;
|
|
89 |
|
|
90 |
// ...for KSdioCisTplExt (Function)
|
|
91 |
const TUint8 KSdioCisTplExtFuncLen1_0 = 0x1E; // Length of Tuple for SDIO Ver 1.0
|
|
92 |
const TUint8 KSdioCisTplExtFuncLen1_1 = 0x23; // Length of Tuple for SDIO Ver 1.1
|
|
93 |
|
|
94 |
const TUint8 KSdioExtFuncOffFuncInfo = 0x03;
|
|
95 |
const TUint8 KSdioExtFuncOffRevision = 0x04;
|
|
96 |
const TUint8 KSdioExtFuncOffSerialNo0 = 0x05;
|
|
97 |
const TUint8 KSdioExtFuncOffSerialNo1 = 0x06;
|
|
98 |
const TUint8 KSdioExtFuncOffSerialNo2 = 0x07;
|
|
99 |
const TUint8 KSdioExtFuncOffSerialNo3 = 0x08;
|
|
100 |
const TUint8 KSdioExtFuncOffCSASize0 = 0x09;
|
|
101 |
const TUint8 KSdioExtFuncOffCSASize1 = 0x0a;
|
|
102 |
const TUint8 KSdioExtFuncOffCSASize2 = 0x0b;
|
|
103 |
const TUint8 KSdioExtFuncOffCSASize3 = 0x0c;
|
|
104 |
const TUint8 KSdioExtFuncOffCSAProps = 0x0d;
|
|
105 |
const TUint8 KSdioExtFuncOffMaxBlkSzLo = 0x0e;
|
|
106 |
const TUint8 KSdioExtFuncOffMaxBlkSzHi = 0x0f;
|
|
107 |
const TUint8 KSdioExtFuncOffOCR0 = 0x10;
|
|
108 |
const TUint8 KSdioExtFuncOffOCR1 = 0x11;
|
|
109 |
const TUint8 KSdioExtFuncOffOCR2 = 0x12;
|
|
110 |
const TUint8 KSdioExtFuncOffOCR3 = 0x13;
|
|
111 |
const TUint8 KSdioExtFuncOffMinPwrOp = 0x14;
|
|
112 |
const TUint8 KSdioExtFuncOffAvePwrOp = 0x15;
|
|
113 |
const TUint8 KSdioExtFuncOffMaxPwrOp = 0x16;
|
|
114 |
const TUint8 KSdioExtFuncOffMinPwrStby = 0x17;
|
|
115 |
const TUint8 KSdioExtFuncOffAvePwrStby = 0x18;
|
|
116 |
const TUint8 KSdioExtFuncOffMaxPwrStby = 0x19;
|
|
117 |
const TUint8 KSdioExtFuncOffMinBwLo = 0x1a;
|
|
118 |
const TUint8 KSdioExtFuncOffMinBwHi = 0x1b;
|
|
119 |
const TUint8 KSdioExtFuncOffOptBwLo = 0x1c;
|
|
120 |
const TUint8 KSdioExtFuncOffOptBwHi = 0x1d;
|
|
121 |
const TUint8 KSdioExtFuncOffEnableToLo = 0x1e; // Introduced at SDIO Ver 1.1
|
|
122 |
const TUint8 KSdioExtFuncOffEnableToHi = 0x1f; // Introduced at SDIO Ver 1.1
|
|
123 |
const TUint8 KSdioExtFuncOffAveHiPwrLo = 0x20; // Introduced at SDIO Ver 1.1
|
|
124 |
const TUint8 KSdioExtFuncOffAveHiPwrHi = 0x21; // Introduced at SDIO Ver 1.1
|
|
125 |
const TUint8 KSdioExtFuncOffMaxHiPwrLo = 0x22; // Introduced at SDIO Ver 1.1
|
|
126 |
const TUint8 KSdioExtFuncOffMaxHiPwrHi = 0x23; // Introduced at SDIO Ver 1.1
|
|
127 |
|
|
128 |
//
|
|
129 |
|
|
130 |
const TUint KReportErrors = 0x00002000;
|
|
131 |
const TUint KFindOnly = 0x00004000;
|
|
132 |
|
|
133 |
const TInt KMaxTuplesPerCis = 256;
|
|
134 |
|
|
135 |
///////////////////////
|
|
136 |
|
|
137 |
class TCisReader
|
|
138 |
{
|
|
139 |
public:
|
|
140 |
IMPORT_C TCisReader();
|
|
141 |
IMPORT_C TInt SelectCis(TUint aSocket,TUint aStack,TUint aCard,TUint8 aFunction);
|
|
142 |
IMPORT_C TInt Restart();
|
|
143 |
IMPORT_C TInt FindReadTuple(TUint8 aDesiredTpl,TDes8 &aDes,TUint aFlag=0);
|
|
144 |
IMPORT_C TInt ReadTuple(TDes8 &aDes);
|
|
145 |
IMPORT_C TInt FindReadCommonConfig(TSDIOCardConfig& anInfo);
|
|
146 |
IMPORT_C TInt FindReadFunctionConfig(TSDIOFunctionCaps& aCaps);
|
|
147 |
public:
|
|
148 |
TInt DoSelectCis(TUint8 aCardFunc);
|
|
149 |
void DoRestart();
|
|
150 |
TInt DoFindReadTuple(TUint8 aDesiredTpl,TDes8 &aDes,TUint aFlag);
|
|
151 |
TInt DoReadTuple(TDes8 &aDes);
|
|
152 |
TInt ReadCis(TInt aPos,TDes8 &aDes,TInt aLen);
|
|
153 |
private:
|
|
154 |
static TInt ParseConfigTuple(TDes8 &configTpl,TSDIOCardConfig &anInfo);
|
|
155 |
static TInt ParseExtensionTupleCommon(TDes8 &configTpl,TSDIOCardConfig &anInfo);
|
|
156 |
static TInt ParseExtensionTupleFunction(TDes8 &configTpl,TSDIOFunctionCaps& aCaps);
|
|
157 |
static TInt ParseTupleStandardFunction(TDes8 &configTpl, TSDIOFunctionCaps& aCaps);
|
|
158 |
public:
|
|
159 |
TUint8 iFunc;
|
|
160 |
TUint32 iCisOffset;
|
|
161 |
TBool iRestarted;
|
|
162 |
private:
|
|
163 |
DMMCSocket* iSocketP;
|
|
164 |
DMMCStack* iStackP;
|
|
165 |
TSDIOCard* iCardP;
|
|
166 |
|
|
167 |
private:
|
|
168 |
//
|
|
169 |
// Reserved members to maintain binary compatibility
|
|
170 |
TInt iReserved[2];
|
|
171 |
};
|
|
172 |
|
|
173 |
#endif
|