PPI(4)
π PPI(4) π
okay bestie so this is a page from the Kernel Interfaces Manual, and it's about the ppi driver β no cap, it's the whole user-space interface to the ppbus parallel 'geek' port. let's get into it π¦
β¨ NAME β¨
ppi β user-space interface to ppbus parallel 'geek' port
πΈ SYNOPSIS πΈ
device ppi
Minor numbering: unit numbers correspond directly to ppbus numbers.
#include <dev/ppbus/ppi.h>
#include <dev/ppbus/ppbconf.h>
π DESCRIPTION π
The ppi driver is literally the moment for user applications that wanna mess with the state of the parallel port. it gives you easy low-speed I/O operations without the security problems that come as a free gift with using the /dev/io interface. periodt.
π PROGRAMMING INTERFACE π
so every single I/O operation on the ppi interface happens through ioctl() calls. each command takes a single uint8_t argument and transfers exactly one byte of data. here's the full roster, no skips:
PPIGDATA,PPISDATAβ get and set the contents of the data register. iconic duo πPPIGSTATUS,PPISSTATUSβ get and set the contents of the status register.PPIGCTRL,PPISCTRLβ get and set the contents of the control register. the following defines correspond to bits in this register. and heads up bestie: setting a bit in the control register drives the corresponding output low.STROBEAUTOFEEDnINITSELECTINPCD
PPIGEPP,PPISEPPβ get and set the contents of the EPP control register.PPIGECR,PPISECRβ get and set the contents of the ECP control register.PPIGFIFO,PPISFIFOβ read and write the ECP FIFO (8-bit operations only, don't try anything fancy π«Ά).
π EXAMPLES π
say you wanna present the value 0x5a to the data port, drive STROBE low and then high again β this code fragment right here is your girl:
int fd;
uint8_t val;
val = 0x5a;
ioctl(fd, PPISDATA, &val);
ioctl(fd, PPIGCTRL, &val);
val |= STROBE;
ioctl(fd, PPISCTRL, &val);
val &= ~STROBE;
ioctl(fd, PPISCTRL, &val);
π BUGS π
- The inverse sense of signals is confusing. not me having to think about it twice every time π
- The
ioctl()interface is slow, and there is no way (yet) to chain multiple operations together. fr fr, one byte at a time bestie. - The headers required for user applications are not installed as part of the standard system. so you're gonna have to go find them yourself, sorry π₯Ί
okay that's the whole page!! this came from the <strong>Debian</strong> folks, dated <strong>January 2, 1998</strong> β yes she's an older queen but she still ate π β¨ byeeee π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1997 Michael Smith
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms