File: scc_eng.doc

package info (click to toggle)
z8530-utils2 3.0-1-8
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 252 kB
  • ctags: 113
  • sloc: ansic: 1,217; makefile: 94; sh: 6
file content (733 lines) | stat: -rw-r--r-- 22,531 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
!! Version 3.0
!!
!! Deutscher Text siehe scc_ger.doc (Vorsicht: veraltet!)
!!
!! Please note that the information in this document may be hopelessly 
!! outdated.
!!
!! BTW: REAL programmers don't document...
!!


	 SCC.C - Linux driver for Z8530 based HDLC cards for AX.25      

   ********************************************************************

        Copyright 1993-1997 by Joerg Reuter DL1BKE

        portions (c) 1993 Guido ten Dolle PE1NNZ

        for the complete copyright notice see >> Copying.Z8530DRV <<

   ******************************************************************** 


0. Quickstart
=============

To compile the utilities, type

	make dep ; make

sccinit  - reads /etc/z8530drv.conf and initializes the driver
sccstat  - shows the status of a channel
sccparam - sets KISS parameters for a channel

It will install these utilities in /sbin/ and an example
configuration file as /etc/z8530drv.conf.ex. Rename this
file to /etc/z8530drv.conf and edit it according to chapter
1.2.

Please note that since version 3.0 of this driver the driver 
itself does not come with this package (hence the package name
"z8530drv-*.*-utils.tar.gz"). 
              =====

Now configure the Linux kernel to prepare the compilation of 
the driver. If you are using menuconfig or xconfig select:

Network device support
	Radio network interfaces (CONFIG_NET_RADIO): "Y"
	Z8530 SCC driver for AX.25 (CONFIG_SCC): "Y" or "M"

Do not forget to select other AX.25 devices you probably need,
and do not forget to include the kernel AX.25 / NET/ROM / Rose
stuff as well. Please read the AX.25-HOWTO for details.

Save your new kernel configuration and either rebuild your kernel
now (if you selected "Y" for CONFIG_SCC), or rebuild your modules
(if you selected "M").

1. Initialization of the driver
===============================

To use the driver, 3 steps must be performed:

     1. if compiled as module: loading the module
     2. Setup of hardware, MODEM and KISS parameters with sccinit
     3. Attach each channel to the Linux kernel AX.25 with "ifconfig"

Unlike the versions below 2.4 this driver is a real network device
driver. If you want to run xNOS instead of our fine kernel AX.25
use a 2.x version (available from above sites) or read the
AX.25-HOWTO on how to emulate a KISS TNC on network device drivers.


1.1 Loading the module
======================

(If you're going to compile the driver as a part of the kernel image,
 skip this chapter and continue with 1.2)

Before you can use a module, you'll have to load it with

	insmod scc

please read 'man insmod' that comes with modutils.

You should include the insmod in one of the /etc/rc.d/rc.* files,
and don't forget to insert a call of sccinit after that. It
will read your /etc/z8530drv.conf.

1.2. /etc/z8530drv.conf
=======================

To setup all parameters you must run /sbin/sccinit from one
of your rc.*-files. This has to be done BEFORE you can
"ifconfig" an interface. Sccinit reads the file /etc/z8530drv.conf
and sets the hardware, MODEM and KISS parameters. A sample file is
delivered with this package. Change it to your needs.

The file itself consists of two main sections.

1.2.1 configuration of hardware parameters
==========================================

The hardware setup section defines the following parameters for each
Z8530:

chip    1
data_a  0x300                   # data port A
ctrl_a  0x304                   # control port A
data_b  0x301                   # data port B
ctrl_b  0x305                   # control port B
irq     5                       # IRQ No. 5
pclock  4915200                 # clock
board   BAYCOM                  # hardware type
escc    no                      # enhanced SCC chip? (8580/85180/85280)
vector  0                       # latch for interrupt vector
special no                      # address of special function register
option  0                       # option to set via sfr


chip	- this is just a delimiter to make sccinit a bit simpler to
	  program. A parameter has no effect.

data_a  - the address of the data port A of this Z8530 (needed)
ctrl_a  - the address of the control port A (needed)
data_b  - the address of the data port B (needed)
ctrl_b  - the address of the control port B (needed)

irq     - the used IRQ for this chip. Different chips can use different
          IRQs or the same. If they share an interrupt, it needs to be
	  specified within one chip-definition only.

