Subversion Repositories f9daq

Rev

Rev 170 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#ifndef _VME_H_
#define _VME_H_

#include <stdint.h>

#ifndef _CVI_
#define __stdcall
#define UCHAR unsigned char
#define  _VI_FUNC
#endif

#define CAEN_V1718   0
#define WIENER_VMEMM 1
#define WIENER_VMUSB 2
#define SIS3153_USB  3


short WIENER_VMUSB_VME_DGG(unsigned short channel, unsigned short trigger,unsigned short output,
                    long delay, unsigned short gate, unsigned short invert, unsigned short latch);
short WIENER_VMUSB_VME_Output_settings( unsigned short channel, unsigned short code, unsigned short invert, unsigned short latch );
short WIENER_VMUSB_register_write( short RegAddr, long RegData);

short VME_START( int interface );
int VME_GetInterface();
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_MWRST     (*VME_MWRST_Ptr)
#define  VME_MW        (*VME_MW_Ptr)
#define  VME_MWEXEC    (*VME_MWEXEC_Ptr)

#define  VME_MRRST     (*VME_MRRST_Ptr)
#define  VME_MR        (*VME_MR_Ptr)
#define  VME_MREXEC    (*VME_MREXEC_Ptr)


extern short __stdcall VME_R( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
extern short __stdcall VME_W( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);

extern short __stdcall VME_MWRST( void );
extern short __stdcall VME_MW( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
extern short __stdcall VME_MWEXEC( void );

extern short __stdcall VME_MRRST( void );
extern short __stdcall VME_MR( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
extern short __stdcall VME_MREXEC( uint32_t *Data  );

#endif