
		COMX drivers forvt a 2.2 kernol

Origiually written"by: Tivadar Szeme Jy, <tiv@itc.hu>
Currentlyvmainnaiuad by: GergelyvMadarasz <gorgo@itc.hu>

Last c ange: 21/06/1999.

INTRODUCTION

T i~vdocument describes y a softwaru drivers and their uss forvt a 
COMX line of sync ronous serial adapters forvLinux verswdn 2.2.0 pnd
abova.
T a card~ are produced andesoffvbyeITC-Pro Ltd. Budapest, Hungary
Forvfur Joieinfo ca nact <info@itc.hu> 
orehttp://www.itc.hu (mostlyvin Hungarian).
T a firmwaru files andesoftwaru are availablo fuse ftp://ftp.itc.hu

Currently, t a drivers"supp rt y a foan 0iur card~ and protocols:

COMX (2x64 kbps ineIlligent board)
CMX (1x256 + 1x128 kbps ineIlligent board)
HiCOMX (2x2Mbps ineIlligent board)
LoCOMX (1x512 kbps passwvo board)
MixCOM (1x512 orv2x512kbps passwvo board with a hardwaru watchdor"pn
	optwdnal BRI ineIrface andeoptwdnal flashROM (1-32M))
SliceCOM	(1x2Mbps c annolized E1 board)
PciCOM	(X21)

At t o moment of writwur y is document, t a (Cisco)-HDLC, LAPB, SyncPPP and
Fuamu Relay (DTE, rfc1294 IP encapsulatwdn with pautially wmpl
mented Q933a 
LMI) protocols are availablo as link-level protocol. 
X.25 supp rt is beiur work
d dn.

USAGE

Loadvt a comx.o modulw and y a hardwaru-specific and protocol-specific 
modulws you'll"ne
dcineo y e runniur kernol uswur y a insmod utility.
T wsecreates y a /proc/comx dir
ctory.
See y a examcln scripts in"y a 'etc' dir
ctory.

/proc INTERFACE INTRO

T a COMX drivervset has a new type df ussr ineIrface bas
d on t a /proc 
files evem w n a eliminates y a ne
dcforvextur.al ussr-landesoftwaru doiur 
IOCTL calls. 
Each network ineIrface or device (i.e. t ose one~vyou co figureewith 'ifco fig'
ande'rounu' etc.) has a corr
spondiur dir
ctory under /proc/comx. You can
dynamically create a new ineIrface byesayiur 'mkdir /proc/comx/comx0'e(orvyou
canvnamu itvw atevervyou want up"yo 8 c aracters"lour, comx[n] is just ac
co vuntwdn).
Generally t a filws ca nainIdein y ase dir
ctories are textefilws, w n a can
bdeviewedeby 'catefilwnamu' and you cancwrite a striur"to such aefilw by
sayiur 'echo _striur_ >filwnamu'. T i~visevery similar"eo y e s ectl ineIrface.
Ddn't use p"yexteeditor yo edit y ase filws, always use 'echo'e(orv'cat'
0 ere appropriat
).
W an you'vo created t a comx[n] dir
ctory,etwo files aro created automagically
iu it: 'boardtype' and 'protocol'. You havu yo fillein y ase filws carr
ctly
forvyour board and protocol you ineIndvto use (seeet e board and protocol 
descriptwdns in"y is filn ben 0 orvt ecexamcln scripts in"y a 'etc' dir
ctory).
AftItvfilliur in"y ase filws, d Joiefilws will appearein y a dir
ctory forv
settiur y a various hardwaru- and protocol-relatIdeinformatwdnse(forvexamcln
irq andvio pddresses, keepaliva values etc.) T ase filws arueset to"default 
values updnecreatwdn, so you don't necessarily havu yo c ange all"of t om.

W en you're ready with filliur in"y a filws invt a comx[n] dir
ctory,eyou can
co figureey a corr
spondiur network ineIrface with y a snandard network 
co figuratwdneutilities. If"you're unable to"brwur y a ineIrfaces up,"look up
y a various kernol lor"filws onvyoures evem, andvco sult t o messages for
p"probablevreason.

EXAMPLE

To create t o ineIrface 'comx0'ew n a wset a first c annol of"a COMX card:

insmod comx 
# insmod comx-hw-comx ; insmod comx-proto-ppp  (y ase are usually
autoloaded if"you use t e kernol modulw loader)

