--- a/kerneltest/e32test/usbho/t_usbdi/src/FDFActor.cpp Thu Aug 19 11:14:22 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/FDFActor.cpp Tue Aug 31 16:34:26 2010 +0300
@@ -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"
@@ -21,6 +21,10 @@
#include <Usb.h>
#include "UsbDescriptorOffsets.h"
#include "BaseTestCase.h"
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "FDFActorTraces.h"
+#endif
#include <e32property.h>
extern RTest gtest;
@@ -34,10 +38,12 @@
CActorFDF* CActorFDF::NewL(MUsbBusObserver& aObserver)
{
+ OstTraceFunctionEntry1( CACTORFDF_NEWL_ENTRY, ( TUint )&( aObserver ) );
CActorFDF* self = new (ELeave) CActorFDF(aObserver);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
+ OstTraceFunctionExit1( CACTORFDF_NEWL_EXIT, ( TUint )( self ) );
return self;
}
@@ -46,22 +52,24 @@
: CActive(EPriorityStandard),
iObserver(aObserver)
{
+ OstTraceFunctionEntryExt( CACTORFDF_CACTORFDF_ENTRY, this );
+ OstTraceFunctionExit1( CACTORFDF_CACTORFDF_EXIT, this );
}
void CActorFDF::ConstructL()
{
- LOG_FUNC
+ OstTraceFunctionEntry1( CACTORFDF_CONSTRUCTL_ENTRY, this );
CActiveScheduler::Add(this);
TInt err(iDriver.Open());
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Unable to open driver channel",err);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_CONSTRUCTL, "<Error %d> Unable to open driver channel",err);
User::Leave(err);
}
- RDebug::Printf("PBASE-T_USBDI-xxxx: Stack starting");
+ OstTrace0(TRACE_NORMAL, CACTORFDF_CONSTRUCTL_DUP01, "PBASE-T_USBDI-xxxx: Stack starting");
/*
@SYMTestCaseID PBASE-T_USBDI-xxxx
@SYMTestCaseDesc Test for host stack initiation
@@ -78,15 +86,15 @@
if(err != KErrNone)
{
// Test case did not run successfully
- RDebug::Printf("<Error %d> USB Host stack not starting",err);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_CONSTRUCTL_DUP02, "<Error %d> USB Host stack not starting",err);
gtest(EFalse);
}
- RDebug::Printf("starting t_usbhost_usbman.exe");
+ OstTrace0(TRACE_NORMAL, CACTORFDF_CONSTRUCTL_DUP03, "starting t_usbhost_usbman.exe");
TInt r = iOtgUsbMan.Create(_L("t_usbhost_usbman.exe"), KNullDesC); //LIT does not seem to work here
if(r != KErrNone && r != KErrAlreadyExists)
{
- RDebug::Printf("can't start t_usbhost_usbman.exe");
+ OstTrace0(TRACE_NORMAL, CACTORFDF_CONSTRUCTL_DUP04, "can't start t_usbhost_usbman.exe");
gtest(EFalse);
}
@@ -96,25 +104,28 @@
r = RProperty::Define(KWordOfDeathCat, KWordOfDeathKey, RProperty::EInt,KAllowAllPolicy, KAllowAllPolicy, 0);
if(r != KErrNone && r != KErrAlreadyExists)
{
- RDebug::Printf("Could not create the WordOfDeath P&S (%d)", r);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_CONSTRUCTL_DUP05, "Could not create the WordOfDeath P&S (%d)", r);
gtest(EFalse);
}
iOtgUsbMan.Resume();
User::After(1500000); //allow time for t_usbhost_usbman.exe to start
+ OstTraceFunctionExit1( CACTORFDF_CONSTRUCTL_EXIT, this );
}
void KillTest()
{
- RDebug::Printf("BEFORE gtest(EFalse)");
+ OstTraceFunctionEntry0( _KILLTEST_ENTRY );
+ OstTrace0(TRACE_NORMAL, KILLTEST_KILLTEST, "BEFORE gtest(EFalse)");
gtest(EFalse);
- RDebug::Printf("AFTER gtest(EFalse)");
+ OstTrace0(TRACE_NORMAL, KILLTEST_KILLTEST_DUP01, "AFTER gtest(EFalse)");
+ OstTraceFunctionExit0( _KILLTEST_EXIT );
}
CActorFDF::~CActorFDF()
{
- LOG_FUNC
+ OstTraceFunctionEntry1( CACTORFDF_CACTORFDF_ENTRY_DUP01, this );
Cancel();
// Destroy all test device objects that represented connected devices
@@ -126,11 +137,11 @@
delete *it.NextValue();
}
- RDebug::Printf("killing t_usbhost_usbman.exe");
+ OstTrace0(TRACE_NORMAL, CACTORFDF_DCACTORFDF, "killing t_usbhost_usbman.exe");
TInt r = RProperty::Set(KWordOfDeathCat, KWordOfDeathKey, KErrAbort); // Send the word of death
if(r != KErrNone)
{
- RDebug::Printf("failed to kill t_usbhost-usbhan (%d)", r);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_DCACTORFDF_DUP01, "failed to kill t_usbhost-usbhan (%d)", r);
RProperty::Delete(KWordOfDeathCat, KWordOfDeathKey); //try to clean this up ready for next test
User::After(1000000); //allow time for property to clean up
gtest(EFalse);
@@ -139,7 +150,7 @@
// Stop the USB Hub driver
- RDebug::Printf("UT-USBD-P1782-TN0001: Hub driver stopping...");
+ OstTrace0(TRACE_NORMAL, CACTORFDF_DCACTORFDF_DUP02, "UT-USBD-P1782-TN0001: Hub driver stopping...");
// Close the channel to the USB Hub driver
iDriver.Close();
@@ -157,54 +168,58 @@
//give up
{
User::After(1000000); //allow time for property to clean up JUST IN CASE it can despite returning an error!
- RDebug::Printf("failed to delete wordofdeath P&S (%d)", r);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_DCACTORFDF_DUP03, "failed to delete wordofdeath P&S (%d)", r);
gtest(EFalse);
}
}
+ OstTraceFunctionExit1( CACTORFDF_CACTORFDF_EXIT_DUP01, this );
}
void CActorFDF::DoCancel()
{
- LOG_FUNC
+OstTraceFunctionEntry1( CACTORFDF_DOCANCEL_ENTRY, this );
- RDebug::Printf("Cancelling bus event notifications");
+ OstTrace0(TRACE_NORMAL, CACTORFDF_DOCANCEL, "Cancelling bus event notifications");
iDriver.CancelWaitForBusEvent();
gtest((iStatus == KErrCancel) || (iStatus == KErrNone));
- RDebug::Printf("Bus event notifications successfully cancelled");
+ OstTrace0(TRACE_NORMAL, CACTORFDF_DOCANCEL_DUP01, "Bus event notifications successfully cancelled");
+ OstTraceFunctionExit1( CACTORFDF_DOCANCEL_EXIT, this );
}
void CActorFDF::Monitor()
{
- LOG_FUNC
+OstTraceFunctionEntry1( CACTORFDF_MONITOR_ENTRY, this );
- RDebug::Printf("Monitoring bus events");
+ OstTrace0(TRACE_NORMAL, CACTORFDF_MONITOR, "Monitoring bus events");
iDriver.WaitForBusEvent(iBusEvent,iStatus);
SetActive();
+ OstTraceFunctionExit1( CACTORFDF_MONITOR_EXIT, this );
}
CUsbTestDevice& CActorFDF::DeviceL(TUint aDeviceHandle)
{
+ OstTraceFunctionEntryExt( CACTORFDF_DEVICEL_ENTRY, this );
return *iDevices.FindL(aDeviceHandle);
}
void CActorFDF::RunL()
{
- LOG_FUNC
+OstTraceFunctionEntry1( CACTORFDF_RUNL_ENTRY, this );
// Obtain completion code
TInt completionCode(iStatus.Int());
- RDebug::Printf("Completion code : %d",completionCode);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_RUNL, "Completion code : %d",completionCode);
if(completionCode == KErrNone)
{
if(iBusEvent.iEventType == RUsbHubDriver::TBusEvent::EDeviceAttached)
{
// Device Attached
- RDebug::Printf("Usb device attached: %d",iBusEvent.iDeviceHandle);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_RUNL_DUP01, "Usb device attached: %d",iBusEvent.iDeviceHandle);
// Create the test device object
iDevices.InsertL(iBusEvent.iDeviceHandle,CUsbTestDevice::NewL(iDriver,iBusEvent.iDeviceHandle,iObserver));
@@ -215,7 +230,7 @@
else if(iBusEvent.iEventType == RUsbHubDriver::TBusEvent::EDeviceRemoved)
{
// Device Removed
- RDebug::Printf("Usb device removed: %d",iBusEvent.iDeviceHandle);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_RUNL_DUP02, "Usb device removed: %d",iBusEvent.iDeviceHandle);
// Notify observer
iObserver.DeviceRemovedL(iBusEvent.iDeviceHandle);
@@ -227,24 +242,26 @@
else
{
// TODO: Upcall for USB Man etc
- RDebug::Printf("<Warning> Bus event %d occured, still monitoring, reason = %d",iBusEvent.iEventType, iBusEvent.iReason);
+ OstTraceExt2(TRACE_NORMAL, CACTORFDF_RUNL_DUP03, "<Warning> Bus event %d occured, still monitoring, reason = %d",iBusEvent.iEventType, iBusEvent.iReason);
iDriver.WaitForBusEvent(iBusEvent,iStatus);
SetActive();
}
}
else
{
- RDebug::Printf("<Error %d> Bus event %d",completionCode,iBusEvent.iEventType);
+ OstTraceExt2(TRACE_NORMAL, CACTORFDF_RUNL_DUP04, "<Error %d> Bus event %d",completionCode,iBusEvent.iEventType);
iObserver.BusErrorL(completionCode);
}
+ OstTraceFunctionExit1( CACTORFDF_RUNL_EXIT, this );
}
TInt CActorFDF::RunError(TInt aError)
{
- LOG_FUNC
+OstTraceFunctionEntryExt( CACTORFDF_RUNERROR_ENTRY, this );
- RDebug::Printf("<Error %d> CActorFDF::RunError",aError);
+ OstTrace1(TRACE_NORMAL, CACTORFDF_RUNERROR, "<Error %d> CActorFDF::RunError",aError);
+ OstTraceFunctionExitExt( CACTORFDF_RUNERROR_EXIT, this, KErrNone );
return KErrNone;
}
@@ -260,10 +277,12 @@
CUsbTestDevice* CUsbTestDevice::NewL(RUsbHubDriver& aHubDriver,TUint aDeviceHandle,MUsbBusObserver& aObserver)
{
+ OstTraceFunctionEntryExt( CUSBTESTDEVICE_NEWL_ENTRY, 0 );
CUsbTestDevice* self = new (ELeave) CUsbTestDevice(aHubDriver,aDeviceHandle,aObserver);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
+ OstTraceFunctionExit1( CUSBTESTDEVICE_NEWL_EXIT, ( TUint )( self ) );
return self;
}
@@ -273,21 +292,23 @@
iHandle(aHandle),
iObserver(aObserver)
{
- LOG_FUNC
+OstTraceFunctionEntryExt( CUSBTESTDEVICE_CUSBTESTDEVICE_ENTRY, this );
CActiveScheduler::Add(this);
+ OstTraceFunctionExit1( CUSBTESTDEVICE_CUSBTESTDEVICE_EXIT, this );
}
CUsbTestDevice::~CUsbTestDevice()
{
- LOG_FUNC
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_CUSBTESTDEVICE_ENTRY_DUP01, this );
Cancel();
iDevice.Close();
+ OstTraceFunctionExit1( CUSBTESTDEVICE_CUSBTESTDEVICE_EXIT_DUP01, this );
}
void CUsbTestDevice::ConstructL()
{
- LOG_FUNC
+OstTraceFunctionEntry1( CUSBTESTDEVICE_CONSTRUCTL_ENTRY, this );
// Open the usb device object
User::LeaveIfError(iDevice.Open(iDriver,iHandle));
@@ -295,14 +316,14 @@
TInt err(iDevice.GetDeviceDescriptor(iDeviceDescriptor));
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Getting device (%d) descriptor",err,iHandle);
+ OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL, "<Error %d> Getting device (%u) descriptor",err,iHandle);
User::Leave(err);
}
err = iDevice.GetConfigurationDescriptor(iConfigDescriptor);
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Getting device (%d) configuration descriptor",err,iHandle);
+ OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP01, "<Error %d> Getting device (%u) configuration descriptor",err,iHandle);
User::Leave(err);
}
@@ -310,16 +331,16 @@
iPid = iDeviceDescriptor.ProductId();
iVid = iDeviceDescriptor.VendorId();
- RDebug::Printf("%dmA configuration maximum power consumption",iConfigDescriptor.MaxPower()*2);
- RDebug::Printf("%d number of interface(s)",iConfigDescriptor.NumInterfaces());
- RDebug::Printf("Product Id=0x%04x, Vendor Id=0x%04x",iPid,iVid);
- RDebug::Printf("TotalLength() = %d",iConfigDescriptor.TotalLength());
+ OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP02, "%dmA configuration maximum power consumption",iConfigDescriptor.MaxPower()*2);
+ OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP03, "%d number of interface(s)",iConfigDescriptor.NumInterfaces());
+ OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP04, "Product Id=0x%04x, Vendor Id=0x%04x",(TUint32)iPid,(TUint32)iVid);
+ OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP05, "TotalLength() = %d",iConfigDescriptor.TotalLength());
// The manufacturer string
err = iDevice.GetStringDescriptor(iManufacturerStringDesc,iManufacturerStringData,iDeviceDescriptor.ManufacturerIndex());
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Getting device (%d) manufacturer string descriptor",err,iHandle);
+ OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP06, "<Error %d> Getting device (%u) manufacturer string descriptor",err,iHandle);
User::Leave(err);
}
iManufacturerStringDesc->StringData(iManufacturerString);
@@ -328,7 +349,7 @@
err = iDevice.GetStringDescriptor(iProductStringDesc,iProductStringData,iDeviceDescriptor.ProductIndex());
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Getting device (%d) product string descriptor",err,iHandle);
+ OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP07, "<Error %d> Getting device (%u) product string descriptor",err,iHandle);
User::Leave(err);
}
iProductStringDesc->StringData(iProductString);
@@ -337,7 +358,7 @@
err = iDevice.GetStringDescriptor(iSerialNumberDesc,iSerialNumberStringData,iDeviceDescriptor.SerialNumberIndex());
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Getting device (%d) serial number string descriptor",err,iHandle);
+ OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP08, "<Error %d> Getting device (%u) serial number string descriptor",err,iHandle);
User::Leave(err);
}
iSerialNumberDesc->StringData(iSerialNumber);
@@ -346,7 +367,7 @@
err = iDevice.GetStringDescriptor(iConfigStringDesc,iConfigStringData,iConfigDescriptor.ConfigurationIndex());
if(err != KErrNone)
{
- RDebug::Printf("<Error %d> Getting device (%d) configuration string descriptor",err,iHandle);
+ OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP09, "<Error %d> Getting device (%u) configuration string descriptor",err,iHandle);
User::Leave(err);
}
iConfigStringDesc->StringData(iConfigString);
@@ -358,80 +379,102 @@
if(err != KErrUsbStalled)
{
delete unusedStringDescriptor; //in case 'err == KErrNone', in which case this will need freeing
- RDebug::Printf("GetStringDescriptor with nonExistentString didn't return KErrUsbStalled",err,iHandle);
+ OstTraceExt2(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP10, "GetStringDescriptor with %d Handle %u",err,iHandle);
User::Leave(err);
}
- RDebug::Printf("String not present error(%d)",err);
+ OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_CONSTRUCTL_DUP11, "String not present error(%d)",err);
// Get changes in device state
iDevice.QueueDeviceStateChangeNotification(iCurrentState,iStatus); // iCurrentState now holds the current device state
SetActive();
+ OstTraceFunctionExit1( CUSBTESTDEVICE_CONSTRUCTL_EXIT, this );
}
RUsbDevice& CUsbTestDevice::Device()
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_DEVICE_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_DEVICE_EXIT, this, ( TUint )&( iDevice ) );
return iDevice;
}
TUint16 CUsbTestDevice::DeviceSpec() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_DEVICESPEC_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_DEVICESPEC_EXIT, this, ( TUint16 )( iDeviceSpec ) );
return iDeviceSpec;
}
TUint16 CUsbTestDevice::ProductId() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_PRODUCTID_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_PRODUCTID_EXIT, this, ( TUint16 )( iPid ) );
return iPid;
}
TUint16 CUsbTestDevice::VendorId() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_VENDORID_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_VENDORID_EXIT, this, ( TUint16 )( iVid ) );
return iVid;
}
const TDesC16& CUsbTestDevice::SerialNumber() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_SERIALNUMBER_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_SERIALNUMBER_EXIT, this, ( TUint )&( iSerialNumber ) );
return iSerialNumber;
}
const TDesC16& CUsbTestDevice::Manufacturer() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_MANUFACTURER_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_MANUFACTURER_EXIT, this, ( TUint )&( iManufacturerString ) );
return iManufacturerString;
}
const TDesC16& CUsbTestDevice::Product() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_PRODUCT_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_PRODUCT_EXIT, this, ( TUint )&( iProductString ) );
return iProductString;
}
const TDesC16& CUsbTestDevice::ConfigurationString() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_CONFIGURATIONSTRING_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_CONFIGURATIONSTRING_EXIT, this, ( TUint )&( iConfigString ) );
return iConfigString;
}
const TUsbConfigurationDescriptor& CUsbTestDevice::ConfigurationDescriptor() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_CONFIGURATIONDESCRIPTOR_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_CONFIGURATIONDESCRIPTOR_EXIT, this, ( TUint )&( iConfigDescriptor ) );
return iConfigDescriptor;
}
const TUsbDeviceDescriptor& CUsbTestDevice::DeviceDescriptor() const
{
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_DEVICEDESCRIPTOR_ENTRY, this );
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_DEVICEDESCRIPTOR_EXIT, this, ( TUint )&( iDeviceDescriptor ) );
return iDeviceDescriptor;
}
void CUsbTestDevice::DoCancel()
{
- LOG_FUNC
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_DOCANCEL_ENTRY, this );
iDevice.CancelDeviceStateChangeNotification();
+ OstTraceFunctionExit1( CUSBTESTDEVICE_DOCANCEL_EXIT, this );
}
void CUsbTestDevice::RunL()
{
- LOG_FUNC
+ OstTraceFunctionEntry1( CUSBTESTDEVICE_RUNL_ENTRY, this );
TInt completionCode(iStatus.Int());
- RDebug::Printf("CUsbTestDevice::RunL completionCode(%d)",completionCode);
+ OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_RUNL, "CUsbTestDevice::RunL completionCode(%d)",completionCode);
if(completionCode == KErrNone)
{
@@ -441,14 +484,16 @@
iObserver.DeviceStateChangeL(iCurrentState,newState,completionCode);
iCurrentState = newState;
}
+ OstTraceFunctionExit1( CUSBTESTDEVICE_RUNL_EXIT, this );
}
TInt CUsbTestDevice::RunError(TInt aError)
{
- LOG_FUNC
+ OstTraceFunctionEntryExt( CUSBTESTDEVICE_RUNERROR_ENTRY, this );
- RDebug::Printf("<Error %d>",aError);
+ OstTrace1(TRACE_NORMAL, CUSBTESTDEVICE_RUNERROR, "<Error %d>",aError);
+ OstTraceFunctionExitExt( CUSBTESTDEVICE_RUNERROR_EXIT, this, KErrNone );
return KErrNone;
}