Specifications

Special Considerations
16-3
system start-up script, to register itself to catch a range of VME addresses. If a VME bus
error occurs within this registered range of VME addresses, then a user-specified signal is
sent to that process. It is up to the signal handler to decide what action should be taken in
order to correct the situation, such as resetting the device, re-issuing a command to the
device, or even shutting the simulation and/or system down.
The usual coding sequence for using iobus_err(2) is to:
1. Setup a signal handler, using sigaction(2), to catch the signal used for
VME bus error notifications.
The sample code uses SIGUSR1 as the bus error notification signal below:
int status;
struct sigaction act;
act.sa_sigaction = sigcatcher; /* signal routine */
status = sigaction(SIGUSR1, &act,
(struct sigaction*)Null;
2. Register to catch a range of VME bus errors, using the IO_REG command
on an iobus_err(2) system service call, and passing the signal number
that is to be used for bus error notification. (The process can catch any and
all VME bus errors in the system by specifying a starting address of 0, and
a length of -1 (0xffffffff)).
The sample code below registers to catch VME bus errors starting at
address 0xc1010000 and ending at address 0xc1010ffff:
int status;
paddr_t base_addr = 0xc1010000; /* starting vme
physical address */
size_t length = 0x1000; /* 4k length */
struct sigevent sig_event;
status = iobus_error(IO_REG, VME, base_addr,
length, (void*)&sig_event);
3. In the signal handler, additional information can be obtained about the
VME bus error by calling iobus_error(2) with the IO_INFO com-
mand.
For example:
int status;
paddr_t base_addr = 0xc1010000;
size_t length = 0x1000;
struct iobus_info info;
status = iobus_err(IO_INFO, VME, base_addr, length,
(void *)&info);
Note that the values for base_addr and length should be exactly the same as
those previously specified on the IO_REG iobus_err(2) system ser-
vice call; otherwise, this call fails.