IO_ON_INTERRUPT(3D) — Series 500 Only
NAME
io_on_interrupt − device interrupt (fault) control
SYNOPSIS
#include <dvio.h>
int (*io_on_interrupt (eid, causevec, handler))()
int eid;
struct interrupt_struct *causevec;
int (*handler)();
handler (eid, causevec)
int eid;
struct interrupt_struct *causevec;
HP-UX COMPATIBILITY
Level: Device I/O Library − HP-UX/EXTENDED
Origin: HP
Remarks: Io_on_interrupt is implemented on the Series 500 only.
DESCRIPTION
Eid is an entity identifier of an open HP-IB raw bus, or GPIO device file, obtained from an open(2), dup(2), fcntl(2), or creat(2) call.
Causevec is a pointer to a structure of the form:
struct interrupt_struct {
int cause;
int mask;
};
The interrupt_struct structure is defined in the file dvio.h.
The cause parameter is a bit vector specifying which of the interrupt or fault events will cause the handler routine to be invoked. The interrupt causes are often specific to the type of interface being considered. As well, certain exception (error) conditions can be handled using the io_on_interrupt capability. Specifying a zero valued cause vector effectively turns off the interrupts for that eid.
The mask parameter is used when an HP-IB parallel poll interrupt is being defined. Mask is an integer that specifies which parallel poll response lines are of interest. Mask’s value is obtained from an 8-bit binary number, each bit of which corresponds to on of the eight lines. For example, if you want an interrupt handler invoked for a response on lines 2 or 6, the correct binary number is 01000100. This converts to a decimal equivalent of 68, which is the number you should assign to mask.
When an interrupt that is to be caught occurs during a read, a write, an open, or an ioctl system call on a slow device (like a terminal; but not a file), during a pause system call, during a sigpause(2) system call, or during a wait system call that does not return immediately due to the existence of a previously stopped or zombie process, the interrupt handling function will be executed and then the interrupted system call will return a -1 to the calling process with errno set to EINTR.
Interrupts handlers are not inherited across a fork(2). Eids for the same device file produced by dup(2) share the same handler.
An interrupt for a given eid is implicitly disabled after the occurrence of the event. The interrupt condition may be re-enabled with io_interrupt_ctl(3).
Upon the occurrence of an event specified by cause, the receiving process is to execute the interrupt handler function pointed to by handler. When the handler returns the user process resumes at the point of execution left when the event occurred.
Handler will be passed two parameters, the eid associated with the event, and a pointer to a causevec structure. The cause of the interrupt can be determined by the value returned in the cause field of the causevec structure. If the interrupt handler was invoked due to a parallel poll interrupt, then the mask field of the causevec structure will contain the parallel poll response byte XOR-ed with the sense and AND-ed with the mask
HPIB INTERRUPTS
This section describes interrupt causes specific to an hpib device. For an hpib device the cause is a bit vector which is used as follows. To enable a given event, the appropriate bit (in cause), shown below, must be set to 1:
SRQ SRQ and active controller.
TLK Talker addressed.
LTN Listener addressed.
TCT Controller in charge.
IFC IFC has been asserted
REN Remote enable
DCL Device clear
GET Group execution trigger
PPOLLParallel poll
GPIO INTERRUPTS
This section describes interrupt causes specific to a gpio device. For a gpio device the cause is a bit vector which is used as follows. To enable a given event, the appropriate bit (in cause), shown below, must be set to 1:
EIR External interrupt
SIE0 Status line 0
SIE1 Status line 1
HARDWARE DEPENDENCIES
Series 500:
The 5.0 HP_UX system does not support parallel poll interrupts. The internal HP-IB supplied with the Model 550 will not support talker addressed, listner addressed, controller in charge, and remote enable interrupt. GPIO interrupts on the EIR line are not supported.
RETURN VALUE
Io_on_interrupt returns a pointer to the previous handler if the new handler is successfully installed, otherwise it returns a −1 and errno is set.
DIAGNOSTICS
Io_on_interrupt can fail for any of the following reasons:
Eid does not refer to an open file [EBADF]
Eid does not refer to a GPIO or a raw HP-IB device file [ENOTTY]
Handler points to an illegal address [EFAULT]
causevec points to an illegal address. [EFAULT]
SEE ALSO
io_interrupt_ctl(3), pause(2), sigpause(2)
Hewlett-Packard — last mod. May 11, 2021