kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0496.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0496.cpp	Tue Aug 24 14:42:58 2010 +0100
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0496.cpp	Tue Aug 24 14:49:21 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -20,6 +20,10 @@
 #include "testpolicy.h"
 #include "modelleddevices.h"
 #include "testliterals.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "PBASE-T_USBDI-0496Traces.h"
+#endif
 
 
  
@@ -48,10 +52,12 @@
 
 CUT_PBASE_T_USBDI_0496* CUT_PBASE_T_USBDI_0496::NewL(TBool aHostRole)
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0496_NEWL_ENTRY, aHostRole );
 	CUT_PBASE_T_USBDI_0496* self = new (ELeave) CUT_PBASE_T_USBDI_0496(aHostRole);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_NEWL_EXIT, ( TUint )( self ) );
 	return self;
 	}
 	
@@ -60,11 +66,14 @@
 :	CBaseBulkTestCase(KTestCaseId,aHostRole),
 	iCaseStep(EInProgress)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_CUT_PBASE_T_USBDI_0496_ENTRY, this );
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_CUT_PBASE_T_USBDI_0496_EXIT, this );
 	} 
 
 
 void CUT_PBASE_T_USBDI_0496::ConstructL()
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0496_CONSTRUCTL_ENTRY, this );
 	BaseBulkConstructL();
 
 	iInBuffer = HBufC8::NewL(KTestBufferLength);
@@ -80,36 +89,39 @@
 		iValidateBufferPtr.Append(KLiteralEnglish5());
 		}
 	
-	RDebug::Printf("CUT_PBASE_T_USBDI_0496::ConstructL(): buffer created");
+	OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_CONSTRUCTL, "CUT_PBASE_T_USBDI_0496::ConstructL(): buffer created");
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_CONSTRUCTL_EXIT, this );
 	}
 
 
 CUT_PBASE_T_USBDI_0496::~CUT_PBASE_T_USBDI_0496()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0496_CUT_PBASE_T_USBDI_0496_ENTRY_DUP01, this );
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_CUT_PBASE_T_USBDI_0496_EXIT_DUP01, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0496::KillTransfers()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0496_KILLTRANSFERS_ENTRY, this );
 	
 	iInTransfer[0]->Cancel();
 	iInTransfer[1]->Cancel();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_KILLTRANSFERS_EXIT, this );
 	}
 	
 	
 	
 void CUT_PBASE_T_USBDI_0496::Ep0TransferCompleteL(TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_ENTRY, this );
 	
-	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d", aCompletionCode);
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d", aCompletionCode);
 	
 	if(aCompletionCode != KErrNone)
 		{
 		if(iCaseStep == EFailed)
 			{// ignore error, nad catch the TestFailed method called further down.
-			RDebug::Printf("***Failure sending FAIL message to client on endpoint 0***");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP01, "***Failure sending FAIL message to client on endpoint 0***");
 			}
 		else
 			{
@@ -117,10 +129,11 @@
 			TBuf<256> msg;
 			_LIT(lit, "<Error %d> Transfer to control endpoint 0 was not successful");
 			msg.Format(lit,aCompletionCode);
-			RDebug::Print(msg);
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP02, msg);
 			iCaseStep = EFailed;
 			TTestCaseFailed request(aCompletionCode,msg);
 			iControlEp0->SendRequest(request,this);
+			OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_EXIT, this );
 			return;
 			}
 		}
@@ -139,20 +152,20 @@
 		
 		case ERequestRepeatedWrite:
 			{
-			RDebug::Printf("Try to perform ALL transfers");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP03, "Try to perform ALL transfers");
 			
 			iCaseStep = ETransfer;	
 			iIsValid = ETrue; //innocent until proved guilty
-			RDebug::Printf("\n");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP04, "\n");
 			iTransferComplete |= ValidatePreviousAndPerformNextTransfers(KBulkTransferInId[0]); //should not validate - just perform necessary transfers
 			iTransferComplete |= ValidatePreviousAndPerformNextTransfers(KBulkTransferInId[1]); //should not validate - just perform necessary transfers
-			RDebug::Printf("\n");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP05, "\n");
 			if((iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask)
 				{
 				iTransferComplete = 0; //reset
 				_LIT(lit, "TEST FAILURE: No data to send!!");
 				TBuf<40> msg(lit);
-				RDebug::Print(msg);
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP06, msg);
 				iCaseStep = EFailed;
 				TTestCaseFailed request(KErrAbort,msg);
 				return iControlEp0->SendRequest(request,this);
@@ -161,20 +174,21 @@
 			break;
 
 		default:
-			RDebug::Printf("<Error> Unknown test step");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_DUP07, "<Error> Unknown test step");
 			TestFailed(KErrUnknown);
 			break;
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_EP0TRANSFERCOMPLETEL_EXIT_DUP01, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0496::TransferCompleteL(TInt aTransferId,TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_ENTRY, this );
 	Cancel();
 	
 	TInt err(KErrNone);
 	TBuf<256> msg;
-	RDebug::Printf("Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep);
+	OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL, "Transfer completed (id=%d), aCompletionCode = %d, test step = %d",aTransferId, aCompletionCode, iCaseStep);
 
 
 	switch(iCaseStep)
@@ -198,16 +212,16 @@
 				break;
 				}
 	
-			RDebug::Printf("\n");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP01, "\n");
 			iTransferComplete |= ValidatePreviousAndPerformNextTransfers(aTransferId);
