VME Device Drivers

Driver registration

As with other subsystems within the Linux kernel, VME device drivers registerwith the VME subsystem, typically called from the devices init routine. This isachieved via a call tovme_register_driver().

A pointer to a structure of typestructvme_driver mustbe provided to the registration function. Along with the maximum number ofdevices your driver is able to support.

At the minimum, the ‘.name’, ‘.match’ and ‘.probe’ elements ofstructvme_driver should be correctly set. The ‘.name’element is a pointer to a string holding the device driver’s name.

The ‘.match’ function allows control over which VME devices should be registeredwith the driver. The match function should return 1 if a device should beprobed and 0 otherwise. This example match function (from vme_user.c) limitsthe number of devices probed to one:

#define USER_BUS_MAX    1...staticintvme_user_match(structvme_dev*vdev){if(vdev->id.num>=USER_BUS_MAX)return0;return1;}

The ‘.probe’ element should contain a pointer to the probe routine. Theprobe routine is passed astructvme_dev pointer as anargument.

Here, the ‘num’ field refers to the sequential device ID for this specificdriver. The bridge number (or bus number) can be accessed usingdev->bridge->num.

A function is also provided to unregister the driver from the VME core calledvme_unregister_driver() and should usually be called from the devicedriver’s exit routine.

Resource management

Once a driver has registered with the VME core the provided match routine willbe called the number of times specified during the registration. If a matchsucceeds, a non-zero value should be returned. A zero return value indicatesfailure. For all successful matches, the probe routine of the correspondingdriver is called. The probe routine is passed a pointer to the devicesdevice structure. This pointer should be saved, it will be required forrequesting VME resources.

The driver can request ownership of one or more master windows(vme_master_request()), slave windows (vme_slave_request())and/or dma channels (vme_dma_request()). Rather than allowing the devicedriver to request a specific window or DMA channel (which may be used by adifferent driver) the API allows a resource to be assigned based on the requiredattributes of the driver in question. For slave windows these attributes aresplit into the VME address spaces that need to be accessed in ‘aspace’ and VMEbus cycle types required in ‘cycle’. Master windows add a further set ofattributes in ‘width’ specifying the required data transfer widths. Theseattributes are defined as bitmasks and as such any combination of theattributes can be requested for a single window, the core will assign a windowthat meets the requirements, returning a pointer of type vme_resource thatshould be used to identify the allocated resource when it is used. For DMAcontrollers, the request function requires the potential direction of anytransfers to be provided in the route attributes. This is typically VME-to-MEMand/or MEM-to-VME, though some hardware can support VME-to-VME and MEM-to-MEMtransfers as well as test pattern generation. If an unallocated window fittingthe requirements can not be found a NULL pointer will be returned.

Functions are also provided to free window allocations once they are no longerrequired. These functions (vme_master_free(),vme_slave_free()andvme_dma_free()) should be passed the pointer to the resourceprovided during resource allocation.

Master windows

Master windows provide access from the local processor[s] out onto the VME bus.The number of windows available and the available access modes is dependent onthe underlying chipset. A window must be configured before it can be used.

Master window configuration

Once a master window has been assignedvme_master_set() can be used toconfigure it andvme_master_get() to retrieve the current settings. Theaddress spaces, transfer widths and cycle types are the same as describedunder resource management, however some of the options are mutually exclusive.For example, only one address space may be specified.

Master window access

The functionvme_master_read() can be used to read from andvme_master_write() used to write to configured master windows.

In addition to simple reads and writes,vme_master_rmw() is provided todo a read-modify-write transaction. Parts of a VME window can also be mappedinto user space memory usingvme_master_mmap().

Slave windows

Slave windows provide devices on the VME bus access into mapped portions of thelocal memory. The number of windows available and the access modes that can beused is dependent on the underlying chipset. A window must be configured beforeit can be used.

Slave window configuration

Once a slave window has been assignedvme_slave_set() can be used toconfigure it andvme_slave_get() to retrieve the current settings.

The address spaces, transfer widths and cycle types are the same as describedunder resource management, however some of the options are mutually exclusive.For example, only one address space may be specified.

Slave window buffer allocation

Functions are provided to allow the user to allocate(vme_alloc_consistent()) and free (vme_free_consistent())contiguous buffers which will be accessible by the VME bridge. These functionsdo not have to be used, other methods can be used to allocate a buffer, thoughcare must be taken to ensure that they are contiguous and accessible by the VMEbridge.

Slave window access

