Standard Parallel Port Control Using ppdev

Using inb and outb isn't the only way to query and control the PC parallel port's data, control, and status registers. The Linux parallel port device driver, ppdev, also allows for this control, by using ioctl.2 This approach is similar to the approach used in Chapter 6, “Asynchronous Serial Communication Interfacing,” to control the serial port. A file (/dev/parport0) is opened, and a file descriptor is returned. With this descriptor, calls to ioctl can set individual control bits, query the port status, and read and write to the port's data bus. The program in Listing 7.3, snowmakingcontrolppdev.c, uses ppdev to control the parallel port registers that control the interface circuit in Figure 7.3. (“The ...

Get Embedded Linux®: Hardware, Software, and Interfacing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.