kernel/eka/include/drivers/dma.inl
changeset 0 a41df078684a
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32\include\drivers\dma.inl
       
    15 // DMA framework public inline functions
       
    16 // This file should not be modified when porting the DMA framework to
       
    17 // new hardware.
       
    18 // TDmaChannel
       
    19 // 
       
    20 // WARNING: This file contains some APIs which are internal and are subject
       
    21 //          to change without noticed. Such APIs should therefore not be used
       
    22 //          outside the Kernel and Hardware Services package.
       
    23 //
       
    24 
       
    25 inline void TDmaChannel::Wait()
       
    26 	{
       
    27 	NKern::FMWait(&iLock);
       
    28 	}
       
    29 
       
    30 inline void TDmaChannel::Signal()
       
    31 	{
       
    32 	NKern::FMSignal(&iLock);
       
    33 	}
       
    34 
       
    35 inline TBool TDmaChannel::Flash()
       
    36 	{
       
    37 	return NKern::FMFlash(&iLock);
       
    38 	}
       
    39 
       
    40 inline TBool TDmaChannel::IsOpened() const
       
    41 	{
       
    42 	return iController != NULL;
       
    43 	}
       
    44 
       
    45 inline TBool TDmaChannel::IsQueueEmpty() const
       
    46 	{
       
    47 	return const_cast<TDmaChannel*>(this)->iReqQ.IsEmpty();
       
    48 	}
       
    49 
       
    50 inline TUint32 TDmaChannel::PslId() const
       
    51 	{
       
    52 	return iPslId;
       
    53 	}
       
    54 
       
    55 inline TInt TDmaChannel::FailNext(TInt /*aFragmentCount*/)
       
    56 	{
       
    57 	return iController->FailNext(*this);
       
    58 	}
       
    59 
       
    60 inline TInt TDmaChannel::MissNextInterrupts(TInt aInterruptCount)
       
    61 	{
       
    62 	return iController->MissNextInterrupts(*this, aInterruptCount);
       
    63 	}
       
    64 
       
    65 /** Function allowing platform-specific layer to extend API with new
       
    66 	channel-specific operations.
       
    67  	@param aCmd Command identifier.  Negative values are reserved for Symbian use.
       
    68 	@param aArg PSL-specific
       
    69 	@return KErrNotSupported if aCmd is not supported.  PSL-specific value otherwise.
       
    70  */
       
    71 
       
    72 inline TInt TDmaChannel::Extension(TInt aCmd, TAny* aArg)
       
    73 	{
       
    74 	return iController->Extension(*this, aCmd, aArg);
       
    75 	}
       
    76 
       
    77 inline const TDmac* TDmaChannel::Controller() const
       
    78 	{
       
    79 	return iController;
       
    80 	}
       
    81 
       
    82 inline TInt TDmaChannel::MaxTransferSize(TUint aFlags, TUint32 aPslInfo)
       
    83 	{
       
    84 	return iController->MaxTransferSize(*this, aFlags, aPslInfo);
       
    85 	}
       
    86 
       
    87 inline TUint TDmaChannel::MemAlignMask(TUint aFlags, TUint32 aPslInfo)
       
    88 	{
       
    89 	return iController->MemAlignMask(*this, aFlags, aPslInfo);
       
    90 	}
       
    91 
       
    92 // DDmaRequest
       
    93 
       
    94 /** Called when request is removed from request queue in channel */
       
    95 
       
    96 inline void DDmaRequest::OnDeque()
       
    97 	{
       
    98 	iQueued = EFalse;
       
    99 	iLastHdr->iNext = NULL;
       
   100 	iChannel.DoUnlink(*iLastHdr);
       
   101 	}
       
   102 
       
   103 // TDmac
       
   104 
       
   105 inline void TDmac::Wait()
       
   106 	{
       
   107 	NKern::FMWait(&iLock);
       
   108 	}
       
   109 
       
   110 inline void TDmac::Signal()
       
   111 	{
       
   112 	NKern::FMSignal(&iLock);
       
   113 	}
       
   114 
       
   115 inline SDmaPseudoDes& TDmac::HdrToDes(const SDmaDesHdr& aHdr) const
       
   116 	{
       
   117 	return static_cast<SDmaPseudoDes*>(iDesPool)[&aHdr - iHdrPool];
       
   118 	}
       
   119 
       
   120 inline TAny* TDmac::HdrToHwDes(const SDmaDesHdr& aHdr) const
       
   121 	{
       
   122 	return static_cast<TUint8*>(iDesPool) + iDesSize*(&aHdr - iHdrPool);
       
   123 	}
       
   124 
       
   125 inline TUint32 TDmac::DesLinToPhys(TAny* aDes) const
       
   126 	{
       
   127 #ifdef __WINS__
       
   128 	(void)aDes;
       
   129 	return 0xDEADBEEF;
       
   130 #else
       
   131 	return iHwDesChunk->iPhysAddr + ((TLinAddr)aDes - iHwDesChunk->iLinAddr);
       
   132 #endif
       
   133 	}
       
   134 
       
   135 // DmaChannelMgr
       
   136 
       
   137 inline void DmaChannelMgr::Wait()
       
   138 	{
       
   139 	NKern::FMWait(&Lock);
       
   140 	}
       
   141 
       
   142 inline void DmaChannelMgr::Signal()
       
   143 	{
       
   144 	NKern::FMSignal(&Lock);
       
   145 	}
       
   146 
       
   147 //---