Slave windows map local memory onto the VME bus, the standard methods foraccessing memory should be used.

DMA channels

The VME DMA transfer provides the ability to run link-list DMA transfers. TheAPI introduces the concept of DMA lists. Each DMA list is a link-list which canbe passed to a DMA controller. Multiple lists can be created, extended,executed, reused and destroyed.

List Management

The functionvme_new_dma_list() is provided to create andvme_dma_list_free() to destroy DMA lists. Execution of a list will notautomatically destroy the list, thus enabling a list to be reused for repetitivetasks.

List Population

An item can be added to a list usingvme_dma_list_add() (the source anddestination attributes need to be created before calling this function, this iscovered under “Transfer Attributes”).

Note

The detailed attributes of the transfers source and destinationare not checked until an entry is added to a DMA list, the requestfor a DMA channel purely checks the directions in which thecontroller is expected to transfer data. As a result it ispossible for this call to return an error, for example if thesource or destination is in an unsupported VME address space.

Transfer Attributes

The attributes for the source and destination are handled separately from addingan item to a list. This is due to the diverse attributes required for each typeof source and destination. There are functions to create attributes for PCI, VMEand pattern sources and destinations (where appropriate):

The functionvme_dma_free_attribute() should be used to free anattribute.

List Execution

The functionvme_dma_list_exec() queues a list for execution and willreturn once the list has been executed.

Interrupts

The VME API provides functions to attach and detach callbacks to specific VMElevel and status ID combinations and for the generation of VME interrupts withspecific VME level and status IDs.

Attaching Interrupt Handlers

The functionvme_irq_request() can be used to attach andvme_irq_free() to free a specific VME level and status ID combination.Any given combination can only be assigned a single callback function. A voidpointer parameter is provided, the value of which is passed to the callbackfunction, the use of this pointer is user undefined. The callback parameters areas follows. Care must be taken in writing a callback function, callbackfunctions run in interrupt context:

voidcallback(intlevel,intstatid,void*priv);

Interrupt Generation

The functionvme_irq_generate() can be used to generate a VME interruptat a given VME level and VME status ID.

Location monitors

The VME API provides the following functionality to configure the locationmonitor.

Location Monitor Management

The functionvme_lm_request() is provided to request the use of a blockof location monitors andvme_lm_free() to free them after they are nolonger required. Each block may provide a number of location monitors,monitoring adjacent locations. The functionvme_lm_count() can be usedto determine how many locations are provided.

Location Monitor Configuration

Once a bank of location monitors has been allocated, the functionvme_lm_set() is provided to configure the location and mode of thelocation monitor. The functionvme_lm_get() can be used to retrieveexisting settings.

Location Monitor Use

The functionvme_lm_attach() enables a callback to be attached andvme_lm_detach() allows on to be detached from each location monitorlocation. Each location monitor can monitor a number of adjacent locations. Thecallback function is declared as follows.

voidcallback(void*data);

Slot Detection

The functionvme_slot_num() returns the slot ID of the provided bridge.

Bus Detection

The functionvme_bus_num() returns the bus ID of the provided bridge.

VME API

structvme_dev

Structure representing a VME device

Definition

struct vme_dev {  int num;  struct vme_bridge *bridge;  struct device dev;  struct list_head drv_list;  struct list_head bridge_list;};

Members

num
The device number
bridge
Pointer to the bridge device this device is on
dev
Internal device structure
drv_list
List of devices (per driver)
bridge_list
List of devices (per bridge)
structvme_driver

Structure representing a VME driver

Definition

struct vme_driver {  const char *name;  int (*match)(struct vme_dev *);  int (*probe)(struct vme_dev *);  int (*remove)(struct vme_dev *);  struct device_driver driver;  struct list_head devices;};

Members

name
Driver name, should be unique among VME drivers and usually the sameas the module name.
match
Callback used to determine whether probe should be run.
probe
Callback for device binding, called when new device is detected.
remove
Callback, called on device removal.
driver
Underlying generic device driver structure.
devices
List of VME devices (struct vme_dev) associated with this driver.
void *vme_alloc_consistent(struct vme_resource * resource, size_t size, dma_addr_t * dma)

Allocate contiguous memory.

Parameters

structvme_resource*resource
Pointer to VME resource.
size_tsize
Size of allocation required.
dma_addr_t*dma
Pointer to variable to store physical address of allocation.

Description

Allocate a contiguous block of memory for use by the driver. This is used tocreate the buffers for the slave windows.

Return

