This page describes patches for NetBSD 5.1 (i386 port only) to add
support for the parallel port user space API 'ppui' (originally written
for FreeBSD and there named 'ppi'). Look at the outdated
ppbus project page.
The lower layer named 'ppbus' is already part of NetBSD 5.1, this patch
only adds the upper layer 'ppui' that provides access to the parallel
port pins via ioctl(2).
ppui patch for NetBSD 5.1 (tar archive) [Size: 30KiByte]
Prepare a NetBSD 5.1 kernel source tree. Extract the patch file from the tar archive and copy it into the toplevel directory "src". Change into that directory and apply the patches like this:
# patch -p1 <patch_ppui_NetBSD5.1
Configure the patched kernel to use the new parallel port system like this:
# Disable old lpt printer driver # PCI parallel printer interfaces #lpt* at puc? port ? # ISA parallel printer interfaces #lpt0 at isa? port 0x378 irq 7 # Standard PC parallel #lpt1 at isa? port 0x278 #lpt2 at isa? port 0x3bc # Enable new ppbus based drivers # atppc device # flag values: 0x01 - disable irq, 0x02 - disable dma # Parallel port directly configured on ISA bus atppc0 at isa? port 0x378 irq 7 flags 0x02 # Parallel port configured by ACPI #atppc* at acpi? flags 0x00 # Parallel port configured by PNPBIOS #atppc* at pnpbios? index ? flags 0x00 # Parallel port on a PCI PUC #atppc* at puc? port ? flags 0x00 # Parallel port configured by ISAPNP #atppc* at isapnp? flags 0x00 #options ATPPC_DEBUG #options ATPPC_VERBOSE # ppbus device and flags ppbus* at atppc? #options PPBUS_VERBOSE #options PPBUS_DEBUG #options DEBUG_1284 #options DONTPROBE_1284 #options PERIPH_1284 # Devices which attach to ppbus # Printer lpt* at ppbus? #options LPT_DEBUG #options LPT_VERBOSE # Network device plip* at ppbus? #options PLIP_DEBUG # PPS device pps* at ppbus? # ppui device ppui* at ppbus?
Now compile and install the kernel as documented in NetBSD kernel documentation.
After the next reboot, verify that the new drivers have been loaded. 'dmesg' should show something like that:
atppc0 at isa0 port 0x378-0x37f irq 7 drq : AT Parallel Port atppc0: capabilities=29<INTR,PS2,EPP> ppbus0 at atppc0 ppbus0: No IEEE1284 device found. lpt0 at ppbus0: port mode = 1<COMPATIBLE> plip0 at ppbus0 pps0 at ppbus0 ppui0 at ppbus0
To let the world see the API of the ppui driver, copy the header file: "src/sys/dev/ppbus" from your kernel source tree to "/usr/include/dev/ppbus". If you want to compile a program that should use ppui, include this header file.
Now copy the man pages "src/man/*" to the
"/usr/share/man/" directory.
You can now view the manual pages ppui(4) and ppui(9).
Note:
The manual page ppbus(4) refers to ppui with the original name ppi
from FreeBSD, but a driver called ppi is already present in NetBSD
(HP300 port). This ppi driver does not use the ppbus framework, don't
be confused.
Finally you have to create device files for ppui in the "/dev" directory. The files are usually called "ppui<0-2>", but you can use any name. For the i386 port you have to create character device files with major number 104. The minor number is directly mapped to the devices: The first port have minor number 0, the second minor number 1 and so on.
Modify your "/dev/MAKEDEV.local" script like this:
all) makedev_local ppui ;; ppui) mkdev ppui0 c 104 0 600 mkdev ppui1 c 104 1 600 mkdev ppui2 c 104 2 600 ;;
And let the script create the device files for you:
./MAKEDEV.local ppui
Thanks to Gary Thorpe for porting the ppbus framework to NetBSD.