Types of Parallel Ports

The PC parallel port goes back to the earliest days of the microcomputer, and the variety of types of port and of communications protocols reflect this. Most modern systems use an ECP port (Extended Capabilities Parallel Port) which can be programmed to emulate the older protocols. To further complicate matters, the IO chips which control parallel ports can themselves be set up, usually in BIOS, but sometimes using a utility program, to use one of the various available protocols exclusively. Many peripherals are capable of communicating in more than one of these protocols, and your driver may well need to support multiple protocols as well. This is particularly important for devices (such as scanners and digital cameras) where the primary direction of communication is inbound from the peripheral to the computer, as the original parallel ports were unidirectional (outbound), and the capabilities of the various protocols vary more for inbound data transfer than for outbound.

EPP ports are capable of SPP and PS/2 data transfers without any adjustment. An ECP port can emulate SPP and PS/2 modes, and usually EPP mode as well, though many IO chips have separate settings for ECP (no EPP possible) and ECP+EPP where EPP can be emulated. If the IO chip is programmed (usually in BIOS) as an EPP port, it will allow PS/2 and SPP operations normally, but if it is set up for ECP+EPP, and the ECP control register is set for EPP mode, the slower modes will NOT work. This is all rather confusing, and needs to be explained in the documentation for any driver that uses EPP. Most peripherals support either EPP or ECP, but not both.

To get information on the capabilities of a particular port setup, if the parallel port driver is loaded into the kernel, dmesg should produce a line like

parport0: PC-style at 0x378 (0x778) [SPP,ECP,ECPPS2,ECPEPP].[1]

Here SPP and ECP are supported modes (tested by the kernel at boot time, or when the module was loaded), and ECPPS2 and ECPEPP are PS2 and EPP modes available if the ECP port is properly programmed. Systems which use the /proc filesystem (and nearly all do) allow one to get information about the port from the from the file /proc/parport/parportX/hardware (with 2.2 kernels), or /proc/sys/dev/parport/parportX/hardware (with 2.4 kernels). The file looks as follows:

base: 0x378 (0x778)

irq: none

dma: none

modes: SPP,ECP,ECPPS2, ECPEPP

Reading this file is probably the easiest way for a user-space program to get information about a system's parallel port setup.

Notes

[1]

This is for a 2.2.x kernel. For the 2.4 series, this will be changed somewhat, but the new format hasn't yet stabilized at the time this was written.