Virtual address of allocation on success, NULL on failure.

voidvme_free_consistent(struct vme_resource * resource, size_t size, void * vaddr, dma_addr_t dma)

Free previously allocated memory.

Parameters

structvme_resource*resource
Pointer to VME resource.
size_tsize
Size of allocation to free.
void*vaddr
Virtual address of allocation.
dma_addr_tdma
Physical address of allocation.

Description

Free previously allocated block of contiguous memory.

size_tvme_get_size(struct vme_resource * resource)

Helper function returning size of a VME window

Parameters

structvme_resource*resource
Pointer to VME slave or master resource.

Description

Determine the size of the VME window provided. This is a helperfunction, wrappering the call to vme_master_get or vme_slave_getdepending on the type of window resource handed to it.

Return

Size of the window on success, zero on failure.

struct vme_resource *vme_slave_request(structvme_dev * vdev, u32 address, u32 cycle)

Request a VME slave window resource.

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.
u32address
Required VME address space.
u32cycle
Required VME data transfer cycle type.

Description

Request use of a VME window resource capable of being set for the requestedaddress space and data transfer cycle.

Return

Pointer to VME resource on success, NULL on failure.

intvme_slave_set(struct vme_resource * resource, int enabled, unsigned long long vme_base, unsigned long long size, dma_addr_t buf_base, u32 aspace, u32 cycle)

Set VME slave window configuration.

Parameters

structvme_resource*resource
Pointer to VME slave resource.
intenabled
State to which the window should be configured.
unsignedlonglongvme_base
Base address for the window.
unsignedlonglongsize
Size of the VME window.
dma_addr_tbuf_base
Based address of buffer used to provide VME slave window storage.
u32aspace
VME address space for the VME window.
u32cycle
VME data transfer cycle type for the VME window.

Description

Set configuration for provided VME slave window.

Return

Zero on success, -EINVAL if operation is not supported on this
device, if an invalid resource has been provided or invalidattributes are provided. Hardware specific errors may also bereturned.
intvme_slave_get(struct vme_resource * resource, int * enabled, unsigned long long * vme_base, unsigned long long * size, dma_addr_t * buf_base, u32 * aspace, u32 * cycle)

Retrieve VME slave window configuration.

Parameters

structvme_resource*resource
Pointer to VME slave resource.
int*enabled
Pointer to variable for storing state.
unsignedlonglong*vme_base
Pointer to variable for storing window base address.
unsignedlonglong*size
Pointer to variable for storing window size.
dma_addr_t*buf_base
Pointer to variable for storing slave buffer base address.
u32*aspace
Pointer to variable for storing VME address space.
u32*cycle
Pointer to variable for storing VME data transfer cycle type.

Description

Return configuration for provided VME slave window.

Return

Zero on success, -EINVAL if operation is not supported on this
device or if an invalid resource has been provided.
voidvme_slave_free(struct vme_resource * resource)

Free VME slave window

Parameters

structvme_resource*resource
Pointer to VME slave resource.

Description

Free the provided slave resource so that it may be reallocated.

struct vme_resource *vme_master_request(structvme_dev * vdev, u32 address, u32 cycle, u32 dwidth)

Request a VME master window resource.

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.
u32address
Required VME address space.
u32cycle
Required VME data transfer cycle type.
u32dwidth
Required VME data transfer width.

Description

Request use of a VME window resource capable of being set for the requestedaddress space, data transfer cycle and width.

Return

Pointer to VME resource on success, NULL on failure.

intvme_master_set(struct vme_resource * resource, int enabled, unsigned long long vme_base, unsigned long long size, u32 aspace, u32 cycle, u32 dwidth)

Set VME master window configuration.

Parameters

structvme_resource*resource
Pointer to VME master resource.
intenabled
State to which the window should be configured.
unsignedlonglongvme_base
Base address for the window.
unsignedlonglongsize
Size of the VME window.
u32aspace
VME address space for the VME window.
u32cycle
VME data transfer cycle type for the VME window.
u32dwidth
VME data transfer width for the VME window.

Description

Set configuration for provided VME master window.

Return

Zero on success, -EINVAL if operation is not supported on this
device, if an invalid resource has been provided or invalidattributes are provided. Hardware specific errors may also bereturned.
intvme_master_get(struct vme_resource * resource, int * enabled, unsigned long long * vme_base, unsigned long long * size, u32 * aspace, u32 * cycle, u32 * dwidth)

Retrieve VME master window configuration.

Parameters