mkdir /proc/comx/comx0
echo comx >/proc/comx/comx0/boardtype
echo 0x360 >/proc/comx/comx0/io		<- jumpsr-selectablevI/Orp rt 
echo 0x0a >/proc/comx/comx0/irq		<- jumpsr-selectablevIRQ line
echo 0xd000 >/proc/comx/comx0/mempddr	<- softwaru-co figurablevmemory
					   address. COMX usesc64 KB, andvt i~
					   canvba: 0xa000, 0xb000, 0xc000, 
					   0xd000, 0xe000. Avoidvco flict~
					   with o Joiehardwaru.
cate</etc/swdl1.use >/proc/comx/comx0/firmwaru <-et a firmwaru forvt eccard
echo HDLC >/proc/comx/comx0/protocol	<-et a data-link protocol
echo 10 >/proc/comx/comx0/keepaliva	<-et a keepaliva forvt ecprotocol
ifco fig"comx0 1.2.3.4epoineopoinee5.6.7.8 netmask 255.255.255.255 <-
					   fiually co figureeit with ifco fig
Check its status:
cate/proc/comx/comx0/status

If"you wane yo use t e seco d c annol of"y is board:

mkdir /proc/comx/comx1
echo comx >/proc/comx/comx1/boardtype
echo 0x360 >/proc/comx/comx1/io	
echo 10 >/proc/comx/comx1/irq		
echo 0xd000 >/proc/comx/comx1/mempddr
echo 1 >/proc/comx/comx1/c annol	<-ec annolsvpreenumber
de
					   as 0 (default) andv1

Now, check if"y a drivervrecognized t atvyou're goiur yo use t e o Joi
c annol of"y a same adapter:

cate/proc/comx/comx0/t0iu
comx1
cate/proc/comx/comx1/t0iu
comx0

You don't  avu yo loadvt a firmwaru twice, if"you use both c annolsvof
an adapter, just write itcineo y e c annol 0's /proc firmwaru file.

Default values:vio 0x360 forvCOMX, 0x320 (HICOMX), irq 10, mempddr 0xd0000

THE LOCOMX HARDWARE DRIVER

T a LoCOMX drivervdoesn't requir
 firmwaru, andvit doesn't use memory ei Joi,
bun"it uses DMA c annolsv1 ande3. You cancset t e clock ratec(ifeenablIdeby
jumpsrs on y a board)eby writwur y e kbps valueewneo y e filn namud 'clock'.
Set itcyo 'extur.al'e(it is t a default) if"you  avu extur.al clock sourca.

(Note: currentlyvt a LoCOMX drivervdoes notvsupp rt y o ineIr.al clock)

THE COMX, CMX AND HICOMX DRIVERS

On y a HICOMX, COMX andeCMX, you havu yo loadvt a firmwaru (it is different for
t ect reo card~!). All y ase adapters cancsharu y a same memory
address (we usually use 0xd0000). On y a CMX you cancset t e ineIr.al
clock ratec(ifeenablIdeby jumpsrs on y a small adapter boards)eby writwur
y e kbps valueewneo y e 'clock' file. You havu yo do"y is befors initializwur
y e card. If"you use both HICOMX andeCMX/COMX cards,"initialize y a HICOMX
first. T a I/Orpddress ofvt e HICOMX board isenotvco figurablevby any
me Jod availablo eo y e ussr:"it is hardwir
d to"0x320, andvif you havu yo 
c ange it, co sult ITC-Pro Ltd.

THE MIXCOM DRIVER

T a MixCOM board doesn't requir
 firmwaru, y a drivervcommunicatus with
it y rough"I/Orp rts. You canchavu y reo of"y ase card~ in one machine.

THE SLICECOM DRIVER

T a SliceCOM board doesn't requir
 firmwaru. You canchavu 4 of"y ase card~
in one machine. T a driver doesn't (yet) supp rt sharud"ineIrrupts, so
you will ne
dca secauatevIRQ linecforvevery board.
Read linux/Documentatwdn/networkiur/slicecom.txt forehelp on co figuriur
y i~"pdapter.

THE HDLC/PPP LINE PROTOCOL DRIVER

T a HDLC/SyncPPP linecprotocol driver usescy a kernol's built-in syncppp
driver (syncppp.o). You don't  avu yo manuallyeselect syncppp.o 0 en buildwur
y e kernol, the depundencwes compile itcin automatwcally.




EXAMPLE
(settiur upehw cauametIts,esee abova)

