162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci===============================
462306a36Sopenharmony_ciLinux Drivers for Baycom Modems
562306a36Sopenharmony_ci===============================
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciThomas M. Sailer, HB9JNX/AE4WA, <sailer@ife.ee.ethz.ch>
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciThe drivers for the baycom modems have been split into
1062306a36Sopenharmony_ciseparate drivers as they did not share any code, and the driver
1162306a36Sopenharmony_ciand device names have changed.
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciThis document describes the Linux Kernel Drivers for simple Baycom style
1462306a36Sopenharmony_ciamateur radio modems.
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ciThe following drivers are available:
1762306a36Sopenharmony_ci====================================
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_cibaycom_ser_fdx:
2062306a36Sopenharmony_ci  This driver supports the SER12 modems either full or half duplex.
2162306a36Sopenharmony_ci  Its baud rate may be changed via the ``baud`` module parameter,
2262306a36Sopenharmony_ci  therefore it supports just about every bit bang modem on a
2362306a36Sopenharmony_ci  serial port. Its devices are called bcsf0 through bcsf3.
2462306a36Sopenharmony_ci  This is the recommended driver for SER12 type modems,
2562306a36Sopenharmony_ci  however if you have a broken UART clone that does not have working
2662306a36Sopenharmony_ci  delta status bits, you may try baycom_ser_hdx.
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_cibaycom_ser_hdx:
2962306a36Sopenharmony_ci  This is an alternative driver for SER12 type modems.
3062306a36Sopenharmony_ci  It only supports half duplex, and only 1200 baud. Its devices
3162306a36Sopenharmony_ci  are called bcsh0 through bcsh3. Use this driver only if baycom_ser_fdx
3262306a36Sopenharmony_ci  does not work with your UART.
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_cibaycom_par:
3562306a36Sopenharmony_ci  This driver supports the par96 and picpar modems.
3662306a36Sopenharmony_ci  Its devices are called bcp0 through bcp3.
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_cibaycom_epp:
3962306a36Sopenharmony_ci  This driver supports the EPP modem.
4062306a36Sopenharmony_ci  Its devices are called bce0 through bce3.
4162306a36Sopenharmony_ci  This driver is work-in-progress.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ciThe following modems are supported:
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ci======= ========================================================================
4662306a36Sopenharmony_ciser12   This is a very simple 1200 baud AFSK modem. The modem consists only
4762306a36Sopenharmony_ci	of a modulator/demodulator chip, usually a TI TCM3105. The computer
4862306a36Sopenharmony_ci	is responsible for regenerating the receiver bit clock, as well as
4962306a36Sopenharmony_ci	for handling the HDLC protocol. The modem connects to a serial port,
5062306a36Sopenharmony_ci	hence the name. Since the serial port is not used as an async serial
5162306a36Sopenharmony_ci	port, the kernel driver for serial ports cannot be used, and this
5262306a36Sopenharmony_ci	driver only supports standard serial hardware (8250, 16450, 16550)
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_cipar96   This is a modem for 9600 baud FSK compatible to the G3RUH standard.
5562306a36Sopenharmony_ci	The modem does all the filtering and regenerates the receiver clock.
5662306a36Sopenharmony_ci	Data is transferred from and to the PC via a shift register.
5762306a36Sopenharmony_ci	The shift register is filled with 16 bits and an interrupt is signalled.
5862306a36Sopenharmony_ci	The PC then empties the shift register in a burst. This modem connects
5962306a36Sopenharmony_ci	to the parallel port, hence the name. The modem leaves the
6062306a36Sopenharmony_ci	implementation of the HDLC protocol and the scrambler polynomial to
6162306a36Sopenharmony_ci	the PC.
6262306a36Sopenharmony_ci
6362306a36Sopenharmony_cipicpar  This is a redesign of the par96 modem by Henning Rech, DF9IC. The modem
6462306a36Sopenharmony_ci	is protocol compatible to par96, but uses only three low power ICs
6562306a36Sopenharmony_ci	and can therefore be fed from the parallel port and does not require
6662306a36Sopenharmony_ci	an additional power supply. Furthermore, it incorporates a carrier
6762306a36Sopenharmony_ci	detect circuitry.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ciEPP     This is a high-speed modem adaptor that connects to an enhanced parallel
7062306a36Sopenharmony_ci	port.
7162306a36Sopenharmony_ci
7262306a36Sopenharmony_ci	Its target audience is users working over a high speed hub (76.8kbit/s).
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cieppfpga This is a redesign of the EPP adaptor.
7562306a36Sopenharmony_ci======= ========================================================================
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciAll of the above modems only support half duplex communications. However,
7862306a36Sopenharmony_cithe driver supports the KISS (see below) fullduplex command. It then simply
7962306a36Sopenharmony_cistarts to send as soon as there's a packet to transmit and does not care
8062306a36Sopenharmony_ciabout DCD, i.e. it starts to send even if there's someone else on the channel.
8162306a36Sopenharmony_ciThis command is required by some implementations of the DAMA channel
8262306a36Sopenharmony_ciaccess protocol.
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ciThe Interface of the drivers
8662306a36Sopenharmony_ci============================
8762306a36Sopenharmony_ci
8862306a36Sopenharmony_ciUnlike previous drivers, these drivers are no longer character devices,
8962306a36Sopenharmony_cibut they are now true kernel network interfaces. Installation is therefore
9062306a36Sopenharmony_cisimple. Once installed, four interfaces named bc{sf,sh,p,e}[0-3] are available.
9162306a36Sopenharmony_cisethdlc from the ax25 utilities may be used to set driver states etc.
9262306a36Sopenharmony_ciUsers of userland AX.25 stacks may use the net2kiss utility (also available
9362306a36Sopenharmony_ciin the ax25 utilities package) to convert packets of a network interface
9462306a36Sopenharmony_cito a KISS stream on a pseudo tty. There's also a patch available from
9562306a36Sopenharmony_cime for WAMPES which allows attaching a kernel network interface directly.
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ciConfiguring the driver
9962306a36Sopenharmony_ci======================
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ciEvery time a driver is inserted into the kernel, it has to know which
10262306a36Sopenharmony_cimodems it should access at which ports. This can be done with the setbaycom
10362306a36Sopenharmony_ciutility. If you are only using one modem, you can also configure the
10462306a36Sopenharmony_cidriver from the insmod command line (or by means of an option line in
10562306a36Sopenharmony_ci``/etc/modprobe.d/*.conf``).
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ciExamples::
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci  modprobe baycom_ser_fdx mode="ser12*" iobase=0x3f8 irq=4
11062306a36Sopenharmony_ci  sethdlc -i bcsf0 -p mode "ser12*" io 0x3f8 irq 4
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciBoth lines configure the first port to drive a ser12 modem at the first
11362306a36Sopenharmony_ciserial port (COM1 under DOS). The * in the mode parameter instructs the driver
11462306a36Sopenharmony_cito use the software DCD algorithm (see below)::
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci  insmod baycom_par mode="picpar" iobase=0x378
11762306a36Sopenharmony_ci  sethdlc -i bcp0 -p mode "picpar" io 0x378
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_ciBoth lines configure the first port to drive a picpar modem at the
12062306a36Sopenharmony_cifirst parallel port (LPT1 under DOS). (Note: picpar implies
12162306a36Sopenharmony_cihardware DCD, par96 implies software DCD).
12262306a36Sopenharmony_ci
12362306a36Sopenharmony_ciThe channel access parameters can be set with sethdlc -a or kissparms.
12462306a36Sopenharmony_ciNote that both utilities interpret the values slightly differently.
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ciHardware DCD versus Software DCD
12862306a36Sopenharmony_ci================================
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ciTo avoid collisions on the air, the driver must know when the channel is
13162306a36Sopenharmony_cibusy. This is the task of the DCD circuitry/software. The driver may either
13262306a36Sopenharmony_ciutilise a software DCD algorithm (options=1) or use a DCD signal from
13362306a36Sopenharmony_cithe hardware (options=0).
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci======= =================================================================
13662306a36Sopenharmony_ciser12   if software DCD is utilised, the radio's squelch should always be
13762306a36Sopenharmony_ci	open. It is highly recommended to use the software DCD algorithm,
13862306a36Sopenharmony_ci	as it is much faster than most hardware squelch circuitry. The
13962306a36Sopenharmony_ci	disadvantage is a slightly higher load on the system.
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_cipar96   the software DCD algorithm for this type of modem is rather poor.
14262306a36Sopenharmony_ci	The modem simply does not provide enough information to implement
14362306a36Sopenharmony_ci	a reasonable DCD algorithm in software. Therefore, if your radio
14462306a36Sopenharmony_ci	feeds the DCD input of the PAR96 modem, the use of the hardware
14562306a36Sopenharmony_ci	DCD circuitry is recommended.
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_cipicpar  the picpar modem features a builtin DCD hardware, which is highly
14862306a36Sopenharmony_ci	recommended.
14962306a36Sopenharmony_ci======= =================================================================
15062306a36Sopenharmony_ci
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ciCompatibility with the rest of the Linux kernel
15462306a36Sopenharmony_ci===============================================
15562306a36Sopenharmony_ci
15662306a36Sopenharmony_ciThe serial driver and the baycom serial drivers compete
15762306a36Sopenharmony_cifor the same hardware resources. Of course only one driver can access a given
15862306a36Sopenharmony_ciinterface at a time. The serial driver grabs all interfaces it can find at
15962306a36Sopenharmony_cistartup time. Therefore the baycom drivers subsequently won't be able to
16062306a36Sopenharmony_ciaccess a serial port. You might therefore find it necessary to release
16162306a36Sopenharmony_cia port owned by the serial driver with 'setserial /dev/ttyS# uart none', where
16262306a36Sopenharmony_ci# is the number of the interface. The baycom drivers do not reserve any
16362306a36Sopenharmony_ciports at startup, unless one is specified on the 'insmod' command line. Another
16462306a36Sopenharmony_cimethod to solve the problem is to compile all drivers as modules and
16562306a36Sopenharmony_cileave it to kmod to load the correct driver depending on the application.
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ciThe parallel port drivers (baycom_par, baycom_epp) now use the parport subsystem
16862306a36Sopenharmony_cito arbitrate the ports between different client drivers.
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_civy 73s de
17162306a36Sopenharmony_ci
17262306a36Sopenharmony_ciTom Sailer, sailer@ife.ee.ethz.ch
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_cihb9jnx @ hb9w.ampr.org
175