This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for the CHICKEN 4 version of this egg, if it exists.
If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.
User-space interface to ppbus parallel 'geek' port under FreeBSD
This extension uses C functions from FreeBSD's ppi to implement simple procedures for handling Parallel Port's input and output.[procedure] (ppi-in DEVICE REQUEST)
Gets the contents of the corresponding register on the given device[procedure] (ppi-out DEVICE REQUEST NUMBER)
Sets the contents of the corresponding register on the given device
- DEVICE is a string indicating a path to the device's file (eg. "/dev/ppi0")
- REQUEST is one of
with a meaning as described in man ppi.
There are predefined procedures to set and get various registers[procedure] ppi-data-in
Each ppi-***-in procedure is a procedure of no arguments. Each ppi-***-out procedure is a procedure of one argument being the number to send to register.
For example: <procedure>(ppi-data-out NUMBER)</procedure>
Sets the contents of the data register to given number There are 8 bits in the data register so range of numbers available to set is 0 - 255
sets D2 and D0 to logical 1
(ppi-status-in) ; 8 * S3 + 16 * S4 + 32 * S5 + 64 * S6 + 128 * ~S7
reads the contents of the status register.
Example : For S3 and S5 set to 1 and the rest to 0
(ppi-status-in) => 40
The predefined procedures make usage of the device /dev/ppi0 as the parallel port. If you want them to use another device, you can change it, as the device's name to use is bound with ppi-device variable.
Example: To read control register on /dev/ppi1 device you can use either
(ppi-in "/dev/ppi1" PPIGCTRL)
(set! ppi-device "/dev/ppi1") (ppi-control-in)
In the latter case, consequent calls to ppi-***-in/out procedures will obviously refer to "/dev/ppi1" device.
For further reference on ppi see man ppi
There are many sites devoted to parallel port operations, for example:
- 1.1 Added freebsd platform specifier to meta file
- 1.0 Initial version<
Copyright (c) 2005 Michal Dybizbanski
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.