BUSMASTER--attachingIBM-PCorMultibusperipheralstoan1108withExtendedProcessorOption(CPE)Initiallyreleased:25Sept1984MichaelHerringEdited:22Oct1984IBMPC-orMultibus-compatibleperipheraldevices(notbothatonce!)canbeattachedtoan1108whichhastheExtendedProcessorOption(CPE),usingXerox'sBusMasterinterfaceoption.ThisdocumentdescribesthefunctionalityoftheBusMasterhardware,andtheBUSMASTERsoftwarepackageforcontrollingit.Itisdividedintosections:thisintroductorysectionsingle-bytetransfers-theBUSfunctionsmicrocodedblocktransfers-theBUSBLTfunctionsdma-overviewofdirectmemoryaccessdma-detaileddiscussionofthedmaprocessdma-registermodeloftheBusMasterdmacontrollerdma-theBUSDMAfunctionsdma-summaryofsimpleusedma-technicalnotes(ThisdocumentandtheaccompanyingBUSMASTERsoftwarepackagearesomewhatpreliminary:WhiletheyhavebeenusedwithIBMPC-compatibleperipherals,theMultibusalternativehasnotbeenfullyintegratedatthiswriting.ThussomechangescanbeexpectedbeforetheBusMasterinterfaceoptionisreleased.Inparticular,moreobscuredetailsmaychange,themoretechnicaldocumentationmaybecomemoreexact,thedocumentationwillbecomelessPCoriented,and(perhapsmostimportantly)well-packageddiagnosticsoftwarewillbeincluded.Alsohopefullyglobalinitializationwillbebetterunderstoodandbetterpackaged,andtheproblemofaccessingnonexistentmemoryontheexternalbuswillbeproperlyaddressed.NoteinparticularthatmuchofthisdocumentationiswrittenasthoughonlyIBMPCperipheralsweresupported,whichisfalse.IBMPC,IPBPC-XT,Intel8237-5A,andDataTranslationDT2801areproprietarynames.)AdditionalhardwareisrequiredbetweentheBusMasterandtheperipheraldevices:anIBMPCorPC-XTexpansionchassistomounttheperipherals'controllercardsin,andinsomecasesaPCmemorycard,mountedintheexpansionchassis.TheBusMasterconnectsthePCexpansionchassis(the"externalbus")totheBusExtenderhigh-speedparallelportofthe1108.TheBUSMASTERlibrarypackagemakesuseoftheBUSEXTENDERlibrarypackage.Intermsofthehardwareenvironment,PCperipheralsfitintothisaugmented1108systeminjustthesamewaytheywouldintoanIBMPC.MostprogrammingoftheperipheralsisdoneinjustthesamewayitwouldbedoneinBASIConanIBMPC:"peeksandpokes"--thatis,explicitlyprogrammedtransfersofindividualbytesfromandtoindividuali/oandmemoryaddresses.Therearetworestrictionsaffectingmoreadvancedi/oprogrammingtechniques:1)Interrupts:Interruptsarenotasyetsupported.Moreprecisely,whilethehardwaredoessupportinterrupts,exactlyasonanIBMPC,the1108microcodedoesnotasyetsupportinterrupts.2)Directmemoryaccess:PCperipheralscannotperformdirectmemoryaccess(dma)totheinternalmemoryofthe1108.However,theperipheralcanperformdmato/fromPCmemorymountedinthePCexpansionchassis,andthe1108cansimultaneouslyaccessthatmemory,eitherwithpeeks&pokesorwithmicrocodedhigh-speedblocktransferinstructions.Ourexperienceisthatexamplei/oprogramsinBASIC,notinvolvinginterruptsordma,canbetranslatedimmediatelytoInterlisp-Dwithoutsubtlety.Wehavealsoimplementedseveralapplicationsthatusedmatechniques,withtwodifferentperipheraldevices,theDataTranslationDT2801Analog&DigitalI/OSystemandaTecmar-like640x400x4-bitcolorboard.Oneofourapplicationshasthedataacquisitionboardsamplingacousticdataat êq?€`½ îp`¬ êq?€`½îî êïg_p`¬î ìïagq`žî ìr`{îóîþî&øî.öî1Œî:Ê îFÎîIEî"ºï_>î%¬î+oî0Lî:îDÖî"ºï]@î)às`×î ìï[¨ïZt`Xî1œïXîu`Fî5rî:bî;äî>~î1œïW¸î5Ýî1œïV-î5rî6ôî9 t`Xî ìïT¢îâïSî:îQîðî†î´ î#‘ î)öî.Žî1Mî4Yî5Äî9Íî<*î=íîC6îD¶îFyîI‘î ìïQœî ÉîîAî9î%î"¥î&ûî*uî/Dî5áî;UîâïPîÌîî¼îí î'»î)Fî+wî2î8Dî:Íî<þîFî ìïN–î4îEîT îî�îåî /î!mî&0î(ØîâïMîØïK�îJ îøîØïJ î•îôî Åî"öî&îØïHŠ îî¦î$î$Öî'î,ÛîØïGîÄî•î4î¿î"pî'­îØïE„îÄî•îš î"èî$sî&¤î)�îØïDîÄî•îCî Kî!Öî$î*¤î-� îØïB~îÄî•îÆî bîØï@ûîÄî•îbîíî#!îØï?xîÄî•î)îâï=õïÚîA!îCgîF•îI î ìï9l î1îœîîæî>îŒîðî$ìî'Iî) î.—î2¶î4çî;„î@øîE îF^î ìï7éî_î·îY î³îîüî$î&ðî+Àî-ñî1Uî6é î@îBîîGÓî ìï6fî Pîî3 îbîÝî#Âî&)î(Oî-ãî0lî5áî9 î@Ç îI}î ìï4ã î/îwîòîµîî×î"Öî(Ìî,½ î4fî6áî8¤îáîA îGðî ìï0Zî  î¬î‰îÇîâï.×îùîwî îïîî$¦î'/î*] î1eî6�î8§ î?›îâï-Tï+Ñ î†î^îœî!úî'8î)iî0î2�î4À î;%î@6î@ŽîBQîEhîGŽîI$î ìï*Nîyî½îîˆî½î î î(/ î.:î1Ÿî3wî6î7€î:äî>(î?%îAKîFˆîIÁî ìï(ËîŒî î=î�î#î{î!$î'Áî-*î/[î1�î7Åî<î>ºîD{îH îIŒî ìï'Hî  î îÌîƒî"Mî#Øî& îâï%Åî‹î£îâî#óî'üî*Cî+Îî-ÿ î9 î=Hîâï$Bï"¿î„î î«îÜî´ î%çî( î.öî0—î3?î5±î<‘î?©îCõîEuîGçîJî ìï!<î ;îåîÆîÃîkî.îEî Âî!î$s î,Òî.]î0Ž î7wî8µî;øî=xî?êîBîEjîHîI<î ìï¹î éî¬îïîoîûîÓî–î­î"Lî&¢î)+î-–î.àî1î3 î8È î@ºîFîG¤î ìï6 î9îžîÖî_îß î!,î#Pî%Ùî+ î1Pî1¨î5zî7 î: î@äîFXîI¼î ìï³îÏîó îR îâï0vîc tîüîT î�îµî!ûî#|î%— î,3î,‹î0 î5ñî9uî;¦îA~îDîIYî ìïš î]îÉîJî"îåîüîzî!«î$Ãî+=î.>î0„î2î4 î8ú îâïvîcîVîKtî¢îÈ î&±î*üî0#î3Ôî9î<ïî@ÍîBMîD~îIbî ìï�î)î´îåîTî¬î°îá î%Fî'£î,Êî/¶î4Æî6ìî<)îAÉîCIîEzîG î ìïþî0îÓî\î�î¥îv tî'áî+¿î.^î3óî7¯î:šî>@î?ªîCeîDûîGæî ìïh î, îõîƒî ^ îâïåïbî– î>î|îî!cî#‡î)iî*éî/Íî2î7ç î>î?–îBÚîE7îFúî ìïß î î¨î( î î$ßîâï \î?îWîô îî#r î*Òî-qî/¸î2¤ î9¤î<�î? îD€î ìï Ù îQîAîrî  î!¨î&Äî+Zî,Äî1#î3Áî8Oî:Øî;Õ îC@î ìï V îƒîÏîíîEîî¥î! î(aî*¨î,Ùî/¯ î6jî:1î?ÛîDàîG¶îI!  êq?€`½210KHz,whilethe1108processesthedata(includingFFTs)andgraphstheresults,continuouslyinrealtime.Thisapplicationusesquitesophisticateddmatechniques:thedataacquisitionboarddmascontinuouslyintoacircularbufferinmemoryintheexpansionchassis,whiletheprograminthe1108continuouslyreads&processesdatafromthecircularbuffer.Thisispossiblebecause(1)thePC'sdmacontroller(whichisfunctionallyduplicatedintheBusMaster)canbeprogrammedtowrapdmaaroundacircularbuffercontinuouslywithoutsoftwareintervention,(2)thedmapointerscanbereadbythesoftwareprogram,and(3)datatransferfromthePCmemorytothe1108doesnotinterferewithdmafromtheperipheraldevice.Thisdmatechniquetookonlyacoupleofdaystodesign&implementusingtheBUSMASTERsoftware.OurinterfacefunctionsfortheDataTranslationboardareavailableastheLISPLibraryPackagePCDAC;itisoneexampleofhowtousetheBUSMASTERpackage.Single-bytetransfersto/fromtheexternalbus--theBUSfunctionsNotethatwheneveryoupower-uporBUS.RESET,youthenhavetocallBUSDMA.INITatleastonce,toinitializethememoryrefreshapparatus,beforethememoryontheexternalbuscanbeexpectedtoholddata.(BUS.RESET)--actslikeapower-up:resetstheBusMasterandassertstheResetsignalontheexternalbus,therebycausingeverydevicetheretoresetitselfasatpower-up.BUSDMA.INITwillthenhavetobecalledagainifthedmacontrollerormemoryrefreshapparatusisneeded.(BUS.INPUTi/oaddress)=>8bitvalue--inputabytefromanexternal-busi/oaddress,returningitasasmallnonnegativeinteger.(BUS.OUTPUTi/oaddress8bitvalue)--outputabyte(theleastsignificant8bitsoftheintegerargument)toanexternal-busi/oaddress(BUS.READmemoryaddress)=>8bitvalue--readabytefromexternal-busmemory,returningitasasmallnonnegativeinteger.(BUS.READHLmemaddrhimemaddrlo)=>8bitvalue--readabytefromexternal-busmemory,returningitasasmallnonnegativeinteger.memaddrloisthelesssignificant16bitsofthememoryaddress;memaddrhiisthemoresignificantbitsoftheaddress.(BUS.WRITEmemoryaddress8bitvalue)--writeabyte(theleastsignificant8bitsoftheintegerargument)toexternal-busmemory(BUS.WRITEHLmemaddrhimemaddrlo8bitvalue)--writeabyte(theleastsignificant8bitsoftheintegerargument)toexternal-busmemory.memaddrloisthelesssignificant16bitsofthememoryaddress;memaddrhiisthemoresignificantbitsoftheaddress.Microcodedblocktranfersto/fromtheexternalbus--theBUSBLTfunctionsThesefunctionstransferdatabetweenanarrayinInterlisp-Dvirtualmemoryandaconsecutiveregioninthememoryontheexternalbus.NotethatBUSDMA.INIThastobecalledatleastonce,toinitializethememoryrefreshapparatus,beforethememoryontheexternalbuscanbeexpectedtoholddata.(BUSBLT.BYTESarraystartingindexbusaddressnelementstoexternalmemory?)--transfereverybyteofnelementselementsofthearrayinInterlisp-Dmemory,startingwiththestartingindex'thelement,toorfromconsecutivebyteaddressesontheexternalbus,startingatbusaddress.arraymustbeanarrayofeitherBYTEs,WORDs(=SMALLPOSPs),orFIXPs.IfthearrayisofWORDsorFIXPsthenthemoresignificantbyteofeachInterlisp-Dwordistransferredtotheloweraddressontheexternalbus.îI!î êïføt`Xî ìïhsp`¬î ìïbt`XîÓîWîˆî îlî�î"s î(Ìî,Óî/\î3�î5Îî:E îB)îC©îF1îI~îIÖî ìï`~î Ö î²î}îÖ î!Æî$² î+Óî,+î.\î12 î7íî;´î?$ îGîI°îJ­î ìï^ûî¯î®î.îkîëîî#`î(î+‡î-¸î3î4–î6Çî9ß îAÃîE3îF�î ìï]xî¸îŽîÆî÷îºî!î#úî%8î*Gî/8î12î3cî6eî9Q î?\îC²îDðî ìï[õ îL îÒîRîƒ î"™î$öî&¹ î.«î0+î3oî6[î:èî;åî@¨îD§î ìïZr îÐî©îñ î#Ëî%Åî'öî*âî/ýî2Zî4î7 î8×î;î@PîFîH�îJ‰î ìïXïî Âî�îÕîî,îiîéî"î%2î(3î*yî/×î2Âî5®î8æî; îA|îEçîF?îI)î ìïWlî ØîüîðîÚî×îî¡î"˜î$î(7î)¡î0Sî3Íî5þî?îâïUéî–î îÕîäî!î$C î+Kî/î18î6Àî8Aî:rî=ËîBŽîGªî ìïTfî­îî-îkîèî0î»î�î î"Wî$ˆî- îâïRãî ìïQ”s`×ïPw`i î6î¾î¶î!Vî'ƒî*Jî+»î.[î29îâïN‰s`×ïLýt`Xî)îÈîÌîTî#Wî$í î->î/Æî2½î5Õî7Uî9° îC³îEîHî ìïKzî [îÛ î4îeî¢î  î&vî*•î,Æî2î3Ûî6 î;î=…î?âîA¥îG0îH°î ìïI÷î ìîâïHtî ìïF²x`it`Xîbî¬î5î°î­î")î"�î&î(Nî.ëî1tî5”î7Åî;aî?î@ôîC%îH6îØïE î˜îhî !î#§î'»î+î,•î/­î2Ùî4Zî5Åî<îî'¸î(µî+–î.Îî0‘ î8+î:Oî?aîE8îF`îGáîHÞîØï>ÂîF îÉî ìï=?ï;}x`i t`Xî´î v tî\î´vtî"¸î$î(Bî)?î, î.Êî1À î8$î9,î;žî=)î?ZîCÆîJ8îØï9çîXî îµî Ùî ìï8dï6¢x`it`Xî}îÕv tîyîávtî%lî&¶î)¢î*Ÿî-€î0¸ î8Rî=çîC¾îDæîFgîGdîØï5 îF îÉî ìï3‰ï1Çx`i t`XîëîCvîîitî$¤î' vtî,—î-áî0Íî1Êî4«î7ã î?}îEîØï01î¯î×îXîUî à î(Fî- î-avtî4#î5aî7’î9ù î@]îBîD‡îFîHCîØï.›îîHvtî%î&Tî(…î+é î2Mî4¿î6Jî8{î ìï-ï+Cx`i t`XîCî›v îÆîtî$"î%lî(ºî)·î,˜î/Bî28 î8œî9¤î<î=¡î?ÒîD>îJ°îØï)­îX îòî ìï(*ï&hx`i t`Xî±î vî×î/î$ñî%Itî+Mî,—î/åî0âî3Ãî6mî9c î?Çî@ÏîCAîDÌîFýîØï$ÒîDî¶î 6 î'Ðî-dî-¼vtî4~î5¼î7íî:T î@¸îBpîDâîFmîHžîØï#<îîHvtî%î&Tî(…î+é î2Mî4¿î6Jî8{î ìï!¦ïäx`iïYw îÈîîÝî"Õî%uî+¢î.iî/Úî2zî9´îâïŸt`Xïî´îîZî 0î%nî'1î*‹î, î2éî7îØî?Õ îFõî ìï™î ÿîî°îíîÅîöî îâïî)îÈ îËî!î"’î$Uî(î)†î,|î/ëî1k î6Äî8õî>2îBŸ îIî ìï“î î<îyîQî‚î“î ûî#Xî%î*¦î,&î/&îâïî ìïNx`i t`Xî'îvîäî< î#*î#‚ î*î*Xî0dî0¼tî<”î=ÞîB¹îF?îI îJ«îØï¸vtîäînî ùî#*vtî&�î( î.íî4‚î9;î<&î>Wv tîGÑîØï"î6î¶îLî„ î&¤î)…î/hî1@î3qî8‚î;Bî?ûîAfv tîH;îH“îØïŒvtî=îvî9îüî!Vî"áî&�î+Šî0þî3/ î=Dî>ÚîCPîC¨îDýîG.îJˆîØï öîî¡îî«î!Êî$Áî&òî*V î0ºî3›î5&î8( î?îB_îC� îJgîØï sîXî‰î#îÝî!µî#æî(÷ÿ a êq?€`½E3(BUSBLT.RIGHTBYTESarraystartingindexbusaddressnelementstoexternalmemory?)--transferthelesssignificantbyteofeachwordofnelementselementsofthearrayinInterlisp-Dmemory,startingwiththestartingindex'thelement,toorfromconsecutivebyteaddressesontheexternalbus,startingatbusaddress.arraymustbeanarrayofeitherWORDs(=SMALLPOSPs)orFIXPs.(NotethatarraycannotbeofBYTEs.)OntransferstoInterlisp-Dvirtualmemory,themoresignificantbyteofeachwordiszeroed.(BUSBLT.NYBBLESarraystartingindexbusaddressnelements)--transferevery4-bitnybbleofnelementselementsofthearrayinInterlisp-Dmemory,startingwiththestartingindex'thelement,toconsecutivebyteaddressesontheexternalbus,startingatbusaddress.Each4-bitnybbleofInterlisp-Dvirtualmemorycorrespondstoabyteintheexternalbusmemory:theInterlisp-Dnybbleisright-alignedintheexternal-busbyte,withtheleft4bitsoftheexternal-busbyteunspecified.ThebyteresultingfromthemoresignificantnybbleofeachInterlisp-Dwordistransferredtothelowerbyteaddressontheexternalbus.arraymustbeanarrayofeitherBYTEs,WORDs(=SMALLPOSPs)orFIXPs.NOTEthatonlythetransferfromInterlisp-Dmemorytoexternal-busmemoryisimplementedatthiswriting.AreadformofBUSBLT.NYBBLESisexpectedtobeaddedlater.AlsoBUSBLT.SWAPBYTES,whichwilldifferfromBUSBLT.BYTESonlyinthatthemoresignificantbyteofthe1108wordwillcorrespondtothehigheraddressontheexternalbus.Dma--overviewofdirectmemoryaccessontheexternalbusTheBusMasterincludes,inadditiontopeekandpokeapparatus,a3-channelDMAcontrollerandmemoryrefreshcircuitry.MemoryrefreshcircuitryisnecessaryfordynamicRAM(suchasthatusedinthePC)tokeepitsdata.AsintheIBMPC,theBusMaster'smemoryrefreshcircuitryisintegratedwithitsdmacontrollerandtimer,andusesthefourthdmachannel#0.Memoryrefreshisinitiatedduringtheglobalinitializationofthedmacontroller.TheseoperationswouldbedoneautomaticallyonanIBMPC.Directmemoryaccess(dma)referstoaprocesswherebyani/odevicecantransferdatatoorfrommainmemorywithoutdirectinterventionbythecentralprocessor.Thatis,althoughthecentralprocessormusthelpinsettingupthedmaoperationandintidyingupafterit,manybytesofdatacanbetransferredinasingledmaoperationwithoutthecentralprocessorhavingtobeinvolvedaseachbyteistransferred.Thisinvolveshavingdedicatedhardware(inthiscasetheBusMaster'sdmacontroller)withmemory-addressandtransfer-countregistersandcontrolcircuitry.Typicallyasingledmaoperationtransfersapredeterminednumberofbytesofdatafromthei/odevicetosequentialaddressesinmainmemory,orsimilarlywiththedatagoingfrommemorytothei/odevice.Thedmacircuitryhastoallowfortheoperationtoterminateprematurely;theBusMasterallowstheoperationtobeterminatedprematurelyeitherbytheprogramorbythei/odevice(thoughnotalli/odevicesaresmartenough).TheBusMasterwillalsoallowdmatotakeplacetoorfroma"circularbuffer"inmemory.Thisisreferredtointhisdocumentbythenot-obviously-appropriatename"AutoinitializationMode".Thenamecomesfromthefactthat,inAutoinitializationMode,thedmacontrollerdoesnotterminatethedmaoperationwhenthetransfercountrunsout,butratherre-initializestheaddressandcounterregisterstotheirinitialvalues,thus"wrappingaround"the"circularbuffer".InthiscasetheBusMasterwillletthedmagoonforever:thei/odeviceortheprogramhastoterminateit.Thedirectmemoryaccessdiscussedheretakesplaceentirelyontheexternalbus.Thereisnodirectmemoryaccesspossiblebetweeni/odevicesontheexternalbusandthe1108'smemory.Asimilareffectcanbegotbyusingdmabetweenthei/odeviceandthememoryontheexternalbus,togetherwithblocktransfersbetweentheexternalbusmemoryandthe1108'smemory(discussedintheirownsectionabove).AsontheIBMPC,thedmacontrolleranditssupporthardwareareactuallycontrolledviapeeksandpokes.However,theBUSMASTERpackageincludesasetofBUSDMAfunctionsthatimplementaî+^î êïføt`XîI¾ïhsp`¬î ìïbt`Xï`?x`it`XîÕî-vî ’î ê î(Øî)0 î/®î0î6î6jtîBBîCŒîHgîJ˜îØï^©î? î£î„î!î$î'jî(õvtî/î4‹î6î8Gvtî;¬î=, îD îIŸîØï]î‘î|î­v tî''î,…î.î/›î2Ó î9óî<ÔîB·îD�îFÀîØï[}îéî©î bî!Ív tî(¢î(úvtî,_î/˜î1[î3î6xî8î;¿îA3îCdîØïYç î•î+î#¡î#ùî'¹î*Xvtî-½î2î3Ëî5Vî:»î;î=CîB¢îD"îØïXQ î¶îßî$tî&¥î* î0mî3Nî4Ùî7Ûî;4îWv tîGÑîØïQàî6î¶ î!Öî$·î*šî,rî.£î3´î6tî;-î<˜v tîCmîCÅîGîJîØïPJî9îÄ î ¢î$Ëî* î1uî2õî3òî6Óî8Sî:„î?•îAýîG³îH îJ<îØïNÇ î¶îî U î(:î)ºî+ë î3…î6¾î9©î;Úî> î?(îAšîC%îEVîØïMD îrîS î%¿î&î(Àî+¡î1î4Lî6}î9á î@EîD¦îF1îI3îØïKÁ î¶îîM î&î'—î)Èî-bî0Cî4ýî6Õî9î>î@ÖîA.vtîD“îGÌîI�îØïJ+î›îõî€î<î#)î(�î*Î î4‹î6!î:—î:ïî?GîAæîDÐîGîØïH¨î³îë î"Éî(î)† î1 î6]î7› î?¸îA#îC•î ìïG%îâïE¢îAî-îeîð î$¢î%àî+kî,ëî.®î2¢î5ïî6Gî9FîHFî ìïDî ÉîDîßî î!Áî$«î&+î(Êî*ûî._ î4Ãî7¤î9/î;`î>xîAÑîDLî ìïBœ îÕîUî†î¥î_î7î!hî&yîâïAï?–î ìï>w`iî ¼î-î�îiîÖî!Ýî&Áî(êî+Šî1·îâïî3¹î5:î7Ùî:æî—îA6îB¶îEØîG„îJ±îK î ìï4¡î Ïî Oî€î—îîF î¿î#üî(iî-¥î.ã î5(î8î9¿î<« îB¶îE?îIî ìï3î uî@îqîzîfîVî î mî%Öî*Cî+�î0±î4ñî7"î; îB¼îDGîFxîIdî ìï1› îNî¦îx îòîïî ²î#õ î,1î. î/Ìî2ãîâï0ï.•îëî(îîäî#‹î% î&î*«î0 î1Íî3ñî8î:bî?=îBîC“îE)îHaî ìï-î :îwîPî î"ƒî$Qî&‚î*Ø î1î1hî4î6î;žî=ÏîB%îHî ìï+�î %îî�îÅî©îÚîÆî"¼î%Eî&Åî+;î-î0,î1¬î5Hî8­î:8î=î?kîA. îGøîIxîJuî ìï* î §î“î‰îbî“î!éî'Êî,î-•î/Xî4¿î6@î9Bî<#î=a îD‚îDÚîGÄî ìï(‰îî\î_î7î!0î#¢î&bî(“ î0 î2ø î9|î?îCÓîD+îGîHSî ìïqîþî~îþîpîªîxî©î.\î1íî=;îBîBlîEîH¦î ìïîî êî"îSîÑîÈîHî$æî)î+Aî.- î48î79î9î?wîA¨îD”îJŠî ìïkî rî£î~î$îî®î î#Þ î+]î-Žî2Hî4Ñî9 î>Òî@RîCiîG"î ìïèîBîîªîçîî$‹î)‘î)éî+‹î-ýî0½î2îî9‹î<î=Óî@îBðîD²îFŠî ìïeîòî#îGî[îñî"î €î"Çî$Gî*?îâïâï_î‹î<îyîWî$.î'î*hî-Ìî2šî4rî6£î;´î>sî>ËîB�îCÛîE³îIdî ìïÜî)îîîTîxî$î%èî(î-*î/’î2î4Lî8@î=Ôî>,î?‹îCßîG{îIØî ìïYî ¯î ßî­î'îîQî‚î¦î#ºî&Cî(tî-±î/‰î1ºî6Ëî9‹î>½îA¨îE6îJ•î ìïÖî*î[îlîÔîî šî"Ëî&¿î+ü î2Lî3Ìî6ãî9¸î>#îâï Sï ÐîÅî�îÎîåîcî”î€ î%‹î(î)Àî.šî4rî6˜î;| îAÉîCØîG~îJî ìï Mî þîVîZî‹î£î$´î)åî*âî,Ñî.\î4øî:Ãî=bîDîEÿ- êq?€`½_4higher-levelviewofthedmacontroller.ThisviewofthedmacontrollerisbasicallyasimplifiedversionofthatinthespecificationsfortheIntel8237-5A,onwhichthesystemisbased.Dma--detaileddiscussionofthedmaprocessTypicaldmaoperationsusingtheBusMasterarequiteeasytoprogram--youareonlydealingwithonei/odeviceandinonlyoneway.Evenplanningtheuseofoneparticulari/odeviceisnottoobadifyou'renotgoingtobeexotic.Unfortunately,i/odevicesdifferinmajor&minorways,theBusMasterisdesignedtofitwellwithmostofthem,andthisdiscussionhastoenableyoutoplantheuseof(almost)anyi/odevicein(almost)anywayreasonable.Sopleasebetolerant.MyhopeisthatafteryoureadthroughtotheSummarysectionbelow,youshouldhaveatmostafewquestions,whichcanlikelybeansweredbyskimmingaround.(Ifyouareplanningexoticthings,youmayneedtoreadthespecificationsforthetheIntel8237-5Admacontrollerchip,onwhichtheBusmasterisbased,andtheTechnicalNotessectionbelow.)ThedmacontrollerandmemoryrefreshcircuitryhavetobeinitializedbeforeanydmacantakeplaceandbeforethememoryinthePCexpansionchassiscanholddatareliably.ThisisdonewiththeBUSDMA.INITfunction(thoughundersomecircumstancesyoumayalsoneedtheBUS.RESETfunctiondiscussedabove).BUSDMA.INITcanbecalledagainatanytime,withthesideeffectofdisabling(masking)allthreedmachannels.Thedmacontrollerhasthreeseparatedmachannels,numbered1to3.(Thereisactuallyalsoafourthchannel,numbered0,dedicatedtothememoryrefreshapparatus.)Eachi/odevicethatdoesdmahastoknoworbetolditsdmachannelnumber,asdoesthesoftwarecontrollingthedevice.Usuallyadevice'sinterfacecardhasswitchesorjumperswhichdeterminewhichdmachannelitwilluse.Onlyonedevicecanbeusinganyonedmachannelatatime.Thustherecanbeatmostthreei/odevicesdoingdmaatanytime.Thethreedmachannelsarecontrolledseparately.Wethinkintermsofdma"operations".A"singledmaoperation"is:theprogramgetsthei/odeviceanditschannelsetupfortheoperation;manybytesaretransferredoneatatimeattheinstigationofthei/odevicebutunderthecontrolofthechannel;thetransferisterminatedsomehowbyeitherthechannel,thei/odevice,and/ortheprogram;finallytheprogramtidiesupthei/odevice&thechannel.Also,duringthetimewhenindividualbytesarebeingtransferredbythei/odeviceandthechannel,theprogrammightintervenetotemporarily"suspend"andthen"resume"thedmaoperation.Itisimportanttonoticethatthedmacontrolleritselfdoesnotactuallydistinguishbetween"suspended"and"terminated":iftheprogramresumestheoperationthenitwas"suspended";ifitsetsupanewoperationthentheoldonewas"terminated"!Thesetupofthei/odevicedependsonthedevice.Settingupthedmachannelbasicallyinvolvessettingupaddress,transfer-count,andmoderegisters.Itwouldbeprematuretodiscussthesetupfurtherhere,aswehavenotyetmotivatedtheissues.Ratherwewilldiscusseverythingelse,includingthefunctionofthechannel'sregisters,thendiscusssetupagainintheSummarysection.Duringtheextended"dmaoperation",individualbytetransfersarerequestedbythei/odeviceinvolved.Ifmorethanonedevicerequestsdmaatthesametime,thedmacontrollerservicesthelower-numberedchannelfirst.Thedirectionofthetransfer(toorfrommemory)hastohavebeensetupthesameinboththei/odeviceandthedmachannel.Thememoryaddressto/fromwhichthetransferwilltakeplaceisdeterminedentirelybythedmachannel.Normallyitusessuccessivelyincreasingbyteaddressesinmemory,butitispossibletousesuccessivelydecreasingaddresses,andin"AutoinitializationMode",thechannelwillwraptheaddressesaroundacircularbuffer(wrappingineitherdirection).Forexactlyhowaddressesaregenerated,seethediscussionofthepage,current-address,andbase-addressregistersbelowintheRegisterModelsection.Dmaonaparticularchannelcanbesuspendedandresumedby"masking"and"unmasking"thechannel.Amaskedchannelrefusestohonoranydmatransferrequests.Ifthereisadmatransferrequeststillpendingwhenthechannelbecomesunmasked,thechannelwillservicetherequestthen.Obviously,datacanbelostbykeepingthedmachannelmaskedtoolongwhileitsi/odeviceisrequestingtransfers.Itremainstodiscusshowadmaoperationisterminated.Thisispotentiallyrathercomplicated.îEî êïføt`Xî ìïhsp`¬î ìïbt`X îBîNîÙî îö î!Xî$Bî'Nî(Ùî+ î-ö î4î5?î:›î;˜ îAÏîFfîGñîJ�î ìï`~î lî � îÎîÝîî%î"Åî$�î(zî*«î.÷î05îâï^ûï]xî ìï[üw`iî ¼î-î î§îsî!î$lîâïZBt`XïX¿î™î… îÿî yî"ªî)Gî+mî.Æî1œî3î8zî9ÄîrîA\îEþîHéî ìïW<î iî�î¡î*îªî”îîîjî"Ãî(Lî*}î,Äî.Oî0Ì î6Îî8òî=î>Dî@ŠîBÄîEMîF€îJ‰î ìïU¹î 2îÌîLîî7î� î žî"Âî'Zî*õî,uî0;î1¥î5Œî9î;CîAàîCîH¨îJ(î ìïT6î �îKî6îcîîî î)î› î$éî'0î(°î,åî/mî0íî3Øî6 î8Pî9Ûî?îAtîC˜îG¬îI,î ìïR³îî…î/ î"îzîRî!Eî#î(Cî(›î*øî.;î/yî2î5%î7­î:™î?ŸîAîCPîI_î ìïQ0îWî‹îî]îuîàî! î" î$} î*¶î.“î0ðî4}î6@î<î=æîDîHìîIDî ìïO­î ºîBîhîñîÂîî Šî#`î&Žî(î*úî-+ î5\î7kî9œî;Íî>äîD,îGî ìïN* î÷î/îîäîî!†î"Äî&Îî)Wî+ˆî1”î5_î9Êî>vî>Îî?&îâïL§ïK$î‹îw î‚î î"Hî&µî+ñî/ î0‰î2L î8kî<Šî>ýîAéîDFîGîJtî ìïI¡î uî”îÅîî‚î³îÙî$î(hî*Åî-Åî0›î5´î6 î8öî:4î=wî@bîB“î ìïH îïî6î1î"î%h î-éî0qî3Gî5äî9î;CîC<îHƒî ìïF›îÃîeî½ îÀî!î"àî&¦î* î+‹î-þî1Lî47î6hî9î<­î>8îCáîJî ìïEî ­îîóîâïC•î‹îw î‚îÉî #î%Kî(7î.î4jî5rî6òî8Qî8©î<ôî>2îCîE³îF°îJ¹î ìïBî4î›îûîþî~î ¯î%ìî*Y î18î1�î4Óî6÷î; î=ªî@«îC—îEÞîG^î ìï@�î {îîÔî|î(îîî"Xî#Ùî&Úî) î.S î5 î7>î;©î<î@ÚîA×îFÇî ìï? î`îAîˆîºîPî lî$Iî*™î.vî1bî6Rî7zî9õî<“îâï=‰î$î¡îµîîÕî Oî"Âî%?î(+î-î.†î/ƒî2Ðî3(î6vî9Ðî<-î=ðî?[îBˆîEâîHî ìï<î„î4î î‹îþîKî£îLî"¦î%’î+î-, î3y îâï:ƒî?î­î-îÉîTî@ î&qî&Éî((î,“î/ î6%î7Üî: î?kîB îD;îF_îJsî ìï9î uî!îîîäîóî$ î!“î%/î(”î*º î1„î4î5lî6iî9_î:Êî<û îCtîDÿîG0îITî ìï7}îîRî%îVîÖîaî’î#ûî&,î+î,E î3î8äî:²î>nî@ŸîEçîHîJ<î ìï5úîXîÏîî×îéî!î&xî)ñî+Õî.î0*î4>î5¨î7Ùî= î=xî@ÏîEîG@îJ6î ìï4wî r î¿î$îJîå î#¯î%}î'®î)Òî-æî0oî2 î7èî:î?wîC>îIîJ•î ìï2ô î!îžî'îî#î%Hî(4 î.�î.Ùî0#î1aî7�î9î<öî?•îAÆîD² îJ½î ìï1qî îî_îC îÿî#= î+%î-® î6Eî7xî9©î?îD$îFUî ìï/îîâîÙîî îàî î!;î#®î%’î&�î)Oî/Eî2<î4mî6§î9$î;¢ îD9îâï.kî:îâï,èî‹îî‘îÂîæîúî$8î&î(Aî,¬î-î1{î3_î5�î8|î=lîBÈîGíî ìï+eî!îîîî šî$@ î)Éî*!î+kî/hî1+î7�î9î=‰î?ºîC5îG­î ìï)âî 0î±î«îÃî î$î]î Žî$–î$îî)Pî+Jî-Åî21 î8Ãî;£îAƒîC´îHûîJ†î ìï(_î îé îsîjîÖî"Qî%Ëî'Kî)|î/‹îâï&Üï%Yîzî«îbîþ î%ü î,Iî/*î4‰î6¯î<¾î>Œî@½îBáîFõî ìï#ÖîªîîWî»î²î/îCî#kî&Wî'Âî)óî-Bî0�î2Áî5­ î;¸î@’îBÃî ìï"S îîþîþîVîÿî$’î&î(Nî-)î/"î0¸î3ðî9¦î;íî=mî@…îC³îE¢îG†îI·î ìï Ðî ;î»îÇîøîî0î¹îêî!ÖîâïMî‹îÈî‚î ’î$oî& î+{î-öî0Àî4$î5b îYîC4îGØîJHî ìï5îî™îÊîºî#î%Öî(î,÷î/rî3Èî5ùî:�î=ëî>C îDóîGÉîJ&î ìï²î ¯îîãîÝîîúîêî#¹î%óî(Ýî,aî. î01î4Eî5ƒ î;ÿ îAµîâï/ï¬î,î'î§îîèîåî!Ñî'Çî) î0î0rî3\î4š î;4î? îFàÿ5 êq?€`½5Dmatransferswillceaseundereitherofthreeconditions:thei/odeviceceasestorequestdmatransfers;thedmachannelmasksitselfbecauseitstransfercounterrunsout;orthedmachannelismaskedbytheprogram.Ineithercase,thedmachannelitselfdoesnotdistinguishbetween"suspended"and"terminated".Iwilltrytosaywhatitdoesdo:Atanygivenpoint,admachannelisaskingitself"AmImasked?".Ifso,that'sall.Butifitisnotmasked,itthenasks"AmIreceivingarequestforadmatransfer?".Ifnot,that'sall.Butifitisreceivingarequestforadmatransfer,thenitgetsthetransferdone,andthenincrementsordecrementsitscurrent-addressregister,anddecrementsitscurrent-transfer-countregister.Ifitscurrent-transfer-countregisterdoesnotgotozero,thenthat'sall.Butifitscurrent-transfer-countregisterdoesgotozero,thenthechannelassertstheexternal-bussignalnamedTC,andalsosetsits"TCbit"inthedmacontroller'sstatusregister.(TheTCsignalisalsoreferredtoasEOP,andisavailableforthei/odevicetosenseifitwants.)Thechannelthenasksitself"AmIinAutoinitializationMode?".IfitisnotinAutoinitializationmode,thenitmasksitself;ifitisinAutoinitializationmode,thenitreinitializesitscurrent-addressandcurrent-transfer-countregistersfromthecorrespondingbaseregisters,butdoesnotmaskitself.Inanycase,thedmachanneldoesnot"terminatethedmaoperation"really:itmaymaskitself,anditmayemittheTCsignalandsetitsTCbit,andtheprogramorthei/odevicemayactonthesethings.Butallthechannelcaresaboutthis,untilitisactedonbytheprogram,isthatifitmaskeditself,thenitstaysmaskeduntiltheprogramunmasksit(possiblyafterchangingitsotherregisters!).Thei/odevicemightceasetorequestdmatransfersforanyofseveralreasons,including:ithasitsowntransfercountregister,whichhasrunout;ithasdetectedanerrorconditionandchosentostoptransfer;ithasdetectedtheTCsignalfromitsdmachannelontheexternalbus;ithasdetectedsomeotherterminationcondition;orithasbeendisabledbytheprogram.Anyparticulari/odevicemaywellnotsupportallthesechoices.Thedmachannelcannottelldirectlythatthedevicehasceasedrequestingdmatransfers;itsimplyrespondstothemif&astheyarise.Typicallytheprogramdeterminesthatthei/odeviceconsidersthedmaoperationdone.Theprogrammightmaskthechanneltemporarily,forsomekindofhousekeepingreason,oritmaydosoaspartofterminatingthedmaoperation.Itcanhaveanysortofreasonfordoingthis.Thedmachanneldoesnotcare:iftheprogramchoosestoresetsomeofthechannel'sparameterswhileitismasked,that'sfine;otherwisewhenthechannelbecomesunmasked,itwillkeeponfromwhereitwas.Changingadmachannel'sparameterswhileitisunmaskedisriskyandtobeavoided.Directmemoryaccess--registermodeloftheBusMasterdmacontrollerInourmodelofthedmacontroller,therearenoglobalregisters,andeachchannelhasasetofsevenregisters:Pageregister--Suppliesthemoresignificantbitsoftheexternal-busmemoryaddressesgeneratedbythechannel.Thecontentsofthisregisteraresimplyconcatenatedontotheleftofthecontentsofthecurrent-addressregisterwhenanaddressisgenerated.Unfortunately,incrementingordecrementingachannel'scurrent-addressregisterdoesnotaffectitspageregisters.(Thisimpliesthatanydmaoperationmusttakeplaceentirelywithinone(64KB-aligned)64KBpage,sincethecurrent-addressregistersare16bitswide.Further,admabufferthatseemstooverlapa64KB-pageboundarywillreallywraparoundwithinthe64KB-pageitstartsin.Thepageregistersaresetupbytheprogram,butcannotbereadbyit.Current-addressregister--Holdsthelesssignificantbitsoftheexternal-busmemoryaddressesgeneratedbythechannel,thatis,the16-bitaddress-within-page.Thechannelgeneratesaddressesbyconcatenatingitspageregisterontotheleftofitscurrent-addressregister.îFàî êïføt`XîI¾ïhsp`¬îâïbt`Xî&î…îîeî!8î$ôî&î)Ù î0Àî1î3Iî5mî9�î=jî>êîCŽîFzî ìï`~ îÄîõîáîÑî¹î åî%Öî'‚î,]î1,î4î6×î8mî:žî=ŠîBzîC¸îH‡îJUî ìï^ûî îâï]xï[õî„î@îXî‰îuî!eî$‘î'’î)Ø î0”î5Ò î=ºî@C îH¸îIîIìî ìïZrî gîaîáîî@îhîiîâïXïî¯î"î§îmîjîVî#Fî$„î(—î+Ãî.ûî/×î6;î6“î7èî9Öî=QîâïWlîTî‡î¯îíî3îZî‚î yî#8î&pî'Lî,öî-óî2—î4¦î5£î8� î>ÿî?Wî@¬îCJîFÅîâïUéîTî‡î¯îíî—î”î 8î"Gî#Dî&0î+cî.Zî/‚î2!î4Rî9-î<Èî?QîBH îIîJ§î ìïTf îøî¤îî!î#§ î*³î,_î9»î>Àî?î@mîBî ìïRãîHîöî÷î!=î"ÿî$î'«î*¢î.îâïQ`îTî‡î3î!�î&=î)>î+î,€î/¬î2£î4Ôî9Äî=äî@ îG¯î ìïOÝî §îþî‘îî·î*îÖî Áî#_î$ßî'î)ü î0ãî4Šî9�î<±î>ìîB§îCåîF‚î ìïNZîþî~îÿîxîî?îÇî Öî#î%+î)?î*¿î./î/bî0Šî5 î5dî8 î<ýî?ôîB³îEßîIîIóî ìïL×î lî îqîÉîîFî„î!Êî#Jî-èî1æî4Ýî6î9íî=’î=êî?î@EîAƒîCî ìïKTîŠîˆîî§ î#­î%Yî.Íî1Vî>²îCäîGîIMî ìïIÑ î­î™ î#îuî vî"¼î& î)£îâïHNî„î÷îî@î,î î#î%c î, î.<î1( î7Îî;áî= î?ßîCCîFÇîIPîJxî ìïFËî Âî¸îéî$îßîhîWîî >î"„î% î'>î,œî.2î0cî2‡î6›î9qî;vî=Nî@¨îDçîE?îG±îIrî ìïEHî î îQîîÌîâî î Hî#¸î%�î'^î)�î/Eî0ƒî3"î4Uî5}î:Lî=Ðî@ÇîAïîEîIáî ìïCÅî î3î‘îî-î Àî#Íî)xî+$î.“ î5îâïBBï@¿î‹î¯îÃîŠîïî oî%î'ÿî-^î/mî1àî3kî7Ìî<Ò îC+îCƒîD«îFòîHžî ìï?<î ÁîœîBîHî%î lî"Ôî%“î&»î)î.Kî0î3Qî9;î;Äî@%îA¥îDoîIÃî ìï=¹î î [î¤îÕîîËîî¯î"›î'‹î)cî+”î0¥î3†î4®î6õî<>î?¢îC îJFî ìï<6 îOîåî îTî‚î¾îŒî!½î'rî'Êî*Ÿ î0¡î2Åî6Ùî9¯î³îC�îENîH¨î ìï:³îÚî2îÛîÇî·îî 1î$ôî'“î)Äî-Øî0î4J î:Æî=² îCŠîD²îHñî ìï90î�îî[îŽîøîyîZî½îî$Þî'î,m î3Aî5àî8î:5î>IîDîFEîI1î ìï7­îâîâï6*ï4§î‹îéî°îî Eî%5 î,Âî.Ñî25î55î6À î?)îC«îEAîFiîI?î ìï3$î Äî ZîÛî�î îFîwîc î%°î&î'Rî)¯î,Çî/:î1Âî3Mî7wî9†î=6î?ÿî@WîCîEìî ìï1¡îÜîÝî#î\î´îçîî vî%Oî&Ïî)çî-Kî.Öî1î6Ó î=¨îA,îBTîC’îH¹î ìï0î gî~îuîûî,î!î&…î-8î.`î0Ûî3ýî5Õî9 î<öî>î@óîAKîGYîHVî ìï.›î Øî¤ îyîýî%îcî%¾î&üî*(î,±î.1î/ôîâï-ï+•î ìï*w`iîÐî×î»î,î•î!Kî%íî'¹î*Yî2Šî5ã îâï(_t`Xï&Üî„îàîèîsî¤î� î#óî'Mî)sî+Kî/< î4Æî7Oî:Qî?AîAˆîB…îDtîEÿîI›î ìï%Y îâï#Öî ìï"fvî $ îâï Ðtî?îpîÔ î 8î"ªî$5î&f î.î3=î9 î?:îAîC9îH€îHØî ìïMî •îÒî]îÏî}î£î â î(êî+êî.î0aî1ìî4î9Zî:åî=îFŠî ìïÊîšî îãî�îÛ îâïG îñ î î!¤ î*î+î0Íî:Aî>ïîAðîD6îGÒîI~î ìïÄî  î�îåîHîÞî}îðî"Üî(Òî, î.Õî29î7î;î=— îG î ìïAî ©îî\î�î î%3î'Yî)î+ƒî.üî/Tî4‘î5Žî8zîî$Ëî(Þî+î2î3-î6’îâï;î‹î£îÕîûîêîÎî!œî#Íî)ƒî+Õî0 î1ãî4Ïî6�îâï¸î ìïHvî{ îâï²tî¿îðîW î»î -î!¸î#é î+ƒî0Àî6£î<½î>‹î@¼îFîH£îJ9î ìï/î îäîbîºîcî$Sî*+î0î1Ü î:Qî;ýî?îCÃîFÃîHôî ìï¬î 2î ½îiîÝÿ � êq?€`½96Aftereachbytetransfer,thechannelincrementsordecrementsthecurrent-addressregisterbyone.Thedirectiondependsonabitinthechannel'smoderegister.Unfortunately,thisincrementordecrementdoesnotaffectthepageregister(asdiscussedabove).Thecurrent-addressregisterissetupbytheprogram,incrementedordecrementedbythechannel,and,in"AutoinitializationMode",reloadedbythechannelfromitsbase-addressregisterwhenitscurrent-transfer-countregisterrunsdown.Thecurrent-addressregistercanbereadbytheprogram,sothattheprogramcankeepitsaccesstotheexternal-busmemorysynchronizeedwithdmaontheexternalbus.Base-addressregister--InAutoinitializationMode,holdsthestartingaddressofthecircularbuffer.Thatis,inAutoinitializationMode,whenachannel'scurrent-transfer-countregisterrunsdown,thechannelreinitializesitscurrent-addressregisterfromitsbase-addressregister.Thebase-addressregisterisloadedautomaticallywhenevertheprogramsetsupthecurrent-addressregister.ThereisnoBUSDMAfunctionforreadingthebase-addressregister.Current-transfer-countregister--Controlsthelengthofthedmaoperation(or,inAutoinitializationMode,thelengthofthecircularbuffer).Thatis,aftereachdatatransfer,thechanneldecrementsitscurrent-transfer-countregister,andifitgoestozero,thenaTCsignalisassertedtotheexternalbusandthechannelismasked(ifnotAutoinitializationMode)orthecurrentaddress&transfer-countregistersarereinitializedfromthebaseones(ifAutoinitializationMode).Notethatthecurrent-transfer-countregistercontainsthenumberofbytetransfersremainingtobedone,asanunsigned16-bitnumber.Notealsothatwhileacurrent-transfer-countregistervalueofzero,viewedasafteradmatransfer,means"done",thesamezerovalueviewedasbeforeadmatransfer,means64K.Thusthemaximumtransfer(orcircularbuffersize)is64Kbytes.(Youmayalsoneedtoknowthatthehardwareregisterkeepsitsvaluesonelessthatwhatwe'vedescribedhere,modulo64K.TheBUSDMAfunctionsmaintainthetranslation.)Thecurrent-transfer-countregisterissetupbytheprogram,decrementedbythechannel,and,inAutoinitializationMode,reloadedbythechannelfromitsbase-transfer-countregisterwhenitrunsdown.Thecurrent-transfer-countregistercanbereadbytheprogram,sothattheprogramcansynchronizeitsexternal-busmemoryaccesseswiththeexternal-busdma.Base-transfer-countregister--InAutoinitializationMode,holdstheinitialvalueofthecurrent-transfer-countregister.Thatis,inAutoinitializationMode,whenachannel'scurrent-transfer-countregisterrunsdown,thechannelreinitializesitfromitsbase-transfer-countregister.Thebase-transfer-countregisterisloadedautomaticallywhenevertheprogramsetsupthecurrent-transfer-countregister.ThereisnoBUSDMAfunctionforreadingthebase-transfer-countregister.Moderegister--Containssomecontrolbits.Themoderegisterissetupbytheprogram,butcannotbereadbyit.writememory?--determineswhetherdmatransfersarefromthei/odevicetomemory,orviceversa.autoinit?--governsAutoinitializationMode.Iffalse,thecurrent-transfer-countregistershouldbesetupwiththelengthofthetransfer,andwhenitrunsdownthechannelmasksitself.Iftrue,thecurrent-transfer-countregistershouldbesetupwiththelengthofthecircularbufferinexternal-busmemory,and,whenitrunsdown,thechannelreloadsthecurrent-addressandcurrent-transfer-countregistersfromthebase-addressandbase-transfer-countregisters,thuswrappingaroundthecircularbuffer.decaddr?--determineswhetherthecurrent-addressregisteristobeincrementedordecrementedaftereachbytetransferred.Maskbit--Whileachannel'smaskbitisset(thechannelissaidtobe"masked"),dmaonthechannelissuspendedinthatthechannelwillignorerequestsfordmatransfersfromthei/odevice.Notethatifani/odevicerequestsadmatransferwhileitschannelismasked,andisstillassertingthatrequestwhenthechannelbecomesunmasked,thechannelwillservicetherequestatthattime.Thusdatacanbelostwhileachannelismaskedonlyifthechanneliskeptmaskedforasignificanttimerelativetothespeedofthei/odevice.îŠî êïføt`Xî ìïhsp`¬îâïbt`XîQîSî4îgî˜î$ˆ î+Qî,ç î3óî6$î?˜îDFîFîHèîI@î ìï`~î •î(îfî>î;î)î©îÚî%¦î)Lî.Qî.© î7¸î:*î@oîBîH�î ìï^ûî íî3îÏîîîÆîÀî$—îâï]xî‹îÿî­î ëî"Úî$¾î&Œî(½î.s î6#î7¹ î?¬îAzîC«îHóî ìï[õî ÍîMî›îuî#èî%¶î'çî,×î0î1» î9‚î>0îA¶îCbî ìïZrîHîöîâî"Ôî#,î%Õî/Iî3÷î6Tî8î;î<Ñî?îD¸îFNîHíî ìïXïî î{îØîúî¦î„îî 5 î'Ïî- î5Íî8¸î;¤î=|î?­îD¾îâïWlî ìïUüv î³ îâïTftî„î"îLî"Ðî%î)ºî.tî/ÿî20î6óî;Iî>`î?öîAvî ìïRãîŠî´î:î7î#î0_î5 î7ùî;ìî>îC îJî ìïQ`î ˜î îºîòîž î&eîâïOÝî‹ îRîî>î#ˆ î+Äî1Èî3ùî9Wî;Êî=®î?ßîISî ìïNZîñîIîîYî1îÍî"î$#î(çî+ î2ßîâïL×î ìïKgvîb îâïIÑtîIîzîƒîî?î!+î'!î)ˆî+î5¦î9Ðî<î@ îA•îCÆîH‰î ìïHNî»îî*îÀîÍîÏî¥î!Øî$ î(ù î0î1±î? îDvîFœtîGÄîHìî ìïF¸î ×îWîƒvtî^î[î–îQî�î!–î#î%Gî*Xî,Àvtî/6î1gî6Wî7•îî@Vî ìïE"îŠîÕîkîœî!5î%ïî'Y î/ûî5-î7S î>›îAÓîDîFðîIñî ìïCŸî ˜î6îâïBî)îÈîùî$Uî)î.4î0eî5aî6ìî9Íî?,îE{îFûîH¾î ìï@™î ‡îîËîvî=î�îèî#/î%Ìî(kî+ïî,ìî:Hî>öîBpîCûîG'î ìï?îcvîätîçîäîÐîî î%î'Dî*“î-gî0áî5Xî6Ùvtî:·î;´î> îCÓîGèî ìï=€î î rîÀîñîAîî +î$îî(íî+âî- î/÷îâï;ýî:îî­îÛî[îêî"‰î$ºî*’î/@î2æî4’î8�î; î=tî@îCAîFèî ìï:zîäî(î î9î‘î:î$Öî*¡î0*î2[ îâï8÷î‹îçî#•î$Óî&Âî(¦î*tî,¥î2[ î:Nî<î>MîC•îFvîGöî ìï7tîŠî´î'îõî"&î'î*Nî+úî7©îîC îJî ìï,ßî îLîøî§îâï+\î‹î:î!èî#&î'p î/¬î5°î7áî=?î?²îA–îCÇî ìï)ÙîHîMî¥î wî!µî#�î*)î/pî1î6Cî8tîD#îâï(Vî ìï&ævî ‘ îâï%PtîvîÚîZî#î{î"$î%Êî*xî+¶î-¥î/‰î1Wî3ˆî9>î;�î?ÛîAžîDŠîFXîâï#Ív tî:î„ îXî$uî'aî,Àî.æî2î4Oî6sî:‡î<îAœîC2îEÛîâï"7vtîDîŽîsî%î):î)’î*çî.@î0qî=ÍîB{îFÅîHˆîJwî ìï ¡î Ðî»îìîõî€î±îäî mî#óî%î(î+¢î-Óî2Ãî6«î:.î:†î;Ûî>èîAî ìïîHîöî @î"î#òî%Öî(Áî*òî.ûî0†î2·î7zî;yî<ù îD“îJ(î ìï›î ÍîSî{îgîZî‹î{î$î&8î/¬î25î?‘îDÃîGûîJ,î ìï î³î<îë î%uî(Kî.-î2ºî4ëî9®îâï•vtî@îŠ î^î!{î#¬î- î1Îî3 î4Œî6O î=ÿî?• îGˆîJ•î ìïÿî îîÏ îâï|î ìï vî ‘îâïvtîÉîÆî’îöîäî "î"î$»î)«î*éî-’î/î0Õ î7Õî:Áî<™î>ÊîCºîDøî ìïóîtîôî“îÄî´î/î"Bî'jî)yî,eî1Äî4üî7-î9Qîâïpî)îÈîûî¾îâîöî#î$î'î+âî/fî1î6î7@îðî@.îBžîHîJ±î ìïíî�îîGî7î î%Sî'„î,tî.ïî3Eî5vî:î;…î>$îAqîAÉîEîGíîJJî ìïjî ¯îî™î–î†îÄî“î }î!°î#áî(Ñî*î,úî1Éî3Øî4Õ î;9î>/îBÜîD\îF�îJ?î ìï çî wî ¨îÌÿ¶ êq?€`½è7Allchannels'maskbitsaresetwhenthedmacontrolleris(re)initialized,includingatpower-up.Theycanbesetorclearedbytheprogram.Achannelsetsitsmaskbitwhenthecurrent-transfer-counterrunsdown,exceptinAutoinitializationMode.Theprogramcannotreadthemaskbits.TCbit--Whetherthechannel'scurrent-transfer-countregisterhasrundownsincethelasttimeeitherthedmacontrollerwas(re)initialized,includingatpower-uporBUSDMA.READTCBITwasexplicitlyusedtoresetthisbit.Directmemoryaccess--theBUSDMAfunctionsSeetheRegisterModelsectionaboveforexplanationsoftheargumentsofthesefunctionsandoftheregistersreferredtobythem.Thesefunctionsdonotchecktheirargumentsexceptasspecificallynoted.(BUSDMA.INIT)--(re)initializethedmacontrollerandmemoryrefreshcircuitry.Maskschannels1,2and3,andclearstheirTCbits.(BUSDMA.SETMODEchannelwritememory?autoinit?decaddr?)--setthemoderegisterforthechannel.(BUSDMA.SETPAGEchannelhighbitsofaddress)--writetothepageregisterforthechannel.Checksthatchannelisintherange1-3.(BUSDMA.SETADDRESSchannellow16bitsofaddress)--writetoboththebase¤taddressregistersforthechannel.Thechannelmustbemaskedwhenthisfunctioniscalled--thisisthecaller'sresponsibility.(BUSDMA.READADDRESSchannel)=>low16bitsofaddress--readthecurrentaddressregisterforthechannel.Thechannelmustbemaskedwhenthisfunctioniscalled--thisisthecaller'sresponsibility.(BUSDMA.SETCOUNTERchannelnbytes)--writetoboththebase¤ttransfer-countregistersforthechannel.Checksthatnbytesisintherange1-65536.Thechannelmustbemaskedwhenthisfunctioniscalled--thisisthecaller'sresponsibility.(BUSDMA.READCOUNTERchannel)=>nbytes--readthecurrenttransfer-countregisterforthechannel.Notethatthevalue65536isreturnedas(thefunctionallyindistinguishablevalue)zero.Thechannelmustbemaskedwhenthisfunctioniscalled--thisisthecaller'sresponsibility.(BUSDMA.MASKchannel)--setthemaskbitforthechannel,disablingdmaonthechannel.(BUSDMA.UNMASKchannel)--clearthemaskbitforthechannel,enablingdmaonthechannel.(BUSDMA.READTCBITchannelclearthebit?)=>thechannel'sTCbit,asTorNIL.Alsoclearsthebitifrequested.Directmemoryaccess--summaryofsimpleuseGenerallyeachchannelcanbedealtwithseparately.Planning--îßî êïføt`XîI¾ïhsp`¬îâïbt`XîîÑî5î§îÍî ¼î$Bî&sî)_ î/jî0¨î9:î?î@…îFßîG7îJ�î ìï`~î Iî îûî‘îîìîîÒî *î!‰î&yî(ìî*˜î-üî/êî3pî5¡îD&îGî ìï^ûî ßîÿîîî"Fî"žî%Gî*¥î.ðî1Üî4 î7qîâï]xî ìï\vî 'îâïZrtîbî“î_î)»î.iî0°î3î6³î9öî<'î>xîAnvtîE îG<îJ(î ìïXÜ î÷îuîî çî"Rî(Uvtî)áî9î;˜ îAKîDXîEØîHðî ìïWFî ^îâïUÃïT@î ìïRÄw`iîÐî×î»î,îÌî%¾îâïQ t`XïO‡îJî{î­îáî!Lî%î'- î.æî0qî2¢î9î:ªî>îCÏîFXîGãîJî ìïNîî0î°î~îâïL�î´îîWî�î Nî#eî)âî.î/ƒ î6TîâïJþî ìïI<x`i t`XîÒî î�î!Áî$­ î*¸î-Aî2~î6ë î<~î<Öî@êîF^îG¾îHÆîØïGªîaîÁîJîðî!î#Bî ìïF'ïDex`i t`Xîîlvî Bî š î(òî)Jtî.¬î/vtî4Ûî6%î8î:Eî=ëîB™îD¨îFÙîØïBÏî ìïALï?Šx`i t`XîuîÍvî£îûtî*¯î+ùî/Gî0Çî2øî6î:¾î<Íî>þîDEîD�îI5îØï=ôîwvtîMî‹î î <î#Øî ìï<^ï:œx`it`XîöîNvî#$î#|tî.þî0Hî3–î5î8"î:Sî=?î>©îCBîGüîØï9î îîJî"‘î"éî%’î*‚î-»î/~î4Mî7Óî:Eî?Œî@ÊîD�îEÚîHLîIŠîØï7ƒî îiî ìï6ï4>x`iî½t`Xî vtî%dî'Ìî3Lî4–î7‚î9³î>LîCîG´îIÃîØï2¨î îPî¨îQî#Aî&zî(=î- î0’î3î8Kî9‰î=Oî>™îA îBIîDzîHÚîØï1%î ìï/¢ï-àx`iîit`XîÁvî#—î#ïtî(`î)ªî,øî.xî1„î3µî6¡î8 î<¤ îEFîJxîØï,Jîçîî_î·îî"§î%Fvtî)>î*|î+üî.-î1Éî7î7iî:î?îB;îCþîHÍîØï*´î^îÐîî Uî$î%eî'×î)î+Fî/¦î ìï)1ï'ox`it`Xî &î ~vtî%Íî(5vtî,-î-wî0cî2”î7- î?ÏîD}îFŒîH½îØï%Ùîîwî¾î]î!Žî%î(Ðî*î/xî0ùî3£ î;îEYîILîØï$Vîî[îîôî"-î#ðî(¿î,Eî,�î/î4Vî5”î9Zî:¤î=î>Tî@…îDåîØï"Óî ìï!PïŽx`i t`XîÉvî!tîpîºî ©î"Úî&>î(,î*;î,lî1´î7]î:IîRî ìïøï6x`i t`Xî|îÔvtî #î!mî$�î&Àî*$î,î.!î0Rî5šî;î=îî?ÆîA÷î ìï ïÞx`it`XîŸî÷vî!Íî"% tî)”î+üî.-î3ùî64î8zî9ûî;9î<Ïî@ î@bîCaîGîI8îØïHîÆîù î ìïÅîâïBî ìïÆw`iîÐî×î»î,î!ëî#·î(šîâï t`Xï‰îîîî_î!"î$Zî'E îâïî ìï –v ÿ; êq?€`½ó8Determinewhatchannelthedevicewilluse.Determinewhatconditionswillterminatethedmaoperations,andhowthedevice,theprogram,andthedmacontrollerwillfindoutaboutthem.Determinewherethebuffer(s)willbe,totheextentthattheyarenotdynamicallyallocated.Ifyouareusingcircularbuffering,orotherexoticstuff,you'llknowitbythispoint.Globalinitialization--CallBUS.RESETwheneveryouwanttosimulateapower-down,power-upcyclefortheBusMaster,theexpansionchassis,andthedevicesontheexpansionchassisbus.CallBUSDMA.INIT.Thishastobedoneatleastoncebeforedoingdmaontheexternalbusorexpectingthememoryontheexternalbustokeepdata.Itcanbecalledredundantly,buthasthesideeffectofmaskingchannels1-3.Sincethereisnowaytoreadthemaskbits,ifyouhavemultiple,logicallyindependenti/odevicesusingdmaonthesystem,youwillhavetocoordinateBUSDMAinitializationinyourownsoftware.Thismaybefixedlater.Admaoperation--Ifthechannelisnotmasked(whichitisafterBUSDMA.INIT),callBUSDMA.MASK.ThencallBUSDMA.SETMODE,BUSDMA.SETPAGE,BUSDMA.SETADDRESS,andBUSDMA.SETCOUNTERinanyorder.(Ifyourmodesettingsorpagenumberforthechannelareconstant,youdon'thavetosetthemeachtime,thoughit'scheap.)Whilethechannelismaskedisasafetimetosetupthei/odevice.NowcallBUSDMA.UNMASK,then,whenready,startthei/odevice.(Itcouldbestartedwhilethechannelismaskedifdatawouldn'tbelost,butthiswayalwaysworks.)Thedmaoperationisnowhopefully"inprogress".Youwillneedtotestthingsduringthistime,especiallysincewedon'thaveinterrupts.IfyouaregoingtouseBUSDMA.READADDRESSorBUSDMA.READCOUNTER,orotherwiseneedtosuspenddmaonthechanneltemporarilyforsomereason,callBUSDMA.MASKtosuspend,thencallBUSDMA.UNMASKtoresume.TostopthedmachannelcallBUSDMA.MASK.Directmemoryaccess--technicalnotes(1)Thecurrent-andbase-transfer-countregistersarekeptinthehardwareasthenumberoftransfersremaininglessone,andthechannelchecksaftereachbytetransferforthecurrent-transfer-counthavingbeendecrementedfromzeroto-1.BUSDMA.SETCOUNTERandBUSDMA.READCOUNTERperformthetranslationtothemodeldescribedabove.(2)Thei/oaddressesofthedevicesdescribedhereinarethesameasontheIBMPC.TheycanbediscoveredbyinspectingtheInterlisp-DsourcecodeinthisBUSMASTERlibrarypackage.(3)ThemainpointofthissectionistotelltechnicallyadvancedreadershowtheBUSDMAmodelofthedmaprocessrelatestotheTruthabouttheBusMasterandtheIntel8237-5Admacontrollerchip.ThisforthosewhohavereadthespecificationsfortheIntel8237-5AdmacontrollerchiporlookedattheBusMasterorIBMPCschematics.Asidebenefit,perhaps,istogivehintsforthosewhoarethinkingaboutusinganexoticdevicethroughtheBusMaster.Thissectionisnotintendedtobeintelligibletoacasualreader.BusMasterfunctionalitythatishiddenbytheBUSDMAfunctions--theInterruptandInterruptMaskbits,ParityError,andingeneralalltheBusMasterstatusandcontrolregisterbits(exceptResetviaBUS.RESET).Notethatinterruptsfromtheexternal-busi/odevicestothe1108aresupportedbyBusMaster,butthe1108microcodewillatpresentblowupifpresentedwithsuchaninterrupt.SeealsoTechnicalNote(1)above.Intel8237-5AfunctionalitythatdoesnotapplyinthehardwarecontextoftheBusMaster--Channel0isdedicatedtomemoryrefresh.Andthereforeblockmemory-to-memorytransferandblockmemoryinitializationareimpossible.I/odevicescannotasserttheTCsignaltothedmacontroller.Commandregister:thetimingvariationsmayormaynotbephysicallypossible,Idon'tknow;DREQ&DACKsenseareofcoursefixed.Moderegister:"cascade"modeisofcoursenotpossible.Notethatthepageregistersarenotonthe8237-5A.î"î êïg v`Xî ìïhsp`¬îâïbt`XîŠî¸î¨îÙî#íî&hî)î)^î0î34 î9¢î<îBîDFîG2î ìï`~ î¾îGîîMî¹îêî$ î')î)Zî,F î2Qî4Ìî7‹î9Ñî=‚îA3îA‹îH3î ìï^ûî Õîî{îöîî‘îÂî!¶î$Uî'6î)\î+¢ î3 îâï]xî7î¿îåî_î" î#Qî$çî(Vî,'î/�î3%î6´î7Üî9ªî<îâï[õî ìïZ…vîîâïXïtî î™î�î"%î%Sî&Óî,î- î5)î;,î>oî@~îB¯ îI¤î ìïWlî îaîî�î¾î Vî".î$_î*£î.îîâïUéî  îúîRî<î!ƒî#î$Æî( î)tî,jî/�î3 î7Pî:<î<î>EîCVîE¾îGTî ìïTfîäîîRî*î[î lî"Ôî$Tî'vî*£î*ûî,Eî.¢î0eî4+ î<î>Yî@ îBÑîEzîIîJ¡î ìïRãî(îœî$î|îî[î™î!qî$î%›î(‡î*¸î.î0æî2î4¡î7¹î=WîB� îJKî ìïQ`î î¨î"îîæîî»î"Cî$¾î'Öî)V î/æî6‚ î>+î?«îB·îEŒî ìïOÝî‹îãîÍî£îfî´îâïNZî ìïLêvî Aî îâïKTtî7îhîXî–îÜî«î$î%)î&gî)t î4Hî6£ îB.îB†îEõîHPî ìïIÑî4î%øî6’î9îIÃî ìïHNî lî ßî»îîáîíî“îLî âî#úî(öî+î-6î2&î4Lî9áî?îâïEHîîn î":î%‰î)î-î/äî2î49î8¤î8üî:¿î>Yî@îDhîGìîJî ìïCÅîÜîîéîîòî{î >î"üî%Nî'Àî*jî.ŸîâïBBî‹îwîmî«î€î$vî&¦ î,êî-Bî0!î2œî5Êî7Jî9§î=�îAÏîDAîG�î ìï@¿ îíî0î*îŽî¦ î"î"nî"Æî$î&£î(Éî,cî-ãî0*îAíîCƒî ìï?<îmîî#úî'(î(¨î-Åî0±î2‰î4ºî9ª î@ßîBîîFRî ìï=¹înîÉ îýî}î"òî%éî(D î5¸î78îâï<6îÚî¤îÕîÁî±î îâï:³ï90î ìï7´w`iîÐî×î»î,î!÷îâï5út`Xï4wîÜî…î—î î… î''î,Yî.î1jî2êî5î:óî¥îC¡îE,îJ‹î ìï2ôî;vî—tîOîØî îùî#.î&;î)=î,î0ùî3î59îB•îFàîJî ìï1^ îßvtîîîÂîBîîrî,î.£î@ÌîEóîH$î ìï/È î|îüî-î5î-îâï.Eï,ÂîÜî…î©îŒîîHî#àî)Øî-ìî0î2Cî5’î7î8ëî;î>3î@°îAîDaîF¾îH�î ìï+? îˆîV î¥îÖ î!´î%Óî(êî*jî,Üî5ôî:3îâï)¼ï(9îÜî…îÓîAîÌî>î"©î#çî%gî'– î.<î4î8¸î;�î=¾îDZîHbîIíî ìï&¶î î î¬îËîKî|î8î"éî%î+·î.@î0qî3ˆî8Ðî;¼ îAÇîDþîEVîH@îJOî ìï%3î [î0îHî4îe î –î"¥î$Öî'íî-5î0! î6,î9 î:¢î>õî@`îB‘îI.î ìï#°î ‚î™î¿ î³î îjîî âî&6î'tî(ôî+³î.ëî0úî4iî7>î9dî>ªîB[îEÕîG˜î ìï"-î ½îÑî×î îâï ªîÌî7îuî»îEî Åî"ˆ î) î* î+�î/…îâï'ï¤î îMîìî!*î%¡î'oî) î0< î6ùî7Qî9‚î?9îAÂîGyî ìï!î |îFîîôî}îýî  î"aî$’î+/î.Öî1_î5ßî:�î<ÿîA˜îE4îGCî ìïž îâïî)îÈ îáîî J î'äî*î. î0 î2Qî5iî7�î=Ôî?¢ îF—îHéî ìï˜î î5î¯î*î•î9î!pî#Tî$‡î*–î-�î0ƒî2F îâïîJîçîóî:î4îâï’ïîùîA îî!®î$¯î&õî*�î,î.Aî4î8¼î:Gîïî?GîEÙî ìï†îîDîm îyîOîåî"»î%î&Ä î,ñî2Xî34î6˜î: î?î@€îEîH‰îJ¯î ìï î wî–î;î“îeîŒî"±î&Wî'•î) î-?î/…îâï €î)îÈîùîîCî!iî#¯î%‡î'¸ÿ  êq?€`½è9Intel8237-5AfunctionalitythatishiddenbecauseitiseitherimpossibleintheBusMasterhardwarecontextoronlyusefulwithveryexotichardware(Idon'tknowwhich)--Moderegister:"block"mode,"demand"mode.Commandregister:rotatingpriority.Intel8237-5AfunctionalitythatishiddeninBUSDMAbecauseitwasjudgednotusefulincontext--Read&writetherequestbits,readtemporaryregister,clearmaskregister,readbase-addressregister,readbase-transfer-countregister.Commandregisterbits:disablecontroller.Moderegisterbits:the"verify"transfertype.Intel8237-5AfunctionalitythatispartiallyhiddeninBUSDMA--MasterclearisimbeddedinBUSDMA.INIT.Read&clearstatusregisterTCbitsispresented,somewhatmodified,inBUSDMA.READTCBIT.ClearbyteselectflipflopishiddeninthefourfunctionsBUSDMA.READ/SETADDRESS/COUNTER.î,ÿî êïføt`XîI¾ïhsp`¬îâïbt`Xï`~îùîA îî!®î"ìî'cî,Tî-|î.ºî2v î9î:�î<ÁîC^îI6î ìï^ûî�î%îî÷îâîÃî ”î&lî'Áî+%î.´î3üî4Tî8&î=MîB;îF9î ìï]xîiîfî¾îPî wî%fîâï[õïZrîùîA îî!®î"ìî'cî(ãî/î4pî5˜î8î½îB¥îD%îIºîJî ìïXïî \îÆîîEîéî³îŸî%î*î-8î0œî5¢î8Ž î@UîE[îHGî ìïWlî›î îøî!Šî&8î)#î-™ î3ûî4Sî8%î<Óî?¾îAïîG î ìïUéîÇîâïTfïRãîùîA îî!®î"ìî(î,“î.î5¡î5ùî:fî=ˆî>ÆîE îF‹î ìïQ` îFîžîîxîšî Aî$ïî'*î)œî*Ú î1Aî7{î=|î>üî ìïOÝî|îÔîYî :î#Êî(€î)¾î.5î/µî1æî4»î:†îAyîI&î ìïNZîâïL×ÿï êq?€`½Aþ TIMESROMAN é TIMESROMAN é TIMESROMAN þ HELVETICAþ TIMESROMAN ~GACHA é HELVETICAé HELVETICA~GACHA ½ ‰%b4þB¼P îY ŒfFioj/l jÿÿž†þ^ÿÿÿÿÿÿ0{ERIS}INTERMEZZO>LIBRARY>BUSMASTER.PRESS;2JELLINEK12-Apr-85 14:46:01