Adaptation/GUID-9C05C157-D58E-4C43-87E4-82B4F310AEA9.dita
changeset 15 307f4279f433
equal deleted inserted replaced
14:578be2adaf3e 15:307f4279f433
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-9C05C157-D58E-4C43-87E4-82B4F310AEA9" xml:lang="en"><title>DmaChannelMgr Implementation</title><shortdesc>Describes how to write the hardware-specific functions
       
    13 of the <codeph>DmaChannelMgr</codeph> class.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>The <xref href="GUID-176B8E0D-0422-341B-A134-7C85432E1303.dita"><apiname>DmaChannelMgr</apiname></xref> class is already defined in
       
    15 the DMA header file but it belongs to the PSL implementation: opening
       
    16 and closing channels require hardware-specific operations. </p>
       
    17 <p>When implementing the PSL, you need to provide at least one function:<codeblock xml:space="preserve">TDmaChannel* DmaChannelMgr::Open(TUint32 aOpenId)</codeblock></p>
       
    18 <p>This function opens a DMA channel and returns the object controlling
       
    19 this channel.</p>
       
    20 <p>How the channel is allocated is hardware-dependent. The call to
       
    21 the <codeph>Open()</codeph> function specifies which channel to open
       
    22 through the <codeph>aOpenId</codeph> parameter. The format of the
       
    23 parameter is not part of the DMA platform service and depends on an
       
    24 agreement between the PSL implementation and the driver using DMA.
       
    25 The example section below shows a static method, but the allocation
       
    26 could also be completely or partially dynamic. </p>
       
    27 <p>If you want to perform a hardware-specific operation when closing
       
    28 the channel, you also need to update <xref href="GUID-176B8E0D-0422-341B-A134-7C85432E1303.dita#GUID-176B8E0D-0422-341B-A134-7C85432E1303/GUID-909D795A-7303-3A76-9C8E-3B07A97DD716"><apiname>DmaChannelMgr::Close()</apiname></xref>. It is usually not necessary: in the template source code, it is
       
    29 implemented as doing nothing.</p>
       
    30 <p/>
       
    31 <example><title>Open() example</title><p>This example illustrates
       
    32 a simple allocation scheme where <codeph>aOpenId</codeph> represents
       
    33 the index of the requested channel in the channel array (<codeph>Controller.iChannels</codeph>).<codeblock xml:space="preserve">
       
    34 TDmaChannel* DmaChannelMgr::Open(TUint32 aOpenId)
       
    35 	{
       
    36 	__DMA_ASSERTA(aOpenId &lt; static_cast&lt;TUint32&gt;(KChannelCount));
       
    37 	TDmaChannel* pC = Controller.iChannels + aOpenId;
       
    38 	if (pC-&gt;IsOpened())
       
    39 		pC = NULL;
       
    40 	else
       
    41 		{
       
    42 		pC-&gt;iController = &amp;Controller;
       
    43 		pC-&gt;iPslId = aOpenId;
       
    44 		}
       
    45       return pC;
       
    46 }</codeblock></p></example>
       
    47 </conbody><related-links>
       
    48 <link href="GUID-D5ED62EB-744D-42EB-B8CF-D5623BDA5B38.dita"><linktext>DMA
       
    49 Client Interface Guide</linktext></link>
       
    50 </related-links></concept>