Subversion Repositories f9daq

Compare Revisions

No changes between revisions

Ignore whitespace Rev 76 → Rev 77

/cvi/instr/CAENV1718/CAENV1718.fp
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/cvi/instr/CAENV1718/CAENV1718.h
0,0 → 1,111
#ifndef _CAEN_V1718_H
#define _CAEN_V1718_H
 
#include <CAENVMElib.h>
 
extern int32_t CAEN_udev;
 
 
int CAEN_VME_start (char*);
int CAEN_VME_close (int);
int CAEN_VME_stop (void);
int CAEN_VME_reset (void);
 
short __stdcall CAEN_VME_R( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
 
short __stdcall CAEN_VME_W( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
 
short __stdcall CAEN_VME_MW( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
short __stdcall CAEN_VME_MWRST( void );
short __stdcall CAEN_VME_MWEXEC( void );
 
short __stdcall CAEN_VME_MR( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
short __stdcall CAEN_VME_MRRST( void );
short __stdcall CAEN_VME_MREXEC( uint32_t *Data );
 
 
 
int CAEN_VME_BltRead(long Handle, unsigned long Address, void *Data,int size, CVAddressModifier AM, CVDataWidth DW);
 
 
short CAEN_VME_read(long Handle, unsigned long Address, void *Data, CVAddressModifier AM, CVDataWidth DW);
short CAEN_VME_write(long Handle, unsigned long Address, void *Data, CVAddressModifier AM, CVDataWidth DW);
 
short CAEN_VME_appendread(unsigned long Address, void *Data, CVAddressModifier AM, CVDataWidth DW);
short CAEN_VME_appendwrite(unsigned long Address, void *Data, CVAddressModifier AM, CVDataWidth DW);
 
short CAEN_VME_MultiReadReset( void);
short CAEN_VME_MultiWriteReset( void);
short CAEN_VME_MultiReadExecute(long Handle, uint32_t *Data);
short CAEN_VME_MultiWriteExecute(long Handle);
 
#define CAEN_VME_START(NODE) CAEN_VME_start((NODE))
#define CAEN_VME_STOP() CAENVME_End(CAEN_udev)
#define CAEN_VME_RESET() CAENVME_SystemReset(CAEN_udev)
 
#define CAEN_VME_A16D8_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA16_U_DATA, cvD8)
#define CAEN_VME_A16D16_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA16_U_DATA, cvD16)
#define CAEN_VME_A16D32_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA16_U_DATA, cvD32)
 
#define CAEN_VME_A24D8_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA24_U_DATA, cvD8)
#define CAEN_VME_A24D16_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA24_U_DATA, cvD16)
#define CAEN_VME_A24D32_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA24_U_DATA, cvD32)
 
#define CAEN_VME_A32D8_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA32_U_DATA, cvD8)
#define CAEN_VME_A32D16_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA32_U_DATA, cvD16)
#define CAEN_VME_A32D32_R(VME,DATA) CAEN_VME_read( CAEN_udev, (VME), (DATA) , cvA32_U_DATA, cvD32)
 
#define CAEN_VME_A16D8_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA16_U_DATA, cvD8)
#define CAEN_VME_A16D16_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA16_U_DATA, cvD16)
#define CAEN_VME_A16D32_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA16_U_DATA, cvD32)
 
#define CAEN_VME_A24D8_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA24_U_DATA, cvD8)
#define CAEN_VME_A24D16_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA24_U_DATA, cvD16)
#define CAEN_VME_A24D32_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA24_U_DATA, cvD32)
 
#define CAEN_VME_A32D8_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA32_U_DATA, cvD8)
#define CAEN_VME_A32D16_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA32_U_DATA, cvD16)
#define CAEN_VME_A32D32_W(VME,DATA) CAEN_VME_write( CAEN_udev, (VME), (DATA) , cvA32_U_DATA, cvD32)
 
 
 
#define CAEN_VME_A16D8_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA16_U_DATA, cvD8)
#define CAEN_VME_A16D16_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA16_U_DATA, cvD16)
#define CAEN_VME_A16D32_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA16_U_DATA, cvD32)
 
#define CAEN_VME_A24D8_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA24_U_DATA, cvD8)
#define CAEN_VME_A24D16_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA24_U_DATA, cvD16)
#define CAEN_VME_A24D32_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA24_U_DATA, cvD32)
 
#define CAEN_VME_A32D8_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA32_U_DATA, cvD8)
#define CAEN_VME_A32D16_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA32_U_DATA, cvD16)
#define CAEN_VME_A32D32_MR(VME,DATA) CAEN_VME_appendread( (VME), (DATA) , cvA32_U_DATA, cvD32)
 
#define CAEN_VME_A16D8_MW(VME,DATA) CAEN_VME_appendwrite( (VME), (DATA) , cvA16_U_DATA, cvD8)
#define CAEN_VME_A16D16_MW(VME,DATA) CAEN_VME_appendwrite( (VME), (DATA) , cvA16_U_DATA, cvD16)
#define CAEN_VME_A16D32_MW(VME,DATA) CAEN_VME_appendwrite( (VME), (DATA) , cvA16_U_DATA, cvD32)
 
#define CAEN_VMEA24D8_MW(VME,DATA) CAEN_VMEappendwrite( (VME), (DATA) , cvA24_U_DATA, cvD8)
#define CAEN_VMEA24D16_MW(VME,DATA) CAEN_VMEappendwrite( (VME), (DATA) , cvA24_U_DATA, cvD16)
#define CAEN_VMEA24D32_MW(VME,DATA) CAEN_VMEappendwrite( (VME), (DATA) , cvA24_U_DATA, cvD32)
 
#define CAEN_VMEA32D8_MW(VME,DATA) CAEN_VMEappendwrite( (VME), (DATA) , cvA32_U_DATA, cvD8)
#define CAEN_VMEA32D16_MW(VME,DATA) CAEN_VMEappendwrite( (VME), (DATA) , cvA32_U_DATA, cvD16)
#define CAEN_VMEA32D32_MW(VME,DATA) CAEN_VMEappendwrite( (VME), (DATA) , cvA32_U_DATA, cvD32)
 
#define CAEN_VMEMWRST() CAEN_VMEMultiWriteReset()
#define CAEN_VMEMWEXEC() CAEN_VMEMultiWriteExecute(CAEN_udev)
#define CAEN_VMEMRRST() CAEN_VMEMultiReadReset()
#define CAEN_VMEMREXEC(DATA) CAEN_VMEMultiReadExecute(CAEN_udev, (DATA) )
 
#define CAEN_VMEA32D16BLT_R(VME,DATA,SIZE) CAEN_VMEBltRead( CAEN_udev, (VME), (DATA) , (SIZE) , cvA32_U_BLT, cvD16)
#define CAEN_VMEA24D16BLT_R(VME,DATA,SIZE) CAEN_VMEBltRead( CAEN_udev, (VME), (DATA) , (SIZE) , cvA24_U_BLT, cvD16)
 
#define CAEN_VMEA32D32BLT_R(VME,DATA,SIZE) CAEN_VMEBltRead( CAEN_udev, (VME), (DATA) , (SIZE) , cvA32_U_BLT, cvD32)
#define CAEN_VMEA24D32BLT_R(VME,DATA,SIZE) CAEN_VMEBltRead( CAEN_udev, (VME), (DATA) , (SIZE) , cvA24_U_DATA, cvD32)
 
#define CAEN_VMEA24D32BLT_READ(VME,DATA,SIZE,COUNT) CAENVME_BLTReadCycle(CAEN_udev, (VME), (DATA), (SIZE), cvA24_U_BLT, cvD32 , (COUNT) )
 
 
#endif
/cvi/instr/CAENV1718/CAENVMEtypes.h
0,0 → 1,344
/*
-----------------------------------------------------------------------------
 
--- CAEN SpA - Computing Systems Division ---
 
-----------------------------------------------------------------------------
 
CAENVMEtypes.h
 
-----------------------------------------------------------------------------
 
Author: Stefano Coluccini (s.coluccini@caen.it)
 
Created: March 2004
 
-----------------------------------------------------------------------------
*/
#ifndef __CAENVMETYPES_H
#define __CAENVMETYPES_H
 
#ifdef LINUX
#define CAEN_BYTE unsigned char
#define CAEN_BOOL int
#else
#ifdef _CVI_
#define CAEN_BYTE unsigned char
#define CAEN_BOOL int
#else
 
#define CAEN_BYTE byte
#define CAEN_BOOL VARIANT_BOOL
 
#endif
#endif
 
 
/*
CAEN VME bridges.
*/
typedef enum CVBoardTypes {
cvV1718 = 0, /* CAEN V1718 USB-VME bridge */
cvV2718 = 1, /* V2718 PCI-VME bridge with optical link */
cvA2818 = 2, /* PCI board with optical link */
cvA2719 = 3, /* Optical link piggy-back */
cvA3818 = 4 /* PCIe board with up to 4 optical links */
} CVBoardTypes;
 
/*
VME cycles data width.
Ver. 2.2 - Added byte-swapping data widths
*/
typedef enum CVDataWidth {
cvD8 = 0x01, /* 8 bit */
cvD16 = 0x02, /* 16 bit */
cvD32 = 0x04, /* 32 bit */
cvD64 = 0x08, /* 64 bit */
cvD16_swapped = 0x12, /* 16 bit swapped */
cvD32_swapped = 0x14, /* 32 bit swapped */
cvD64_swapped = 0x18 /* 64 bit swapped */
} CVDataWidth;
 
/*
VME cycles address modifiers
*/
typedef enum CVAddressModifier {
cvA16_S = 0x2D, /* A16 supervisory access */
cvA16_U = 0x29, /* A16 non-privileged */
cvA16_LCK = 0x2C, /* A16 lock command */
 
cvA24_S_BLT = 0x3F, /* A24 supervisory block transfer */
cvA24_S_PGM = 0x3E, /* A24 supervisory program access */
cvA24_S_DATA = 0x3D, /* A24 supervisory data access */
cvA24_S_MBLT = 0x3C, /* A24 supervisory 64-bit block trnsfer */
cvA24_U_BLT = 0x3B, /* A24 non-privileged block transfer */
cvA24_U_PGM = 0x3A, /* A24 non-privileged program access */
cvA24_U_DATA = 0x39, /* A24 non-privileged data access */
cvA24_U_MBLT = 0x38, /* A24 non-privileged 64-bit block trnsfer */
cvA24_LCK = 0x32, /* A24 lock command */
 
cvA32_S_BLT = 0x0F, /* A32 supervisory block transfer */
cvA32_S_PGM = 0x0E, /* A32 supervisory program access */
cvA32_S_DATA = 0x0D, /* A32 supervisory data access */
cvA32_S_MBLT = 0x0C, /* A32 supervisory 64-bit block trnsfer */
cvA32_U_BLT = 0x0B, /* A32 non-privileged block transfer */
cvA32_U_PGM = 0x0A, /* A32 non-privileged program access */
cvA32_U_DATA = 0x09, /* A32 non-privileged data access */
cvA32_U_MBLT = 0x08, /* A32 non-privileged 64-bit block trnsfer */
cvA32_LCK = 0x05, /* A32 lock command */
 
cvCR_CSR = 0x2F, /* CR/CSR space */
 
/*
The following address modifiers are not yet implemented.
*/
 
cvA40_BLT = 0x37, /* A40 block transfer (MD32) */
cvA40_LCK = 0x35, /* A40 lock command */
cvA40 = 0x34, /* A40 access */
 
cvA64 = 0x01, /* A64 single trnsfer access */
cvA64_BLT = 0x03, /* A64 block transfer */
cvA64_MBLT = 0x00, /* A64 64-bit block transfer */
cvA64_LCK = 0x04, /* A64 lock command */
 
cvA3U_2eVME = 0x21, /* 2eVME for 3U modules */
cvA6U_2eVME = 0x20 /* 2eVME for 6U modules */
} CVAddressModifier;
 
/*
Error codes returned by the exported functions.
*/
typedef enum CVErrorCodes {
cvSuccess = 0, /* Operation completed successfully */
cvBusError = -1, /* VME bus error during the cycle */
cvCommError = -2, /* Communication error */
cvGenericError = -3, /* Unspecified error */
cvInvalidParam = -4, /* Invalid parameter */
cvTimeoutError = -5, /* Timeout error */
} CVErrorCodes;
 
/*
Pulser selection.
*/
typedef enum CVPulserSelect {
cvPulserA = 0, /* Identifies the pulser 'A' */
cvPulserB = 1 /* Identifies the pulser 'B' */
} CVPulserSelect;
 
/*
Output selection.
*/
typedef enum CVOutputSelect {
cvOutput0 = 0, /* Identifies the output line 0 */
cvOutput1 = 1, /* Identifies the output line 1 */
cvOutput2 = 2, /* Identifies the output line 2 */
cvOutput3 = 3, /* Identifies the output line 3 */
cvOutput4 = 4 /* Identifies the output line 4 */
} CVOutputSelect;
 
/*
Input selection.
*/
typedef enum CVInputSelect {
cvInput0 = 0, /* Identifies the input line 0 */
cvInput1 = 1 /* Identifies the input line 1 */
} CVInputSelect;
 
/*
Signal sources.
*/
typedef enum CVIOSources {
cvManualSW = 0, /* Manual (button) or software controlled */
cvInputSrc0 = 1, /* Input line 0 */
cvInputSrc1 = 2, /* Input line 1 */
cvCoincidence = 3, /* Inputs coincidence */
cvVMESignals = 4, /* Signals from VME bus */
cvMiscSignals = 6 /* Various internal signals */
} CVIOSources;
 
/*
Time base units to specify pulses period and width.
*/
typedef enum CVTimeUnits {
cvUnit25ns = 0, /* Time unit is 25 nanoseconds */
cvUnit1600ns = 1, /* Time unit is 1.6 microseconds */
cvUnit410us = 2, /* Time unit is 410 microseconds */
cvUnit104ms = 3 /* Time unit is 104 milliseconds */
} CVTimeUnits;
 
/*
Polarity for LED emitting.
*/
typedef enum CVLEDPolarity {
cvActiveHigh = 0, /* LED emits on signal high level */
cvActiveLow = 1 /* LED emits on signal low level */
} CVLEDPolarity;
 
/*
Input and Output signal polarity.
*/
typedef enum CVIOPolarity {
cvDirect = 0, /* Normal polarity */
cvInverted = 1 /* Inverted polarity */
} CVIOPolarity;
 
/*
Accessible registers.
*/
typedef enum CVRegisters {
cvStatusReg = 0x00, /* Status register */
cvVMEControlReg = 0x01, /* VME Control register */
cvFwRelReg = 0x02, /* Firmware Release register */
cvFwDldReg = 0x03, /* Firmware Download register */
cvFlenaReg = 0x04, /* Flash Enable */
cvVMEIRQEnaReg = 0x06, /* VME IRQ Lines Enable */
cvInputReg = 0x08, /* Input register */
cvOutRegSet = 0x0A, /* Output register */
cvInMuxRegSet = 0x0B, /* Input Multiplexer */
cvOutMuxRegSet = 0x0C, /* Output Multiplexer */
cvLedPolRegSet = 0x0D, /* Led Polarity */
cvOutRegClear = 0x10, /* Output register */
cvInMuxRegClear = 0x11, /* Input Multiplexer */
cvOutMuxRegClear = 0x12, /* Output Multiplexer */
cvLedPolRegClear = 0x13, /* Led Polarity */
cvPulserA0 = 0x16, /* Period and width of Pulser A */
cvPulserA1 = 0x17, /* Num pulses and range of Pulser A */
cvPulserB0 = 0x19, /* Period and width of Pulser B */
cvPulserB1 = 0x1A, /* Num pulses and range of Pulser B */
cvScaler0 = 0x1C, /* Limit and Autores of Scaler A */
cvScaler1 = 0x1D, /* Counter value of Scaler A */
cvDispADL = 0x20, /* Display AD[15:0] */
cvDispADH = 0x21, /* Display AD[31:16] */
cvDispDTL = 0x22, /* Display DT[15:0] */
cvDispDTH = 0x23, /* Display DT[31:16] */
cvDispC1 = 0x24, /* Display Control left bar */
cvDispC2 = 0x25, /* Display Control left bar */
cvLMADL = 0x28, /* Loc. Mon. AD[15:0] */
cvLMADH = 0x29, /* Loc. Mon. AD[31:16] */
cvLMC = 0x2C /* Loc. Mon. Controls */
} CVRegisters;
 
/*
Bits for status register decoding.
*/
typedef enum CVStatusRegisterBits {
cvSYSRES = 0x0001, /* VME is in system reset state */
cvSYSCTRL = 0x0002, /* The bridge is the VME system controller */
cvDTACK = 0x0010, /* Last access has generated a DTACK signal */
cvBERR = 0x0020, /* Last access has generated a bus error */
cvDIP0 = 0x0100, /* Dip Switch position 0 state */
cvDIP1 = 0x0200, /* Dip Switch position 1 state */
cvDIP2 = 0x0400, /* Dip Switch position 2 state */
cvDIP3 = 0x0800, /* Dip Switch position 3 state */
cvDIP4 = 0x1000, /* Dip Switch position 4 state */
cvUSBTYPE = 0x8000 /* USB Speed: 0 = Full; 1 = High */
} CVStatusRegisterBits;
 
/*
Bits for input register decoding.
*/
typedef enum CVInputRegisterBits {
cvIn0Bit = 0x0001, /* Input line 0 signal level. */
cvIn1Bit = 0x0002, /* Input line 1 signal level. */
cvCoincBit = 0x0004, /* Coincidence of input signal level. */
cvPulsAOutBit = 0x0008, /* Pulser A output signal level. */
cvPulsBOutBit = 0x0010, /* Pulser B output signal level. */
cvScalEndCntBit = 0x0020, /* Scaler end counter signal level. */
cvLocMonBit = 0x0040, /* Location monitor signal level. */
} CVInputRegisterBits;
 
/*
Bits for input register decoding.
*/
typedef enum CVOutputRegisterBits {
cvPulsAStartBit = 0x0001, /* Pulser A start signal level. */
cvPulsAResetBit = 0x0002, /* Pulser A reset signal level. */
cvPulsBStartBit = 0x0004, /* Pulser B start signal level. */
cvPulsBResetBit = 0x0008, /* Pulser B reset signal level. */
cvScalGateBit = 0x0010, /* Scaler gate signal level. */
cvScalResetBit = 0x0020, /* Scaler reset counter signal level. */
cvOut0Bit = 0x0040, /* Output line 0 signal level. */
cvOut1Bit = 0x0080, /* Output line 1 signal level. */
cvOut2Bit = 0x0100, /* Output line 2 signal level. */
cvOut3Bit = 0x0200, /* Output line 3 signal level. */
cvOut4Bit = 0x0400, /* Output line 4 signal level. */
} CVOutputRegisterBits;
 
/*
Types of VME Arbiter.
*/
typedef enum CVArbiterTypes {
cvPriorized = 0, /* Priority Arbiter */
cvRoundRobin = 1 /* Round-Robin Arbiter */
} CVArbiterTypes;
 
/*
Types of VME Bus Requester.
*/
typedef enum CVRequesterTypes {
cvFair = 0, /* Fair bus requester */
cvDemand = 1 /* On demand bus requester */
} CVRequesterTypes;
 
/*
Types of VME Bus release.
*/
typedef enum CVReleaseTypes {
cvRWD = 0, /* Release When Done */
cvROR = 1 /* Release On Request */
} CVReleaseTypes;
 
/*
VME bus request levels.
*/
typedef enum CVBusReqLevels {
cvBR0 = 0, /* Bus request level 0 */
cvBR1 = 1, /* Bus request level 1 */
cvBR2 = 2, /* Bus request level 2 */
cvBR3 = 3 /* Bus request level 3 */
} CVBusReqLevels;
 
/*
VME Interrupt levels.
*/
typedef enum CVIRQLevels {
cvIRQ1 = 0x01, /* Interrupt level 1 */
cvIRQ2 = 0x02, /* Interrupt level 2 */
cvIRQ3 = 0x04, /* Interrupt level 3 */
cvIRQ4 = 0x08, /* Interrupt level 4 */
cvIRQ5 = 0x10, /* Interrupt level 5 */
cvIRQ6 = 0x20, /* Interrupt level 6 */
cvIRQ7 = 0x40 /* Interrupt level 7 */
} CVIRQLevels;
 
/*
VME bus timeouts.
*/
typedef enum CVVMETimeouts {
cvTimeout50us = 0, /* Timeout is 50 microseconds */
cvTimeout400us = 1 /* Timeout is 400 microseconds */
} CVVMETimeouts;
 
/*
Data type to store the front panel display last access data.
*/
typedef struct CVDisplay {
long cvAddress; /* VME Address */
long cvData; /* VME Data */
long cvAM; /* Address modifier */
long cvIRQ; /* IRQ levels */
CAEN_BOOL cvDS0; /* Data Strobe 0 signal */
CAEN_BOOL cvDS1; /* Data Strobe 1 signal */
CAEN_BOOL cvAS; /* Address Strobe signal */
CAEN_BOOL cvIACK; /* Interrupt Acknowledge signal */
CAEN_BOOL cvWRITE; /* Write signal */
CAEN_BOOL cvLWORD; /* Long Word signal */
CAEN_BOOL cvDTACK; /* Data Acknowledge signal */
CAEN_BOOL cvBERR; /* Bus Error signal */
CAEN_BOOL cvSYSRES; /* System Reset signal */
CAEN_BOOL cvBR; /* Bus Request signal */
CAEN_BOOL cvBG; /* Bus Grant signal */
} CVDisplay;
 
#endif // __CAENVMETYPES_H
/cvi/instr/CAENV1718/CAENVMElib.h
0,0 → 1,1305
/*!
-----------------------------------------------------------------------------
 
--- CAEN SpA - Computing Systems Division ---
 
-----------------------------------------------------------------------------
 
CAENVMElib.h
 
-----------------------------------------------------------------------------
 
Created: March 2004
 
-----------------------------------------------------------------------------
*/
#ifndef __CAENVMELIB_H
#define __CAENVMELIB_H
 
#include <stdio.h>
// Rev. 2.5
#ifdef LINUX
#include <stdint.h>
#endif
#include <stdlib.h>
#ifndef _CVI_
#include <malloc.h>
#endif
#include "CAENVMEoslib.h"
#include "CAENVMEtypes.h"
 
 
 
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/*
CAENVME_DecodeError
-----------------------------------------------------------------------------
Parameters:
[in] Code : The error code to decode.
-----------------------------------------------------------------------------
Returns:
An string describing the error condition.
-----------------------------------------------------------------------------
Description:
Decode the error.
*/
const char *
#ifdef WIN32
__stdcall
#endif
CAENVME_DecodeError(CVErrorCodes Code);
 
/*
CAENVME_API CAENVME_SWRelease
-----------------------------------------------------------------------------
Parameters:
[out] SwRel : Returns the software release of the library.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
Permits to read the software release of the library.
*/
CAENVME_API
CAENVME_SWRelease(char *SwRel);
 
/*
CAENVME_BoardFWRelease.
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] FWRel : Returns the firmware release of the device.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
Permits to read the firmware release loaded into the device.
*/
CAENVME_API
CAENVME_BoardFWRelease(int32_t Handle, char *FWRel);
 
/*
CAENVME_DriverRelease.
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Rel : Returns the software release of the device driver
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
Permits to read the software release of the device driver.
*/
CAENVME_API
CAENVME_DriverRelease(int32_t Handle, char *Rel);
 
/*
CAENVME_DeviceReset
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
Permits to reset the device.
Implemented for A2818, A2719, V2718 on Linux platform only
*/
CAENVME_API
CAENVME_DeviceReset(int32_t dev);
 
 
/*
CAENVME_Init
-----------------------------------------------------------------------------
Parameters:
[in] BdType : The model of the bridge (V1718/V2718).
[in] Link : The link number (don't care for V1718).
[in] BdNum : The board number in the link.
[out] Handle : The handle that identifies the device.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function generates an opaque handle to identify a module
attached to the PC. In the case of V1718 bridge it must be
specified only the module index (BdNum) because the link is USB.
In the case of V2718 it must be specified also the link because
you can have some A2818 optical link inside the PC.
*/
CAENVME_API
CAENVME_Init(CVBoardTypes BdType, short Link, short BdNum, int32_t *Handle);
 
/*
CAENVME_End
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
Notifies the library the end of work and free the allocated
resources.
*/
CAENVME_API
CAENVME_End(int32_t Handle);
 
/*
CAENVME_ReadCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[out] Data : The data read from the VME bus.
[in] AM : The address modifier (see CVAddressModifier enum).
[in] DW : The data width.(see CVDataWidth enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a single VME read cycle.
*/
CAENVME_API
CAENVME_ReadCycle(int32_t Handle, uint32_t Address, void *Data,
CVAddressModifier AM, CVDataWidth DW);
 
/*
CAENVME_RMWCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address: The VME bus address.
[in/out] Data : The data read and then written to the VME bus.
[in] AM : The address modifier (see CVAddressModifier enum).
[in] DW : The data width.(see CVDataWidth enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a Read-Modify-Write cycle. The Data parameter
is bidirectional: it is used to write the value to the VME bus and to
return the value read.
*/
CAENVME_API
CAENVME_RMWCycle(int32_t Handle, uint32_t Address, void *Data,
CVAddressModifier AM, CVDataWidth DW);
 
/*
CAENVME_WriteCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[in] Data : The data written to the VME bus.
[in] AM : The address modifier (see CVAddressModifier enum).
[in] DW : The data width.(see CVDataWidth enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a single VME write cycle.
*/
CAENVME_API
CAENVME_WriteCycle(int32_t Handle, uint32_t Address, void *Data,
CVAddressModifier AM, CVDataWidth DW);
 
/*
CAENVME_MultiRead (Ver. 2.2)
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Addrs : The VME bus addresses.
[out] Buffer : The data read from the VME bus.
[in] NCycles : The number of read cycles to perform.
[in] AMs : The address modifiers (see CVAddressModifier enum).
[in] DWs : The data widths.(see CVDataWidth enum).
[out] ECs : The error codes relaive to each cycle.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a block of single VME read cycles.
*/
CAENVME_API
CAENVME_MultiRead(int32_t Handle, uint32_t *Addrs, uint32_t *Buffer,
int NCycles, CVAddressModifier *AMs, CVDataWidth *DWs, CVErrorCodes *ECs);
 
/*
CAENVME_MultiWrite (Ver. 2.2)
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Addrs : The VME bus addresses.
[in] Buffer : The data to write to the VME bus.
[in] NCycles : The number of read cycles to perform.
[in] AMs : The address modifiers (see CVAddressModifier enum).
[in] DWs : The data widths.(see CVDataWidth enum).
[out] ECs : The error codes relaive to each cycle.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a block of single VME write cycles.
*/
CAENVME_API
CAENVME_MultiWrite(int32_t Handle, uint32_t *Addrs, uint32_t *Buffer,
int NCycles, CVAddressModifier *AMs, CVDataWidth *DWs, CVErrorCodes *ECs);
 
/*
CAENVME_BLTReadCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[out] Buffer : The data read from the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[in] DW : The data width.(see CVDataWidth enum).
[out] count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME block transfer read cycle. It can be used to
perform MBLT transfers using 64 bit data width.
*/
CAENVME_API
CAENVME_BLTReadCycle(int32_t Handle, uint32_t Address, void *Buffer,
int Size, CVAddressModifier AM, CVDataWidth DW, int *count);
 
/*
Ver. 2.3 - New function
 
CAENVME_FIFOBLTReadCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[out] Buffer : The data read from the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[in] DW : The data width.(see CVDataWidth enum).
[out] count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME block transfer read cycle. It can be used to
perform MBLT transfers using 64 bit data width. The Address is not
incremented on the VMEBus during the cycle.
*/
CAENVME_API
CAENVME_FIFOBLTReadCycle(int32_t Handle, uint32_t Address, void *Buffer,
int Size, CVAddressModifier AM, CVDataWidth DW, int *count);
 
/*
CAENVME_MBLTReadCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[out] Buffer : The data read from the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[out] count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME multiplexed block transfer read cycle.
*/
CAENVME_API
CAENVME_MBLTReadCycle(int32_t Handle, uint32_t Address, void *Buffer,
int Size, CVAddressModifier AM, int *count);
 
/*
Ver. 2.3 - New function
CAENVME_FIFOMBLTReadCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[out] Buffer : The data read from the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[out] count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME multiplexed block transfer read cycle.
The Address is not incremented on the VMEBus during the cycle.
*/
CAENVME_API
CAENVME_FIFOMBLTReadCycle(int32_t Handle, uint32_t Address, void *Buffer,
int Size, CVAddressModifier AM, int *count);
 
/*
CAENVME_BLTWriteCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[in] Buffer : The data to be written to the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[in] DW : The data width.(see CVDataWidth enum).
[out] count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME block transfer write cycle.
*/
CAENVME_API
CAENVME_BLTWriteCycle(int32_t Handle, uint32_t Address, void *Buffer,
int size, CVAddressModifier AM, CVDataWidth DW, int *count);
 
/*
Ver. 2.3 - New function
 
CAENVME_FIFOBLTWriteCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[in] Buffer : The data to be written to the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[in] DW : The data width.(see CVDataWidth enum).
[out] count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME block transfer write cycle. The address
is not incremented during the cycle.
*/
CAENVME_API
CAENVME_FIFOBLTWriteCycle(int32_t Handle, uint32_t Address, void *Buffer,
int size, CVAddressModifier AM, CVDataWidth DW, int *count);
 
/*
CAENVME_MBLTWriteCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[in] Buffer : The data to be written to the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[out] count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME multiplexed block transfer write cycle.
*/
CAENVME_API
CAENVME_MBLTWriteCycle(int32_t Handle, uint32_t Address, void *Buffer,
int size, CVAddressModifier AM, int *count);
 
/*
Ver. 2.3 - New function
CAENVME_FIFOMBLTWriteCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[in] Buffer : The data to be written to the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[out] count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME multiplexed block transfer write cycle.
The address is not incremented during the cycle.
*/
CAENVME_API
CAENVME_FIFOMBLTWriteCycle(int32_t Handle, uint32_t Address, void *Buffer,
int size, CVAddressModifier AM, int *count);
 
/*
CAENVME_ADOCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[in] AM : The address modifier (see CVAddressModifier enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME address only cycle. It can be used to
perform MBLT transfers using 64 bit data width.
*/
CAENVME_API
CAENVME_ADOCycle(int32_t Handle, uint32_t Address, CVAddressModifier AM);
 
/*
CAENVME_ADOHCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[in] AM : The address modifier (see CVAddressModifier enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME address only with handshake cycle.
*/
CAENVME_API
CAENVME_ADOHCycle(int32_t Handle, uint32_t Address, CVAddressModifier AM);
 
/*
CAENVME_IACKCycle
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Level : The IRQ level to acknowledge (see CVIRQLevels enum).
[in] DW : The data width.(see CVDataWidth enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a VME interrupt acknowledge cycle.
*/
CAENVME_API
CAENVME_IACKCycle(int32_t Handle, CVIRQLevels Level, void *Vector, CVDataWidth DW);
 
/*
CAENVME_IRQCheck
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Mask : A bit-mask indicating the active IRQ lines.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function returns a bit mask indicating the active IRQ lines.
*/
CAENVME_API
CAENVME_IRQCheck(int32_t Handle, CAEN_BYTE *Mask);
 
/*
CAENVME_IRQEnable
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Mask : A bit-mask indicating the IRQ lines.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function enables the IRQ lines specified by Mask.
*/
CAENVME_API
CAENVME_IRQEnable(int32_t Handle, uint32_t Mask);
 
/*
CAENVME_IRQDisable
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Mask : A bit-mask indicating the IRQ lines.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function disables the IRQ lines specified by Mask.
*/
CAENVME_API
CAENVME_IRQDisable(int32_t Handle, uint32_t Mask);
 
/*
CAENVME_IRQWait
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Mask : A bit-mask indicating the IRQ lines.
[in] Timeout : Timeout in milliseconds.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function wait the IRQ lines specified by Mask until one of
them raise or timeout expires.
*/
CAENVME_API
CAENVME_IRQWait(int32_t Handle, uint32_t Mask, uint32_t Timeout);
 
/*
CAENVME_SetPulserConf
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] PulSel : The pulser to configure (see CVPulserSelect enum).
[in] Period : The period of the pulse in time units.
[in] Width : The width of the pulse in time units.
[in] Unit : The time unit for the pulser configuration (see
CVTimeUnits enum).
[in] PulseNo : The number of pulses to generate (0 = infinite).
[in] Start : The source signal to start the pulse burst (see
CVIOSources enum).
[in] Reset : The source signal to stop the pulse burst (see
CVIOSources enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to configure the pulsers. All the timing parameters
are expressed in the time units specified. The start signal source can be
one of: front panel button or software (cvManualSW), input signal 0
(cvInputSrc0),input signal 1 (cvInputSrc1) or input coincidence
(cvCoincidence). The reset signal source can be: front panel button or
software (cvManualSW) or, for pulser A the input signal 0 (cvInputSrc0),
for pulser B the input signal 1 (cvInputSrc1).
*/
CAENVME_API
CAENVME_SetPulserConf(int32_t Handle, CVPulserSelect PulSel, unsigned char Period,
unsigned char Width, CVTimeUnits Unit, unsigned char PulseNo,
CVIOSources Start, CVIOSources Reset);
 
/*
CAENVME_SetScalerConf
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Limit : The counter limit for the scaler.
[in] AutoReset : Enable/disable the counter auto reset.
[in] Hit : The source signal for the signal to count (see
CVIOSources enum).
[in] Gate : The source signal for the gate (see CVIOSources enum).
[in] Reset : The source signal to stop the counter (see
CVIOSources enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to configure the scaler. Limit range is 0 - 1024
(10 bit). The hit signal source can be: input signal 0 (cvInputSrc0)
or input coincidence (cvCoincidence). The gate signal source can be:
front panel button or software (cvManualSW) or input signal 1
(cvInputSrc1). The reset signal source can be: front panel button or
software (cvManualSW) or input signal 1 (cvInputSrc1).
*/
CAENVME_API
CAENVME_SetScalerConf(int32_t Handle, short Limit, short AutoReset,
CVIOSources Hit, CVIOSources Gate, CVIOSources Reset);
 
/*
CAENVME_SetOutputConf
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] OutSel : The output line to configure (see CVOutputSelect
enum).
[in] OutPol : The output line polarity (see CVIOPolarity enum).
[in] LEDPol : The output LED polarity (see CVLEDPolarity enum).
[in] Source : The source signal to propagate to the output line
(see CVIOSources enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to configure the output lines of the module. It
can be specified the polarity for the line and for the LED. The
output line source depends on the line as figured out by the
following table:
 
+-----------------------------------------------------------+
! S O U R C E S E L E C T I O N !
+--------------+---------------+---------------+------------+
! cvVMESignals ! cvCoincidence ! cvMiscSignals ! cvManualSW !
+---+---+--------------+---------------+---------------+------------+
! ! 0 ! DS ! Input Coinc. ! Pulser A ! Manual/SW !
! O +---+--------------+---------------+---------------+------------+
! U ! 1 ! AS ! Input Coinc. ! Pulser A ! Manual/SW !
! T +---+--------------+---------------+---------------+------------+
! P ! 2 ! DTACK ! Input Coinc. ! Pulser B ! Manual/SW !
! U +---+--------------+---------------+---------------+------------+
! T ! 3 ! BERR ! Input Coinc. ! Pulser B ! Manual/SW !
! +---+--------------+---------------+---------------+------------+
! ! 4 ! LMON ! Input Coinc. ! Scaler end ! Manual/SW !
+---+---+--------------+---------------+---------------+------------+
*/
CAENVME_API
CAENVME_SetOutputConf(int32_t Handle, CVOutputSelect OutSel, CVIOPolarity OutPol,
CVLEDPolarity LEDPol, CVIOSources Source);
 
/*
CAENVME_SetInputConf
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] InSel : The input line to configure (see CVInputSelect enum).
[in] InPol : The input line polarity (see CVIOPolarity enum).
[in] LEDPol : The output LED polarity (see CVLEDPolarity enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to configure the input lines of the module. It
ca be specified the polarity for the line and for the LED.
*/
CAENVME_API
CAENVME_SetInputConf(int32_t Handle, CVInputSelect InSel, CVIOPolarity InPol,
CVLEDPolarity LEDPol);
 
/*
CAENVME_GetPulserConf
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] PulSel : The pulser to configure (see CVPulserSelect enum).
[out] Period : The period of the pulse in time units.
[out] Width : The width of the pulse in time units.
[out] Unit : The time unit for the pulser configuration (see
CVTimeUnits enum).
[out] PulseNo : The number of pulses to generate (0 = infinite).
[out] Start : The source signal to start the pulse burst (see
CVIOSources enum).
[out] Reset : The source signal to stop the pulse burst (see
CVIOSources enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to read the configuration of the pulsers.
*/
CAENVME_API
CAENVME_GetPulserConf(int32_t Handle, CVPulserSelect PulSel, unsigned char *Period,
unsigned char *Width, CVTimeUnits *Unit, unsigned char *PulseNo,
CVIOSources *Start, CVIOSources *Reset);
 
/*
CAENVME_GetScalerConf
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Limit : The counter limit for the scaler.
[out] AutoReset : The auto reset configuration.
[out] Hit : The source signal for the signal to count (see
CVIOSources enum).
[out] Gate : The source signal for the gate (see CVIOSources enum).
[out] Reset : The source signal to stop the counter (see
CVIOSources enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to read the configuration of the scaler.
*/
CAENVME_API
CAENVME_GetScalerConf(int32_t Handle, short *Limit, short *AutoReset,
CVIOSources *Hit, CVIOSources *Gate, CVIOSources *Reset);
 
 
/*
CAENVME_SetOutputConf
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] OutSel : The output line to configure (see CVOutputSelect enum).
[out] OutPol : The output line polarity (see CVIOPolarity enum).
[out] LEDPol : The output LED polarity (see CVLEDPolarity enum).
[out] Source : The source signal to propagate to the output line (see
CVIOSources enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to read the configuration of the output lines.
*/
CAENVME_API
CAENVME_GetOutputConf(int32_t Handle, CVOutputSelect OutSel, CVIOPolarity *OutPol,
CVLEDPolarity *LEDPol, CVIOSources *Source);
 
/*
CAENVME_SetInputConf
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] InSel : The input line to configure (see CVInputSelect enum).
[out] InPol : The input line polarity (see CVIOPolarity enum).
[out] LEDPol : The output LED polarity (see CVLEDPolarity enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to read the configuration of the input lines.
*/
CAENVME_API
CAENVME_GetInputConf(int32_t Handle, CVInputSelect InSel, CVIOPolarity *InPol,
CVLEDPolarity *LEDPol);
 
/*
CAENVME_ReadRegister
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Reg : The internal register to read (see CVRegisters enum).
[out] Data : The data read from the module.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to read all internal registers.
*/
CAENVME_API
CAENVME_ReadRegister(int32_t Handle, CVRegisters Reg, unsigned int *Data);
 
/*
CAENVME_WriteRegister
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Reg : The internal register to read (see CVRegisters enum).
[in] Data : The data to be written to the module.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function permits to write to all internal registers.
*/
CAENVME_API
CAENVME_WriteRegister(int32_t Handle, CVRegisters Reg, unsigned int Data);
 
/*
CAENVME_SetOutputRegister
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Mask : The lines to be set.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function sets the lines specified. Refer the CVOutputRegisterBits
enum to compose and decoding the bit mask.
*/
CAENVME_API
CAENVME_SetOutputRegister(int32_t Handle, unsigned short Mask);
 
/*
CAENVME_ClearOutputRegister
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Mask : The IRQ lines to be cleared.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function clears the lines specified. Refer the CVOutputRegisterBits
enum to compose and decoding the bit mask.
*/
CAENVME_API
CAENVME_ClearOutputRegister(int32_t Handle, unsigned short Mask);
 
/*
CAENVME_PulseOutputRegister
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Mask : The lines to be pulsed.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function produces a pulse with the lines specified by setting and
then clearing them. Refer the CVOutputRegisterBits enum to compose and
decoding the bit mask.
*/
CAENVME_API
CAENVME_PulseOutputRegister(int32_t Handle, unsigned short Mask);
 
/*
CAENVME_ReadDisplay
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Value : The values read from the module (see CVDisplay enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function reads the VME data display on the front panel of the module.
Refer to the CVDisplay data type definition and comments to decode the
value returned.
*/
CAENVME_API
CAENVME_ReadDisplay(int32_t Handle, CVDisplay *Value);
 
/*
CAENVME_SetArbiterType
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Value : The type of VME bus arbitration to implement (see
CVArbiterTypes enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function sets the behaviour of the VME bus arbiter on the module.
*/
CAENVME_API
CAENVME_SetArbiterType(int32_t Handle, CVArbiterTypes Value);
 
/*
CAENVME_SetRequesterType
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Value : The type of VME bus requester to implement (see
CVRequesterTypes enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function sets the behaviour of the VME bus requester on the module.
*/
CAENVME_API
CAENVME_SetRequesterType(int32_t Handle, CVRequesterTypes Value);
 
/*
CAENVME_SetReleaseType
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Value : The type of VME bus release policy to implement (see
CVReleaseTypes enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function sets the release policy of the VME bus on the module.
*/
CAENVME_API
CAENVME_SetReleaseType(int32_t Handle, CVReleaseTypes Value);
 
/*
CAENVME_SetBusReqLevel
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Value : The type of VME bus requester priority level to set
(see CVBusReqLevels enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function sets the specified VME bus requester priority level on
the module.
*/
CAENVME_API
CAENVME_SetBusReqLevel(int32_t Handle, CVBusReqLevels Value);
 
/*
CAENVME_SetTimeout
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Value : The value of VME bus timeout to set (see
CVVMETimeouts enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function sets the specified VME bus timeout on the module.
*/
CAENVME_API
CAENVME_SetTimeout(int32_t Handle, CVVMETimeouts Value);
 
/*
CAENVME_SetLocationMonitor
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The addres to be monitored.
[in] Write : Flag to specify read or write cycle types.
[in] Lword : Flag to specify long word cycle type.
[in] Iack : Flag to specify interrupt acknowledge cycle type.
 
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function sets the Location Monitor.
*/
CAENVME_API
CAENVME_SetLocationMonitor(int32_t Handle, uint32_t Address, CVAddressModifier Am,
short Write, short Lword, short Iack);
/*
CAENVME_SetFIFOMode
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Value : Enable/disable the FIFO mode.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function enables/disables the auto increment of the VME addresses
during the block transfer cycles. With the FIFO mode enabled the
addresses are not incremented.
*/
CAENVME_API
CAENVME_SetFIFOMode(int32_t Handle, short Value);
 
/*
CAENVME_GetArbiterType
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Value : The type of VME bus arbitration implemented (see
CVArbiterTypes enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function get the type of VME bus arbiter implemented on the module.
*/
CAENVME_API
CAENVME_GetArbiterType(int32_t Handle, CVArbiterTypes *Value);
 
/*
CAENVME_GetRequesterType
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Value : The type of VME bus requester implemented (see
CVRequesterTypes enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function get the type of VME bus requester implemented on the module.
*/
CAENVME_API
CAENVME_GetRequesterType(int32_t Handle, CVRequesterTypes *Value);
 
/*
CAENVME_GetReleaseType
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Value : The type of VME bus release policy implemented (see
CVReleaseTypes enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function get the type of VME bus release implemented on the module.
*/
CAENVME_API
CAENVME_GetReleaseType(int32_t Handle, CVReleaseTypes *Value);
 
/*
CAENVME_GetBusReqLevel
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Value : The type of VME bus requester priority level (see
CVBusReqLevels enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function reads the specified VME bus requester priority level on
the module.
*/
CAENVME_API
CAENVME_GetBusReqLevel(int32_t Handle, CVBusReqLevels *Value);
 
/*
CAENVME_GetTimeout
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Value : The value of VME bus timeout (see CVVMETimeouts enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function sets the specified VME bus timeout on the module.
*/
CAENVME_API
CAENVME_GetTimeout(int32_t Handle, CVVMETimeouts *Value);
 
/*
CAENVME_GetFIFOMode
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Value : The FIFO mode read setting.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function read if the auto increment of the VME addresses during the
block transfer cycles is enabled (0) or disabled (!=0).
*/
CAENVME_API
CAENVME_GetFIFOMode(int32_t Handle, short *Value);
 
/*
CAENVME_SystemReset
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function performs a system reset on the module.
*/
CAENVME_API
CAENVME_SystemReset(int32_t Handle);
 
/*
CAENVME_ResetScalerCount
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function resets the counter of the scaler..
*/
CAENVME_API
CAENVME_ResetScalerCount(int32_t Handle);
 
/*
CAENVME_EnableScalerGate
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function enables the gate of the scaler.
*/
CAENVME_API
CAENVME_EnableScalerGate(int32_t Handle);
 
/*
CAENVME_DisableScalerGate
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function disables the gate of the scaler.
*/
CAENVME_API
CAENVME_DisableScalerGate(int32_t Handle);
 
/*
CAENVME_StartPulser
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] PulSel : The pulser to configure (see CVPulserSelect enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function starts the generation of pulse burst if the specified
pulser is configured for manual/software operation.
*/
CAENVME_API
CAENVME_StartPulser(int32_t Handle, CVPulserSelect PulSel);
 
/*
CAENVME_StopPulser
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] PulSel : The pulser to configure (see CVPulserSelect enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function stops the generation of pulse burst if the specified
pulser is configured for manual/software operation.
*/
CAENVME_API
CAENVME_StopPulser(int32_t Handle, CVPulserSelect PulSel);
 
/*
CAENVME_WriteFlashPage
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Data : The data to write.
[in] PageNum : The flash page number to write.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function writes the data into the specified flash page.
*/
CAENVME_API
CAENVME_WriteFlashPage(int32_t Handle, unsigned char *Data, int PageNum);
 
/*
CAENVME_ReadFlashPage
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Data : The data to write.
[in] PageNum : The flash page number to write.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function reads the data from the specified flash page.
*/
CAENVME_API
CAENVME_ReadFlashPage(int32_t Handle, unsigned char *Data, int PageNum);
 
/*
CAENVME_EraseFlashPage
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] PageNum : The flash page number to write.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function erases the specified flash page.
*/
CAENVME_API
CAENVME_EraseFlashPage(int32_t Handle, int Pagenum);
 
#ifdef LINUX
/*
CAENVME_BLTReadAsync
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[in] Address : The VME bus address.
[out] Buffer : The data read from the VME bus.
[in] Size : The size of the transfer in bytes.
[in] AM : The address modifier (see CVAddressModifier enum).
[in] DW : The data width.(see CVDataWidth enum).
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function starts a VME block transfer read cycle. It can be used
to perform MBLT transfers using 64 bit data width.
This function cannot be used with the V1718 USB bridge.
This function can be used only on Linux platforms.
Take care to call the CAENVME_BLTReadWait function before any other
call to a CAENVMElib function with the same handle.
*/
CAENVME_API
CAENVME_BLTReadAsync(int32_t Handle, uint32_t Address, void *Buffer,
int Size, CVAddressModifier AM, CVDataWidth DW);
 
/*
CAENVME_BLTReadWait
-----------------------------------------------------------------------------
Parameters:
[in] Handle : The handle that identifies the device.
[out] Count : The number of bytes transferred.
-----------------------------------------------------------------------------
Returns:
An error code about the execution of the function.
-----------------------------------------------------------------------------
Description:
The function wait for the completion of a VME block transfer read
cycle started with the CAENVME_BLTReadAsync function call.
This function cannot be used with the V1718 USB bridge.
This function can be used only on Linux platforms.
*/
CAENVME_API
CAENVME_BLTReadWait(int32_t Handle, int *Count);
 
#endif
 
#ifdef __cplusplus
}
#endif // __cplusplus
 
#endif // __CAENVMELIB_H
/cvi/instr/CAENV1718/CAENVMEoslib.h
0,0 → 1,36
/*
-----------------------------------------------------------------------------
 
--- CAEN SpA - Computing Systems Division ---
 
-----------------------------------------------------------------------------
 
CAENVMEoslib.h
 
-----------------------------------------------------------------------------
 
Author: Stefano Coluccini (s.coluccini@caen.it)
 
Created: January 2004
 
-----------------------------------------------------------------------------
*/
 
 
#ifndef __CAENVMEOSLIB_H
#define __CAENVMEOSLIB_H
 
#ifdef WIN32
 
#include <windows.h>
#include <winioctl.h>
 
#define CAENVME_API CVErrorCodes __stdcall
 
#else // WIN32
 
#define CAENVME_API CVErrorCodes
 
#endif // WIN32
 
#endif // __CAENVMEOSLIB_H
/cvi/instr/CAENV1718/CAENV1718.c
0,0 → 1,229
 
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
 
#include <CAENVMElib.h>
#include <CAENVMEoslib.h>
#include <CAENVMEtypes.h>
 
 
#include "CAENV1718.h"
 
int32_t CAEN_udev;
 
int VMEerrors;
 
int CAEN_VME_start (char* serial)
{
 
CVErrorCodes result = CAENVME_Init( cvV1718 , 0 , 0 , &CAEN_udev);
if (result != cvSuccess) {
printf("CAEN1718 Init %s\n", CAENVME_DecodeError(result));
printf(" Check usb cable, usb udev permissions and restart! Exiting .....\n");
return (-1);
}
if (serial == NULL) serial = malloc(100*sizeof(char));
CAENVME_BoardFWRelease(CAEN_udev, serial);
return result;
}
 
 
short CAEN_VME_read(long Handle, unsigned long Address, void *Data, CVAddressModifier AM, CVDataWidth DW)
{
 
CVErrorCodes result;
int ncount=0;
while (1){
result = CAENVME_ReadCycle(Handle, Address, Data, AM, DW );
if (result !=cvSuccess ) {
VMEerrors++;
printf("%d CAENVME_ReadCycle at 0x%0lX failed! data=0x%0X AM= 0x%0X DW= 0x%0X err=%s\n", ncount,Address, *((uint32_t *) Data),AM,DW, CAENVME_DecodeError(result));
ncount++;
if (ncount==10) return (result);
} else break;
}
return result;
}
 
int CAEN_VME_BltRead(long Handle, unsigned long Address, void *Data, int size, CVAddressModifier AM, CVDataWidth DW)
{
int count=0;
CVErrorCodes result;
int ncount=0;
while (1){
result = CAENVME_BLTReadCycle(Handle, Address, Data, size, AM, DW , &count);
if (result !=cvSuccess ) {
VMEerrors++;
printf("%d CAENVME_BLTReadCycle at 0x%0lX failed! data=0x%0X AM= 0x%0X DW= 0x%0X err=%s count=%d\n", ncount,Address, *((uint32_t *) Data),AM,DW, CAENVME_DecodeError(result),count);
ncount++;
if (ncount==10) return (result);
} else break;
}
return count;
}
 
short CAEN_VME_write(long Handle, unsigned long Address, void *Data, CVAddressModifier AM, CVDataWidth DW)
{
 
CVErrorCodes result;
int ncount=0;
while (1){
result = CAENVME_WriteCycle(Handle, Address, Data, AM, DW );
if (result !=cvSuccess ) {
VMEerrors++;
printf("CAENVME_WriteCycle at 0x%0lX failed! data=0x%0X AM= 0x%0X DW= 0x%0X err=%s\n", Address, *((uint32_t *) Data),AM,DW, CAENVME_DecodeError(result));
if (ncount==10) return (result);
} else break;
}
return result;
}
 
 
 
 
uint32_t *WStackAddrs = NULL;
uint32_t *WStackBuffer;
short WStackNCycles;
short WStackMaxCycles=0xFFFF;
CVAddressModifier *WStackAMs;
CVDataWidth *WStackDWs;
CVErrorCodes *WStackECs;
 
 
uint32_t *RStackAddrs =NULL;
short RStackNCycles;
short RStackMaxCycles=0xFFFF;
CVAddressModifier *RStackAMs;
CVDataWidth *RStackDWs;
CVErrorCodes *RStackECs;
 
 
 
short CAEN_VME_appendread(unsigned long Address, void *Data, CVAddressModifier AM, CVDataWidth DW){
if (RStackNCycles<RStackMaxCycles){
RStackAddrs[RStackNCycles] = Address;
RStackAMs[RStackNCycles] = AM;
RStackDWs[RStackNCycles] = DW;
//int i=RStackNCycles;
//printf("AppendRead %d ADDR= 0x%0X AM= 0x%0X DW= 0x%0X \n", i,RStackAddrs[i],RStackAMs[i], RStackDWs[i]);
RStackNCycles++;
} else {
printf("Increase DataBuffer RStackMaxCycles =%d\n", RStackMaxCycles);
}
return RStackNCycles;
}
 
short CAEN_VME_appendwrite(unsigned long Address, void *Data, CVAddressModifier AM, CVDataWidth DW){
if (WStackNCycles<WStackMaxCycles){
WStackAddrs[WStackNCycles] = Address;
WStackBuffer[WStackNCycles] = *((uint32_t *) Data);
WStackAMs[WStackNCycles] = AM;
WStackDWs[WStackNCycles] = DW;
WStackNCycles++;
} else {
printf("Increase DataBuffer WStackMaxCycles =%d\n", WStackMaxCycles);
}
return 0;
}
 
short CAEN_VME_MultiReadReset(){
RStackNCycles=0;
if (RStackAddrs!=NULL) return 0;
RStackAddrs = (uint32_t *) malloc( RStackMaxCycles*sizeof(uint32_t));
RStackAMs = (CVAddressModifier *) malloc(RStackMaxCycles*sizeof(CVAddressModifier));
RStackDWs = (CVDataWidth *) malloc(RStackMaxCycles*sizeof(CVDataWidth));
RStackECs = (CVErrorCodes *) malloc(RStackMaxCycles*sizeof(CVErrorCodes));
return 0;
}
 
short CAEN_VME_MultiWriteReset(){
WStackNCycles=0;
if (WStackAddrs!=NULL) return 0;
WStackBuffer = (uint32_t *) malloc( WStackMaxCycles*sizeof(uint32_t));
WStackAddrs = (uint32_t *) malloc( WStackMaxCycles*sizeof(uint32_t));
WStackAMs = (CVAddressModifier *) malloc(WStackMaxCycles*sizeof(CVAddressModifier));
WStackDWs = (CVDataWidth *) malloc(WStackMaxCycles*sizeof(CVDataWidth));
WStackECs = (CVErrorCodes *) malloc(WStackMaxCycles*sizeof(CVErrorCodes));
return 0;
}
 
short CAEN_VME_MultiReadExecute(long Handle, uint32_t * Data){
//printf("len=%d\n",RStackNCycles);
int i=0;
CVErrorCodes result =CAENVME_MultiRead(Handle, RStackAddrs, Data, RStackNCycles, RStackAMs, RStackDWs, RStackECs);
if (result !=cvSuccess ) {
VMEerrors++;
printf("CAENVME_MultiRead at 0x%0X failed! err=%s RStackNCycles=%d\n", RStackAddrs[0], CAENVME_DecodeError(result), RStackNCycles);
for (i=0;i<RStackNCycles;i++){
if (RStackECs[i]!=cvSuccess ) printf("%d ADDR= 0x%0X AM= 0x%0X DW= 0x%0X failed! err=%s\n", i,RStackAddrs[i],RStackAMs[i], RStackDWs[i], CAENVME_DecodeError(RStackECs[i]) );
}
exit(result);
}
return RStackNCycles;
}
 
short CAEN_VME_MultiWriteExecute(long Handle){
int i=0;
CVErrorCodes result =CAENVME_MultiWrite(Handle, WStackAddrs, WStackBuffer, WStackNCycles, WStackAMs, WStackDWs, WStackECs);
if (result !=cvSuccess ) {
printf("CAENVME_MultiWrite at 0x%0X failed! err=%s WStackNCycles=%d\n", WStackAddrs[0], CAENVME_DecodeError(result), WStackNCycles);
for (i=0;i<WStackNCycles;i++){
if (WStackECs[i]!=cvSuccess )
printf("%d ADDR= 0x%0X AM= 0x%0X DW= 0x%0X data= 0x%0X failed! err=%s\n", i,WStackAddrs[i],WStackAMs[i], WStackDWs[i], WStackBuffer[i], CAENVME_DecodeError(WStackECs[i]) );
}
exit(result);
}
return WStackNCycles;
}
 
 
short __stdcall CAEN_VME_R( uint16_t AddressModifier, uint16_t DataWidth, uint32_t VME_Address, uint32_t *Data){
return CAEN_VME_read( CAEN_udev, VME_Address, (void *)Data, AddressModifier, DataWidth);
}
 
short __stdcall CAEN_VME_W( uint16_t AddressModifier, uint16_t DataWidth, uint32_t VME_Address, uint32_t Data){
return CAEN_VME_write( CAEN_udev, VME_Address, (void *)Data, AddressModifier, DataWidth);
}
 
short __stdcall CAEN_VME_MW( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data){
 
return CAEN_VME_appendwrite( VME_Address, &Data ,AM , DW) ;
 
}
short __stdcall CAEN_VME_MWRST( void ){
 
return CAEN_VME_MultiWriteReset();
 
}
short __stdcall CAEN_VME_MWEXEC( void ){
 
return CAEN_VME_MultiWriteExecute(CAEN_udev);
 
}
 
short __stdcall CAEN_VME_MR( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data){
 
return CAEN_VME_appendread( VME_Address, Data ,AM , DW) ;
 
}
short __stdcall CAEN_VME_MRRST( void ){
 
return CAEN_VME_MultiReadReset();
 
}
short __stdcall CAEN_VME_MREXEC( uint32_t *Data ){
 
return 0;
 
}