kerneltest/e32test/hcr/d_hcrsim.h
changeset 4 56f325a607ea
parent 0 a41df078684a
child 14 5d2844f35677
equal deleted inserted replaced
2:4122176ea935 4:56f325a607ea
    19 #define D_HCRSIM_H
    19 #define D_HCRSIM_H
    20 
    20 
    21 #include <e32cmn.h>
    21 #include <e32cmn.h>
    22 #include <e32ver.h>
    22 #include <e32ver.h>
    23 #include <drivers/hcr.h>
    23 #include <drivers/hcr.h>
       
    24 #ifndef HCRTEST_USERSIDE_INTERFACE
    24 #include "hcr_hai.h"
    25 #include "hcr_hai.h"
    25 #include "hcr_pil.h"
    26 #include "hcr_pil.h"
       
    27 #endif // HCRTEST_USERSIDE_INTERFACE
    26 
    28 
    27 #ifndef __KERNEL_MODE__
    29 #ifndef __KERNEL_MODE__
    28 using namespace HCR;
    30 using namespace HCR;
    29 #endif // __KERNEL_MODE__
    31 #endif // __KERNEL_MODE__
    30 
    32 
    31 // Device driver name
    33 // Device driver names
    32 _LIT(KTestHcrSim, "d_hcrsim");
    34 _LIT(KTestHcrRealOwn, "d_hcrext_own");
       
    35 _LIT(KTestHcrSimOwn, "d_hcrsim_own");
       
    36 _LIT(KTestHcrRealClient, "d_hcrext_client");
       
    37 _LIT(KTestHcrSimClient, "d_hcrsim_client");
       
    38 
       
    39 const TUint KTestBenchmarkNumberOfSettingsInCategory = 1001;
       
    40 const HCR::TCategoryUid KTestBenchmarkCategoryId = 0x60000000;
    33 
    41 
    34 // The following flags are used when calling InitExtension() in order to modify
    42 // The following flags are used when calling InitExtension() in order to modify
    35 // the behaviour of the test PSL.
    43 // the behaviour of the test PSL.
    36 enum TTestPslConfiguration {
    44 enum TTestPslConfiguration {
    37 	// Make PSL return NULL when asked for the address of the Compiled Repository
    45 	// Make PSL return NULL when asked for the address of the Compiled Repository
    49 	// Use Corrupt Repository (has duplicates)
    57 	// Use Corrupt Repository (has duplicates)
    50 	ETestCorruptRepository2 = 0x10,
    58 	ETestCorruptRepository2 = 0x10,
    51 
    59 
    52 	// Set Override Repository address to the Empty Compiled Repository
    60 	// Set Override Repository address to the Empty Compiled Repository
    53 	ETestEnableOverrideRepository = 0x20,
    61 	ETestEnableOverrideRepository = 0x20,
       
    62 
       
    63 	// Make PSL fail to create a variant object
       
    64 	ETestVariantObjectCreateFail = 0x40,
       
    65 
       
    66 	// Make PSL initialisation fail
       
    67 	ETestInitialisationFail = 0x80,
       
    68 
       
    69 	// Use bad repository with NULL ordered list
       
    70 	ETestNullOrderedList = 0x100,
       
    71 
       
    72 	// Make PSL return NULL when asked for the address of the Compiled Repository
       
    73 	// but return KErrNone
       
    74 	ETestNullRepositoryKErrNone = 0x200,
       
    75 
       
    76 	// GetCompiledRepositoryAddress return wrong error code
       
    77 	ETestBadErrorCode = 0x400,
    54 };
    78 };
    55 
    79 
    56 class RHcrSimTestChannel : public RBusLogicalChannel
    80 class RHcrSimTestChannel : public RBusLogicalChannel
    57 	{
    81 	{
    58 public:
    82 public:
    83 		// HCR Internal API's
   107 		// HCR Internal API's
    84 		EHcrInitExtension,
   108 		EHcrInitExtension,
    85 		EHcrSwitchRepository,
   109 		EHcrSwitchRepository,
    86 		EHcrClearRepository,
   110 		EHcrClearRepository,
    87 		EHcrCheckIntegrity,
   111 		EHcrCheckIntegrity,
       
   112 		// Others
       
   113 		EHcrGetInitExtensionTestResults,
       
   114 		EHcrBenchmarkGetSettingInt,
       
   115 		EHcrBenchmarkGetSettingArray,
       
   116 		EHcrBenchmarkGetSettingDes,
       
   117 		EHcrBenchmarkFindNumSettingsInCategory,
       
   118 		EHcrBenchmarkFindSettings,
       
   119 		EHcrBenchmarkGetTypeAndSize,
       
   120 		EHcrBenchmarkGetWordSettings,
    88 		};
   121 		};
    89  
   122 
    90 #ifndef __KERNEL_MODE__
   123 #ifndef __KERNEL_MODE__
    91 	inline TInt Open();
   124 	inline TInt Open(const TDesC& aLdd);
    92 	inline TInt GetLinAddr(const TSettingId& aId, TLinAddr& aValue);
   125 	inline TInt GetLinAddr(const TSettingId& aId, TLinAddr& aValue);
    93 	inline TInt FindNumSettingsInCategory(TCategoryUid aCatUid);
   126 	inline TInt FindNumSettingsInCategory(TCategoryUid aCatUid);
    94 	inline TInt FindSettings(TCategoryUid aCatUid,
   127 	inline TInt FindSettings(TCategoryUid aCatUid,
    95 							TInt aMaxNum, TUint32& aNumFound,
   128 							TInt aMaxNum, TUint32& aNumFound,
    96 							TElementId* aElIds, TSettingType* aTypes, TUint16* aLens);
   129 							TElementId* aElIds, TSettingType* aTypes, TUint16* aLens);
    97 	inline TInt FindSettings(TCategoryUid aCat,
   130 	inline TInt FindSettings(TCategoryUid aCat,	TInt aMaxNum,
    98 							TInt aMaxNum, TUint32 aAtId,
       
    99 							TUint32 aMask, TUint32 aPattern, TUint32& aNumFound,
   131 							TUint32 aMask, TUint32 aPattern, TUint32& aNumFound,
   100 							TElementId* aElIds, TSettingType* aTypes, TUint16* aLens);
   132 							TElementId* aElIds, TSettingType* aTypes, TUint16* aLens);
   101 	inline TInt GetTypeAndSize(const TSettingId& aId,
   133 	inline TInt GetTypeAndSize(const TSettingId& aId,
   102 							TSettingType& aType, TUint16& aLen);
   134 							TSettingType& aType, TUint16& aLen);
   103 	inline TInt GetWordSettings(TInt aNum, const SSettingId aIds[],
   135 	inline TInt GetWordSettings(TInt aNum, const SSettingId aIds[],
   123 	inline TInt GetString(const TSettingId& aId, TUint16 aMaxLen,
   155 	inline TInt GetString(const TSettingId& aId, TUint16 aMaxLen,
   124 							TText8* aValue, TUint16& aLen);
   156 							TText8* aValue, TUint16& aLen);
   125 	inline TInt InitExtension(const TUint32 aFlags = 0);
   157 	inline TInt InitExtension(const TUint32 aFlags = 0);
   126 	inline TInt SwitchRepository(const TDesC8& aFileName, HCRInternal::TReposId aId);
   158 	inline TInt SwitchRepository(const TDesC8& aFileName, HCRInternal::TReposId aId);
   127 	inline TInt CheckIntegrity();
   159 	inline TInt CheckIntegrity();
       
   160 	inline TInt GetInitExtensionTestResults(TInt& aLine, TInt& aError);
       
   161 	inline TInt BenchmarkGetSettingInt(const TSettingId& aId, TUint32& aTimeMs);
       
   162 	inline TInt BenchmarkGetSettingArray(const TSettingId& aId, TUint32& aTimeMs);
       
   163 	inline TInt BenchmarkGetSettingDes(const TSettingId& aId, TUint32& aTimeMs);
       
   164 	inline TInt BenchmarkFindNumSettingsInCategory(const TCategoryUid aCatUid, TUint32& aTimeMs);
       
   165 	inline TInt BenchmarkFindSettings(const TCategoryUid aCatUid, TUint32& aTimeMs);
       
   166 	inline TInt BenchmarkGetTypeAndSize(const TSettingId& aId, TUint32& aTimeMs);
       
   167 	inline TInt BenchmarkGetWordSettings(const TCategoryUid aCatUid, TUint32& aTimeMs);
   128 #endif // __KERNEL_MODE__
   168 #endif // __KERNEL_MODE__
   129 	};
   169 	};
   130 
   170 
   131 #ifndef __KERNEL_MODE__
   171 #ifndef __KERNEL_MODE__
   132 inline TInt RHcrSimTestChannel::Open()
   172 inline TInt RHcrSimTestChannel::Open(const TDesC& aLdd)
   133 	{return (DoCreate(KTestHcrSim(), TVersion(1, 0, KE32BuildVersionNumber), KNullUnit, NULL, NULL, EOwnerThread));}
   173 	{return (DoCreate(aLdd, TVersion(1, 0, KE32BuildVersionNumber), KNullUnit, NULL, NULL, EOwnerThread));}
   134 inline TInt RHcrSimTestChannel::GetLinAddr(const TSettingId& aId, TLinAddr& aValue)
   174 inline TInt RHcrSimTestChannel::GetLinAddr(const TSettingId& aId, TLinAddr& aValue)
   135 	{return DoControl(EHcrGetLinAddr, (TAny*) &aId, (TAny*) &aValue);}
   175 	{return DoControl(EHcrGetLinAddr, (TAny*) &aId, (TAny*) &aValue);}
   136 inline TInt RHcrSimTestChannel::FindNumSettingsInCategory(TCategoryUid aCatUid)
   176 inline TInt RHcrSimTestChannel::FindNumSettingsInCategory(TCategoryUid aCatUid)
   137 	{return DoControl(EHcrFindNumSettingsInCategory, (TAny*) aCatUid);}
   177 	{return DoControl(EHcrFindNumSettingsInCategory, (TAny*) aCatUid);}
   138 inline TInt RHcrSimTestChannel::FindSettings(TCategoryUid aCatUid,
   178 inline TInt RHcrSimTestChannel::FindSettings(TCategoryUid aCatUid,
   146 	args[3] = (TAny*) aElIds;
   186 	args[3] = (TAny*) aElIds;
   147 	args[4] = (TAny*) aTypes;
   187 	args[4] = (TAny*) aTypes;
   148 	args[5] = (TAny*) aLens;
   188 	args[5] = (TAny*) aLens;
   149 	return DoControl(EHcrFindSettingsCategory, (TAny*) args);
   189 	return DoControl(EHcrFindSettingsCategory, (TAny*) args);
   150 	}
   190 	}
   151 inline TInt RHcrSimTestChannel::FindSettings(TCategoryUid aCat,
   191 inline TInt RHcrSimTestChannel::FindSettings(TCategoryUid aCat,	TInt aMaxNum, 
   152 					TInt aMaxNum, TUint32 aAtId,
       
   153 					TUint32 aMask, TUint32 aPattern, TUint32& aNumFound,
   192 					TUint32 aMask, TUint32 aPattern, TUint32& aNumFound,
   154 					TElementId* aElIds, TSettingType* aTypes, TUint16* aLens)
   193 					TElementId* aElIds, TSettingType* aTypes, TUint16* aLens)
   155 	{
   194 	{
   156 	TAny* args[9];
   195 	TAny* args[8];
   157 	args[0] = (TAny*) aCat;
   196 	args[0] = (TAny*) aCat;
   158 	args[1] = (TAny*) aMaxNum;
   197 	args[1] = (TAny*) aMaxNum;
   159 	args[2] = (TAny*) aAtId;
   198 	args[2] = (TAny*) aMask;
   160 	args[3] = (TAny*) aMask;
   199 	args[3] = (TAny*) aPattern;
   161 	args[4] = (TAny*) aPattern;
   200 	args[4] = (TAny*) &aNumFound;
   162 	args[5] = (TAny*) &aNumFound;
   201 	args[5] = (TAny*) aElIds;
   163 	args[6] = (TAny*) aElIds;
   202 	args[6] = (TAny*) aTypes;
   164 	args[7] = (TAny*) aTypes;
   203 	args[7] = (TAny*) aLens;
   165 	args[8] = (TAny*) aLens;
       
   166 	return DoControl(EHcrFindSettingsPattern, (TAny*) args);
   204 	return DoControl(EHcrFindSettingsPattern, (TAny*) args);
   167 	}
   205 	}
   168 inline TInt RHcrSimTestChannel::GetTypeAndSize(const TSettingId& aId,
   206 inline TInt RHcrSimTestChannel::GetTypeAndSize(const TSettingId& aId,
   169 						TSettingType& aType, TUint16& aLen)
   207 						TSettingType& aType, TUint16& aLen)
   170 	{
   208 	{
   252 	{return DoControl(EHcrInitExtension, (TAny*) aFlags);}
   290 	{return DoControl(EHcrInitExtension, (TAny*) aFlags);}
   253 inline TInt RHcrSimTestChannel::SwitchRepository(const TDesC8& aFileName, HCRInternal::TReposId aId)
   291 inline TInt RHcrSimTestChannel::SwitchRepository(const TDesC8& aFileName, HCRInternal::TReposId aId)
   254 	{return DoControl(EHcrSwitchRepository, (TAny*) &aFileName, (TAny*) aId);}
   292 	{return DoControl(EHcrSwitchRepository, (TAny*) &aFileName, (TAny*) aId);}
   255 inline TInt RHcrSimTestChannel::CheckIntegrity()
   293 inline TInt RHcrSimTestChannel::CheckIntegrity()
   256 	{return DoControl(EHcrCheckIntegrity);}
   294 	{return DoControl(EHcrCheckIntegrity);}
       
   295 inline TInt RHcrSimTestChannel::GetInitExtensionTestResults(TInt& aLine, TInt& aError)
       
   296 	{return DoControl(EHcrGetInitExtensionTestResults, (TAny*) &aLine, (TAny*) &aError);}
       
   297 inline TInt RHcrSimTestChannel::BenchmarkGetSettingInt(const TSettingId& aId, TUint32& aTimeMs)
       
   298 	{return DoControl(EHcrBenchmarkGetSettingInt, (TAny*) &aId, (TAny*) &aTimeMs);}
       
   299 inline TInt RHcrSimTestChannel::BenchmarkGetSettingArray(const TSettingId& aId, TUint32& aTimeMs)
       
   300 	{return DoControl(EHcrBenchmarkGetSettingArray, (TAny*) &aId, (TAny*) &aTimeMs);}
       
   301 inline TInt RHcrSimTestChannel::BenchmarkGetSettingDes(const TSettingId& aId, TUint32& aTimeMs)
       
   302 	{return DoControl(EHcrBenchmarkGetSettingDes, (TAny*) &aId, (TAny*) &aTimeMs);}
       
   303 inline TInt RHcrSimTestChannel::BenchmarkFindNumSettingsInCategory(const TCategoryUid aCatUid, TUint32& aTimeMs)
       
   304 	{return DoControl(EHcrBenchmarkFindNumSettingsInCategory, (TAny*) aCatUid, (TAny*) &aTimeMs);}
       
   305 inline TInt RHcrSimTestChannel::BenchmarkFindSettings(const TCategoryUid aCatUid, TUint32& aTimeMs)
       
   306 	{return DoControl(EHcrBenchmarkFindSettings, (TAny*) aCatUid, (TAny*) &aTimeMs);}
       
   307 inline TInt RHcrSimTestChannel::BenchmarkGetTypeAndSize(const TSettingId& aId, TUint32& aTimeMs)
       
   308 	{return DoControl(EHcrBenchmarkGetTypeAndSize, (TAny*) &aId, (TAny*) &aTimeMs);}
       
   309 inline TInt RHcrSimTestChannel::BenchmarkGetWordSettings(const TCategoryUid aCatUid, TUint32& aTimeMs)
       
   310 	{return DoControl(EHcrBenchmarkGetWordSettings, (TAny*) aCatUid, (TAny*) &aTimeMs);}
   257 #endif // __KERNEL_MODE__
   311 #endif // __KERNEL_MODE__
   258 #endif // D_HCRSIM_H
   312 #endif // D_HCRSIM_H