--- a/kernel/eka/drivers/usbcc/chapter9.cpp Thu Aug 19 11:14:22 2010 +0300
+++ b/kernel/eka/drivers/usbcc/chapter9.cpp Tue Aug 31 16:34:26 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2000-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"
@@ -23,6 +23,11 @@
*/
#include <drivers/usbc.h>
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "chapter9Traces.h"
+#endif
+
//#define ENABLE_EXCESSIVE_DEBUG_OUTPUT
@@ -61,7 +66,8 @@
*/
TUsbcEp0State DUsbClientController::EnquireEp0NextState(const TUint8* aSetupBuf) const
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::EnquireEp0NextState()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_ENQUIREEP0NEXTSTATE,
+ "DUsbClientController::EnquireEp0NextState()" );
// This function may be called by the PSL from within an ISR -- so we have
// to take care what we do here (and also in all functions that get called
@@ -69,17 +75,21 @@
if (SWAP_BYTES_16((reinterpret_cast<const TUint16*>(aSetupBuf)[3])) == 0) // iLength
{
- __KTRACE_OPT(KUSB, Kern::Printf(" --> EEp0StateStatusIn"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_ENQUIREEP0NEXTSTATE_DUP1,
+ " --> EEp0StateStatusIn" );
+
return EEp0StateStatusIn; // No-data Control => Status_IN
}
else if ((aSetupBuf[0] & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" --> EEp0StateDataOut"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_ENQUIREEP0NEXTSTATE_DUP2,
+ " --> EEp0StateDataOut" );
return EEp0StateDataOut; // Control Write => Data_OUT
}
else
{
- __KTRACE_OPT(KUSB, Kern::Printf(" --> EEp0StateDataIn"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_ENQUIREEP0NEXTSTATE_DUP3,
+ " --> EEp0StateDataIn" );
return EEp0StateDataIn; // Control Read => Data_IN
}
}
@@ -87,7 +97,8 @@
TInt DUsbClientController::ProcessEp0ReceiveDone(TInt aCount)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessEp0ReceiveDone()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0RECEIVEDONE,
+ "DUsbClientController::ProcessEp0ReceiveDone()" );
TInt r;
if (iEp0DataReceiving == EFalse)
{
@@ -111,7 +122,8 @@
TInt DUsbClientController::ProcessEp0TransmitDone(TInt aCount, TInt aError)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessEp0TransmitDone()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0TRANSMITDONE,
+ "DUsbClientController::ProcessEp0TransmitDone()" );
// In any case: there's now no longer a write pending
iEp0WritePending = EFalse;
// If it was a client who set up this transmission, we report to that client
@@ -127,7 +139,8 @@
ProcessDataTransferDone(*p);
return KErrNone;
}
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: DUsbClientController::ProcessEpTransmitDone: Stalling Ep0"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0TRANSMITDONE_DUP1,
+ " Error: DUsbClientController::ProcessEpTransmitDone: Stalling Ep0" );
StallEndpoint(KEp0_In); // request not found
return KErrNotFound;
}
@@ -135,18 +148,10 @@
return KErrNone;
}
-
-#define USB_PROCESS_REQUEST(request) \
- if (Process ## request(packet) != KErrNone) \
- { \
- __KTRACE_OPT(KUSB, \
- Kern::Printf(" ProcessEp0SetupReceived: Stalling Ep0")); \
- StallEndpoint(KEp0_In); \
- }
-
TInt DUsbClientController::ProcessEp0SetupReceived(TInt aCount)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessEp0SetupReceived()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED,
+ "DUsbClientController::ProcessEp0SetupReceived()" );
if (aCount > iEp0MaxPacketSize)
{
@@ -160,69 +165,73 @@
#if defined(_DEBUG) && defined(ENABLE_EXCESSIVE_DEBUG_OUTPUT)
// let's see what we've got:
- __KTRACE_OPT(KUSB, Kern::Printf(" bmRequestType = 0x%02x", packet.iRequestType));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP1,
+ " bmRequestType = 0x%02x", packet.iRequestType );
if ((packet.iRequestType & KUsbRequestType_TypeMask) == KUsbRequestType_TypeStd)
{
switch (packet.iRequest)
{
case KUsbRequest_GetStatus:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (GET_STATUS)",
- KUsbRequest_GetStatus));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP2,
+ " bRequest = 0x%02x (GET_STATUS)", KUsbRequest_GetStatus );
break;
case KUsbRequest_ClearFeature:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (CLEAR_FEATURE)",
- KUsbRequest_ClearFeature));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP3,
+ " bRequest = 0x%02x (CLEAR_FEATURE)", KUsbRequest_ClearFeature );
break;
case KUsbRequest_SetFeature:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (SET_FEATURE)",
- KUsbRequest_SetFeature));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP4,
+ " bRequest = 0x%02x (SET_FEATURE)", KUsbRequest_SetFeature );
break;
case KUsbRequest_SetAddress:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (SET_ADDRESS)",
- KUsbRequest_SetAddress));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP5,
+ " bRequest = 0x%02x (SET_ADDRESS)", KUsbRequest_SetAddress );
break;
case KUsbRequest_GetDescriptor:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (GET_DESCRIPTOR)",
- KUsbRequest_GetDescriptor));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP6,
+ " bRequest = 0x%02x (GET_DESCRIPTOR)", KUsbRequest_GetDescriptor );
break;
case KUsbRequest_SetDescriptor:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (SET_DESCRIPTOR)",
- KUsbRequest_SetDescriptor));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP7,
+ " bRequest = 0x%02x (SET_DESCRIPTOR)", KUsbRequest_SetDescriptor );
break;
case KUsbRequest_GetConfig:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (GET_CONFIGURATION)",
- KUsbRequest_GetConfig));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP8,
+ " bRequest = 0x%02x (GET_CONFIGURATION)", KUsbRequest_GetConfig );
break;
case KUsbRequest_SetConfig:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (SET_CONFIGURATION)",
- KUsbRequest_SetConfig));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP9,
+ " bRequest = 0x%02x (SET_CONFIGURATION)", KUsbRequest_SetConfig );
break;
case KUsbRequest_GetInterface:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (GET_INTERFACE)",
- KUsbRequest_GetInterface));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP10,
+ " bRequest = 0x%02x (GET_INTERFACE)", KUsbRequest_GetInterface );
break;
case KUsbRequest_SetInterface:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (SET_INTERFACE)",
- KUsbRequest_SetInterface));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP11,
+ " bRequest = 0x%02x (SET_INTERFACE)", KUsbRequest_SetInterface );
break;
case KUsbRequest_SynchFrame:
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (SYNCH_FRAME)",
- KUsbRequest_SynchFrame));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP12,
+ " bRequest = 0x%02x (SYNCH_FRAME)", KUsbRequest_SynchFrame );
break;
default:
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: bRequest = 0x%02x (UNKNWON STANDARD REQUEST)",
- packet.iRequest));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP13,
+ " Error: bRequest = 0x%02x (UNKNWON STANDARD REQUEST)", packet.iRequest );
break;
}
}
else
{
- __KTRACE_OPT(KUSB, Kern::Printf(" bRequest = 0x%02x (NON-STANDARD REQUEST)",
- packet.iRequest));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP14,
+ " bRequest = 0x%02x (NON-STANDARD REQUEST)", packet.iRequest );
}
- __KTRACE_OPT(KUSB, Kern::Printf(" wValue = 0x%04x", packet.iValue));
- __KTRACE_OPT(KUSB, Kern::Printf(" wIndex = 0x%04x", packet.iIndex));
- __KTRACE_OPT(KUSB, Kern::Printf(" wLength = 0x%04x", packet.iLength));
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP15,
+ " wValue = 0x%04x", packet.iValue );
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP16,
+ " wIndex = 0x%04x", packet.iIndex );
+ OstTraceDef1( OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP17,
+ " wLength = 0x%04x", packet.iLength );
#endif // defined(_DEBUG) && defined(ENABLE_EXCESSIVE_DEBUG_OUTPUT)
// now the actual analysis
@@ -235,18 +244,34 @@
switch (packet.iRequestType & KUsbRequestType_DestMask)
{ // Recipient
case KUsbRequestType_DestDevice:
- USB_PROCESS_REQUEST(GetDeviceStatus);
+ if (ProcessGetDeviceStatus(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP18,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequestType_DestIfc:
- USB_PROCESS_REQUEST(GetInterfaceStatus);
+ if (ProcessGetInterfaceStatus(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP19,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequestType_DestEp:
- USB_PROCESS_REQUEST(GetEndpointStatus);
+ if (ProcessGetEndpointStatus(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP20,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
default:
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: GET STATUS - Other or Unknown recipient"));
- __KTRACE_OPT(KPANIC, Kern::Printf(" -> DUsbClientController::ProcessEp0SetupReceived: "
- "Stalling Ep0"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP21,
+ " Error: GET STATUS - Other or Unknown recipient" );
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP22,
+ " -> DUsbClientController::ProcessEp0SetupReceived: Stalling Ep0" );
StallEndpoint(KEp0_In);
break;
}
@@ -256,49 +281,107 @@
switch (packet.iRequestType & KUsbRequestType_DestMask)
{ // Recipient
case KUsbRequestType_DestDevice:
- USB_PROCESS_REQUEST(SetClearDevFeature);
+ if (ProcessSetClearDevFeature(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP23,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequestType_DestIfc:
- USB_PROCESS_REQUEST(SetClearIfcFeature);
+ if (ProcessSetClearIfcFeature(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP24,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequestType_DestEp:
- USB_PROCESS_REQUEST(SetClearEpFeature);
+ if (ProcessSetClearEpFeature(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP25,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
default:
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: SET/CLEAR FEATURE - "
- "Other or Unknown recipient"));
- __KTRACE_OPT(KPANIC, Kern::Printf(" -> Stalling Ep0"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP26,
+ " Error: SET/CLEAR FEATURE - Other or Unknown recipient" );
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP27,
+ " -> Stalling Ep0" );
StallEndpoint(KEp0_In);
break;
}
break;
case KUsbRequest_SetAddress:
- USB_PROCESS_REQUEST(SetAddress);
+ if (ProcessSetAddress(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP28,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequest_GetDescriptor:
- USB_PROCESS_REQUEST(GetDescriptor);
+ if (ProcessGetDescriptor(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP29,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequest_SetDescriptor:
- USB_PROCESS_REQUEST(SetDescriptor);
+ if (ProcessSetDescriptor(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP30,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequest_GetConfig:
- USB_PROCESS_REQUEST(GetConfiguration);
+ if (ProcessGetConfiguration(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP31,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequest_SetConfig:
- USB_PROCESS_REQUEST(SetConfiguration);
+ if (ProcessSetConfiguration(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP32,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequest_GetInterface:
- USB_PROCESS_REQUEST(GetInterface);
+ if (ProcessGetInterface(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP33,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequest_SetInterface:
- USB_PROCESS_REQUEST(SetInterface);
+ if (ProcessSetInterface(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP34,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
case KUsbRequest_SynchFrame:
- USB_PROCESS_REQUEST(SynchFrame);
+ if (ProcessSynchFrame(packet) != KErrNone)
+ {
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP35,
+ "ProcessEp0SetupReceived: Stalling Ep0" );
+ StallEndpoint(KEp0_In);
+ }
break;
default:
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Unknown/unsupported Std Setup Request"));
- __KTRACE_OPT(KPANIC, Kern::Printf(" -> Stalling Ep0"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP36,
+ " Error: Unknown/unsupported Std Setup Request" );
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP37,
+ " -> Stalling Ep0" );
StallEndpoint(KEp0_In);
break;
}
@@ -321,7 +404,8 @@
}
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateConfigured)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP38,
+ " Error: Invalid device state" );
}
else
{
@@ -334,7 +418,8 @@
{
if (ifcset_ptr->CurrentInterface()->iNoEp0Requests)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Recipient says: NoEp0RequestsPlease"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP39,
+ " Recipient says: NoEp0RequestsPlease" );
}
else
{
@@ -343,8 +428,8 @@
}
else
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Interface 0x%02x does not exist",
- packet.iIndex));
+ OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP40,
+ " Error: Interface 0x%02x does not exist", packet.iIndex );
}
}
if (NKern::CurrentContext() == EThread)
@@ -360,12 +445,13 @@
}
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateConfigured)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP41,
+ " Error: Invalid device state" );
}
else if (EndpointExists(packet.iIndex) == EFalse)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint 0x%02x does not exist",
- packet.iIndex));
+ OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP42,
+ " Error: Endpoint 0x%02x does not exist", packet.iIndex );
}
else
{
@@ -374,7 +460,8 @@
iRealEndpoints[idx].iLEndpoint->iInterface->iInterfaceSet;
if (ifcset_ptr->CurrentInterface()->iNoEp0Requests)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Recipient says: NoEp0RequestsPlease"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP43,
+ " Recipient says: NoEp0RequestsPlease" );
}
else
{
@@ -387,7 +474,8 @@
}
break;
default:
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Other or Unknown recipient"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP44,
+ " Error: Other or Unknown recipient" );
break;
}
if (client != NULL)
@@ -401,13 +489,15 @@
{
__ASSERT_DEBUG((p->iEndpointNum == 0), Kern::Fault(KUsbPILPanicCat, __LINE__));
__ASSERT_DEBUG((p->iTransferDir == EControllerRead), Kern::Fault(KUsbPILPanicCat, __LINE__));
- __KTRACE_OPT(KUSB, Kern::Printf(" Found Ep0 read request"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP45,
+ " Found Ep0 read request" );
if (packet.iLength != 0)
{
if ((packet.iRequestType & KUsbRequestType_DirMask) == KUsbRequestType_DirToDev)
{
// Data transfer & direction OUT => there'll be a DATA_OUT stage
- __KTRACE_OPT(KUSB, Kern::Printf(" Next is DATA_OUT: setting up DataOutVars"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP46,
+ " Next is DATA_OUT: setting up DataOutVars" );
SetEp0DataOutVars(packet, client);
}
else if ((packet.iRequestType & KUsbRequestType_DirMask) == KUsbRequestType_DirToHost)
@@ -425,14 +515,16 @@
return KErrNone;
}
}
- __KTRACE_OPT(KUSB, Kern::Printf(" Ep0 read request not found: setting RxExtra vars (Setup)"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP47,
+ " Ep0 read request not found: setting RxExtra vars (Setup)" );
iEp0_RxExtraCount = aCount;
iEp0_RxExtraData = ETrue;
return KErrNotFound;
}
else // if (client == NULL)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Ep0 request error: Stalling Ep0"));
+ OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0SETUPRECEIVED_DUP48,
+ " Ep0 request error: Stalling Ep0" );
StallEndpoint(KEp0_In);
return KErrGeneral;
}
@@ -440,18 +532,16 @@
return KErrNone;
}
-#undef USB_PROCESS_REQUEST
-
-
TInt DUsbClientController::ProcessEp0DataReceived(TInt aCount)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessEp0DataReceived()"));
-
- __KTRACE_OPT(KUSB, Kern::Printf(" : %d bytes", aCount));
-
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSEP0DATARECEIVED,
+ "DUsbClientController::ProcessEp0DataReceived()" );
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0DATARECEIVED_DUP1,
+ " : %d bytes", aCount );
if (aCount > iEp0MaxPacketSize)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Too much data"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0DATARECEIVED_DUP2,
+ " Error: Too much data" );
aCount = iEp0MaxPacketSize;
}
iEp0DataReceived += aCount;
@@ -467,8 +557,10 @@
break;
#endif
default:
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: invalid request in iSetup"));
- __KTRACE_OPT(KPANIC, Kern::Printf(" -> DUsbClientController::ProcessEp0DataReceived: Stalling Ep0"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0DATARECEIVED_DUP3,
+ " Error: invalid request in iSetup" );
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSEP0DATARECEIVED_DUP4,
+ " -> DUsbClientController::ProcessEp0DataReceived: Stalling Ep0" );
StallEndpoint(KEp0_In);
ResetEp0DataOutVars();
break;
@@ -485,7 +577,8 @@
{
__ASSERT_DEBUG((p->iEndpointNum == 0), Kern::Fault(KUsbPILPanicCat, __LINE__));
__ASSERT_DEBUG((p->iTransferDir == EControllerRead), Kern::Fault(KUsbPILPanicCat, __LINE__));
- __KTRACE_OPT(KUSB, Kern::Printf(" Found Ep0 read request"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0DATARECEIVED_DUP5,
+ " Found Ep0 read request" );
memcpy(p->iBufferStart, iEp0_RxBuf, aCount);
p->iError = KErrNone; // if it wasn't 'KErrNone' we wouldn't be here
*(p->iPacketSize) = aCount;
@@ -495,7 +588,8 @@
goto found;
}
}
- __KTRACE_OPT(KUSB, Kern::Printf(" Ep0 read request not found: setting RxExtra vars (Data)"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSEP0DATARECEIVED_DUP6,
+ " Ep0 read request not found: setting RxExtra vars (Data)" );
iEp0_RxExtraCount = aCount;
iEp0_RxExtraData = ETrue;
iEp0DataReceived -= aCount;
@@ -515,15 +609,18 @@
TInt DUsbClientController::ProcessGetDeviceStatus(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetDeviceStatus()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSGETDEVICESTATUS,
+ "DUsbClientController::ProcessGetDeviceStatus()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateAddress)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETDEVICESTATUS_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
const TUint16 status = ((DeviceSelfPowered() ? KUsbDevStat_SelfPowered : 0) |
(iRmWakeupStatus_Enabled ? KUsbDevStat_RemoteWakeup : 0));
- __KTRACE_OPT(KUSB, Kern::Printf(" Reporting device status: 0x%02x", status));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETDEVICESTATUS_DUP2,
+ " Reporting device status: 0x%02x", status );
*reinterpret_cast<TUint16*>(iEp0_TxBuf) = SWAP_BYTES_16(status);
if (SetupEndpointZeroWrite(iEp0_TxBuf, sizeof(status)) == KErrNone)
{
@@ -535,19 +632,23 @@
TInt DUsbClientController::ProcessGetInterfaceStatus(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetInterfaceStatus()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACESTATUS,
+ "DUsbClientController::ProcessGetInterfaceStatus()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateConfigured)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACESTATUS_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
if (InterfaceExists(aPacket.iIndex) == EFalse)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Interface does not exist"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACESTATUS_DUP2,
+ " Error: Interface does not exist" );
return KErrGeneral;
}
const TUint16 status = 0x0000; // as of USB Spec 2.0
- __KTRACE_OPT(KUSB, Kern::Printf(" Reporting interface status: 0x%02x", status));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACESTATUS_DUP3,
+ " Reporting interface status: 0x%02x", status );
*reinterpret_cast<TUint16*>(iEp0_TxBuf) = SWAP_BYTES_16(status);
if (SetupEndpointZeroWrite(iEp0_TxBuf, sizeof(status)) == KErrNone)
{
@@ -559,23 +660,26 @@
TInt DUsbClientController::ProcessGetEndpointStatus(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetEndpointStatus()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSGETENDPOINTSTATUS,
+ "DUsbClientController::ProcessGetEndpointStatus()" );
if (iTrackDeviceState &&
((iDeviceState < EUsbcDeviceStateAddress) ||
(iDeviceState == EUsbcDeviceStateAddress && (aPacket.iIndex & KUsbEpAddress_Portmask) != 0)))
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETENDPOINTSTATUS_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
if (EndpointExists(aPacket.iIndex) == EFalse)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint does not exist"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETENDPOINTSTATUS_DUP2,
+ " Error: Endpoint does not exist" );
return KErrGeneral;
}
const TInt ep = EpAddr2Idx(aPacket.iIndex);
const TUint16 status = (iRealEndpoints[ep].iHalt) ? KUsbEpStat_Halt : 0;
- __KTRACE_OPT(KUSB, Kern::Printf(" Reporting endpoint status 0x%02x for real endpoint %d",
- status, ep));
+ OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETENDPOINTSTATUS_DUP3,
+ " Reporting endpoint status 0x%02x for real endpoint %d", status, ep );
*reinterpret_cast<TUint16*>(iEp0_TxBuf) = SWAP_BYTES_16(status);
if (SetupEndpointZeroWrite(iEp0_TxBuf, 2) == KErrNone)
{
@@ -587,10 +691,12 @@
TInt DUsbClientController::ProcessSetClearDevFeature(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetClearDevFeature()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE,
+ "DUsbClientController::ProcessSetClearDevFeature()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateDefault)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
@@ -603,7 +709,8 @@
case KUsbFeature_RemoteWakeup:
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateAddress)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP2,
+ " Error: Invalid device state" );
return KErrGeneral;
}
iRmWakeupStatus_Enabled = ETrue;
@@ -611,30 +718,35 @@
case KUsbFeature_TestMode:
if (!iHighSpeed)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Request only supported in High-Speed mode"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP3,
+ " Error: Request only supported in High-Speed mode" );
return KErrGeneral;
}
if (LowByte(aPacket.iIndex) != 0)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Lower byte of wIndex must be zero"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP4,
+ " Error: Lower byte of wIndex must be zero" );
return KErrGeneral;
}
test_sel = HighByte(aPacket.iIndex);
if ((test_sel < KUsbTestSelector_Test_J) || (test_sel > KUsbTestSelector_Test_Force_Enable))
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid test selector: %d", test_sel));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP5,
+ " Error: Invalid test selector: %d", test_sel );
return KErrGeneral;
}
break;
case KUsbFeature_B_HnpEnable:
if (!iOtgSupport)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Request only supported on a OTG device"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP6,
+ " Error: Request only supported on a OTG device" );
return KErrGeneral;
}
if (!(iOtgFuncMap & KUsbOtgAttr_HnpSupp))
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Request only valid if OTG device supports HNP"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP7,
+ " Error: Request only valid if OTG device supports HNP" );
return KErrGeneral;
}
iOtgFuncMap |= KUsbOtgAttr_B_HnpEnable;
@@ -643,12 +755,14 @@
case KUsbFeature_A_HnpSupport:
if (!iOtgSupport)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Request only supported on a OTG device"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP8,
+ " Error: Request only supported on a OTG device" );
return KErrGeneral;
}
if (!(iOtgFuncMap & KUsbOtgAttr_HnpSupp))
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Request only valid if OTG device supports HNP"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP9,
+ " Error: Request only valid if OTG device supports HNP" );
return KErrGeneral;
}
iOtgFuncMap |= KUsbOtgAttr_A_HnpSupport;
@@ -657,19 +771,22 @@
case KUsbFeature_A_AltHnpSupport:
if (!iOtgSupport)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Request only supported on a OTG device"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP10,
+ " Error: Request only supported on a OTG device" );
return KErrGeneral;
}
if (!(iOtgFuncMap & KUsbOtgAttr_HnpSupp))
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Request only valid if OTG device supports HNP"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP11,
+ " Error: Request only valid if OTG device supports HNP" );
return KErrGeneral;
}
iOtgFuncMap |= KUsbOtgAttr_A_AltHnpSupport;
OtgFeaturesNotify();
break;
default:
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Unknown feature requested"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP12,
+ " Error: Unknown feature requested" );
return KErrGeneral;
}
}
@@ -680,13 +797,15 @@
case KUsbFeature_RemoteWakeup:
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateAddress)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP13,
+ " Error: Invalid device state" );
return KErrGeneral;
}
iRmWakeupStatus_Enabled = EFalse;
break;
default:
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Unknown feature requested"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP14,
+ " Error: Unknown feature requested" );
return KErrGeneral;
}
}
@@ -697,7 +816,8 @@
// after the status stage of the request."
if (test_sel)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Entering HS Test Mode %d", test_sel));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARDEVFEATURE_DUP15,
+ " Entering HS Test Mode %d", test_sel );
EnterTestMode(test_sel);
}
@@ -707,10 +827,12 @@
TInt DUsbClientController::ProcessSetClearIfcFeature(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetClearIfcFeature()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSSETCLEARIFCFEATURE,
+ "DUsbClientController::ProcessSetClearIfcFeature()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateConfigured)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEARIFCFEATURE_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
// No interface features defined in USB spec, thus
@@ -720,29 +842,34 @@
TInt DUsbClientController::ProcessSetClearEpFeature(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetClearEpFeature()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSSETCLEAREPFEATURE,
+ "DUsbClientController::ProcessSetClearEpFeature()" );
if (iTrackDeviceState &&
((iDeviceState < EUsbcDeviceStateAddress) ||
(iDeviceState == EUsbcDeviceStateAddress && (aPacket.iIndex & KUsbEpAddress_Portmask) != 0)))
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEAREPFEATURE_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
if (aPacket.iValue != KUsbFeature_EndpointHalt)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Unknown feature requested"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEAREPFEATURE_DUP2,
+ " Error: Unknown feature requested" );
return KErrGeneral;
}
if (EndpointExists(aPacket.iIndex) == EFalse)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint does not exist"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEAREPFEATURE_DUP3,
+ " Error: Endpoint does not exist" );
return KErrGeneral;
}
const TInt ep = EpAddr2Idx(aPacket.iIndex);
if (iRealEndpoints[ep].iLEndpoint->iInfo.iType == KUsbEpTypeControl ||
iRealEndpoints[ep].iLEndpoint->iInfo.iType == KUsbEpTypeIsochronous)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint is Control or Isochronous"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCLEAREPFEATURE_DUP4,
+ " Error: Endpoint is Control or Isochronous" );
return KErrGeneral;
}
SetClearHaltFeature(ep, aPacket.iRequest);
@@ -753,16 +880,19 @@
TInt DUsbClientController::ProcessSetAddress(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetAddress()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSSETADDRESS,
+ "DUsbClientController::ProcessSetAddress()" );
if (iTrackDeviceState && iDeviceState > EUsbcDeviceStateAddress)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETADDRESS_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
const TUint16 addr = aPacket.iValue;
if (addr > 127)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Bad address value: %d (>127)", addr));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETADDRESS_DUP2,
+ " Error: Bad address value: %d (>127)", addr );
return KErrGeneral;
}
if (addr == 0)
@@ -770,7 +900,8 @@
// Enter Default state (from Default or Address)
NextDeviceState(EUsbcDeviceStateDefault);
}
- __KTRACE_OPT(KUSB, Kern::Printf(" USB address: %d", addr));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSSETADDRESS_DUP3,
+ " USB address: %d", addr );
// The spec says, under section 9.4.6:
// "Stages after the initial Setup packet assume the same device address as the Setup packet. The USB
// device does not change its device address until after the Status stage of this request is completed
@@ -785,10 +916,12 @@
TInt DUsbClientController::ProcessGetDescriptor(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetDescriptor()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSGETDESCRIPTOR,
+ "DUsbClientController::ProcessGetDescriptor()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateDefault)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETDESCRIPTOR_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
@@ -804,16 +937,18 @@
if ((result != KErrNone) || (size == 0))
{
// This doesn't have to be an error - protocol-wise it's OK.
- __KTRACE_OPT(KUSB, Kern::Printf(" Couldn't retrieve descriptor"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETDESCRIPTOR_DUP2,
+ " Couldn't retrieve descriptor" );
return KErrGeneral;
}
- __KTRACE_OPT(KUSB, Kern::Printf(" Descriptor found, size: %d (requested: %d)",
- size, aPacket.iLength));
+ OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETDESCRIPTOR_DUP3,
+ " Descriptor found, size: %d (requested: %d)", size, aPacket.iLength );
if (size > KUsbcBufSz_Ep0Tx)
{
// This should actually not be possible (i.e. we should never get here).
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Ep0_Tx buffer too small"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETDESCRIPTOR_DUP4,
+ " Error: Ep0_Tx buffer too small" );
}
if (size > aPacket.iLength)
{
@@ -822,10 +957,8 @@
}
#ifdef ENABLE_EXCESSIVE_DEBUG_OUTPUT
- __KTRACE_OPT(KUSB,
- Kern::Printf(" Data: 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x 0x%02x ...",
- iEp0_TxBuf[0], iEp0_TxBuf[1], iEp0_TxBuf[2], iEp0_TxBuf[3],
- iEp0_TxBuf[4], iEp0_TxBuf[5], iEp0_TxBuf[6], iEp0_TxBuf[7]));
+ OstTraceDefExt1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETDESCRIPTOR_DUP5,
+ " Data: %{uint8[]}", TOstArray<TUint8>(iEp0_TxBuf, 8) );
#endif
// If we're about to send less bytes than expected by the host AND our number is a
// multiple of the packet size, in order to indicate the end of the control transfer,
@@ -842,7 +975,8 @@
TInt DUsbClientController::ProcessSetDescriptor(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetDescriptor()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSSETDESCRIPTOR,
+ "DUsbClientController::ProcessSetDescriptor()" );
#ifndef USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
return KErrGeneral;
#else
@@ -854,7 +988,8 @@
if (aPacket.iLength > KUsbcBufSz_Ep0Rx)
{
// Error: Our Rx buffer is too small! (Raise a defect to make it larger)
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Ep0_Rx buffer too small"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETDESCRIPTOR_DUP1,
+ " Error: Ep0_Rx buffer too small" );
return KErrGeneral;
}
SetEp0DataOutVars(aPacket);
@@ -866,27 +1001,33 @@
TInt DUsbClientController::ProcessGetConfiguration(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetConfiguration()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSGETCONFIGURATION,
+ "DUsbClientController::ProcessGetConfiguration()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateAddress)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETCONFIGURATION_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
if (iTrackDeviceState && iDeviceState == EUsbcDeviceStateAddress && iCurrentConfig != 0)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: DeviceState Address && Config != 0"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETCONFIGURATION_DUP2,
+ " Error: DeviceState Address && Config != 0" );
return KErrGeneral;
}
if (iTrackDeviceState && iDeviceState == EUsbcDeviceStateConfigured && iCurrentConfig == 0)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: DeviceState Configured && Config == 0"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETCONFIGURATION_DUP3,
+ " Error: DeviceState Configured && Config == 0" );
return KErrGeneral;
}
if (aPacket.iLength != 1) // "unspecified behavior"
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Warning: wLength != 1 (= %d)", aPacket.iLength));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETCONFIGURATION_DUP4,
+ " Warning: wLength != 1 (= %d)", aPacket.iLength );
}
- __KTRACE_OPT(KUSB, Kern::Printf(" Reporting configuration value %d", iCurrentConfig));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETCONFIGURATION_DUP5,
+ " Reporting configuration value %d", iCurrentConfig );
if (SetupEndpointZeroWrite(&iCurrentConfig, sizeof(iCurrentConfig)) == KErrNone)
{
iEp0WritePending = ETrue;
@@ -906,32 +1047,36 @@
*/
TInt DUsbClientController::ProcessSetConfiguration(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetConfiguration()"));
-
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSSETCONFIGURATION,
+ "DUsbClientController::ProcessSetConfiguration()" );
// This function may be called by the PSL from within an ISR -- so we have
// to take care what we do here (and also in all functions that get called
// from here).
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateAddress)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCONFIGURATION_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
const TUint16 value = aPacket.iValue;
if (value > 1) // we support only one configuration
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Configuration value too large: %d", value));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETCONFIGURATION_DUP2,
+ " Error: Configuration value too large: %d", value );
return KErrGeneral;
}
- __KTRACE_OPT(KUSB, Kern::Printf(" Configuration value: %d", value));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSSETCONFIGURATION_DUP3,
+ " Configuration value: %d", value );
ChangeConfiguration(value);
// In 9.4.5 under GET_STATUS we read, that after SET_CONFIGURATION the HALT feature
// for all endpoints is reset to zero.
TInt num = 0;
(TAny) DoForEveryEndpointInUse(&DUsbClientController::ClearHaltFeature, num);
- __KTRACE_OPT(KUSB, Kern::Printf(" Called ClearHaltFeature() for %d endpoints", num));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSSETCONFIGURATION_DUP4,
+ " Called ClearHaltFeature() for %d endpoints", num );
SendEp0ZeroByteStatusPacket(); // success: zero bytes data during status stage
return KErrNone;
}
@@ -939,27 +1084,32 @@
TInt DUsbClientController::ProcessGetInterface(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessGetInterface()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACE,
+ "DUsbClientController::ProcessGetInterface()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateConfigured)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACE_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
if (iCurrentConfig == 0)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Device not configured"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACE_DUP2,
+ " Error: Device not configured" );
return KErrGeneral;
}
const TInt number = aPacket.iIndex;
if (!InterfaceExists(number))
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Bad interface index: %d", number));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACE_DUP3,
+ " Error: Bad interface index: %d", number );
return KErrGeneral;
}
// Send alternate setting code of iCurrentInterface of Interface(set) <number> of the current
// config (iCurrentConfig).
const TUint8 setting = InterfaceNumber2InterfacePointer(number)->iCurrentInterface;
- __KTRACE_OPT(KUSB, Kern::Printf(" Reporting interface setting %d", setting));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSGETINTERFACE_DUP4,
+ " Reporting interface setting %d", setting );
if (SetupEndpointZeroWrite(&setting, 1) == KErrNone)
{
iEp0WritePending = ETrue;
@@ -970,21 +1120,25 @@
TInt DUsbClientController::ProcessSetInterface(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSetInterface()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSSETINTERFACE,
+ "DUsbClientController::ProcessSetInterface()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateConfigured)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETINTERFACE_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
if (iCurrentConfig == 0)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Device not configured"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETINTERFACE_DUP2,
+ " Error: Device not configured" );
return KErrGeneral;
}
const TInt number = aPacket.iIndex;
if (!InterfaceExists(number))
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Bad interface index: %d", number));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETINTERFACE_DUP3,
+ " Error: Bad interface index: %d", number );
return KErrGeneral;
}
const TInt setting = aPacket.iValue;
@@ -992,10 +1146,12 @@
RPointerArray<TUsbcInterface>& ifcs = ifcset_ptr->iInterfaces;
if (setting >= ifcs.Count())
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Alt Setting >= bNumAltSettings: %d", setting));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSETINTERFACE_DUP4,
+ " Error: Alt Setting >= bNumAltSettings: %d", setting );
return KErrGeneral;
}
- __KTRACE_OPT(KUSB, Kern::Printf(" Interface setting:: %d", setting));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_PROCESSSETINTERFACE_DUP5,
+ " Interface setting:: %d", setting );
// Set iCurrentInterface of Interface(set) <number> of the current config
// (iCurrentConfig) to alternate setting <setting>.
ChangeInterface(ifcs[setting]);
@@ -1015,21 +1171,25 @@
TInt DUsbClientController::ProcessSynchFrame(const TUsbcSetup& aPacket)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProcessSynchFrame()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCESSSYNCHFRAME,
+ "DUsbClientController::ProcessSynchFrame()" );
if (iTrackDeviceState && iDeviceState < EUsbcDeviceStateConfigured)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Invalid device state"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSYNCHFRAME_DUP1,
+ " Error: Invalid device state" );
return KErrGeneral;
}
const TInt ep = aPacket.iIndex;
if (EndpointExists(ep) == EFalse)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint does not exist"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSYNCHFRAME_DUP2,
+ " Error: Endpoint does not exist" );
return KErrGeneral;
}
if (iRealEndpoints[EpAddr2Idx(ep)].iLEndpoint->iInfo.iType != KUsbEpTypeIsochronous)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint is not isochronous"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_PROCESSSYNCHFRAME_DUP3,
+ " Error: Endpoint is not isochronous" );
return KErrGeneral;
}
// We always send 0:
@@ -1045,7 +1205,8 @@
#ifdef USB_SUPPORTS_SET_DESCRIPTOR_REQUEST
void DUsbClientController::ProceedSetDescriptor()
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ProceedSetDescriptor()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_PROCEEDSETDESCRIPTOR,
+ "DUsbClientController::ProceedSetDescriptor()" );
// iEp0DataReceived already reflects the current buffer state
if (iEp0DataReceived < iSetup.iLength)
{
@@ -1078,17 +1239,19 @@
void DUsbClientController::SetClearHaltFeature(TInt aRealEndpoint, TUint8 aRequest)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::SetClearHaltFeature()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_SETCLEARHALTFEATURE,
+ "DUsbClientController::SetClearHaltFeature()" );
if (aRequest == KUsbRequest_SetFeature)
{
if (iRealEndpoints[aRealEndpoint].iHalt)
{
// (This condition is not really an error)
- __KTRACE_OPT(KUSB, Kern::Printf(" Warning: HALT feature already set"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_SETCLEARHALTFEATURE_DUP1,
+ " Warning: HALT feature already set" );
return;
}
- __KTRACE_OPT(KUSB, Kern::Printf(" setting HALT feature for real endpoint %d",
- aRealEndpoint));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_SETCLEARHALTFEATURE_DUP2,
+ " setting HALT feature for real endpoint %d", aRealEndpoint );
StallEndpoint(aRealEndpoint);
iRealEndpoints[aRealEndpoint].iHalt = ETrue;
}
@@ -1097,12 +1260,13 @@
if (iRealEndpoints[aRealEndpoint].iHalt == EFalse)
{
// In this case, before we return, the data toggles are reset to DATA0.
- __KTRACE_OPT(KUSB, Kern::Printf(" Warning: HALT feature already cleared"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_SETCLEARHALTFEATURE_DUP3,
+ " Warning: HALT feature already cleared" );
ResetDataToggle(aRealEndpoint);
return;
}
- __KTRACE_OPT(KUSB, Kern::Printf(" clearing HALT feature for real endpoint %d",
- aRealEndpoint));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_SETCLEARHALTFEATURE_DUP4,
+ " clearing HALT feature for real endpoint %d", aRealEndpoint );
ResetDataToggle(aRealEndpoint);
ClearStallEndpoint(aRealEndpoint);
iRealEndpoints[aRealEndpoint].iHalt = EFalse;
@@ -1113,7 +1277,8 @@
TInt DUsbClientController::ClearHaltFeature(TInt aRealEndpoint)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ClearHaltFeature()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_CLEARHALTFEATURE,
+ "DUsbClientController::ClearHaltFeature()" );
if (iRealEndpoints[aRealEndpoint].iHalt != EFalse)
{
ClearStallEndpoint(aRealEndpoint);
@@ -1125,19 +1290,21 @@
void DUsbClientController::ChangeConfiguration(TUint16 aValue)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ChangeConfiguration()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION,
+ "DUsbClientController::ChangeConfiguration()" );
// New configuration is the same as the old one: 0
if (iCurrentConfig == 0 && aValue == 0)
{
// no-op
- __KTRACE_OPT(KUSB, Kern::Printf(" Configuration: New == Old == 0 --> exiting"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP1,
+ " Configuration: New == Old == 0 --> exiting" );
return;
}
// New configuration is the same as the old one (but not 0)
if (iCurrentConfig == aValue)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Configuration: New == Old == %d --> exiting", aValue));
-
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP2,
+ " Configuration: New == Old == %d --> exiting", aValue );
// From the spec 9.1.1.5, Data toggle is reset to zero here when
// setconfiguration(x->x)(x!=0) received, although we only support
// single configuration currently.
@@ -1145,21 +1312,24 @@
TInt ret = DoForEveryEndpointInUse(&DUsbClientController::ResetDataToggle, num);
if(ret != KErrNone)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint data toggle reset failed"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP3,
+ " Error: Endpoint data toggle reset failed" );
}
- __KTRACE_OPT(KUSB, Kern::Printf(" Called ResetDataToggle()for %d endpoints", num));
-
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP4,
+ " Called ResetDataToggle()for %d endpoints", num );
return;
}
// Device is already configured
if (iCurrentConfig != 0)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Device was configured: %d", iCurrentConfig));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP5,
+ " Device was configured: %d", iCurrentConfig );
// Tear down all interface(set)s of the old configuration
RPointerArray<TUsbcInterfaceSet>& ifcsets = CurrentConfig()->iInterfaceSets;
for (TInt i = 0; i < ifcsets.Count(); ++i)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Tearing down InterfaceSet %d", i));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP6,
+ " Tearing down InterfaceSet %d", i );
InterfaceSetTeardown(ifcsets[i]);
}
iCurrentConfig = 0;
@@ -1170,7 +1340,8 @@
// Device gets a new configuration
if (aValue != 0)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Device gets new configuration..."));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP7,
+ " Device gets new configuration..." );
// Setup all alternate settings 0 of all interfaces
// (Don't separate the next two lines of code.)
iCurrentConfig = aValue;
@@ -1178,20 +1349,23 @@
const TInt n = ifcsets.Count();
for (TInt i = 0; i < n; ++i)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Setting up InterfaceSet %d", i));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP8,
+ " Setting up InterfaceSet %d", i );
InterfaceSetup(ifcsets[i]->iInterfaces[0]);
}
// Enter Configured state (from Address or Configured)
NextDeviceState(EUsbcDeviceStateConfigured);
}
- __KTRACE_OPT(KUSB, Kern::Printf(" New configuration: %d", iCurrentConfig));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGECONFIGURATION_DUP9,
+ " New configuration: %d", iCurrentConfig );
return;
}
void DUsbClientController::InterfaceSetup(TUsbcInterface* aIfc)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::InterfaceSetup()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_INTERFACESETUP,
+ "DUsbClientController::InterfaceSetup()" );
const TInt num_eps = aIfc->iEndpoints.Count();
for (TInt i = 0; i < num_eps; i++)
{
@@ -1201,24 +1375,27 @@
// adjusted in its constructor.)
if (iHighSpeed)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Setting Ep info size to %d (HS)", ep->iEpSize_Hs));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_INTERFACESETUP_DUP1,
+ " Setting Ep info size to %d (HS)", ep->iEpSize_Hs );
ep->iInfo.iSize = ep->iEpSize_Hs;
}
else
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Setting Ep info size to %d (FS)", ep->iEpSize_Fs));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_INTERFACESETUP_DUP2,
+ " Setting Ep info size to %d (FS)", ep->iEpSize_Fs );
ep->iInfo.iSize = ep->iEpSize_Fs;
}
const TInt idx = EpAddr2Idx(ep->iPEndpoint->iEndpointAddr);
if (ConfigureEndpoint(idx, ep->iInfo) != KErrNone)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint %d configuration failed", idx));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_INTERFACESETUP_DUP3,
+ " Error: Endpoint %d configuration failed", idx );
continue;
}
// Should there be a problem with it then we could try resetting the ep
// data toggle at this point (or before the Configure) as well.
- __KTRACE_OPT(KUSB, Kern::Printf(" Connecting real ep addr 0x%02x & logical ep #%d",
- ep->iPEndpoint->iEndpointAddr, ep->iLEndpointNum));
+ OstTraceDefExt2( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_INTERFACESETUP_DUP4,
+ " Connecting real ep addr 0x%02x & logical ep #%d", ep->iPEndpoint->iEndpointAddr, ep->iLEndpointNum );
ep->iPEndpoint->iLEndpoint = ep;
}
aIfc->iInterfaceSet->iCurrentInterface = aIfc->iSettingCode;
@@ -1228,10 +1405,12 @@
void DUsbClientController::InterfaceSetTeardown(TUsbcInterfaceSet* aIfcSet)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::InterfaceSetTeardown()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_INTERFACESETTEARDOWN,
+ "DUsbClientController::InterfaceSetTeardown()" );
if (aIfcSet->iInterfaces.Count() == 0)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" No interfaces exist - returning"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_INTERFACESETTEARDOWN_DUP1,
+ " No interfaces exist - returning" );
return;
}
RPointerArray<TUsbcLogicalEndpoint>& eps = aIfcSet->CurrentInterface()->iEndpoints;
@@ -1245,24 +1424,29 @@
if (!ep->iPEndpoint->iLEndpoint)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" real ep %d not configured: skipping", idx));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_INTERFACESETTEARDOWN_DUP2,
+ " real ep %d not configured: skipping", idx );
continue;
}
if (ResetDataToggle(idx) != KErrNone)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint %d data toggle reset failed", idx));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_INTERFACESETTEARDOWN_DUP3,
+ " Error: Endpoint %d data toggle reset failed", idx );
}
if (DeConfigureEndpoint(idx) != KErrNone)
{
- __KTRACE_OPT(KPANIC, Kern::Printf(" Error: Endpoint %d de-configuration failed", idx));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCLIENTCONTROLLER_INTERFACESETTEARDOWN_DUP4,
+ " Error: Endpoint %d de-configuration failed", idx );
}
- __KTRACE_OPT(KUSB, Kern::Printf(" disconnecting real ep & logical ep"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_INTERFACESETTEARDOWN_DUP5,
+ " disconnecting real ep & logical ep" );
ep->iPEndpoint->iLEndpoint = NULL;
}
if (aIfcSet->CurrentInterface() != 0)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Resetting alternate interface setting to 0"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_INTERFACESETTEARDOWN_DUP6,
+ " Resetting alternate interface setting to 0" );
//Add this mutex to protect the interface set data structure
if (NKern::CurrentContext() == EThread)
{
@@ -1281,15 +1465,18 @@
void DUsbClientController::ChangeInterface(TUsbcInterface* aIfc)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::ChangeInterface()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_CHANGEINTERFACE,
+ "DUsbClientController::ChangeInterface()" );
TUsbcInterfaceSet* ifcset = aIfc->iInterfaceSet;
const TUint8 setting = aIfc->iSettingCode;
if (ifcset->iCurrentInterface == setting)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" New Ifc == old Ifc: nothing to do"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGEINTERFACE_DUP1,
+ " New Ifc == old Ifc: nothing to do" );
return;
}
- __KTRACE_OPT(KUSB, Kern::Printf(" Setting new interface setting #%d", setting));
+ OstTraceDef1( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_CHANGEINTERFACE_DUP2,
+ " Setting new interface setting #%d", setting );
InterfaceSetTeardown(ifcset);
InterfaceSetup(aIfc);
StatusNotify(static_cast<TUsbcDeviceState>(KUsbAlternateSetting | setting), ifcset->iClientId);
@@ -1301,12 +1488,14 @@
//
TInt DUsbClientController::DoForEveryEndpointInUse(TInt (DUsbClientController::*aFunction)(TInt), TInt& aCount)
{
- __KTRACE_OPT(KUSB, Kern::Printf("DUsbClientController::DoForEveryEndpointInUse()"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_FLOW, DUSBCLIENTCONTROLLER_DOFOREVERYENDPOINTINUSE,
+ "DUsbClientController::DoForEveryEndpointInUse()" );
aCount = 0;
TUsbcConfiguration* const config = CurrentConfig();
if (!config)
{
- __KTRACE_OPT(KUSB, Kern::Printf(" Device is not configured - returning"));
+ OstTraceDef0( OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_DOFOREVERYENDPOINTINUSE_DUP1,
+ " Device is not configured - returning" );
return KErrNone;
}
RPointerArray<TUsbcInterfaceSet>& ifcsets = config->iInterfaceSets;