-			RDebug::Printf("\n");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP02, "\n");
 			
 			if(err==KErrNone && (iTransferComplete & KBulkTransferIdMask) == KBulkTransferIdMask)
 				{
 				/*
 				Transfers all complete - check all were valid, and if so pass the test
 				*/
-				RDebug::Printf("All Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete);
+				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP03, "All Transfers Completed Successfully: Transfer Completion Aggregation Mask 0x%x", iTransferComplete);
 				if(!iIsValid)
 					{
 					err = KErrCompletion; //indicates data validation failure
@@ -215,7 +229,7 @@
 					break;
 					}
 				// Comparison is a match
-				RDebug::Printf("Comparison for IN transfer is a match");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP04, "Comparison for IN transfer is a match");
 				iCaseStep = EPassed;
 				TTestCasePassed request;
 				iControlEp0->SendRequest(request,this);
@@ -242,19 +256,20 @@
 	if(err!=KErrNone)
 		{	
 		KillTransfers();
-		RDebug::Print(msg);
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_DUP05, msg);
 		iCaseStep = EFailed;
 		TTestCaseFailed request(err,msg);
 		return iControlEp0->SendRequest(request,this);
 		}	
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_TRANSFERCOMPLETEL_EXIT, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0496::DeviceInsertedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_ENTRY, this );
 	
 	Cancel();
-	RDebug::Printf("this - %08x", this);
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL, "this - %08x", this);
 	
 	TBuf<256> msg;
 	TInt err = KErrNone;
@@ -281,7 +296,7 @@
 			iInTransfer[1] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,KBulkMaxTransferSize,*this,KBulkTransferInId[1]);
 			
 			// Initialise the descriptors for transfer		
-			RDebug::Printf("Initialising the transfer descriptors - interface 1");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_DUP01, "Initialising the transfer descriptors - interface 1");
 			err = iUsbInterface1.InitialiseTransferDescriptors();
 			if(err != KErrNone)
 				{
@@ -292,22 +307,24 @@
 		}
 	if(err != KErrNone)
 		{
-		RDebug::Print(msg);
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_DUP02, msg);
 		iCaseStep = EFailed;
 		TTestCaseFailed request(err,msg);
 		iControlEp0->SendRequest(request,this);
 		}
 	else
 		{
-		RDebug::Printf("Asking client for 'Read' on interface 1");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_DUP03, "Asking client for 'Read' on interface 1");
 		iCaseStep = ERequestRepeatedWrite;	
 		TRepeatedWriteDataRequest request(1,1,KLiteralEnglish5(),KDeviceNumWriteBytes,KTotalBytesToTransfer);// EP2 means endpoint index 2 not the actual endpoint number, here the ep with 32 byte max packet size
 		iControlEp0->SendRequest(request,this);
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_DEVICEINSERTEDL_EXIT, this );
 	}
 
 TUint8 CUT_PBASE_T_USBDI_0496::Index(TUint8 aTransferId)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_INDEX_ENTRY, this );
 	switch(aTransferId)
 		{
 		case KBulkTransferInId0:
@@ -317,6 +334,7 @@
 		default:
 			_LIT(lit, "TRANSFER ID OUT OF RANGE");
 			User::Panic(lit, KErrArgument);
+			OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_INDEX_EXIT, this );
 			return 0; //should never get here
 		}
 	}
@@ -329,11 +347,11 @@
 		transfer ID.
 */
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_ENTRY, this );
 	
 	TUint8 index = Index(aTransferId);
-	RDebug::Printf("\n");
-	RDebug::Printf("Transfer[%d]", index);
+	OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS, "\n");
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_DUP01, "Transfer[%d]", index);
 	
 	
 	if(iNumBytesExpected[index] != 0)
@@ -341,7 +359,7 @@
 		TPtrC8 data1(iInTransfer[index]->DataPolled());
 		if(ValidateData(data1, iValidateBufferPtr.Mid(iValidationStringStartPointTransfer[index], iNumBytesExpected[index])) == EFalse)
 			{
-			RDebug::Printf("=====VALIDATION FAILURE: Point of Validation String Entry %d, Newly Read Bytes %d=====",iValidationStringStartPointTransfer[index], iNumBytesExpected[index]);
+			OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_DUP02, "=====VALIDATION FAILURE: Point of Validation String Entry %u, Newly Read Bytes %u=====",iValidationStringStartPointTransfer[index], iNumBytesExpected[index]);
 			iIsValid = EFalse;
 			}
 		iNumBytesExpected[index] = 0; //reset
@@ -349,7 +367,8 @@
 	if(iNumBytesRequestedSoFar >= KTotalBytesToTransfer)
 		//if we are near the end the other transfer will mop up remaining bytes...
 		{
-		RDebug::Printf("****ALL DONE for Transfer[%d]****", index);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_DUP03, "****ALL DONE for Transfer[%d]****", index);
+		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_EXIT, this, aTransferId );
 		return aTransferId; //tell caller that all transfers are complete for this transfer ID
 		}
 
@@ -360,6 +379,7 @@
 	iInTransfer[index]->TransferIn(KHostNumReadBytes); //rely on ZLP to complete the last 'TransferIn'
 	iExpectedNextTransferNumber = 1 - iExpectedNextTransferNumber;
 
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0496_VALIDATEPREVIOUSANDPERFORMNEXTTRANSFERS_EXIT_DUP01, this );
 	return 0; //tell caller there are still transfers to complete for the requested transfer ID
 	}