pclock  - the clock at the PCLK pin of the Z8530 (option, 4915200 is
          default), measured in Hertz

board   - the "type" of the board:

	   SCC type                 value
	   ---------------------------------
	   PA0HZP SCC card          PA0HZP
	   EAGLE card               EAGLE
	   PC100 card               PC100
	   PRIMUS-PC (DG9BL) card   PRIMUS
	   BayCom (U)SCC card       BAYCOM

escc    - if you want support for ESCC chips (8580, 85180, 85280), set
          this to "yes" (option, defaults to "no")

vector  - address of the vector latch (aka "intack port") for PA0HZP
          cards. There can be only one vector latch for all chips!
	  (option, defaults to 0)

special - address of the special function register on several cards.
          (option, defaults to 0)

option  - The value you write into that register (option, default is 0)

You can specify up to four chips (8 channels). If this is not enough,
just change

	#define MAXSCC 4

to a higher value.

Example for the BayCom USCC:
----------------------------

chip    1
data_a  0x300                   # data port A
ctrl_a  0x304                   # control port A
data_b  0x301                   # data port B
ctrl_b  0x305                   # control port B
irq     5                       # IRQ No. 5 (#)
board   BAYCOM                  # hardware type (*)
#
# SCC chip 2
#
chip    2
data_a  0x302
ctrl_a  0x306
data_b  0x303
ctrl_b  0x307
board   BAYCOM

An example for a PA0HZP card:
-----------------------------

chip 1
data_a 0x153
data_b 0x151
ctrl_a 0x152
ctrl_b 0x150
irq 9
pclock 4915200
board PA0HZP
vector 0x168
escc no
#
#
#
chip 2
data_a 0x157
data_b 0x155
ctrl_a 0x156
ctrl_b 0x154
irq 9
pclock 4915200
board PA0HZP
vector 0x168
escc no

A DRSI would should probably work with this:
--------------------------------------------
(actually: two DRSI cards...)

chip 1
data_a 0x303
data_b 0x301
ctrl_a 0x302
ctrl_b 0x300
irq 7
pclock 4915200
board DRSI
escc no
#
#
#
chip 2
data_a 0x313
data_b 0x311
ctrl_a 0x312
ctrl_b 0x310
irq 7
pclock 4915200
board DRSI
escc no

Note that you cannot use the on-board baudrate generator off DRSI
cards. Use "mode dpll" for clock source (see below).

This is based on information provided by Mike Bilow (and verified
by Paul Helay)

The utility "gencfg"
--------------------

If you only know the parameters for the PE1CHL driver for DOS,
run gencfg. It will generate the correct port addresses (I hope).
Its parameters are exactly the same as the ones you use with
the "attach scc" command in net, except that the string "init" must 
not appear. Example:

gencfg 2 0x150 4 2 0 1 0x168 9 4915200 

will print a skeleton z8530drv.conf for the OptoSCC to stdout.

gencfg 2 0x300 2 4 5 -4 0 7 4915200 0x10

does the same for the BayCom USCC card. I my opinion it is much easier
to edit scc_config.h... 


1.2.2 channel configuration
===========================

The channel definition is divided into three sub sections for each
channel:

An example for scc0:

# DEVICE

device scc0	# the device for the following params

# MODEM / BUFFERS

speed 1200		# the default baudrate
clock dpll		# clock source: 
			# 	dpll     = normal halfduplex operation
			# 	external = MODEM provides own Rx/Tx clock
			#	divider  = use fullduplex divider if
			#		   installed (1)
mode nrzi		# HDLC encoding mode
			#	nrzi = 1k2 MODEM, G3RUH 9k6 MODEM
			#	nrz  = DF9IC 9k6 MODEM
			#
bufsize	384		# size of buffers. Note that this must include
			# the AX.25 header, not only the data field!
			# (optional, defaults to 384)

# KISS (Layer 1)

txdelay 36              # (see chapter 1.4)
persist 64
slot    8
tail    8
fulldup 0
wait    12
min     3
maxkey  7
idle    3
maxdef  120
group   0
txoff   off
softdcd on                   
slip    off

The order WITHIN these sections is unimportant. The order OF these
sections IS important. The MODEM parameters are set with the first
recognized KISS parameter...

Please note that you can initialize the board only once after boot
(or insmod). You can change all parameters but "mode" and "clock" 
later with the Sccparam program or through KISS. Just to avoid 
security holes... 