structvme_resource*resource
Pointer to VME master resource.
int*enabled
Pointer to variable for storing state.
unsignedlonglong*vme_base
Pointer to variable for storing window base address.
unsignedlonglong*size
Pointer to variable for storing window size.
u32*aspace
Pointer to variable for storing VME address space.
u32*cycle
Pointer to variable for storing VME data transfer cycle type.
u32*dwidth
Pointer to variable for storing VME data transfer width.

Description

Return configuration for provided VME master window.

Return

Zero on success, -EINVAL if operation is not supported on this
device or if an invalid resource has been provided.
ssize_tvme_master_read(struct vme_resource * resource, void * buf, size_t count, loff_t offset)

Read data from VME space into a buffer.

Parameters

structvme_resource*resource
Pointer to VME master resource.
void*buf
Pointer to buffer where data should be transferred.
size_tcount
Number of bytes to transfer.
loff_toffset
Offset into VME master window at which to start transfer.

Description

Perform read of count bytes of data from location on VME bus which maps intothe VME master window at offset to buf.

Return

Number of bytes read, -EINVAL if resource is not a VME master
resource or read operation is not supported. -EFAULT returned ifinvalid offset is provided. Hardware specific errors may also bereturned.
ssize_tvme_master_write(struct vme_resource * resource, void * buf, size_t count, loff_t offset)

Write data out to VME space from a buffer.

Parameters

structvme_resource*resource
Pointer to VME master resource.
void*buf
Pointer to buffer holding data to transfer.
size_tcount
Number of bytes to transfer.
loff_toffset
Offset into VME master window at which to start transfer.

Description

Perform write of count bytes of data from buf to location on VME bus whichmaps into the VME master window at offset.

Return

Number of bytes written, -EINVAL if resource is not a VME master
resource or write operation is not supported. -EFAULT returned ifinvalid offset is provided. Hardware specific errors may also bereturned.
unsigned intvme_master_rmw(struct vme_resource * resource, unsigned int mask, unsigned int compare, unsigned int swap, loff_t offset)

Perform read-modify-write cycle.

Parameters

structvme_resource*resource
Pointer to VME master resource.
unsignedintmask
Bits to be compared and swapped in operation.
unsignedintcompare
Bits to be compared with data read from offset.
unsignedintswap
Bits to be swapped in data read from offset.
loff_toffset
Offset into VME master window at which to perform operation.

Description

Perform read-modify-write cycle on provided location:- Location on VME bus is read.- Bits selected by mask are compared with compare.- Where a selected bit matches that in compare and are selected in swap,the bit is swapped.- Result written back to location on VME bus.

Return

Bytes written on success, -EINVAL if resource is not a VME master
resource or RMW operation is not supported. Hardware specificerrors may also be returned.
intvme_master_mmap(struct vme_resource * resource, struct vm_area_struct * vma)

Mmap region of VME master window.

Parameters

structvme_resource*resource
Pointer to VME master resource.
structvm_area_struct*vma
Pointer to definition of user mapping.

Description

Memory map a region of the VME master window into user space.

Return

Zero on success, -EINVAL if resource is not a VME master
resource or -EFAULT if map exceeds window size. Other generic mmaperrors may also be returned.
voidvme_master_free(struct vme_resource * resource)

Free VME master window

Parameters

structvme_resource*resource
Pointer to VME master resource.

Description

Free the provided master resource so that it may be reallocated.

struct vme_resource *vme_dma_request(structvme_dev * vdev, u32 route)

Request a DMA controller.

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.
u32route
Required src/destination combination.

Description

Request a VME DMA controller with capability to perform transfers bewteenrequested source/destination combination.

Return

Pointer to VME DMA resource on success, NULL on failure.

struct vme_dma_list *vme_new_dma_list(struct vme_resource * resource)

Create new VME DMA list.

Parameters

structvme_resource*resource
Pointer to VME DMA resource.

Description

Create a new VME DMA list. It is the responsibility of the user to freethe list once it is no longer required withvme_dma_list_free().

Return

Pointer to new VME DMA list, NULL on allocation failure or invalid
VME DMA resource.
struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type)

Create “Pattern” type VME DMA list attribute.

Parameters

u32pattern
Value to use used as pattern
u32type
Type of pattern to be written.

Description

Create VME DMA list attribute for pattern generation. It is theresponsibility of the user to free used attributes usingvme_dma_free_attribute().

Return

Pointer to VME DMA attribute, NULL on failure.

struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address)

Create “PCI” type VME DMA list attribute.

Parameters

dma_addr_taddress
PCI base address for DMA transfer.

Description

Create VME DMA list attribute pointing to a location on PCI for DMAtransfers. It is the responsibility of the user to free used attributesusingvme_dma_free_attribute().

Return

Pointer to VME DMA attribute, NULL on failure.

struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address, u32 aspace, u32 cycle, u32 dwidth)

Create “VME” type VME DMA list attribute.

Parameters

unsignedlonglongaddress
VME base address for DMA transfer.
u32aspace
VME address space to use for DMA transfer.
u32cycle
VME bus cycle to use for DMA transfer.
u32dwidth
VME data width to use for DMA transfer.

Description

Create VME DMA list attribute pointing to a location on the VME bus for DMAtransfers. It is the responsibility of the user to free used attributesusingvme_dma_free_attribute().

Return

Pointer to VME DMA attribute, NULL on failure.

voidvme_dma_free_attribute(struct vme_dma_attr * attributes)

Free DMA list attribute.

Parameters

structvme_dma_attr*attributes
Pointer to DMA list attribute.

Description

Free VME DMA list attribute. VME DMA list attributes can be safely freedoncevme_dma_list_add() has returned.

intvme_dma_list_add(struct vme_dma_list * list, struct vme_dma_attr * src, struct vme_dma_attr * dest, size_t count)

Add enty to a VME DMA list.

Parameters

structvme_dma_list*list
Pointer to VME list.
structvme_dma_attr*src
Pointer to DMA list attribute to use as source.
structvme_dma_attr*dest
Pointer to DMA list attribute to use as destination.
size_tcount
Number of bytes to transfer.

Description

Add an entry to the provided VME DMA list. Entry requires pointers to sourceand destination DMA attributes and a count.

Please note, the attributes supported as source and destinations fortransfers are hardware dependent.

Return

Zero on success, -EINVAL if operation is not supported on this
device or if the link list has already been submitted for execution.Hardware specific errors also possible.
intvme_dma_list_exec(struct vme_dma_list * list)

Queue a VME DMA list for execution.

Parameters

structvme_dma_list*list
Pointer to VME list.

Description

Queue the provided VME DMA list for execution. The call will return once thelist has been executed.

Return

Zero on success, -EINVAL if operation is not supported on this
device. Hardware specific errors also possible.
intvme_dma_list_free(struct vme_dma_list * list)

Free a VME DMA list.

Parameters

structvme_dma_list*list
Pointer to VME list.

Description

Free the provided DMA list and all its entries.

Return

Zero on success, -EINVAL on invalid VME resource, -EBUSY if resource
is still in use. Hardware specific errors also possible.
intvme_dma_free(struct vme_resource * resource)

Free a VME DMA resource.

Parameters

structvme_resource*resource
Pointer to VME DMA resource.

Description

Free the provided DMA resource so that it may be reallocated.

Return

Zero on success, -EINVAL on invalid VME resource, -EBUSY if resource
is still active.
intvme_irq_request(structvme_dev * vdev, int level, int statid, void (*callback)(int, int, void *), void * priv_data)

Request a specific VME interrupt.

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.
intlevel
Interrupt priority being requested.
intstatid
Interrupt vector being requested.
void(*)(int,int,void*)callback
Pointer to callback function called when VME interrupt/vectorreceived.
void*priv_data
Generic pointer that will be passed to the callback function.

Description

Request callback to be attached as a handler for VME interrupts with providedlevel and statid.

Return

Zero on success, -EINVAL on invalid vme device, level or if the
function is not supported, -EBUSY if the level/statid combination isalready in use. Hardware specific errors also possible.
voidvme_irq_free(structvme_dev * vdev, int level, int statid)

Free a VME interrupt.

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.
intlevel
Interrupt priority of interrupt being freed.
intstatid
Interrupt vector of interrupt being freed.

Description

Remove previously attached callback from VME interrupt priority/vector.

intvme_irq_generate(structvme_dev * vdev, int level, int statid)

Generate VME interrupt.

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.
intlevel
Interrupt priority at which to assert the interrupt.
intstatid
Interrupt vector to associate with the interrupt.

Description

Generate a VME interrupt of the provided level and with the providedstatid.

Return

Zero on success, -EINVAL on invalid vme device, level or if the
function is not supported. Hardware specific errors also possible.
struct vme_resource *vme_lm_request(structvme_dev * vdev)

Request a VME location monitor

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.

