Linux VME Howto: How to talk to the Tundra Universe PCI-VME bridge using the devices drivers.

Next Previous Contents

## 4. How to talk to the Tundra Universe PCI-VME bridge using the devices drivers.

## 4.1 The device drivers used with VMELinux

- /dev/vme_ctl
- /dev/vme_m0
- /dev/vme_m1
- /dev/vme_m2
- /dev/vme_m3
- /dev/vme_m4
- /dev/vme_m5
- /dev/vme_m6
- /dev/vme_m7

## 4.2 VMEMaster Device Drivers

/dev/vme_m* are drivers used to access the VMEbus as a bus master.

The Universe chip offers the programmer eight VMEMaster windows to the VMEbus. These windows are called Images. The details of the registers within these windows is beyond the scope of this Howto. Please refer to the Universe documentation for details. Tundra Universe

Version 1.1 of our tools only supported the first four images. This is because we originally designed this to work with the original Universe device. When the Universe II became available, Tundra did not update their documentation. Thanks to reports from other Universe users we are now aware of the new images, have found and downloaded the latest Universe manual from Tundra and have added these images to the 1.3.0 release.

## 4.3 VMESlave Device Drivers

The Universe chip offers the programmer four (eight for the UniverseII) VMESlave windows to the VMEbus. These windows are called Images. The details of the registers within these windows is beyond the scope of this Howto. Please refer to the Universe documentation for details. Tundra Universe

We originally intended to support the Universe's slave mode. We never had a need for this thus our efforts concentrated solely on using the Universe as a VME master only. So for 1.3.0 and the near future, we will not support the eight slave images.

I'll repeat this for clarity. Slave VME modes are not yet supported by our VMELinux Universe Kernel driver.

## 4.4 Direct Control of the Universe Registers

/dev/vme_ctl allows read and write access to the Universe registers.

For experienced users, this device allows direct access to the Universe chip's internal registers. Explanation of these registers and what they do is beyond the scope of this howto. Please consult the Universe documentation available from Tundra Universe

## 4.5 read()

n = read(vme_handle,buf,len);

Where:

- vme_handle = The value returned by "open,"
- buf = pointer to data block,
- len = number of bytes to read from the VMEbus.

## 4.6 write()

write(vme_handle,buf,len);

Where:

- vme_handle = The value returned by "open,"
- buf = pointer to data block,
- len = number of bytes to write to the VMEbus.

## 4.7 lseek()

lseek(vme_handle,vme_pnt,Seek_Type);

Where:

- vme_handle = The value returned by "open,"
- vme_pnt = The actual VME address to access,
- Seek_Type = SEEK_SET or SEEK_CUR

## 4.8 ioctl()

ioctl(vme_handle, command, argument);

Where:

- vme_handle = The value returned by "open,"
- command = IOCTL_SET_CTL or IOCTL_SET_MODE or IOCTL_SET_BS or IOCTL_SET_BD or IOCTL_SET_TO
- argument to be sent

And:

- IOCTL_SET_CTL = Sets the image CTL register to argument. Argument must be 32 bits.
- IOCTL_SET_MODE = "MODE_DMA" or "MODE_PROGRAMMED" - Sets the mode by which the Universe chips communicates to the PCI bus (Not VME Block Mode)
- IOCTL_SET_BS = Sets the image BS register to arguments. NOTE: The BD register must already be set prior to making this call.
- IOCTL_SET_BD = Sets the image BD register to argument.
- IOCTL_SET_TO = Set the image TO register to argument.

## 4.9 open() and close()

Here is where you open and close the four VMELinux Master or Slave devices plus the Control device. Slave images are not yet supported.

- vme_handle = open("//dev//vme_m0",O_RDWR,0);
- uni_handle = open("//dev//vme_ctl",O_RDWR,0);

- close(vme_handle);
- close(uni_handle);

Next Previous Contents