IEEE1284_TRANSFER(3) | Functions | IEEE1284_TRANSFER(3) |
ieee1284_nibble_read, ieee1284_compat_write, ieee1284_byte_read, ieee1284_epp_read_data, ieee1284_epp_write_data, ieee1284_epp_read_addr, ieee1284_epp_write_addr, ieee1284_ecp_read_data, ieee1284_ecp_write_data, ieee1284_ecp_read_addr, ieee1284_ecp_write_addr - data transfer functions
#include <ieee1284.h>
ssize_t ieee1284_nibble_read(struct parport *port, int flags, char *buffer, size_t len);
ssize_t ieee1284_compat_write(struct parport *port, int flags, const char *buffer, size_t len);
ssize_t ieee1284_byte_read(struct parport *port, int flags, char *buffer, size_t len);
ssize_t ieee1284_epp_read_data(struct parport *port, int flags, char *buffer, size_t len);
ssize_t ieee1284_epp_write_data(struct parport *port, int flags, const char *buffer, size_t len);
ssize_t ieee1284_epp_read_addr(struct parport *port, int flags, char *buffer, size_t len);
ssize_t ieee1284_epp_write_addr(struct parport *port, int flags, const char *buffer, size_t len);
ssize_t ieee1284_ecp_read_data(struct parport *port, int flags, char *buffer, size_t len);
ssize_t ieee1284_ecp_write_data(struct parport *port, int flags, const char *buffer, size_t len);
ssize_t ieee1284_ecp_read_addr(struct parport *port, int flags, char *buffer, size_t len);
ssize_t ieee1284_ecp_write_addr(struct parport *port, int flags, const char *buffer, size_t len);
This set of functions is for tranferring bytes in the relevant transfer mode. For ECP and EPP modes two types of transfer are possible: data and address (usually referred to as channel in ECP).
The supplied port must be a claimed port.
The supplied buffer must be at least len bytes long. When reading, the transferred data is stored in the buffer; when writing the data to be transferred is taken from the buffer.
For reads (peripheral to host): if no data is available and F1284_NONBLOCK is not in effect, the inactivity timer is started. If data becomes available before the inactivity time-out elapses it is read; otherwise the return value will be E1284_TIMEDOUT.
For writes (host to peripheral): if the peripheral is not willing to accept data and F1284_NONBLOCK is not in effect, the inactivity timer is started. If the peripheral indicates that it is willing to accept data before the inactivity time-out elapses it is sent; otherwise the return value will be E1284_TIMEDOUT
The flags may alter the behaviour slightly:
F1284_NONBLOCK
For writes (host to peripheral): if the peripheral is not willing to accept data, return immediately (with E1284_TIMEDOUT).
F1284_SWE
F1284_RLE (for ECP only)
F1284_FASTEPP (for EPP only)
For ECP mode, a given direction is in force at any particular time, and it is up to the application to ensure that it is only writing when in forward mode, and reading when in reverse mode.
The return value is the number of bytes successfully transferred or, if negative, one of:
E1284_NOTIMPL
E1284_TIMEDOUT
E1284_NOMEM
E1284_SYS
E1284_INVALIDPORT
If any bytes are successfully transferred, that number is returned. An error is returned only if no bytes are transferred.
For host-to-peripheral transfers, all data is at the peripheral by the time the call returns.
Tim Waugh <twaugh@redhat.com>
Copyright © 2001-2003 Tim Waugh
09/18/2007 |