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