kernel/eka/drivers/usbc/d_usbc.cpp
changeset 90 947f0dc9f7a8
parent 33 0173bcd7697c
child 253 d37db4dcc88d
equal deleted inserted replaced
52:2d65c2f76d7b 90:947f0dc9f7a8
   151 DLddUsbcChannel::~DLddUsbcChannel()
   151 DLddUsbcChannel::~DLddUsbcChannel()
   152 	{
   152 	{
   153 	__KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcChannel::~DLddUsbcChannel()"));
   153 	__KTRACE_OPT(KUSB, Kern::Printf("DLddUsbcChannel::~DLddUsbcChannel()"));
   154 	if (iController)
   154 	if (iController)
   155 		{
   155 		{
       
   156 		iController->DeRegisterClient(this);
   156 		iStatusCallbackInfo.Cancel();
   157 		iStatusCallbackInfo.Cancel();
   157 		iEndpointStatusCallbackInfo.Cancel();
   158 		iEndpointStatusCallbackInfo.Cancel();
   158         iOtgFeatureCallbackInfo.Cancel();
   159         iOtgFeatureCallbackInfo.Cancel();
   159         iCompleteAllCallbackInfo.Cancel();
   160         iCompleteAllCallbackInfo.Cancel();
   160 		AbortInterface();
   161 		AbortInterface();
   162 		if (iOwnsDeviceControl)
   163 		if (iOwnsDeviceControl)
   163 			{
   164 			{
   164 			iController->ReleaseDeviceControl(this);
   165 			iController->ReleaseDeviceControl(this);
   165 			iOwnsDeviceControl = EFalse;
   166 			iOwnsDeviceControl = EFalse;
   166 			}
   167 			}
   167 		iController->DeRegisterClient(this);
       
   168 		DestroyEp0();
   168 		DestroyEp0();
   169 		delete iStatusFifo;
   169 		delete iStatusFifo;
   170 		Kern::DestroyClientRequest(iStatusChangeReq);
   170 		Kern::DestroyClientRequest(iStatusChangeReq);
   171 		Kern::DestroyClientRequest(iEndpointStatusChangeReq);
   171 		Kern::DestroyClientRequest(iEndpointStatusChangeReq);
   172 		Kern::DestroyClientRequest(iOtgFeatureChangeReq);
   172 		Kern::DestroyClientRequest(iOtgFeatureChangeReq);
  1957         else
  1957         else
  1958             {
  1958             {
  1959             // Parcel out the memory between endpoints
  1959             // Parcel out the memory between endpoints
  1960             TUint8* newAddr = reinterpret_cast<TUint8*>(chunk->LinearAddress());
  1960             TUint8* newAddr = reinterpret_cast<TUint8*>(chunk->LinearAddress());
  1961             __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory alloc new chunk=0x%x, size=%d", newAddr,bufSizes[chunkInd]));
  1961             __KTRACE_OPT(KUSB, Kern::Printf("SetupInterfaceMemory alloc new chunk=0x%x, size=%d", newAddr,bufSizes[chunkInd]));
  1962             chunkChanged = (newAddr != oldAddr);
  1962             // The check is important to avoid chunkChanged to be corrupted.
       
  1963             // This code change is to fix the problem that one chunk is used by multiple interfaces.
       
  1964             if(!chunkChanged)
       
  1965             	{
       
  1966             	chunkChanged = (newAddr != oldAddr);
       
  1967             	}            
  1963             aHwChunks[chunkInd] = chunk;
  1968             aHwChunks[chunkInd] = chunk;
  1964             }
  1969             }
  1965         chunkInd++;
  1970         chunkInd++;
  1966         }
  1971         }
  1967     
  1972