Texas Instruments TMS320 DSP Computer Hardware User Manual


 
www.ti.com
2.6UseofPeripherals
UseofPeripherals
Rule5
AlgorithmsmustcharacterizetheirROM-ability;i.e.,statewhetherornottheyareROM-able.
Obviously,self-modifyingCodeisnotROM-able.Wedonotrequirethatnoalgorithmemploy
self-modifyingCode;weonlyrequiredocumentationoftheROM-abilityofanalgorithm.Itisalsoworth
pointingoutthatifself-modifyingCodeisused,itmustbedone"atomically,"i.e.,withallinterrupts
disabled;otherwisethisCodewouldfailtobereentrant.
ToensuretheinteroperabilityofeXpressDSP-compliantalgorithms,itisimportantthatalgorithmsnever
directlyaccessanyperipheraldevice.
Rule6
Algorithmsmustneverdirectlyaccessanyperipheraldevice.Thisincludes,butisnotlimitedtoon-chip
DMAs,timers,I/Odevices,andcachecontrolregisters.Note,however,algorithmscanutilizetheDMA
resourcebyimplementingtheIDMA2interfaceonC64xandC5000devices,andtheIDMA3interface
onC64x+devicesusingtheEDMA3controller.SeeChapter6fordetails.
Inorderforanalgorithmtobeframework-independent,itisimportantthatnoalgorithmdirectlycallsany
deviceinterfacetoreadorwritedata.Alldataproducedorconsumedbyanalgorithmmustbeexplicitly
passedtothealgorithmbytheclient.Forexample,noalgorithmshouldcalladevice-independentI/O
libraryfunctiontogetdata;thisistheresponsibilityoftheclientorframework.
24GeneralProgrammingGuidelinesSPRU352GJune2005RevisedFebruary2007
SubmitDocumentationFeedback