kerneltest/e32test/dmav2/t_dma2.h
changeset 130 c30940f6d922
parent 36 538db54a451d
child 199 189ece41fa29
child 247 d8d70de2bd36
equal deleted inserted replaced
129:a990138eda40 130:c30940f6d922
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    20 #include "cap_reqs.h"
    20 #include "cap_reqs.h"
    21 #include "test_thread.h"
    21 #include "test_thread.h"
    22 #include "d_dma2.h"
    22 #include "d_dma2.h"
    23 #include <e32std.h>
    23 #include <e32std.h>
    24 
    24 
    25 
       
    26 class TTestCase;
    25 class TTestCase;
    27 // Global array of test cases
    26 // Global array of test cases
    28 extern RPointerArray<TTestCase> TestArray;
    27 extern RPointerArray<TTestCase> TestArray;
    29 
    28 extern RPointerArray<TTestCase> TestArrayCallback;
       
    29 extern RPointerArray<TTestCase> TestArrayIsrReque;
       
    30 extern RPointerArray<TTestCase> TestArrayMultiPart;
       
    31 extern RPointerArray<TTestCase> TestArrayIsrAndDfc;
       
    32 extern RPointerArray<TTestCase> TestArrayBenchmark;
       
    33 extern RPointerArray<TTestCase> TestArray2DTest;
       
    34 extern RPointerArray<TTestCase> TestArrayIsrAndDfc;
       
    35 extern RPointerArray<TTestCase> TestArrayChannel;
       
    36 extern RPointerArray<TTestCase> TestArraySuspend;
       
    37 extern RPointerArray<TTestCase> TestArrayQueue;
       
    38 extern RPointerArray<TTestCase>	TestArraySimple;
       
    39 extern RPointerArray<TTestCase>	TestArrayRequest;
       
    40 extern RPointerArray<TTestCase>	TestArrayFragment;
    30 
    41 
    31 extern TBool gVerboseOutput;   // Verbose output control
    42 extern TBool gVerboseOutput;   // Verbose output control
    32 
    43 
    33 
       
    34 const TInt KParameterTextLenMax = 80;	// command-line param length
    44 const TInt KParameterTextLenMax = 80;	// command-line param length
    35 
    45 
    36 /**
    46 /**
    37 This function prints out the PSL test Information
    47 This function prints out the PSL test Information
    38 */
    48 */
    40 
    50 
    41 /**
    51 /**
    42 Runs all framework self tests
    52 Runs all framework self tests
    43 */
    53 */
    44 void SelfTests();
    54 void SelfTests();
    45 
       
    46 void ApiTests();
       
    47 
    55 
    48 class CSingleTransferTest;
    56 class CSingleTransferTest;
    49 class CIsrRequeTest;
    57 class CIsrRequeTest;
    50 class CMultiTransferTest;
    58 class CMultiTransferTest;
    51 
    59 
    52 
       
    53 /**
    60 /**
    54 An interface to a classs that sets up the buffers before a test
    61 An interface to a classs that sets up the buffers before a test
    55 */
    62 */
    56 //TODO both pre and post transfer checks should perhaps derive from an
       
    57 //abstract visitor base
       
    58 class MPreTransfer
    63 class MPreTransfer
    59 	{
    64 	{
    60 public:
    65 public:
    61 	virtual ~MPreTransfer()
    66 	virtual ~MPreTransfer()
    62 		{}
    67 		{}
   132 	TInt Check(const TIsrRequeArgs& aRequeueArgs) const;
   137 	TInt Check(const TIsrRequeArgs& aRequeueArgs) const;
   133 	TInt Check(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const;
   138 	TInt Check(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const;
   134 	};
   139 	};
   135 
   140 
   136 /**
   141 /**
       
   142 Check whether destination buffers are zero filled
       
   143 
       
   144 Used to check that a transfer hasn't taken place.
       
   145 */
       
   146 class TCheckNoTransfer : public MPostTransferCheck
       
   147 	{
       
   148 public:
       
   149 	TCheckNoTransfer()
       
   150 		{}
       
   151 
       
   152 	virtual TInt Check(const CSingleTransferTest& aTest) const;
       
   153 	virtual TInt Check(const CIsrRequeTest& aTest) const;
       
   154 	virtual TInt Check(CMultiTransferTest& aTest) const;
       
   155 
       
   156 protected:
       
   157 	TBool IsZeroed(const TDmaTransferArgs& aTransferArgs, TUint8* aChunkBase) const;
       
   158 	};
       
   159 
       
   160 /**
   137 Base class for all DMA tests
   161 Base class for all DMA tests
   138 */
   162 */
   139 class CDmaTest : public CTest
   163 class CDmaTest : public CTest
   140 	{
   164 	{
   141 public:
   165 public:
   142 	CDmaTest(const TDesC& aName, TInt aIterations, const MPreTransfer* aPreTransfer, const MPostTransferCheck* aPostTransfer)
   166 	CDmaTest(const TDesC& aName, TInt aIterations, const MPreTransfer* aPreTransfer, const MPostTransferCheck* aPostTransfer)
   143 		: CTest(aName, aIterations), iPreTransfer(aPreTransfer), iPostTransferCheck(aPostTransfer)
   167 		: CTest(aName, aIterations), iPreTransfer(aPreTransfer), iPostTransferCheck(aPostTransfer)
   144 		{}
   168 		{}
   145 
   169 
   146 	void OpenDmaSession();
   170 	void OpenDmaSession();
       
   171 	/* Duplicate aSession */
       
   172 	void OpenDmaSession(const RDmaSession& aSession);
   147 	void CloseDmaSession();
   173 	void CloseDmaSession();
   148 
   174 	void ChannelPause(const TUint aChannelSessionCookie);
       
   175 	void ChannelResume(const TUint aChannelSessionCookie);
   149 	virtual void PrintTestInfo() const;
   176 	virtual void PrintTestInfo() const;
   150 	virtual TBool Result() = 0;
   177 	virtual TBool Result() = 0;
   151 
   178 
   152 	const RChunk& Chunk() const
   179 	const RChunk& Chunk() const
   153 		{return iChunk;}
   180 		{return iChunk;}
   156 	Tells the test which DMA channel it should run on
   183 	Tells the test which DMA channel it should run on
   157 	*/
   184 	*/
   158 	void SetChannelCookie(TUint32 aCookie)
   185 	void SetChannelCookie(TUint32 aCookie)
   159 		{iChannelCookie = aCookie;}
   186 		{iChannelCookie = aCookie;}
   160 
   187 
   161 	virtual void PreTransferSetup() =0;
   188 	virtual void PreTransferSetup();
   162 	virtual TInt DoPostTransferCheck() =0;
   189 	virtual TInt DoPostTransferCheck();
   163 protected:
   190 protected:
   164 	RDmaSession iDmaSession;
   191 	RDmaSession iDmaSession;
   165 	RChunk iChunk;
   192 	RChunk iChunk;
   166 
   193 
   167 	/**
   194 	/**
   169 	*/
   196 	*/
   170 	TUint iChannelCookie;
   197 	TUint iChannelCookie;
   171 	const MPreTransfer* iPreTransfer;
   198 	const MPreTransfer* iPreTransfer;
   172 
   199 
   173 	const MPostTransferCheck* iPostTransferCheck; //!< Some check to be run after the transfer
   200 	const MPostTransferCheck* iPostTransferCheck; //!< Some check to be run after the transfer
       
   201 	};
       
   202 
       
   203 /**
       
   204 The Decorator Pattern is used allowing test classes to be optionally extended
       
   205 using wrapper/decorator classes.
       
   206 This is the base class for test decorators
       
   207 */
       
   208 class CDmaTestDecorator : public CDmaTest
       
   209 	{
       
   210 public:
       
   211 
       
   212 protected:
       
   213 	CDmaTestDecorator(CDmaTest* aDecoratedTest);
       
   214 	CDmaTestDecorator(const CDmaTestDecorator& aOther);
       
   215 
       
   216 	CDmaTest* iDecoratedTest;
       
   217 	};
       
   218 
       
   219 /**
       
   220 Will run the wrapped test against both versions of the DMA
       
   221 API if available, otherwise just the old version.
       
   222 */
       
   223 class CMultiVersionTest : public CDmaTestDecorator
       
   224 	{
       
   225 public:
       
   226 	CMultiVersionTest(CSingleTransferTest* aDmaTest); 
       
   227 	CMultiVersionTest(const CMultiVersionTest& aOther);
       
   228 	~CMultiVersionTest();
       
   229 
       
   230 	virtual void Announce() const;
       
   231 	virtual void PrintTestType() const;
       
   232 	virtual void PrintTestInfo() const; 
       
   233 
       
   234 	virtual CTest* Clone() const {return new CMultiVersionTest(*this);}
       
   235 	virtual void SetupL();
       
   236 
       
   237 	virtual void RunTest();
       
   238 	virtual TBool Result();
       
   239 
       
   240 protected:
       
   241 	void Configure();
       
   242 	TBool Version2PILAvailable();
       
   243 	CSingleTransferTest* iNewVersionTest;
   174 	};
   244 	};
   175 
   245 
   176 /**
   246 /**
   177 Holds return codes for the various functions which must be called
   247 Holds return codes for the various functions which must be called
   178 to create, fragment, and queue a DMA request
   248 to create, fragment, and queue a DMA request
   184 		TInt aCreate = KErrNone,
   254 		TInt aCreate = KErrNone,
   185 		TInt aFragmentCount = 0,
   255 		TInt aFragmentCount = 0,
   186 		TInt aFragmentationResult = KErrNone,
   256 		TInt aFragmentationResult = KErrNone,
   187 		TInt aQueueResult = KErrNone
   257 		TInt aQueueResult = KErrNone
   188 		)
   258 		)
   189 		:iCreate(aCreate), iFragmentCount(aFragmentCount), iFragmentationResult(aFragmentationResult), iQueueResult(aQueueResult)
   259 		:iCreate(aCreate), 
       
   260 		 iFragmentCount(aFragmentCount), 
       
   261 		 iFragmentationResult(aFragmentationResult), 
       
   262 		 iQueueResult(aQueueResult)
   190 		{}
   263 		{}
   191 
   264 
   192 	/**
   265 	/**
   193 	Constructs with error results
   266 	Constructs with error results
   194 	*/
   267 	*/
   195 	TRequestResults(TFalse)
   268 	TRequestResults(TFalse)
   196 		:iCreate(KErrUnknown), iFragmentCount(0), iFragmentationResult(KErrUnknown), iQueueResult(KErrUnknown)
   269 		:iCreate(KErrUnknown), 
       
   270 		 iFragmentCount(0), 
       
   271 		 iFragmentationResult(KErrUnknown), 
       
   272 		 iQueueResult(KErrUnknown)
   197 		{}
   273 		{}
   198 
   274 
   199 	inline TRequestResults& CreationResult(TInt aErrorCode) {iCreate = aErrorCode; return *this;}
   275 	inline TRequestResults& CreationResult(TInt aErrorCode) {iCreate = aErrorCode; return *this;}
   200 	inline TRequestResults& FragmentCount(TInt aCount) {iFragmentCount = aCount; return *this;}
   276 	inline TRequestResults& FragmentCount(TInt aCount) {iFragmentCount = aCount; return *this;}
   201 	inline TRequestResults& FragmentationResult(TInt aErrorCode) {iFragmentationResult = aErrorCode; return *this;}
   277 	inline TRequestResults& FragmentationResult(TInt aErrorCode) {iFragmentationResult = aErrorCode; return *this;}
   271 		{}
   347 		{}
   272 
   348 
   273 	virtual void Setup(const CSingleTransferTest& aTest) const;
   349 	virtual void Setup(const CSingleTransferTest& aTest) const;
   274 	virtual void Setup(const CIsrRequeTest& aTest) const;
   350 	virtual void Setup(const CIsrRequeTest& aTest) const;
   275 	virtual void Setup(const CMultiTransferTest& aTest) const;
   351 	virtual void Setup(const CMultiTransferTest& aTest) const;
       
   352 
       
   353 	static void SelfTest();
   276 protected:
   354 protected:
   277 	virtual void Setup(const TAddressParms& aParams) const;
   355 	virtual void Setup(const TAddressParms& aParams) const;
       
   356 
   278 	TBool CheckBuffers(const CIsrRequeTest& aTest) const;
   357 	TBool CheckBuffers(const CIsrRequeTest& aTest) const;
   279 	TBool CheckBuffers(const RArray<const TAddressParms> aTransferParams) const;
   358 	TBool CheckBuffers(const CMultiTransferTest& aTest) const;
       
   359 
       
   360 	TBool CheckBuffers(const RArray<const TAddressParms>& aTransferParams, TBool aAllowExactRepeat=ETrue) const;
       
   361 
       
   362 	// This function is part of the unit test
       
   363 	friend TBool DoTferParmTestL(const TAddressParms* aParms, TInt aCount, TBool aAllowRepeat, TBool aPositive);
   280 	};
   364 	};
   281 
   365 
   282 const TPreTransferIncrBytes KPreTransferIncrBytes;
   366 const TPreTransferIncrBytes KPreTransferIncrBytes;
   283 const TCompareSrcDst KCompareSrcDst;
   367 const TCompareSrcDst KCompareSrcDst;
   284 const TCompare2D KCompare2D;
   368 const TCompare2D KCompare2D;
       
   369 const TCheckNoTransfer KCheckNoTransfer;
   285 
   370 
   286 
   371 
   287 /**
   372 /**
   288 Iterates over the bytes in buffer, in the order
   373 Iterates over the bytes in buffer, in the order
   289 the supllied DMA config would access them
   374 the supllied DMA config would access them
   326 	const TDmaTransferConfig* const iCfg;
   411 	const TDmaTransferConfig* const iCfg;
   327 	TUint8* iChunkBase;
   412 	TUint8* iChunkBase;
   328 
   413 
   329 	TUint8* iPtr; //<! Pointer to the current byte
   414 	TUint8* iPtr; //<! Pointer to the current byte
   330 
   415 
   331 	TInt iBytes; //!< The number of bytes traversed
   416 	TUint iBytes; //!< The number of bytes traversed
   332 	};
   417 	};
   333 
   418 
   334 /**
   419 /**
   335 Performs a single DMA transfer using the member TDmaTransferArgs on
   420 Performs a single DMA transfer using the member TDmaTransferArgs on
   336 one channel. At each stage of the transfer results are recorded in a
   421 one channel. At each stage of the transfer results are recorded in a
   358 	/**
   443 	/**
   359 	Perform each stage of trasnfer
   444 	Perform each stage of trasnfer
   360 	*/
   445 	*/
   361 	virtual void RunTest();
   446 	virtual void RunTest();
   362 	virtual void PrintTestType() const;
   447 	virtual void PrintTestType() const;
       
   448 	virtual void PrintTestInfo() const;
   363 
   449 
   364 	virtual CTest* Clone() const {return new CSingleTransferTest(*this);}
   450 	virtual CTest* Clone() const {return new CSingleTransferTest(*this);}
   365 
   451 
   366 	/**
   452 	/**
   367 	Compares the actual vs the exepected results and reports
   453 	Compares the actual vs the exepected results and reports
   420 	TBool iUseNewFragment; //!< If true then CSingleTransferTest will use v2 Fragment API
   506 	TBool iUseNewFragment; //!< If true then CSingleTransferTest will use v2 Fragment API
   421 	const TUint iMaxFragmentSize;
   507 	const TUint iMaxFragmentSize;
   422 	};
   508 	};
   423 
   509 
   424 /**
   510 /**
       
   511 This class will be used for testing DMA Close() and Open() API
       
   512 
       
   513 Extends CDmaTest by implemeting a RunTest() with a sequence of operations 
       
   514 to test Close() and Open() API 
       
   515 */
       
   516 class COpenCloseTest : public CDmaTest 
       
   517 	{
       
   518 public:
       
   519 	COpenCloseTest(
       
   520 			const TDesC& aName, TInt aIterations,	
       
   521 			const MPostTransferCheck* aPostTferChk = NULL,
       
   522 			const MPreTransfer* aPreTfer = NULL
       
   523 			)
       
   524 		: CDmaTest(aName, aIterations, aPreTfer, aPostTferChk), iOpenCloseResult(EFalse) , iRunOpen(EFalse)
       
   525 		{}
       
   526 
       
   527 	~COpenCloseTest();
       
   528 
       
   529 	virtual void RunTest();
       
   530 	virtual void PrintTestType() const;
       
   531 
       
   532 	virtual CTest* Clone() const {return new COpenCloseTest(*this);}
       
   533 	
       
   534 	/**
       
   535 	Checks the results of the sequeunce of  sequence of operations 
       
   536 	to test Close() and Open() API, return ETrue for a pass, EFalse for a fail
       
   537 	 */
       
   538 	virtual TBool Result();
       
   539 
       
   540 	// The methods below is a setters ie. The Named Parameter Idiom
       
   541 	// @see http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18
       
   542 	inline COpenCloseTest& RunOpenApiTest(TBool aFlag) {iRunOpen=aFlag; return *this;}
       
   543 
       
   544 protected:	
       
   545 	TBool DoRunClose();
       
   546 	TBool DoRunOpen();
       
   547 	TBool DoRunOpenExposed();
       
   548 
       
   549 protected:
       
   550 	/**
       
   551 	A handle to kernel side TDmaChannel object received after a channel is opened.
       
   552 	*/
       
   553 	TUint iChannelSessionCookie;
       
   554 	/**
       
   555 	A handle to kernel side DDmaRequest object.
       
   556 	*/
       
   557 	TUint iRequestSessionCookie;
       
   558 
       
   559 	/**
       
   560 	If true then Close/Open  API test passed
       
   561 	*/
       
   562 	TBool iOpenCloseResult;
       
   563 	
       
   564 	/**
       
   565 	 If true then run Open API test otherwise run Close API test
       
   566 	*/
       
   567 	TBool iRunOpen;
       
   568 	};
       
   569 
       
   570 /**
       
   571 Used for testing Pause and Resume
       
   572 
       
   573 Extends CSingle transfer by adding the capability to test
       
   574 Pause  & Resume() API.
       
   575 */
       
   576 class CPauseResumeTest : public CSingleTransferTest
       
   577 	{
       
   578 public:
       
   579 	 CPauseResumeTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aArgs, const TResultSet& aExpected)
       
   580 		:CSingleTransferTest(aName, aIterations, aArgs, aExpected)
       
   581 	 {}
       
   582 
       
   583 	~CPauseResumeTest();
       
   584 
       
   585 	virtual void RunTest();
       
   586 	virtual void PrintTestType() const;
       
   587 
       
   588 	virtual CTest* Clone() const {return new  CPauseResumeTest(*this);}
       
   589 
       
   590 	// The methods below is a setters ie. The Named Parameter Idiom
       
   591 	// @see http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18
       
   592 	inline CPauseResumeTest& UseNewDmaApi(TBool aFlag) {CSingleTransferTest::UseNewDmaApi(aFlag); return *this;}
       
   593 
       
   594 protected:
       
   595 	void DoCalibrationTransfer(TUint64 &atime);
       
   596 	TInt QueueAsyncRequest(TRequestStatus &aRequestState,TUint64 &atime);
       
   597 	};
       
   598 
       
   599 /**
   425 This class will be used for tests which benchmark certain DMA operations
   600 This class will be used for tests which benchmark certain DMA operations
   426 */
   601 */
   427 class CDmaBenchmark : public CSingleTransferTest
   602 class CDmaBenchmark : public CSingleTransferTest
   428 	{
   603 	{
   429 public:
   604 public:
   430 	CDmaBenchmark(const TDesC& aName, TInt aIterations, const TResultSet& aExpectedResults, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
   605 	CDmaBenchmark(const TDesC& aName, TInt aIterations, const TResultSet& aExpectedResults, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
       
   606 	CDmaBenchmark(const CDmaBenchmark& aOriginal);
   431 	~CDmaBenchmark();
   607 	~CDmaBenchmark();
   432 
   608 
   433 	virtual TBool Result();
   609 	virtual TBool Result();
   434 
   610 
   435 	static void SelfTest();
   611 	static void SelfTest();
   438 	/**
   614 	/**
   439 	@return The mean average of the result array
   615 	@return The mean average of the result array
   440 	*/
   616 	*/
   441 	TUint64 MeanResult();
   617 	TUint64 MeanResult();
   442 
   618 
   443 	//TODO must be included within copy ctor or all instances will
       
   444 	//share on result set!
       
   445 	RArray<TUint64> iResultArray;
   619 	RArray<TUint64> iResultArray;
   446 
       
   447 	};
   620 	};
   448 
   621 
   449 /**
   622 /**
   450 Fragments requests (only) and records duration
   623 Fragments requests (only) and records duration
   451 TODO make sure we are using old style DDmaRequest
       
   452 */
   624 */
   453 class CDmaBmFragmentation : public CDmaBenchmark
   625 class CDmaBmFragmentation : public CDmaBenchmark
   454 	{
   626 	{
   455 public:
   627 public:
   456 	CDmaBmFragmentation(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
   628 	CDmaBmFragmentation(const TDesC& aName, TInt aIterations, const TDmaTransferArgs& aTransferArgs, TUint aMaxFragmentSize);
   548 	*/
   720 	*/
   549 	TBool iPauseWhileQueuing;
   721 	TBool iPauseWhileQueuing;
   550 	};
   722 	};
   551 
   723 
   552 /**
   724 /**
       
   725 Used for testing TDmaChannel::IsQueueEmpty
       
   726 Extends CMultiTransferTest by adding the capability to test IsQueueEmpty() API. 
       
   727 */
       
   728 class CIsQueueEmptyTest : public  CMultiTransferTest 
       
   729 	{
       
   730 public:
       
   731 	CIsQueueEmptyTest(const TDesC& aName, TInt aIterations, const TDmaTransferArgs* aTransferArgs, const TResultSet* aResultSets, TInt aCount);
       
   732 	CIsQueueEmptyTest(const CIsQueueEmptyTest& aOther);
       
   733 	~CIsQueueEmptyTest();
       
   734 
       
   735 	inline CIsQueueEmptyTest& SetPreTransferTest(const MPreTransfer* aPreTfer) {iPreTransfer = aPreTfer; return *this;}
       
   736 	inline CIsQueueEmptyTest& SetPostTransferTest(const MPostTransferCheck* aPostTfer) {iPostTransferCheck = aPostTfer; return *this;}
       
   737 
       
   738 	virtual CTest* Clone() const {return new CIsQueueEmptyTest(*this);}
       
   739 	virtual void RunTest();
       
   740 	virtual void PrintTestType() const;
       
   741 
       
   742 protected:
       
   743 	void DoQueueNotEmpty();	
       
   744 	void DoIsQueueEmpty();
       
   745 	void QueueRequests();
       
   746 	};
       
   747 
       
   748 /**
       
   749 Used for testing CancelAll, Will create and queue multiple requests
       
   750 Extends CSingle transfer by adding the capability to test CancelAll API
       
   751 */
       
   752 class CCancelAllTest : public CMultiTransferTest
       
   753 	{
       
   754 public:
       
   755 	CCancelAllTest(const TDesC& aName, TInt aIterations,
       
   756 		const TDmaTransferArgs* aTransferArgs, const TResultSet* aResultSets,
       
   757 		TInt aCount
       
   758 		);
       
   759 	//CCancelAllTest(const CCacheNotifyDirCh
       
   760 
       
   761 	virtual void RunTest();
       
   762 	virtual void PrintTestType() const;
       
   763 	virtual CTest* Clone() const {return new CCancelAllTest(*this);}
       
   764 
       
   765 	inline CCancelAllTest& PauseWhileQueuing()
       
   766 		{iPauseWhileQueuing = ETrue; return *this;}
       
   767 	inline CCancelAllTest& SetPreTransferTest(const MPreTransfer* aPreTfer)
       
   768 		{iPreTransfer = aPreTfer; return *this;}
       
   769 	inline CCancelAllTest& SetPostTransferTest(const MPostTransferCheck* aPostTfer)
       
   770 		{iPostTransferCheck = aPostTfer; return *this;}
       
   771 
       
   772 protected:
       
   773 	void QueueRequestsAsync();
       
   774 	TInt CancelAllRequests();
       
   775 	void PauseChannel();
       
   776 	void ResumeChannel();
       
   777 
       
   778 	/**
       
   779 	A single request status that we use for all
       
   780 	asynchronously queued requests (we do not intend
       
   781 	to wait for them)
       
   782 	*/
       
   783 	TRequestStatus iDummyRequestStatus;
       
   784 	};
       
   785 
       
   786 /**
   553 Used for testing TDmaChannel::IsrRedoRequest
   787 Used for testing TDmaChannel::IsrRedoRequest
   554 
   788 
   555 Extends CSingle transfer by adding the capability to queue with
   789 Extends CSingle transfer by adding the capability to queue with
   556 additonal transfer parameters (TIsrRequeArgs) which are passed
   790 additonal transfer parameters (TIsrRequeArgs) which are passed
   557 to IsrRedoRequest in ISR callback
   791 to IsrRedoRequest in ISR callback
   565 			const MPostTransferCheck* aPostTferChk, TUint aMaxFragmentSize=0);
   799 			const MPostTransferCheck* aPostTferChk, TUint aMaxFragmentSize=0);
   566 
   800 
   567 	virtual void PrintTestType() const;
   801 	virtual void PrintTestType() const;
   568 
   802 
   569 	virtual void Queue();
   803 	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);}
   804 	virtual CTest* Clone() const {return new CIsrRequeTest(*this);}
   580 
   805 
   581 	const TIsrRequeArgsSet& GetRequeueArgs() const
   806 	const TIsrRequeArgsSet& GetRequeueArgs() const
   582 		{return iRequeArgSet;}
   807 		{return iRequeArgSet;}
   583 
   808 
   615 and other information about how the test should be run.
   840 and other information about how the test should be run.
   616 */
   841 */
   617 class TTestCase
   842 class TTestCase
   618 	{
   843 	{
   619 public:
   844 public:
   620 	//TODO it might be better to group sets of TDmaCapability
       
   621 	//into their own class eg. TDmaCapSet.
       
   622 	TTestCase(CDmaTest* aTest,
   845 	TTestCase(CDmaTest* aTest,
   623            TBool aConcurrent = EFalse,
   846            TBool aConcurrent = EFalse,
   624 		   const TDmaCapability = TDmaCapability(),
   847 		   const TDmaCapability = TDmaCapability(),
   625 		   const TDmaCapability = TDmaCapability(),
   848 		   const TDmaCapability = TDmaCapability(),
   626 		   const TDmaCapability = TDmaCapability(),
   849 		   const TDmaCapability = TDmaCapability(),
   659 public:
   882 public:
   660 	TTestRunner();
   883 	TTestRunner();
   661 	~TTestRunner();
   884 	~TTestRunner();
   662 
   885 
   663 	/**
   886 	/**
   664 	This function will populate TTestRunner with an array of test cases which 
   887 	This function will populate TTestRunner with an array of test cases
   665 	would be a collection of DMA test,its hardware prerequisites,and other 
   888 	to be run
   666 	information about how the test	
   889 
   667 
   890 	@param aTTestCases Array of test cases
   668 	@aTTestCases on return, this contains an the DMA test cases 
       
   669 	*/
   891 	*/
   670 	void AddTestCases(RPointerArray<TTestCase>& aTTestCases);
   892 	void AddTestCases(RPointerArray<TTestCase>& aTTestCases);
   671 
   893 
   672 	/**
   894 	/**
   673 	This will iterate over all test cases held by the test runner and
   895 	This will iterate over all test cases held by the test runner and
   713 	Array of DMA channel cookies
   935 	Array of DMA channel cookies
   714 	*/
   936 	*/
   715 	RArray<TUint> iPslCookies;
   937 	RArray<TUint> iPslCookies;
   716 };
   938 };
   717 
   939 
       
   940 /**
       
   941 Copy an RArray
       
   942 */
       
   943 template <typename T>
       
   944 void CopyL(const RArray<T>& aOriginal, RArray<T>& aNew)
       
   945 	{
       
   946 	const TInt count = aOriginal.Count();
       
   947 	for(TInt i=0; i<count; ++i)
       
   948 		{
       
   949 		aNew.AppendL(aOriginal[i]);
       
   950 		}
       
   951 	}
       
   952 
       
   953 template <typename T, typename Iterator>
       
   954 void ArrayAppendL(RArray<T>& aArray, Iterator aBegin, Iterator aEnd)
       
   955 	{
       
   956 	for(Iterator begin = aBegin; begin != aEnd; ++begin)
       
   957 		aArray.AppendL(*begin);
       
   958 	}
       
   959 
   718 
   960 
   719 #endif // #ifndef __T_DMA2_H__
   961 #endif // #ifndef __T_DMA2_H__