--- a/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/BreakController.cpp Tue Aug 31 17:01:47 2010 +0300
+++ b/usbmgmt/usbmgr/device/classdrivers/acm/classimplementation/ecacm/src/BreakController.cpp Wed Sep 01 12:35:00 2010 +0100
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 1997-2010 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
@@ -21,12 +21,12 @@
#include "HostPushedChangeObserver.h"
#include "AcmPanic.h"
#include "BreakObserver.h"
-#include "OstTraceDefinitions.h"
-#ifdef OST_TRACE_COMPILER_IN_USE
-#include "BreakControllerTraces.h"
+#include <usb/usblogger.h>
+
+#ifdef __FLOG_ACTIVE
+_LIT8(KLogComponent, "ECACM");
#endif
-
CBreakController::CBreakController(CCdcAcmClass& aParentAcm)
/**
* Constructor.
@@ -37,7 +37,6 @@
iBreakState(EInactive),
iParentAcm(aParentAcm)
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_CBREAKCONTROLLER_CONS_ENTRY );
CActiveScheduler::Add(this);
// now populate the state machine that manages the transfers between
@@ -67,7 +66,6 @@
StateDispatcher[ELocked ][EInactive ] = &ScInactive;
StateDispatcher[ELocked ][ETiming ] = &ScSetTimer;
- OstTraceFunctionExit0( CBREAKCONTROLLER_CBREAKCONTROLLER_CONS_EXIT );
}
CBreakController* CBreakController::NewL(CCdcAcmClass& aParentAcm)
@@ -78,12 +76,12 @@
* @return Ownership of a new CBreakController object.
*/
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_NEWL_ENTRY );
+ LOG_STATIC_FUNC_ENTRY
+
CBreakController* self = new(ELeave) CBreakController(aParentAcm);
CleanupStack::PushL(self);
self->ConstructL();
CLEANUPSTACK_POP(self);
- OstTraceFunctionExit0( CBREAKCONTROLLER_NEWL_EXIT );
return self;
}
@@ -92,13 +90,7 @@
* 2nd-phase constructor.
*/
{
- TInt err;
- err = iTimer.CreateLocal();
- if (err < 0)
- {
- OstTrace1( TRACE_NORMAL, CBREAKCONTROLLER_CONSTRUCTL, "CBreakController::ConstructL;err=%d", err );
- User::Leave(err);
- }
+ LEAVEIFERRORL(iTimer.CreateLocal());
}
CBreakController::~CBreakController()
@@ -106,10 +98,10 @@
* Destructor.
*/
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_CBREAKCONTROLLER_DES_ENTRY );
+ LOG_FUNC
+
Cancel();
iTimer.Close();
- OstTraceFunctionExit0( CBREAKCONTROLLER_CBREAKCONTROLLER_DES_EXIT );
}
void CBreakController::RunL()
@@ -117,8 +109,9 @@
* Called by the active scheduler; handles timer completion.
*/
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_RUNL_ENTRY );
-
+ LOG_LINE
+ LOG_FUNC
+
// check the status to see if the timer has matured, if so go straight
// to INACTIVE state (and publish new state)
if ( iStatus == KErrNone )
@@ -126,13 +119,9 @@
// Use iRequester to turn the break off. This should not fail.
TInt err = BreakRequest(iRequester, EInactive);
static_cast<void>(err);
- if (err)
- {
- OstTrace1( TRACE_FATAL, CBREAKCONTROLLER_RUNL, "CBreakController::RunL;err=%d", err );
- __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
- }
+ __ASSERT_DEBUG(!err,
+ _USB_PANIC(KAcmPanicCat, EPanicInternalError));
}
- OstTraceFunctionExit0( CBREAKCONTROLLER_RUNL_EXIT );
}
void CBreakController::DoCancel()
@@ -140,9 +129,9 @@
* Called by the framework; handles cancelling the outstanding timer request.
*/
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_DOCANCEL_ENTRY );
+ LOG_FUNC
+
iTimer.Cancel();
- OstTraceFunctionExit0( CBREAKCONTROLLER_DOCANCEL_EXIT );
}
TInt CBreakController::BreakRequest(TRequester aRequester,
@@ -158,30 +147,28 @@
* @return Error, for instance if a different entity already owns the break.
*/
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_BREAKREQUEST_ENTRY );
- OstTraceExt3( TRACE_NORMAL, CBREAKCONTROLLER_BREAKREQUEST,
- "CBreakController::BreakRequest;aRequester=%d;aState=%d;aDelay=%d", (TInt)aRequester, (TInt)aState, aDelay.Int() );
+ LOG_FUNC
+ LOGTEXT4(_L8("\taRequester = %d, aState = %d, aDelay = %d"),
+ aRequester, aState, aDelay.Int());
// Check the validity of the request.
if ( aRequester != iRequester && iRequester != ENone )
{
- OstTraceExt2( TRACE_FLOW, CBREAKCONTROLLER_BREAKREQUEST_DUP1,
- "CBreakController::BreakRequest;%d is in charge- cannot service request from %d- returning KErrInUse",
- (TInt)iRequester, (TInt)aRequester );
-
- OstTraceFunctionExit0( CBREAKCONTROLLER_BREAKREQUEST_EXIT );
+ LOGTEXT3(_L8("\t*** %d is in charge- cannot service request "
+ "from %d- returning KErrInUse"), iRequester, aRequester);
return KErrInUse;
}
iRequester = aRequester;
+
StateMachine(aState, aDelay);
+
// Reset the owner member if relevant.
if ( aState == EInactive )
{
iRequester = ENone;
}
- OstTraceFunctionExit0( CBREAKCONTROLLER_BREAKREQUEST_EXIT_DUP1 );
return KErrNone;
}
@@ -194,23 +181,20 @@
* @param aDelay Only used if going to a breaking state, the delay.
*/
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_STATEMACHINE_ENTRY );
+ LOG_FUNC
+
TBool resultOK = EFalse;
// Invoke the desired function.
PBFNT pfsDispatch = StateDispatcher[iBreakState][aBreakState];
- if (!pfsDispatch)
- {
- OstTraceExt1( TRACE_FATAL, CBREAKCONTROLLER_STATEMACHINE, "CBreakController::StateMachine;pfsDispatch=%p", (TAny*)pfsDispatch );
- __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
- }
+ __ASSERT_DEBUG(pfsDispatch,
+ _USB_PANIC(KAcmPanicCat, EPanicInternalError));
resultOK = ( *pfsDispatch )(this, aDelay);
if ( resultOK )
{
- OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_STATEMACHINE_DUP1,
- "CBreakController::StateMachine;\tbreak state dispatcher returned *SUCCESS*" );
-
+ LOGTEXT(_L8("\tbreak state dispatcher returned *SUCCESS*"));
+
// check to see if the state change will need to result
// in a modification to the public state of BREAK which is
// either NO-BREAK == EBreakInactive
@@ -230,10 +214,8 @@
}
else
{
- OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_STATEMACHINE_DUP2,
- "CBreakController::StateMachine;\tbreak state dispatcher returned *FAILURE*" );
+ LOGTEXT(_L8("\tbreak state dispatcher returned *FAILURE*"));
}
- OstTraceFunctionExit0( CBREAKCONTROLLER_STATEMACHINE_EXIT );
}
void CBreakController::Publish(TState aNewState)
@@ -244,13 +226,11 @@
* @param aNewState The next state we're about to go to.
*/
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_PUBLISH_ENTRY );
+ LOG_FUNC
+ LOGTEXT2(_L8("\taNewState = %d"), aNewState);
- if (aNewState == iBreakState)
- {
- OstTrace1( TRACE_FATAL, CBREAKCONTROLLER_PUBLISH, "CBreakController::Publish;aNewState=%d", (TInt)aNewState );
- __ASSERT_DEBUG( EFalse, User::Panic(KAcmPanicCat, EPanicInternalError) );
- }
+ __ASSERT_DEBUG(aNewState != iBreakState,
+ _USB_PANIC(KAcmPanicCat, EPanicInternalError));
// send the new BREAK state off to the USB Host
// this function is normally used so that ACMCSY can send client
@@ -267,7 +247,7 @@
// this should cause it to be toggled there.
if( iParentAcm.BreakCallback() )
{
- OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_PUBLISH_DUP1, "CBreakController::Publish;\tabout to call back break state change" );
+ LOGTEXT(_L8("\tabout to call back break state change"));
iParentAcm.BreakCallback()->BreakStateChange();
}
@@ -275,13 +255,13 @@
// we tell the MBreakObserver (ACM port) that the break has completed.
if ( aNewState == EInactive )
{
- OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_PUBLISH_DUP2, "CBreakController::Publish;\tnew state is break-inactive" );
+ LOGTEXT(_L8("\tnew state is break-inactive"));
if ( iRequester == EDevice )
{
- OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_PUBLISH_DUP3, "CBreakController::Publish;\tdevice is interested" );
+ LOGTEXT(_L8("\tdevice is interested"));
if( iParentAcm.BreakCallback() )
{
- OstTrace0( TRACE_NORMAL, CBREAKCONTROLLER_PUBLISH_DUP4, "CBreakController::Publish;\tabout to call back break completion" );
+ LOGTEXT(_L8("\tabout to call back break completion"));
iParentAcm.BreakCallback()->BreakRequestCompleted();
}
}
@@ -289,7 +269,6 @@
// We just got to break-inactive state. Blank the requester record.
iRequester = ENone;
}
- OstTraceFunctionExit0( CBREAKCONTROLLER_PUBLISH_EXIT );
}
/**
@@ -302,17 +281,18 @@
TBool CBreakController::ScInvalid(CBreakController *aThis,
TTimeIntervalMicroSeconds32 aDelay)
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_SCINVALID_ENTRY );
+ LOG_STATIC_FUNC_ENTRY
+
static_cast<void>(aThis); // remove warning
static_cast<void>(aDelay); // remove warning
- OstTraceFunctionExit0( CBREAKCONTROLLER_SCINVALID_EXIT );
+
return( EFalse );
}
TBool CBreakController::ScInactive(CBreakController *aThis,
TTimeIntervalMicroSeconds32 aDelay)
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_SCINACTIVE_ENTRY );
+ LOG_STATIC_FUNC_ENTRY
static_cast<void>(aDelay); // remove warning
@@ -322,19 +302,17 @@
aThis->iParentAcm.SetBreakActive(EFalse);
- OstTraceFunctionExit0( CBREAKCONTROLLER_SCINACTIVE_EXIT );
return( ETrue );
}
TBool CBreakController::ScSetTimer(CBreakController *aThis,
TTimeIntervalMicroSeconds32 aDelay)
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_SCSETTIMER_ENTRY );
+ LOG_STATIC_FUNC_ENTRY
// don't try to set any delay if the caller wants something impossible
if ( aDelay.Int() <= 0 )
{
- OstTraceFunctionExit0( CBREAKCONTROLLER_SCSETTIMER_EXIT );
return( EFalse );
}
@@ -345,14 +323,14 @@
aThis->iParentAcm.SetBreakActive(ETrue);
- OstTraceFunctionExit0( CBREAKCONTROLLER_SCSETTIMER_EXIT_DUP1 );
return( ETrue );
}
TBool CBreakController::ScLocked(CBreakController *aThis,
TTimeIntervalMicroSeconds32 aDelay)
{
- OstTraceFunctionEntry0( CBREAKCONTROLLER_SCLOCKED_ENTRY );
+ LOG_STATIC_FUNC_ENTRY
+
static_cast<void>(aDelay); // remove warning
// this may have been called while a BREAK is already current, so cancel
@@ -361,7 +339,6 @@
aThis->iParentAcm.SetBreakActive(ETrue);
- OstTraceFunctionExit0( CBREAKCONTROLLER_SCLOCKED_EXIT );
return( ETrue );
}