PPI(4)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

🌸 NAME 🌸

okay bestie, welcome to PPI(4) from the Kernel Interfaces Manual β€” this is the ppi page, and it’s literally the user-space interface to the ppbus parallel 'geek' port. πŸ’…βœ¨

πŸŽ€ SYNOPSIS πŸŽ€

device ppi

Minor numbering: unit numbers correspond directly to ppbus numbers. no cap, that’s the whole mapping. 🫢

#include <dev/ppbus/ppi.h>
#include <dev/ppbus/ppbconf.h>

πŸ¦‹ DESCRIPTION πŸ¦‹

The ppi driver gives user applications a convenient way to manipulate the state of the parallel port, enabling easy low-speed I/O operations without the security problems inherent with the use of the /dev/io interface. it’s giving β€œparallel port but make it safe-ish” energy, and honestly? iconic. πŸ’–

✨ PROGRAMMING INTERFACE ✨

All I/O on the ppi interface is performed using ioctl() calls. Each command takes a single uint8_t argument, transferring one byte of data. okay so here are the commands available, bestie:

  • PPIGDATA, PPISDATA β€” get and set the contents of the data register. πŸ“
  • 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: STROBE, AUTOFEED, nINIT, SELECTIN, PCD. setting a bit in the control register drives the corresponding output low β€” yes, low, the inverse-sense girlies know. πŸ’…
  • 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). 🧚

πŸ”₯ EXAMPLES πŸ”₯

wanna present the value 0x5a to the data port, drive STROBE low and then high again? this code fragment is literally right there for u:

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. 😭 no cap, it’s a whole vibe.

the ioctl() interface is slow, and there is no way (yet) to chain multiple operations together. periodt.

the headers required for user applications are not installed as part of the standard system. so don’t come for me if they’re not just chilling in the standard install, bestie. πŸ™ˆ


xoxo, this cutie is signed off by Debian, dated January 2, 1998, and it’s PPI(4) β€” slay forever πŸ’‹πŸŽ€

πŸ“¦ where this page comes from