HPlogo HP-UX Reference Volume 4 of 5 > h

hpib_io(3I)

Series 800 Only
» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

hpib_io() — perform I/O with an HP-IB channel from buffers (OBSOLETED AT 10.30)

SYNOPSIS

#include <dvio.h>

int hpib_io(int eid, struct iodetail *iovec, size_t iolen);

DESCRIPTION

hpib_io() performs and controls read and/or write operations on the specified HP-IB bus. eid is an entity identifier of an open HP-IB raw bus device file obtained from an open(), dup(), fcntl(), or creat() call.

Parameters are as follows:

iovec

Pointer to an array of structures of the form:

struct iodetail { char mode; char terminator; int count; char *buf; };

The iodetail structure is defined in the include file <dvio.h>.

iolen

Specifies the number of structures in iovec.

iodetail Structure

Elements in the iodetail structure are:

mode

Describes what is to be done during I/O on the buffer pointed to by buf. mode is constructed by OR-ing flags from the following list:

  • One and only one of the following two flags must be specified:

    HPIBREAD

    Perform a read of the HP-IB bus, placing data into the accompanying buffer.

    HPIBWRITE

    Perform a write to the HP-IB bus, using data from the accompanying buffer.

  • The following flags can be used in most combinations (not all combinations are valid), or not at all:

    HPIBATN

    Data is written with ATN enabled.

    HPIBEOI

    Data written is terminated with EOI (this flag is ignored when HPIBATN is enabled).

    HPIBCHAR

    Data read is terminated with the character given in the terminator element of the iodetail structure.

terminator

Describes the termination character, if any, that should be checked for on input. count is an integer specifying the maximum number of bytes to be transferred.

A read operation terminates when either count is matched, an EOI is detected, or the designated terminator is detected (if HPIBCHAR is set in mode).

A write operation terminates when count is matched, and the final byte is sent with EOI asserted (if HPIBEOI is set in mode).

If HPIBATN is set in mode, write operations occur with ATN enabled. Setting HPIBATN for a read operation is ignored and has no effect.

The members of the iovec array are accessed in order.

RETURN VALUE

If all transactions are successful, hpib_io() returns a zero and updates the count element in each structure in the iovec array to reflect the actual number of bytes read or written.

If an error is encountered during a transaction defined by an element of iovec, hpib_io() returns without completing any transactions that might follow. In particular, if an error occurs, hpib_io() returns a -1, and the count element of the transaction that caused the error is set to -1.

ERRORS

hpib_io() fails under any of the following circumstances, and sets errno (see errno(2)) to the value indicated:

[EBADF]

eid does not refer to an open file.

[ENOTTY]

eid does not refer to an HP-IB raw bus device file.

[ETIMEDOUT]

a timeout occurred.

[EIO]

eid is not the active controller.

DEPENDENCIES

If the interface is not currently the active controller, hpib_io() sets errno to [EACCES] instead of to [EIO].

AUTHOR

hpib_io() was developed by HP.

© Hewlett-Packard Development Company, L.P.