home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / telecomm / sticpsrc.lzh / DOC / SCC.ARC / SCC.DOC next >
Encoding:
Text File  |  1990-03-02  |  18.9 KB  |  443 lines

  1. 06601030305800
  2. F0110030
  3. 9[...................................................]001
  4. êTheZ8530SCCdriverfortheAtariSTandPCClonesÇ
  5.  
  6. ByR.E.Janssen,PE1CHL.
  7.  
  8.  
  9. AdriverhasbeenwrittentosupportanumberofZ8530SCCchips
  10. connectedtoanAtariSTcomputer.Thedriverisconfigurable
  11. fordifferenthardwareconfigurations,andanexampleschematic
  12. supportingupto7SCC's(14channels)hasbeenincluded.
  13. ThedrivernowalsorunsonPCClones,althoughtheinterrupt
  14. handlingcapabilitiesofthistypeofcomputerlimitsthemaximum
  15. speedandnumberofchannelstoalowervaluethanontheAtari.
  16. (dependingonthespeedofyourmachine)
  17.  
  18. Eachchannelmaybeindepentlyprogrammedtosupport:
  19.  
  20. -AnasynchronousSLIPline
  21. -AnasynchronousinterfacetoaKISSTNC
  22. -DirectAX.25(HDLC)
  23.  
  24. Thesoftwarehasbeenwritteninsuchawaythataportto
  25. anotherenvironmentwhereZ8530SCC'sareavailableshouldbe
  26. relativelystraightforward.Addressesofthechipsare
  27. completelyconfigurable,andmostprobablyonlythefirst-level
  28. interrupthandler(writteninassemblylanguage)hastobe
  29. adaptedtothespecificconfigurationoftheinterrupt
  30. acknowledgelogicinthesystem.
  31. ThePCversionsupportsafewspecialtypesofinterfaceboard,
  32. thatusespecificIOportstocontrolcertainon-boardfeatures
  33. likeMODEMsandinterruptconfiguration.
  34.  
  35. êInitializationandattachmentofthechannelsÇ
  36.  
  37. Tousethedriver,2stepsmustbeperformed:
  38.  
  39. 1.Globalinitializationofthedriver
  40. 2.Attachmentofeachchannel,specifyingmodeandoptions
  41.  
  42. TheglobalinitializationisneededtoresetallSCCsandto
  43. installacommoninterrupthandler.Also,thehardwareaddresses
  44. ofthechipsaredefinedinthisstep.Inthesecondstep,each
  45. channelissetupfortheintendeduse.
  46.  
  47.  
  48. ♪≡ê1.InitializationÇ
  49.  
  50. Initializationisperformedusingthe"attachsccinit"command,
  51. usingthefollowingsyntax:
  52.  
  53. attachscc<numberofchips>init<baseaddress>
  54. <spacingbetweenchips><offsettochannelActrl>
  55. <offsettochannelBctrl><offsetfromctrltodata>
  56. <addressofINTACKlatch>|0<interruptnumber>
  57. p<PCLKfrequency>|r<RTxCfrequency>
  58. [<specialinterfacetype><interfaceparameter>]
  59.  
  60. Toinitializeaboardwith2SCCsusingmyschematic,the
  61. followingcommandwouldbeused:
  62.  
  63. attach scc 2 init fffd00 8 3 7 -2 fffd3f 3 p4915200
  64.  
  65. Thisspecifiesinterruptnumber3,anormallyunusedinterruptin
  66. 520STand1040STmachines.InthenewerMega-STthisinterrupt
  67. isusedfortheBlitter.Inthiscase,itispossibletousethe
  68. "ringindicator"inputoftheRS232interfaceasaninterrupt
  69. source.Ithasinterruptnumber14.
  70.  
  71. TheINTACKlatch(write,thenreadtogettheinterruptvector)
  72. islocatedat0xfffd3f.Itisalsopossibletospecify0for
  73. thisaddress.Inthatcase,INTACKisnotusedandthedriver
  74. findstheinterruptingchipbypollingeachRR3Aregister.This
  75. allowsamoresimplehardwaredesign,especiallyforPCs.
  76.  
  77. Thecrystalclockisspecifiedas4.9152MHz.Otherfrequencies
  78. canbeused,andthisparametershouldbeadjustedaccordingly.
  79. TheclockusedforbaudrategenerationisconnectedtoPCLK.It
  80. wouldalsobepossibletosupplyabaudrateclocktoRTxC,anda
  81. clockofadifferentfrequencytoPCLK(liketheprocessor
  82. clock).Thisoptionisselectedbyprefixingtheclockfrequency
  83. withan"r"insteadofa"p".
  84.  
  85. The"specialinterfacetype"and"interfaceparameter"fieldscan
  86. beusedtospecifysomespecialtypeofinterfaceboardtobe
  87. used.Thisrequiresmodificationtothedriversoftware.
  88. Currently,thefollowingspecialtypesaresupportedonthePC:
  89.  
  90. -type1:EAGLE
  91. -type2:PC-100
  92. -type4:PRIMUS
  93.      -type8:DRSIPC*Packet
  94.  
  95. ThePC-100andthePRIMUSacceptaninterfaceparameter,thatis
  96. usedtocontroltheon-boardMODEM.Itmustbespecifiedasa
  97. hexadecimalvaluetobesenttotheoutputportontheboard.
  98. ♪∙ÇPossibleinitialisationcommandsare:
  99.  
  100. EAGLE:attach scc 1 init 2e8 8 2 0 1 0 2 p36864001
  101.  
  102. PC-100:attach scc 1 init 2e816 6 4 1 0 2 p4915200222
  103.  
  104. PRIMUS:attach scc 1 init 2e8 4 2 0 1 0 2 r2457600402
  105.  
  106. DRSI:attach scc 1 init 300 16 2 0 1 0 2 p49152008
  107.  
  108. WhenusinganAT-typemachine(withtwo8259interrupt
  109. controllers),andusingthe"interrupt2"lineontheBUS,
  110. specifyinterruptnumber9insteadof2.Thisbetterreflects
  111. theactualconfiguration.TheBIOSwillattempttheredirection
  112. ofinterruptvector#9to#2,butitdoesnotcompletelydothe
  113. job.
  114.  
  115.  
  116. TheSCCdriverusesthe"buffers"featurethatpre-allocatesa
  117. numberofreceiverbufferstobeusedbythedriversatinterrupt
  118. time.Besuretoissuea"buffers<n>"commandbeforeyouattach
  119. anyoftheSCC'schannels(seebelow).The<n>parameterofthe
  120. bufferscommandspecifiesthenumberofbufferstopre-allocate,
  121. thisisafunctionofthenumberofchannelsyouwillattach,the
  122. baudrateofthechannels,theactivityoneachofthesechannels,
  123. andthetimethecomputercanspendwithoutre-allocatingnew
  124. buffers.Agoodnumberofreceiverbufferstotryis32.Ifyou
  125. seeanon-zeronumberinthe"Space"columnintheSCCSTAToutput
  126. (seebelow)youcanincreasethisnumber.Itspecifiesthe
  127. numberof128-bytebuffersthatarepre-allocatedforthe
  128. receiverbuffersofallchannelsattached.Sointhiscase,
  129. 4Kbytesareallocated.
  130. Itisalsopossibletosetthesizeofthebufferstobe
  131. allocated,usingthe2ndand3rdargumentofthe"buffers"
  132. command.Thesesetaminimalandmaximalsizeofeachbuffer.
  133. ThePCversionwillonlyallocatebuffersofthemaximumsize
  134. (andignoresthesecondargument),buttheAtariSTversions
  135. minimizesthethrashingofthememoryfreelistbyallocating
  136. buffersbetweentheminimalandmaximalsize,thatcanbecarved
  137. outofthefreelistwithoutfurthersplittingblocksofmemory.
  138. Example:buffers6410128
  139.  
  140. ê2.AttachcommandsÇ
  141.  
  142. WhentheSCCdriverhasbeeninitialized,youcanattachthe
  143. channels.Thisisdoneusingoneof3formsofthe"attachscc"
  144. command:
  145.  
  146. attachscc<channel>slip<mtu><baudrate>
  147.      attachscc<channel>kiss<mtu><baudrate><callsign>
  148.      attachscc<channel>ax25<mtu><baudrate><callsign>
  149.  
  150. Thesewillberefferredtoas"slip","kiss"and"ax25"mode.
  151.  
  152. ÇThe<channel>parameterspecifieswhichhalfofwhichSCCwillbe
  153. programmed,asfollows:
  154.  
  155. channel0:"A"sideoffirstSCC
  156. channel1:"B"sideoffirstSCC
  157.      channel2:"A"sideofsecondSCC
  158.      channel3:"B"sideofsecondSCC
  159.  
  160. etcetera.Thechannelnumberrangesfrom0to(2*nchips)-1,
  161. wherenchipsisthenumberofchipsspecifiedinthe
  162. "attachsccinit"command.
  163.  
  164.  
  165. ♪⑥êSLIPmodeÇ
  166.  
  167. Thiscanbeusedforalinktoanothermachine,whenthechannel
  168. hasanRS232interface.Example:
  169.  
  170. attachscc0slipsl02569600
  171.  
  172. ♪⑤Thisattachesthe"A"sideofthefirstSCCasinterface"sl0",
  173. withanMTUof256andaninitialbaudrateof9600.Thebaudrate
  174. canbechangedlaterby:
  175.  
  176. paramsl0<baudrate>
  177.  
  178. Enteringjust"paramsl0"willdisplaythecurrentbaudrate.
  179.  
  180. êKISSmodeÇ
  181.  
  182. KISSmodecanbeusedtotalktoaKISSTNC.Itcanalsobeused
  183. onanasynchronouslinktoanothercomputerrunningNET.
  184. ThedifferencewithSLIPisthattheinterfacewillbeAX.25
  185. type,andcanthereforebeusedforAX.25connections.A
  186. callsignmustbegivenasaparameter,thiswillbeusedforIP
  187. andNET/ROMpurposesontheinterface.Example:
  188.  
  189. attach scc 2 kiss 430 256 4800 pe1chl-7
  190.  
  191. Intheexamplethe"A"sideofthesecondSCCwillbeattachedas
  192. interface"430"usinganMTUof256,abaudrateof4800andthe
  193. callsignPE1CHL-7.
  194.  
  195. Thecommand"param430<paramnum><decimalvalue>"canbeusedto
  196. settheparametersoftheKISSTNC.Itisnotpossibleto
  197. displaythecurrentsettings.
  198.  
  199.  
  200. êAX.25modeÇ
  201.  
  202. Thisisprobablythemostinterestingmodetousewiththis
  203. interface.ItallowsAX.25communicationwithoutaTNC.Onlya
  204. MODEMisneeded.Example:
  205.  
  206. Çattach scc 2 ax25 430 256 1200 pe1chl-7
  207.  
  208. TheparametershavethesamemeaningasinKISSmode.Infact,
  209. theAX.25modeisemulatinganextendedKISSTNC,sothesame
  210. commandscanbeusedtosettheparametersoftheinterface(see
  211. below).
  212.  
  213. TobeabletorunfullduplexusinganSCCinAX.25mode,an
  214. externaldividermustbeavailable,thatdividesthebaudrate
  215. generatorclockavailableontheTRxCpinby32,andputsthe
  216. resultingsignalontheRTxCpinofthesamechanneloftheSCC.
  217. SuchadividerisnotnecessaryfornormalCSMApacketradio
  218. operation,butinterruptoverheadisslightlyreducedifyou
  219. stillinstallit.Ifyouhaveinstalledthedivider,prefixthe
  220. baudratewithaletter"d",asin:
  221.  
  222. attach scc 2 ax25 430 256 d1200 pe1chl-7
  223.  
  224. NotethatwhenusingtheRTxCinputasthebaudrategenerator
  225. clocksource,youwillhavetofeedtheexactrateofthe
  226. transmittertoTRxCtobeabletousefullduplex.Forthis
  227. reason,itisbettertousePCLKastheclocksourcewhenever
  228. possible.
  229. TheDRSIPC*PacketadapterusestheZ8536CIOontheboardasa
  230. divider,soyoucan(andshould)specifythe"d"optionforthat
  231. board.
  232.  
  233. Anotheroptionistouseexternalclocking,suppliedbythe
  234. MODEM.Thisisspecifiedusingthekeyword"ext",asin:
  235.  
  236. attach scc 2 ax25 430 256 ext pe1chl-7
  237.  
  238. ThereceiveclockwillbetakenfromtheRTxCpin,thetransmit
  239. clockfromtheTRxCpin.Watchthephaserelationshipbetween
  240. theclockandthedata!
  241.  
  242. ThesettingofparametersoftheemulatedKISSTNCisdoneinthe
  243. samewayasintheKISSmodeoftheSCCdriver:
  244.  
  245.      param430<paramnum><decimalvalue>
  246.  
  247. InAX.25modehowever,itisalsopossibletodisplaythe
  248. currentsettingsusing"param430".Thiswilldisplayaline
  249. like:speed=1200div=ygroup=0001=362=503=304=35=06=07=50
  250. 8=79=310=30.
  251.  
  252. The"clocktick"unitmentionedinthedescriptionsbelowdepends
  253. onthecomputertype.OntheAtariST,eachclocktickis10ms.
  254. OnthePCClones,aclocktickisusually55ms,buttheactual
  255. valueisprintedduringexecutionofthe"attachsccinit".
  256. Considerthattheexacttimeofeachdelaymaybeupto1
  257. clockticktimelessthanthespecifiedtime.Itistherefore
  258. unwisetospecifyavaluelessthan2foradelay(exceptwhen
  259. thespecialcase0isselected).
  260. Ç
  261. Theparametershavethefollowingmeaning:
  262.  
  263. 1:Thedelay(inunitsofclocktick)afterkeyingofthe
  264. transmitter,untilthefirstbyteissent.Thisisusually
  265. called"TXDELAY"inaTNC.When0isspecified,thedriver
  266. willjustwaituntiltheCTSsignalisasserted.This
  267. assumesthepresenceofatimerorothercircuitryinthe
  268. MODEMand/ortransmitter,thatassertsCTSwhenthetrans⑨
  269. mitterisreadyfordata.
  270. Thedefaultvalueofthisparameteris360ms.
  271.  
  272. 2:Thisistheprobabilitythatthetransmitterwillbekeyed
  273. whenthechannelisfoundtobefree.Itisavaluefrom0
  274. to255,andtheprobabilityis(value+1)/256.Thevalue
  275. shouldbesomewherenear20-60,andshouldbeloweredwhen
  276. thechannelisusedmoreheavily.
  277. Thedefaultvalueis25(10%persistence).
  278.  
  279. ♪⑤3:Thisisthetimebetweensamplesofthechannel.Itis
  280. expressedinunitsofclocktick.About100-300msseemsto
  281. beagoodvalue.
  282. Thisparametershouldneverbe0.Thechannelwillnot
  283. transmitwhen0isused!
  284. Thedefaultvalueis160ms.
  285.  
  286. ♪⑦4:Thetimethetransmitterwillremainkeyedafterthelast
  287. byteofapackethasbeentransferredtotheSCC.Thisis
  288. necessarybecausetheCRCandaflagstillhavetoleavethe
  289. SCCbeforethetransmitteriskeyeddown.Thevaluedepends
  290. onthebaudrateselected.Afewcharactertimesshouldbe
  291. sufficient,e.g.30msat1200baud.
  292. Thevalueofthisparameterisinclocktickunits,the
  293. defaultis30ms(oratleast2clockticks).
  294.  
  295. ♪5:Thefull-duplexmodeswitch.Thiscanbeoneofthefolowing
  296. values:
  297. 0:TheinterfacewilloperateinCSMAmode(thenormal
  298. half-duplexpacketradiooperation)
  299. 1:Fullduplexmode,i.e.thetransmitterwillbekeyedat
  300. anytime,withoutcheckingthereceivedcarrier.It
  301. willbeunkeyedwhentherearenopacketstobesent.
  302. 2:Like1,butthetransmitterwillremainkeyed,also
  303. whentherearenopacketstobesent.Flagswillbe
  304. sentinthatcase,untilatimeout(parameter10)
  305. occurs.
  306.      Thedefaultvalueis0,CSMAoperation.
  307.  
  308. 6:ControloftheDTRoutputoftheSCC.DTRwillbesetwhen
  309. thisvalueisnonzero,itwillberesetwhenthevalueis0.
  310. AfterinitializationDTRwillbesetbydefault.TheDTR
  311. outputcanbeusedasageneral-purposeoutput,e.g.to
  312. changebetween2transceiverfrequenciesoroutputpower
  313. levels.
  314. ÇThedefaultvalueofthisparameteris1,DTRSET.
  315.  
  316. 7:Theinitialwaittimebeforeanytransmitattempt,afterthe
  317. framehasbeenqueuedfortransmit.Thisisthelengthof
  318. thefirstslotinCSMAmode.Infullduplexmodesitcanbe
  319. setto1formaximumperformance,ortoahighervalueto
  320. giveNETachancetocombineseveralpacketsinasingle
  321. transmission.
  322. Thevalueofthisparameterisinclocktickunits.Itshould
  323. neverbesetto0.(Thechannelwillnottransmitinthat
  324. case)
  325. Thedefaultvalueis500ms.
  326.  
  327. 8:Themaximaltimethetransmitterwillbekeyedtosend
  328. packets,inseconds.ThiscanbeusefulonbusyCSMA
  329. channels,toavoid"gettingabadreputation"whenyouare
  330. generatingalotoftraffic.Afterthespecifiedtimehas
  331. elapsed,nonewframewillbestarted.Instead,thetrans⑨
  332. mitterwillbeswitchedoffforaspecifiedtime(parameter
  333. 9),andthentheselectedalgorithmforkeyupwillbe
  334. startedagain.
  335. Thevalue0willdisablethisfeature,andallowinfinite
  336. transmissiontime.
  337. Thedefaultvalueis7seconds.
  338.  
  339. 9:Thisisthetimethetransmitterwillbeswitchedoffwhen
  340. themaximumtransmissiontimeisexceeded.Thisparameter
  341. isinseconds,andshouldneverbe0.
  342. Thedefaultvalueis3seconds.
  343.  
  344. ♪!10:InCSMAmode,thisparameterspecifiesthemaximumtimethe
  345. transmitterwillwaitforthechanneltobecomeclear,
  346. expressedinunitsofonesecond.Whenthistimehas
  347. elapsedwithoutanopportunitytotransmit,thetransmitter
  348. willbekeyed.Thisisasafeguardagainstsituationswhere
  349. thesquelchrefusestoclose,oraweakcarrierispresent
  350. onthefrequency,topreventanindefinitepileupofframes
  351. totransmit(withapossibledangerofmemoryoverflow).Of
  352. course,thevalueshouldbesetsufficientlyhightoprevent
  353. accidentalkeyupsinperiodsofhighchannelload,e.g.60
  354. seconds.Thereisacompile-timeoptioninthedriverto
  355. throwawayframesinthiscase.
  356. Infullduplex2mode,thisparameterspecifiesthemaximum
  357. idletime,inseconds.Whennoframeshavebeensentfor
  358. thistime,thetransmitterwillbekeyeddown.Avalueof0
  359. willdisablethisfeature,i.e.thetransmitterwillbe
  360. keyedindefinitely.
  361. Thedefaultvalueofthisparameteris120seconds.
  362.  
  363.  
  364. ♪∙êTransmitterGroupsÇ
  365.  
  366. Itispossibletobuildspecialradioequipmenttousemorethan
  367. onefrequencyonthesameband,e.g.usingseveralreceiversand
  368. onlyonetransmitterthatcanbeswitchedbetweenfrequencies.
  369. Also,youcanconnectseveralradiosthatareactiveonthesame
  370. band.Inthesecases,itisnotpossible,ornotagoodidea,to
  371. transmitonmorethanonefrequency.TheSCCdriverprovidesa
  372. methodtolocktransmittersondifferentinterfaces,usingthe
  373. "param<interface>group<x>"command.Thiswillonlyworkwhen
  374. youareusingCSMAmode(parameter#5=0).
  375. Thenumber<x>mustbe0ifyouwantnogrouprestrictions,and
  376. canbecomputedasfollowstocreaterestrictedgroups:
  377. <x>isthesumofsomeHEXnumbers:
  378.  
  379. 200Thistransmitterwillonlybekeyedwhenallother
  380. transmittersinthegroupareoff.
  381. 100Thistransmitterwillonlybekeyedwhenthecarrier
  382. detectofallotherinterfacesinthegroupisoff.
  383. 0xxAbytethatcanbeusedtodefinedifferentgroups.
  384. Interfacesareinthesamegroup,whenthelogicalAND
  385. betweentheirxxvaluesisnonzero.
  386.  
  387. Examples:
  388. When2interfacesusegroup=201,theirtransmitterswillneverbe
  389. keyedatthesametime.
  390. When2interfacesusegroup=101,thetransmitterswillonlykey
  391. whenbothchannelsareclearatthesametime.Whengroup=301,
  392. thetransmitterswillnotbekeyedatthesametime,andonlyif
  393. bothchannelsareclear.
  394.  
  395.  
  396. ♪⑤êSCCSTATcommandÇ
  397.  
  398. OncetheSCCdriverhasbeeninitialized,somestatistic
  399. informationcanbeshownusingthesccstatcommand.Theoutputof
  400. thiscommandshowsonelineofinformationperattachedchannel.
  401.  
  402. ♪⑤Example:
  403.  
  404. ChIfaceSentRcvdErrorSpaceOverrRxintsTxintsExintsSpints
  405. 01448815220000100134488905235
  406. 143067000019152900
  407.  
  408. ♪⑥Theinfoshownis:
  409.  
  410. -channelnumberoftheattachcommand
  411. -nameoftheinterface
  412. -numberofframesqueuedfortransmission
  413. -numberofframesreceivedcorrectly
  414. -numberofreceiveerrors(CRC,ABORT)
  415. -numberoftimesthereceiverbufferpoolwasfoundempty
  416. -numberofreceiveroverrunsandtransmitterunderruns
  417. -numberofreceiverinterrupts
  418. Ç-numberoftransmitterinterrupts
  419. -numberofreceiverspecialconditioninterrupts
  420. -numberofexternal/statusinterrupts
  421.  
  422. ItisnormalthataSLIPorKISSchannelshowsnoerrors,andno
  423. specialconditionorexternal/statusinterrupts,whileanAX25
  424. channelhaslotsofthese.
  425.  
  426. Anoverrunisabnormalforalloperatingmodes.Iflotsofthese
  427. occur,theproductofbaudrateandnumberofinterfacesistoo
  428. highfortheprocessingpowerofyourcomputer.
  429.  
  430. If"Space"errorsoccur,specifyahighernumberofbuffersin
  431. the"buffers"command.Itis,however,normaliftheseerrors
  432. occurwhenyoustartashell,orwhenyoupausetheoutputofany
  433. commandusingCTRL-S.Thisisbecausetheprocessingand
  434. allocationofbuffersstopsinthesecases,whilereceiverinput
  435. keepscominginunderinterruptcontrol.
  436.  
  437. Whenyouseeonlytransmittedframes,thenumberoftransmitter
  438. interruptsis1,andallothercountersare0,theSCCisnot
  439. generatinginterruptstothecomputer.Thesingletransmitter
  440. interruptisa"simulated"interruptthatshouldstartthe
  441. transmission(butapparentlydoesn't).
  442.  
  443.