URL
https://opencores.org/ocsvn/or1k/or1k/trunk
Subversion Repositories or1k
[/] [or1k/] [tags/] [before_ORP/] [uclinux/] [uClinux-2.0.x/] [drivers/] [char/] [README.baycom] - Rev 1765
Compare with Previous | Blame | View Log
LINUX DRIVER FOR BAYCOM MODEMS
Thomas M. Sailer <hb9jnx@radio.amiv.ethz.ch>
This document describes the Linux Kernel Driver for simple Baycom style
amateur radio modems. The driver supports the following modems:
ser12: This is a very simple 1200 baud AFSK modem. The modem consists only
of a modulator/demodulator chip, usually a TI TCM3105. The computer
is responsible for regenerating the receiver bit clock, as well as
for handling the HDLC protocol. The modem connects to a serial port,
hence the name. Since the serial port is not used as an async serial
port, the kernel driver for serial ports cannot be used, and this
driver only supports standard serial hardware (8250, 16450, 16550)
par96: This is a modem for 9600 baud FSK compatible to the G3RUH standard.
The modem does all the filtering and regenerates the receiver clock.
Data is transferred from and to the PC via a shift register.
The shift register is filled with 16 bits and an interrupt is signalled.
The PC then empties the shift register in a burst. This modem connects
to the parallel port, hence the name. The modem leaves the
implementation of the HDLC protocol and the scrambler polynomial to
the PC.
par97: This is a redesign of the par96 modem by Henning Rech, DF9IC. The modem
is protocol compatible to par96, but uses only three low power ICs
and can therefore be fed from the parallel port and does not require
an additional power supply.
All of the above modems only support half duplex communications. However,
the driver supports the KISS (see below) fullduplex command. It then simply
starts to send as soon as there's a packet to transmit and does not care
about DCD, i.e. it starts to send even if there's someone else on the channel.
This command is required by some implementations of the DAMA channel
access protocol.
The Interface of the driver
The driver interfaces to the AX25 stack via a KISS interface. The driver
can be accessed as a character device with major 60. Major 60 is the first
number of the local/experimental range. I did no steps to coordinate a
major number for this driver, but I plan to do so in the near future.
The driver supports multiple modems (currently four, as defined with
NR_PORTS). It therefore responds to minor numbers 0 to 3. I recommend
to access the driver via the special device files /dev/bc[0-3], which
can be created with 'make bc'.
Compiling and installing the driver
First unpack the source files into a directory. Then enter the following: (you
must be root to do it)
make dep
make
This will create the files baycom.o and setbaycom. baycom.o is as well copied
to /lib/modules/`uname -n`/misc. If you plan to use kerneld, do the following:
depmod -a
Do not forget to create the device special files if you install the driver the
first time. This can be done with:
make bc
You are now ready to use the driver. You can now activate the driver manually
by entering
insmod baycom
or leave this task to kerneld (if installed). Add the following line to
/etc/conf.modules
alias char-major-60 baycom
Configuring the driver
Every time the driver is inserted into the kernel, it has to know which
modems it should access at which ports. This can be done with the setbaycom
utility. If you are only using one modem, you can also configure the
driver from the insmod command line (or by means of an option line in
/etc/conf.modules).
Examples:
insmod baycom modem=1 iobase=0x3f8 irq=4 options=1
setbaycom -i /dev/bc0 -p ser12 0x3f8 4 1
Both lines configure the first port to drive a ser12 modem at the first
serial port (COM1 under DOS). options=1 instructs the driver to use
the software DCD algorithm (see below).
insmod baycom modem=2 iobase=0x378 irq=7 options=1
setbaycom -i /dev/bc0 -p par96 0x378 7 1
Both lines configure the first port to drive a par96 or par97 modem at the
first parallel port (LPT1 under DOS). options=1 instructs the driver to use
the software DCD algorithm (see below).
The channel access parameters must be set through KISS parameter frames. The
AX25 stack may be used to generate such frames. KA9Q NET derivatives such
as WAMPES or TNOS offer the 'param' command for this purpose.
Hardware DCD versus Software DCD
To avoid collisions on the air, the driver must know when the channel is
busy. This is the task of the DCD circuitry/software. The driver may either
utilise a software DCD algorithm (options=1) or use a DCD signal from
the hardware (options=0).
ser12: if software DCD is utilised, the radio's squelch should always be
open. It is highly recommended to use the software DCD algorithm,
as it is much faster than most hardware squelch circuitry. The
disadvantage is a slightly higher load on the system.
par96: the software DCD algorithm for this type of modem is rather poor.
The modem simply does not provide enough information to implement
a reasonable DCD algorithm in software. Therefore, if your radio
feeds the DCD input of the PAR96 modem, the use of the hardware
DCD circuitry is recommended.
par97: as far as I know it is in this respect equivalent to par96.
Compatibility with the rest of the Linux kernel
The tty interface gave me some headaches. I did not find a reasonable
documentation of its interfaces, so I'm not particularly sure if I implemented
it the way I should. Perhaps someone with a more profound knowledge about
tty drivers could check the interface routines.
The driver produces a rather high interrupt load. par96/par97 generates 600
interrupts per second, ser12 1200 while transmitting and 2400 if hardware
DCD is used, 3600 otherwise. If other device drivers disable interrupts
too long, the performance of the driver drops (the packet loss rate increases),
especially with the ser12 modem.
There were also reports that under rather high load situations the driver
drops frames. This might be either an interrupt problem, or an AX25 stack
running in user mode might not get enough CPU time to process the packets
before the drivers internal buffers overflow. There is no way to throttle
the other radio stations from this layer, throttling must be done in the
AX25 layer.
The serial driver, the line printer (lp) driver and the baycom driver compete
for the same hardware resources. Of course only one driver can access a given
interface at a time. The serial driver grabs all interfaces it can find at
startup time. Therefore the baycom driver subsequently won't be able to
access a serial port. You might therefore find it necessary to release
a port owned by the serial driver with 'setserial /dev/ttyS# uart none', where
# is the number of the interface. The baycom driver does not reserve any
port at startup, unless one is specified on the 'insmod' command line. Another
method to solve the problem is to compile all three drivers as modules and
leave it to kerneld to load the correct driver depending on the application.
vy 73s de
Tom Sailer, hb9jnx@radio.amiv.ethz.ch
hb9jnx @ hb9w.ampr.org