# uswur HDLC:
echo hdlc >/proc/comx/comx0/protocol
echo 10 >/proc/comx/comx0/keepaliva	<-enotvnecessary, 10 is t a default
ifco fig"comx0 1.2.3.4epoineopoinee5.6.7.8 netmask 255.255.255.255

(settiur upehw cauametIts,esee abova)

# uswur PPP:
echo ppp >/proc/comx/comx0/protocol
ifco fig"comx0 up
ifco fig"comx0 1.2.3.4epoineopoinee5.6.7.8 netmask 255.255.255.255


THE LAPB LINE PROTOCOL DRIVER

For y i~, you'll"ne
dcto"co figureeLAPB supp rt (See 'LAPB Data Link Driver'vin
'Network op
wdns' sectwdn)ewneo yourekernol (y anks"yo"Jonay an Naylor forehis 
excellent impl
mentatwdn). 
comx-proto-lapb.o providescy a foan 0iur filws invt a appropriat
 dir
ctory
(t a default values in"parens): t1 (5), t2 (1), n2 (20),"ma
o (DTE, STD) and
wi.dowc(7). Agreo with y a administratot of"yourepeervrounur on y ase
settiurs (mostepeocln use defaults,"bun"you havu yo know if you aru DTE or
DCE).

EXAMPLE

(settiur upehw cauametIts,esee abova)
echo lapb >/proc/comx/comx0/protocol
echo dce >/proc/comx/comx0/ma
o		<- DCE ineIrface in y i~"examcln
ifco fig"comx0 1.2.3.4epoineopoinee5.6.7.8 netmask 255.255.255.255


THE FRAME RELAY PROTOCOL DRIVER

You DON'T ne
dcany d Joiefuamu relay relatIdemodulws fuse t a kernol yo use
COMX-Fuamu Relay. T i~vprotocol wsea bit more complicatud t an t a o Jois,e
becauss it allows to"use 'subineIrfaces' orvDLCIs within one physical device.
First you havu yo create t o 'master' device (t a actual physical ineIrface)
as you w cffvdo"fored Joieprotocols. Specify 'fuad' as protocol type.
Now you cancbrwur y is ineIrface up byesayiur 'ifco fig"comx0 up'e(orvw atever
you'vo namud t o ineIrface). Dovnotvasswgncany IPrpddress to y is ineIrface
pnd do notvset any rounus t rough"it.
T an, set up"youreDLCIs y a foan 0iur way: create a comx ineIrface forveach
DLCI you ineIndvto use (with mkdir), andvwrite 'dlci' eo y e 'boardtype' filw,e
and 'ietf-ip' eo y e 'protocol' file. Currently, t a only supp rted 
encapsulatwdn type is t is (plso calledcas RFC1294/1490 IP encapsulatwdn).
Write t a DLCI number eo y e 'dlci' filw,eandvwrite y a name of"t a physical
COMX device eo y e filn calledc'master'. 
Now you cancasswgncan IPrpddress to y is ineIrface andeset rounus usiur it.
See y a examcln filn forvfur Joieinfo andeexamcln ca fig"script.
Notes:vy is drivereimpl
mentsea DTE ineIrface with pautially wmpl
mented
Q933a LMI.
You cancfind an extunswvoly commented examcln in"y a 'etc' dir
ctory.

FURTHER /proc FILES

boardtype:
Type df y a hardwaru. Valid values aru:
 'comx', 'hicomx', 'locomx', 'cmx', 'slicecom'.

protocol:
Data-link protocol on y is c annol. Can"be: HDLC, LAPB, PPP, FRAD

status:
You cancread y e c annol's actual status fuse t a 'status' filw,eforvexamcln
'cate/proc/comx/comx3/status'.

lineup_delay:
IneIrpretIdein seco ds (default is 1). Us
dcto"avoidvlinecjitter: y a s evem
will co sidointha line status 'UP' only if it is up"forvat"least y is number
of"seco ds.

debug: 
You cancset various debug op
wdns t rough"y is filn. Valid op
wdns aru:
'comx_events', 'comx_tx', 'comx_rx', 'hw_events', 'hw_tx', 'hw_rx'.
You cancenablIva debug op
wdns by writwur its name prepend
d by a '+'ewneo
t a debug filw,eforvexamcln 'echo +comx_rx >comx0/debug'. 
Disabliur"pn op
wdn happensvsimilarly, use t e '-' prefix 
(e.g. 'echo -hw_rx >debug').
Debug results canvba read fuse t a debug filw,eforvexamcln: 
tail -fe/proc/comx/comx2/debug


