Back Midas Rome Roody Rootana
  Midas DAQ System  Not logged in ELOG logo
Entry  03 Aug 2009, Exaos Lee, Forum, How to distinguish the status and value returned from "mvme_read_value(...)" 
    Reply  03 Aug 2009, Stefan Ritt, Forum, How to distinguish the status and value returned from "mvme_read_value(...)" 
    Reply  03 Aug 2009, Konstantin Olchanski, Forum, How to distinguish the status and value returned from "mvme_read_value(...)" 
Message ID: 610     Entry time: 03 Aug 2009     In reply to: 609
Author: Stefan Ritt 
Topic: Forum 
Subject: How to distinguish the status and value returned from "mvme_read_value(...)" 

Exaos Lee wrote:
The definition of mvme_read_value is as the following:
unsigned int 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


Question: How to distinguish the status and value returned? Should the definition be something like
int EXPRT mvme_read_value(MVME_INTERFACE *mvme, mvme_addr_t vme_addr, unsigned int *var);


This function is a shortcut when you want something like
  printf("%d\n", mvme_read_value(...)); 

and you know that the status is ok. Without this function, you would need to define a variable
  unsigned long d;
  mvme_read_value(..., &d);
  printf("%d\n", d);

so the above function is just a handy shortcut. If you want to see the status however, you can call the "normal" function mvme_read:
  status = mvme_read(..., &d, adr, 4); 
ELOG V3.1.4-2e1708b5