brintos

brintos / linux-shallow public Read only

0
0
Text · 20.3 KiB · d294276 Raw
687 lines · plain
1.. SPDX-License-Identifier: GPL-2.02.. include:: <isonum.txt>3 4=========================================================5SCC.C - Linux driver for Z8530 based HDLC cards for AX.256=========================================================7 8 9This is a subset of the documentation. To use this driver you MUST have the10full package from:11 12Internet:13 14    1. ftp://ftp.ccac.rwth-aachen.de/pub/jr/z8530drv-utils_3.0-3.tar.gz15 16    2. ftp://ftp.pspt.fi/pub/ham/linux/ax25/z8530drv-utils_3.0-3.tar.gz17 18Please note that the information in this document may be hopelessly outdated.19A new version of the documentation, along with links to other important20Linux Kernel AX.25 documentation and programs, is available on21http://yaina.de/jreuter22 23Copyright |copy| 1993,2000 by Joerg Reuter DL1BKE <jreuter@yaina.de>24 25portions Copyright |copy| 1993 Guido ten Dolle PE1NNZ26 27for the complete copyright notice see >> Copying.Z8530DRV <<28 291. Initialization of the driver30===============================31 32To use the driver, 3 steps must be performed:33 34     1. if compiled as module: loading the module35     2. Setup of hardware, MODEM and KISS parameters with sccinit36     3. Attach each channel to the Linux kernel AX.25 with "ifconfig"37 38Unlike the versions below 2.4 this driver is a real network device39driver. If you want to run xNOS instead of our fine kernel AX.2540use a 2.x version (available from above sites) or read the41AX.25-HOWTO on how to emulate a KISS TNC on network device drivers.42 43 441.1 Loading the module45======================46 47(If you're going to compile the driver as a part of the kernel image,48 skip this chapter and continue with 1.2)49 50Before you can use a module, you'll have to load it with::51 52	insmod scc.o53 54please read 'man insmod' that comes with module-init-tools.55 56You should include the insmod in one of the /etc/rc.d/rc.* files,57and don't forget to insert a call of sccinit after that. It58will read your /etc/z8530drv.conf.59 601.2. /etc/z8530drv.conf61=======================62 63To setup all parameters you must run /sbin/sccinit from one64of your rc.*-files. This has to be done BEFORE you can65"ifconfig" an interface. Sccinit reads the file /etc/z8530drv.conf66and sets the hardware, MODEM and KISS parameters. A sample file is67delivered with this package. Change it to your needs.68 69The file itself consists of two main sections.70 711.2.1 configuration of hardware parameters72==========================================73 74The hardware setup section defines the following parameters for each75Z8530::76 77    chip    178    data_a  0x300                   # data port A79    ctrl_a  0x304                   # control port A80    data_b  0x301                   # data port B81    ctrl_b  0x305                   # control port B82    irq     5                       # IRQ No. 583    pclock  4915200                 # clock84    board   BAYCOM                  # hardware type85    escc    no                      # enhanced SCC chip? (8580/85180/85280)86    vector  0                       # latch for interrupt vector87    special no                      # address of special function register88    option  0                       # option to set via sfr89 90 91chip92	- this is just a delimiter to make sccinit a bit simpler to93	  program. A parameter has no effect.94 95data_a96	- the address of the data port A of this Z8530 (needed)97ctrl_a98	- the address of the control port A (needed)99data_b100	- the address of the data port B (needed)101ctrl_b102	- the address of the control port B (needed)103 104irq105	- the used IRQ for this chip. Different chips can use different106	  IRQs or the same. If they share an interrupt, it needs to be107	  specified within one chip-definition only.108 109pclock  - the clock at the PCLK pin of the Z8530 (option, 4915200 is110	  default), measured in Hertz111 112board113	- the "type" of the board:114 115	   =======================  ========116	   SCC type                 value117	   =======================  ========118	   PA0HZP SCC card          PA0HZP119	   EAGLE card               EAGLE120	   PC100 card               PC100121	   PRIMUS-PC (DG9BL) card   PRIMUS122	   BayCom (U)SCC card       BAYCOM123	   =======================  ========124 125escc126	- if you want support for ESCC chips (8580, 85180, 85280), set127	  this to "yes" (option, defaults to "no")128 129vector130	- address of the vector latch (aka "intack port") for PA0HZP131	  cards. There can be only one vector latch for all chips!132	  (option, defaults to 0)133 134special135	- address of the special function register on several cards.136	  (option, defaults to 0)137 138option  - The value you write into that register (option, default is 0)139 140You can specify up to four chips (8 channels). If this is not enough,141just change::142 143	#define MAXSCC 4144 145to a higher value.146 147Example for the BAYCOM USCC:148----------------------------149 150::151 152	chip    1153	data_a  0x300                   # data port A154	ctrl_a  0x304                   # control port A155	data_b  0x301                   # data port B156	ctrl_b  0x305                   # control port B157	irq     5                       # IRQ No. 5 (#)158	board   BAYCOM                  # hardware type (*)159	#160	# SCC chip 2161	#162	chip    2163	data_a  0x302164	ctrl_a  0x306165	data_b  0x303166	ctrl_b  0x307167	board   BAYCOM168 169An example for a PA0HZP card:170-----------------------------171 172::173 174	chip 1175	data_a 0x153176	data_b 0x151177	ctrl_a 0x152178	ctrl_b 0x150179	irq 9180	pclock 4915200181	board PA0HZP182	vector 0x168183	escc no184	#185	#186	#187	chip 2188	data_a 0x157189	data_b 0x155190	ctrl_a 0x156191	ctrl_b 0x154192	irq 9193	pclock 4915200194	board PA0HZP195	vector 0x168196	escc no197 198A DRSI would should probably work with this:199--------------------------------------------200(actually: two DRSI cards...)201 202::203 204	chip 1205	data_a 0x303206	data_b 0x301207	ctrl_a 0x302208	ctrl_b 0x300209	irq 7210	pclock 4915200211	board DRSI212	escc no213	#214	#215	#216	chip 2217	data_a 0x313218	data_b 0x311219	ctrl_a 0x312220	ctrl_b 0x310221	irq 7222	pclock 4915200223	board DRSI224	escc no225 226Note that you cannot use the on-board baudrate generator off DRSI227cards. Use "mode dpll" for clock source (see below).228 229This is based on information provided by Mike Bilow (and verified230by Paul Helay)231 232The utility "gencfg"233--------------------234 235If you only know the parameters for the PE1CHL driver for DOS,236run gencfg. It will generate the correct port addresses (I hope).237Its parameters are exactly the same as the ones you use with238the "attach scc" command in net, except that the string "init" must239not appear. Example::240 241	gencfg 2 0x150 4 2 0 1 0x168 9 4915200242 243will print a skeleton z8530drv.conf for the OptoSCC to stdout.244 245::246 247	gencfg 2 0x300 2 4 5 -4 0 7 4915200 0x10248 249does the same for the BAYCOM USCC card. In my opinion it is much easier250to edit scc_config.h...251 252 2531.2.2 channel configuration254===========================255 256The channel definition is divided into three sub sections for each257channel:258 259An example for scc0::260 261	# DEVICE262 263	device scc0	# the device for the following params264 265	# MODEM / BUFFERS266 267	speed 1200		# the default baudrate268	clock dpll		# clock source:269				# 	dpll     = normal half duplex operation270				# 	external = MODEM provides own Rx/Tx clock271				#	divider  = use full duplex divider if272				#		   installed (1)273	mode nrzi		# HDLC encoding mode274				#	nrzi = 1k2 MODEM, G3RUH 9k6 MODEM275				#	nrz  = DF9IC 9k6 MODEM276				#277	bufsize	384		# size of buffers. Note that this must include278				# the AX.25 header, not only the data field!279				# (optional, defaults to 384)280 281	# KISS (Layer 1)282 283	txdelay 36              # (see chapter 1.4)284	persist 64285	slot    8286	tail    8287	fulldup 0288	wait    12289	min     3290	maxkey  7291	idle    3292	maxdef  120293	group   0294	txoff   off295	softdcd on296	slip    off297 298The order WITHIN these sections is unimportant. The order OF these299sections IS important. The MODEM parameters are set with the first300recognized KISS parameter...301 302Please note that you can initialize the board only once after boot303(or insmod). You can change all parameters but "mode" and "clock"304later with the Sccparam program or through KISS. Just to avoid305security holes...306 307(1) this divider is usually mounted on the SCC-PBC (PA0HZP) or not308    present at all (BayCom). It feeds back the output of the DPLL309    (digital pll) as transmit clock. Using this mode without a divider310    installed will normally result in keying the transceiver until311    maxkey expires --- of course without sending anything (useful).312 3132. Attachment of a channel by your AX.25 software314=================================================315 3162.1 Kernel AX.25317================318 319To set up an AX.25 device you can simply type::320 321	ifconfig scc0 44.128.1.1 hw ax25 dl0tha-7322 323This will create a network interface with the IP number 44.128.20.107324and the callsign "dl0tha". If you do not have any IP number (yet) you325can use any of the 44.128.0.0 network. Note that you do not need326axattach. The purpose of axattach (like slattach) is to create a KISS327network device linked to a TTY. Please read the documentation of the328ax25-utils and the AX.25-HOWTO to learn how to set the parameters of329the kernel AX.25.330 3312.2 NOS, NET and TFKISS332=======================333 334Since the TTY driver (aka KISS TNC emulation) is gone you need335to emulate the old behaviour. The cost of using these programs is336that you probably need to compile the kernel AX.25, regardless of whether337you actually use it or not. First setup your /etc/ax25/axports,338for example::339 340	9k6	dl0tha-9  9600  255 4 9600 baud port (scc3)341	axlink	dl0tha-15 38400 255 4 Link to NOS342 343Now "ifconfig" the scc device::344 345	ifconfig scc3 44.128.1.1 hw ax25 dl0tha-9346 347You can now axattach a pseudo-TTY::348 349	axattach /dev/ptys0 axlink350 351and start your NOS and attach /dev/ptys0 there. The problem is that352NOS is reachable only via digipeating through the kernel AX.25353(disastrous on a DAMA controlled channel). To solve this problem,354configure "rxecho" to echo the incoming frames from "9k6" to "axlink"355and outgoing frames from "axlink" to "9k6" and start::356 357	rxecho358 359Or simply use "kissbridge" coming with z8530drv-utils::360 361	ifconfig scc3 hw ax25 dl0tha-9362	kissbridge scc3 /dev/ptys0363 364 3653. Adjustment and Display of parameters366=======================================367 3683.1 Displaying SCC Parameters:369==============================370 371Once a SCC channel has been attached, the parameter settings and372some statistic information can be shown using the param program::373 374	dl1bke-u:~$ sccstat scc0375 376	Parameters:377 378	speed       : 1200 baud379	txdelay     : 36380	persist     : 255381	slottime    : 0382	txtail      : 8383	fulldup     : 1384	waittime    : 12385	mintime     : 3 sec386	maxkeyup    : 7 sec387	idletime    : 3 sec388	maxdefer    : 120 sec389	group       : 0x00390	txoff       : off391	softdcd     : on392	SLIP        : off393 394	Status:395 396	HDLC                  Z8530           Interrupts         Buffers397	-----------------------------------------------------------------------398	Sent       :     273  RxOver :     0  RxInts :   125074  Size    :  384399	Received   :    1095  TxUnder:     0  TxInts :     4684  NoSpace :    0400	RxErrors   :    1591                  ExInts :    11776401	TxErrors   :       0                  SpInts :     1503402	Tx State   :    idle403 404 405The status info shown is:406 407==============	==============================================================408Sent		number of frames transmitted409Received	number of frames received410RxErrors	number of receive errors (CRC, ABORT)411TxErrors	number of discarded Tx frames (due to various reasons)412Tx State	status of the Tx interrupt handler: idle/busy/active/tail (2)413RxOver		number of receiver overruns414TxUnder		number of transmitter underruns415RxInts		number of receiver interrupts416TxInts		number of transmitter interrupts417EpInts		number of receiver special condition interrupts418SpInts		number of external/status interrupts419Size		maximum size of an AX.25 frame (*with* AX.25 headers!)420NoSpace		number of times a buffer could not get allocated421==============	==============================================================422 423An overrun is abnormal. If lots of these occur, the product of424baudrate and number of interfaces is too high for the processing425power of your computer. NoSpace errors are unlikely to be caused by the426driver or the kernel AX.25.427 428 4293.2 Setting Parameters430======================431 432 433The setting of parameters of the emulated KISS TNC is done in the434same way in the SCC driver. You can change parameters by using435the kissparms program from the ax25-utils package or use the program436"sccparam"::437 438     sccparam <device> <paramname> <decimal-|hexadecimal value>439 440You can change the following parameters:441 442===========   =====443param	      value444===========   =====445speed         1200446txdelay       36447persist       255448slottime      0449txtail        8450fulldup       1451waittime      12452mintime       3453maxkeyup      7454idletime      3455maxdefer      120456group         0x00457txoff         off458softdcd       on459SLIP          off460===========   =====461 462 463The parameters have the following meaning:464 465speed:466     The baudrate on this channel in bits/sec467 468     Example: sccparam /dev/scc3 speed 9600469 470txdelay:471     The delay (in units of 10 ms) after keying of the472     transmitter, until the first byte is sent. This is usually473     called "TXDELAY" in a TNC.  When 0 is specified, the driver474     will just wait until the CTS signal is asserted. This475     assumes the presence of a timer or other circuitry in the476     MODEM and/or transmitter, that asserts CTS when the477     transmitter is ready for data.478     A normal value of this parameter is 30-36.479 480     Example: sccparam /dev/scc0 txd 20481 482persist:483     This is the probability that the transmitter will be keyed484     when the channel is found to be free.  It is a value from 0485     to 255, and the probability is (value+1)/256.  The value486     should be somewhere near 50-60, and should be lowered when487     the channel is used more heavily.488 489     Example: sccparam /dev/scc2 persist 20490 491slottime:492     This is the time between samples of the channel. It is493     expressed in units of 10 ms.  About 200-300 ms (value 20-30)494     seems to be a good value.495 496     Example: sccparam /dev/scc0 slot 20497 498tail:499     The time the transmitter will remain keyed after the last500     byte of a packet has been transferred to the SCC. This is501     necessary because the CRC and a flag still have to leave the502     SCC before the transmitter is keyed down. The value depends503     on the baudrate selected.  A few character times should be504     sufficient, e.g. 40ms at 1200 baud. (value 4)505     The value of this parameter is in 10 ms units.506 507     Example: sccparam /dev/scc2 4508 509full:510     The full-duplex mode switch. This can be one of the following511     values:512 513     0:   The interface will operate in CSMA mode (the normal514	  half-duplex packet radio operation)515     1:   Fullduplex mode, i.e. the transmitter will be keyed at516	  any time, without checking the received carrier.  It517	  will be unkeyed when there are no packets to be sent.518     2:   Like 1, but the transmitter will remain keyed, also519	  when there are no packets to be sent.  Flags will be520	  sent in that case, until a timeout (parameter 10)521	  occurs.522 523     Example: sccparam /dev/scc0 fulldup off524 525wait:526     The initial waittime before any transmit attempt, after the527     frame has been queue for transmit.  This is the length of528     the first slot in CSMA mode.  In full duplex modes it is529     set to 0 for maximum performance.530     The value of this parameter is in 10 ms units.531 532     Example: sccparam /dev/scc1 wait 4533 534maxkey:535     The maximal time the transmitter will be keyed to send536     packets, in seconds.  This can be useful on busy CSMA537     channels, to avoid "getting a bad reputation" when you are538     generating a lot of traffic.  After the specified time has539     elapsed, no new frame will be started. Instead, the trans-540     mitter will be switched off for a specified time (parameter541     min), and then the selected algorithm for keyup will be542     started again.543     The value 0 as well as "off" will disable this feature,544     and allow infinite transmission time.545 546     Example: sccparam /dev/scc0 maxk 20547 548min:549     This is the time the transmitter will be switched off when550     the maximum transmission time is exceeded.551 552     Example: sccparam /dev/scc3 min 10553 554idle:555     This parameter specifies the maximum idle time in full duplex556     2 mode, in seconds.  When no frames have been sent for this557     time, the transmitter will be keyed down.  A value of 0 is558     has same result as the fullduplex mode 1. This parameter559     can be disabled.560 561     Example: sccparam /dev/scc2 idle off	# transmit forever562 563maxdefer564     This is the maximum time (in seconds) to wait for a free channel565     to send. When this timer expires the transmitter will be keyed566     IMMEDIATELY. If you love to get trouble with other users you567     should set this to a very low value ;-)568 569     Example: sccparam /dev/scc0 maxdefer 240	# 2 minutes570 571 572txoff:573     When this parameter has the value 0, the transmission of packets574     is enable. Otherwise it is disabled.575 576     Example: sccparam /dev/scc2 txoff on577 578group:579     It is possible to build special radio equipment to use more than580     one frequency on the same band, e.g. using several receivers and581     only one transmitter that can be switched between frequencies.582     Also, you can connect several radios that are active on the same583     band.  In these cases, it is not possible, or not a good idea, to584     transmit on more than one frequency.  The SCC driver provides a585     method to lock transmitters on different interfaces, using the586     "param <interface> group <x>" command.  This will only work when587     you are using CSMA mode (parameter full = 0).588 589     The number <x> must be 0 if you want no group restrictions, and590     can be computed as follows to create restricted groups:591     <x> is the sum of some OCTAL numbers:592 593 594     ===  =======================================================595     200  This transmitter will only be keyed when all other596	  transmitters in the group are off.597     100  This transmitter will only be keyed when the carrier598	  detect of all other interfaces in the group is off.599     0xx  A byte that can be used to define different groups.600	  Interfaces are in the same group, when the logical AND601	  between their xx values is nonzero.602     ===  =======================================================603 604     Examples:605 606     When 2 interfaces use group 201, their transmitters will never be607     keyed at the same time.608 609     When 2 interfaces use group 101, the transmitters will only key610     when both channels are clear at the same time.  When group 301,611     the transmitters will not be keyed at the same time.612 613     Don't forget to convert the octal numbers into decimal before614     you set the parameter.615 616     Example: (to be written)617 618softdcd:619     use a software dcd instead of the real one... Useful for a very620     slow squelch.621 622     Example: sccparam /dev/scc0 soft on623 624 6254. Problems626===========627 628If you have tx-problems with your BayCom USCC card please check629the manufacturer of the 8530. SGS chips have a slightly630different timing. Try Zilog...  A solution is to write to register 8631instead to the data port, but this won't work with the ESCC chips.632*SIGH!*633 634A very common problem is that the PTT locks until the maxkeyup timer635expires, although interrupts and clock source are correct. In most636cases compiling the driver with CONFIG_SCC_DELAY (set with637make config) solves the problems. For more hints read the (pseudo) FAQ638and the documentation coming with z8530drv-utils.639 640I got reports that the driver has problems on some 386-based systems.641(i.e. Amstrad) Those systems have a bogus AT bus timing which will642lead to delayed answers on interrupts. You can recognize these643problems by looking at the output of Sccstat for the suspected644port. If it shows under- and overruns you own such a system.645 646Delayed processing of received data: This depends on647 648- the kernel version649 650- kernel profiling compiled or not651 652- a high interrupt load653 654- a high load of the machine --- running X, Xmorph, XV and Povray,655  while compiling the kernel... hmm ... even with 32 MB RAM ...  ;-)656  Or running a named for the whole .ampr.org domain on an 8 MB657  box...658 659- using information from rxecho or kissbridge.660 661Kernel panics: please read /linux/README and find out if it662really occurred within the scc driver.663 664If you cannot solve a problem, send me665 666- a description of the problem,667- information on your hardware (computer system, scc board, modem)668- your kernel version669- the output of cat /proc/net/z8530670 6714. Thor RLC100672==============673 674Mysteriously this board seems not to work with the driver. Anyone675got it up-and-running?676 677 678Many thanks to Linus Torvalds and Alan Cox for including the driver679in the Linux standard distribution and their support.680 681::682 683	Joerg Reuter	ampr-net: dl1bke@db0pra.ampr.org684			AX-25   : DL1BKE @ DB0ABH.#BAY.DEU.EU685			Internet: jreuter@yaina.de686			WWW     : http://yaina.de/jreuter687