Description

Allocate a location monitor resource to the driver. A location monitorallows the driver to monitor accesses to a contiguous number ofaddresses on the VME bus.

Return

Pointer to a VME resource on success or NULL on failure.

intvme_lm_count(struct vme_resource * resource)

Determine number of VME Addresses monitored

Parameters

structvme_resource*resource
Pointer to VME location monitor resource.

Description

The number of contiguous addresses monitored is hardware dependent.Return the number of contiguous addresses monitored by thelocation monitor.

Return

Count of addresses monitored or -EINVAL when provided with an
invalid location monitor resource.
intvme_lm_set(struct vme_resource * resource, unsigned long long lm_base, u32 aspace, u32 cycle)

Configure location monitor

Parameters

structvme_resource*resource
Pointer to VME location monitor resource.
unsignedlonglonglm_base
Base address to monitor.
u32aspace
VME address space to monitor.
u32cycle
VME bus cycle type to monitor.

Description

Set the base address, address space and cycle type of accesses to bemonitored by the location monitor.

Return

Zero on success, -EINVAL when provided with an invalid location
monitor resource or function is not supported. Hardware specificerrors may also be returned.
intvme_lm_get(struct vme_resource * resource, unsigned long long * lm_base, u32 * aspace, u32 * cycle)

Retrieve location monitor settings

Parameters

structvme_resource*resource
Pointer to VME location monitor resource.
unsignedlonglong*lm_base
Pointer used to output the base address monitored.
u32*aspace
Pointer used to output the address space monitored.
u32*cycle
Pointer used to output the VME bus cycle type monitored.

Description

Retrieve the base address, address space and cycle type of accesses tobe monitored by the location monitor.

Return

Zero on success, -EINVAL when provided with an invalid location
monitor resource or function is not supported. Hardware specificerrors may also be returned.
intvme_lm_attach(struct vme_resource * resource, int monitor, void (*callback)(void *), void * data)

Provide callback for location monitor address

Parameters

structvme_resource*resource
Pointer to VME location monitor resource.
intmonitor
Offset to which callback should be attached.
void(*)(void*)callback
Pointer to callback function called when triggered.
void*data
Generic pointer that will be passed to the callback function.

Description

Attach a callback to the specificed offset into the location monitorsmonitored addresses. A generic pointer is provided to allow data to bepassed to the callback when called.

Return

Zero on success, -EINVAL when provided with an invalid location
monitor resource or function is not supported. Hardware specificerrors may also be returned.
intvme_lm_detach(struct vme_resource * resource, int monitor)

Remove callback for location monitor address

Parameters

structvme_resource*resource
Pointer to VME location monitor resource.
intmonitor
Offset to which callback should be removed.

Description

Remove the callback associated with the specificed offset into thelocation monitors monitored addresses.

Return

Zero on success, -EINVAL when provided with an invalid location
monitor resource or function is not supported. Hardware specificerrors may also be returned.
voidvme_lm_free(struct vme_resource * resource)

Free allocated VME location monitor

Parameters

structvme_resource*resource
Pointer to VME location monitor resource.

Description

Free allocation of a VME location monitor.

WARNING: This function currently expects that any callbacks that have
been attached to the location monitor have been removed.

Return

Zero on success, -EINVAL when provided with an invalid location
monitor resource.
intvme_slot_num(structvme_dev * vdev)

Retrieve slot ID

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.

Description

Retrieve the slot ID associated with the provided VME device.

Return

The slot ID on success, -EINVAL if VME bridge cannot be determined
or the function is not supported. Hardware specific errors may alsobe returned.
intvme_bus_num(structvme_dev * vdev)

Retrieve bus number

Parameters

structvme_dev*vdev
Pointer to VME device struct vme_dev assigned to driver instance.

Description

Retrieve the bus enumeration associated with the provided VME device.

Return

The bus number on success, -EINVAL if VME bridge cannot be
determined.
intvme_register_driver(structvme_driver * drv, unsigned int ndevs)

Register a VME driver

Parameters

structvme_driver*drv
Pointer to VME driver structure to register.
unsignedintndevs
Maximum number of devices to allow to be enumerated.

Description

Register a VME device driver with the VME subsystem.

Return

Zero on success, error value on registration failure.

voidvme_unregister_driver(structvme_driver * drv)

Unregister a VME driver

Parameters

structvme_driver*drv
Pointer to VME driver structure to unregister.

Description

Unregister a VME device driver from the VME subsystem.