epoc32/include/drivers/dma.inl
branchSymbian2
changeset 2 2fe1408b6811
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
       
     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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.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 //
       
    21 
       
    22 inline void TDmaChannel::Wait()
       
    23 	{
       
    24 	NKern::FMWait(&iLock);
       
    25 	}
       
    26 
       
    27 inline void TDmaChannel::Signal()
       
    28 	{
       
    29 	NKern::FMSignal(&iLock);
       
    30 	}
       
    31 
       
    32 inline TBool TDmaChannel::IsOpened() const
       
    33 	{
       
    34 	return iController != NULL;
       
    35 	}
       
    36 
       
    37 inline TBool TDmaChannel::IsQueueEmpty() const
       
    38 	{
       
    39 	return const_cast<TDmaChannel*>(this)->iReqQ.IsEmpty();
       
    40 	}
       
    41 
       
    42 inline TUint32 TDmaChannel::PslId() const
       
    43 	{
       
    44 	return iPslId;
       
    45 	}
       
    46 
       
    47 inline TInt TDmaChannel::FailNext(TInt /*aFragmentCount*/)
       
    48 	{
       
    49 	return iController->FailNext(*this);
       
    50 	}
       
    51 
       
    52 inline TInt TDmaChannel::MissNextInterrupts(TInt aInterruptCount)
       
    53 	{
       
    54 	return iController->MissNextInterrupts(*this, aInterruptCount);
       
    55 	}
       
    56 
       
    57 /** Function allowing platform-specific layer to extend API with new
       
    58 	channel-specific operations.
       
    59  	@param aCmd Command identifier.  Negative values are reserved for Symbian use.
       
    60 	@param aArg PSL-specific
       
    61 	@return KErrNotSupported if aCmd is not supported.  PSL-specific value otherwise.
       
    62  */
       
    63 
       
    64 inline TInt TDmaChannel::Extension(TInt aCmd, TAny* aArg)
       
    65 	{
       
    66 	return iController->Extension(*this, aCmd, aArg);
       
    67 	}
       
    68 
       
    69 inline const TDmac* TDmaChannel::Controller() const
       
    70 	{
       
    71 	return iController;
       
    72 	}
       
    73 
       
    74 inline TInt TDmaChannel::MaxTransferSize(TUint aFlags, TUint32 aPslInfo)
       
    75 	{
       
    76 	return iController->MaxTransferSize(*this, aFlags, aPslInfo);
       
    77 	}
       
    78 
       
    79 inline TUint TDmaChannel::MemAlignMask(TUint aFlags, TUint32 aPslInfo)
       
    80 	{
       
    81 	return iController->MemAlignMask(*this, aFlags, aPslInfo);
       
    82 	}
       
    83 
       
    84 // DDmaRequest
       
    85 
       
    86 /** Called when request is removed from request queue in channel */
       
    87 
       
    88 inline void DDmaRequest::OnDeque()
       
    89 	{
       
    90 	iQueued = EFalse;
       
    91 	iLastHdr->iNext = NULL;
       
    92 	iChannel.DoUnlink(*iLastHdr);
       
    93 	}
       
    94 
       
    95 // TDmac
       
    96 
       
    97 inline void TDmac::Wait()
       
    98 	{
       
    99 	NKern::FMWait(&iLock);
       
   100 	}
       
   101 
       
   102 inline void TDmac::Signal()
       
   103 	{
       
   104 	NKern::FMSignal(&iLock);
       
   105 	}
       
   106 
       
   107 inline SDmaPseudoDes& TDmac::HdrToDes(const SDmaDesHdr& aHdr) const
       
   108 	{
       
   109 	return static_cast<SDmaPseudoDes*>(iDesPool)[&aHdr - iHdrPool];
       
   110 	}
       
   111 
       
   112 inline TAny* TDmac::HdrToHwDes(const SDmaDesHdr& aHdr) const
       
   113 	{
       
   114 	return static_cast<TUint8*>(iDesPool) + iDesSize*(&aHdr - iHdrPool);
       
   115 	}
       
   116 
       
   117 inline TUint32 TDmac::DesLinToPhys(TAny* aDes) const
       
   118 	{
       
   119 #ifdef __WINS__
       
   120 	(void)aDes;
       
   121 	return 0xDEADBEEF;
       
   122 #else
       
   123 	return iHwDesChunk->iPhysAddr + ((TLinAddr)aDes - iHwDesChunk->iLinAddr);
       
   124 #endif
       
   125 	}
       
   126 
       
   127 // DmaChannelMgr
       
   128 
       
   129 inline void DmaChannelMgr::Wait()
       
   130 	{
       
   131 	NKern::FMWait(&Lock);
       
   132 	}
       
   133 
       
   134 inline void DmaChannelMgr::Signal()
       
   135 	{
       
   136 	NKern::FMSignal(&Lock);
       
   137 	}
       
   138 
       
   139 //---