kerneltest/sdiotest/source/sdiotests.h
branchRCL_3
changeset 294 039a3e647356
parent 268 345b1ca54e88
child 295 5460f47b94ad
equal deleted inserted replaced
268:345b1ca54e88 294:039a3e647356
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Test for SDIO functions
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file sdiotests.h
       
    20  @internal
       
    21  @test
       
    22 */
       
    23 
       
    24 #ifndef __SDIO_TESTS_H__
       
    25 #define __SDIO_TESTS_H__
       
    26 
       
    27 class DSDIORegisterInterface;
       
    28 class TSDIOCard;
       
    29 
       
    30 
       
    31 class TSDIOCardConfigTest
       
    32 /**
       
    33 Class to store card configuration parameters.
       
    34 NB should be exactly the same layout as private class TSDIOCardConfig, defined in sdiocard.h
       
    35 
       
    36 @internal
       
    37 @test
       
    38 */
       
    39 	{
       
    40 public:								 
       
    41 	/** The Manufacture ID */
       
    42 	TUint16 iManufacturerID;
       
    43 	/** The Card ID */
       
    44 	TUint16 iCardID;		
       
    45 	/** The maximum block size for Function 0 */
       
    46 	TUint16 iFn0MaxBlockSize;
       
    47 	/** The maximum transfer rate (encoded) */
       
    48 	TUint8  iMaxTranSpeed;		
       
    49 	/** The current block size (of function 0) */
       
    50 	TUint16 iCurrentBlockSize;	
       
    51 	/** SDIO/CCCR Revision	(as CCCR offset 0x00) */
       
    52 	TUint8 iRevision;			
       
    53 	/** SD Format Version	(as CCCR offset 0x01) */
       
    54 	TUint8 iSDFormatVer;		
       
    55 	/** Card Capabilities	(as CCCR offset 0x08) */
       
    56 	TUint8 iCardCaps;			
       
    57 	/** Common CIS Pointer	(as CCCR offset 0x09:0x0B) */
       
    58 	TUint32 iCommonCisP;		
       
    59 	/** High speed register (as CCCR offset 0x0D) */
       
    60 	TUint8 iHighSpeed;			
       
    61 
       
    62     TInt iReserved[4];
       
    63 	};
       
    64 
       
    65 /**
       
    66 Package up the TSDIOCardConfigTest as a descriptor.
       
    67 
       
    68 @internal
       
    69 @test
       
    70 */
       
    71 typedef TPckgBuf<TSDIOCardConfigTest> TSDIOCardConfigTestPckg;
       
    72 
       
    73 
       
    74 #ifndef __KERNEL_MODE__
       
    75 enum TSdioFunctionType
       
    76 /** These define the standard SDIO Function Types
       
    77 	These are defined by the SDA and provide a standard, common 
       
    78 	register interface for each class of peripheral.
       
    79 */
       
    80 	{
       
    81 	/** Not an SDIO standard interface */
       
    82 	ESdioFunctionTypeUnknown  = 0,
       
    83 	/** SDIO UART standard interface */
       
    84 	ESdioFunctionTypeUART	  = 1,
       
    85 	/** SDIO 'thin' Bluetooth standard interface */
       
    86 	ESdioFunctionTypeThinBT	  = 2,
       
    87 	/** SDIO 'complete' Bluetooth standard interface */
       
    88 	ESdioFunctionTypeFullBT	  = 3,
       
    89 	/** SDIO GPS standard interface */
       
    90 	ESdioFunctionTypeGPS	  = 4,
       
    91 	/** SDIO Camera standard interface */
       
    92 	ESdioFunctionTypeCamera	  = 5,
       
    93 	/** SDIO PHS Radio standard interface */
       
    94 	ESdioFunctionTypePHS	  = 6,
       
    95 	/** SDIO WLAN standard interface (Introduced in SDIO Rev. 1.10f) */
       
    96 	ESdioFunctionTypeWLAN	  = 7,
       
    97 	/** Extended SDIO standard interface (Introduced in SDIO Rev. 1.10f) */
       
    98 	ESdioFunctionTypeExtended = 15,
       
    99 	};
       
   100 #endif // #ifvdef __KERNEL_MODE__
       
   101 
       
   102 
       
   103 
       
   104 
       
   105 class TSDIOFunctionCapsTest
       
   106 /**
       
   107 Class to store card function parameters.
       
   108 NB should be exactly the same layout as private class TSDIOFunctionCaps, defined in function.h
       
   109 
       
   110 @internal
       
   111 @test
       
   112 */
       
   113 	{
       
   114 public:
       
   115 	//
       
   116 	// The following data is obtained from the functions FBR
       
   117 	//
       
   118 		
       
   119 	/** Function number within the card */
       
   120 	TUint8 iNumber;
       
   121 	/** Extended devide code */
       
   122 	TUint8 iDevCodeEx;
       
   123 	/** Type of function */
       
   124 	TSdioFunctionType iType;
       
   125 	/** Function contains Code Storage Area */
       
   126 	TBool iHasCSA;
       
   127 	/** High-Power Requirements */
       
   128 	TUint8 iPowerFlags;
       
   129 	
       
   130 	//
       
   131 	// The following data is obtained from the functions CIS
       
   132 	//
       
   133 		
       
   134 	/** Function Info */
       
   135 	TUint8 iFunctionInfo;	
       
   136 	/** Function revision of standard function */
       
   137 	TUint8 iRevision;
       
   138 	/** Product Serial Number */
       
   139 	TUint32 iSerialNumber;
       
   140 	/** CSA Size */
       
   141 	TUint32 iCSASize;
       
   142 	/** CSA Properties */
       
   143 	TUint8 iCSAProperties;
       
   144 	/** Maximum Block Size */
       
   145 	TUint16 iMaxBlockSize;
       
   146 	/** 32-Bit SD OCR */
       
   147 	TUint32 iOCR;
       
   148 	/** Minimum standby current (mA) */
       
   149 	TUint8 iMinPwrStby;
       
   150 	/** Average standby current (mA) */
       
   151 	TUint8 iAvePwrStby;
       
   152 	/** Maximum standby current (mA) */
       
   153 	TUint8 iMaxPwrStby;
       
   154 	/** Minumum operating current (mA) */
       
   155 	TUint8 iMinPwrOp;
       
   156 	/** Average operating current (mA) */
       
   157 	TUint8 iAvePwrOp;
       
   158 	/** Maximum operating current (mA) */
       
   159 	TUint8 iMaxPwrOp;
       
   160 	/** Minimum Bandwidth */
       
   161 	TUint16 iMinBandwidth;
       
   162 	/** Optimum Bandwidth */
       
   163 	TUint16 iOptBandwidth;
       
   164 	/** Enable Timeout (Added in SDIO Rev 1.1) */
       
   165 	TUint16 iEnableTimeout;
       
   166 	/** Average operating current required in High Power mode (mA) (Added in SDIO Rev 1.1) */
       
   167 	TUint16 iAveHiPwr;
       
   168 	/** Maximum operating current required in High Power mode (mA) (Added in SDIO Rev 1.1) */
       
   169 	TUint16 iMaxHiPwr;
       
   170 
       
   171 	/** Standard Function ID */
       
   172 	TUint8 iStandardFunctionID;	
       
   173 	/** Standard Function Type */
       
   174 	TUint8 iStandardFunctionType;
       
   175 
       
   176 	enum TSDIOCapsMatch
       
   177 	/** These bits define the capabilities to match when enumerating SDIO functions.
       
   178 		@see TSDIOFunctionCaps::CapabilitiesMatch
       
   179 		@see TSDIOCard::FindFunction
       
   180 	*/
       
   181 		{
       
   182 		/** Specify EDontCare to match functions without specific properties */
       
   183 		EDontCare 		= KClear32,
       
   184 		/** Find functions with a specific function number */
       
   185 		EFunctionNumber	= KBit0,
       
   186 		/** Find functions with a specific device code */
       
   187 		EFunctionType	= KBit1,
       
   188 		/** Find functions that have a Code Storage Area */
       
   189 		EHasCSA			= KBit2,
       
   190 		/** Find functions with specific High-Power support */
       
   191 		EPowerFlags		= KBit3,
       
   192 		/** Find functions with specific capabilities (Currently only Wake-Up Supported) */
       
   193 		EFunctionInfo	= KBit4,
       
   194 		/** Find functions with a specific revision code */
       
   195 		ERevision		= KBit5,
       
   196 		/** Find functions with a specific serial number */
       
   197 		ESerialNumber	= KBit6,
       
   198 		/** Find functions with a CSA size greater than or equal to that specified */
       
   199 		ECSASize		= KBit7,
       
   200 		/** Find functions with specific CSA properties (re-formattable, write-protected) */
       
   201 		ECSAProperties	= KBit8,
       
   202 		/** Find functions that support a block size greater than or equal to that specified */
       
   203 		EMaxBlockSize	= KBit9,
       
   204 		/** Find functions that support a subset of the requested OCR */
       
   205 		EOcr			= KBit10,
       
   206 		/** Find functions where the minimum standby current does not exceed that specified */
       
   207 		EMinPwrStby		= KBit11,
       
   208 		/** Find functions where the average standby current does not exceed that specified */
       
   209 		EAvePwrStby		= KBit12,
       
   210 		/** Find functions where the maximum standby current does not exceed that specified */
       
   211 		EMaxPwrStby		= KBit13,
       
   212 		/** Find functions where the minimum operating current does not exceed that specified */
       
   213 		EMinPwrOp		= KBit14,
       
   214 		/** Find functions where the average operating current does not exceed that specified */
       
   215 		EAvePwrOp		= KBit15,
       
   216 		/** Find functions where the maximum operating current does not exceed that specified */
       
   217 		EMaxPwrOp		= KBit16,
       
   218 		/** Find functions where the average operating current in high-power mode does not exceed that specified */
       
   219 		EAveHiPwr		= KBit17,
       
   220 		/** Find functions where the maximum operating current in high-power mode does not exceed that specified */
       
   221 		EMaxHiPwr		= KBit18,
       
   222 		/** Find functions that support bandwidth greater than or equal to that specified*/
       
   223 		EMinBandwidth	= KBit19,
       
   224 		/** Find functions that support an optimum bandwidth greater than or equal to that specified*/
       
   225 		EOptBandwidth	= KBit20,
       
   226 		/** Find functions with a specific standard function ID */
       
   227 		EStandardFunctionID		= KBit21,
       
   228 		/** Find functions with a specific standard function type */
       
   229 		EStandardFunctionType	= KBit22,		
       
   230 		};	
       
   231 
       
   232     TInt iReserved[2];		
       
   233 	};
       
   234 typedef TPckgBuf<TSDIOFunctionCapsTest> TSDIOFunctionCapsTestPckg;
       
   235 
       
   236 class TSDIOTestUtils
       
   237 /**
       
   238 Utility class.
       
   239 
       
   240 @internal
       
   241 @test
       
   242 */
       
   243 	{
       
   244 public:
       
   245 	static inline TPtrC FunctionTypeText(TSdioFunctionType aType)
       
   246 	/**
       
   247 	Convert a function type enumeration to human readable text.
       
   248 
       
   249 	@param aType The function type enum value
       
   250 	@return The Human readable text
       
   251 	
       
   252 	@internal
       
   253 	@test
       
   254 	*/
       
   255 		{
       
   256 		switch(aType)
       
   257 			{
       
   258 			case ESdioFunctionTypeUnknown:	return(_L("Not a standard SDIO interface"));
       
   259 			case ESdioFunctionTypeUART:		return(_L("UART standard interface"));
       
   260 			case ESdioFunctionTypeThinBT:	return(_L("'thin' Bluetooth standard interface"));
       
   261 			case ESdioFunctionTypeFullBT:	return(_L("'complete' Bluetooth standard interface"));
       
   262 			case ESdioFunctionTypeGPS:		return(_L("GPS standard interface"));
       
   263 			case ESdioFunctionTypeCamera:	return(_L("Camera standard interface"));
       
   264 			case ESdioFunctionTypePHS:		return(_L("PHS Radio standard interface"));
       
   265 			case ESdioFunctionTypeWLAN:		return(_L("WLAN standard interface"));
       
   266 			case ESdioFunctionTypeExtended: return(_L("Extended standard interface"));
       
   267 			default: 						return(_L("Unknown"));
       
   268 			}
       
   269 		}
       
   270 	};
       
   271 
       
   272 #endif