www.ti.com
6.11SubmittingDMATransferRequests
6.12DeviceIndependentDMAOptimizationGuideline
SubmittingDMATransferRequests
ThespecificationoftheACPY2interfacestrivestoperformadelicatetrade-offbetweenallowinghigh
performanceandrequiringerrorcheckingatruntime.Optimizedalgorithmsrequirehighspeedtransfer
mechanismsandinvariablyusealignedaddressesand32or16-bitelementsizesastheirfundamental
typeofdatatransfer.Attheotherendofthespectrum,arealgorithmsthatneedaDMAlibrarytoperform
thetransferoftherequirednumberofbytesfromanysourcesaddresstoanydestinationaddresswithout
beinganymorecomplicatedthanasimplememorycopy(memcpy)functionintheCstandardlibrary.
TheACPY2interfaceprovidesalgorithmdeveloperstwointerfacefunctionstosubmitDMAtransfer
requests:ACPY2_start()andACPY2_startAligned().Theonlyoperationaldifferencebetween
ACPY2_startAligned()andACPY2_start()istheadditionalrequirementbyACPY2_startAligned()for
itssourceanddestinationaddressestobeproperlyalignedwithrespecttotheconfiguredelementsize.
Whenusing32-bittransfermode,theseaddressesmustbeatleast32-bitaligned.For16-bittransfers,
16-bitalignmentisrequired.Whencalledwithproperlyalignedaddresses,bothfunctionsimplementan
identicalbehavior.However,inarchitectures,suchasC6000,whichpermitDMAtransfersusing8-bitor
16-bitalignmentofsourceordestinationaddressesirrespectiveoftheactualtransferelementsize,the
ACPY2_startAligned()functioncanbeoptimizedtooperatemoreefficiently.Ontheotherhand,certain
architectures,suchasC55x,mayimposedevice-dependentDMArulesthatrequirestricturealignmentof
thesourceanddestinationaddressesforalltransfersandthereforemayprovidethesameimplementation
forbothAPIs.
ACPY2_start()makesnoassumptionsonthealignmentofthesourceanddestinationaddresses.It
acceptsaddressesatanyalignmentandwhenallowedbythearchitecture,adjuststhetransfer
parameters(includingelementsize,numberofelements,transfertype)totransparentlyperformthe
desiredtransferusingthegivenalignment.Itisintendedtosimplifyalgorithmdevelopmentintheinitial
states.ACPY2_start()thusstrivestomaintainsimplicitywhilemaintainingreasonablelevelsof
performance.TheACPY2_startAligned()API,ontheotherhand,makesnorun-timechecksonthe
alignmentandperformsthetransferusingtheconfiguredtransfersettingsofthechannel.Passingsource
ordestinationaddresseswithincorrectalignment,withrespecttotheconfiguredelementsizeoftheDMA
handle,willresultinunspecifiedbehavior.Inthisrespect,thesoleaimofACPY2_startAligned()isto
guaranteeperformancebyeliminatingrun-timechecksbyapre-negotiatedcontractwiththealgorithm
developer.
Inthissection,weoutlineageneralguidelineapplicabletoallarchitecturesthatmayresultinsignificant
performanceoptimizations.Thebasicpremiseisthatconfiguringalogicalchannelisanexpensive
operationintermsofcycles,evenwhencomparedtothestandardACPY2schedulingandsynchronization
APIs.Thereinliesthemotivationforthefollowingnewguideline:
DMAGuideline2
Allalgorithmsshouldminimizechannel(re)configurationoverheadbyrequestingadedicatedlogical
DMAchannelforeachdistincttypeofDMAtransferitissues,andavoidcallingACPY2_configureand
usethenewfastconfigurationAPIswherepossible.
DMAGuideline2isusefulwhendifferenttypesofDMAtransfersareneededinacriticalloopofan
algorithm.BydefiningdifferentIDMA2logicalchannelsforeachtransfertype,ACPY2_configure()canbe
calledoneachchannelatthebeginningofthealgorithmcode.Then,transferrequestscanberapidly
submittedonthesepreconfiguredchannelsinthecriticalloopusingthenewACPY2_start()or
ACPY2_startAligned()function.
Inthenexttwosections,wepresentadditionalDMArulesandguidelinesspecifictoC5000orC6000
architectures.
UseoftheDMAResource 68SPRU352G–June2005–RevisedFebruary2007
SubmitDocumentationFeedback