kernel/eka/drivers/dma/dmapil.cpp
branchRCL_3
changeset 89 1df514389a47
parent 87 2f92ad2dc5db
child 256 c1f20ce4abcf
equal deleted inserted replaced
87:2f92ad2dc5db 89:1df514389a47
   489 		iQueued = ETrue;
   489 		iQueued = ETrue;
   490 		iChannel.iReqQ.Add(&iLink);
   490 		iChannel.iReqQ.Add(&iLink);
   491 		*iChannel.iNullPtr = iFirstHdr;
   491 		*iChannel.iNullPtr = iFirstHdr;
   492 		iChannel.iNullPtr = &(iLastHdr->iNext);
   492 		iChannel.iNullPtr = &(iLastHdr->iNext);
   493 		iChannel.DoQueue(*this);
   493 		iChannel.DoQueue(*this);
       
   494 		__DMA_INVARIANT();
   494 		iChannel.Signal();
   495 		iChannel.Signal();
   495 		}
   496 		}
   496 	else
   497 	else
   497 		{
   498 		{
   498 		// Someone is cancelling all requests...
   499 		// Someone is cancelling all requests...
   499 		req_count = --iChannel.iQueuedRequests;
   500 		req_count = --iChannel.iQueuedRequests;
       
   501 		__DMA_INVARIANT();
   500 		iChannel.Signal();
   502 		iChannel.Signal();
   501 		if (req_count == 0)
   503 		if (req_count == 0)
   502 			{
   504 			{
   503 			iChannel.QueuedRequestCountChanged();
   505 			iChannel.QueuedRequestCountChanged();
   504 			}
   506 			}
   505 		}
   507 		}
   506 
       
   507 	__DMA_INVARIANT();
       
   508 	}
   508 	}
   509 
   509 
   510 EXPORT_C TInt DDmaRequest::ExpandDesList(TInt aCount)
   510 EXPORT_C TInt DDmaRequest::ExpandDesList(TInt aCount)
   511 	{
   511 	{
   512 	__DMA_ASSERTD(!iQueued);
   512 	__DMA_ASSERTD(!iQueued);
   572 
   572 
   573 #ifdef _DEBUG
   573 #ifdef _DEBUG
   574 
   574 
   575 void DDmaRequest::Invariant()
   575 void DDmaRequest::Invariant()
   576 	{
   576 	{
   577 	iChannel.Wait();
   577 	// This invariant may be called either with,
       
   578 	// or without the channel lock already held
       
   579 	TBool channelLockAquired=EFalse;
       
   580 	if(!iChannel.iLock.HeldByCurrentThread())
       
   581 		{
       
   582 		iChannel.Wait();
       
   583 		channelLockAquired = ETrue;
       
   584 		}
       
   585 
   578 	__DMA_ASSERTD(iChannel.IsOpened());
   586 	__DMA_ASSERTD(iChannel.IsOpened());
   579 	__DMA_ASSERTD(0 <= iMaxTransferSize);
   587 	__DMA_ASSERTD(0 <= iMaxTransferSize);
   580 	__DMA_ASSERTD(0 <= iDesCount && iDesCount <= iChannel.iMaxDesCount);
   588 	__DMA_ASSERTD(0 <= iDesCount && iDesCount <= iChannel.iMaxDesCount);
   581 	if (iDesCount == 0)
   589 	if (iDesCount == 0)
   582 		{
   590 		{
   586 	else
   594 	else
   587 		{
   595 		{
   588 		__DMA_ASSERTD(iChannel.iController->IsValidHdr(iFirstHdr));
   596 		__DMA_ASSERTD(iChannel.iController->IsValidHdr(iFirstHdr));
   589 		__DMA_ASSERTD(iChannel.iController->IsValidHdr(iLastHdr));
   597 		__DMA_ASSERTD(iChannel.iController->IsValidHdr(iLastHdr));
   590 		}
   598 		}
   591 	iChannel.Signal();
   599 
       
   600 	if(channelLockAquired)
       
   601 		{
       
   602 		iChannel.Signal();
       
   603 		}
   592 	}
   604 	}
   593 
   605 
   594 #endif
   606 #endif
   595 
   607 
   596 
   608