kernel/eka/include/drivers/pccard.h
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 1998-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\include\drivers\pccard.h
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedPartner
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef __P32PCCD_H__
       
    25 #define __P32PCCD_H__
       
    26 #include <drivers/pbus.h>
       
    27 
       
    28 const TUint KPccdIntMaskIReq=0x1;
       
    29 const TUint KPccdIntMaskIndChg=0x2;
       
    30 const TUint KPccdIntMaskRdyChg=0x4;
       
    31 
       
    32 enum TPccdInt
       
    33 	{
       
    34 	EPccdIntIReq=0,
       
    35 	EPccdIntIndChange=1,
       
    36 	EPccdIntRdyChange=2,
       
    37 	};
       
    38 
       
    39 const TUint KPccdEvFlagIReqLevelMode=0x00000001;
       
    40 const TUint KPccdEvFlagReserved=0x80000000;
       
    41 
       
    42 //
       
    43 // PC Card maximum system settings
       
    44 //
       
    45 const TInt KMaxPccdSockets=KMaxPBusSockets;
       
    46 const TInt KMaxPccdMediaChanges=2;
       
    47 const TInt KMaxPccdVccSupplies=2;
       
    48 const TUint KMaxFuncPerCard=8;
       
    49 const TUint KDefaultAttribMemSize=0x10000;	  // 64K Bytes (32K CIS)
       
    50 
       
    51 const TSocket KInvalidSocket=-1;
       
    52 const TUint8 KInvalidFuncNum=(KMaxFuncPerCard+1);
       
    53 //
       
    54 // PC Card Enumerates
       
    55 //
       
    56 enum TPccdFuncType {EGlobalCard,EVendorMultiFuncCard,EMemoryCard,ESerialCard,
       
    57 					EParallelCard,EFixedDiskCard,EVideoCard,ENetworkCard,EAimsCard,
       
    58 					EScsiCard,EVendorSpecificCard,EUnknownCard}; // Order important
       
    59 enum TPccdMemType {EPccdAttribMem,EPccdCommon8Mem,EPccdCommon16Mem,EPccdIo8Mem,EPccdIo16Mem};
       
    60 enum TPccdCardStatus {ECardNotPresent,ECardNotReady,ECardBad,ECardReady};
       
    61 enum TPccdAccessSpeed {EAcSpeed50nS,EAcSpeed100nS,EAcSpeed150nS,EAcSpeed200nS,
       
    62 					   EAcSpeed250nS,EAcSpeed300nS,EAcSpeed450nS,EAcSpeed600nS,
       
    63 					   EAcSpeed750nS,EAcSpeedExtended,EAcSpeedInValid};
       
    64 enum TMemDeviceType {EDeviceNull,EDeviceRom,EDeviceOTP,EDeviceEPROM,
       
    65 					 EDeviceEEPROM,EDeviceFlash,EDeviceSRam,EDeviceDRam,
       
    66 					 EDeviceFunSpec,EDeviceInvalid}; // Order important
       
    67 
       
    68 // Active signals (correspond to Config entry tuple - dont change)
       
    69 const TUint KSigBvdActive=0x00000010;	
       
    70 const TUint KSigWpActive=0x00000020;	
       
    71 const TUint KSigReadyActive=0x00000040;
       
    72 const TUint KSigWaitRequired=0x00000080;	
       
    73 const TUint KSigWaitSupported=KSigWaitRequired;	
       
    74 //
       
    75 const TUint KPccdVcc_5V0=0x01;
       
    76 const TUint KPccdVcc_3V3=0x02;
       
    77 const TUint KPccdVcc_xVx=0x04;
       
    78 const TUint KPccdVcc_yVy=0x08;
       
    79 // Interrupt info 
       
    80 const TUint KPccdIntShare=0x00000080;	
       
    81 const TUint KPccdIntPulse=0x00000040;	
       
    82 const TUint KPccdIntLevel=0x00000020;	
       
    83 
       
    84 enum TPccdSocketVcc	{EPccdSocket_Invalid=0,EPccdSocket_5V0=KPccdVcc_5V0,EPccdSocket_3V3=KPccdVcc_3V3,
       
    85 					 EPccdSocket_xVx=KPccdVcc_xVx,EPccdSocket_yVy=KPccdVcc_yVy};
       
    86 
       
    87 enum TPccdOpCritical {EPccdOpCritical,EPccdOpNonCritical};
       
    88 //
       
    89 // PC Card memory chunk speed/type/signal definitions
       
    90 //
       
    91 #define __IS_COMMON_MEM(aMemType) (aMemType==EPccdCommon8Mem||aMemType==EPccdCommon16Mem)
       
    92 #define __IS_IO_MEM(aMemType) (aMemType==EPccdIo8Mem||aMemType==EPccdIo16Mem)
       
    93 #define __IS_ATTRIB_MEM(aMemType) (aMemType==EPccdAttribMem)
       
    94 #define DEF_IO_ACSPEED  EAcSpeed200nS
       
    95 #define DEF_MEM_ACSPEED EAcSpeed250nS
       
    96 #define DEF_ATTR_ACSPEED EAcSpeed600nS 
       
    97 //
       
    98 // PC Card Vcc definitions
       
    99 //
       
   100 const TInt KVcc_Level_5V=5000;
       
   101 const TInt KVcc_Level_3V3=3300;
       
   102 const TInt KVcc_Level_xVx=0;
       
   103 const TInt KVcc_Level_yVy=0;
       
   104 //
       
   105 // General tuple parsing definitions
       
   106 //
       
   107 const TInt KSmallTplBufSize=16;
       
   108 const TInt KLargeTplBufSize=257;
       
   109 const TInt KMaxCfEntriesPerCis=20;
       
   110 //
       
   111 // Link Tuple definitions
       
   112 //
       
   113 const TUint KPccdLinkA=0x00000001;
       
   114 const TUint KPccdLinkC=0x00000002;
       
   115 const TUint KPccdLinkMFC=0x00000004;
       
   116 const TUint KPccdNoLink=0x00000008;
       
   117 //
       
   118 // Tuple codes
       
   119 //
       
   120 const TUint8 KCisTplNull=0x00;
       
   121 const TUint8 KCisTplDevice=0x01;
       
   122 const TUint8 KCisTplLongLinkMfc=0x06;
       
   123 const TUint8 KCisTplCheckSum=0x10;
       
   124 const TUint8 KCisTplLongLinkA=0x11;
       
   125 const TUint8 KCisTplLongLinkC=0x12;
       
   126 const TUint8 KCisTplLinkTarget=0x13;
       
   127 const TUint8 KCisTplNoLink=0x14;
       
   128 const TUint8 KCisTplVers1=0x15;
       
   129 const TUint8 KCisTplAltStr=0x16;
       
   130 const TUint8 KCisTplDeviceA=0x17;
       
   131 const TUint8 KCisTplJedecC=0x18;
       
   132 const TUint8 KCisTplJedecA=0x19;
       
   133 const TUint8 KCisTplConfig=0x1A;
       
   134 const TUint8 KCisTplCfTableEntry=0x1B;
       
   135 const TUint8 KCisTplDeviceOC=0x1C;
       
   136 const TUint8 KCisTplDeviceOA=0x1D;
       
   137 const TUint8 KCisTplDeviceGeo=0x1E;
       
   138 const TUint8 KCisTplDeviceGeoA=0x1F;
       
   139 const TUint8 KCisTplManfId=0x20;
       
   140 const TUint8 KCisTplFuncId=0x21;
       
   141 const TUint8 KCisTplFunce=0x22;
       
   142 const TUint8 KCisTplSwIl=0x23;
       
   143 const TUint8 KCisTplVers2=0x40;
       
   144 const TUint8 KCisTplFormat=0x41;
       
   145 const TUint8 KCisTplGeometry=0x42;
       
   146 const TUint8 KCisTplByteOrder=0x43;
       
   147 const TUint8 KCisTplDate=0x44;
       
   148 const TUint8 KCisTplBattery=0x45;
       
   149 const TUint8 KCisTplOrg=0x46;
       
   150 const TUint8 KCisTplLongLinkCB=0x47;
       
   151 const TUint8 KCisTplVendorSpecific1=0x80;
       
   152 const TUint8 KCisTplVendorSpecific2=0x81;
       
   153 const TUint8 KCisTplVendorSpecific3=0x82;
       
   154 const TUint8 KCisTplEnd=0xFF;
       
   155 //
       
   156 const TUint8 KPccdNonSpecificTpl=0xff;
       
   157 const TUint8 KInvalidConfOpt=0xFF;
       
   158 const TUint KPccdRestartCis=0x8000;
       
   159 //
       
   160 // PC Card Configuration Register definitions
       
   161 //
       
   162 const TUint KConfigOptionReg=0;
       
   163 const TUint KConfigOptionRegM=0x00000001;
       
   164 const TUint KConfigAndStatusReg=1;
       
   165 const TUint KConfigAndStatusRegM=0x00000002;
       
   166 const TUint KPinReplacementReg=2;
       
   167 const TUint KPinReplacementRegM=0x00000004;
       
   168 const TUint KSocketAndCopyReg=3;
       
   169 const TUint KSocketAndCopyRegM=0x00000008;
       
   170 
       
   171 const TUint KConfOptConfM=0x0000003F;
       
   172 const TUint KConfOptLevIReqM=0x00000040;
       
   173 const TUint KConfOptSResetM=0x00000080;
       
   174 const TUint KConfStatIntrAckM=0x00000001;
       
   175 const TUint KConfStatIntrM=0x00000002;
       
   176 const TUint KConfStatPwrDwnM=0x00000004;
       
   177 const TUint KConfStatAudioEnableM=0x00000008;
       
   178 const TUint KConfStatIoIs8M=0x00000020;
       
   179 const TUint KConfStatSigChgM=0x00000040;
       
   180 const TUint KConfStatChangedM=0x00000080;
       
   181 const TUint KPinRepWProtM=0x00000001;
       
   182 const TUint KPinRepReadyM=0x00000002;
       
   183 const TUint KPinRepBvdM=0x0000000C;
       
   184 //
       
   185 // Pc Card Flag definitions - Mem request/setup and others
       
   186 //
       
   187 const TUint KPccdRequestWait=0x00000001;			// Memory request
       
   188 const TUint KPccdChunkCacheable=0x00000010;			// Memory request
       
   189 const TUint KPccdChunkShared=0x00000020;			// Memory request
       
   190 const TUint KPccdChunkPermanent=0x00000040;			// Memory request
       
   191 const TUint KPccdChunkSystemOwned=0x00000080;		// Memory request
       
   192 
       
   193 const TUint KPccdDisableWaitStateCntrl=0x00000100; 	// Memory chunk setup
       
   194 const TUint KPccdBusWidth32=0x00000200; 			// Memory chunk setup
       
   195 
       
   196 const TUint KPccdReturnLinkTpl=0x00001000;			// Cis parsing
       
   197 const TUint KPccdReportErrors=0x00002000;			// Cis parsing
       
   198 const TUint KPccdFindOnly=0x00004000;				// Cis parsing
       
   199 
       
   200 const TUint KPccdCompatNoVccCheck=0x00000001;	    // Config compatibility checking
       
   201 const TUint KPccdCompatNoVppCheck=0x00000002;	    // Config compatibility checking
       
   202 const TUint KPccdCompatNoPwrCheck=0x00000004;	    // Config compatibility checking
       
   203 
       
   204 const TUint KPccdConfigRestorable=0x00000001;	    // Configuration request
       
   205 //
       
   206 // PC Card tick definitions
       
   207 //
       
   208 const TInt KPccdPowerUpReqInterval=20000;	// Units 1uS
       
   209 const TInt KResetOnDefaultLen=5;			// Units 20ms
       
   210 const TInt KResetOffDefaultLen=5;			// Units 20ms
       
   211 const TInt KPwrUpTimeOut=125;				// Units 20mS
       
   212 const TUint KResetOnMask=0x0000FFFF;
       
   213 const TUint KResetOffMask=0x7FFF0000;
       
   214 const TInt KResetOffShift=16;
       
   215 const TInt KResetProfileDefault=((KResetOffDefaultLen<<KResetOffShift)|KResetOnDefaultLen);
       
   216 
       
   217 	/**
       
   218 	 This class contains  information of Size, base address and memory type information on a particular 
       
   219 	 memory chunk of a Pc Card. 
       
   220 	 
       
   221 	 This class is used as a member of TPcCardRegion or TPcCardConfig, when Pc Card memory needs to be configured.
       
   222 	 
       
   223 	 TPccdChnk  can  be used directly in a call to DPcCardController::RequestMemory() to request
       
   224 	 a chunk of PC Card memory. 
       
   225 
       
   226      @publishedPartner
       
   227 	 @released
       
   228 	 */
       
   229 class TPccdChnk
       
   230 	{
       
   231 public:
       
   232 	/**
       
   233 	 Initializes the object with memory type to EPccdAttribMem type,BaseAddress and size to 0.
       
   234 
       
   235 	 Pc Card contains following memory types : EPccdAttribMem,EPccdCommon8Mem,EPccdCommon16Mem,EPccdIo8Mem,EPccdIo16Mem.
       
   236 	 
       
   237 	 Default constructor initializes to EPccAttribMem.
       
   238 	 */
       
   239 	IMPORT_C TPccdChnk();
       
   240 	/**
       
   241 	 Initializes the object with the specified memory type, base address and size.
       
   242 	 
       
   243 	 @param aType		Type of Pc Card memory to be configured.
       
   244 	 
       
   245 	 @param aBaseAddr   Base address of the Pc Card to be configured.
       
   246      
       
   247 	 @param aLen        Length of the memory to be configured.
       
   248 	 
       
   249 	 @see TPccdMemType
       
   250 	 */	
       
   251 	IMPORT_C TPccdChnk(TPccdMemType aType,TUint32 aBaseAddr,TUint32 aLen);
       
   252 public:
       
   253     /**
       
   254 	 Pc Card memory type (EPccdAttribMem,EPccdCommon8Mem,EPccdCommon16Mem,EPccdIo8Mem,EPccdIo16Mem).
       
   255 	 @see TPccMemType
       
   256      */
       
   257 	TPccdMemType iMemType;
       
   258 	/** 
       
   259 	 Start address of memory region.
       
   260 	 */
       
   261 	TUint32 iMemBaseAddr;
       
   262 	/**
       
   263  	 Size of memory region (in bytes).
       
   264 	 */
       
   265 	TUint32 iMemLen;
       
   266 	};
       
   267     /** 
       
   268 	 The maximum number of chunks that can be used per configuration.
       
   269 	 */
       
   270 const TInt KMaxChunksPerConfig=2;
       
   271 	 /**
       
   272 	 This class provides information on a particular configuration option of a Pc Card.
       
   273 
       
   274      This Card Information Structure (CIS) is used to determine the type of card and 
       
   275      what device drivers need to be loaded to support it.
       
   276 	 
       
   277 	 This is retrieved after a call of TCisReader::FindReadConfig() and can then be passed in a call of  
       
   278      DPcCardController::RequestConfig() to request a configuration.
       
   279 
       
   280      @publishedPartner
       
   281 	 @released
       
   282      */
       
   283 class TPcCardConfig
       
   284 	{
       
   285 public:
       
   286     /**
       
   287 	 Default Constructor
       
   288 
       
   289 	 It sets the iConfigOption data member to KInvalidConfOpt.
       
   290 	 This guarantees that we start with the 1st configuration entry.
       
   291 	 */
       
   292 	IMPORT_C TPcCardConfig();
       
   293  	/**
       
   294 	 Determines whether a configuration is compatible with the specification of 
       
   295 	 the indicated socket 'aSocket' on the machine.
       
   296 
       
   297 	 This is called after a call to TCisReader::FindReadRegion().
       
   298 
       
   299 	 It checks Vcc level compatibility, WAIT signal compatibility and access speed compatibility. 
       
   300 	 It also masks out active signals (in iActiveSignals) that are not supported by the machine.
       
   301  	 
       
   302 	 @param aSocket  The socket for which the machine compatibility is to be performed.
       
   303 
       
   304 	 @param aFlag    It is possible to disable some aspects of compatibility checking by ORing aFlag with 
       
   305 					 KPccdCompatNoVccCheck, KPccdCompatNoVppCheck or KPccdCompatNoPwrCheck.
       
   306 
       
   307 	 @return True if a configuration is compatible with the specification of the indicated socket 'aSocket' on the machine.
       
   308 	 */
       
   309 	IMPORT_C TBool IsMachineCompatible(TSocket aSocket,TInt aFlag=0);
       
   310 public:								 
       
   311 	/** 
       
   312  	 Access speed of memory involved (EAcSpeed50nS, 100ns, 150ns, 200ns, 250ns, 300ns, 450ns, 600ns,
       
   313 	 750nS, EAcSpeedExtended, EAcSpeedInValid).
       
   314  	 */
       
   315 	TPccdAccessSpeed iAccessSpeed;
       
   316 	/** 
       
   317  	 Pc Card signals supported - KSigWaitRequired, KSigReadyActive, KSigWpActive, KSigBvdActive.
       
   318  	 */
       
   319 	TUint iActiveSignals;
       
   320 	/**
       
   321 	 Maximum Vcc for this configuration.
       
   322 	 */
       
   323 	TInt iVccMaxInMilliVolts;			
       
   324 	/**
       
   325 	 Minimum Vcc for this configuration.
       
   326 	 */
       
   327 	TInt iVccMinInMilliVolts;						
       
   328 	/**
       
   329 	 Size, type and base address of Pc Card regions enabled with this configuration.
       
   330 	 */
       
   331 	TPccdChnk iChnk[KMaxChunksPerConfig];
       
   332 	/**
       
   333      Number of elements of iChnk which are valid.
       
   334 	 */
       
   335 	TInt iValidChunks;
       
   336 	/**
       
   337 	 TRUE - i/o and memory, FALSE - memory only.
       
   338 	 */
       
   339 	TBool iIsIoAndMem;
       
   340 	/**
       
   341 	 True if CIS indicates this is default option.
       
   342 	 */
       
   343 	TBool iIsDefault;
       
   344 	/**
       
   345 	 True if power down supported.
       
   346 	 */
       
   347 	TBool iPwrDown;
       
   348 	/**
       
   349 	 Maximum Vpp for this configuration.
       
   350 	 */
       
   351 	TInt iVppMaxInMilliVolts;						
       
   352 	/**
       
   353 	 Minimum Vpp for this configuration.
       
   354 	 */
       
   355 	TInt iVppMinInMilliVolts;						
       
   356     /**
       
   357 	 Operation current drawn when card is in this configuration.
       
   358 	 */
       
   359 	TInt iOperCurrentInMicroAmps;				   
       
   360     /**
       
   361 	 Current drawn in this configuration when Pc Card is in  power down mode.
       
   362 	 */
       
   363 	TInt iPwrDwnCurrentInMicroAmps;				 
       
   364 	/**
       
   365 	 Interrupt features supported. Any of:- KPccdIntShare, KPccdIntPulse,KPccdIntLevel.
       
   366 	 */
       
   367 	TUint iInterruptInfo;
       
   368 	/**
       
   369 	 Value to be written in to ConfigOptionReg for this configuration.
       
   370 	 */
       
   371 	TInt iConfigOption;
       
   372 	/**
       
   373 	 Base address of configuration registers (in attribute memory).
       
   374 	 */
       
   375 	TUint32 iConfigBaseAddr;
       
   376 	/**
       
   377 	 Mask of configuration registers present.
       
   378 	 */
       
   379 	TUint32 iRegPresent;	
       
   380 	};
       
   381 
       
   382 	/**
       
   383 	 Information about a specific memory region of a Pc Card.
       
   384 
       
   385 	 This is retrieved by calling TCisReader::FindReadRegion().
       
   386 
       
   387 	 An object of this type contains a TPccdChunk object, and can be passed to 
       
   388 	 DPcCardController::RequestMemory() to request the corresponding memory chunk.
       
   389 	
       
   390 	 @publishedPartner
       
   391 	 @released
       
   392 	 */
       
   393 class TPcCardRegion 
       
   394 	{
       
   395 public:
       
   396 	/**
       
   397 	 Initializes iDeviceType to EDeviceInvalid.
       
   398 
       
   399 	 This guarantees that we start with the 1st device information entry.
       
   400 	 */
       
   401 	IMPORT_C TPcCardRegion();
       
   402 	/**	
       
   403 	 Used after TCisReader::FindReadRegion() to determine if a configuration is compatible with the specification of 
       
   404 	 the indicated socket 'aSocket' on the machine. Checks Vcc level compatibility,
       
   405 	 WAIT signal compatibility and access speed compatibility. Also masks out active signals (in iActiveSignals)
       
   406 	 which aren't supported by the machine.
       
   407 
       
   408 	 @param aSocket  Socket for which the machine compatibility to be performed.
       
   409      
       
   410 	 @return True if a configuration is compatible with the specification of the indicated socket 'aSocket' on the machine.
       
   411 	 */
       
   412 	IMPORT_C TBool IsMachineCompatible(TSocket aSocket);
       
   413 public:										
       
   414 	/** 
       
   415  	 Access speed of memory involved (EAcSpeed50nS, 100ns, 150ns, 200ns, 250ns, 300ns, 450ns, 600ns,
       
   416 	 750nS, EAcSpeedExtended, EAcSpeedInValid).
       
   417  	 */
       
   418 	TPccdAccessSpeed iAccessSpeed;
       
   419     /** 
       
   420  	 Pc Card signals supported - KSigWaitRequired, KSigReadyActive, KSigWpActive, KSigBvdActive.
       
   421  	 */
       
   422 	TUint iActiveSignals;
       
   423 	/**
       
   424      Info on the memory regions applies when the card is powered at this voltage.
       
   425 	 */
       
   426 	TPccdSocketVcc iVcc;
       
   427     /**
       
   428 	 TPccdChnk object holds size, type and base address of Pc Card region.
       
   429 	 */
       
   430 	TPccdChnk iChnk;
       
   431 	/**
       
   432 	 Memory device type present (e.g. ROM, SRAM, OTP etc.).
       
   433 	 */
       
   434 	TMemDeviceType iDeviceType;
       
   435 	/**
       
   436 	 When iAccessSpeed, i.e, extended device speed field converted to speed in nS.
       
   437 	 */
       
   438 	TInt iExtendedAccSpeedInNanoSecs;
       
   439 	};
       
   440 
       
   441 	/**
       
   442 	 Contains platform-specific information about the Pc Card.
       
   443 
       
   444 	 @publishedPartner
       
   445 	 @released
       
   446 	 */
       
   447 class TPccdType
       
   448 	{
       
   449 public:
       
   450 	/**
       
   451 	 Default Constructor, initializes maximum functions performed by the Pc Card.
       
   452 	 */
       
   453 	IMPORT_C TPccdType();
       
   454 public:
       
   455 	/**
       
   456 	 Gets the function type of the Pc Card. 
       
   457 	 @see TPccdFuncType
       
   458 	 */
       
   459 	TPccdFuncType iFuncType[KMaxFuncPerCard];
       
   460 	/**
       
   461 	 Total number of fuctions performed by the Pc Card.
       
   462 	 */
       
   463 	TInt iFuncCount;
       
   464 	};
       
   465 
       
   466 enum TPccdBatteryState {EPccBattZero,EPccBattVeryLow,EPccBattLow,EPccBattGood};
       
   467 class TSocketIndicators
       
   468 	{
       
   469 public:
       
   470 	TBool iCardDetected;
       
   471 	TInt iVoltSense;
       
   472 	TBool iWriteProtected;
       
   473 	TPccdBatteryState iBatState;
       
   474 	};
       
   475 
       
   476     /**
       
   477 	 Contains platform-specific information about the PC card Socket.
       
   478 	
       
   479 	 @publishedPartner
       
   480 	 @released
       
   481 	 */
       
   482 class TPcCardSocketInfo
       
   483 	{
       
   484 public:
       
   485 	/**
       
   486 	 Minimum Vpp in Millivolts for the socket of the Pc Card.
       
   487 	 */
       
   488 	TInt iNomVppInMilliVolts;
       
   489 	/**
       
   490 	 Maximum Vpp in Micro Amps for the socket of the Pc Card.
       
   491 	 */
       
   492 	TInt iMaxVppCurrentInMicroAmps;
       
   493 	/**
       
   494 	 Supported signals used to check for machine compatability of Pc Card. i.e, KSigWaitRequired, KSigReadyActive, KSigWpActive, KSigBvdActive.
       
   495 	 */
       
   496 	TUint iSupportedSignals;
       
   497 	/**
       
   498      Maximum access speed of attribute memory , used to check requested access speed of attribute memory for Machine compatability.
       
   499 	 */
       
   500 	TPccdAccessSpeed iMaxAttribAccSpeed;
       
   501     /**
       
   502 	 Maximum access speed of Common Io Memory ,used to check requested access speed of Io memory for Machine compatability.
       
   503 	 */
       
   504 	TPccdAccessSpeed iMaxCommonIoAccSpeed;
       
   505 	};
       
   506 //
       
   507 	/**
       
   508 	 Platform-specific configuration information for the Pc Card stack.
       
   509 	
       
   510 	 @publishedPartner
       
   511 	 @released
       
   512 	 */
       
   513 class TPcCardMachineInfo
       
   514 	{
       
   515 public:
       
   516     /**
       
   517 	 Total number of sockets for the Pc Card.
       
   518 	 */
       
   519 	TInt iTotalSockets;
       
   520 	/**
       
   521 	 Total number of times Media changes have occurred.
       
   522 	 */
       
   523 	TInt iTotalMediaChanges;
       
   524 	/**
       
   525 	 Not currently used.
       
   526 	
       
   527 	 Set this value to zero.
       
   528 	 */
       
   529 	TInt iTotalPrimarySupplies;
       
   530     /**
       
   531 	 Total number of drives supported for the Pc Card.
       
   532 	 */
       
   533 	TInt iTotalSupportedDrives;
       
   534     /**
       
   535 	 The Version number of the Pc Card controller.
       
   536 	 */
       
   537 	TInt iControllerHwVersion;
       
   538     /**
       
   539 	 This data member is not used.
       
   540 	 */	  
       
   541 	TInt iDisableOnLowBattery;
       
   542 	};
       
   543 typedef TPckg<TPcCardMachineInfo> TPcCardMachineInfoPckg;
       
   544 //
       
   545 class RPccdWindow;
       
   546 class DPcCardSocket;
       
   547 NONSHARABLE_CLASS(DPccdChunkBase) : public DBase
       
   548 	{
       
   549 public:
       
   550 	DPccdChunkBase();
       
   551 	virtual ~DPccdChunkBase();
       
   552 	virtual void Close();
       
   553 	TInt Create(DPcCardSocket* aSocket, TPccdChnk aChunk, TUint aFlag);
       
   554 public:
       
   555 	virtual TInt DoCreate(TPccdChnk aChunk, TUint aFlag)=0;
       
   556 	virtual TInt SetupChunkHw(TPccdAccessSpeed aSpeed, TPccdMemType aMemType, TBool aWaitSig, TUint aFlag)=0;
       
   557 	virtual TLinAddr LinearAddress()=0;
       
   558 	virtual TInt Read(TInt aPos, TAny *aPtr, TInt aLength)=0;
       
   559 	virtual TInt Write(TInt aPos, const TAny *aPtr, TInt aLength)=0;
       
   560 	virtual TInt ReadByteMultiple(TInt aPos, TAny *aPtr, TInt aCount)=0;
       
   561 	virtual TInt WriteByteMultiple(TInt aPos, const TAny *aPtr, TInt aCount)=0;
       
   562 	virtual TInt ReadHWordMultiple(TInt aPos, TAny *aPtr, TInt aCount)=0;
       
   563 	virtual TInt WriteHWordMultiple(TInt aPos, const TAny *aPtr, TInt aCount)=0;
       
   564 	virtual TUint Read8(TInt aPos)=0;
       
   565 	virtual void Write8(TInt aPos, TUint aValue)=0;
       
   566 	virtual TBool IsTypeCompatible(TPccdMemType aMemType)=0;
       
   567 public:
       
   568 	TInt AllocateWinCheck(TPccdChnk aWin, TUint aFlag);
       
   569 	void AddWindow(RPccdWindow *aWindow);
       
   570 	void RemoveWindow(RPccdWindow *aWindow);
       
   571 	TBool IsRemovable();
       
   572 	TBool IsLocked();
       
   573 	inline TUint32 BaseAddr();
       
   574 public:
       
   575 	SDblQue iWindowQ;
       
   576 	TInt iWindows;
       
   577 	TInt iPermanentWindows;
       
   578 	TInt iShareableWindows;
       
   579 	TInt iSystemWindows;
       
   580 	DPcCardSocket* iSocket;
       
   581 	TPccdChnk iChnk;
       
   582 	TBool iCacheable;
       
   583 	};
       
   584 
       
   585 class RPccdWindow : public SDblQueLink
       
   586 	{
       
   587 public:
       
   588 	IMPORT_C RPccdWindow();
       
   589 	IMPORT_C TInt Create(DPcCardSocket* aSocket, TPccdChnk aChnk, TPccdAccessSpeed aSpeed, TUint aFlag);
       
   590 	IMPORT_C void Close();
       
   591 	IMPORT_C TInt SetupChunkHw(TUint aFlag=0);
       
   592 	inline TInt Read(TInt aPos, TAny *aPtr, TInt aLength);
       
   593 	inline TInt Write(TInt aPos, const TAny *aPtr, TInt aLength);
       
   594 	inline TInt ReadByteMultiple(TInt aPos, TAny *aPtr, TInt aCount);
       
   595 	inline TInt WriteByteMultiple(TInt aPos, const TAny *aPtr, TInt aCount);
       
   596 	inline TInt ReadHWordMultiple(TInt aPos, TAny *aPtr, TInt aCount);
       
   597 	inline TInt WriteHWordMultiple(TInt aPos, const TAny *aPtr, TInt aCount);
       
   598 	inline TUint Read8(TInt aPos);
       
   599 	inline void Write8(TInt aPos, TUint aValue);
       
   600 	inline void SetAccessSpeed(TPccdAccessSpeed aSpeed);
       
   601 	IMPORT_C TLinAddr LinearAddress();
       
   602 public:
       
   603 	TBool Overlap(TUint32 anOffset, TUint aLen);
       
   604 	inline TBool IsPermanent();
       
   605 	inline TBool IsShareable();
       
   606 	inline TBool IsSystemOwned();
       
   607 public:
       
   608 	TPccdAccessSpeed iAccessSpeed;
       
   609 	TPccdMemType iMemType;			// ???
       
   610 	TUint32 iOffset;
       
   611 	TUint32 iLen;
       
   612 	DPccdChunkBase* iChunk;
       
   613 	TUint iType;
       
   614 	TBool iWaitSig;
       
   615 	};
       
   616 
       
   617 	/**
       
   618 	 @publishedPartner
       
   619 	 @released
       
   620 
       
   621 	 Provides functions for parsing a CIS.
       
   622 
       
   623 	 These range from functions for selecting a CIS and reading 'raw' tuples to
       
   624 	 functions that return card configuration and memory region information
       
   625 	 in a standard format (and hide the detail of the corresponding tuples).
       
   626 
       
   627 	 An object of this type stores the current position of the CIS pointer
       
   628 	 allowing multiple clients to parse a card CIS simultaneousy. 
       
   629 
       
   630 	 Following a CIS chain may require the controller to allocate extra memory (e.g. a CIS with a link to Common memory)
       
   631 	 so this class should only be used during a Kernel Server call.
       
   632 	 */
       
   633 class TCisReader
       
   634 	{
       
   635 public:
       
   636 	/**
       
   637      Initialises function number,CisOffset,LinkOffset,LinkFlags,RegionCount and Configcount to 0,
       
   638 	 memory type to EPccdAttribMem, and restarted flag to flase.
       
   639 	 
       
   640 	 Pc Card contains following memory types : EPccdAttribMem,EPccdCommon8Mem,EPccdCommon16Mem,EPccdIo8Mem,EPccdIo16Mem.
       
   641 	 
       
   642 	 Default constructor initializes to EPccAttribMem.
       
   643 	 */ 
       
   644    	IMPORT_C TCisReader();
       
   645 	/**
       
   646      Sets the CIS reader to a socket and function and then restarts.
       
   647 	 
       
   648 	 @param aSocket  socket to be set to the CIS reader.
       
   649 
       
   650 	 @param aCardFunc card function to be assigned to CIS reader.
       
   651 
       
   652 	 @return KErrNone if successful, otherwise KErrNotReady,if Card not powered/ready (possible media change),KErrNotFound, if Selected function isn't valid.
       
   653 	 */
       
   654 	IMPORT_C TInt SelectCis(TSocket aSocket,TInt aCardFunc);
       
   655 	/**
       
   656 	 Sets the CIS reader back to the start of the CIS for this function.
       
   657 	 @return KErrNone if successful, otherwise KErrGeneral, if a CIS hasn't been selected (i.e. SelectCis() not called).
       
   658 	 */
       
   659 	IMPORT_C TInt Restart();
       
   660 	/**
       
   661 	 Find the next instance of the specified tuple, 'aDesiredTpl' in the CIS chain
       
   662 	 and read it into 'aDes'. The search starts from the current position in the CIS (ie CIS pointer),
       
   663 	 not from the start of the CIS. If  the tuple cannot be found then KErrNotFound is returned. 
       
   664 	 When changing the desired tuple it is normal to precede this function with Restart() to reset 
       
   665 	 the current position in the CIS. To find multiple instances of the same tuple in a CIS, 
       
   666 	 keep calling the function with the same value for 'aDesired' tuple without calling Restart(). 
       
   667 
       
   668 	 To use this function to find a tuple without reading it, OR 'aFlag' with KPccdFindOnly.
       
   669 	 (It is recomended not to read an un-recognisd tuple in case it contains active registers.
       
   670 	 Therefore this option should generally be used with KPccdNonSpecificTpl when the requirement
       
   671 	 is to just validate a CIS). To turn on full error reporting (e.g. when validating a CIS),
       
   672 	 OR 'aFlag' with 'KPccdReportErrors'.
       
   673 	 
       
   674 	 @param aDesiredTpl  Tuple to be searched in CIS chain.
       
   675 	 
       
   676 	 @param aDes  Tuple searched is read into aDes.
       
   677 
       
   678 	 @param aFlag Used to read tuple which are not read by default by ORing aFlag with KPccdReturnLinkTpl.
       
   679 
       
   680 	 
       
   681 	 @return KErrNone if successful,KErrNotFound,if could not find a tuple of the type specified
       
   682 	 (or possible invalid CIS if 'KPccdReportErrors' isn't set).KErrNotReady,if card not powered/ready(possible media change).
       
   683 	 KErrCorrupt,if only returned when 'KPccdReportErrors' set.Too many tuples found (>256), too many link tuples, no link target etc.
       
   684 	 KErrArguement,if Tuple is longer than maximum length of 'aDes'.KErrNoMemory,if problem allocating memory during processing of request (no memory).
       
   685 	 KerrAccessDenied, if problem allocating memory during processing of request (memory containing CIS already allocated to another client).
       
   686 	 */
       
   687 	IMPORT_C TInt FindReadTuple(TUint8 aDesiredTpl,TDes8 &aDes,TUint aFlag=0);
       
   688 	/**
       
   689 	 Gets the tuple at the current CIS offset. This is identical to FindReadTuple() except that it always returns 
       
   690 	 the tuple at the current CIS offset rather than  searching for a tuple of a specified type. 
       
   691 	 
       
   692 	 @param aDec8 Tuple is read into aDes8.
       
   693 
       
   694      @return KErrNone if successful, KErrNotFound, if could not find a tuple of the type specified (or possible invalid CIS if 'KPccdReportErrors' isn't set).
       
   695 	 KErrNotReady,if card not powered/ready (possible media change).KErrCorrupt,if only returned when 'KPccdReportErrors' set. 
       
   696 	 Too many tuples found (>256), too many link tuples, no link target etc.KErrArguement ,if Tuple is longer than maximum length of 'aDes'.
       
   697 	 KErrNoMemory if problem allocating memory during processing of request (no memory). KErrAccessDenied, if problem allocating memory during processing of request
       
   698 	 (memory containing CIS already allocated to another client).
       
   699      */
       
   700 	IMPORT_C TInt ReadTuple(TDes8 &aDes);
       
   701 	/**
       
   702 	 Gets information in 'anInfo' from the selected CIS on the card's memory devices. 
       
   703 	 
       
   704 	 This information is contained in the CIS in the appropriate Device tuple. 
       
   705 	 Each time the function is called it returns information on the next device specified 
       
   706 	 (i.e. next Device Info field). When all regions have been reported, KErrNotFound is returned. 
       
   707 	 By default, it reports on devices in common memory space. 
       
   708 	
       
   709 	 To receive device info when the card is operated at 5V, set 'aSocketVcc' 
       
   710 	 to EPccdSocket_5V0 (and KCisTplDevice tuples are processed). For characteristics at 3.3V,
       
   711 	 set 'aSocketVcc' to EPccdSocket_3V3 (and KCisTplDeviceOC tuples are processed). 
       
   712 	 
       
   713 	 To receive info on devices in attribute memory space, use 'aDesiredTpl' to override 
       
   714 	 the type of tuple processed. E.g. to receive device information on attribute memory at 5V, 
       
   715 	 set 'aDesiredTpl' to KCisTplDeviceA. (This feature also allows FindReadRegion() to be used 
       
   716 	 to parse vendor specific tuples which conform to device tuple structure).
       
   717 	 This function searches for the appropriate tuple type starting from the current position 
       
   718 	 of the CIS pointer so it may be necessary to issue a Restart() before each sequence of Calls of this function. 
       
   719 
       
   720 	 The TPcCardRegion object contains a TPccdChnk which can then be used directly in a
       
   721 	 call to DPcCardController::RequestMemory() to request a chunk of PC Card memory.
       
   722 	 
       
   723 	 @param aSocketVcc Used to set the Pc Card Socket voltage.
       
   724 
       
   725      @param anInfo    This has the information returned from the selected CIS on the card's memory devices.
       
   726 
       
   727 	 @param aDesiredTpl Desired Tuple used to find, initialized to zero.
       
   728 
       
   729      @return KErrNone if successful.KErrNotFound,if no more configurations present. KErrNotReady if card not powered/ready (possible media change).
       
   730 	 KErrCorrupt, if invalid configuration/configuration-table-entry tuple detected. KErrNotSupported, if Configuration table entry not supported.
       
   731 	 KErrNoMemory, if problem allocating memory during processing of request (no memory). KErrAccessDenied if problem allocating memory during 
       
   732 	 processing of request (memory containing CIS already allocated to another client).
       
   733 	 */
       
   734 	IMPORT_C TInt FindReadRegion(TPccdSocketVcc aSocketVcc,TPcCardRegion &anInfo,TUint8 aDesiredTpl=0);
       
   735 	/**
       
   736 	 Find the next configuration table entry in the CIS and return the detail of it in 'anInfo'. 
       
   737 	 When all entries have been found, KErrNotFound is returned. This function allows a client to parse a CIS,
       
   738 	 reading information on each of the different configuration option present. 
       
   739 	 It is necessary to issue a Restart() before each sequence of calls of this function. 
       
   740        
       
   741 	 Following a call to this function, the TPcCardConfig object can then be used directly
       
   742 	 in a call to DPcCardController::RequestConfig() to configure the card. Also the TPcCardConfig object
       
   743 	 contains a TPccdChnk which can then be used directly in a call to DPcCardController::RequestMemory() 
       
   744 	 to request the appropriate chunk of PC Card memory.
       
   745 	 
       
   746 	 @param anInfo  has the PcCardconfig information read from CIS entry.
       
   747 	 
       
   748 	 @return KErrNone if successful. KerrNotFound, if no more regions of the type specified to be found.
       
   749 	 KErrNotReady,if card not powered/ready (possible media change). KErrCorrupt, if device tuple contained invalid device info. field.
       
   750 	 KErrNotSupported ,if device tuple contained extended device type. KErrNoMemory,if problem allocating memory during processing
       
   751 	 of request (no memory). KErrAccessDenied if problem allocating memory during processing of request 
       
   752 	 (memory containing CIS already allocated to another client).
       
   753 
       
   754 	 */
       
   755 	IMPORT_C TInt FindReadConfig(TPcCardConfig &anInfo);
       
   756 public:
       
   757     /**
       
   758 	 Sets the CIS reader to socket and function, and checks that the function is valid.
       
   759 	
       
   760 	 @param aCardFunc  Card function to be assined to the CIS reader.
       
   761 	 */
       
   762 	TInt DoSelectCis(TInt aCardFunc);
       
   763 	/**
       
   764 	 Sets the CIS reader back to the start of the CIS.
       
   765 	 */
       
   766 	void DoRestart();
       
   767 	/**
       
   768 	 Find a specified tuple from the CIS and read it.
       
   769 
       
   770 	 @param aDesiredTpl  Tuple to be searched in CIS chain.
       
   771 	 
       
   772 	 @param aDec8 Tuple is read into aDes8.
       
   773 
       
   774 	 @param aFlag Used to read tuple which are not read by default by ORing aFlag with KPccdReturnLinkTpl.
       
   775 
       
   776 	 To use this function to find a tuple without reading it, OR 'aFlag' with KPccdFindOnly.
       
   777 	 (It is recomended not to read an un-recognisd tuple in case it contains active registers.
       
   778 	 Therefore this option should generally be used with KPccdNonSpecificTpl when the requirement
       
   779 	 is to just validate a CIS). To turn on full error reporting (e.g. when validating a CIS),
       
   780 	 OR 'aFlag' with 'KPccdReportErrors'.
       
   781 	 @return KErrNone if successful, KErrNotFound,if could not find a tuple of the type specified
       
   782 	 (or possible invalid CIS if 'KPccdReportErrors' isn't set).KErrNotReady if card not powered/ready (possible media change).
       
   783 	 KErrCorrupt if only returned when 'KPccdReportErrors' set.Too many tuples found (>256), too many link tuples, no link target etc.
       
   784 	 KErrArguement,if tuple is longer than maximum length of 'aDes'. KErrNoMemory if problem allocating memory during processing of request (no memory).
       
   785 	 KErrAccessDenied,if problem allocating memory during processing of request (memory containing CIS already allocated to another client).
       
   786 	 */
       
   787 	TInt DoFindReadTuple(TUint8 aDesiredTpl,TDes8 &aDes,TUint aFlag);
       
   788 	/**
       
   789 	 Gets the tuple at the current CIS offset. This is identical to FindReadTuple() except that it always returns 
       
   790 	 the tuple at the current CIS offset rather than  searching for a tuple of a specified type. 
       
   791 	 
       
   792 	 @param aDec8 Tuple is read into aDes8.
       
   793      
       
   794 	 @return KErrNone if successful, KErrNotFound,if could not find a tuple of the type specified
       
   795 	 (or possible invalid CIS if 'KPccdReportErrors' isn't set).KErrNotReady if card not powered/ready (possible media change).
       
   796 	 KErrCorrupt if only returned when 'KPccdReportErrors' set.Too many tuples found (>256), too many link tuples, no link target etc.
       
   797 	 KErrArguement,if tuple is longer than maximum length of 'aDes'. KErrNoMemory if problem allocating memory during processing of request (no memory).
       
   798 	 KErrAccessDenied,if problem allocating memory during processing of request (memory containing  CIS already allocated to another client). 
       
   799 	 */
       
   800 	TInt DoReadTuple(TDes8 &aDes);
       
   801     /**
       
   802 	 Gets the error report when their is no more CIS links.
       
   803 
       
   804 	 Called at the end of a tuple chain, this moves CIS pointer to the next CIS chain if a long link has been detected.
       
   805 	 
       
   806 	 @param aFullErrorReport Error report after when their is no more CIS links.
       
   807      */
       
   808 	TInt FollowLink(TUint aFullErrorReport);
       
   809 	/**
       
   810 	 Verify a new tuple chain starts with a valid link target tuple.
       
   811 	 
       
   812 	 @return KErrNone if successfull, otherwise KErrCorrupt.
       
   813      */
       
   814 	TInt VerifyLinkTarget();
       
   815 public:
       
   816 	/**
       
   817      A pointer to Pc Card Socket. 
       
   818 	 */
       
   819 	DPcCardSocket *iSocket;
       
   820 	/**
       
   821 	 Pc Card function.
       
   822 	 */
       
   823 	TInt iFunc;
       
   824 	/**
       
   825 	 Offset within the CIS memory.
       
   826 	 */
       
   827 	TUint32	iCisOffset;	
       
   828 	/**
       
   829 	 Link offset within the CIS memory.
       
   830 	 */
       
   831 	TUint32	iLinkOffset;	
       
   832 	/**
       
   833 	 Pc Card memory type.
       
   834 	 @see TPccdMemType
       
   835 	 */
       
   836 	TPccdMemType iMemType;
       
   837 	/**
       
   838 	 Linkflags used to link the tuple.
       
   839 	 */ 
       
   840 	TInt iLinkFlags;
       
   841     /** 
       
   842 	 Used in constructor to mark Pc Card as not restarted.
       
   843 	 */
       
   844 	TBool iRestarted; 
       
   845 	/**
       
   846      For FindReadRegion() - Count of regions read so far.
       
   847 	 */
       
   848 	TInt iRegionCount; 	
       
   849 	/**
       
   850 	 For FindReadConfig() - Configurations read so far.
       
   851 	 */
       
   852 	TInt iConfigCount; 
       
   853 	};
       
   854 
       
   855 NONSHARABLE_CLASS(DPcCardVcc) : public DPBusPsuBase
       
   856 	{
       
   857 public:
       
   858 	DPcCardVcc(TInt aPsuNum, TInt aMediaChangeNum);
       
   859 	virtual TBool IsLocked();
       
   860 	virtual void ReceiveVoltageCheckResult(TInt anError);
       
   861 	inline void SetVoltage(TPccdSocketVcc aVoltage);
       
   862 	inline TPccdSocketVcc VoltageSetting();
       
   863 	static TInt SocketVccToMilliVolts(TPccdSocketVcc aVcc);
       
   864 public:
       
   865 	TPccdSocketVcc iVoltageSetting;
       
   866 	};
       
   867 
       
   868 NONSHARABLE_CLASS(DPcCardMediaChange) : public DMediaChangeBase
       
   869 	{
       
   870 public:
       
   871 	DPcCardMediaChange(TInt aMediaChangeNum);
       
   872 	virtual TInt Create();
       
   873 	};
       
   874     /**
       
   875 	 This class contains functions provided by Pc Card.
       
   876 
       
   877 	 @publishedPartner
       
   878 	 @released
       
   879 	 */
       
   880 class TPcCardFunction
       
   881 	{
       
   882 public:
       
   883     /**
       
   884      Constructor, intialises iFuncType (EUnknownCard),iInitCisOffset(anOffset),iInitCisMemType(aMemType),
       
   885 	 iConfigBaseAddr(0),iConfigRegMask(0),iConfigIndex(KInvalidConfOpt),iConfigFlags(0).
       
   886      
       
   887 	 @param anOffset   An offset value to be initialised for Cis.
       
   888 	 
       
   889 	 @param aMemType   Cis memory type to be initialised.  
       
   890 	 
       
   891 	 @see TPccdMemType
       
   892 	 */ 
       
   893 	TPcCardFunction(TUint32 anOffset,TPccdMemType aMemType);
       
   894 	/**
       
   895 	 Sets the  configuration option(anIndex), client ID and flags used to configure the Pc Card .
       
   896 
       
   897 	 @param anIndex		     Configuration option of the Pc Card.
       
   898 	 
       
   899 	 @param aClientId	     A pointer to the LDD making the configuration.
       
   900 
       
   901 	 @param aConfigFlags	 Select Pc Card features.
       
   902 	 */
       
   903 	void SetConfigOption(TInt anIndex,DBase *aClientID,TUint aConfigFlags);
       
   904     /**
       
   905 	 Sets the configuration base address for Pc Card.
       
   906 
       
   907      @param anAddr	Base address to configure Pc Card.
       
   908 	 */
       
   909 	inline void SetConfigBaseAddr(TUint32 anAddr);
       
   910 	/**
       
   911 	 Sets the Mask register with aMask value.
       
   912 
       
   913 	 @param aMask  The mask value to which the register to be masked.
       
   914 	 */
       
   915 	inline void SetConfigRegMask(TInt aMask);	
       
   916 	/**
       
   917      Sets the function type of the Pc Card.
       
   918 
       
   919 	 @param aType  Function type of the Pc Card.
       
   920 
       
   921 	 @see TPccdFuncType
       
   922 	 */
       
   923 	inline void SetFuncType(TPccdFuncType aType);	
       
   924 	/**
       
   925      Sets the register and offset address.
       
   926 
       
   927      @param anRegOffset   Offset within the register address.
       
   928 
       
   929 	 @param anAddr		  Register address to configure.
       
   930 
       
   931 	 @return KErrNone if successful, otherwise Error if the register isn't present.
       
   932 	 */ 
       
   933 	TInt ConfigRegAddress(TInt aRegOffset,TInt &anAddr);
       
   934 	/**
       
   935 	 Gets a fuction type the card can provide.
       
   936 
       
   937 	 @param anAddr , Address to be configured.
       
   938 
       
   939 	 @return iFuncType The type of function the card can provide.
       
   940 
       
   941 	 @see TPccdFuncType
       
   942 	 */
       
   943 	inline TPccdFuncType FuncType();
       
   944     /**
       
   945 	 Gets configuration index of the Pc Card.
       
   946 
       
   947 	 @return iConfigIndex the configuration option of the Pc Card.
       
   948      */
       
   949 	inline TInt ConfigOption();
       
   950 	/**
       
   951 	 Checks whether the Pc Card is configured to the given configuration.
       
   952 
       
   953      @return True if the Pc Card is configured for the given configuration.
       
   954 
       
   955 	 */
       
   956 	inline TBool IsConfigured();
       
   957 	/**
       
   958 	 Checks whether the Pc Card is configured by the client.
       
   959 
       
   960 	 @param aClientId	A pointer to the LDD making the configuration.
       
   961 
       
   962 	 @return True if the card is configured for the given clientId.
       
   963 	 */
       
   964 	inline TBool IsConfiguredByClient(DBase *aClientID);
       
   965 	/**
       
   966 	 Checks whether the configuration is restoreable after it has been powered 
       
   967      down due to inactivity (but not media change).
       
   968 
       
   969 	 @return True if it can restore
       
   970 	 */
       
   971 	inline TBool IsRestorableConfig();
       
   972 	/** 
       
   973 	 Gets CIS initialisation  of the Pc Card.
       
   974 
       
   975 	 @return iInitCisOffset CIS initialisation of the Pc Card.
       
   976 	 */
       
   977 	inline TUint32 InitCisOffset();
       
   978 	/**
       
   979 	 Gets the type of CIS memory.
       
   980 
       
   981      @return iInitCisMemType type of Cis Memory type.
       
   982 	 */
       
   983 	inline TPccdMemType InitCisMemType();
       
   984 public:
       
   985 	/**
       
   986 	 Type of function the Pc Card can provide.
       
   987 
       
   988 	 @see TPccdFuncType.
       
   989 	 */
       
   990 	TPccdFuncType iFuncType;
       
   991 	/**
       
   992      To store offset of CIS memory to be initialzed.
       
   993 	 */
       
   994 	TUint32 iInitCisOffset;	
       
   995 	/** 
       
   996 	 To store the type of memory which needs to be configured.
       
   997 
       
   998 	 @see TPccdMemType.
       
   999 	 */
       
  1000 	TPccdMemType iInitCisMemType;
       
  1001 	/**
       
  1002 	 To hold the base configuration address of the Pc Card.
       
  1003 	 */
       
  1004 	TUint32 iConfigBaseAddr;
       
  1005 	/**
       
  1006 	 To hold the  configuration register mask  of the Pc Card.
       
  1007 	 */
       
  1008 	TInt iConfigRegMask;
       
  1009     /**
       
  1010      To store the configuration option of the Pc Card.
       
  1011      */
       
  1012 	TInt iConfigIndex;
       
  1013 	/**
       
  1014 	 A pointer to the LDD which request Cis configuration.
       
  1015 	 */
       
  1016 	DBase *iClientID;
       
  1017 	/** 
       
  1018 	 Configuration flags that can be used to configure the Pc Card.
       
  1019 	 */
       
  1020 	TUint iConfigFlags;
       
  1021 	};
       
  1022 
       
  1023 NONSHARABLE_CLASS(DPcCardSocket) : public DPBusSocket
       
  1024 	{
       
  1025 public:
       
  1026 	enum TPowerUpState
       
  1027 		{
       
  1028 		EIdle=0,
       
  1029 		EInit=1,
       
  1030 		EApplyingReset=2,
       
  1031 		ECheckVcc=3,
       
  1032 		EWaitForVccReading=4,
       
  1033 		EWaitForReady=5,
       
  1034 		EPauseAfterReady=6,
       
  1035 		};
       
  1036 public:
       
  1037 	DPcCardSocket(TSocket aSocketNum);
       
  1038 	virtual TInt Create(const TDesC* aName);
       
  1039 	virtual void InitiatePowerUpSequence();
       
  1040 	void TerminatePowerUpSequence(TInt aResult);
       
  1041 	void ResetPowerUpState();
       
  1042 	void CardPowerUpTick();
       
  1043 	virtual void SocketInfo(TPcCardSocketInfo& anInfo)=0;
       
  1044 	virtual void Reset1();
       
  1045 	virtual void Reset2();
       
  1046 	virtual TInt CardIsReadyAndVerified();
       
  1047 	virtual TBool CardIsReady();
       
  1048 	virtual TBool CardIsPowered();
       
  1049 	IMPORT_C TInt VerifyCard(TPccdType& aType);
       
  1050 	TInt GetCisFormat();
       
  1051 	IMPORT_C TInt RequestConfig(TInt aCardFunc,DBase *aClientID,TPcCardConfig &anInfo,TUint aFlag);
       
  1052 	IMPORT_C void ReleaseConfig(TInt aCardFunc,DBase *aClientID);
       
  1053 	IMPORT_C TInt ReadConfigReg(TInt aCardFunc,TInt aRegOffset,TUint8 &aVal);
       
  1054 	IMPORT_C TInt WriteConfigReg(TInt aCardFunc,TInt aRegOffset,const TUint8 aVal);
       
  1055 	TInt ReadCis(TPccdMemType aMemType,TInt aPos,TDes8 &aDes,TInt aLen);
       
  1056 	TPcCardFunction *CardFunc(TInt aCardFunc);
       
  1057 	TInt AddNewFunc(TUint32 anOffset,TPccdMemType aMemType);
       
  1058 	TInt ValidateCis(TInt aCardFunc);
       
  1059 	inline TInt CardFuncCount();
       
  1060 	inline TBool IsValidCardFunc(TInt aCardFunc);
       
  1061 	inline TBool IsMultiFuncCard();
       
  1062 	TBool IsConfigLocked();
       
  1063 	TBool IsMemoryLocked();
       
  1064 	TBool IsVerified();
       
  1065 	virtual void HwReset(TBool anAssert)=0;
       
  1066 	virtual TInt Indicators(TSocketIndicators &anInd)=0;
       
  1067 	virtual TBool Ready(TInt aCardFunc=KInvalidFuncNum)=0;
       
  1068 	TPccdSocketVcc VccSetting();
       
  1069 	void Restore();
       
  1070 public:
       
  1071 	virtual DPccdChunkBase *NewPccdChunk(TPccdMemType aType)=0;
       
  1072 	virtual TInt InterruptEnable(TPccdInt anInt, TUint aFlag)=0;
       
  1073 	virtual void InterruptDisable(TPccdInt anInt)=0;
       
  1074 	void RemoveChunk(DPccdChunkBase *aChunk);
       
  1075 public:
       
  1076 	RPointerArray<TPcCardFunction> iCardFuncArray;
       
  1077 	RPointerArray<DPccdChunkBase> iMemChunks;
       
  1078 	RPccdWindow iAttribWin;
       
  1079 	TInt iCardPowerUpState;
       
  1080 	TTickLink iCardPowerUpTimer;
       
  1081 	TDfc iCardPowerUpDfc;
       
  1082 	TInt iCardPowerUpTickCount;
       
  1083 	TInt iCardPowerUpResetLen;
       
  1084 	TInt iCardPowerUpPauseLen;
       
  1085 	TInt iClientWindows;
       
  1086 	TInt iActiveConfigs;
       
  1087 	};
       
  1088 
       
  1089 enum TPcCardPanic
       
  1090 	{
       
  1091 	EPcCardBadSocketNumber=0,
       
  1092 	EPcCardCisReaderUnInit=1,
       
  1093 	EPcCardBadFunctionNumber=2,
       
  1094 	EPcCardPowerUpReqFault=3,
       
  1095 	EPcCardMediaDriverCurrentConsumption=4,
       
  1096 	EPcCardAddEventError=5
       
  1097 	};
       
  1098 
       
  1099 GLREF_C void PcCardPanic(TPcCardPanic aPanic);
       
  1100 
       
  1101 #include <pccard.inl>
       
  1102 
       
  1103 
       
  1104 #endif