(1) this divider is usually mounted on the SCC-PBC (PA0HZP) or not
    present at all (BayCom). It feeds back the output of the DPLL 
    (digital pll) as transmit clock. Using this mode without a divider 
    installed will normally result in keying the transceiver until 
    maxkey expires --- of course without sending anything (useful).

2. Attachment of a channel by your AX.25 software
=================================================

2.1 Kernel AX.25
================

To set up an AX.25 device you can simply type:

	ifconfig scc0 44.128.1.1 hw ax25 dl0tha-7

This will create a network interface with the IP number 44.128.20.107 
and the callsign "dl0tha". If you do not have any IP number (yet) you 
can use any of the 44.128.0.0 network. Note that you do not need 
axattach. The purpose of axattach (like slattach) is to create a KISS 
network device linked to a TTY. Please read the documentation of the 
ax25-utils and the AX.25-HOWTO to learn how to set the parameters of
the kernel AX.25.

2.2 NOS, NET and TFKISS
=======================

Since the TTY driver (aka KISS TNC emulation) is gone you need
to emulate the old behaviour. The cost using these programs is
that you probably need to compile the kernel AX.25, regardless 
if you actually use it or not. First setup your /etc/ax25/axports,
for example:

	9k6	dl0tha-9  9600  255 4 9600 baud port (scc3)
	axlink	dl0tha-15 38400 255 4 Link to NOS

Now "ifconfig" the scc device:

	ifconfig scc3 44.128.1.1 hw ax25 dl0tha-9

You can now axattach a pseudo-TTY:

	axattach /dev/ptys0 axlink

and start your NOS and attach /dev/ptys0 there. The problem is that
NOS is reachable only via digipeating through the kernel AX.25
(disasterous on a DAMA controlled channel). To solve this problem,
configure "rxecho" to echo the incoming frames from "9k6" to "axlink"
and outgoing frames from "axlink" to "9k6" and start:

	rxecho

Or simply use "kissbridge" coming with this package:

	ifconfig scc3 hw ax25 dl0tha-9
	kissbridge scc3 /dev/ptys0

There's a similar program called net2kiss coming with the
AX.25 utilities which does basicly the same (but the
source looks better than mine...) and is better documented.

3. Adjustment and Display of parameters
=======================================

3.1 Displaying SCC Parameters:
==============================

Once a SCC channel has been attached, the parameter settings and 
some statistic information can be shown using the param program:

dl1bke-u:~$ sccstat scc0

Parameters:

speed       : 1200 baud
txdelay     : 36
persist     : 255
slottime    : 0
txtail      : 8
fulldup     : 1
waittime    : 12
mintime     : 3 sec
maxkeyup    : 7 sec
idletime    : 3 sec
maxdefer    : 120 sec
group       : 0x00
txoff       : off
softdcd     : on
SLIP        : off

Status:

HDLC                  Z8530           Interrupts         Buffers
-----------------------------------------------------------------------
Sent       :     273  RxOver :     0  RxInts :   125074  Size    :  384
Received   :    1095  TxUnder:     0  TxInts :     4684  NoSpace :    0
RxErrors   :    1591                  ExInts :    11776
TxErrors   :       0                  SpInts :     1503
Tx State   :    idle


The status info shown is:

Sent		- number of frames transmitted
Received	- number of frames received
RxErrors	- number of receive errors (CRC, ABORT)
TxErrors	- number of discarded Tx frames (due to various reasons) 
Tx State	- status of the Tx interrupt handler: idle/busy/active/tail (2)
RxOver		- number of receiver overruns
TxUnder		- number of transmitter underruns
RxInts		- number of receiver interrupts
TxInts		- number of transmitter interrupts
EpInts		- number of receiver special condition interrupts
SpInts		- number of external/status interrupts
Size		- maximum size of an AX.25 frame (*with* AX.25 headers!)
NoSpace		- number of times a buffer could not get allocated

An overrun is abnormal. If lots of these occur, the product of
baudrate and number of interfaces is too high for the processing
power of you computer. NoSpace errors are not likely caused by the
driver or the kernel AX.25.


3.2 Setting Parameters
======================


The setting of the channel access parameters is done in the  same way 
as a KISS TNC. You can change parameters by using the kissparms program 
from the ax25-utils package or use the program "sccparam":

     sccparam <device> <paramname> <decimal-|hexadecimal value>

