VME Howto

John Huggins and Michael Wyrick, vmelinux@va.net

v0.8a, 30 July 1998


This document came about to show the embedded system community how to run Linux on their VMEbus Pentium and other PCI local bus based VMEbus processor designs.

1. Introduction

2. Installation of the VMELinux Kernel Driver

3. How to talk to the VMEbus with the VMEUtils and the VMEShell Packages

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

5. Advantages of the VMEbus, Linux and VMELinux

6. Current and planned Board Support

7. Conclusion

8. FAQ


1. Introduction

1.1 Knowledge Required

Using Linux on an embedded VMEbus processor board is not very difficult. However, more than fundamental knowledge is required. This document is not a primer on how to fully configure a Linux machine.

In order to understand this HOWTO document it is assumed that you are thoroughly familiar with the following:

If you are uncertain of how to proceed with any of the above it is STRONGLY recommended that you use the links provided to familiarize yourself with all packages. We may not reply to any mail regarding any of the above. Please direct any questions to the appropriate author of the HOWTO or consult the respective hardware manufacturer.

This document describes the installation and use of VMELinux on a Xycom XVME-655 6U VME processor board. Other brands of VME boards that use a Pentium and the Tundra Universe chip should be capable of running VMELinux. Please consult the Board Support Section of the VMELinux web site for tested boards. VMELinux Project Web Site

1.2 Why use Linux on VMEbus systems?

Operating systems for VMEbus computers are usually Real-time Operating Systems (RTOS) which have high cost and a significant learning curve. In return the RTOS offers quick response to real world events for control of machinery or response to a process.

The VMEbus provides a rugged computer enclosure and interconnection system. Many system integrators require this ruggedness and also need very fast real-time response. However, there are many times when there is little need for real-time response, but the software still needs:

Linux has all these capabilities. Thus, the VMELinux Project exists.

1.3 Purpose

The purpose of VMELinux is to give the VME system integrator another choice in operating systems. Rich in features, high in reliability and low in cost, Linux offers benefits to the embedded computer industry. High cost operating systems economically prohibit the use of VME in many applications. With Linux and the VMELinux drivers, the rugged VMEbus has new possibilities.

The purpose of the VMELinux Project is to:

1.4 Feedback

As VMELinux is tested in the field, we encourage comments about how well or how bad it works. Please feel free to send comments to The VMELinux Project

As we get experience about each brand of VME CPU, we will list the different configurations in this HOWTO. For now we will describe only the Xycom board.

1.5 VMELinux Revision History

Linux Kernel Driver

VMEUtils Program

VMEShell Utilities

1.6 Copyright/Distribution

This document is Copyright 1997-1998 by John Huggins and the VMELinux Project.

A verbatim copy may be reproduced or distributed in any medium physical or electronic without permission of the author. Translations are similarly permitted without express permission if it includes a notice on who translated it. Commercial redistribution is allowed and encouraged; however please notify The VMELinux Project of any such distributions.

Excerpts from the document may be used without prior consent provided that the derivative work contains the verbatim copy or a pointer to a verbatim copy.

Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all copies.

In short, we wish to promote dissemination of this information through as many channels as possible. However, we wish to retain copyright on this HOWTO document, and would like to be notified of any plans to redistribute this HOWTO.


2. Installation of the VMELinux Kernel Driver

2.1 Download the Source

Download the distribution from the VMELinux Web Site.

2.2 Install the source to the software

Place the file in a directory reserved for VME usage; We suggest /universe. Untar the zipped/tarred file by typing...

tar -xzf VMELinux_08a.tar.gz

You should see three directories and one link to ca91c042

ca91c042
vmeshell
vmeutils
driver

In ca91c042 you should find:

ca91c042/                    
ca91c042/Makefile            
ca91c042/ca91c042.c          
ca91c042/ca91c042.h          
ca91c042/README              
ca91c042/e                   
ca91c042/ins                 
ca91c042/stat                
ca91c042/uns                                        

In vmeshell you should find:

vmeshell/vmer    
vmeshell/README  
vmeshell/vmeseek 
vmeshell/cmd.vme 
vmeshell/vmew    
vmeshell/vmeregw 
vmeshell/vmeregr 
vmeshell/vmefa   
vmeshell/vmecall 
vmeshell/e       
vmeshell/ec      
vmeshell/fa.vme  
vmeshell/map.vme 
vmeshell/tmp.vme 
vmeshell/vmedb   
vmeshell/vmedl   
vmeshell/vmedw   
vmeshell/vmemap  
vmeshell/vmerb   
vmeshell/vmerf   
vmeshell/vmerl   
vmeshell/vmerw   
vmeshell/vmewb 
vmeshell/vmewf 
vmeshell/vmewl 
vmeshell/vmeww 

In the vmeutils directory you should find:

vmeutils/commands.cpp 
vmeutils/commands.h   
vmeutils/universe.h   
vmeutils/Makefile     
vmeutils/vmeutils.h   
vmeutils/unilib.h     
vmeutils/unilib.cpp   
vmeutils/vmeutils.cpp 
vmeutils/README       

2.3 Compile the VMELinux components

Enter the "ca91c042" directory and make the VMELinux device driver module.

make

Now you must create the several /dev driver files. Type:

make devices

Once made, you should see the file "ca91c042.o" in the directory. This is a loadable module. See below for loading information. Plus, you should find several "vme..." files in the /dev directory.

Once the devices are made in the /dev directory you must change their permissions. Type:

cd /dev
chmod 666 vme*
Here is how the files should look:
hostname:/dev# ls -l vme*                                           
crw-rw-rw-   1 root     root      70,   8 Jul 30 10:51 vme_ctl    
crw-rw-rw-   1 root     root      70,   0 Jul 30 10:51 vme_m0     
crw-rw-rw-   1 root     root      70,   1 Jul 30 10:51 vme_m1     
crw-rw-rw-   1 root     root      70,   2 Jul 30 10:51 vme_m2     
crw-rw-rw-   1 root     root      70,   3 Jul 30 10:51 vme_m3     
crw-rw-rw-   1 root     root      70,   4 Jul 30 10:51 vme_s0     
crw-rw-rw-   1 root     root      70,   5 Jul 30 10:51 vme_s1     
crw-rw-rw-   1 root     root      70,   6 Jul 30 10:51 vme_s2     
crw-rw-rw-   1 root     root      70,   7 Jul 30 10:51 vme_s3     
hostname:/dev#                                                      

Change to the "vmeutils" directory and type make there.

make

This will compile the "vmeutils" program. This program directly speaks to the kernel driver. It is a reference work for those of you who wish to write your own programs to directly speak with the driver.

Copy the program "vmeutils" to your user binary directory. On our system this is "/usr/local/bin." Alternatively, you can create a link in the user bin directory to the "vmeutils" program.

Change to the "vmeshell" directory. There are no files to be compiled here. These are shell programs that use the "vmeutils" program to access the VMEbus. All the files beginning with "vme" should with have a link made or be copied to the "/usr/local/bin" directory.

You are now ready to try the driver.

2.4 Load the VMELinux Kernel Module

Make sure you are root and insert "load" the VMELinux Kernel Module for the Universe chip by typing...

insmod ca91c042

Or just type "ins" to let the shell script do this for you. Once complete, type...

stat
You should see a list of registers displayed on your screen. Something like this...
Universe driver info:                                  
  Control Pointer = 0000                               
  Stats  reads = 0  writes = 0  ioctls = 0             
  LSI0_CTL = 00800000    LSI1_CTL = 00800000           
  LSI0_BS  = C0000000    LSI1_BS  = 00000000           
  LSI0_BD  = C0010000    LSI1_BD  = 00000000           
  LSI0_TO  = 40009000    LSI1_TO  = 00000000           
  LSI2_CTL = 00800000    LSI3_CTL = 00800000           
  LSI2_BS  = 00000000    LSI3_BS  = 00000000           
  LSI2_BD  = 00000000    LSI3_BD  = 00000000           
  LSI2_TO  = 00000000    LSI3_TO  = 00000000           
  image_va0   = 00000000     image_va1   = 00000000    
  image_va2   = 00000000     image_va3   = 00000000    
                                                       
