1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/kernel/eka/include/drivers/dma_v1.inl Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,147 @@
1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0""
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// include/drivers/dma_v1.inl
1.18 +// DMA framework public inline functions
1.19 +// This file should not be modified when porting the DMA framework to
1.20 +// new hardware.
1.21 +// TDmaChannel
1.22 +//
1.23 +// WARNING: This file contains some APIs which are internal and are subject
1.24 +// to change without noticed. Such APIs should therefore not be used
1.25 +// outside the Kernel and Hardware Services package.
1.26 +//
1.27 +
1.28 +inline void TDmaChannel::Wait()
1.29 + {
1.30 + NKern::FMWait(&iLock);
1.31 + }
1.32 +
1.33 +inline void TDmaChannel::Signal()
1.34 + {
1.35 + NKern::FMSignal(&iLock);
1.36 + }
1.37 +
1.38 +inline TBool TDmaChannel::Flash()
1.39 + {
1.40 + return NKern::FMFlash(&iLock);
1.41 + }
1.42 +
1.43 +inline TBool TDmaChannel::IsOpened() const
1.44 + {
1.45 + return iController != NULL;
1.46 + }
1.47 +
1.48 +inline TBool TDmaChannel::IsQueueEmpty() const
1.49 + {
1.50 + return const_cast<TDmaChannel*>(this)->iReqQ.IsEmpty();
1.51 + }
1.52 +
1.53 +inline TUint32 TDmaChannel::PslId() const
1.54 + {
1.55 + return iPslId;
1.56 + }
1.57 +
1.58 +inline TInt TDmaChannel::FailNext(TInt /*aFragmentCount*/)
1.59 + {
1.60 + return iController->FailNext(*this);
1.61 + }
1.62 +
1.63 +inline TInt TDmaChannel::MissNextInterrupts(TInt aInterruptCount)
1.64 + {
1.65 + return iController->MissNextInterrupts(*this, aInterruptCount);
1.66 + }
1.67 +
1.68 +/** Function allowing platform-specific layer to extend API with new
1.69 + channel-specific operations.
1.70 + @param aCmd Command identifier. Negative values are reserved for Symbian use.
1.71 + @param aArg PSL-specific
1.72 + @return KErrNotSupported if aCmd is not supported. PSL-specific value otherwise.
1.73 + */
1.74 +
1.75 +inline TInt TDmaChannel::Extension(TInt aCmd, TAny* aArg)
1.76 + {
1.77 + return iController->Extension(*this, aCmd, aArg);
1.78 + }
1.79 +
1.80 +inline const TDmac* TDmaChannel::Controller() const
1.81 + {
1.82 + return iController;
1.83 + }
1.84 +
1.85 +inline TInt TDmaChannel::MaxTransferSize(TUint aFlags, TUint32 aPslInfo)
1.86 + {
1.87 + return iController->MaxTransferSize(*this, aFlags, aPslInfo);
1.88 + }
1.89 +
1.90 +inline TUint TDmaChannel::MemAlignMask(TUint aFlags, TUint32 aPslInfo)
1.91 + {
1.92 + return iController->MemAlignMask(*this, aFlags, aPslInfo);
1.93 + }
1.94 +
1.95 +// DDmaRequest
1.96 +
1.97 +/** Called when request is removed from request queue in channel */
1.98 +
1.99 +inline void DDmaRequest::OnDeque()
1.100 + {
1.101 + iQueued = EFalse;
1.102 + iLastHdr->iNext = NULL;
1.103 + iChannel.DoUnlink(*iLastHdr);
1.104 + }
1.105 +
1.106 +// TDmac
1.107 +
1.108 +inline void TDmac::Wait()
1.109 + {
1.110 + NKern::FMWait(&iLock);
1.111 + }
1.112 +
1.113 +inline void TDmac::Signal()
1.114 + {
1.115 + NKern::FMSignal(&iLock);
1.116 + }
1.117 +
1.118 +inline SDmaPseudoDes& TDmac::HdrToDes(const SDmaDesHdr& aHdr) const
1.119 + {
1.120 + return static_cast<SDmaPseudoDes*>(iDesPool)[&aHdr - iHdrPool];
1.121 + }
1.122 +
1.123 +inline TAny* TDmac::HdrToHwDes(const SDmaDesHdr& aHdr) const
1.124 + {
1.125 + return static_cast<TUint8*>(iDesPool) + iDesSize*(&aHdr - iHdrPool);
1.126 + }
1.127 +
1.128 +inline TUint32 TDmac::DesLinToPhys(TAny* aDes) const
1.129 + {
1.130 +#ifdef __WINS__
1.131 + (void)aDes;
1.132 + return 0xDEADBEEF;
1.133 +#else
1.134 + return iHwDesChunk->iPhysAddr + ((TLinAddr)aDes - iHwDesChunk->iLinAddr);
1.135 +#endif
1.136 + }
1.137 +
1.138 +// DmaChannelMgr
1.139 +
1.140 +inline void DmaChannelMgr::Wait()
1.141 + {
1.142 + NKern::FMWait(&Lock);
1.143 + }
1.144 +
1.145 +inline void DmaChannelMgr::Signal()
1.146 + {
1.147 + NKern::FMSignal(&Lock);
1.148 + }
1.149 +
1.150 +//---