You can change the following parameters:

param	    : value
------------------------
speed       : 1200
txdelay     : 36
persist     : 255
slottime    : 0
txtail      : 8
fulldup     : 1
waittime    : 12
mintime     : 3
maxkeyup    : 7
idletime    : 3
maxdefer    : 120
group       : 0x00
txoff       : off
softdcd     : on
SLIP        : off


The parameters have the following meaning:

speed:
     The baudrate on this channel in bits/sec

     Example: sccparam scc3 speed 9600

txdelay:
     The delay (in units of 10ms) after keying of the 
     transmitter, until the first byte is sent. This is usually 
     called "TXDELAY" in a TNC.  When 0 is specified, the driver 
     will just wait until the CTS signal is asserted. This 
     assumes the presence of a timer or other circuitry in the 
     MODEM and/or transmitter, that asserts CTS when the 
     transmitter is ready for data.
     A normal value of this parameter is 30-36.

     Example: sccparam scc0 txd 20

persist:
     This is the probability that the transmitter will be keyed 
     when the channel is found to be free.  It is a value from 0 
     to 255, and the probability is (value+1)/256.  The value 
     should be somewhere near 50-60, and should be lowered when 
     the channel is used more heavily.

     Example: sccparam scc2 persist 20

slottime:
     This is the time between samples of the channel. It is 
     expressed in units of 10ms.  About 200-300 ms (value 20-30) 
     seems to be a good value.

     Example: sccparam scc0 slot 20

tail:
     The time the transmitter will remain keyed after the last 
     byte of a packet has been transferred to the SCC. This is 
     necessary because the CRC and a flag still have to leave the 
     SCC before the transmitter is keyed down. The value depends 
     on the baudrate selected.  A few character times should be 
     sufficient, e.g. 40ms at 1200 baud. (value 4)
     The value of this parameter is in 10ms units.

     Example: sccparam scc2 4

full:
     The full-duplex mode switch. This can be one of the following 
     values:

     0:   The interface will operate in CSMA mode (the normal 
          half-duplex packet radio operation)
     1:   Fullduplex mode, i.e. the transmitter will be keyed at 
          any time, without checking the received carrier.  It 
          will be unkeyed when there are no packets to be sent.
     2:   Like 1, but the transmitter will remain keyed, also 
          when there are no packets to be sent.  Flags will be 
          sent in that case, until a timeout (parameter 10) 
          occurs.

     Example: sccparam scc0 fulldup off

wait:
     The initial waittime before any transmit attempt, after the 
     frame has been queue for transmit.  This is the length of 
     the first slot in CSMA mode.  In fullduplex modes it is
     set to 0 for maximum performance.
     The value of this parameter is in 10ms units. 

     Example: sccparam scc1 wait 4

maxkey:
     The maximal time the transmitter will be keyed to send 
     packets, in seconds.  This can be useful on busy CSMA 
     channels, to avoid "getting a bad reputation" when you are 
     generating a lot of traffic.  After the specified time has 
     elapsed, no new frame will be started. Instead, the trans-
     mitter will be switched off for a specified time (parameter 
     min), and then the selected algorithm for keyup will be 
     started again.
     The value 0 as well as "off" will disable this feature, 
     and allow infinite transmission time. 

     Example: sccparam scc0 maxk 20

min:
     This is the time the transmitter will be switched off when 
     the maximum transmission time is exceeded.

     Example: sccparam scc3 min 10

idle
     This parameter specifies the maximum idle time in fullduplex 
     2 mode, in seconds.  When no frames have been sent for this 
     time, the transmitter will be keyed down.  A value of 0 is
     has same result as the fullduplex mode 1. This parameter
     can be disabled.

     Example: sccparam scc2 idle off	# transmit forever

maxdefer
     This is the maximum time (in seconds) to wait for a free channel
     to send. When this timer expires the transmitter will be keyed 
     IMMEDIATELY. If you love to get trouble with other users you
     should set this to a very low value ;-)

     Example: sccparam scc0 maxdefer 240	# 2 minutes


txoff:
     When this parameter has the value 0, the transmission of packets
     is enable. Otherwise it is disabled.

     Example: sccparam scc2 txoff on