Driver Program Status:                                 
  DMACTL 0    = 00000000 DMACTL 1    = 00000000        
  DMACTL 2    = 00000000 DMACTL 3    = 00000000        
  OkToWrite 0 = 0        OkToWrite 1 = 0               
  OkToWrite 2 = 0        OkToWrite 3 = 0               
  Mode 0      = 0        Mode 1      = 0               
  Mode 2      = 0        Mode 3      = 0               
If not, something went wrong.

2.5 Difficulties

The Universe driver does a good job of finding the Universe chip on a PCI bus, but differences in board design may prevent this. We tested all our routines on a Xycom XVME-655 board. There is little reason why this should not work on any other Intel board with a PCI bus and the Universe PCI-VME bridge chip. If you encounter problems, please let us know at the The VMELinux Project


3. How to talk to the VMEbus with the VMEUtils and the VMEShell Packages

3.1 What is the VMEUtils program

This program can be run as is. Once started, you will see a command prompt. Type ? And you will see a list of commands. While useful, I think you will find the VMEShell scripts a better way to go. They do use this program to speak with the kernel driver so it is necessary to have this program available in the current PATH.

The source code for "vmeutils" is also instruction on how to speak directly to the kernel driver. For those of you who wish to create programs that directly speak with the driver, these source files are good examples.

3.2 What are the VMEShell Scripts

The VMEShell programs are unix shell scripts. They offer the operator a simple way to access the data on a VMEbus. Using these commands creates temporary files in the user's working directory which store information on the last access you did. This is nice because it will be possible to log off the machine, log back in and proceed from where you left off without having to re-enter VMEbus information again. Plus, these files are stored in the current working directory, so you can have different VME access configuration just by setting up different directories for each VME board of interest.

Assuming you placed the shell programs and the "vmeutils" program in the /usr/local/bin directory, you should be able to log in as a regular user and run them. What follows assumes exactly this.

3.3 The "vmemap" command.

Login as a regular user and create a directory to experiment with. Once in this directory type:

vmemap
You should get a help screen like this...
Usage:  map address count space size type                   
  where address is VME Address to set Universe image to     
                                                            
    Space = 0 CR/CSR    Space = 1 A16                       
    Space = 2 A24       Space = 3 A32                       
                                                            
    Size  = 1 8 bit     Size  = 2 16 bit                    
    Size  = 3 32 bit    Size  = 4 64 bit                    
                                                            
    Type  = 0 USR/DATA  Type  = 1 USR/PRG                   
    Type  = 2 SUP/DATA  Type  = 3 SUP/PRG                   
This is where you tell VMELinux how you want to access the VMEbus. We assume you already know about the VMEbus' many modes of operation, but here is a short list to help you. Typing...
vmemap 0x8000 0x100 1 2 0
sets up the VMELinux driver to access an A16 board at base address 8000 Hex with a range of 100H bytes with 16 bit data width and USR/DATA mode.

You will find two new files in your current directory.

fa.vme stores a "fixed adder" value that will be added to all subsequent accesses with the programs below.

map.vme store the parameters above so you do not have to enter them every time.

All the following shell utilities read values from these two files to performs VME accesses.

3.4 Read Byte, Word or Long

Syntax:

3.5 Write Byte, Word or Long

Syntax:

3.6 Read the VMEbus to a file

Syntax:

3.7 Write a file to the VMEbus

Syntax:

3.8 Parameters

There are several parameters used with these commands: address, size and filename.

3.9 Options

Available options are defined with a single dash with the any combination of the following:

3.10 A Note about DMA mode.

