#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