group:
     It is possible to build special radio equipment to use more than 
     one frequency on the same bad, e.g. using several receivers and 
     only one transmitter that can be switched between frequencies.
     Also, you can connect several radios that are active on the same 
     band.  In these cases, it is not possible, or not a good idea, to 
     transmit on more than one frequency.  The SCC driver provides a 
     method to lock transmitters on different interfaces, using the 
     "param <interface> group <x>" command.  This will only work when 
     you are using CSMA mode (parameter full = 0).
     The number <x> must be 0 if you want no group restrictions, and 
     can be computed as follows to create restricted groups:
     <x> is the sum of some OCTAL numbers:

     200  This transmitter will only be keyed when all other 
          transmitters in the group are off.
     100  This transmitter will only be keyed when the carrier 
          detect of all other interfaces in the group is off.
     0xx  A byte that can be used to define different groups.  
          Interfaces are in the same group, when the logical AND 
          between their xx values is nonzero.

     Examples:
     When 2 interfaces use group 201, their transmitters will never be 
     keyed at the same time.
     When 2 interfaces use group 101, the transmitters will only key 
     when both channels are clear at the same time.  When group 301, 
     the transmitters will not be keyed at the same time.

     Don't forget to convert the octal numbers into decimal before
     you set the parameter.

     Example: (to be written)

softdcd:
     use a software dcd instead of the real one... Useful for a very
     slow squelch.

     Example: sccparam scc0 soft on


4. Problems 
===========

If you have tx-problems with your BayCom USCC card please check
the manufacturer of the 8530. SGS chips have a slightly
different timing. Try Zilog...  A solution is to write to register 8 
instead to the data port, but this won't work with the ESCC chips. 
*SIGH!*

A very common problem is that the PTT locks until the maxkeyup timer
expires, although interrupts and clock source are correct. In most
cases #define SCC_DELAY solves the problems. For more hints read
the (pseudo) FAQ and the documentation coming with z8530drv-utils.

I got reports that the driver has problems on some 386-based systems.
(i.e. Amstrad) Those systems have a bogus AT bus timing which will
lead to delayed answers on interrupts. You can recognize these
problems by looking at the output of Sccstat for the suspected
port. See if it shows under- and overruns you own such a system.

Delayed processing of received data: This depends on

- the kernel version

- kernel profiling compiled or not

- a high interrupt load

- a high load of the machine --- running X, Xmorph, XV and Povray,
  while compiling the kernel... hmm ... even with 32 MB RAM ...  ;-)
  Or running a named for the whole .ampr.org. domain on an 8 MB
  box...

- using information from rxecho or kissbridge.

Kernel panics: please read to /linux/README and find out if it
really occurred within the scc driver.

If you cannot solve a problem, send me

- a description of the problem,
- information on your hardware (computer system, scc board, modem)
- your kernel version
- the output of cat /proc/net/z8530

4. Thor RLC100
==============

Mysteriously this board seems not to work with the driver. Anyone
got it up-and-running?

5. Appendix
===========

The fullduplex mode 3 works as follows: 

1. The protocol layer sends a KISS command 

	[PARAM_RTS] [TX_ON] 

   to key up the transmitter. Then it sends the data frame(s) to
   the driver. When all frames are sent, the driver will send the 
   KISS command 

   	[PARAM_HWEVENT] [HWEV_ALL_SENT]. 

   The protocol layer may now key down the transmitter with 

	[PARAM_RTS] [TX_OFF]

   or send more frames. Note that the maxkeyup timer may expire and
   key down the transceiver before everything is sent.

2. The driver sends

	[PARAM_HWEVENT] [HWEV_DCD_ON]
   or
	[PARAM_HWEVENT] [HWEV_DCD_OFF]

   if the status of the DCD changes.

3. The protocol layer can send

	[PARAM_HWEVENT] 0

   the driver will reply with one of the DCD status messages.

Note that KISS command doesn't necessarily mean that the enclosed data
is SLIP encoded. In network driver mode the driver does not encode/decode 
SLIP, but it will still distinguish between a data and a command packet 
by the leading byte, just like in 'real' KISS mode.

Note that this feature may vanish without a notice.

6. Thanks
=========

Many thanks to everyone who contributed to this project with ideas,
error reports and bug fixes. Special thanks to Linus Torvalds and Alan 
Cox for including the driver in the Linux standard distribution and 
their support.

Joerg Reuter	ampr-net: dl1bke@db0pra.ampr.org
		AX-25   : DL1BKE @ DB0ACH.#NRW.DEU.EU
		Internet: jreuter@lykos.oche.de