kerneltest/e32test/dmav2/t_dma2.h
changeset 36 538db54a451d
child 130 c30940f6d922
equal deleted inserted replaced
34:f497542af8e4 36:538db54a451d
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 */
       
    17 #ifndef __T_DMA2_H__
       
    18 #define __T_DMA2_H__
       
    19 
       
    20 #include "cap_reqs.h"
       
    21 #include "test_thread.h"
       
    22 #include "d_dma2.h"
       
    23 #include <e32std.h>
       
    24 
       
    25 
       
    26 class TTestCase;
       
    27 // Global array of test cases
       
    28 extern RPointerArray<TTestCase> TestArray;
       
    29 
       
    30 
       
    31 extern TBool gVerboseOutput;   // Verbose output control
       
    32 
       
    33 
       
    34 const TInt KParameterTextLenMax = 80;	// command-line param length
       
    35 
       
    36 /**
       
    37 This function prints out the PSL test Information
       
    38 */
       
    39 void Print(const TDmaV2TestInfo& aInfo);
       
    40 
       
    41 /**
       
    42 Runs all framework self tests
       
    43 */
       
    44 void SelfTests();
       
    45 
       
    46 void ApiTests();
       
    47 
       
    48 class CSingleTransferTest;
       
    49 class CIsrRequeTest;
       
    50 class CMultiTransferTest;
       
    51 
       
    52 
       
    53 /**
       
    54 An interface to a classs that sets up the buffers before a test
       
    55 */
       
    56 //TODO both pre and post transfer checks should perhaps derive from an
       
    57 //abstract visitor base
       
    58 class MPreTransfer
       
    59 	{
       
    60 public:
       
    61 	virtual ~MPreTransfer()
       
    62 		{}
       
    63 	virtual void Setup(const CSingleTransferTest& aTest) const = 0;
       
    64 	virtual void Setup(const CIsrRequeTest& aTest) const = 0;
       
    65 	virtual void Setup(const CMultiTransferTest& aTest) const = 0;
       
    66 	};
       
    67 
       
    68 /**
       
    69 An interface for a check which takes place at the end of a DMA
       
    70 transfer test to verify the transfer was as expected.
       
    71 */
       
    72 class MPostTransferCheck
       
    73 	{
       
    74 public:
       
    75 	virtual ~MPostTransferCheck()
       
    76 		{}
       
    77 	virtual TInt Check(const CSingleTransferTest& aTest) const = 0;
       
    78 	virtual TInt Check(const CIsrRequeTest& aTest) const = 0;
       
    79 	virtual TInt Check(CMultiTransferTest& aTest) const = 0;
       
    80 	};
       
    81 
       
    82 class TCompare2D : public MPostTransferCheck
       
    83 	{
       
    84 public:
       
    85 	TCompare2D()
       
    86 		{}
       
    87 
       
    88 	virtual TInt Check(const CSingleTransferTest& aTest) const;
       
    89 	virtual TInt Check(const CIsrRequeTest& aTest) const;
       
    90 	virtual TInt Check(CMultiTransferTest& aTest) const;
       
    91 
       
    92 	};
       
    93 
       
    94 class TAlwaysFail : public MPostTransferCheck
       
    95 	{
       
    96 public:
       
    97 	virtual TInt Check(const CSingleTransferTest& /*aTest*/) const
       
    98 		{return KErrUnknown;}
       
    99 	virtual TInt Check(const CIsrRequeTest&) const
       
   100 		{return KErrUnknown;}
       
   101 	virtual TInt Check(CMultiTransferTest&) const
       
   102 		{return KErrUnknown;}
       
   103 	};
       
   104 
       
   105 class TAlwaysPass : public MPostTransferCheck
       
   106 	{
       
   107 public:
       
   108 	virtual TInt Check(const CSingleTransferTest& /*aTest*/) const
       
   109 		{return KErrNone;}
       
   110 	virtual TInt Check(const CIsrRequeTest&) const
       
   111 		{return KErrNone;}
       
   112 	virtual TInt Check(CMultiTransferTest&) const
       
   113 		{return KErrNone;}
       
   114 	};
       
   115 
       
   116 /**
       
   117 Compare that all the various source buffers of a test match
       
   118 its destination buffers
       
   119 */
       
   120 class TCompareSrcDst : public MPostTransferCheck
       
   121 	{
       
   122 public:
       
   123 	TCompareSrcDst()
       
   124 		{}
       
   125 
       
   126 	virtual TInt Check(const CSingleTransferTest& aTest) const;
       
   127 	virtual TInt Check(const CIsrRequeTest& aTest) const;
       
   128 	virtual TInt Check(CMultiTransferTest& aTest) const;
       
   129 
       
   130 protected:
       
   131 	TInt Check(const TIsrRequeArgsSet& aRequeueArgSet, TUint8* aChunkBase, const TDmaTransferArgs& aTferArgs) const;
       
   132 	TInt Check(const TIsrRequeArgs& aRequeueArgs) const;
       
   133 	TInt Check(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const;
       
   134 	};
       
   135 
       
   136 /**
       
   137 Base class for all DMA tests
       
   138 */
       
   139 class CDmaTest : public CTest
       
   140 	{
       
   141 public:
       
   142 	CDmaTest(const TDesC& aName, TInt aIterations, const MPreTransfer* aPreTransfer, const MPostTransferCheck* aPostTransfer)
       
   143 		: CTest(aName, aIterations), iPreTransfer(aPreTransfer), iPostTransferCheck(aPostTransfer)
       
   144 		{}
       
   145 
       
   146 	void OpenDmaSession();
       
   147 	void CloseDmaSession();
       
   148 
       
   149 	virtual void PrintTestInfo() const;
       
   150 	virtual TBool Result() = 0;
       
   151 
       
   152 	const RChunk& Chunk() const
       
   153 		{return iChunk;}
       
   154 
       
   155 	/**
       
   156 	Tells the test which DMA channel it should run on
       
   157 	*/
       
   158 	void SetChannelCookie(TUint32 aCookie)
       
   159 		{iChannelCookie = aCookie;}
       
   160 
       
   161 	virtual void PreTransferSetup() =0;
       
   162 	virtual TInt DoPostTransferCheck() =0;
       
   163 protected:
       
   164 	RDmaSession iDmaSession;
       
   165 	RChunk iChunk;
       
   166 
       
   167 	/**
       
   168 	Identifies the channel to open (as understood by a DMA PSL)
       
   169 	*/
       
   170 	TUint iChannelCookie;
       
   171 	const MPreTransfer* iPreTransfer;
       
   172 
       
   173 	const MPostTransferCheck* iPostTransferCheck; //!< Some check to be run after the transfer
       
   174 	};
       
   175 
       
   176 /**
       
   177 Holds return codes for the various functions which must be called
       
   178 to create, fragment, and queue a DMA request
       
   179 */
       
   180 struct TRequestResults
       
   181 	{
       
   182 	TRequestResults
       
   183 		(
       
   184 		TInt aCreate = KErrNone,
       
   185 		TInt aFragmentCount = 0,
       
   186 		TInt aFragmentationResult = KErrNone,
       
   187 		TInt aQueueResult = KErrNone
       
   188 		)
       
   189 		:iCreate(aCreate), iFragmentCount(aFragmentCount), iFragmentationResult(aFragmentationResult), iQueueResult(aQueueResult)
       
   190 		{}
       
   191 
       
   192 	/**
       
   193 	Constructs with error results
       
   194 	*/
       
   195 	TRequestResults(TFalse)
       
   196 		:iCreate(KErrUnknown), iFragmentCount(0), iFragmentationResult(KErrUnknown), iQueueResult(KErrUnknown)
       
   197 		{}
       
   198 
       
   199 	inline TRequestResults& CreationResult(TInt aErrorCode) {iCreate = aErrorCode; return *this;}
       
   200 	inline TRequestResults& FragmentCount(TInt aCount) {iFragmentCount = aCount; return *this;}
       
   201 	inline TRequestResults& FragmentationResult(TInt aErrorCode) {iFragmentationResult = aErrorCode; return *this;}
       
   202 	inline TRequestResults& QueueResult(TInt aErrorCode) {iQueueResult = aErrorCode; return *this;}
       
   203 
       
   204 	TInt iCreate;
       
   205 	TInt iFragmentCount; //!< 0 means any result permitted
       
   206 	TInt iFragmentationResult;
       
   207 	TInt iQueueResult;
       
   208 	};
       
   209 
       
   210 /**
       
   211 Holds all the results for a DMA CSingleTransferTest
       
   212 */
       
   213 struct TResultSet
       
   214 	{
       
   215 	/**
       
   216 	No errors expected
       
   217 	*/
       
   218 	TResultSet(TInt aChannelOpenResult = KErrNone,
       
   219 			const TRequestResults aRequestResults = TRequestResults(),
       
   220 			TInt aPostTransferCheck = KErrNone,
       
   221 			const TCallbackRecord aCallbackRecord = TCallbackRecord(TCallbackRecord::EThread,1)
       
   222 			)
       
   223 		:
       
   224 		iChannelOpenResult(aChannelOpenResult),
       
   225 		iRequestResult(aRequestResults),
       
   226 		iPostTransferCheck(aPostTransferCheck),
       
   227 		iCallbackRecord(aCallbackRecord)
       
   228 		{}
       
   229 	
       
   230 	explicit TResultSet(const TCallbackRecord& aRecord)
       
   231 		:iChannelOpenResult(KErrNone),
       
   232 		 iRequestResult(),
       
   233 		 iPostTransferCheck(KErrNone),
       
   234 		 iCallbackRecord(aRecord)
       
   235 		{}
       
   236 
       
   237 	/**
       
   238 	Errors expected
       
   239 	*/
       
   240 	TResultSet(TFalse)
       
   241 		:iChannelOpenResult(KErrUnknown), 
       
   242 		iRequestResult(EFalse),
       
   243 		iPostTransferCheck(KErrUnknown),
       
   244 		iCallbackRecord(TCallbackRecord::Empty())
       
   245 		{}		
       
   246 	
       
   247 	void Print() const;
       
   248 	TBool operator == (const TResultSet& aOther) const;
       
   249 
       
   250 	/** Set channel opening result */
       
   251 	TResultSet& ChannelOpenResult(TInt aResult) {iChannelOpenResult = aResult; return *this;}
       
   252 	TResultSet& PostTransferResult(TInt aResult) {iPostTransferCheck = aResult; return *this;}
       
   253 	/** Set request results */
       
   254 	TResultSet& RequestResult(const TRequestResults& aResults) {iRequestResult = aResults; return *this;}
       
   255 	/** Set Callback record */
       
   256 	TResultSet& CallbackRecord(const TCallbackRecord& aCallbackRecord) {iCallbackRecord = aCallbackRecord; return *this;}
       
   257 
       
   258 	TInt iChannelOpenResult;
       
   259 	TRequestResults iRequestResult;
       
   260 	TInt iPostTransferCheck;
       
   261 	TCallbackRecord iCallbackRecord;
       
   262 	};
       
   263 
       
   264 /**
       
   265 Fills each source buffer with an increasing value and clears each destination
       
   266 */
       
   267 class TPreTransferIncrBytes : public MPreTransfer
       
   268 	{
       
   269 public:
       
   270 	TPreTransferIncrBytes()
       
   271 		{}
       
   272 
       
   273 	virtual void Setup(const CSingleTransferTest& aTest) const;
       
   274 	virtual void Setup(const CIsrRequeTest& aTest) const;
       
   275 	virtual void Setup(const CMultiTransferTest& aTest) const;
       
   276 protected:
       
   277 	virtual void Setup(const TAddressParms& aParams) const;
       
   278 	TBool CheckBuffers(const CIsrRequeTest& aTest) const;
       
   279 	TBool CheckBuffers(const RArray<const TAddressParms> aTransferParams) const;
       
   280 	};
       
   281 
       
   282 const TPreTransferIncrBytes KPreTransferIncrBytes;
       
   283 const TCompareSrcDst KCompareSrcDst;
       
   284 const TCompare2D KCompare2D;
       
   285 
       
   286 
       
   287 /**
       
   288 Iterates over the bytes in buffer, in the order
       
   289 the supllied DMA config would access them
       
   290 */
       
   291 class TTransferIter
       
   292 	{
       
   293 public:
       
   294 	TTransferIter()
       
   295 		:iCfg(NULL), iPtr(NULL)
       
   296 		{}
       
   297 
       
   298 	TTransferIter(const TDmaTransferConfig& aCfg, TUint8* aChunkBase=NULL)
       
   299 		:iElem(0), iFrame(0), iCfg(&aCfg), iChunkBase(aChunkBase), iPtr(Start()), iBytes(0)
       
   300 		{}
       
   301 
       
   302 	void operator++ ();
       
   303 	TUint8& operator* ()
       
   304 		{
       
   305 		Invariant();
       
   306 		return *iPtr;
       
   307 		}
       
   308 
       
   309 	TBool operator!= (const TTransferIter& aOther)
       
   310 		{
       
   311 		return (iPtr != aOther.iPtr);
       
   312 		}
       
   313 
       
   314 	static void SelfTest();
       
   315 private:
       
   316 	TUint8* Start() const
       
   317 		{
       
   318 		return iChunkBase + iCfg->iAddr;
       
   319 		}
       
   320 
       
   321 	void Invariant() const;
       
   322 
       
   323 	TUint iElem; //!< The current element
       
   324 	TUint iFrame; //!< The current frame
       
   325 
       
   326 	const TDmaTransferConfig* const iCfg;
       
   327 	TUint8* iChunkBase;
       
   328 
       
   329 	TUint8* iPtr; //<! Pointer to the current byte
       
   330 
       
   331 	TInt iBytes; //!< The number of bytes traversed
       
   332 	};
       
   333 
       
   334 /**
       
   335 Performs a single DMA transfer using the member TDmaTransferArgs on
       
   336 one channel. At each stage of the transfer results are recorded in a
       
   337 TResultSet struct: at the end these are compared with a set of expected
       
   338 results.
       
   339 */
       
   340 class CSingleTransferTest : public CDmaTest
       
   341 	{
       
   342 public:
       
   343 	CSingleTransferTest(
       
   344 			const TDesC& aName, TInt aIterations,
       
   345 			const TDmaTransferArgs& aArgs,
       
   346 			const TResultSet& aExpected,
       
   347 			TUint aMaxFragmentSize = 0,
       
   348 			const MPostTransferCheck* aPostTferChk = &KCompareSrcDst,
       
   349 			const MPreTransfer* aPreTfer = &KPreTransferIncrBytes
       
   350 			)
       
   351 		: CDmaTest(aName, aIterations, aPreTfer, aPostTferChk),
       
   352 		iTransferArgs(aArgs),iExpected(aExpected),iActual(EFalse),
       
   353 		iUseNewRequest(ETrue),
       
   354 		iUseNewFragment(ETrue),
       
   355 		iMaxFragmentSize(aMaxFragmentSize)
       
   356 		{}
       
   357 
       
   358 	/**
       
   359 	Perform each stage of trasnfer
       
   360 	*/
       
   361 	virtual void RunTest();
       
   362 	virtual void PrintTestType() const;
       
   363 
       
   364 	virtual CTest* Clone() const {return new CSingleTransferTest(*this);}
       
   365 
       
   366 	/**
       
   367 	Compares the actual vs the exepected results and reports
       
   368 	of the test passed
       
   369 	@return ETrue for a pass, EFalse for a fail
       
   370 	 */
       
   371 	virtual TBool Result();
       
   372 
       
   373 	/**
       
   374 	An accessor function for the object's TDmaTransferArgs
       
   375 	*/
       
   376 	const TDmaTransferArgs& TransferArgs() const
       
   377 		{return iTransferArgs;}
       
   378 
       
   379 	// The below methods are setters, which may be chained together
       
   380 	// ie. The Named Parameter Idiom
       
   381 	// @see http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18
       
   382 	inline CSingleTransferTest& UseNewRequest(TBool aFlag) {iUseNewRequest=aFlag; return *this;}
       
   383 	inline CSingleTransferTest& UseNewFragment(TBool aFlag) {iUseNewFragment=aFlag; return *this;}
       
   384 	inline CSingleTransferTest& UseNewDmaApi(TBool aFlag) {UseNewRequest(aFlag); UseNewFragment(aFlag); return *this;}
       
   385 
       
   386 protected:
       
   387 	virtual void OpenChannel();
       
   388 	virtual void PreTransferSetup();
       
   389 	virtual void CreateDmaRequest();
       
   390 	virtual void Fragment();
       
   391 	virtual void Queue();
       
   392 	virtual void PostTransferCheck();
       
   393 	virtual TInt DoPostTransferCheck();
       
   394 	virtual void FreeRequest();
       
   395 	virtual void CloseChannel();
       
   396 
       
   397 protected:
       
   398 	/**
       
   399 	A handle to kernel side TDmaChannel object received after a channel is opened.
       
   400 	*/
       
   401 	TUint iChannelSessionCookie;
       
   402 	/**
       
   403 	A handle to kernel side DDmaRequest object.
       
   404 	*/
       
   405 	TUint iRequestSessionCookie;
       
   406 
       
   407 	const TDmaTransferArgs& iTransferArgs;
       
   408 
       
   409 	/**
       
   410 	Expected transfer results
       
   411 	*/
       
   412 	TResultSet iExpected;
       
   413 
       
   414 	/**
       
   415 	Filled with actual transfer results
       
   416 	*/
       
   417 	TResultSet iActual;
       
   418 
       
   419 	TBool iUseNewRequest; //!< If true then CSingleTransferTest will create a DDmaRequest with the v2 ctor
       
   420 	TBool iUseNewFragment; //!< If true then CSingleTransferTest will use v2 Fragment API
       
   421 	const TUint iMaxFragmentSize;
       
   422 	};
       
   423 
       
   424 /**
       
   425 This class will be used for tests which benchmark certain DMA operations
       
   426 */
       
   427 class CDmaBenchmark : public CSingleTransferTest
       
   428 	{
       
   429 public:
       
   430 	CDmaBenchmark(const TDesC& aName, TInt aIterations, const TResultSet& aExpectedResults, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
       
   431 	~CDmaBenchmark();
       
   432 
       
   433 	virtual TBool Result();
       
   434 
       
   435 	static void SelfTest();
       
   436 
       
   437 protected:
       
   438 	/**
       
   439 	@return The mean average of the result array
       
   440 	*/
       
   441 	TUint64 MeanResult();
       
   442 
       
   443 	//TODO must be included within copy ctor or all instances will
       
   444 	//share on result set!
       
   445 	RArray<TUint64> iResultArray;
       
   446 
       
   447 	};
       
   448 
       
   449 /**
       
   450 Fragments requests (only) and records duration
       
   451 TODO make sure we are using old style DDmaRequest
       
   452 */
       
   453 class CDmaBmFragmentation : public CDmaBenchmark
       
   454 	{
       
   455 public:
       
   456 	CDmaBmFragmentation(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
       
   457 	virtual CTest* Clone() const {return new CDmaBmFragmentation(*this);}
       
   458 	virtual TInt DoPostTransferCheck()
       
   459 		{TEST_FAULT; return KErrNotSupported;}
       
   460 
       
   461 	virtual void RunTest();
       
   462 	virtual void PrintTestType() const;
       
   463 
       
   464 protected:
       
   465 	void Fragment();
       
   466 	static const TResultSet ExpectedResults;
       
   467 	};
       
   468 
       
   469 /**
       
   470 Performs a transfer using an old style DDmaRequest and
       
   471 records the duration
       
   472 */
       
   473 class CDmaBmTransfer : public CDmaBenchmark
       
   474 	{
       
   475 public:
       
   476 	CDmaBmTransfer(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
       
   477 	virtual CTest* Clone() const {return new CDmaBmTransfer(*this);}
       
   478 	virtual TInt DoPostTransferCheck()
       
   479 		{TEST_FAULT; return KErrNotSupported;}
       
   480 
       
   481 	virtual void RunTest();
       
   482 	virtual void PrintTestType() const;
       
   483 
       
   484 	inline CDmaBmTransfer& UseNewDmaApi(TBool aFlag) {CSingleTransferTest::UseNewDmaApi(aFlag); return *this;}
       
   485 	inline CDmaBmTransfer& ExpectedResults(const TResultSet& aArgs) {iExpected=aArgs; return *this;}
       
   486 protected:
       
   487 	void Queue();
       
   488 	};
       
   489 
       
   490 
       
   491 
       
   492 /**
       
   493 Will create and queue multiple requests
       
   494 
       
   495 Unlike CSingleTransferTest the class does not permit the use of TResultSet to
       
   496 define expected results (for neagative testing)
       
   497 */
       
   498 class CMultiTransferTest : public CDmaTest
       
   499 	{
       
   500 public:
       
   501 	CMultiTransferTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs* aTransferArgs, const TResultSet* aResultSets, TInt aCount);
       
   502 	CMultiTransferTest(const CMultiTransferTest& aOther);
       
   503 	virtual ~CMultiTransferTest();
       
   504 	virtual CTest* Clone() const {return new CMultiTransferTest(*this);}
       
   505 
       
   506 	virtual TBool Result();
       
   507 	virtual void RunTest();
       
   508 	virtual void PrintTestType() const;
       
   509 
       
   510 	inline CMultiTransferTest& PauseWhileQueuing() {iPauseWhileQueuing = ETrue; return *this;}
       
   511 	inline CMultiTransferTest& SetPreTransferTest(const MPreTransfer* aPreTfer) {iPreTransfer = aPreTfer; return *this;}
       
   512 	inline CMultiTransferTest& SetPostTransferTest(const MPostTransferCheck* aPostTfer) {iPostTransferCheck = aPostTfer; return *this;}
       
   513 
       
   514 	const TDmaTransferArgs& TransferArgs(TInt aIndex) const;
       
   515 	inline TInt TransferCount() const {return iTransferArgsCount;}
       
   516 
       
   517 	void SetPostTransferResult(TInt aIndex, TInt aErrorCode);
       
   518 protected:
       
   519 	void OpenChannel();
       
   520 	TInt CloseChannel();
       
   521 	void CreateDmaRequests();
       
   522 	void Fragment();
       
   523 	void QueueRequests();
       
   524 
       
   525 	virtual void PreTransferSetup();
       
   526 	virtual TInt DoPostTransferCheck();
       
   527 
       
   528 	TBool Result(TInt aTransfer);
       
   529 
       
   530 	const TDmaTransferArgs* const iTransferArgs; //pointer to an array of transfer args
       
   531 	const TInt iTransferArgsCount;
       
   532 
       
   533 
       
   534 	TBool iNewDmaApi; //!< If true then CMultiTransferTest will use new style API
       
   535 
       
   536 	/**
       
   537 	A handle to kernel side TDmaChannel object received after a channel is opened.
       
   538 	*/
       
   539 	TUint iChannelSessionCookie;
       
   540 	RArray<TUint> iRequestCookies;
       
   541 
       
   542 	const TResultSet* const iExpectedArray; // array will be of length iTransferArgsCount
       
   543 	RArray<TResultSet> iActualResults;
       
   544 
       
   545 	/**
       
   546 	If set, the test will pause the channel before queuing requests, and
       
   547 	resume once they are all queued
       
   548 	*/
       
   549 	TBool iPauseWhileQueuing;
       
   550 	};
       
   551 
       
   552 /**
       
   553 Used for testing TDmaChannel::IsrRedoRequest
       
   554 
       
   555 Extends CSingle transfer by adding the capability to queue with
       
   556 additonal transfer parameters (TIsrRequeArgs) which are passed
       
   557 to IsrRedoRequest in ISR callback
       
   558 */
       
   559 class CIsrRequeTest : public CSingleTransferTest
       
   560 	{
       
   561 public:
       
   562 	CIsrRequeTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aArgs,
       
   563 			TIsrRequeArgs* aRequeueArgs, TInt aCount,
       
   564 			const TResultSet& aExpected, const MPreTransfer* aPreTfer,
       
   565 			const MPostTransferCheck* aPostTferChk, TUint aMaxFragmentSize=0);
       
   566 
       
   567 	virtual void PrintTestType() const;
       
   568 
       
   569 	virtual void Queue();
       
   570 
       
   571 	/**
       
   572 	Compares the actual vs the exepected results and reports
       
   573 	of the test passed
       
   574 	@return ETrue for a pass, EFalse for a fail
       
   575 	 */
       
   576 	//virtual TBool Result();
       
   577 
       
   578 
       
   579 	virtual CTest* Clone() const {return new CIsrRequeTest(*this);}
       
   580 
       
   581 	const TIsrRequeArgsSet& GetRequeueArgs() const
       
   582 		{return iRequeArgSet;}
       
   583 
       
   584 
       
   585 protected:
       
   586 	virtual TInt DoPostTransferCheck();
       
   587 	virtual void PreTransferSetup();
       
   588 
       
   589 	TIsrRequeArgsSet iRequeArgSet;
       
   590 	};
       
   591 
       
   592 /**
       
   593 A channel record collects DMA channel capabilities and other PSL information
       
   594 before running tests.
       
   595 */
       
   596 class TChannelRecord
       
   597 	{
       
   598 public:
       
   599 	TChannelRecord(){}
       
   600 	~TChannelRecord(){}
       
   601 
       
   602 	/**
       
   603 	DMA Channel Cookie
       
   604 	*/
       
   605 	TUint   iCookie;
       
   606 
       
   607 	/**
       
   608 	DMA Channel Capabilities
       
   609 	*/
       
   610 	TDmacTestCaps iChannelCaps;
       
   611 	};
       
   612 
       
   613 /**
       
   614 A test case collects together a DMA test (CDmaTest), its hardware prerequisites,
       
   615 and other information about how the test should be run.
       
   616 */
       
   617 class TTestCase
       
   618 	{
       
   619 public:
       
   620 	//TODO it might be better to group sets of TDmaCapability
       
   621 	//into their own class eg. TDmaCapSet.
       
   622 	TTestCase(CDmaTest* aTest,
       
   623            TBool aConcurrent = EFalse,
       
   624 		   const TDmaCapability = TDmaCapability(),
       
   625 		   const TDmaCapability = TDmaCapability(),
       
   626 		   const TDmaCapability = TDmaCapability(),
       
   627 		   const TDmaCapability = TDmaCapability(),
       
   628 		   const TDmaCapability = TDmaCapability()
       
   629 		   );
       
   630 
       
   631 	static void SelfTest();
       
   632 
       
   633 	/**
       
   634 	Compares the requirements held in the class
       
   635 	against those described in aChannelCaps and makes a decision
       
   636 	as to whether this test case should be run, skipped, or failed.
       
   637 	*/
       
   638 	TResult TestCaseValid(const SDmacCaps& aChannelCaps) const;
       
   639 	TResult TestCaseValid(const TDmacTestCaps& aChannelCaps) const;
       
   640 
       
   641 	enum {KMaxChannelCaps=5};
       
   642 	TDmaCapability	iChannelCaps[KMaxChannelCaps];
       
   643 	TUint iChannelType;
       
   644 	TInt iTimeout;
       
   645 	CDmaTest* iTest;
       
   646 	TBool iConcurrentTest;
       
   647 	TBool iDmaV2Only; //!< If true then this test cannot be run on DMA v1 framework
       
   648 	};
       
   649 
       
   650 /**
       
   651 A TestRunner manages the whole testing process.Before running any test cases it will open its own RDmaSession 
       
   652 handle, not associated with a DMA channel, so that it can recover the TDmaTestInfo object (as used by the 
       
   653 existing DMA framework) which says what channels are available to be tested.It will use TTestThread objects 
       
   654 to run tests in new threads.TTestThread contains a number of useful features such as waiting for thread exit 
       
   655 and accepting a TFunctor object to be run in a new thread. 
       
   656 */
       
   657 class TTestRunner
       
   658 {
       
   659 public:
       
   660 	TTestRunner();
       
   661 	~TTestRunner();
       
   662 
       
   663 	/**
       
   664 	This function will populate TTestRunner with an array of test cases which 
       
   665 	would be a collection of DMA test,its hardware prerequisites,and other 
       
   666 	information about how the test	
       
   667 
       
   668 	@aTTestCases on return, this contains an the DMA test cases 
       
   669 	*/
       
   670 	void AddTestCases(RPointerArray<TTestCase>& aTTestCases);
       
   671 
       
   672 	/**
       
   673 	This will iterate over all test cases held by the test runner and
       
   674 	for each one will judge which DMA channels it can be run on, running
       
   675 	the test if possible.
       
   676 	*/
       
   677 	void RunTests();
       
   678 
       
   679 private:
       
   680 	/**
       
   681 	This functions retrieves the PSL cookies from all the DMA channels
       
   682 	and stores them in a single array.	It will use information from 
       
   683 	the PslTestInfo.
       
   684 	*/
       
   685 	void GetPslCookie();
       
   686 
       
   687 	/**
       
   688 	This function will generate the DMA channel records.i.e channel cookies,Caps.
       
   689 	*/
       
   690 	void GenerateChannelRecord();
       
   691 
       
   692 	/**
       
   693 	Holds the PslTestInfo
       
   694 	*/	
       
   695 	TDmaV2TestInfo iPslTestInfo;
       
   696 
       
   697 	/**
       
   698 	A handle to RDmaSession
       
   699 	*/
       
   700 	RDmaSession iDmaSession;
       
   701 	
       
   702 	/**
       
   703 	Array of DMA test cases 
       
   704 	*/
       
   705 	RPointerArray<TTestCase> iTestCases; 
       
   706 	
       
   707 	/**
       
   708 	Array of DMA channel records,channel capabilities and other PSL information
       
   709 	*/
       
   710 	RArray<TChannelRecord> iChannelRecords; 	
       
   711 
       
   712 	/**
       
   713 	Array of DMA channel cookies
       
   714 	*/
       
   715 	RArray<TUint> iPslCookies;
       
   716 };
       
   717 
       
   718 
       
   719 #endif // #ifndef __T_DMA2_H__