The Linux Parallel Port Programming HOWTO

Eugene Weiss

yossarian@users.sourceforge.net

Revision History
Revision v0.17 December, 2000

This document provides information on programming the PC parallel port for the Linux operating system.


Table of Contents
Introduction
Types of Parallel Ports
Accessing the Parallel Port
Selecting a Data Transfer Mode
SPP, Compatibility, Nibble and Byte Mode Transfers
EPP
ECP
Other Sources of Information
Copyright Information
Disclaimer

Introduction

This is the Linux Parallel Port Programming HOWTO. The purpose of this document is to assist the programmer in writing Linux device drivers for peripherals that use the IEEE 1284 parallel port. It is intended to aid the development of user-space programs, but may be helpful for writing kernel drivers provided that the programmer is already familiar with the art of writing kernel modules. It includes information on the various parallel port communication protocols (SPP, PS/2, EPP, ECP, etc.) with programming information for writing drivers either through the Linux kernel's generic parallel port driver ppdev.c, or through direct low-level port access using the macros provided by the GNU C library.

Hardware information

PARALLEL PORT PINOUT (female)

13 12 11 10 9 8 7 6 5 4 3 2 1
25 24 23 22 21 20 19 18 17 16 15 14  

Pin # 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Function C0 D0 D1 D2 D3 D4 D5 D6 D7 S6 S7 S5 S4 C1 S3 C2 C3

S=Status D=Data C=Control. Pins 18-25 are grounded.

CONTROL REGISTER

Pin Hex Function
1 0x1 STROBE
14 0x2 AUTOFEED
16 0x4 INIT
17 0x8 SELECTIN
* 0x10 INTEN
* 0x20 DIRECTION

STATUS REGISTER

Pin Hex Function
* 0x4 nIRQ
15 0x8 nERROR
13 0x10 SELECT
12 0x20 PAPEROUT
10 0x40 nACK
11 0x80 nBUSY

Note: * Internal control register.