diff -r 0a40b8675b23 -r d37db4dcc88d kernel/eka/drivers/usbcsc/d_usbcsc.cpp --- a/kernel/eka/drivers/usbcsc/d_usbcsc.cpp Tue Aug 24 14:42:58 2010 +0100 +++ b/kernel/eka/drivers/usbcsc/d_usbcsc.cpp Tue Aug 24 14:49:21 2010 +0100 @@ -21,9 +21,13 @@ @file d_usbcsc.cpp @internalTechnology */ - #include #include "platform.h" +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "d_usbcscTraces.h" +#endif + /*****************************************************************************\ * DUsbcScLogDevice * @@ -67,7 +71,8 @@ // Only proceed if we have the Controller underneath us if (!DUsbClientController::UsbcControllerPointer()) { - __KTRACE_OPT(KPANIC, Kern::Printf("LDD Install: USB Controller Not Present")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DUSBCSCLOGDEVICE_INSTALL, "LDD Install: USB Controller Not Present" ); + return KErrGeneral; } return SetName(&KUsbScLddName); @@ -137,13 +142,12 @@ // Note that nothing may happen immediately, as something else may have the chunk open. void TUsbcScChunkInfo::Close() { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::Close %d", iChunk->AccessCount())); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_CLOSE, "TUsbcScChunkInfo::Close %d", iChunk->AccessCount()); if (Kern::ChunkClose(iChunk)) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::Close1")); - ChunkCleanup(); - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::Close2")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_CLOSE_DUP1, "TUsbcScChunkInfo::Close1"); + ChunkCleanup(); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_CLOSE_DUP2, "TUsbcScChunkInfo::Close2"); } } @@ -156,17 +160,18 @@ TInt r; TLinAddr physAddr; - __KTRACE_OPT(KUSB, Kern::Printf("::chunkalloc AllocPhysicalRam aSize %d", aSize)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_CHUNKALLOC, "::chunkalloc AllocPhysicalRam aSize %d", aSize); r = Epoc::AllocPhysicalRam(aSize, physAddr); - __KTRACE_OPT(KUSB, if (r!=KErrNone) Kern::Printf("::chunkalloc AllocPhysicalRam r=%d (Error!)", r)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_CHUNKALLOC_DUP1, "::chunkalloc AllocPhysicalRam r=%d (Error!)", r); + if (r==KErrNone) { - __KTRACE_OPT(KUSB, Kern::Printf("::chunkalloc ChunkCommitPhysical iChunk 0x%x size(%d), aOffset 0x%x, aSize 0x%x phsAddr 0x%x", - iChunk, sizeof(DChunk), aOffset, aSize,physAddr )); - + OstTraceDefExt5(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_CHUNKALLOC_DUP2, "T::chunkalloc ChunkCommitPhysical iChunk 0x%x size(%d), aOffset 0x%x, aSize 0x%x phsAddr 0x%x", (TUint)iChunk, sizeof(DChunk), aOffset, aSize,(TUint)physAddr); r = Kern::ChunkCommitPhysical(iChunk, aOffset, aSize, physAddr); - __KTRACE_OPT(KUSB, if (r!=KErrNone) Kern::Printf("::chunkalloc ChunkCommitPhysical r=%d (Error!)", r)); + if (r!=KErrNone) + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_CHUNKALLOC_DUP3, "::chunkalloc ChunkCommitPhysical r=%d (Error!)", r); + if (r!=KErrNone) Epoc::FreePhysicalRam(physAddr, aSize); @@ -176,8 +181,8 @@ TInt i=0; for (rle=(aSize>>iPageNtz); rle>0; rle--, i++,physAddr+=pageSize) { - __KTRACE_OPT(KUSB, Kern::Printf("::phys offset 0x%x = 0x%x", - (aOffset>>iPageNtz)+i, (physAddr & pageMask) | ((rle>(TInt)rleMask)?(TInt)rleMask:rle))); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_CHUNKALLOC_DUP4, "::phys offset 0x%x = 0x%x", + (TInt32)((aOffset>>iPageNtz)+i), (TUint32)( (physAddr & pageMask) | ((rle>(TInt)rleMask)?(TInt)rleMask:rle))); iPhysicalMap[(aOffset>>iPageNtz)+i] = (physAddr & pageMask) | ((rle>(TInt)rleMask)?(TInt)rleMask:rle); } } @@ -218,7 +223,8 @@ void TUsbcScChunkInfo::ChunkCleanup() { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::ChunkCleanup()")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, TUSBCSCCHUNKINFO_CHUNKCLEANUP, "TUsbcScChunkInfo::ChunkCleanup()" ); + TUint physAddr; TInt length; TInt offset = 0; @@ -249,8 +255,8 @@ TInt TUsbcScChunkInfo::New(TUsbcScChunkInfo*& aChunk, TInt aSize, DLogicalDevice* aLdd) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::New totalSize %d", aSize)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_NEW, "TUsbcScChunkInfo::New totalSize %d", aSize); + aChunk = new TUsbcScChunkInfo(aLdd); if (aChunk==NULL) { @@ -265,7 +271,8 @@ return r; } - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChunkInfo::New Created at 0x%x", aChunk->iChunkMem )); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCCHUNKINFO_NEW_DUP1, "TUsbcScChunkInfo::New Created at 0x%x", aChunk->iChunkMem); + return KErrNone; } @@ -342,8 +349,7 @@ iBufferStart->iHead= iHead; iBufferStart->iTail= iHead; // Initially no data! iBufferStart->iBilTail=iHead; - __KTRACE_OPT(KUSB, Kern::Printf("Realize: iHead 0x%x bufferHeader 0x%x", iHead,iBufferStart )); - + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_CREATECHUNKBUFFERHEADER, "Realize: iHead 0x%x bufferHeader 0x%x", iHead,(TUint)iBufferStart); // Dont need to round here, as we will round it up on endpoint change. (configuration) } } @@ -369,16 +375,18 @@ */ void TUsbcScBuffer::StartEndpoint(TUsbcRequestCallback* aRequestInfo, TUint aFlags) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartEndpoint (0x%x) : ep %d(%d)",this,aRequestInfo->iEndpointNum, aRequestInfo->iRealEpNum)); + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTENDPOINT, "TUsbcScBuffer::StartEndpoint (0x%x) : ep %d(%d)", (TUint)this,aRequestInfo->iEndpointNum, aRequestInfo->iRealEpNum); iCallback=aRequestInfo; iMaxPacketSize = iLdd->iController->EndpointPacketSize(iLdd, aRequestInfo->iRealEpNum); iAlignMask = ~(((iMaxPacketSize+1) & 0xFFFFFFF8)-1); iMode = aFlags; - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartEndpoint : max Packets %d, mask 0x%x flags 0x%x", iMaxPacketSize, iAlignMask, iMode)); + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTENDPOINT_DUP1, "TUsbcScBuffer::StartEndpoint : max Packets %d, mask 0x%x flags 0x%x", iMaxPacketSize, iAlignMask, (TUint)iMode); + if ((iDirection&1)==KUsbcScOut) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UsbcScOut\n")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTENDPOINT_DUP2, "TUsbcScBuffer::UsbcScOut\n" ); + // Add dummy packet (doesnt have to be aligned, which avoids what if it changes issue) // And Start next read. iNeedsPacket=KEpIsStarting; @@ -389,7 +397,8 @@ void TUsbcScBuffer::Destroy() { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::Destroy()")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, TUSBCSCBUFFER_DESTROY, "TUsbcScBuffer::Destroy()" ); + Cancel(KErrCancel); if (iLdd->iController && ((iDirection&1)==KUsbcScOut)) { // Me must cancel reads to LDD to, an there will be no list for the callbacks to look into. @@ -404,12 +413,14 @@ { if (!iMaxPacketSize) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataRead() - Not Configured")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAREAD, "TUsbcScBuffer::StartDataRead() - Not Configured" ); + return KErrNone; } if (iStatusList.iState!=ENotRunning) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataRead() - Already Stated! (%d)",iStatusList.iState)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAREAD_DUP1, "TUsbcScBuffer::StartDataRead() - Already Stated! (%d)", iStatusList.iState ); + return KErrNone; } @@ -421,7 +432,8 @@ TUsbcScStatusElement* nextJob = iStatusList.Next(); if (nextJob == NULL) { - __KTRACE_OPT(KUSB, Kern::Printf("No more jobs")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAREAD_DUP2, "No more jobs"); + if (iMode && KUsbScCoupledRead) return KErrEof; iStatusList.iState=EReadingAhead; @@ -432,20 +444,20 @@ TInt tail = iBufferStart->iTail; TInt headerSize = sizeof(TUsbcScTransferHeader)-4; // TransferHeader includes 4 bytes of data. maxLength = iChunkInfo->GetPhysical(iHead + headerSize, &physAddr); //returns all the bytes available after iHead + headerSize) - __ASSERT_DEBUG(maxLength>0,Kern::Fault("TUsbcScBuffer::StartDataRead(", __LINE__)); if (tail>iHead) // # # # H _ _ _ T # # # # { - __KTRACE_OPT(KUSB,Kern::Printf("TUsbcScBuffer::StartDataRead() - tail 0x%x>head 0x%x, maxlength 0x%x", tail, iHead, maxLength)); - + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAREAD_DUP3, "TUsbcScBuffer::StartDataRead() - tail 0x%x>head 0x%x, maxlength 0x%x", (TUint)tail, iHead, maxLength); + freeSpace = (tail & iAlignMask) - (iHead +headerSize + (~iAlignMask+1) ); // Cant read right up to last buffer, or head/tail will cross. if (freeSpace=iMinReadSize,Kern::Fault("TUsbcScBuffer::StartDataRead(", __LINE__)); TUint8* data = ((TUsbcScTransferHeader *) (iHead + iChunkAddr))->iData.b; @@ -468,7 +479,7 @@ r = iLdd->iController->SetupReadBuffer(*iCallback); if (r!=KErrNone) { - __KTRACE_OPT(KUSB,Kern::Printf("SetupReadBuffer Error: %d, RT %d",r, iStatusList.iState)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAREAD_DUP5, "SetupReadBuffer Error: %d, RT %d",r, iStatusList.iState); iStatusList.Complete(r); } // After this, TUsbcScEndpoint::RequestCallback is called in a DFC. @@ -479,8 +490,8 @@ void TUsbcScBuffer::CompleteRead(TBool aStartNextRead) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::CompleteRead buff=%x",this)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_COMPLETEREAD, "TUsbcScBuffer::CompleteRead buff=%x",this); + // The first packet always contains the total #of bytes const TInt byteCount = iCallback->iPacketSize[0]; const TInt packetCount = iCallback->iRxPackets; @@ -499,12 +510,11 @@ void TUsbcScBuffer::UpdateBufferList(TInt aByteCount,TUint aFlags, TBool aStartNextRead) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst aByteCount %d, flags 0x%x iHead 0x%x", aByteCount, aFlags, iHead)); - + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_UPDATEBUFFERLIST, "TUsbcScBuffer::UpdateBUfferLIst aByteCount %d, flags 0x%x iHead 0x%x", aByteCount, aFlags, (TUint)iHead); + TInt headerSize = sizeof(TUsbcScTransferHeader)-4; // TransferHeader includes 4 bytes of data. TLinAddr dummy; - __KTRACE_OPT(KUSB, Kern::Printf("iHead 0x%x headerSize 0x%x",iHead, headerSize)); - + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_UPDATEBUFFERLIST_DUP1, "iHead 0x%x headerSize 0x%x",iHead, headerSize); // Find iNext TInt next = iHead + headerSize + aByteCount; // next unused byte in buffer. @@ -517,7 +527,8 @@ next = (next + headerSize + ~iAlignMask) & iAlignMask; maxLength = iChunkInfo->GetPhysical(next, &dummy); - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst next %x buffer end %x min-read: %x maxRun %x", next, iBufferEnd, iMinReadSize, maxLength)); + OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_UPDATEBUFFERLIST_DUP2, "TUsbcScBuffer::UpdateBUfferLIst next %x buffer end %x min-read: %x maxRun %x", next, iBufferEnd, (TUint)iMinReadSize, (TUint)maxLength); + // At the end of the buffer - wrap it if needbe. if ((TUint)(next + iMinReadSize) > iBufferEnd) { @@ -528,14 +539,15 @@ if (maxLengthiAltSettingSeq=iLdd->iAsSeq; header->iAltSetting=iLdd->iAlternateSetting; header->iFlags=aFlags; - __KTRACE_OPT(KUSB, Kern::Printf("We set next to 0x%x", next)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_UPDATEBUFFERLIST_DUP5, "We set next to 0x%x", next); + iStatusList.iState=ENotRunning; if (next==iBufferStart->iTail) //or (othwise is as good as full) { @@ -561,7 +573,7 @@ else { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst StartRead?? ")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_UPDATEBUFFERLIST_DUP6, "TUsbcScBuffer::UpdateBUfferLIst StartRead?? "); TInt oldHead=iHead; iHead = next; @@ -583,7 +595,8 @@ else { iBufferStart->iHead = next; - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::UpdateBUfferLIst Compleating\n")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_UPDATEBUFFERLIST_DUP7, "TUsbcScBuffer::UpdateBUfferLIst Compleating\n"); + } // Complete userside iStatusList.Complete(); @@ -607,7 +620,8 @@ if (StartDataRead() == KErrOverflow) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::PopStall Warning: Transfer was freed, but still no space!\n")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_POPSTALL, "TUsbcScBuffer::PopStall Warning: Transfer was freed, but still no space!\n"); + } iBufferStart->iHead = iHead; @@ -618,7 +632,8 @@ void TUsbcScBuffer::StartDataWrite() { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataWrite()")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, TUSBCSCBUFFER_STARTDATAWRITE, "TUsbcScBuffer::StartDataWrite()"); + TUsbcScStatusElement* nextJob = iStatusList.Next(); TBool zlpReqd; TInt length; @@ -629,16 +644,16 @@ TInt r; if (!iMaxPacketSize) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataWrite() - Not Configured")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAWRITE_DUP1, "TUsbcScBuffer::StartDataWrite() - Not Configured"); return; } if (nextJob == NULL) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataWrite() - No more jobs d=%d", iDirection)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAWRITE_DUP2, "TUsbcScBuffer::StartDataWrite() - No more jobs d=%d", iDirection); if (iDirection==KUsbcScBiIn) // assume this is EP0, if this is true. { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::StartDataWrite() Queue Read on EP0.")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAWRITE_DUP3, "TUsbcScBuffer::StartDataWrite() Queue Read on EP0."); // Start other read again. iLdd->iBuffers[iLdd->iEP0OutBuff].StartDataRead(); } @@ -679,7 +694,8 @@ r = iLdd->iController->SetupWriteBuffer(*iCallback); if (r!=KErrNone) { - __KTRACE_OPT(KUSB, Kern::Printf("SetupWriteBUffer Error: %d",r)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_STARTDATAWRITE_DUP4, "SetupWriteBUffer Error: %d",r); + iStatusList.Complete(r); } } @@ -689,7 +705,7 @@ void TUsbcScBuffer::CompleteWrite() { TInt error = iCallback->iError; - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::CompleteWrite buff=%x, err=%d",this, error)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_COMPLETEWRITE, "TUsbcScBuffer::CompleteWrite buff=%x, err=%d",(TUint)this, error); iSent+= iCallback->iTxBytes; // More to send? @@ -739,8 +755,8 @@ void TUsbcScBuffer::SendEp0StatusPacket(TInt aState) { - __KTRACE_OPT(KUSB, Kern::Printf(" TUsbcScBuffer::SendEp0StatusPacket(%d)", aState)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCBUFFER_SENDEP0STATUSPACKET, " TUsbcScBuffer::SendEp0StatusPacket(%d)", aState); + // We need to add a packet to the buffer, so we must stop the pending read, and start // another after we have added out packet. Ep0CancelLddRead(); @@ -809,7 +825,8 @@ TInt TUsbcScStatusList ::Add(TRequestStatus* aStatus, TInt aLength, TUint aStart, TUint aFlags) { - __KTRACE_OPT(KUSB,Kern::Printf("Adding request. iLength %d iSize %d", iLength, iSize)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCSTATUSLIST_ADD, "Adding request. iLength %d iSize %d", iLength, iSize); + if (iLengthiHead;alt!=NULL;alt = alt->iNext ) { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: AlternateSetting %x", alt)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_COPYANDSORTENDPOINTS_DUP1, "Realize: AlternateSetting %x", alt); + iBufs[KUsbcScIn].iEps =0; iBufs[KUsbcScOut].iEps =0; // For alt setting, iterate eps for (altEp=1; altEp <= alt->iNumberOfEndpoints; altEp++) { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Endpoint to add: %d",altEp)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_COPYANDSORTENDPOINTS_DUP2, "Realize: Endpoint to add: %d", altEp); TUsbcScEndpoint* nextEp = alt->iEndpoint[altEp]; - __KTRACE_OPT(KUSB, Kern::Printf("Realize: ep Buffer Size: %d",nextEp->EndpointInfo()->iBufferSize)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_COPYANDSORTENDPOINTS_DUP3, "Realize: ep Buffer Size: %d",nextEp->EndpointInfo()->iBufferSize); + inout = (nextEp->EndpointInfo()->iDir==KUsbEpDirIn)?KUsbcScIn: (nextEp->EndpointInfo()->iDir==KUsbEpDirOut)?KUsbcScOut:KUsbcScUnknown; if (inout==KUsbcScUnknown) { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: KUsbcScUnknown %x",nextEp->EndpointInfo()->iDir)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_COPYANDSORTENDPOINTS_DUP4, "Realize: KUsbcScUnknown %x",nextEp->EndpointInfo()->iDir); + return KErrArgument; } bufsd = &(iBufs[inout]); - __KTRACE_OPT(KUSB, Kern::Printf("Realize: ep direction: %x # endpoints %d", inout, bufsd->iEps)); - + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_COPYANDSORTENDPOINTS_DUP5, "Realize: ep direction: %x # endpoints %d", inout, bufsd->iEps); // find and position ep, and insert. if (bufsd->iEps==0) // First entry. { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Add first endpoint")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_COPYANDSORTENDPOINTS_DUP6, "Realize: Add first endpoint"); + endpointOffs = altSetting*iMaxEndpoints; bufsd->iEp[endpointOffs] = nextEp; } @@ -1030,14 +1047,12 @@ endpointOffs = altSetting*iMaxEndpoints + endpoint; if (bufsd->iEp[endpointOffs]->EndpointInfo()->iBufferSize < nextEp->EndpointInfo()->iBufferSize) { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Shift Endpoint %d", endpoint)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_COPYANDSORTENDPOINTS_DUP7, "Realize: Shift Endpoint %d", endpoint); bufsd->iEp[endpointOffs+1] = bufsd->iEp[endpointOffs]; } else { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Insert After Endpoint %d", endpoint)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_COPYANDSORTENDPOINTS_DUP8, "Realize: Insert After Endpoint %d", endpoint); bufsd->iEp[endpointOffs+1] = nextEp; placed = ETrue; break; @@ -1063,8 +1078,8 @@ void TRealizeInfo::CalcBuffSizes() { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Calculate Buffers")); - + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, TREALIZEINFO_CALCBUFFSIZES, "Realize: Calculate Buffers" ); + TInt endpoint; TInt inout; TInt altSetting; @@ -1074,28 +1089,27 @@ for (inout=KUsbcScIn; inoutiEp[altSetting* iMaxEndpoints + endpoint]; if (nextEp!=NULL) { bufferSize = nextEp->EndpointInfo()->iBufferSize; - __KTRACE_OPT(KUSB, Kern::Printf("Realize: comparing size %d", bufferSize)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_CALCBUFFSIZES_DUP4, "Realize: comparing size %d", bufferSize); if (bufferSize> bufMaxSize) bufMaxSize = bufferSize; } } // for altsetting - __KTRACE_OPT(KUSB, Kern::Printf("Realize: bufMaxSize %d", bufMaxSize)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_CALCBUFFSIZES_DUP5, "Realize: bufMaxSize %d", bufMaxSize); bufsd->iSizes[endpoint] = bufMaxSize; if (bufMaxSize>0) { @@ -1148,10 +1162,8 @@ TInt tableOffset = (TUint) iAltSettingsTbl->iAltTableOffset - (TUint) aChunkInfo->iChunkMem + iAltSettings*sizeof(TInt); - __KTRACE_OPT(KUSB, Kern::Printf("Realize: table offset: 0x%x, altTble %x iChnkMem %x altSettings %x",tableOffset, iAltSettingsTbl, aChunkInfo->iChunkMem, iAltSettings )); - - __KTRACE_OPT(KUSB, Kern::Printf("Realize: populate chunk - create alt settings table")); - + OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_LAYOUTCHUNKHEADER, "Realize: table offset: 0x%x, altTble %x iChnkMem %x altSettings %x",tableOffset, (TUint)iAltSettingsTbl, (TUint)aChunkInfo->iChunkMem, iAltSettings); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TREALIZEINFO_LAYOUTCHUNKHEADER_DUP1, "Realize: populate chunk - create alt settings table"); // Create alt settings table. Set each element of altsettings table, to each induivatual alt setting table. // then fill in the number of endpoints for that alt setting, in the table. @@ -1163,8 +1175,7 @@ alt = iAlternateSettingList->iHead; for (altSetting=0; altSettingiAltTableOffset[altSetting] = tableOffset; noEpForAlt = (TInt*) &aChunkInfo->iChunkMem[tableOffset]; @@ -1215,7 +1226,8 @@ iBuffers(NULL), iEp0Endpoint(NULL) { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DLddUsbcScChannel()")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_DLDDUSBCSCCHANNEL_CONS, "DLddUsbcScChannel::DLddUsbcScChannel()" ); + iClient = &Kern::CurrentThread(); iClient->Open(); for (TInt i = 1; i < KUsbcMaxRequests; i++) @@ -1231,7 +1243,7 @@ DLddUsbcScChannel::~DLddUsbcScChannel() { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::~DLddUsbcScChannel()")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_DLDDUSBCSCCHANNEL_DES, "DLddUsbcScChannel::~DLddUsbcScChannel()" ); if (iController) { iController->DeRegisterClient(this); @@ -1252,7 +1264,7 @@ delete iStatusFifo; } } - __KTRACE_OPT(KUSB, Kern::Printf("Closing buffers")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DLDDUSBCSCCHANNEL_DES_DUP1, "Closing buffers" ); if (iBuffers) { TInt i; @@ -1266,14 +1278,14 @@ if (iRealizeCalled) { // Close Chunk - __KTRACE_OPT(KUSB, Kern::Printf("iChunkInfo->Close()")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DLDDUSBCSCCHANNEL_DES_DUP2, "iChunkInfo->Close()" ); iChunkInfo->Close(); // ChunkInfo will delete itself with DFC, but the pointer here is no longer needed. iChunkInfo=NULL; } - __KTRACE_OPT(KUSB, Kern::Printf("about to SafeClose")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DLDDUSBCSCCHANNEL_DES_DUP3, "about to SafeClose" ); Kern::SafeClose((DObject*&)iClient, NULL); - __KTRACE_OPT(KUSB, Kern::Printf("about to SafeClose1")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DLDDUSBCSCCHANNEL_DES_DUP4, "about to SafeClose1" ); } @@ -1283,8 +1295,9 @@ TInt DLddUsbcScChannel::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer) { - __KTRACE_OPT(KUSB, Kern::Printf("LDD DoCreateL 1 Ver = %02d %02d %02d", - aVer.iMajor, aVer.iMinor, aVer.iBuild)); + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCREATE, "LDD DoCreateL 1 Ver = %02d %02d %02d", + aVer.iMajor, aVer.iMinor, aVer.iBuild); + if (!Kern::CurrentThreadHasCapability(ECapabilityCommDD, __PLATSEC_DIAGNOSTIC_STRING("Checked by USBCSC.LDD (USB Driver)"))) { @@ -1344,8 +1357,8 @@ { TThreadMessage& m = *(TThreadMessage*)aMsg; TInt id = m.iValue; - __KTRACE_OPT(KUSB, Kern::Printf("HandleMsg 0x%x", id)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_HANDLEMSG, "HandleMsg 0x%x", id); + if (id == (TInt) ECloseMsg) { iChannelClosing = ETrue; @@ -1354,13 +1367,11 @@ } TInt r; - if (aMsg->Client() != iClient) { m.Complete(KErrAccessDenied, ETrue); return; } - if (id < 0) { // DoRequest @@ -1384,8 +1395,6 @@ // end HandleMsg. -#define BREAK_IF_NULL_ARG(a,r) if (a==NULL) { r = KErrArgument; __KTRACE_OPT(KUSB,Kern::Printf("NULL Argument")); break; } - // // DoRequest - Asynchronous requests // @@ -1397,8 +1406,8 @@ TInt r = KErrNone; // return via request notify TBool needsCompletion =EFalse; - __KTRACE_OPT(KUSB, Kern::Printf("DoRequest 0x%08x", aReqNo)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST, "DoRequest 0x%08x", aReqNo); + if ((reqNo>RDevUsbcScClient::ERequestReadDataNotify) && (reqNo>RDevUsbcScClient::KFieldBuffPos)&RDevUsbcScClient::KFieldBuffMask; - __KTRACE_OPT(KUSB, Kern::Printf("ERequestWriteData")); - BREAK_IF_NULL_ARG(a2,r); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP1, "ERequestWriteData"); + if (a2 == NULL) + { + r = KErrArgument; + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP2, "NULL Argument"); + break; + } r = DoWriteData( aStatus, buffer, (TInt) a1 /*Start*/, (TInt) a2 /* Length */, aReqNo>>RDevUsbcScClient::KFieldFlagsPos ); // Flags @@ -1424,14 +1438,19 @@ } case RDevUsbcScClient::ERequestReadDataNotify: { - __KTRACE_OPT(KUSB, Kern::Printf("ERequestReadDataNotify")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP3, "ERequestReadDataNotify"); return DoReadDataNotify(aStatus, (TInt) a1, (TInt) a2); // a1 = aBufferNumber, a2 - aLength; } case RDevUsbcScClient::ERequestAlternateDeviceStatusNotify: { - __KTRACE_OPT(KUSB, Kern::Printf("ERequestAlternateDeviceStatusNotify")); - BREAK_IF_NULL_ARG(a1,r); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP4, "ERequestAlternateDeviceStatusNotify"); + if (a1 == NULL) + { + r = KErrArgument; + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP5, "NULL Argument"); + break; + } iDeviceStatusNeeded = ETrue; iStatusChangePtr = a1; needsCompletion = AlternateDeviceStateTestComplete(); @@ -1439,24 +1458,32 @@ } case RDevUsbcScClient::ERequestReEnumerate: { - __KTRACE_OPT(KUSB, Kern::Printf("ERequestReEnumerate")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP6, "ERequestReEnumerate"); // If successful, this will complete via the status notification. r = iController->ReEnumerate(); break; } case RDevUsbcScClient::ERequestEndpointStatusNotify: { - __KTRACE_OPT(KUSB, Kern::Printf("ERequestEndpointStatusNotify")); - BREAK_IF_NULL_ARG(a1,r); - + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP7, "ERequestEndpointStatusNotify"); + if (a1 == NULL) + { + r = KErrArgument; + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP8, "NULL Argument"); + break; + } iEndpointStatusChangePtr = a1; break; } case RDevUsbcScClient::ERequestOtgFeaturesNotify: { - __KTRACE_OPT(KUSB, Kern::Printf("ERequestOtgFeaturesNotify")); - BREAK_IF_NULL_ARG(a1,r); - + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP9, "ERequestOtgFeaturesNotify"); + if (a1 == NULL) + { + r = KErrArgument; + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP10, "NULL Argument"); + break; + } iOtgFeatureChangePtr = a1; break; } @@ -1481,14 +1508,16 @@ // TInt DLddUsbcScChannel::DoReadDataNotify(TRequestStatus* aStatus, TInt aBufferNum, TInt aLength) { - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoReadDataNotify(x, %d, 0x%x)", aBufferNum, aLength)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREADDATANOTIFY, " DLddUsbcScChannel::DoReadDataNotify(x, %d, 0x%x)", aBufferNum, aLength); + TInt r = KErrNone; // check range if ((aBufferNum<0) || (aBufferNum>=iNumBuffers)) // Indirectly checks that we are set up. { if (aBufferNum!=KUsbcScEndpointZero) { - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoReadDataNotify : Bad Buffer Number!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREADDATANOTIFY_DUP1, " DLddUsbcScChannel::DoReadDataNotify : Bad Buffer Number!"); + return KErrArgument; } else @@ -1501,7 +1530,7 @@ // check direction if (iBuffers[aBufferNum].iDirection!=KUsbcScOut) { - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoReadDataNotify : Bad Buffer Direction!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREADDATANOTIFY_DUP2, " DLddUsbcScChannel::DoReadDataNotify : Bad Buffer Direction!"); return KErrNotSupported; } if (!Configured()) @@ -1509,8 +1538,7 @@ } SUsbcScBufferHeader* scBuffer = (SUsbcScBufferHeader*) iBuffers[aBufferNum].iBufferStart; - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoReadDataNotify head %x tail %x", iBuffers[aBufferNum].iHead , scBuffer->iTail )); - + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREADDATANOTIFY_DUP3, " DLddUsbcScChannel::DoReadDataNotify head %x tail %x", iBuffers[aBufferNum].iHead , scBuffer->iTail); if (iBuffers[aBufferNum].iHead != scBuffer->iBilTail) r = KErrCompletion; else @@ -1528,7 +1556,7 @@ } else { - __KTRACE_OPT(KUSB, Kern::Printf("Job in Progress!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREADDATANOTIFY_DUP4, "Job in Progress!"); } return r; } @@ -1543,7 +1571,8 @@ // TInt DLddUsbcScChannel::DoWriteData(TRequestStatus* aStatus,TInt aBufferNum, TUint aStart, TUint aLength, TUint aFlags) { - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoWriteData(%d, 0x%x, 0x%x, 0x%x)", aBufferNum, aStart, aLength, aFlags)); + OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOWRITEDATA, " DLddUsbcScChannel::DoWriteData(%d, 0x%x, 0x%x, 0x%x)", aBufferNum, aStart, aLength, aFlags); + if (!iUserKnowsAltSetting) return KErrEof; // Check Buffer Number @@ -1551,7 +1580,7 @@ { if ((TUint)aBufferNum!=RDevUsbcScClient::KFieldBuffMask) // KUsbcScEndpointZero & KFieldBuffMas = KFieldBuffMas; { - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoWriteData : Bad Buffer Number!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOWRITEDATA_DUP1, " DLddUsbcScChannel::DoWriteData : Bad Buffer Number!"); return KErrArgument; } else @@ -1564,7 +1593,7 @@ // check direction if (iBuffers[aBufferNum].iDirection!=KUsbcScIn) { - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoWriteData Bad endpoint Direction")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOWRITEDATA_DUP2, " DLddUsbcScChannel::DoWriteData Bad endpoint Direction"); return KErrArgument; } } @@ -1573,7 +1602,7 @@ if ((aStart< (((TLinAddr) buf.iBufferStart)-buf.iChunkAddr)) || ((aStart+aLength)>iBuffers[aBufferNum].iBufferEnd)) { - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DoWriteData Bad Range aStart or aLength 0x%x > 0x%x + 0x%x < 0x%x", (((TLinAddr) buf.iBufferStart)-buf.iChunkAddr),aStart, aLength, iBuffers[aBufferNum].iBufferEnd )); + OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOWRITEDATA_DUP3, "DLddUsbcScChannel::DoWriteData Bad Range aStart or aLength 0x%x > 0x%x + 0x%x < 0x%x", (TInt)(((TLinAddr) buf.iBufferStart)-buf.iChunkAddr),aStart, aLength, iBuffers[aBufferNum].iBufferEnd); return KErrArgument; } @@ -1582,7 +1611,8 @@ if (aStart & ~buf.iAlignMask) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScBuffer::DoDataWrite: address 0x%x unaligned.",aStart)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOWRITEDATA_DUP4, "TUsbcScBuffer::DoDataWrite: address 0x%x unaligned.",aStart); + return KErrArgument; } @@ -1594,7 +1624,7 @@ } else { - __KTRACE_OPT(KUSB, Kern::Printf("Job in Progress!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOWRITEDATA_DUP5, "Job in Progress!"); } @@ -1611,7 +1641,8 @@ TInt r = KErrNone; TInt direction=KUsbcScOut; - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel: 0x%x aBuff 0x%x", aReqNo, aBuff)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL, "DoCancel: 0x%x aBuff 0x%x", aReqNo, aBuff); + switch (aReqNo) { case RDevUsbcScClient::ERequestCancel: @@ -1628,11 +1659,10 @@ case RDevUsbcScClient::ERequestWriteDataCancel: direction = KUsbcScIn; case RDevUsbcScClient::ERequestReadDataNotifyCancel: - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Direction %d endpoints: 0x%x",direction, aReqNo)); - + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP1, "DoCancel Direction %d endpoints: 0x%x", direction, aReqNo); if (((TInt)aBuff)==KUsbcScEndpointZero) // EP0 is bi-directional, so pick correct buffer for call type { - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Cancel Endpoint 0/%d",direction)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP2, "DoCancel Cancel Endpoint 0/%d",direction); iEp0Endpoint->AbortTransfer(); if (direction==KUsbcScIn) aBuff=iEP0InBuff; @@ -1641,13 +1671,13 @@ } else if ((TInt)aBuff >= iNumBuffers) // check buff no range. { - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Error: Bad buffer number")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP3, "DoCancel Error: Bad buffer number"); return KErrArgument; } if ((iBuffers[aBuff].iDirection&1)!=direction) // Does direction match call type? { - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Error: Bad buffer direction")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP4, "DoCancel Error: Bad buffer direction"); return KErrArgument; } iBuffers[aBuff].iStatusList.CancelQueued(); @@ -1656,7 +1686,7 @@ return KErrNone; case RDevUsbcScClient::ERequestAlternateDeviceStatusNotifyCancel: - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel: ERequestAlternateDeviceStatusNotify 0x%x", aReqNo)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP5, "DoCancel: ERequestAlternateDeviceStatusNotify 0x%x", aReqNo); iDeviceStatusNeeded = EFalse; iStatusFifo->FlushQueue(); if (iStatusChangePtr) @@ -1670,21 +1700,21 @@ break; case RDevUsbcScClient::ERequestReEnumerateCancel: - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestReEnumerate: 0x%x", aReqNo)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP6, "DoCancel ERequestReEnumerate: 0x%x", aReqNo); break; case RDevUsbcScClient::ERequestEndpointStatusNotifyCancel: - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestEndpointStatusNotify: 0x%x", aReqNo)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP7, "DoCancel ERequestEndpointStatusNotify: 0x%x", aReqNo); CancelNotifyEndpointStatus(); break; case RDevUsbcScClient::ERequestOtgFeaturesNotifyCancel: - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel ERequestOtgFeaturesNotify: 0x%x", aReqNo)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP8, "DoCancel ERequestOtgFeaturesNotify: 0x%x", aReqNo); CancelNotifyOtgFeatures(); break; default: - __KTRACE_OPT(KUSB, Kern::Printf("DoCancel Unknown! 0x%x", aReqNo)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCANCEL_DUP9, "DoCancel Unknown! 0x%x", aReqNo); return KErrArgument; } @@ -1734,8 +1764,8 @@ TInt DLddUsbcScChannel::DoControl(TInt aFunction, TAny* a1, TAny* a2) { - __KTRACE_OPT(KUSB, Kern::Printf("DoControl: %d", aFunction)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL, "DoControl: %d", aFunction); + TInt r = KErrNone; TInt ep, param; TUsbcScEndpoint* pEndpoint; @@ -1748,7 +1778,7 @@ switch (aFunction) { case RDevUsbcScClient::EControlEndpointZeroRequestError: - __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointZeroRequestError")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP1, "EControlEndpointZeroRequestError"); r = KErrNone; if (iOwnsDeviceControl || (iValidInterface && iDeviceState == EUsbcDeviceStateConfigured)) { @@ -1764,7 +1794,7 @@ break; case RDevUsbcScClient::EControlGetAlternateSetting: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetAlternateSetting")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP2, "EControlGetAlternateSetting"); if (iValidInterface && iDeviceState == EUsbcDeviceStateConfigured) { r = iController->GetInterfaceNumber(this, param); @@ -1785,7 +1815,7 @@ break; case RDevUsbcScClient::EControlDeviceStatus: - __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceStatus")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP3, "EControlDeviceStatus"); param = iController->GetDeviceStatus(); r = Kern::ThreadRawWrite(iClient, a1, ¶m, sizeof(param), iClient); if (r != KErrNone) @@ -1793,7 +1823,7 @@ break; case RDevUsbcScClient::EControlEndpointStatus: - __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointStatus")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP4, "EControlEndpointStatus"); if (iValidInterface && ValidEndpoint((TInt) a1)) { pEndpoint = iEndpoint[(TInt)a1]; @@ -1817,7 +1847,7 @@ break; case RDevUsbcScClient::EControlEndpointCaps: - __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointCaps")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP5, "EControlEndpointCaps"); r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient); if (r != KErrNone) PanicClientThread(r); @@ -1825,7 +1855,7 @@ break; case RDevUsbcScClient::EControlDeviceCaps: - __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceCaps")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP6, "EControlDeviceCaps"); r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient); if (r != KErrNone) PanicClientThread(r); @@ -1833,12 +1863,12 @@ break; case RDevUsbcScClient::EControlSendEp0StatusPacket: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSendEp0StatusPacket")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP7, "EControlSendEp0StatusPacket"); iController->SendEp0StatusPacket(this); break; case RDevUsbcScClient::EControlHaltEndpoint: - __KTRACE_OPT(KUSB, Kern::Printf("EControlHaltEndpoint")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP8, "EControlHaltEndpoint"); if (iValidInterface && ValidEndpoint((TInt) a1)) { r = iController->HaltEndpoint(this, iEndpoint[(TInt)a1]->RealEpNumber()); @@ -1853,7 +1883,7 @@ break; case RDevUsbcScClient::EControlClearHaltEndpoint: - __KTRACE_OPT(KUSB, Kern::Printf("EControlClearHaltEndpoint")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP9, "EControlClearHaltEndpoint"); if (iValidInterface && ValidEndpoint((TInt) a1)) { r = iController->ClearHaltEndpoint(this, iEndpoint[(TInt)a1]->RealEpNumber()); @@ -1868,33 +1898,33 @@ break; case RDevUsbcScClient::EControlDumpRegisters: - __KTRACE_OPT(KUSB, Kern::Printf("EControlDumpRegisters")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP10, "EControlDumpRegisters"); iController->DumpRegisters(); break; case RDevUsbcScClient::EControlReleaseDeviceControl: - __KTRACE_OPT(KUSB, Kern::Printf("EControlReleaseDeviceControl")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP11, "EControlReleaseDeviceControl"); iController->ReleaseDeviceControl(this); iOwnsDeviceControl = EFalse; break; case RDevUsbcScClient::EControlEndpointZeroMaxPacketSizes: - __KTRACE_OPT(KUSB, Kern::Printf("EControlEndpointZeroMaxPacketSizes")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP12, "EControlEndpointZeroMaxPacketSizes"); r = iController->EndpointZeroMaxPacketSizes(); break; case RDevUsbcScClient::EControlSetEndpointZeroMaxPacketSize: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetEndpointZeroMaxPacketSize")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP13, "EControlSetEndpointZeroMaxPacketSize"); r = iController->SetEndpointZeroMaxPacketSize(reinterpret_cast(a1)); break; case RDevUsbcScClient::EControlGetEndpointZeroMaxPacketSize: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointZeroMaxPacketSize")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP14, "EControlGetEndpointZeroMaxPacketSize"); r = iController->Ep0PacketSize(); break; case RDevUsbcScClient::EControlGetDeviceDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP15, "EControlGetDeviceDescriptor"); r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient); if (r != KErrNone) PanicClientThread(r); @@ -1902,19 +1932,29 @@ break; case RDevUsbcScClient::EControlSetDeviceDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceDescriptor")); - BREAK_IF_NULL_ARG(a1,r); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP16, "EControlSetDeviceDescriptor"); + if (a1 == NULL) + { + r = KErrArgument; + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP17, "NULL Argument"); + break; + } r = iController->SetDeviceDescriptor(iClient, *((TDes8*) a1)); break; case RDevUsbcScClient::EControlGetDeviceDescriptorSize: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceDescriptorSize")); - BREAK_IF_NULL_ARG(a1,r); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP18, "EControlGetDeviceDescriptorSize"); + if (a1 == NULL) + { + r = KErrArgument; + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP19, "NULL Argument"); + break; + } r = iController->GetDeviceDescriptorSize(iClient, *((TDes8*) a1)); break; case RDevUsbcScClient::EControlGetConfigurationDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP20, "EControlGetConfigurationDescriptor"); r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0 , 0, iClient); if (r != KErrNone) PanicClientThread(r); @@ -1922,7 +1962,7 @@ break; case RDevUsbcScClient::EControlGetConfigurationDescriptorSize: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationDescriptorSize")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP21, "EControlGetConfigurationDescriptorSize"); if (a1 != NULL) { r = iController->GetConfigurationDescriptorSize(iClient, *((TDes8*) a1)); @@ -1932,27 +1972,27 @@ break; case RDevUsbcScClient::EControlSetConfigurationDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetConfigurationDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP22, "EControlSetConfigurationDescriptor"); r = iController->SetConfigurationDescriptor(iClient, *((TDes8*) a1)); break; case RDevUsbcScClient::EControlGetInterfaceDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetInterfaceDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP23, "EControlGetInterfaceDescriptor"); r = iController->GetInterfaceDescriptor(iClient, this, (TInt) a1, *((TDes8*) a2)); break; case RDevUsbcScClient::EControlGetInterfaceDescriptorSize: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetInterfaceDescriptorSize")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP24, "EControlGetInterfaceDescriptorSize"); r = iController->GetInterfaceDescriptorSize(iClient, this, (TInt) a1, *(TDes8*) a2); break; case RDevUsbcScClient::EControlSetInterfaceDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetInterfaceDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP25, "EControlSetInterfaceDescriptor"); r = iController->SetInterfaceDescriptor(iClient, this, (TInt) a1, *((TDes8*) a2)); break; case RDevUsbcScClient::EControlGetEndpointDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP26, "EControlGetEndpointDescriptor"); r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo)); if (r != KErrNone) PanicClientThread(r); @@ -1962,7 +2002,7 @@ break; case RDevUsbcScClient::EControlGetEndpointDescriptorSize: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetEndpointDescriptorSize")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP27, "EControlGetEndpointDescriptorSize"); r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo)); if (r != KErrNone) PanicClientThread(r); @@ -1972,7 +2012,7 @@ break; case RDevUsbcScClient::EControlSetEndpointDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetEndpointDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP28, "EControlSetEndpointDescriptor"); r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo)); if (r != KErrNone) PanicClientThread(r); @@ -1982,7 +2022,7 @@ break; case RDevUsbcScClient::EControlGetDeviceQualifierDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetDeviceQualifierDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP29, "EControlGetDeviceQualifierDescriptor"); r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0, 0, iClient); if (r != KErrNone) PanicClientThread(r); @@ -1990,13 +2030,18 @@ break; case RDevUsbcScClient::EControlSetDeviceQualifierDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceQualifierDescriptor")); - BREAK_IF_NULL_ARG(a1,r); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP30, "EControlSetDeviceQualifierDescriptor"); + if (a1 == NULL) + { + r = KErrArgument; + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOREQUEST_DUP31, "NULL Argument"); + break; + } r = iController->SetDeviceQualifierDescriptor(iClient, *((TDes8*) a1)); break; case RDevUsbcScClient::EControlGetOtherSpeedConfigurationDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetOtherSpeedConfigurationDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP32, "EControlGetOtherSpeedConfigurationDescriptor"); r = Kern::ThreadDesWrite(iClient, a1, pZeroDesc, 0 , 0, iClient); if (r != KErrNone) PanicClientThread(r); @@ -2004,23 +2049,23 @@ break; case RDevUsbcScClient::EControlSetOtherSpeedConfigurationDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetOtherSpeedConfigurationDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP33, "EControlSetOtherSpeedConfigurationDescriptor"); r = iController->SetOtherSpeedConfigurationDescriptor(iClient, *((TDes8*) a1)); break; case RDevUsbcScClient::EControlGetCSInterfaceDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSInterfaceDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP34, "EControlGetCSInterfaceDescriptor"); r = iController->GetCSInterfaceDescriptorBlock(iClient, this, (TInt) a1, *((TDes8*) a2)); break; case RDevUsbcScClient::EControlGetCSInterfaceDescriptorSize: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSInterfaceDescriptorSize")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP35, "EControlGetCSInterfaceDescriptorSize"); r = iController->GetCSInterfaceDescriptorBlockSize(iClient, this, (TInt) a1, *(TDes8*) a2); break; case RDevUsbcScClient::EControlGetCSEndpointDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSEndpointDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP36, "EControlGetCSEndpointDescriptor"); r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo)); if (r != KErrNone) PanicClientThread(r); @@ -2030,7 +2075,7 @@ break; case RDevUsbcScClient::EControlGetCSEndpointDescriptorSize: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetCSEndpointDescriptorSize")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP37, "EControlGetCSEndpointDescriptorSize"); r = Kern::ThreadRawRead(iClient, a1, &epInfo, sizeof(epInfo)); if (r != KErrNone) PanicClientThread(r); @@ -2040,38 +2085,38 @@ break; case RDevUsbcScClient::EControlSignalRemoteWakeup: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSignalRemoteWakeup")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP38, "EControlSignalRemoteWakeup"); r = iController->SignalRemoteWakeup(); break; case RDevUsbcScClient::EControlDeviceDisconnectFromHost: - __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceDisconnectFromHost")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP39, "EControlDeviceDisconnectFromHost"); r = iController->UsbDisconnect(); break; case RDevUsbcScClient::EControlDeviceConnectToHost: - __KTRACE_OPT(KUSB, Kern::Printf("EControlDeviceConnectToHost")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP40, "EControlDeviceConnectToHost"); r = iController->UsbConnect(); break; case RDevUsbcScClient::EControlDevicePowerUpUdc: - __KTRACE_OPT(KUSB, Kern::Printf("EControlDevicePowerUpUdc")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP41, "EControlDevicePowerUpUdc"); r = iController->PowerUpUdc(); break; case RDevUsbcScClient::EControlSetDeviceControl: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceControl")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP42, "EControlSetDeviceControl"); r = iController->SetDeviceControl(this); if (r == KErrNone) { iOwnsDeviceControl = ETrue; if (iEp0Endpoint == NULL) { - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetDeviceControl")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP43, "EControlSetDeviceControl"); r = SetupEp0(); if (r != KErrNone) { - __KTRACE_OPT(KPANIC, Kern::Printf(" Error: SetupEp0() failed")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP44, " Error: SetupEp0() failed"); iController->ReleaseDeviceControl(this); iOwnsDeviceControl=EFalse; DestroyEp0(); @@ -2083,12 +2128,12 @@ break; case RDevUsbcScClient::EControlCurrentlyUsingHighSpeed: - __KTRACE_OPT(KUSB, Kern::Printf("EControlCurrentlyUsingHighSpeed")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP45, "EControlCurrentlyUsingHighSpeed"); r = iController->CurrentlyUsingHighSpeed(); break; case RDevUsbcScClient::EControlSetInterface: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetInterface")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP46, "EControlSetInterface"); r = Kern::ThreadRawRead(iClient, a2, &ifcInfo, sizeof(ifcInfo)); if (r != KErrNone) PanicClientThread(r); @@ -2096,7 +2141,7 @@ break; case RDevUsbcScClient::EControlReleaseInterface: - __KTRACE_OPT(KUSB, Kern::Printf("EControlReleaseInterface")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP47, "EControlReleaseInterface"); if (!iRealizeCalled) { r = iController->ReleaseInterface(this, (TInt) a1); @@ -2106,7 +2151,7 @@ } else { - __KTRACE_OPT(KPANIC, Kern::Printf(" Error in PIL: LDD interface won't be released.")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP48, " Error in PIL: LDD interface won't be released."); } } else @@ -2114,7 +2159,7 @@ break; case RDevUsbcScClient::EControlSetCSInterfaceDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetCSInterfaceDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP49, "EControlSetCSInterfaceDescriptor"); r = Kern::ThreadRawRead(iClient, a1, &desInfo, sizeof(desInfo)); if (r != KErrNone) PanicClientThread(r); @@ -2124,7 +2169,7 @@ break; case RDevUsbcScClient::EControlSetCSEndpointDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetCSEndpointDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP50, "EControlSetCSEndpointDescriptor"); r = Kern::ThreadRawRead(iClient, a1, &desInfo, sizeof(desInfo)); if (r != KErrNone) PanicClientThread(r); @@ -2135,93 +2180,93 @@ break; case RDevUsbcScClient::EControlGetStringDescriptorLangId: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetStringDescriptorLangId")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP51, "EControlGetStringDescriptorLangId"); r = iController->GetStringDescriptorLangId(iClient, *((TDes8*) a1)); break; case RDevUsbcScClient::EControlSetStringDescriptorLangId: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetStringDescriptorLangId")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP52, "EControlSetStringDescriptorLangId"); r = iController->SetStringDescriptorLangId(reinterpret_cast(a1)); break; case RDevUsbcScClient::EControlGetManufacturerStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetManufacturerStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP53, "EControlGetManufacturerStringDescriptor"); r = iController->GetManufacturerStringDescriptor(iClient, *((TPtr8*) a1)); break; case RDevUsbcScClient::EControlSetManufacturerStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetManufacturerStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP54, "EControlSetManufacturerStringDescriptor"); r = iController->SetManufacturerStringDescriptor(iClient, *((TPtr8*) a1)); break; case RDevUsbcScClient::EControlRemoveManufacturerStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveManufacturerStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP55, "EControlRemoveManufacturerStringDescriptor"); r = iController->RemoveManufacturerStringDescriptor(); break; case RDevUsbcScClient::EControlGetProductStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetProductStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP56, "EControlGetProductStringDescriptor"); r = iController->GetProductStringDescriptor(iClient, *((TPtr8*) a1)); break; case RDevUsbcScClient::EControlSetProductStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetProductStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP57, "EControlSetProductStringDescriptor"); r = iController->SetProductStringDescriptor(iClient, *((TPtr8*) a1)); break; case RDevUsbcScClient::EControlRemoveProductStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveProductStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP58, "EControlRemoveProductStringDescriptor"); r = iController->RemoveProductStringDescriptor(); break; case RDevUsbcScClient::EControlGetSerialNumberStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetSerialNumberStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP59, "EControlGetSerialNumberStringDescriptor"); r = iController->GetSerialNumberStringDescriptor(iClient, *((TPtr8*) a1)); break; case RDevUsbcScClient::EControlSetSerialNumberStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetSerialNumberStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP60, "EControlSetSerialNumberStringDescriptor"); r = iController->SetSerialNumberStringDescriptor(iClient, *((TPtr8*) a1)); break; case RDevUsbcScClient::EControlRemoveSerialNumberStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveSerialNumberStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP61, "EControlRemoveSerialNumberStringDescriptor"); r = iController->RemoveSerialNumberStringDescriptor(); break; case RDevUsbcScClient::EControlGetConfigurationStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetConfigurationStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP62, "EControlGetConfigurationStringDescriptor"); r = iController->GetConfigurationStringDescriptor(iClient, *((TPtr8*) a1)); break; case RDevUsbcScClient::EControlSetConfigurationStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetConfigurationStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP63, "EControlSetConfigurationStringDescriptor"); r = iController->SetConfigurationStringDescriptor(iClient, *((TPtr8*) a1)); break; case RDevUsbcScClient::EControlRemoveConfigurationStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveConfigurationStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP64, "EControlRemoveConfigurationStringDescriptor"); r = iController->RemoveConfigurationStringDescriptor(); break; case RDevUsbcScClient::EControlGetStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP65, "EControlGetStringDescriptor"); r = iController->GetStringDescriptor(iClient, (TUint8) (TInt) a1, *((TPtr8*) a2)); break; case RDevUsbcScClient::EControlSetStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP66, "EControlSetStringDescriptor"); r = iController->SetStringDescriptor(iClient, (TUint8) (TInt) a1, *((TPtr8*) a2)); break; case RDevUsbcScClient::EControlRemoveStringDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlRemoveStringDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP67, "EControlRemoveStringDescriptor"); r = iController->RemoveStringDescriptor((TUint8) (TInt) a1); break; case RDevUsbcScClient::EControlAllocateEndpointResource: { - __KTRACE_OPT(KUSB, Kern::Printf("EControlAllocateEndpointResource")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP68, "EControlAllocateEndpointResource"); epRes = (TUsbcEndpointResource)((TInt) a2); TInt realEp=-1; r = GetRealEpForEpResource((TInt)a1, realEp); @@ -2231,7 +2276,7 @@ } case RDevUsbcScClient::EControlDeAllocateEndpointResource: { - __KTRACE_OPT(KUSB, Kern::Printf("EControlDeAllocateEndpointResource")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP69, "EControlDeAllocateEndpointResource"); epRes = (TUsbcEndpointResource)((TInt) a2); TInt realEp=-1; r = GetRealEpForEpResource((TInt)a1, realEp); @@ -2241,7 +2286,7 @@ } case RDevUsbcScClient::EControlQueryEndpointResourceUse: { - __KTRACE_OPT(KUSB, Kern::Printf("EControlQueryEndpointResourceUse")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP70, "EControlQueryEndpointResourceUse"); epRes = (TUsbcEndpointResource)((TInt) a2); TInt realEp=-1; r = GetRealEpForEpResource((TInt)a1, realEp); @@ -2250,31 +2295,31 @@ break; } case RDevUsbcScClient::EControlSetOtgDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlSetOtgDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP71, "EControlSetOtgDescriptor"); r = iController->SetOtgDescriptor(iClient, *((const TDesC8*)a1)); break; case RDevUsbcScClient::EControlGetOtgDescriptor: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetOtgDescriptor")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP72, "EControlGetOtgDescriptor"); r = iController->GetOtgDescriptor(iClient, *((TDes8*)a1)); break; case RDevUsbcScClient::EControlGetOtgFeatures: - __KTRACE_OPT(KUSB, Kern::Printf("EControlGetOtgFeatures")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP73, "EControlGetOtgFeatures"); r = iController->GetOtgFeatures(iClient, *((TDes8*)a1)); break; case RDevUsbcScClient::EControlRealizeInterface: - __KTRACE_OPT(KUSB, Kern::Printf("EControlRealizeInterface")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP74, "EControlRealizeInterface"); r = RealizeInterface(); break; case RDevUsbcScClient::EControlStartNextInAlternateSetting: - __KTRACE_OPT(KUSB, Kern::Printf("EControlStartNextInAlternateSetting")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP75, "EControlStartNextInAlternateSetting"); r = StartNextInAlternateSetting(); break; default: - __KTRACE_OPT(KUSB, Kern::Printf("Function code not supported")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOCONTROL_DUP76, "Function code not supported"); r = KErrNotSupported; } @@ -2289,12 +2334,13 @@ // TInt DLddUsbcScChannel::RequestUserHandle(DThread* aThread, TOwnerType /*aType*/) { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::RequestUserHandle")); - // The USB client LDD can share across process, but can't use simultanously. - // This mean if transfer the handle to another process, can't access this channel - // in the origin process and any call to the channel will return with KErrAccessDenied. - // If there is async request scheduled, can't transfer channel handle to another process - // and return KErrAccessDenied. + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_REQUESTUSERHANDLE, "DLddUsbcScChannel::RequestUserHandle" ); + + // The USB client LDD is not designed for a channel to be shared between + // threads. It saves a pointer to the current thread when it is opened, and + // uses this to complete any asynchronous requests. + // It is therefore not acceptable for the handle to be duplicated and used + // by another thread: if (aThread == iClient) { return KErrNone; @@ -2332,7 +2378,7 @@ iBuffers[i].iStatusList.SetClient(*iClient); } } - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::handle %d", iChunkInfo->iChunk->AccessCount())); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REQUESTUSERHANDLE_DUP1, "DLddUsbcScChannel::handle %d", iChunkInfo->iChunk->AccessCount()); return KErrNone; } } @@ -2402,18 +2448,18 @@ TUsbcScInterfaceInfoBuf* const ifc_info_buf_ptr = aInfoBuf->iInterfaceData; const TInt srcLen = Kern::ThreadGetDesLength(iClient, ifc_info_buf_ptr); - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface srcLen = %d len = %d", srcLen, ifc_info_buf.Length() )); - + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE, "SetInterface srcLen = %d len = %d", srcLen, ifc_info_buf.Length()); + if (srcLen < ifc_info_buf.Length()) { - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface can't copy")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP1, "SetInterface can't copy"); PanicClientThread(EDesOverflow); } TInt r = Kern::ThreadDesRead(iClient, ifc_info_buf_ptr, ifc_info_buf, 0, KChunkShiftBy0); if (r != KErrNone) { - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface Copy failed reason=%d", r)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP2, "SetInterface Copy failed reason=%d", r); PanicClientThread(r); } @@ -2421,7 +2467,7 @@ TUsbcScEndpointInfo* pEndpointData = ifc_info_buf().iEndpointData; const TInt num_endpoints = ifc_info_buf().iTotalEndpointsUsed; - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface num_endpoints=%d", num_endpoints)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP3, "SetInterface num_endpoints=%d", num_endpoints); if (num_endpoints>KMaxEndpointsPerClient) return KErrOverflow; @@ -2434,7 +2480,7 @@ // See if PIL will accept this interface - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface Calling controller")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP4, "SetInterface Calling controller"); TUsbcEndpointInfoArray endpointData = TUsbcEndpointInfoArray(ifc_info_buf().iEndpointData); r = iController->SetInterface(this, @@ -2447,10 +2493,10 @@ &real_ep_numbers[0], ifc_info_buf().iFeatureWord); - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface controller returned %d", r)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP5, "SetInterface controller returned %d", r); if (r != KErrNone) { - __KTRACE_OPT(KPANIC, Kern::Printf("SetInterface failed reason=%d", r)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP6, "SetInterface failed reason=%d", r); return r; } @@ -2465,8 +2511,7 @@ // other endpoints for (TInt i = 1; i <= num_endpoints; i++, pEndpointData++) { - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface for ep=%d", i)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP7, "SetInterface for ep=%d", i); if ((pEndpointData->iType==KUsbEpTypeControl) || (pEndpointData->iDir != KUsbEpDirIn && pEndpointData->iDir != KUsbEpDirOut) || (pEndpointData->iSize > 1024) || (pEndpointData->iSize<=0)) @@ -2497,9 +2542,8 @@ goto CleanUp; } - - __KTRACE_OPT(KUSB, Kern::Printf("SetInterface for ep=%d rec=0x%08x ep==0x%08x", - i, alternateSettingListRec, ep)); + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP8, "SetInterface for ep=%d rec=0x%08x ep==0x%08x", + i, (TUint)alternateSettingListRec, (TUint)ep); } if (iAlternateSettingList->iHead) @@ -2533,8 +2577,12 @@ ReleaseInterface: #if _DEBUG +#ifdef OST_TRACE_COMPILER_IN_USE TInt r1 = iController->ReleaseInterface(this, aInterfaceNumber); - __KTRACE_OPT(KUSB, Kern::Printf("Release Interface controller returned %d", r1)); +#else + (void) iController->ReleaseInterface(this, aInterfaceNumber); +#endif + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_SETINTERFACE_DUP9, "Release Interface controller returned %d", r1); #else (void) iController->ReleaseInterface(this, aInterfaceNumber); #endif @@ -2552,9 +2600,13 @@ if (mem!=NULL) { TInt j; - Kern::Printf("Final chunk header State:"); - for (j=0; j<30; j+=8) - Kern::Printf("%2x: %8x %8x %8x %8x %8x %8x %8x %8x", j, mem[j], mem[j+1], mem[j+2], mem[j+3], mem[j+4], mem[j+5], mem[j+6], mem[j+7] ); + OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_NORMAL, _REALIZEINTERFACE_DUMP, "Final chunk header State:" ); + + for (j=0; j<30; j+=8) + { + OstTrace1(TRACE_NORMAL, _REALIZEINTERFACE_DUMP_DUP1, "%2x", j); + OstTraceExt1(TRACE_NORMAL, _REALIZEINTERFACE_DUMP_DUP2, "%{uint32[]}", TOstArray(&mem[j], 8)); + } }; }; #endif @@ -2645,7 +2697,8 @@ iBuffers = (TUsbcScBuffer *) Kern::AllocZ(sizeof(TUsbcScBuffer) * (bufInfo.iTotalBuffers+2)); // +2 is for ep0. if (!iBuffers) { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Error: Alloc iBufers failed!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE, "Realize: Error: Alloc iBufers failed!" ); + errorOrChunk = KErrNoMemory; goto realize_end; } @@ -2654,19 +2707,18 @@ errorOrChunk = SetupEp0(); if (errorOrChunk) { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: SetupEp0 . ERROR %d",errorOrChunk)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP1, "Realize: SetupEp0 . ERROR %d",errorOrChunk); goto realize_end; } ep0Size = iEp0Endpoint->EndpointInfo()->iSize; - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Setup EP0. max packet size %d", ep0Size)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP2, "Realize: Setup EP0. max packet size %d", ep0Size); // Create EP0 buffers iEP0OutBuff=bufInfo.iTotalBuffers; errorOrChunk = iBuffers[iEP0OutBuff].Construct(KUsbcScBiOut, this, KUsbScEP0OutBufPos, KUsbScEP0OutBufEnd, ep0Size, ep0Size, ep0Size); if (errorOrChunk) { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Setup EP0 Out. ERROR %d",errorOrChunk)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP3, "Realize: Setup EP0 Out. ERROR %d",errorOrChunk); goto realize_end; } @@ -2681,7 +2733,7 @@ errorOrChunk = iBuffers[iEP0InBuff].Construct( KUsbcScBiIn , this, KUsbScEP0InBufPos , KUsbScEP0InBufEnd , ep0Size, ep0Size, ep0Size); if (errorOrChunk) { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Setup EP0 In. ERROR %d",errorOrChunk)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP4, "Realize: Setup EP0 In. ERROR %d",errorOrChunk); goto realize_end; } @@ -2695,8 +2747,7 @@ } // end ep0Size scope // Create resources and tables. . . . . . - __KTRACE_OPT(KUSB, Kern::Printf("Realize: Create resources tables")); - + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP5, "Realize: Create resources tables"); { // scope of bufNum // For each EP buffer TInt buffNum=0; @@ -2718,8 +2769,7 @@ { TInt bufStart = offset; - __KTRACE_OPT(KUSB, Kern::Printf("Realize: buf row:%d inout %d, iBufferOffset[%d+2]=%x",endpoint, inout, buffNum, bufStart)); - + OstTraceDefExt4(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP6, "Realize: buf row:%d inout %d, iBufferOffset[%d+2]=%x",endpoint, (TUint)inout, (TUint)buffNum, (TUint)bufStart); bufsd = &(bufInfo.iBufs[inout]); // and then point all endpoints that use it, towards it. TInt altSetting; @@ -2749,13 +2799,13 @@ if (endpointRecord->EndpointInfo()->iReadSize) maxReadSize = (maxReadSize <= endpointRecord->EndpointInfo()->iReadSize) ? maxReadSize : endpointRecord->EndpointInfo()->iReadSize; - - __KTRACE_OPT(KUSB, Kern::Printf("Realize: endpointNum %d in altSetting %d, alt table @ %d", - endpointNumber, altSetting,bufInfo.iAltSettingsTbl->iAltTableOffset[altSetting])); + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP7, "Realize: endpointNum %d in altSetting %d, alt table @ %d", + endpointNumber, (TUint)altSetting,bufInfo.iAltSettingsTbl->iAltTableOffset[altSetting]); + } else { - __KTRACE_OPT(KUSB, Kern::Printf("Realize: endpointNum NA in altSetting %d", altSetting)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP8, "Realize: endpointNum NA in altSetting %d", altSetting); } } // end for @@ -2827,7 +2877,7 @@ #endif realize_end: - __KTRACE_OPT(KUSB, Kern::Printf("Realize: cleanup. Err=%d", errorOrChunk)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP9, "Realize: cleanup. Err=%d", errorOrChunk); // Here we clean up after either success, or after bailing out early. bufInfo.Free(); @@ -2870,7 +2920,7 @@ if (openedCS) NKern::ThreadLeaveCS(); - __KTRACE_OPT(KUSB, Kern::Printf("Realize: returning %x (%d)", errorOrChunk, errorOrChunk)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REALIZEINTERFACE_DUP10, "Realize: returning %x (%d)", errorOrChunk, errorOrChunk); return errorOrChunk; } // End RealizeInterface @@ -2881,7 +2931,8 @@ void DLddUsbcScChannel::DestroyAllInterfaces() { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DestroyAllInterfaces")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_DESTROYALLINTERFACES, "DLddUsbcScChannel::DestroyAllInterfaces" ); + // Removes all interfaces if (iAlternateSettingList) { @@ -2892,7 +2943,7 @@ { iAlternateSettingList->iTail = alternateSettingListRec->iPrevious; // If this contains NULL now that is only possible if the record to be deleted was at the head - __KTRACE_OPT(KUSB, Kern::Printf("Release interface %d \n", alternateSettingListRec->iSetting)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DESTROYALLINTERFACES_DUP1, "Release interface %d \n", alternateSettingListRec->iSetting); iController->ReleaseInterface(this, alternateSettingListRec->iSetting); delete alternateSettingListRec; if (iAlternateSettingList->iTail == NULL) //No more interfaces left @@ -2911,7 +2962,7 @@ iAlternateSettingList = NULL; iValidInterface = EFalse; - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DestroyAllInterfaces done")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DESTROYALLINTERFACES_DUP2, "DLddUsbcScChannel::DestroyAllInterfaces done"); } @@ -2924,7 +2975,7 @@ void DLddUsbcScChannel::DestroyInterface(TUint aInterfaceNumber) { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DestroyInterface \n")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_DESTROYINTERFACE, "DLddUsbcScChannel::DestroyInterface \n" ); if (iAlternateSetting == aInterfaceNumber) { @@ -2954,7 +3005,7 @@ } else //Somewhere in the middle (would not expect this in normal operation, but here for completeness) { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DestroyInterface Middle interface!\n")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DESTROYINTERFACE_DUP1, "DLddUsbcScChannel::DestroyInterface Middle interface!\n" ); alternateSettingListRec->iPrevious->iNext = alternateSettingListRec->iNext; alternateSettingListRec->iNext->iPrevious = alternateSettingListRec->iPrevious; } @@ -3004,7 +3055,8 @@ void DLddUsbcScChannel::DestroyEp0() { - __KTRACE_OPT(KUSB, Kern::Printf(" DLddUsbcScChannel::DestroyEp0")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_DESTROYEP0, "DLddUsbcScChannel::DestroyEp0" ); + delete iEp0Endpoint; iEp0Endpoint = NULL; } @@ -3014,11 +3066,12 @@ { DLddUsbcScChannel* channel = (DLddUsbcScChannel*) aDLddUsbcScChannel; - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::RequestCallbackEp0")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_REQUESTCALLBACKEP0, "DLddUsbcScChannel::RequestCallbackEp0" ); + if (channel->ChannelClosing()) { - __KTRACE_OPT(KUSB, Kern::Printf("Channel Closing: Completion not accepted!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_REQUESTCALLBACKEP0_DUP1, "Channel Closing: Completion not accepted!" ); return; } @@ -3031,7 +3084,7 @@ channel->iBuffers[channel->iEP0OutBuff].CompleteRead(); return; default: - Kern::Printf("DLddUsbcScChannel::RequestCallbackEp0 - Unexpected completion direction %d",channel->iEp0Endpoint->iRequestCallbackInfo->iTransferDir); + OstTrace1(TRACE_NORMAL, DLDDUSBCSCCHANNEL_REQUESTCALLBACKEP0_DUP2, "DLddUsbcScChannel::RequestCallbackEp0 - Unexpected completion direction %d",channel->iEp0Endpoint->iRequestCallbackInfo->iTransferDir); Kern::Fault("DLddUsbcScChannel::RequestCallbackEp0", __LINE__); } } @@ -3047,7 +3100,8 @@ void DLddUsbcScChannel::EndpointStatusChangeCallback(TAny* aDLddUsbcScChannel) { - __KTRACE_OPT(KUSB, Kern::Printf("EndpointStatusChangeCallback")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_ENDPOINTSTATUSCHANGECALLBACK, "DLddUsbcScChannel::EndpointStatusChangeCallback" ); + DLddUsbcScChannel* dUsbc = (DLddUsbcScChannel*) aDLddUsbcScChannel; if (dUsbc->iChannelClosing) return; @@ -3055,7 +3109,7 @@ const TInt reqNo = (TInt) RDevUsbcScClient::ERequestEndpointStatusNotify; if (dUsbc->iRequestStatus[reqNo]) { - __KTRACE_OPT(KUSB, Kern::Printf("EndpointStatusChangeCallback Notify status")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_ENDPOINTSTATUSCHANGECALLBACK_DUP1, "EndpointStatusChangeCallback Notify status" ); DThread* client = dUsbc->iClient; // set client descriptor length to zero TInt r = Kern::ThreadRawWrite(client, dUsbc->iEndpointStatusChangePtr, &endpointState, @@ -3084,7 +3138,8 @@ (i < KUsbcDeviceStateRequests) && ((deviceState = dUsbc->iStatusCallbackInfo.State(i)) != EUsbcNoState); ++i) { - __KTRACE_OPT(KUSB, Kern::Printf("StatusChangeCallBack status=%d", deviceState)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_STATUSCHANGECALLBACK, "StatusChangeCallBack status=%d", deviceState); + if (deviceState & KUsbAlternateSetting) { dUsbc->ProcessAlternateSetting(deviceState); @@ -3114,7 +3169,8 @@ void DLddUsbcScChannel::OtgFeatureChangeCallback(TAny* aDLddUsbcScChannel) { - __KTRACE_OPT(KUSB, Kern::Printf("OtgFeatureChangeCallback")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_OTGFEATURECHANGECALLBACK, "DLddUsbcScChannel::OtgFeatureChangeCallback" ); + DLddUsbcScChannel* dUsbc = (DLddUsbcScChannel*) aDLddUsbcScChannel; if (dUsbc->iChannelClosing) return; @@ -3126,7 +3182,7 @@ const TInt reqNo = (TInt) RDevUsbcScClient::ERequestOtgFeaturesNotify; if (dUsbc->iRequestStatus[reqNo]) { - __KTRACE_OPT(KUSB, Kern::Printf("OtgFeatureChangeCallback Notify status")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_OTGFEATURECHANGECALLBACK_DUP1, "OtgFeatureChangeCallback Notify status" ); TInt r = Kern::ThreadRawWrite(dUsbc->iClient, dUsbc->iOtgFeatureChangePtr, &features, sizeof(TUint8), dUsbc->iClient); if (r != KErrNone) @@ -3204,14 +3260,15 @@ } else { - __KTRACE_OPT(KPANIC, Kern::Printf(" Error: aEndpoint %d wrong for aAlternateSetting %d", - aEndpoint, aAlternateSetting)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DLDDUSBCSCCHANNEL_EPFROMALTERNATESETTING, " Error: aEndpoint %d wrong for aAlternateSetting %d", + aEndpoint, aAlternateSetting); + return KErrNotFound; } } alternateSettingListRec = alternateSettingListRec->iNext; } - __KTRACE_OPT(KPANIC, Kern::Printf(" Error: no aAlternateSetting %d found", aAlternateSetting)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_FATAL, DLDDUSBCSCCHANNEL_EPFROMALTERNATESETTING_DUP1, " Error: no aAlternateSetting %d found", aAlternateSetting); return KErrNotFound; } @@ -3223,7 +3280,8 @@ { TUint newSetting = aAlternateSetting&(~KUsbAlternateSetting); - __KTRACE_OPT(KUSB, Kern::Printf("ProcessAlternateSetting 0x%08x selecting alternate setting 0x%08x", aAlternateSetting, newSetting)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_PROCESSALTERNATESETTING, "ProcessAlternateSetting 0x%08x selecting alternate setting 0x%08x", aAlternateSetting, newSetting); + iUserKnowsAltSetting=EFalse; iAlternateSetting = newSetting; iAsSeq++; @@ -3247,19 +3305,20 @@ TInt DLddUsbcScChannel::ProcessDeviceState(TUsbcDeviceState aDeviceState) { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::ProcessDeviceState(%d -> %d)", iDeviceState, aDeviceState)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_PROCESSDEVICESTATE, "DLddUsbcScChannel::ProcessDeviceState(%d -> %d)", iDeviceState, aDeviceState); + if (iDeviceState == aDeviceState) { - __KTRACE_OPT(KUSB, Kern::Printf(" No state change => nothing to be done.")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_PROCESSDEVICESTATE_DUP1, " No state change => nothing to be done."); return KErrNone; } if (iDeviceState == EUsbcDeviceStateSuspended) { - __KTRACE_OPT(KUSB, Kern::Printf(" Coming out of Suspend: old state = %d", iOldDeviceState)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_PROCESSDEVICESTATE_DUP2, " Coming out of Suspend: old state = %d", iOldDeviceState); iDeviceState = iOldDeviceState; if (iDeviceState == aDeviceState) { - __KTRACE_OPT(KUSB, Kern::Printf(" New state same as before Suspend => nothing to be done.")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_PROCESSDEVICESTATE_DUP3, " New state same as before Suspend => nothing to be done."); return KErrNone; } } @@ -3268,7 +3327,7 @@ TInt cancellationCode = KErrNone; if (aDeviceState == EUsbcDeviceStateSuspended) { - __KTRACE_OPT(KUSB, Kern::Printf(" Suspending...")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_PROCESSDEVICESTATE_DUP4, " Suspending..."); iOldDeviceState = iDeviceState; // Put PSL into low power mode here } @@ -3300,10 +3359,10 @@ } else if (renumerateState) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChannel:: Reumerated!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_PROCESSDEVICESTATE_DUP5, "TUsbcScChannel:: Reumerated!"); // Select main interface & latch in new endpoint set SelectAlternateSetting(0); - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScChannel:: StartReads!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_PROCESSDEVICESTATE_DUP6, "TUsbcScChannel:: StartReads!"); StartEpReads(); } } @@ -3331,7 +3390,8 @@ { // Device state waiting to be sent userside completeNow = ETrue; - __KTRACE_OPT(KUSB, Kern::Printf("StatusChangeCallback Notify status")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_ALTERNATEDEVICESTATETESTCOMPLETE, "StatusChangeCallback Notify status" ); + // set client descriptor length to zero TInt r = Kern::ThreadRawWrite(iClient, iStatusChangePtr, &deviceState, sizeof(TUint32), iClient); @@ -3346,7 +3406,8 @@ void DLddUsbcScChannel::DeConfigure(TInt aErrorCode) { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DeConfigure()")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_DECONFIGURE, "DLddUsbcScChannel::DeConfigure()" ); + // Called after deconfiguration. Cancels transfers on all endpoints. ResetInterface(aErrorCode); // Cancel the endpoint status notify request if it is outstanding. @@ -3366,29 +3427,27 @@ { // Queued after enumeration. Starts reads on all endpoints. // The endpoint itself decides if it can do a read - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::StartEpReads - 1")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_STARTEPREADS, "DLddUsbcScChannel::StartEpReads - 1" ); TInt i; TInt8 needsPacket; for (i=0; iAbortTransfer(); // All OUT endpoints need a packet sent, to indicate the termination of the current ep 'pipe'. @@ -3439,7 +3499,8 @@ TInt DLddUsbcScChannel::DoEmergencyComplete() { - __KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcScChannel::DoEmergencyComplete")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, DLDDUSBCSCCHANNEL_DOEMERGENCYCOMPLETE, "DLddUsbcScChannel::DoEmergencyComplete" ); + // cancel any pending DFCs // complete all client requests @@ -3462,7 +3523,7 @@ // Complete other Eps request for (i = 1; i <= iNumberOfEndpoints; i++) { - __KTRACE_OPT(KUSB, Kern::Printf("Cancelling transfer ep=%d", i)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOEMERGENCYCOMPLETE_DUP1, "Cancelling transfer ep=%d", i); buffer=iEndpoint[i]->GetBuffer(); buffer->iStatusList.CancelQueued(); buffer->iStatusList.Complete(KErrDisconnected); @@ -3474,7 +3535,7 @@ { if (iRequestStatus[i]) { - __KTRACE_OPT(KUSB, Kern::Printf("Complete request 0x%x", iRequestStatus[i])); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DLDDUSBCSCCHANNEL_DOEMERGENCYCOMPLETE_DUP2, "Complete request 0x%x", iRequestStatus[i]); Kern::RequestComplete(iClient, iRequestStatus[i], KErrDisconnected); } } @@ -3517,14 +3578,15 @@ iBytesTransferred(0), iBuffer(NULL) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::TUsbcScEndpoint")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, TUSBCSCENDPOINT_TUSBCSCENDPOINT_CONS, "TUsbcScEndpoint::TUsbcScEndpoint" ); + } TInt TUsbcScEndpoint::Construct() { - __KTRACE_OPT(KUSB,Kern::Printf("TUsbcScEndpoint::TUsbcScEndpoint iEndpointNumber %d\n",iEndpointNumber)); - + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_CONSTRUCT, "TUsbcScEndpoint::TUsbcScEndpoint iEndpointNumber %d\n",iEndpointNumber); + iRequestCallbackInfo = new TUsbcRequestCallback(iLdd, iEndpointNumber, (iEndpointNumber==0)?DLddUsbcScChannel::RequestCallbackEp0:TUsbcScEndpoint::RequestCallback, @@ -3538,7 +3600,8 @@ TUsbcScEndpoint::~TUsbcScEndpoint() { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::~TUsbcScEndpoint(%d)", iEndpointNumber)); + OstTraceDef1(OST_TRACE_CATEGORY_RND, TRACE_FLOW, TUSBCSCENDPOINT_TUSBCSCENDPOINT_DES, "TUsbcScEndpoint::~TUsbcScEndpoint(%d)", iEndpointNumber); + AbortTransfer(); delete iRequestCallbackInfo; } @@ -3548,11 +3611,11 @@ void TUsbcScEndpoint::RequestCallback(TAny* aTUsbcScEndpoint) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::RequestCallback")); - + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, TUSBCSCENDPOINT_REQUESTCALLBACK, "TUsbcScEndpoint::RequestCallback" ); + if (((TUsbcScEndpoint*)aTUsbcScEndpoint)->iLdd->ChannelClosing()) { - __KTRACE_OPT(KUSB, Kern::Printf("Channel Closing: Completion not accepted!")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_REQUESTCALLBACK_DUP1, "Channel Closing: Completion not accepted!" ); return; } @@ -3565,7 +3628,7 @@ ((TUsbcScEndpoint*) aTUsbcScEndpoint)->iBuffer->CompleteRead(); return; default: - Kern::Printf("TUsbcScEndpoint::RequestCallback - Unexpected compleation direction %d",((TUsbcScEndpoint*) aTUsbcScEndpoint)->iRequestCallbackInfo->iTransferDir); + OstTrace1(TRACE_NORMAL, TUSBCSCENDPOINT_REQUESTCALLBACK_DUP2, "TUsbcScEndpoint::RequestCallback - Unexpected compleation direction %d",((TUsbcScEndpoint*) aTUsbcScEndpoint)->iRequestCallbackInfo->iTransferDir); Kern::Fault("TUsbcScEndpoint::RequestCallback", __LINE__); } } @@ -3581,12 +3644,13 @@ { if (!iLdd->iRealizeCalled) { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::AbortTransfer Ep# %d Real Ep # %d - N.R.",iEndpointNumber, iRealEpNumber)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_ABORTTRANSFER, "TUsbcScEndpoint::AbortTransfer Ep# %d Real Ep # %d - N.R.",iEndpointNumber, iRealEpNumber); + return; } else { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint::AbortTransfer Ep# %d Real Ep # %d",iEndpointNumber, iRealEpNumber)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_ABORTTRANSFER_DUP1, "TUsbcScEndpoint::AbortTransfer Ep# %d Real Ep # %d",iEndpointNumber, iRealEpNumber); } @@ -3600,17 +3664,18 @@ { if (iEndpointNumber!=0) // endpoint zero starts off not sent in any direction, then keeps changing. { - __KTRACE_OPT(KUSB,Kern::Printf("\nTUsbcScEndpoint::AbortTransfer WARNING: Invalid Direction %d on (%d,%d)!\n",iRequestCallbackInfo->iTransferDir,iEndpointNumber, iRealEpNumber)); + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_ABORTTRANSFER_DUP2, "\nTUsbcScEndpoint::AbortTransfer WARNING: Invalid Direction %d on (%d,%d)!\n",iRequestCallbackInfo->iTransferDir,iEndpointNumber, iRealEpNumber); } else { - __KTRACE_OPT(KUSB, Kern::Printf("\nTUsbcScEndpoint::AbortTransfer Can't stop direction %d on (%d,%d)!\n",iRequestCallbackInfo->iTransferDir,iEndpointNumber, iRealEpNumber)); + OstTraceDefExt3(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_ABORTTRANSFER_DUP3, "\nTUsbcScEndpoint::AbortTransfer Can't stop direction %d on (%d,%d)!\n",iRequestCallbackInfo->iTransferDir,iEndpointNumber, iRealEpNumber); } } } else if (!iBuffer) { - __KTRACE_OPT(KUSB,Kern::Printf("\nTUsbcScEndpoint::AbortTransfer WARNING: iBuffer is NULL on (%d,%d)\n",iEndpointNumber, iRealEpNumber)); + OstTraceDefExt2(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_ABORTTRANSFER_DUP4, "\nTUsbcScEndpoint::AbortTransfer WARNING: iBuffer is NULL on (%d,%d)\n",iEndpointNumber, iRealEpNumber); + return; } @@ -3618,10 +3683,11 @@ iRequestCallbackInfo->iDfc.Cancel(); else { - __KTRACE_OPT(KUSB,Kern::Printf("\nTUsbcScEndpoint::AbortTransfer WARNING: iRequestCallbackInfo is NULL\n")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_ABORTTRANSFER_DUP5, "\nTUsbcScEndpoint::AbortTransfer WARNING: iRequestCallbackInfo is NULL\n"); + } - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScEndpoint Done.")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, TUSBCSCENDPOINT_ABORTTRANSFER_DUP6, "TUsbcScEndpoint Done."); } // End TUsbcScEndpoint @@ -3650,7 +3716,8 @@ TUsbcScAlternateSetting::~TUsbcScAlternateSetting() { - __KTRACE_OPT(KUSB, Kern::Printf("TUsbcScAlternateSetting::~TUsbcScAlternateSetting()")); + OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_FLOW, TUSBCSCALTERNATESETTING_TUSBCSCALTERNATESETTING_DES, "TUsbcScAlternateSetting::~TUsbcScAlternateSetting()" ); + for (TInt i = 0; i <= KMaxEndpointsPerClient; i++) { delete iEndpoint[i];