#ifndef _VME_H_
#define _VME_H_
#include <stdint.h>
#define CAEN_V1718 0
#define WIENER_VMEMM 1
#define WIENER_VMUSB 2
short VME_START( int interface );
short VME_STOP();
int VME_CONNECTED();
#define VME_A16 0x29
#define VME_A24 0x39
#define VME_A32 0x9
#define VME_D8 0x1
#define VME_D16 0x2
#define VME_D32 0x4
#define VME_A16D8_R(VME,DATA) VME_R( VME_A16, VME_D8 , (VME), (DATA) )
#define VME_A16D16_R(VME,DATA) VME_R( VME_A16, VME_D16 , (VME), (DATA) )
#define VME_A16D32_R(VME,DATA) VME_R( VME_A16, VME_D32 , (VME), (DATA) )
#define VME_A24D8_R(VME,DATA) VME_R( VME_A24, VME_D8 , (VME), (DATA) )
#define VME_A24D16_R(VME,DATA) VME_R( VME_A24, VME_D16 , (VME), (DATA) )
#define VME_A24D32_R(VME,DATA) VME_R( VME_A24, VME_D32 , (VME), (DATA) )
#define VME_A32D8_R(VME,DATA) VME_R( VME_A32, VME_D8 , (VME), (DATA) )
#define VME_A32D16_R(VME,DATA) VME_R( VME_A32, VME_D16 , (VME), (DATA) )
#define VME_A32D32_R(VME,DATA) VME_R( VME_A32, VME_D32 , (VME), (DATA) )
#define VME_A16D8_W(VME,DATA) VME_W( VME_A16, VME_D8 , (VME), (DATA) )
#define VME_A16D16_W(VME,DATA) VME_W( VME_A16, VME_D16 , (VME), (DATA) )
#define VME_A16D32_W(VME,DATA) VME_W( VME_A16, VME_D32 , (VME), (DATA) )
#define VME_A24D8_W(VME,DATA) VME_W( VME_A24, VME_D8 , (VME), (DATA) )
#define VME_A24D16_W(VME,DATA) VME_W( VME_A24, VME_D16 , (VME), (DATA) )
#define VME_A24D32_W(VME,DATA) VME_W( VME_A24, VME_D32 , (VME), (DATA) )
#define VME_A32D8_W(VME,DATA) VME_W( VME_A32, VME_D8 , (VME), (DATA) )
#define VME_A32D16_W(VME,DATA) VME_W( VME_A32, VME_D16 , (VME), (DATA) )
#define VME_A32D32_W(VME,DATA) VME_W( VME_A32, VME_D32 , (VME), (DATA) )
#define VME_R (*VME_R_Ptr)
#define VME_W (*VME_W_Ptr)
#define VME_MW (*VME_MW_Ptr)
#define VME_MWRST (*VME_MWRST_Ptr)
#define VME_MWEXEC (*VME_MWEXEC_Ptr)
#define VME_MR (*VME_MR_Ptr)
#define VME_MRRST (*VME_MRRST_Ptr)
#define VME_MREXEC (*VME_MREXEC_Ptr)
short __stdcall VME_R( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
short __stdcall VME_W( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
short __stdcall VME_MW( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
short __stdcall VME_MWRST( void );
short __stdcall VME_MWEXEC( void );
short __stdcall VME_MR( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
short __stdcall VME_MRRST( void );
short __stdcall VME_MREXEC( uint32_t *Data );
#endif