kernel/eka/drivers/soundsc/soundldd.cpp
changeset 15 4122176ea935
parent 0 a41df078684a
equal deleted inserted replaced
0:a41df078684a 15:4122176ea935
  1658 		{
  1658 		{
  1659 		iTestSettings&=(~KSoundScTest_TransferDataError);
  1659 		iTestSettings&=(~KSoundScTest_TransferDataError);
  1660 		aTransferResult=KErrTimedOut;
  1660 		aTransferResult=KErrTimedOut;
  1661 		}
  1661 		}
  1662 #endif
  1662 #endif
  1663 	__KTRACE_OPT(KSOUND1, Kern::Printf(">DSoundScLdd::RecordCallback(ID:%xH,Len:%d) - %d",aTransferID,aBytesRecorded,aTransferResult));
  1663 	__KTRACE_OPT(KSOUND1, Kern::Printf(">DSoundScLdd::RecordCallback(ID:%xH,Len:%d) - %d (iCurrentRecBufTf.iTfState %d)",aTransferID,aBytesRecorded,aTransferResult, iCurrentRecBufTf.iTfState));
  1664 	
  1664 	
  1665 	// If the transfer fragment is not for the current record buffer and were not paused then ignore it. Either the PDD
  1665 	// If the transfer fragment is not for the current record buffer and were not paused then ignore it. Either the PDD
  1666 	// has got very confused or more likely its a trailing fragment from an earlier buffer we have already failed. If 
  1666 	// has got very confused or more likely its a trailing fragment from an earlier buffer we have already failed. If 
  1667 	// we're paused, the PDD doesn't need to bother with a transfer ID, we assume its for the current buffer.
  1667 	// we're paused, the PDD doesn't need to bother with a transfer ID, we assume its for the current buffer.
  1668 	if (aTransferID==iCurrentRecBufTf.iId || iState==EPaused)
  1668 	if (iCurrentRecBufTf.iTfState != TSndScTransfer::ETfDone &&
       
  1669 		(aTransferID==iCurrentRecBufTf.iId || (aTransferID == 0 && iState==EPaused)))
  1669 		{
  1670 		{
  1670 		// Update the count of bytes recorded.
  1671 		// Update the count of bytes recorded.
  1671 		iBytesTransferred+=aBytesRecorded;
  1672 		iBytesTransferred+=aBytesRecorded;
  1672 		
  1673 		
  1673 		// Update the transfer status of the current buffer.
  1674 		// Update the transfer status of the current buffer.
  1811 		TInt pos=iCurrentRecBufTf.GetStartOffset();
  1812 		TInt pos=iCurrentRecBufTf.GetStartOffset();
  1812 		TPhysAddr physAddr;
  1813 		TPhysAddr physAddr;
  1813 		TInt len=iCurrentRecBufTf.iAudioBuffer->GetFragmentLength(pos,iCurrentRecBufTf.GetNotStartedLen(),physAddr);
  1814 		TInt len=iCurrentRecBufTf.iAudioBuffer->GetFragmentLength(pos,iCurrentRecBufTf.GetNotStartedLen(),physAddr);
  1814 		
  1815 		
  1815 		r=Pdd()->TransferData(iCurrentRecBufTf.iId,(iBufManager->iChunkBase+pos),physAddr,len);
  1816 		r=Pdd()->TransferData(iCurrentRecBufTf.iId,(iBufManager->iChunkBase+pos),physAddr,len);
  1816 		__KTRACE_OPT(KSOUND1, Kern::Printf("<PDD:TransferData(off:%x len:%d) - %d",pos,len,r));
  1817 		__KTRACE_OPT(KSOUND1, Kern::Printf("<PDD:TransferData(off:%x len:%d) A - %d",pos,len,r));
  1817 		if (r==KErrNone)
  1818 		if (r==KErrNone)
  1818 			iCurrentRecBufTf.SetStarted(len);	// Successfully queued a transfer - update the status.
  1819 			iCurrentRecBufTf.SetStarted(len);	// Successfully queued a transfer - update the status.
  1819 		}
  1820 		}
  1820 	
  1821 	
  1821 	// Either the current record transfer is now fully started, or the PDD can accept no more transfers
  1822 	// Either the current record transfer is now fully started, or the PDD can accept no more transfers
  1826 		TInt pos=iNextRecBufTf.GetStartOffset();
  1827 		TInt pos=iNextRecBufTf.GetStartOffset();
  1827 		TPhysAddr physAddr;
  1828 		TPhysAddr physAddr;
  1828 		TInt len=iNextRecBufTf.iAudioBuffer->GetFragmentLength(pos,iNextRecBufTf.GetNotStartedLen(),physAddr);
  1829 		TInt len=iNextRecBufTf.iAudioBuffer->GetFragmentLength(pos,iNextRecBufTf.GetNotStartedLen(),physAddr);
  1829 		
  1830 		
  1830 		r=Pdd()->TransferData(iNextRecBufTf.iId,(iBufManager->iChunkBase+pos),physAddr,len);
  1831 		r=Pdd()->TransferData(iNextRecBufTf.iId,(iBufManager->iChunkBase+pos),physAddr,len);
  1831 		__KTRACE_OPT(KSOUND1, Kern::Printf("<PDD:TransferData(off:%x len:%d) - %d",pos,len,r));
  1832 		__KTRACE_OPT(KSOUND1, Kern::Printf("<PDD:TransferData(off:%x len:%d) B - %d",pos,len,r));
  1832 		if (r==KErrNone)
  1833 		if (r==KErrNone)
  1833 			iNextRecBufTf.SetStarted(len);	// Successfully queued a transfer - update the status.
  1834 			iNextRecBufTf.SetStarted(len);	// Successfully queued a transfer - update the status.
  1834 		}
  1835 		}
  1835 	if (r==KErrNotReady)
  1836 	if (r==KErrNotReady)
  1836 		r=KErrNone;		// KErrNotReady means the PDD the cannot accept any more requests - this isn't an error.	
  1837 		r=KErrNone;		// KErrNotReady means the PDD the cannot accept any more requests - this isn't an error.