kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0484.cpp
changeset 253 d37db4dcc88d
parent 0 a41df078684a
child 257 3e88ff8f41d5
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0484.cpp	Tue Aug 24 14:42:58 2010 +0100
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-0484.cpp	Tue Aug 24 14:49:21 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -19,6 +19,10 @@
 #include "PBASE-T_USBDI-0484.h"
 #include "testpolicy.h"
 #include "modelleddevices.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "PBASE-T_USBDI-0484Traces.h"
+#endif
 
 
  
@@ -37,10 +41,12 @@
 
 CUT_PBASE_T_USBDI_0484* CUT_PBASE_T_USBDI_0484::NewL(TBool aHostRole)
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0484_NEWL_ENTRY, aHostRole );
 	CUT_PBASE_T_USBDI_0484* self = new (ELeave) CUT_PBASE_T_USBDI_0484(aHostRole);
 	CleanupStack::PushL(self);
 	self->ConstructL();
 	CleanupStack::Pop(self);
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0484_NEWL_EXIT, ( TUint )( self ) );
 	return self;
 	}
 	
@@ -49,32 +55,37 @@
 :	CBaseBulkTestCase(KTestCaseId,aHostRole),
 	iCaseStep(EInProgress)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0484_CUT_PBASE_T_USBDI_0484_ENTRY, this );
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0484_CUT_PBASE_T_USBDI_0484_EXIT, this );
 	} 
 
 
 void CUT_PBASE_T_USBDI_0484::ConstructL()
 	{
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0484_CONSTRUCTL_ENTRY, this );
 	BaseBulkConstructL();
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0484_CONSTRUCTL_EXIT, this );
 	}
 
 
 CUT_PBASE_T_USBDI_0484::~CUT_PBASE_T_USBDI_0484()
 	{
-	LOG_FUNC
+	OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_0484_CUT_PBASE_T_USBDI_0484_ENTRY_DUP01, this );
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0484_CUT_PBASE_T_USBDI_0484_EXIT_DUP01, this );
 	}
 	
 void CUT_PBASE_T_USBDI_0484::Ep0TransferCompleteL(TInt aCompletionCode)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0484_EP0TRANSFERCOMPLETEL_ENTRY, this );
 	Cancel();	
 	
-	RDebug::Printf("Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_EP0TRANSFERCOMPLETEL, "Ep0TransferCompleteL with aCompletionCode = %d",aCompletionCode);
 	
 	if(aCompletionCode != KErrNone)
 		{	
 		TBuf<256> msg;
 		msg.Format(_L("<Error %d> Transfer to control endpoint 0 was not successful"),aCompletionCode);
-		RDebug::Print(msg);
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_EP0TRANSFERCOMPLETEL_DUP01, msg);
 		}
 
 	if(iCaseStep == EPassed)
@@ -91,14 +102,16 @@
 		{
 		return TestFailed(KErrCompletion);
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0484_EP0TRANSFERCOMPLETEL_EXIT, this );
 	}
 	
 	
 void CUT_PBASE_T_USBDI_0484::TransferCompleteL(TInt aTransferId,TInt aCompletionCode)
 	{
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_ENTRY, this );
 	Cancel();
 	TInt err(KErrNone);
-	RDebug::Printf("Transfer completed (id=%d), aCompletionCode = %d",aTransferId, aCompletionCode);
+	OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL, "Transfer completed (id=%d), aCompletionCode = %d",aTransferId, aCompletionCode);
 
 	if(aTransferId == KBulkTransferId1)
 		{
@@ -108,7 +121,7 @@
 				{
 				TBuf<256> msg;
 				msg.Format(_L("<Error %d> The transfer completed with no errors but should have stalled"),aCompletionCode);
-				RDebug::Print(msg);
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP01, msg);
 				TTestCaseFailed request(KErrCorrupt,msg);
 				return iControlEp0->SendRequest(request,this);
 				}
@@ -120,14 +133,14 @@
 					{
 					TBuf<256> msg;
 					msg.Format(_L("<Error %d> The remote stall cannot be cleared"),err);
-					RDebug::Print(msg);
+					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP02, msg);
 					iCaseStep = EFailed;
 					TTestCaseFailed request(err,msg);
 					return iControlEp0->SendRequest(request,this);
 					}
 					
 				// try to get data now, after EP has been stalled
-				RDebug::Printf("try to get data now, after EP has been stalled");
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP03, "try to get data now, after EP has been stalled");
 				iInTransfer[0]->TransferIn(KDataPayload1().Length());
 				iInTransfer[1]->TransferIn(KDataPayload2().Length());
 				iInTransfer[2]->TransferIn(KDataPayload3().Length());
@@ -135,6 +148,7 @@
 				iCaseStep = ETransferAfterStall;
 				TEndpointWriteRequest request(1,1,KDataPayload1);// EP1 because 1st writter EP
 				iControlEp0->SendRequest(request,this);	
+				OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_EXIT, this );
 				return;		
 				}
 			}
