Next | Prev | Up | Top | Contents | Index

Writing User-level VME Device Drivers

The IRIX operating system contains special files in /dev/vme/vme* that provide access to the various address spaces on the system's VME-bus adapters. These special files allow a user-level program to map arbitrary VME devices into its address space. You can take advantage of them to write a user-level memory-mapped device driver.

Byte addresses in /dev/vme/vme* are interpreted as VME-bus addresses. Not all addresses can be read from or written to because of read-only or write-only registers and unequipped addresses. Reads or writes to invalid VME-bus addresses normally result in a SIGBUS signal being sent to the offending process.

If multiple processes have the mapping for the VME address that got an error, a SIGBUS signal is sent to each of them. On multiprocessor systems, a write to an invalid VME-bus address behaves differently from one on a single-processor system. In these cases, since writes are asynchronous, processors do not wait for the completion of the write operation. If a write operation fails, it may take up to 10 milliseconds for the user VME process to be signaled about a failed write. (VME-bus time-out is about 80 microseconds.) So, if the user VME process has to confirm the successful completion of a write, it should wait for about 10 milliseconds. If the user VME process has already terminated by the time the kernel gets the VME write error interrupt, it sends a message to SYSLOG indicating the VME adapter number and failed VME-bus address.

When your driver maps a device into the address space of a user-level program (through the mmap() system call), the user-level program can use simple loads and stores to and from program variables to read or modify device registers or to read or set on-board device memory. If you use memory mapping, you do not need to modify any irix.sm files.

Recall that mmapped device drivers are slave devices in which the hardware is memory mapped into a user's address space. No interrupt or DMA service routine is available to the user process.

The special files found in /dev/vme/* are named in the format:

/dev/vme/vme<adapter-#><address-space><address-mode>

Arguments

adapter-#

specifies which VME-bus adapter

address-space

specifies which address space, such as 16, 24, or 32
(see "VME-bus Space Reserved for Customer Drivers".)

address-mode

identifies the addressing mode, which is n for non-privileged or s for supervisor
Use the hinv(1M) (hardware inventory) command to produce a list of valid VME-bus adapters present on the system. Adapter numbers range upwards from 0. These adapters can be used only for memory mapping VME-bus address space into the address space of a user's program. The address space can be 16, 24 or 32. The address mode is either n for non-privileged or s for supervisory. Thus, adapter 0, address space 16 in non-privileged mode is referred to as /dev/vme/vme0a16n.

Use the technical specification for the device to determine the slave addressing mode.

The kernel driver for user-level VME is referred to as usrvme. If VME buses are added to an existing system, it may be necessary to run MAKEDEV(1M), specifying a target of usrvme, to have the additional /dev/vme devices created.


Example VME Device Driver
Using mmap
User-level DMA Library (udmalib)

Next | Prev | Up | Top | Contents | Index