Outdated egg!

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.

ppi

  1. Outdated egg!
  2. ppi
    1. Description
    2. Author
    3. Requirements
    4. Download
    5. Documentation
    6. Changelog
    7. License

Description

User-space interface to ppbus parallel 'geek' port under FreeBSD

Author

Michal Dybizbanski

Requirements

None

Download

ppi.egg

Documentation

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

Where

[constant] PPIGDATA
[constant] PPISDATA
[constant] PPIGSTATUS
[constant] PPISSTATUS
[constant] PPIGCTRL
[constant] PPISCTRL
[constant] PPIGEPPD
[constant] PPISEPPD
[constant] PPIGEPPA
[constant] PPISEPPA
[constant] PPIGECR
[constant] PPISECR
[constant] PPIGFIFO
[constant] PPISFIFO

with a meaning as described in man ppi.

There are predefined procedures to set and get various registers

[procedure] ppi-data-in
[procedure] ppi-data-out
[procedure] ppi-status-in
[procedure] ppi-status-out
[procedure] ppi-control-in
[procedure] ppi-control-out
[procedure] ppi-eppd-in
[procedure] ppi-eppd-out
[procedure] ppi-eppa-in
[procedure] ppi-eppa-out
[procedure] ppi-ecr-in
[procedure] ppi-ecr-out
[procedure] ppi-fifo-in
[procedure] ppi-fifo-out

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

Example :

(ppi-data-out 5)

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)

or

  (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:

Changelog

License

 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.