@@ -144,7 +158,7 @@
 				{
 				TBuf<256> msg;
 				msg.Format(_L("<Error %d> No data got after EP2 being stalled"),aCompletionCode);
-				RDebug::Print(msg);
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP04, msg);
 				iCaseStep = EFailed;
 				TTestCaseFailed request(err,msg);
 				return iControlEp0->SendRequest(request,this);
@@ -157,13 +171,13 @@
 				{
 				TBuf<256> msg;
 				msg.Format(_L("<Error %d> Interrupt data received does not match data sent"),KErrCompletion);
-				RDebug::Print(msg);
+				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP05, msg);
 				iCaseStep = EFailed;
 				TTestCaseFailed request(KErrCompletion,msg);
 				return iControlEp0->SendRequest(request,this);
 				}			 
 			// Comparison is a match, wait for next transfer
-			RDebug::Printf("Comparison is a match, wait for transfer 2");
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP06, "Comparison is a match, wait for transfer 2");
 			User::After(500000);
 			TEndpointWriteRequest request(1,1,KDataPayload2);// EP1 because 1st writter EP
 			iControlEp0->SendRequest(request,this);						
@@ -175,7 +189,7 @@
 			{
 			TBuf<256> msg;
 			msg.Format(_L("<Error %d> No data got after EP2 being stalled"),aCompletionCode);
-			RDebug::Print(msg);
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP07, msg);
 			iCaseStep = EFailed;
 			TTestCaseFailed request(err,msg);
 			return iControlEp0->SendRequest(request,this);
@@ -188,13 +202,13 @@
 			{
 			TBuf<256> msg;
 			msg.Format(_L("<Error %d> Interrupt data received does not match data sent"),KErrCompletion);
-			RDebug::Print(msg);
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP08, msg);
 			iCaseStep = EFailed;
 			TTestCaseFailed request(KErrCompletion,msg);
 			return iControlEp0->SendRequest(request,this);
 			}			 
 		// Comparison is a match, wait for next transfer
-		RDebug::Printf("Comparison is a match, wait for transfer 3");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP09, "Comparison is a match, wait for transfer 3");
 		User::After(500000);
 		TEndpointWriteRequest request(1,1,KDataPayload3);// EP1 because 1st writter EP
 		iControlEp0->SendRequest(request,this);					
@@ -205,7 +219,7 @@
 			{
 			TBuf<256> msg;
 			msg.Format(_L("<Error %d> No data got after EP2 being stalled"),aCompletionCode);
-			RDebug::Print(msg);
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP10, msg);
 			iCaseStep = EFailed;
 			TTestCaseFailed request(err,msg);
 			return iControlEp0->SendRequest(request,this);
@@ -217,7 +231,7 @@
 			{
 			TBuf<256> msg;
 			msg.Format(_L("<Error %d> Interrupt data received does not match data sent"),KErrCompletion);
-			RDebug::Print(msg);
+			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP11, msg);
 			iCaseStep = EFailed;
 			TTestCaseFailed request(KErrCompletion,msg);
 			return iControlEp0->SendRequest(request,this);
@@ -229,18 +243,19 @@
 		}
 	else
 		{
-		RDebug::Printf("<Error> a transfer completed (id=%d) that was not expected",aTransferId);
+		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_DUP12, "<Error> a transfer completed (id=%d) that was not expected",aTransferId);
 		return TestFailed(KErrCorrupt);
 		}	
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0484_TRANSFERCOMPLETEL_EXIT_DUP01, this );
 	}
 
 
 void CUT_PBASE_T_USBDI_0484::DeviceInsertedL(TUint aDeviceHandle)
 	{
-	LOG_FUNC
+	OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_0484_DEVICEINSERTEDL_ENTRY, this );
 	
 	Cancel();
-	RDebug::Printf("this - %08x", this);
+	OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_DEVICEINSERTEDL, "this - %08x", this);
 	
 	TBuf<256> msg;
 	TInt err = KErrNone;
@@ -258,7 +273,7 @@
 		iInTransfer[2] = new (ELeave) CBulkTransfer(iTestPipeInterface1BulkIn,iUsbInterface1,256,*this,KBulkTransferId3);	
 		
 		// Initialise the descriptors for transfer		
-		RDebug::Printf("Initialising the transfer descriptors - interface 1");
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_DEVICEINSERTEDL_DUP01, "Initialising the transfer descriptors - interface 1");
 		err = iUsbInterface1.InitialiseTransferDescriptors();
 		if(err != KErrNone)
 			{
@@ -268,7 +283,7 @@
 		}
 	if(err != KErrNone)
 		{
-		RDebug::Print(msg);
+		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_0484_DEVICEINSERTEDL_DUP02, msg);
 		iCaseStep = EFailed;
 		TTestCaseFailed request(err,msg);
 		iControlEp0->SendRequest(request,this);
@@ -281,6 +296,7 @@
 		TStallEndpointRequest r2(2,1); // Stall endpoint 2 interface 1
 		iControlEp0->SendRequest(r2,this);		
 		}
+	OstTraceFunctionExit1( CUT_PBASE_T_USBDI_0484_DEVICEINSERTEDL_EXIT, this );
 	}
 	
 	}