IO_ON_INTERRUPT(3I) — HP-UX
NAME
io_on_interrupt − device interrupt (fault) control
SYNOPSIS
int (*io_on_interrupt (eid, causevec, handler))()
int eid;
struct interrupt_struct *causevec;
int (*handler)();
handler (eid, causevec)
int eid;
struct interrupt_struct *causevec;
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 {
| integer | cause; | |
| integer | 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. Also, certain exception (error) conditions can be handled using the io_on_interrupt capability. Specifying a zero valued cause vector effectively turns off the interrupt 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. The value of mask is obtained from an 8-bit binary number, each bit of which corresponds to one 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 enabled interrupt condition on the specified eid occurs, the receiving process executes the interrupt-handler function pointed to by handler. The entity identifier eid and the interrupt condition cause are returned as the first and second parameters respectively.
When a interrupt that is to be caught occurs during a read, write, open, or ioctl system call on a slow device such as a terminal (but not a file), during a pause system call, a sigpause(2) system call, or a wait system call that does not return immediately due to the existence of a previously stopped or zombie process, the interrupt handling function is executed and then the interrupted system call returns a −1 to the calling process with errno set to EINTR.
Interrupt 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(3I).
When an event specified by cause occurs, the receiving process executes 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.
HP-IB INTERRUPTS
This section describes interrupt causes specific to an HP-IB device. For an HP-IB 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
PPOLL Parallel 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
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.
ERRORS
Io_on_interrupt can fail for any of the following reasons:
[EBADF] Eid does not refer to an open file.
[ENOTTY] Eid does not refer to a GPIO or a raw HP-IB device file.
[EFAULT] Handler points to an illegal address. The reliable detection of this error will be implementation dependent.
[EFAULT] Causevec points to an illegal address. The reliable detection of this error will be implementation dependent.
HARDWARE DEPENDENCIES
Series 200, 300
For the HP 98622 GPIO interface, only the EIR interrupt is available. For the HP 98265A/B HP-IB interface, the IFC and GET interrupts are not available.
Series 500
Parallel poll interrupts are not supported. The internal HP-IB supplied with the Model 550 will not support talker addressed, listener addressed, controller in charge, and remote enable interrupts. GPIO interrupts on the EIR lines are not supported.
Series 800
For the HP 27112 GPIO interface, the EIR interrupt is not available. For the HP 27114 GPIO interface, only the EIR interrupt is available.
AUTHOR
Io_on_interrupt was developed by HP.
SEE ALSO
pause(2), sigpause(2), io_interrupt_ctl(3I).
Hewlett-Packard Company — Version B.1, May 11, 2021