os/kernelhwsrv/kernel/eka/include/drivers/pccard.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/pccard.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,1104 @@
     1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\include\drivers\pccard.h
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @publishedPartner
    1.24 + @released
    1.25 +*/
    1.26 +
    1.27 +#ifndef __P32PCCD_H__
    1.28 +#define __P32PCCD_H__
    1.29 +#include <drivers/pbus.h>
    1.30 +
    1.31 +const TUint KPccdIntMaskIReq=0x1;
    1.32 +const TUint KPccdIntMaskIndChg=0x2;
    1.33 +const TUint KPccdIntMaskRdyChg=0x4;
    1.34 +
    1.35 +enum TPccdInt
    1.36 +	{
    1.37 +	EPccdIntIReq=0,
    1.38 +	EPccdIntIndChange=1,
    1.39 +	EPccdIntRdyChange=2,
    1.40 +	};
    1.41 +
    1.42 +const TUint KPccdEvFlagIReqLevelMode=0x00000001;
    1.43 +const TUint KPccdEvFlagReserved=0x80000000;
    1.44 +
    1.45 +//
    1.46 +// PC Card maximum system settings
    1.47 +//
    1.48 +const TInt KMaxPccdSockets=KMaxPBusSockets;
    1.49 +const TInt KMaxPccdMediaChanges=2;
    1.50 +const TInt KMaxPccdVccSupplies=2;
    1.51 +const TUint KMaxFuncPerCard=8;
    1.52 +const TUint KDefaultAttribMemSize=0x10000;	  // 64K Bytes (32K CIS)
    1.53 +
    1.54 +const TSocket KInvalidSocket=-1;
    1.55 +const TUint8 KInvalidFuncNum=(KMaxFuncPerCard+1);
    1.56 +//
    1.57 +// PC Card Enumerates
    1.58 +//
    1.59 +enum TPccdFuncType {EGlobalCard,EVendorMultiFuncCard,EMemoryCard,ESerialCard,
    1.60 +					EParallelCard,EFixedDiskCard,EVideoCard,ENetworkCard,EAimsCard,
    1.61 +					EScsiCard,EVendorSpecificCard,EUnknownCard}; // Order important
    1.62 +enum TPccdMemType {EPccdAttribMem,EPccdCommon8Mem,EPccdCommon16Mem,EPccdIo8Mem,EPccdIo16Mem};
    1.63 +enum TPccdCardStatus {ECardNotPresent,ECardNotReady,ECardBad,ECardReady};
    1.64 +enum TPccdAccessSpeed {EAcSpeed50nS,EAcSpeed100nS,EAcSpeed150nS,EAcSpeed200nS,
    1.65 +					   EAcSpeed250nS,EAcSpeed300nS,EAcSpeed450nS,EAcSpeed600nS,
    1.66 +					   EAcSpeed750nS,EAcSpeedExtended,EAcSpeedInValid};
    1.67 +enum TMemDeviceType {EDeviceNull,EDeviceRom,EDeviceOTP,EDeviceEPROM,
    1.68 +					 EDeviceEEPROM,EDeviceFlash,EDeviceSRam,EDeviceDRam,
    1.69 +					 EDeviceFunSpec,EDeviceInvalid}; // Order important
    1.70 +
    1.71 +// Active signals (correspond to Config entry tuple - dont change)
    1.72 +const TUint KSigBvdActive=0x00000010;	
    1.73 +const TUint KSigWpActive=0x00000020;	
    1.74 +const TUint KSigReadyActive=0x00000040;
    1.75 +const TUint KSigWaitRequired=0x00000080;	
    1.76 +const TUint KSigWaitSupported=KSigWaitRequired;	
    1.77 +//
    1.78 +const TUint KPccdVcc_5V0=0x01;
    1.79 +const TUint KPccdVcc_3V3=0x02;
    1.80 +const TUint KPccdVcc_xVx=0x04;
    1.81 +const TUint KPccdVcc_yVy=0x08;
    1.82 +// Interrupt info 
    1.83 +const TUint KPccdIntShare=0x00000080;	
    1.84 +const TUint KPccdIntPulse=0x00000040;	
    1.85 +const TUint KPccdIntLevel=0x00000020;	
    1.86 +
    1.87 +enum TPccdSocketVcc	{EPccdSocket_Invalid=0,EPccdSocket_5V0=KPccdVcc_5V0,EPccdSocket_3V3=KPccdVcc_3V3,
    1.88 +					 EPccdSocket_xVx=KPccdVcc_xVx,EPccdSocket_yVy=KPccdVcc_yVy};
    1.89 +
    1.90 +enum TPccdOpCritical {EPccdOpCritical,EPccdOpNonCritical};
    1.91 +//
    1.92 +// PC Card memory chunk speed/type/signal definitions
    1.93 +//
    1.94 +#define __IS_COMMON_MEM(aMemType) (aMemType==EPccdCommon8Mem||aMemType==EPccdCommon16Mem)
    1.95 +#define __IS_IO_MEM(aMemType) (aMemType==EPccdIo8Mem||aMemType==EPccdIo16Mem)
    1.96 +#define __IS_ATTRIB_MEM(aMemType) (aMemType==EPccdAttribMem)
    1.97 +#define DEF_IO_ACSPEED  EAcSpeed200nS
    1.98 +#define DEF_MEM_ACSPEED EAcSpeed250nS
    1.99 +#define DEF_ATTR_ACSPEED EAcSpeed600nS 
   1.100 +//
   1.101 +// PC Card Vcc definitions
   1.102 +//
   1.103 +const TInt KVcc_Level_5V=5000;
   1.104 +const TInt KVcc_Level_3V3=3300;
   1.105 +const TInt KVcc_Level_xVx=0;
   1.106 +const TInt KVcc_Level_yVy=0;
   1.107 +//
   1.108 +// General tuple parsing definitions
   1.109 +//
   1.110 +const TInt KSmallTplBufSize=16;
   1.111 +const TInt KLargeTplBufSize=257;
   1.112 +const TInt KMaxCfEntriesPerCis=20;
   1.113 +//
   1.114 +// Link Tuple definitions
   1.115 +//
   1.116 +const TUint KPccdLinkA=0x00000001;
   1.117 +const TUint KPccdLinkC=0x00000002;
   1.118 +const TUint KPccdLinkMFC=0x00000004;
   1.119 +const TUint KPccdNoLink=0x00000008;
   1.120 +//
   1.121 +// Tuple codes
   1.122 +//
   1.123 +const TUint8 KCisTplNull=0x00;
   1.124 +const TUint8 KCisTplDevice=0x01;
   1.125 +const TUint8 KCisTplLongLinkMfc=0x06;
   1.126 +const TUint8 KCisTplCheckSum=0x10;
   1.127 +const TUint8 KCisTplLongLinkA=0x11;
   1.128 +const TUint8 KCisTplLongLinkC=0x12;
   1.129 +const TUint8 KCisTplLinkTarget=0x13;
   1.130 +const TUint8 KCisTplNoLink=0x14;
   1.131 +const TUint8 KCisTplVers1=0x15;
   1.132 +const TUint8 KCisTplAltStr=0x16;
   1.133 +const TUint8 KCisTplDeviceA=0x17;
   1.134 +const TUint8 KCisTplJedecC=0x18;
   1.135 +const TUint8 KCisTplJedecA=0x19;
   1.136 +const TUint8 KCisTplConfig=0x1A;
   1.137 +const TUint8 KCisTplCfTableEntry=0x1B;
   1.138 +const TUint8 KCisTplDeviceOC=0x1C;
   1.139 +const TUint8 KCisTplDeviceOA=0x1D;
   1.140 +const TUint8 KCisTplDeviceGeo=0x1E;
   1.141 +const TUint8 KCisTplDeviceGeoA=0x1F;
   1.142 +const TUint8 KCisTplManfId=0x20;
   1.143 +const TUint8 KCisTplFuncId=0x21;
   1.144 +const TUint8 KCisTplFunce=0x22;
   1.145 +const TUint8 KCisTplSwIl=0x23;
   1.146 +const TUint8 KCisTplVers2=0x40;
   1.147 +const TUint8 KCisTplFormat=0x41;
   1.148 +const TUint8 KCisTplGeometry=0x42;
   1.149 +const TUint8 KCisTplByteOrder=0x43;
   1.150 +const TUint8 KCisTplDate=0x44;
   1.151 +const TUint8 KCisTplBattery=0x45;
   1.152 +const TUint8 KCisTplOrg=0x46;
   1.153 +const TUint8 KCisTplLongLinkCB=0x47;
   1.154 +const TUint8 KCisTplVendorSpecific1=0x80;
   1.155 +const TUint8 KCisTplVendorSpecific2=0x81;
   1.156 +const TUint8 KCisTplVendorSpecific3=0x82;
   1.157 +const TUint8 KCisTplEnd=0xFF;
   1.158 +//
   1.159 +const TUint8 KPccdNonSpecificTpl=0xff;
   1.160 +const TUint8 KInvalidConfOpt=0xFF;
   1.161 +const TUint KPccdRestartCis=0x8000;
   1.162 +//
   1.163 +// PC Card Configuration Register definitions
   1.164 +//
   1.165 +const TUint KConfigOptionReg=0;
   1.166 +const TUint KConfigOptionRegM=0x00000001;
   1.167 +const TUint KConfigAndStatusReg=1;
   1.168 +const TUint KConfigAndStatusRegM=0x00000002;
   1.169 +const TUint KPinReplacementReg=2;
   1.170 +const TUint KPinReplacementRegM=0x00000004;
   1.171 +const TUint KSocketAndCopyReg=3;
   1.172 +const TUint KSocketAndCopyRegM=0x00000008;
   1.173 +
   1.174 +const TUint KConfOptConfM=0x0000003F;
   1.175 +const TUint KConfOptLevIReqM=0x00000040;
   1.176 +const TUint KConfOptSResetM=0x00000080;
   1.177 +const TUint KConfStatIntrAckM=0x00000001;
   1.178 +const TUint KConfStatIntrM=0x00000002;
   1.179 +const TUint KConfStatPwrDwnM=0x00000004;
   1.180 +const TUint KConfStatAudioEnableM=0x00000008;
   1.181 +const TUint KConfStatIoIs8M=0x00000020;
   1.182 +const TUint KConfStatSigChgM=0x00000040;
   1.183 +const TUint KConfStatChangedM=0x00000080;
   1.184 +const TUint KPinRepWProtM=0x00000001;
   1.185 +const TUint KPinRepReadyM=0x00000002;
   1.186 +const TUint KPinRepBvdM=0x0000000C;
   1.187 +//
   1.188 +// Pc Card Flag definitions - Mem request/setup and others
   1.189 +//
   1.190 +const TUint KPccdRequestWait=0x00000001;			// Memory request
   1.191 +const TUint KPccdChunkCacheable=0x00000010;			// Memory request
   1.192 +const TUint KPccdChunkShared=0x00000020;			// Memory request
   1.193 +const TUint KPccdChunkPermanent=0x00000040;			// Memory request
   1.194 +const TUint KPccdChunkSystemOwned=0x00000080;		// Memory request
   1.195 +
   1.196 +const TUint KPccdDisableWaitStateCntrl=0x00000100; 	// Memory chunk setup
   1.197 +const TUint KPccdBusWidth32=0x00000200; 			// Memory chunk setup
   1.198 +
   1.199 +const TUint KPccdReturnLinkTpl=0x00001000;			// Cis parsing
   1.200 +const TUint KPccdReportErrors=0x00002000;			// Cis parsing
   1.201 +const TUint KPccdFindOnly=0x00004000;				// Cis parsing
   1.202 +
   1.203 +const TUint KPccdCompatNoVccCheck=0x00000001;	    // Config compatibility checking
   1.204 +const TUint KPccdCompatNoVppCheck=0x00000002;	    // Config compatibility checking
   1.205 +const TUint KPccdCompatNoPwrCheck=0x00000004;	    // Config compatibility checking
   1.206 +
   1.207 +const TUint KPccdConfigRestorable=0x00000001;	    // Configuration request
   1.208 +//
   1.209 +// PC Card tick definitions
   1.210 +//
   1.211 +const TInt KPccdPowerUpReqInterval=20000;	// Units 1uS
   1.212 +const TInt KResetOnDefaultLen=5;			// Units 20ms
   1.213 +const TInt KResetOffDefaultLen=5;			// Units 20ms
   1.214 +const TInt KPwrUpTimeOut=125;				// Units 20mS
   1.215 +const TUint KResetOnMask=0x0000FFFF;
   1.216 +const TUint KResetOffMask=0x7FFF0000;
   1.217 +const TInt KResetOffShift=16;
   1.218 +const TInt KResetProfileDefault=((KResetOffDefaultLen<<KResetOffShift)|KResetOnDefaultLen);
   1.219 +
   1.220 +	/**
   1.221 +	 This class contains  information of Size, base address and memory type information on a particular 
   1.222 +	 memory chunk of a Pc Card. 
   1.223 +	 
   1.224 +	 This class is used as a member of TPcCardRegion or TPcCardConfig, when Pc Card memory needs to be configured.
   1.225 +	 
   1.226 +	 TPccdChnk  can  be used directly in a call to DPcCardController::RequestMemory() to request
   1.227 +	 a chunk of PC Card memory. 
   1.228 +
   1.229 +     @publishedPartner
   1.230 +	 @released
   1.231 +	 */
   1.232 +class TPccdChnk
   1.233 +	{
   1.234 +public:
   1.235 +	/**
   1.236 +	 Initializes the object with memory type to EPccdAttribMem type,BaseAddress and size to 0.
   1.237 +
   1.238 +	 Pc Card contains following memory types : EPccdAttribMem,EPccdCommon8Mem,EPccdCommon16Mem,EPccdIo8Mem,EPccdIo16Mem.
   1.239 +	 
   1.240 +	 Default constructor initializes to EPccAttribMem.
   1.241 +	 */
   1.242 +	IMPORT_C TPccdChnk();
   1.243 +	/**
   1.244 +	 Initializes the object with the specified memory type, base address and size.
   1.245 +	 
   1.246 +	 @param aType		Type of Pc Card memory to be configured.
   1.247 +	 
   1.248 +	 @param aBaseAddr   Base address of the Pc Card to be configured.
   1.249 +     
   1.250 +	 @param aLen        Length of the memory to be configured.
   1.251 +	 
   1.252 +	 @see TPccdMemType
   1.253 +	 */	
   1.254 +	IMPORT_C TPccdChnk(TPccdMemType aType,TUint32 aBaseAddr,TUint32 aLen);
   1.255 +public:
   1.256 +    /**
   1.257 +	 Pc Card memory type (EPccdAttribMem,EPccdCommon8Mem,EPccdCommon16Mem,EPccdIo8Mem,EPccdIo16Mem).
   1.258 +	 @see TPccMemType
   1.259 +     */
   1.260 +	TPccdMemType iMemType;
   1.261 +	/** 
   1.262 +	 Start address of memory region.
   1.263 +	 */
   1.264 +	TUint32 iMemBaseAddr;
   1.265 +	/**
   1.266 + 	 Size of memory region (in bytes).
   1.267 +	 */
   1.268 +	TUint32 iMemLen;
   1.269 +	};
   1.270 +    /** 
   1.271 +	 The maximum number of chunks that can be used per configuration.
   1.272 +	 */
   1.273 +const TInt KMaxChunksPerConfig=2;
   1.274 +	 /**
   1.275 +	 This class provides information on a particular configuration option of a Pc Card.
   1.276 +
   1.277 +     This Card Information Structure (CIS) is used to determine the type of card and 
   1.278 +     what device drivers need to be loaded to support it.
   1.279 +	 
   1.280 +	 This is retrieved after a call of TCisReader::FindReadConfig() and can then be passed in a call of  
   1.281 +     DPcCardController::RequestConfig() to request a configuration.
   1.282 +
   1.283 +     @publishedPartner
   1.284 +	 @released
   1.285 +     */
   1.286 +class TPcCardConfig
   1.287 +	{
   1.288 +public:
   1.289 +    /**
   1.290 +	 Default Constructor
   1.291 +
   1.292 +	 It sets the iConfigOption data member to KInvalidConfOpt.
   1.293 +	 This guarantees that we start with the 1st configuration entry.
   1.294 +	 */
   1.295 +	IMPORT_C TPcCardConfig();
   1.296 + 	/**
   1.297 +	 Determines whether a configuration is compatible with the specification of 
   1.298 +	 the indicated socket 'aSocket' on the machine.
   1.299 +
   1.300 +	 This is called after a call to TCisReader::FindReadRegion().
   1.301 +
   1.302 +	 It checks Vcc level compatibility, WAIT signal compatibility and access speed compatibility. 
   1.303 +	 It also masks out active signals (in iActiveSignals) that are not supported by the machine.
   1.304 + 	 
   1.305 +	 @param aSocket  The socket for which the machine compatibility is to be performed.
   1.306 +
   1.307 +	 @param aFlag    It is possible to disable some aspects of compatibility checking by ORing aFlag with 
   1.308 +					 KPccdCompatNoVccCheck, KPccdCompatNoVppCheck or KPccdCompatNoPwrCheck.
   1.309 +
   1.310 +	 @return True if a configuration is compatible with the specification of the indicated socket 'aSocket' on the machine.
   1.311 +	 */
   1.312 +	IMPORT_C TBool IsMachineCompatible(TSocket aSocket,TInt aFlag=0);
   1.313 +public:								 
   1.314 +	/** 
   1.315 + 	 Access speed of memory involved (EAcSpeed50nS, 100ns, 150ns, 200ns, 250ns, 300ns, 450ns, 600ns,
   1.316 +	 750nS, EAcSpeedExtended, EAcSpeedInValid).
   1.317 + 	 */
   1.318 +	TPccdAccessSpeed iAccessSpeed;
   1.319 +	/** 
   1.320 + 	 Pc Card signals supported - KSigWaitRequired, KSigReadyActive, KSigWpActive, KSigBvdActive.
   1.321 + 	 */
   1.322 +	TUint iActiveSignals;
   1.323 +	/**
   1.324 +	 Maximum Vcc for this configuration.
   1.325 +	 */
   1.326 +	TInt iVccMaxInMilliVolts;			
   1.327 +	/**
   1.328 +	 Minimum Vcc for this configuration.
   1.329 +	 */
   1.330 +	TInt iVccMinInMilliVolts;						
   1.331 +	/**
   1.332 +	 Size, type and base address of Pc Card regions enabled with this configuration.
   1.333 +	 */
   1.334 +	TPccdChnk iChnk[KMaxChunksPerConfig];
   1.335 +	/**
   1.336 +     Number of elements of iChnk which are valid.
   1.337 +	 */
   1.338 +	TInt iValidChunks;
   1.339 +	/**
   1.340 +	 TRUE - i/o and memory, FALSE - memory only.
   1.341 +	 */
   1.342 +	TBool iIsIoAndMem;
   1.343 +	/**
   1.344 +	 True if CIS indicates this is default option.
   1.345 +	 */
   1.346 +	TBool iIsDefault;
   1.347 +	/**
   1.348 +	 True if power down supported.
   1.349 +	 */
   1.350 +	TBool iPwrDown;
   1.351 +	/**
   1.352 +	 Maximum Vpp for this configuration.
   1.353 +	 */
   1.354 +	TInt iVppMaxInMilliVolts;						
   1.355 +	/**
   1.356 +	 Minimum Vpp for this configuration.
   1.357 +	 */
   1.358 +	TInt iVppMinInMilliVolts;						
   1.359 +    /**
   1.360 +	 Operation current drawn when card is in this configuration.
   1.361 +	 */
   1.362 +	TInt iOperCurrentInMicroAmps;				   
   1.363 +    /**
   1.364 +	 Current drawn in this configuration when Pc Card is in  power down mode.
   1.365 +	 */
   1.366 +	TInt iPwrDwnCurrentInMicroAmps;				 
   1.367 +	/**
   1.368 +	 Interrupt features supported. Any of:- KPccdIntShare, KPccdIntPulse,KPccdIntLevel.
   1.369 +	 */
   1.370 +	TUint iInterruptInfo;
   1.371 +	/**
   1.372 +	 Value to be written in to ConfigOptionReg for this configuration.
   1.373 +	 */
   1.374 +	TInt iConfigOption;
   1.375 +	/**
   1.376 +	 Base address of configuration registers (in attribute memory).
   1.377 +	 */
   1.378 +	TUint32 iConfigBaseAddr;
   1.379 +	/**
   1.380 +	 Mask of configuration registers present.
   1.381 +	 */
   1.382 +	TUint32 iRegPresent;	
   1.383 +	};
   1.384 +
   1.385 +	/**
   1.386 +	 Information about a specific memory region of a Pc Card.
   1.387 +
   1.388 +	 This is retrieved by calling TCisReader::FindReadRegion().
   1.389 +
   1.390 +	 An object of this type contains a TPccdChunk object, and can be passed to 
   1.391 +	 DPcCardController::RequestMemory() to request the corresponding memory chunk.
   1.392 +	
   1.393 +	 @publishedPartner
   1.394 +	 @released
   1.395 +	 */
   1.396 +class TPcCardRegion 
   1.397 +	{
   1.398 +public:
   1.399 +	/**
   1.400 +	 Initializes iDeviceType to EDeviceInvalid.
   1.401 +
   1.402 +	 This guarantees that we start with the 1st device information entry.
   1.403 +	 */
   1.404 +	IMPORT_C TPcCardRegion();
   1.405 +	/**	
   1.406 +	 Used after TCisReader::FindReadRegion() to determine if a configuration is compatible with the specification of 
   1.407 +	 the indicated socket 'aSocket' on the machine. Checks Vcc level compatibility,
   1.408 +	 WAIT signal compatibility and access speed compatibility. Also masks out active signals (in iActiveSignals)
   1.409 +	 which aren't supported by the machine.
   1.410 +
   1.411 +	 @param aSocket  Socket for which the machine compatibility to be performed.
   1.412 +     
   1.413 +	 @return True if a configuration is compatible with the specification of the indicated socket 'aSocket' on the machine.
   1.414 +	 */
   1.415 +	IMPORT_C TBool IsMachineCompatible(TSocket aSocket);
   1.416 +public:										
   1.417 +	/** 
   1.418 + 	 Access speed of memory involved (EAcSpeed50nS, 100ns, 150ns, 200ns, 250ns, 300ns, 450ns, 600ns,
   1.419 +	 750nS, EAcSpeedExtended, EAcSpeedInValid).
   1.420 + 	 */
   1.421 +	TPccdAccessSpeed iAccessSpeed;
   1.422 +    /** 
   1.423 + 	 Pc Card signals supported - KSigWaitRequired, KSigReadyActive, KSigWpActive, KSigBvdActive.
   1.424 + 	 */
   1.425 +	TUint iActiveSignals;
   1.426 +	/**
   1.427 +     Info on the memory regions applies when the card is powered at this voltage.
   1.428 +	 */
   1.429 +	TPccdSocketVcc iVcc;
   1.430 +    /**
   1.431 +	 TPccdChnk object holds size, type and base address of Pc Card region.
   1.432 +	 */
   1.433 +	TPccdChnk iChnk;
   1.434 +	/**
   1.435 +	 Memory device type present (e.g. ROM, SRAM, OTP etc.).
   1.436 +	 */
   1.437 +	TMemDeviceType iDeviceType;
   1.438 +	/**
   1.439 +	 When iAccessSpeed, i.e, extended device speed field converted to speed in nS.
   1.440 +	 */
   1.441 +	TInt iExtendedAccSpeedInNanoSecs;
   1.442 +	};
   1.443 +
   1.444 +	/**
   1.445 +	 Contains platform-specific information about the Pc Card.
   1.446 +
   1.447 +	 @publishedPartner
   1.448 +	 @released
   1.449 +	 */
   1.450 +class TPccdType
   1.451 +	{
   1.452 +public:
   1.453 +	/**
   1.454 +	 Default Constructor, initializes maximum functions performed by the Pc Card.
   1.455 +	 */
   1.456 +	IMPORT_C TPccdType();
   1.457 +public:
   1.458 +	/**
   1.459 +	 Gets the function type of the Pc Card. 
   1.460 +	 @see TPccdFuncType
   1.461 +	 */
   1.462 +	TPccdFuncType iFuncType[KMaxFuncPerCard];
   1.463 +	/**
   1.464 +	 Total number of fuctions performed by the Pc Card.
   1.465 +	 */
   1.466 +	TInt iFuncCount;
   1.467 +	};
   1.468 +
   1.469 +enum TPccdBatteryState {EPccBattZero,EPccBattVeryLow,EPccBattLow,EPccBattGood};
   1.470 +class TSocketIndicators
   1.471 +	{
   1.472 +public:
   1.473 +	TBool iCardDetected;
   1.474 +	TInt iVoltSense;
   1.475 +	TBool iWriteProtected;
   1.476 +	TPccdBatteryState iBatState;
   1.477 +	};
   1.478 +
   1.479 +    /**
   1.480 +	 Contains platform-specific information about the PC card Socket.
   1.481 +	
   1.482 +	 @publishedPartner
   1.483 +	 @released
   1.484 +	 */
   1.485 +class TPcCardSocketInfo
   1.486 +	{
   1.487 +public:
   1.488 +	/**
   1.489 +	 Minimum Vpp in Millivolts for the socket of the Pc Card.
   1.490 +	 */
   1.491 +	TInt iNomVppInMilliVolts;
   1.492 +	/**
   1.493 +	 Maximum Vpp in Micro Amps for the socket of the Pc Card.
   1.494 +	 */
   1.495 +	TInt iMaxVppCurrentInMicroAmps;
   1.496 +	/**
   1.497 +	 Supported signals used to check for machine compatability of Pc Card. i.e, KSigWaitRequired, KSigReadyActive, KSigWpActive, KSigBvdActive.
   1.498 +	 */
   1.499 +	TUint iSupportedSignals;
   1.500 +	/**
   1.501 +     Maximum access speed of attribute memory , used to check requested access speed of attribute memory for Machine compatability.
   1.502 +	 */
   1.503 +	TPccdAccessSpeed iMaxAttribAccSpeed;
   1.504 +    /**
   1.505 +	 Maximum access speed of Common Io Memory ,used to check requested access speed of Io memory for Machine compatability.
   1.506 +	 */
   1.507 +	TPccdAccessSpeed iMaxCommonIoAccSpeed;
   1.508 +	};
   1.509 +//
   1.510 +	/**
   1.511 +	 Platform-specific configuration information for the Pc Card stack.
   1.512 +	
   1.513 +	 @publishedPartner
   1.514 +	 @released
   1.515 +	 */
   1.516 +class TPcCardMachineInfo
   1.517 +	{
   1.518 +public:
   1.519 +    /**
   1.520 +	 Total number of sockets for the Pc Card.
   1.521 +	 */
   1.522 +	TInt iTotalSockets;
   1.523 +	/**
   1.524 +	 Total number of times Media changes have occurred.
   1.525 +	 */
   1.526 +	TInt iTotalMediaChanges;
   1.527 +	/**
   1.528 +	 Not currently used.
   1.529 +	
   1.530 +	 Set this value to zero.
   1.531 +	 */
   1.532 +	TInt iTotalPrimarySupplies;
   1.533 +    /**
   1.534 +	 Total number of drives supported for the Pc Card.
   1.535 +	 */
   1.536 +	TInt iTotalSupportedDrives;
   1.537 +    /**
   1.538 +	 The Version number of the Pc Card controller.
   1.539 +	 */
   1.540 +	TInt iControllerHwVersion;
   1.541 +    /**
   1.542 +	 This data member is not used.
   1.543 +	 */	  
   1.544 +	TInt iDisableOnLowBattery;
   1.545 +	};
   1.546 +typedef TPckg<TPcCardMachineInfo> TPcCardMachineInfoPckg;
   1.547 +//
   1.548 +class RPccdWindow;
   1.549 +class DPcCardSocket;
   1.550 +NONSHARABLE_CLASS(DPccdChunkBase) : public DBase
   1.551 +	{
   1.552 +public:
   1.553 +	DPccdChunkBase();
   1.554 +	virtual ~DPccdChunkBase();
   1.555 +	virtual void Close();
   1.556 +	TInt Create(DPcCardSocket* aSocket, TPccdChnk aChunk, TUint aFlag);
   1.557 +public:
   1.558 +	virtual TInt DoCreate(TPccdChnk aChunk, TUint aFlag)=0;
   1.559 +	virtual TInt SetupChunkHw(TPccdAccessSpeed aSpeed, TPccdMemType aMemType, TBool aWaitSig, TUint aFlag)=0;
   1.560 +	virtual TLinAddr LinearAddress()=0;
   1.561 +	virtual TInt Read(TInt aPos, TAny *aPtr, TInt aLength)=0;
   1.562 +	virtual TInt Write(TInt aPos, const TAny *aPtr, TInt aLength)=0;
   1.563 +	virtual TInt ReadByteMultiple(TInt aPos, TAny *aPtr, TInt aCount)=0;
   1.564 +	virtual TInt WriteByteMultiple(TInt aPos, const TAny *aPtr, TInt aCount)=0;
   1.565 +	virtual TInt ReadHWordMultiple(TInt aPos, TAny *aPtr, TInt aCount)=0;
   1.566 +	virtual TInt WriteHWordMultiple(TInt aPos, const TAny *aPtr, TInt aCount)=0;
   1.567 +	virtual TUint Read8(TInt aPos)=0;
   1.568 +	virtual void Write8(TInt aPos, TUint aValue)=0;
   1.569 +	virtual TBool IsTypeCompatible(TPccdMemType aMemType)=0;
   1.570 +public:
   1.571 +	TInt AllocateWinCheck(TPccdChnk aWin, TUint aFlag);
   1.572 +	void AddWindow(RPccdWindow *aWindow);
   1.573 +	void RemoveWindow(RPccdWindow *aWindow);
   1.574 +	TBool IsRemovable();
   1.575 +	TBool IsLocked();
   1.576 +	inline TUint32 BaseAddr();
   1.577 +public:
   1.578 +	SDblQue iWindowQ;
   1.579 +	TInt iWindows;
   1.580 +	TInt iPermanentWindows;
   1.581 +	TInt iShareableWindows;
   1.582 +	TInt iSystemWindows;
   1.583 +	DPcCardSocket* iSocket;
   1.584 +	TPccdChnk iChnk;
   1.585 +	TBool iCacheable;
   1.586 +	};
   1.587 +
   1.588 +class RPccdWindow : public SDblQueLink
   1.589 +	{
   1.590 +public:
   1.591 +	IMPORT_C RPccdWindow();
   1.592 +	IMPORT_C TInt Create(DPcCardSocket* aSocket, TPccdChnk aChnk, TPccdAccessSpeed aSpeed, TUint aFlag);
   1.593 +	IMPORT_C void Close();
   1.594 +	IMPORT_C TInt SetupChunkHw(TUint aFlag=0);
   1.595 +	inline TInt Read(TInt aPos, TAny *aPtr, TInt aLength);
   1.596 +	inline TInt Write(TInt aPos, const TAny *aPtr, TInt aLength);
   1.597 +	inline TInt ReadByteMultiple(TInt aPos, TAny *aPtr, TInt aCount);
   1.598 +	inline TInt WriteByteMultiple(TInt aPos, const TAny *aPtr, TInt aCount);
   1.599 +	inline TInt ReadHWordMultiple(TInt aPos, TAny *aPtr, TInt aCount);
   1.600 +	inline TInt WriteHWordMultiple(TInt aPos, const TAny *aPtr, TInt aCount);
   1.601 +	inline TUint Read8(TInt aPos);
   1.602 +	inline void Write8(TInt aPos, TUint aValue);
   1.603 +	inline void SetAccessSpeed(TPccdAccessSpeed aSpeed);
   1.604 +	IMPORT_C TLinAddr LinearAddress();
   1.605 +public:
   1.606 +	TBool Overlap(TUint32 anOffset, TUint aLen);
   1.607 +	inline TBool IsPermanent();
   1.608 +	inline TBool IsShareable();
   1.609 +	inline TBool IsSystemOwned();
   1.610 +public:
   1.611 +	TPccdAccessSpeed iAccessSpeed;
   1.612 +	TPccdMemType iMemType;			// ???
   1.613 +	TUint32 iOffset;
   1.614 +	TUint32 iLen;
   1.615 +	DPccdChunkBase* iChunk;
   1.616 +	TUint iType;
   1.617 +	TBool iWaitSig;
   1.618 +	};
   1.619 +
   1.620 +	/**
   1.621 +	 @publishedPartner
   1.622 +	 @released
   1.623 +
   1.624 +	 Provides functions for parsing a CIS.
   1.625 +
   1.626 +	 These range from functions for selecting a CIS and reading 'raw' tuples to
   1.627 +	 functions that return card configuration and memory region information
   1.628 +	 in a standard format (and hide the detail of the corresponding tuples).
   1.629 +
   1.630 +	 An object of this type stores the current position of the CIS pointer
   1.631 +	 allowing multiple clients to parse a card CIS simultaneousy. 
   1.632 +
   1.633 +	 Following a CIS chain may require the controller to allocate extra memory (e.g. a CIS with a link to Common memory)
   1.634 +	 so this class should only be used during a Kernel Server call.
   1.635 +	 */
   1.636 +class TCisReader
   1.637 +	{
   1.638 +public:
   1.639 +	/**
   1.640 +     Initialises function number,CisOffset,LinkOffset,LinkFlags,RegionCount and Configcount to 0,
   1.641 +	 memory type to EPccdAttribMem, and restarted flag to flase.
   1.642 +	 
   1.643 +	 Pc Card contains following memory types : EPccdAttribMem,EPccdCommon8Mem,EPccdCommon16Mem,EPccdIo8Mem,EPccdIo16Mem.
   1.644 +	 
   1.645 +	 Default constructor initializes to EPccAttribMem.
   1.646 +	 */ 
   1.647 +   	IMPORT_C TCisReader();
   1.648 +	/**
   1.649 +     Sets the CIS reader to a socket and function and then restarts.
   1.650 +	 
   1.651 +	 @param aSocket  socket to be set to the CIS reader.
   1.652 +
   1.653 +	 @param aCardFunc card function to be assigned to CIS reader.
   1.654 +
   1.655 +	 @return KErrNone if successful, otherwise KErrNotReady,if Card not powered/ready (possible media change),KErrNotFound, if Selected function isn't valid.
   1.656 +	 */
   1.657 +	IMPORT_C TInt SelectCis(TSocket aSocket,TInt aCardFunc);
   1.658 +	/**
   1.659 +	 Sets the CIS reader back to the start of the CIS for this function.
   1.660 +	 @return KErrNone if successful, otherwise KErrGeneral, if a CIS hasn't been selected (i.e. SelectCis() not called).
   1.661 +	 */
   1.662 +	IMPORT_C TInt Restart();
   1.663 +	/**
   1.664 +	 Find the next instance of the specified tuple, 'aDesiredTpl' in the CIS chain
   1.665 +	 and read it into 'aDes'. The search starts from the current position in the CIS (ie CIS pointer),
   1.666 +	 not from the start of the CIS. If  the tuple cannot be found then KErrNotFound is returned. 
   1.667 +	 When changing the desired tuple it is normal to precede this function with Restart() to reset 
   1.668 +	 the current position in the CIS. To find multiple instances of the same tuple in a CIS, 
   1.669 +	 keep calling the function with the same value for 'aDesired' tuple without calling Restart(). 
   1.670 +
   1.671 +	 To use this function to find a tuple without reading it, OR 'aFlag' with KPccdFindOnly.
   1.672 +	 (It is recomended not to read an un-recognisd tuple in case it contains active registers.
   1.673 +	 Therefore this option should generally be used with KPccdNonSpecificTpl when the requirement
   1.674 +	 is to just validate a CIS). To turn on full error reporting (e.g. when validating a CIS),
   1.675 +	 OR 'aFlag' with 'KPccdReportErrors'.
   1.676 +	 
   1.677 +	 @param aDesiredTpl  Tuple to be searched in CIS chain.
   1.678 +	 
   1.679 +	 @param aDes  Tuple searched is read into aDes.
   1.680 +
   1.681 +	 @param aFlag Used to read tuple which are not read by default by ORing aFlag with KPccdReturnLinkTpl.
   1.682 +
   1.683 +	 
   1.684 +	 @return KErrNone if successful,KErrNotFound,if could not find a tuple of the type specified
   1.685 +	 (or possible invalid CIS if 'KPccdReportErrors' isn't set).KErrNotReady,if card not powered/ready(possible media change).
   1.686 +	 KErrCorrupt,if only returned when 'KPccdReportErrors' set.Too many tuples found (>256), too many link tuples, no link target etc.
   1.687 +	 KErrArguement,if Tuple is longer than maximum length of 'aDes'.KErrNoMemory,if problem allocating memory during processing of request (no memory).
   1.688 +	 KerrAccessDenied, if problem allocating memory during processing of request (memory containing CIS already allocated to another client).
   1.689 +	 */
   1.690 +	IMPORT_C TInt FindReadTuple(TUint8 aDesiredTpl,TDes8 &aDes,TUint aFlag=0);
   1.691 +	/**
   1.692 +	 Gets the tuple at the current CIS offset. This is identical to FindReadTuple() except that it always returns 
   1.693 +	 the tuple at the current CIS offset rather than  searching for a tuple of a specified type. 
   1.694 +	 
   1.695 +	 @param aDec8 Tuple is read into aDes8.
   1.696 +
   1.697 +     @return KErrNone if successful, KErrNotFound, if could not find a tuple of the type specified (or possible invalid CIS if 'KPccdReportErrors' isn't set).
   1.698 +	 KErrNotReady,if card not powered/ready (possible media change).KErrCorrupt,if only returned when 'KPccdReportErrors' set. 
   1.699 +	 Too many tuples found (>256), too many link tuples, no link target etc.KErrArguement ,if Tuple is longer than maximum length of 'aDes'.
   1.700 +	 KErrNoMemory if problem allocating memory during processing of request (no memory). KErrAccessDenied, if problem allocating memory during processing of request
   1.701 +	 (memory containing CIS already allocated to another client).
   1.702 +     */
   1.703 +	IMPORT_C TInt ReadTuple(TDes8 &aDes);
   1.704 +	/**
   1.705 +	 Gets information in 'anInfo' from the selected CIS on the card's memory devices. 
   1.706 +	 
   1.707 +	 This information is contained in the CIS in the appropriate Device tuple. 
   1.708 +	 Each time the function is called it returns information on the next device specified 
   1.709 +	 (i.e. next Device Info field). When all regions have been reported, KErrNotFound is returned. 
   1.710 +	 By default, it reports on devices in common memory space. 
   1.711 +	
   1.712 +	 To receive device info when the card is operated at 5V, set 'aSocketVcc' 
   1.713 +	 to EPccdSocket_5V0 (and KCisTplDevice tuples are processed). For characteristics at 3.3V,
   1.714 +	 set 'aSocketVcc' to EPccdSocket_3V3 (and KCisTplDeviceOC tuples are processed). 
   1.715 +	 
   1.716 +	 To receive info on devices in attribute memory space, use 'aDesiredTpl' to override 
   1.717 +	 the type of tuple processed. E.g. to receive device information on attribute memory at 5V, 
   1.718 +	 set 'aDesiredTpl' to KCisTplDeviceA. (This feature also allows FindReadRegion() to be used 
   1.719 +	 to parse vendor specific tuples which conform to device tuple structure).
   1.720 +	 This function searches for the appropriate tuple type starting from the current position 
   1.721 +	 of the CIS pointer so it may be necessary to issue a Restart() before each sequence of Calls of this function. 
   1.722 +
   1.723 +	 The TPcCardRegion object contains a TPccdChnk which can then be used directly in a
   1.724 +	 call to DPcCardController::RequestMemory() to request a chunk of PC Card memory.
   1.725 +	 
   1.726 +	 @param aSocketVcc Used to set the Pc Card Socket voltage.
   1.727 +
   1.728 +     @param anInfo    This has the information returned from the selected CIS on the card's memory devices.
   1.729 +
   1.730 +	 @param aDesiredTpl Desired Tuple used to find, initialized to zero.
   1.731 +
   1.732 +     @return KErrNone if successful.KErrNotFound,if no more configurations present. KErrNotReady if card not powered/ready (possible media change).
   1.733 +	 KErrCorrupt, if invalid configuration/configuration-table-entry tuple detected. KErrNotSupported, if Configuration table entry not supported.
   1.734 +	 KErrNoMemory, if problem allocating memory during processing of request (no memory). KErrAccessDenied if problem allocating memory during 
   1.735 +	 processing of request (memory containing CIS already allocated to another client).
   1.736 +	 */
   1.737 +	IMPORT_C TInt FindReadRegion(TPccdSocketVcc aSocketVcc,TPcCardRegion &anInfo,TUint8 aDesiredTpl=0);
   1.738 +	/**
   1.739 +	 Find the next configuration table entry in the CIS and return the detail of it in 'anInfo'. 
   1.740 +	 When all entries have been found, KErrNotFound is returned. This function allows a client to parse a CIS,
   1.741 +	 reading information on each of the different configuration option present. 
   1.742 +	 It is necessary to issue a Restart() before each sequence of calls of this function. 
   1.743 +       
   1.744 +	 Following a call to this function, the TPcCardConfig object can then be used directly
   1.745 +	 in a call to DPcCardController::RequestConfig() to configure the card. Also the TPcCardConfig object
   1.746 +	 contains a TPccdChnk which can then be used directly in a call to DPcCardController::RequestMemory() 
   1.747 +	 to request the appropriate chunk of PC Card memory.
   1.748 +	 
   1.749 +	 @param anInfo  has the PcCardconfig information read from CIS entry.
   1.750 +	 
   1.751 +	 @return KErrNone if successful. KerrNotFound, if no more regions of the type specified to be found.
   1.752 +	 KErrNotReady,if card not powered/ready (possible media change). KErrCorrupt, if device tuple contained invalid device info. field.
   1.753 +	 KErrNotSupported ,if device tuple contained extended device type. KErrNoMemory,if problem allocating memory during processing
   1.754 +	 of request (no memory). KErrAccessDenied if problem allocating memory during processing of request 
   1.755 +	 (memory containing CIS already allocated to another client).
   1.756 +
   1.757 +	 */
   1.758 +	IMPORT_C TInt FindReadConfig(TPcCardConfig &anInfo);
   1.759 +public:
   1.760 +    /**
   1.761 +	 Sets the CIS reader to socket and function, and checks that the function is valid.
   1.762 +	
   1.763 +	 @param aCardFunc  Card function to be assined to the CIS reader.
   1.764 +	 */
   1.765 +	TInt DoSelectCis(TInt aCardFunc);
   1.766 +	/**
   1.767 +	 Sets the CIS reader back to the start of the CIS.
   1.768 +	 */
   1.769 +	void DoRestart();
   1.770 +	/**
   1.771 +	 Find a specified tuple from the CIS and read it.
   1.772 +
   1.773 +	 @param aDesiredTpl  Tuple to be searched in CIS chain.
   1.774 +	 
   1.775 +	 @param aDec8 Tuple is read into aDes8.
   1.776 +
   1.777 +	 @param aFlag Used to read tuple which are not read by default by ORing aFlag with KPccdReturnLinkTpl.
   1.778 +
   1.779 +	 To use this function to find a tuple without reading it, OR 'aFlag' with KPccdFindOnly.
   1.780 +	 (It is recomended not to read an un-recognisd tuple in case it contains active registers.
   1.781 +	 Therefore this option should generally be used with KPccdNonSpecificTpl when the requirement
   1.782 +	 is to just validate a CIS). To turn on full error reporting (e.g. when validating a CIS),
   1.783 +	 OR 'aFlag' with 'KPccdReportErrors'.
   1.784 +	 @return KErrNone if successful, KErrNotFound,if could not find a tuple of the type specified
   1.785 +	 (or possible invalid CIS if 'KPccdReportErrors' isn't set).KErrNotReady if card not powered/ready (possible media change).
   1.786 +	 KErrCorrupt if only returned when 'KPccdReportErrors' set.Too many tuples found (>256), too many link tuples, no link target etc.
   1.787 +	 KErrArguement,if tuple is longer than maximum length of 'aDes'. KErrNoMemory if problem allocating memory during processing of request (no memory).
   1.788 +	 KErrAccessDenied,if problem allocating memory during processing of request (memory containing CIS already allocated to another client).
   1.789 +	 */
   1.790 +	TInt DoFindReadTuple(TUint8 aDesiredTpl,TDes8 &aDes,TUint aFlag);
   1.791 +	/**
   1.792 +	 Gets the tuple at the current CIS offset. This is identical to FindReadTuple() except that it always returns 
   1.793 +	 the tuple at the current CIS offset rather than  searching for a tuple of a specified type. 
   1.794 +	 
   1.795 +	 @param aDec8 Tuple is read into aDes8.
   1.796 +     
   1.797 +	 @return KErrNone if successful, KErrNotFound,if could not find a tuple of the type specified
   1.798 +	 (or possible invalid CIS if 'KPccdReportErrors' isn't set).KErrNotReady if card not powered/ready (possible media change).
   1.799 +	 KErrCorrupt if only returned when 'KPccdReportErrors' set.Too many tuples found (>256), too many link tuples, no link target etc.
   1.800 +	 KErrArguement,if tuple is longer than maximum length of 'aDes'. KErrNoMemory if problem allocating memory during processing of request (no memory).
   1.801 +	 KErrAccessDenied,if problem allocating memory during processing of request (memory containing  CIS already allocated to another client). 
   1.802 +	 */
   1.803 +	TInt DoReadTuple(TDes8 &aDes);
   1.804 +    /**
   1.805 +	 Gets the error report when their is no more CIS links.
   1.806 +
   1.807 +	 Called at the end of a tuple chain, this moves CIS pointer to the next CIS chain if a long link has been detected.
   1.808 +	 
   1.809 +	 @param aFullErrorReport Error report after when their is no more CIS links.
   1.810 +     */
   1.811 +	TInt FollowLink(TUint aFullErrorReport);
   1.812 +	/**
   1.813 +	 Verify a new tuple chain starts with a valid link target tuple.
   1.814 +	 
   1.815 +	 @return KErrNone if successfull, otherwise KErrCorrupt.
   1.816 +     */
   1.817 +	TInt VerifyLinkTarget();
   1.818 +public:
   1.819 +	/**
   1.820 +     A pointer to Pc Card Socket. 
   1.821 +	 */
   1.822 +	DPcCardSocket *iSocket;
   1.823 +	/**
   1.824 +	 Pc Card function.
   1.825 +	 */
   1.826 +	TInt iFunc;
   1.827 +	/**
   1.828 +	 Offset within the CIS memory.
   1.829 +	 */
   1.830 +	TUint32	iCisOffset;	
   1.831 +	/**
   1.832 +	 Link offset within the CIS memory.
   1.833 +	 */
   1.834 +	TUint32	iLinkOffset;	
   1.835 +	/**
   1.836 +	 Pc Card memory type.
   1.837 +	 @see TPccdMemType
   1.838 +	 */
   1.839 +	TPccdMemType iMemType;
   1.840 +	/**
   1.841 +	 Linkflags used to link the tuple.
   1.842 +	 */ 
   1.843 +	TInt iLinkFlags;
   1.844 +    /** 
   1.845 +	 Used in constructor to mark Pc Card as not restarted.
   1.846 +	 */
   1.847 +	TBool iRestarted; 
   1.848 +	/**
   1.849 +     For FindReadRegion() - Count of regions read so far.
   1.850 +	 */
   1.851 +	TInt iRegionCount; 	
   1.852 +	/**
   1.853 +	 For FindReadConfig() - Configurations read so far.
   1.854 +	 */
   1.855 +	TInt iConfigCount; 
   1.856 +	};
   1.857 +
   1.858 +NONSHARABLE_CLASS(DPcCardVcc) : public DPBusPsuBase
   1.859 +	{
   1.860 +public:
   1.861 +	DPcCardVcc(TInt aPsuNum, TInt aMediaChangeNum);
   1.862 +	virtual TBool IsLocked();
   1.863 +	virtual void ReceiveVoltageCheckResult(TInt anError);
   1.864 +	inline void SetVoltage(TPccdSocketVcc aVoltage);
   1.865 +	inline TPccdSocketVcc VoltageSetting();
   1.866 +	static TInt SocketVccToMilliVolts(TPccdSocketVcc aVcc);
   1.867 +public:
   1.868 +	TPccdSocketVcc iVoltageSetting;
   1.869 +	};
   1.870 +
   1.871 +NONSHARABLE_CLASS(DPcCardMediaChange) : public DMediaChangeBase
   1.872 +	{
   1.873 +public:
   1.874 +	DPcCardMediaChange(TInt aMediaChangeNum);
   1.875 +	virtual TInt Create();
   1.876 +	};
   1.877 +    /**
   1.878 +	 This class contains functions provided by Pc Card.
   1.879 +
   1.880 +	 @publishedPartner
   1.881 +	 @released
   1.882 +	 */
   1.883 +class TPcCardFunction
   1.884 +	{
   1.885 +public:
   1.886 +    /**
   1.887 +     Constructor, intialises iFuncType (EUnknownCard),iInitCisOffset(anOffset),iInitCisMemType(aMemType),
   1.888 +	 iConfigBaseAddr(0),iConfigRegMask(0),iConfigIndex(KInvalidConfOpt),iConfigFlags(0).
   1.889 +     
   1.890 +	 @param anOffset   An offset value to be initialised for Cis.
   1.891 +	 
   1.892 +	 @param aMemType   Cis memory type to be initialised.  
   1.893 +	 
   1.894 +	 @see TPccdMemType
   1.895 +	 */ 
   1.896 +	TPcCardFunction(TUint32 anOffset,TPccdMemType aMemType);
   1.897 +	/**
   1.898 +	 Sets the  configuration option(anIndex), client ID and flags used to configure the Pc Card .
   1.899 +
   1.900 +	 @param anIndex		     Configuration option of the Pc Card.
   1.901 +	 
   1.902 +	 @param aClientId	     A pointer to the LDD making the configuration.
   1.903 +
   1.904 +	 @param aConfigFlags	 Select Pc Card features.
   1.905 +	 */
   1.906 +	void SetConfigOption(TInt anIndex,DBase *aClientID,TUint aConfigFlags);
   1.907 +    /**
   1.908 +	 Sets the configuration base address for Pc Card.
   1.909 +
   1.910 +     @param anAddr	Base address to configure Pc Card.
   1.911 +	 */
   1.912 +	inline void SetConfigBaseAddr(TUint32 anAddr);
   1.913 +	/**
   1.914 +	 Sets the Mask register with aMask value.
   1.915 +
   1.916 +	 @param aMask  The mask value to which the register to be masked.
   1.917 +	 */
   1.918 +	inline void SetConfigRegMask(TInt aMask);	
   1.919 +	/**
   1.920 +     Sets the function type of the Pc Card.
   1.921 +
   1.922 +	 @param aType  Function type of the Pc Card.
   1.923 +
   1.924 +	 @see TPccdFuncType
   1.925 +	 */
   1.926 +	inline void SetFuncType(TPccdFuncType aType);	
   1.927 +	/**
   1.928 +     Sets the register and offset address.
   1.929 +
   1.930 +     @param anRegOffset   Offset within the register address.
   1.931 +
   1.932 +	 @param anAddr		  Register address to configure.
   1.933 +
   1.934 +	 @return KErrNone if successful, otherwise Error if the register isn't present.
   1.935 +	 */ 
   1.936 +	TInt ConfigRegAddress(TInt aRegOffset,TInt &anAddr);
   1.937 +	/**
   1.938 +	 Gets a fuction type the card can provide.
   1.939 +
   1.940 +	 @param anAddr , Address to be configured.
   1.941 +
   1.942 +	 @return iFuncType The type of function the card can provide.
   1.943 +
   1.944 +	 @see TPccdFuncType
   1.945 +	 */
   1.946 +	inline TPccdFuncType FuncType();
   1.947 +    /**
   1.948 +	 Gets configuration index of the Pc Card.
   1.949 +
   1.950 +	 @return iConfigIndex the configuration option of the Pc Card.
   1.951 +     */
   1.952 +	inline TInt ConfigOption();
   1.953 +	/**
   1.954 +	 Checks whether the Pc Card is configured to the given configuration.
   1.955 +
   1.956 +     @return True if the Pc Card is configured for the given configuration.
   1.957 +
   1.958 +	 */
   1.959 +	inline TBool IsConfigured();
   1.960 +	/**
   1.961 +	 Checks whether the Pc Card is configured by the client.
   1.962 +
   1.963 +	 @param aClientId	A pointer to the LDD making the configuration.
   1.964 +
   1.965 +	 @return True if the card is configured for the given clientId.
   1.966 +	 */
   1.967 +	inline TBool IsConfiguredByClient(DBase *aClientID);
   1.968 +	/**
   1.969 +	 Checks whether the configuration is restoreable after it has been powered 
   1.970 +     down due to inactivity (but not media change).
   1.971 +
   1.972 +	 @return True if it can restore
   1.973 +	 */
   1.974 +	inline TBool IsRestorableConfig();
   1.975 +	/** 
   1.976 +	 Gets CIS initialisation  of the Pc Card.
   1.977 +
   1.978 +	 @return iInitCisOffset CIS initialisation of the Pc Card.
   1.979 +	 */
   1.980 +	inline TUint32 InitCisOffset();
   1.981 +	/**
   1.982 +	 Gets the type of CIS memory.
   1.983 +
   1.984 +     @return iInitCisMemType type of Cis Memory type.
   1.985 +	 */
   1.986 +	inline TPccdMemType InitCisMemType();
   1.987 +public:
   1.988 +	/**
   1.989 +	 Type of function the Pc Card can provide.
   1.990 +
   1.991 +	 @see TPccdFuncType.
   1.992 +	 */
   1.993 +	TPccdFuncType iFuncType;
   1.994 +	/**
   1.995 +     To store offset of CIS memory to be initialzed.
   1.996 +	 */
   1.997 +	TUint32 iInitCisOffset;	
   1.998 +	/** 
   1.999 +	 To store the type of memory which needs to be configured.
  1.1000 +
  1.1001 +	 @see TPccdMemType.
  1.1002 +	 */
  1.1003 +	TPccdMemType iInitCisMemType;
  1.1004 +	/**
  1.1005 +	 To hold the base configuration address of the Pc Card.
  1.1006 +	 */
  1.1007 +	TUint32 iConfigBaseAddr;
  1.1008 +	/**
  1.1009 +	 To hold the  configuration register mask  of the Pc Card.
  1.1010 +	 */
  1.1011 +	TInt iConfigRegMask;
  1.1012 +    /**
  1.1013 +     To store the configuration option of the Pc Card.
  1.1014 +     */
  1.1015 +	TInt iConfigIndex;
  1.1016 +	/**
  1.1017 +	 A pointer to the LDD which request Cis configuration.
  1.1018 +	 */
  1.1019 +	DBase *iClientID;
  1.1020 +	/** 
  1.1021 +	 Configuration flags that can be used to configure the Pc Card.
  1.1022 +	 */
  1.1023 +	TUint iConfigFlags;
  1.1024 +	};
  1.1025 +
  1.1026 +NONSHARABLE_CLASS(DPcCardSocket) : public DPBusSocket
  1.1027 +	{
  1.1028 +public:
  1.1029 +	enum TPowerUpState
  1.1030 +		{
  1.1031 +		EIdle=0,
  1.1032 +		EInit=1,
  1.1033 +		EApplyingReset=2,
  1.1034 +		ECheckVcc=3,
  1.1035 +		EWaitForVccReading=4,
  1.1036 +		EWaitForReady=5,
  1.1037 +		EPauseAfterReady=6,
  1.1038 +		};
  1.1039 +public:
  1.1040 +	DPcCardSocket(TSocket aSocketNum);
  1.1041 +	virtual TInt Create(const TDesC* aName);
  1.1042 +	virtual void InitiatePowerUpSequence();
  1.1043 +	void TerminatePowerUpSequence(TInt aResult);
  1.1044 +	void ResetPowerUpState();
  1.1045 +	void CardPowerUpTick();
  1.1046 +	virtual void SocketInfo(TPcCardSocketInfo& anInfo)=0;
  1.1047 +	virtual void Reset1();
  1.1048 +	virtual void Reset2();
  1.1049 +	virtual TInt CardIsReadyAndVerified();
  1.1050 +	virtual TBool CardIsReady();
  1.1051 +	virtual TBool CardIsPowered();
  1.1052 +	IMPORT_C TInt VerifyCard(TPccdType& aType);
  1.1053 +	TInt GetCisFormat();
  1.1054 +	IMPORT_C TInt RequestConfig(TInt aCardFunc,DBase *aClientID,TPcCardConfig &anInfo,TUint aFlag);
  1.1055 +	IMPORT_C void ReleaseConfig(TInt aCardFunc,DBase *aClientID);
  1.1056 +	IMPORT_C TInt ReadConfigReg(TInt aCardFunc,TInt aRegOffset,TUint8 &aVal);
  1.1057 +	IMPORT_C TInt WriteConfigReg(TInt aCardFunc,TInt aRegOffset,const TUint8 aVal);
  1.1058 +	TInt ReadCis(TPccdMemType aMemType,TInt aPos,TDes8 &aDes,TInt aLen);
  1.1059 +	TPcCardFunction *CardFunc(TInt aCardFunc);
  1.1060 +	TInt AddNewFunc(TUint32 anOffset,TPccdMemType aMemType);
  1.1061 +	TInt ValidateCis(TInt aCardFunc);
  1.1062 +	inline TInt CardFuncCount();
  1.1063 +	inline TBool IsValidCardFunc(TInt aCardFunc);
  1.1064 +	inline TBool IsMultiFuncCard();
  1.1065 +	TBool IsConfigLocked();
  1.1066 +	TBool IsMemoryLocked();
  1.1067 +	TBool IsVerified();
  1.1068 +	virtual void HwReset(TBool anAssert)=0;
  1.1069 +	virtual TInt Indicators(TSocketIndicators &anInd)=0;
  1.1070 +	virtual TBool Ready(TInt aCardFunc=KInvalidFuncNum)=0;
  1.1071 +	TPccdSocketVcc VccSetting();
  1.1072 +	void Restore();
  1.1073 +public:
  1.1074 +	virtual DPccdChunkBase *NewPccdChunk(TPccdMemType aType)=0;
  1.1075 +	virtual TInt InterruptEnable(TPccdInt anInt, TUint aFlag)=0;
  1.1076 +	virtual void InterruptDisable(TPccdInt anInt)=0;
  1.1077 +	void RemoveChunk(DPccdChunkBase *aChunk);
  1.1078 +public:
  1.1079 +	RPointerArray<TPcCardFunction> iCardFuncArray;
  1.1080 +	RPointerArray<DPccdChunkBase> iMemChunks;
  1.1081 +	RPccdWindow iAttribWin;
  1.1082 +	TInt iCardPowerUpState;
  1.1083 +	TTickLink iCardPowerUpTimer;
  1.1084 +	TDfc iCardPowerUpDfc;
  1.1085 +	TInt iCardPowerUpTickCount;
  1.1086 +	TInt iCardPowerUpResetLen;
  1.1087 +	TInt iCardPowerUpPauseLen;
  1.1088 +	TInt iClientWindows;
  1.1089 +	TInt iActiveConfigs;
  1.1090 +	};
  1.1091 +
  1.1092 +enum TPcCardPanic
  1.1093 +	{
  1.1094 +	EPcCardBadSocketNumber=0,
  1.1095 +	EPcCardCisReaderUnInit=1,
  1.1096 +	EPcCardBadFunctionNumber=2,
  1.1097 +	EPcCardPowerUpReqFault=3,
  1.1098 +	EPcCardMediaDriverCurrentConsumption=4,
  1.1099 +	EPcCardAddEventError=5
  1.1100 +	};
  1.1101 +
  1.1102 +GLREF_C void PcCardPanic(TPcCardPanic aPanic);
  1.1103 +
  1.1104 +#include <pccard.inl>
  1.1105 +
  1.1106 +
  1.1107 +#endif