VME Functions (mvme_xxx)
[Midas VME standard]


Functions

int EXPRT mvme_open (MVME_INTERFACE **vme, int index)
int EXPRT mvme_close (MVME_INTERFACE *vme)
int EXPRT mvme_sysreset (MVME_INTERFACE *vme)
int EXPRT mvme_read (MVME_INTERFACE *vme, void *dst, mvme_addr_t vme_addr, mvme_size_t n_bytes)
DWORD EXPRT mvme_read_value (MVME_INTERFACE *vme, mvme_addr_t vme_addr)
int EXPRT mvme_write (MVME_INTERFACE *vme, mvme_addr_t vme_addr, void *src, mvme_size_t n_bytes)
int EXPRT mvme_write_value (MVME_INTERFACE *vme, mvme_addr_t vme_addr, DWORD value)
int EXPRT mvme_set_am (MVME_INTERFACE *vme, int am)
int EXPRT mvme_get_am (MVME_INTERFACE *vme, int *am)
int EXPRT mvme_set_dmode (MVME_INTERFACE *vme, int dmode)
int EXPRT mvme_get_dmode (MVME_INTERFACE *vme, int *dmode)
int EXPRT mvme_set_blt (MVME_INTERFACE *vme, int mode)
int EXPRT mvme_get_blt (MVME_INTERFACE *vme, int *mode)


Function Documentation

int EXPRT mvme_close MVME_INTERFACE vme  ) 
 

Close and release ALL the opened VME channel. See example in mvme_open()

Parameters:
*vme VME structure.
Returns:
MVME_SUCCESS, MVME_ACCESS_ERROR

int EXPRT mvme_get_am MVME_INTERFACE vme,
int *  am
 

Get Address Modifier.

Parameters:
*vme VME structure
*am returned address modifier
Returns:
MVME_SUCCESS

int EXPRT mvme_get_blt MVME_INTERFACE vme,
int *  mode
 

Get current Data mode.

Parameters:
*vme VME structure
*mode returned BLT mode
Returns:
MVME_SUCCESS

int EXPRT mvme_get_dmode MVME_INTERFACE vme,
int *  dmode
 

Get current Data mode.

Parameters:
*vme VME structure
*dmode returned address modifier
Returns:
MVME_SUCCESS

int EXPRT mvme_interrupt_attach MVME_INTERFACE mvme,
int  level,
int  vector,
void(*)(int, void *, void *)  isr,
void *  info
 

int EXPRT mvme_interrupt_detach MVME_INTERFACE mvme,
int  level,
int  vector,
void *  info
 

int EXPRT mvme_interrupt_disable MVME_INTERFACE mvme,
int  level,
int  vector,
void *  info
 

int EXPRT mvme_interrupt_enable MVME_INTERFACE mvme,
int  level,
int  vector,
void *  info
 

int EXPRT mvme_interrupt_generate MVME_INTERFACE mvme,
int  level,
int  vector,
void *  info
 

int EXPRT mvme_open MVME_INTERFACE **  vme,
int  index
 

VME open The code below summarize the use of most of the mvme calls included in this interface.

#include "vmicvme.h"  // or other VME interface driver.

int main () {
  int i, status, vmeio_status, data;
  MVME_INTERFACE *myvme;

  // Open VME channel 
  status = mvme_open(&myvme, 0);

  // Reset VME 
  // Under VMIC reboot CPU!!
  //  status = mvme_sysreset(myvme);

  // Setup AM 
  status = mvme_set_am(myvme, MVME_AM_A24_ND);

  // Setup Data size 
  status = mvme_set_dmode(myvme, MVME_DMODE_D32);

  // Read VMEIO status 
  status = mvme_read(myvme, &vmeio_status, 0x78001C, 4); 
  printf("VMEIO status : 0x%x\n", vmeio_status);

  // Write Single value 
  mvme_write_value(myvme, 0x780010, 0x3);

  // Read Single Value 
  printf("Value : 0x%x\n", mvme_read_value(myvme, 0x780018));

  // Write to the VMEIO in latch mode 
  for (i=0;i<10000;i++) {
    data = 0xF;
    status = mvme_write(myvme, 0x780010, &data, 4);
    data = 0x0;
    status = mvme_write(myvme, 0x780010, &data, 4);
  }

  // Close VME channel 
  status = mvme_close(myvme);
  return 1;
}
Parameters:
**vme user VME pointer to the interface
index interface number should be used to distingush multiple VME interface access within the same program.
Returns:
status MVME_SUCCESS, MVME_NO_INTERFACE, MVME_INVALID_PARAM, MVME_ACCESS_ERROR

int EXPRT mvme_read MVME_INTERFACE vme,
void *  dst,
mvme_addr_t  vme_addr,
mvme_size_t  n_bytes
 

Read from VME bus. Implementation of the read can include automatic DMA transfer based on the size of the data. See example in mvme_open()

Parameters:
*vme VME structure
*dst destination pointer
vme_addr source address (VME location).
n_bytes requested transfer size.
Returns:
MVME_SUCCESS

DWORD EXPRT mvme_read_value MVME_INTERFACE vme,
mvme_addr_t  vme_addr
 

Read single data from VME bus. Useful for register access. See example in mvme_open()

Parameters:
*vme VME structure
vme_addr source address (VME location).
Returns:
MVME_SUCCESS

int EXPRT mvme_set_am MVME_INTERFACE vme,
int  am
 

Set Address Modifier.

Parameters:
*vme VME structure
am address modifier
Returns:
MVME_SUCCESS

int EXPRT mvme_set_blt MVME_INTERFACE vme,
int  mode
 

Set Block Transfer mode.

Parameters:
*vme VME structure
mode BLT mode
Returns:
MVME_SUCCESS

int EXPRT mvme_set_dmode MVME_INTERFACE vme,
int  dmode
 

Set Data mode.

Parameters:
*vme VME structure
dmode Data mode
Returns:
MVME_SUCCESS

int EXPRT mvme_sysreset MVME_INTERFACE vme  ) 
 

VME bus reset. Effect of the VME bus reset is dependent of the type of VME interface used. See example in mvme_open()

Parameters:
*vme VME structure.
Returns:
MVME_SUCCESS, MVME_ACCESS_ERROR

int EXPRT mvme_write MVME_INTERFACE vme,
mvme_addr_t  vme_addr,
void *  src,
mvme_size_t  n_bytes
 

Write data to VME bus. Implementation of the write can include automatic DMA transfer based on the size of the data. See example in mvme_open()

Parameters:
*vme VME structure
vme_addr source address (VME location).
*src source array
n_bytes size of the array in bytes
Returns:
MVME_SUCCESS

int EXPRT mvme_write_value MVME_INTERFACE vme,
mvme_addr_t  vme_addr,
DWORD  value
 

Write single data to VME bus. Useful for register access. See example in mvme_open()

Parameters:
*vme VME structure
vme_addr source address (VME location).
value Value to be written to the VME bus
Returns:
MVME_SUCCESS


Midas DOC Version 1.9.5 ---- PSI Stefan Ritt ----
Contributions: Pierre-Andre Amaudruz - Sergio Ballestrero - Suzannah Daviel - Doxygen - Peter Green - Qing Gu - Greg Hackman - Gertjan Hofman - Paul Knowles - Rudi Meier - Glenn Moloney - Dave Morris - John M O'Donnell - Konstantin Olchanski - Renee Poutissou - Tamsen Schurman - Andreas Suter - Jan M.Wouters - Piotr Adam Zolnierczuk