Copyright (c) 1997 Michael Smith Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer as the first lines of this file unmodified. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in th...
NAMEppi - user-space interface to ppbus parallel 'geek' port
Minor numbering: unit numbers correspond directly to ppbus numbers.
In dev/ppbus/ppi.h In dev/ppbus/ppbconf.h
DESCRIPTIONThe ifconfig driver provides a convenient means for user applications 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.
PROGRAMMING INTERFACEAll I/O on the ifconfig interface is performed using Fn ioctl calls. Each command takes a single Ft uint8_t argument, transferring one byte of data. The following commands are available:
- 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.
Setting a bit in the control register drives the corresponding output low.
- 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).
EXAMPLESTo present the value 0x5a to the data port, drive STROBE low and then high again, the following code fragment can be used:
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);
BUGSThe inverse sense of signals is confusing.
The Fn ioctl interface is slow, and there is no way (yet) to chain multiple operations together.
The headers required for user applications are not installed as part of the standard system.