sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0"" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // include/drivers/dma_v1.inl sl@0: // DMA framework public inline functions sl@0: // This file should not be modified when porting the DMA framework to sl@0: // new hardware. sl@0: // TDmaChannel sl@0: // sl@0: // WARNING: This file contains some APIs which are internal and are subject sl@0: // to change without noticed. Such APIs should therefore not be used sl@0: // outside the Kernel and Hardware Services package. sl@0: // sl@0: sl@0: inline void TDmaChannel::Wait() sl@0: { sl@0: NKern::FMWait(&iLock); sl@0: } sl@0: sl@0: inline void TDmaChannel::Signal() sl@0: { sl@0: NKern::FMSignal(&iLock); sl@0: } sl@0: sl@0: inline TBool TDmaChannel::Flash() sl@0: { sl@0: return NKern::FMFlash(&iLock); sl@0: } sl@0: sl@0: inline TBool TDmaChannel::IsOpened() const sl@0: { sl@0: return iController != NULL; sl@0: } sl@0: sl@0: inline TBool TDmaChannel::IsQueueEmpty() const sl@0: { sl@0: return const_cast(this)->iReqQ.IsEmpty(); sl@0: } sl@0: sl@0: inline TUint32 TDmaChannel::PslId() const sl@0: { sl@0: return iPslId; sl@0: } sl@0: sl@0: inline TInt TDmaChannel::FailNext(TInt /*aFragmentCount*/) sl@0: { sl@0: return iController->FailNext(*this); sl@0: } sl@0: sl@0: inline TInt TDmaChannel::MissNextInterrupts(TInt aInterruptCount) sl@0: { sl@0: return iController->MissNextInterrupts(*this, aInterruptCount); sl@0: } sl@0: sl@0: /** Function allowing platform-specific layer to extend API with new sl@0: channel-specific operations. sl@0: @param aCmd Command identifier. Negative values are reserved for Symbian use. sl@0: @param aArg PSL-specific sl@0: @return KErrNotSupported if aCmd is not supported. PSL-specific value otherwise. sl@0: */ sl@0: sl@0: inline TInt TDmaChannel::Extension(TInt aCmd, TAny* aArg) sl@0: { sl@0: return iController->Extension(*this, aCmd, aArg); sl@0: } sl@0: sl@0: inline const TDmac* TDmaChannel::Controller() const sl@0: { sl@0: return iController; sl@0: } sl@0: sl@0: inline TInt TDmaChannel::MaxTransferSize(TUint aFlags, TUint32 aPslInfo) sl@0: { sl@0: return iController->MaxTransferSize(*this, aFlags, aPslInfo); sl@0: } sl@0: sl@0: inline TUint TDmaChannel::MemAlignMask(TUint aFlags, TUint32 aPslInfo) sl@0: { sl@0: return iController->MemAlignMask(*this, aFlags, aPslInfo); sl@0: } sl@0: sl@0: // DDmaRequest sl@0: sl@0: /** Called when request is removed from request queue in channel */ sl@0: sl@0: inline void DDmaRequest::OnDeque() sl@0: { sl@0: iQueued = EFalse; sl@0: iLastHdr->iNext = NULL; sl@0: iChannel.DoUnlink(*iLastHdr); sl@0: } sl@0: sl@0: // TDmac sl@0: sl@0: inline void TDmac::Wait() sl@0: { sl@0: NKern::FMWait(&iLock); sl@0: } sl@0: sl@0: inline void TDmac::Signal() sl@0: { sl@0: NKern::FMSignal(&iLock); sl@0: } sl@0: sl@0: inline SDmaPseudoDes& TDmac::HdrToDes(const SDmaDesHdr& aHdr) const sl@0: { sl@0: return static_cast(iDesPool)[&aHdr - iHdrPool]; sl@0: } sl@0: sl@0: inline TAny* TDmac::HdrToHwDes(const SDmaDesHdr& aHdr) const sl@0: { sl@0: return static_cast(iDesPool) + iDesSize*(&aHdr - iHdrPool); sl@0: } sl@0: sl@0: inline TUint32 TDmac::DesLinToPhys(TAny* aDes) const sl@0: { sl@0: #ifdef __WINS__ sl@0: (void)aDes; sl@0: return 0xDEADBEEF; sl@0: #else sl@0: return iHwDesChunk->iPhysAddr + ((TLinAddr)aDes - iHwDesChunk->iLinAddr); sl@0: #endif sl@0: } sl@0: sl@0: // DmaChannelMgr sl@0: sl@0: inline void DmaChannelMgr::Wait() sl@0: { sl@0: NKern::FMWait(&Lock); sl@0: } sl@0: sl@0: inline void DmaChannelMgr::Signal() sl@0: { sl@0: NKern::FMSignal(&Lock); sl@0: } sl@0: sl@0: //---