VMELinux offers access to all the features of the Universe Chip. Especially useful is access to the DMA engine on the chip. With this feature the Universe chip transfers data on the PCI bus by becoming a PCI master. This is nice, but the real benefit comes from the VMEbus accesses. Even if the VMEbus interface is not using block mode transfers, the Universe chip can complete VMEbus transfers under 400 nanoseconds sustained. This is the direct result of the Universe taking complete control of both the PCI bus and the VMEbus. Thus, it is possible to access non block mode VMEbus peripherals much faster than older technologies.


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

4.1 The device drivers used with VMELinux

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 four 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

4.3 VMESlave Device Drivers

/dev/vme_s* are drivers used to allow another VMEbus master to access this device.

The Universe chip offers the programmer four 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

Slave VME modes are not yet supported by VMELinux.

4.4 Direct Control of the Universe Registers

/dev/vme_ioctl 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:

4.6 write()

write(vme_handle,buf,len);

Where:

4.7 lseek()

lseek(vme_handle,vme_pnt,Seek_Type);

Where:

4.8 ioctl()

ioctl(vme_handle, command, argument);

Where:

And:

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.


5. Advantages of the VMEbus, Linux and VMELinux

5.1 Pin and socket connectors

The VMEbus standard uses pin and socket connectors. This is superior to edge connections in that the connection is not exposed to humidity and other environmental conditions. It is a more expensive way of doing things, but offers longer times before failure.

5.2 Eurocard assembly

A VMEboard is either a 3U (160 x 100 mm) or a 6U size (160 x 233.35 mm). These sizes correspond to the Eurocard standard for board modules and card cages. Eurocard is a popular format used by many different busses including CompactPCI. This popularity makes the materials needed for cage assembly inexpensive and easy to obtain.

5.3 Linux is Low Cost

The nature of Linux is in its user supported and freely available format. The number of people using Linux is growing. The number of people contributing to the continued development of the Linux software base is growing. It is unfair to state that Linux is a good value because it is available for little to no charge. Linux is a good value because it works.

5.4 Linux is Stable

There are those who say that Linux us an unstable operating system. It is true that the new Linux kernels in development are experimental and should not be relied on for critical applications. However, stable versions of the Linux OS are always available and provide very stable operation. VMELinux is always based on the stable versions of the kernel source; Today's stable kernels are the 2.0.X series.

5.5 Linux is Dynamic

Because so many people are developing Linux, you do not have to wait long for improvements, fixes or new features to become part of the Linux distribution.


6. Current and planned Board Support

While the VMELinux driver should work with any PCI based design, the following boards have actually run our software.

6.1 Xycom XVME655 Pentium VMEbus Board

6.2 XyCom XVME656 Pentium VMEBus Board

6.3 Dynatem DPC1-0367

6.4 Planned Board Support

If you do not see VMELinux support for your board let us know. Maybe the manufacture will lend us a board for development.


7. Conclusion

VMELinux offers the user a low cost way to implement a VMEbus system quickly, reliably and with all the advantages of a unix environment. We are using VMELinux in our projects so you can be sure future developments will come quick. On the drawing board for this year are:

This document outlines the steps you need to install the VMELinux Kernel Driver into the example Xycom XVME-655 Pentium VME board. It is our hope that others will attempt installation of VMELinux into other boards and let us know their success.

Mail any responses to The VMELinux Project. If you have a question or an update to the document let us know and we will add it.


8. FAQ

8.1 The Shell utilities return a bunch of stars (*) when I access a board I know is there. What gives?

Check to be sure the /dev/vme... files have their permissions set to 666. If not, the shell utilities will return a * in place of data to indicate an error condition similar to a VME bus error.

8.2 How does VMELinux handle interrupts?

Right now it doesn't. However, we are planning to get that part going soon. Please be patient.

8.3 I have RedHat 5.1 and can't get VMELinux programs to compile.

RedHat 5.1 includes a new compiler. If you manually edit the Makefile in each directory to call up the new egcs compiler, things should compile. We fully intend to support RedHat 5.1 installations, but for now I suggest using 5.0 or Slackware.