Subversion Repositories f9daq

Compare Revisions

Ignore whitespace Rev 99 → Rev 100

/cvi/instr/WUSBVME_DLL/wusbvme_dll.c
1,21 → 1,82
#ifdef LINUX
#include <dlfcn.h>
#define LoadLibrary(x) dlopen( (x), RTLD_NOW );
#define GetProcAddress(x,y) dlsym((x),(y))
#define __stdcall
#define UCHAR unsigned char
#define HINSTANCE void *
#define _VI_FUNC
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#endif
 
#include "wusbvme_dll.h"
 
 
usb_dev_handle *WUSB_udev;
 
static HINSTANCE DLLHandle;
 
void _VI_FUNC WIENER_VMUSB_load (char* module_path)
 
short __stdcall WIENER_VMUSB_VME_R( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
 
short __stdcall WIENER_VMUSB_VME_W( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
 
short __stdcall WIENER_VMUSB_VME_MW( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
short __stdcall WIENER_VMUSB_VME_MWRST( void );
short __stdcall WIENER_VMUSB_VME_MWEXEC( void );
 
short __stdcall WIENER_VMUSB_VME_MR( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
short __stdcall WIENER_VMUSB_VME_MRRST( void );
short __stdcall WIENER_VMUSB_VME_MREXEC( uint32_t *Data );
 
 
short __stdcall xxusb_register_read(usb_dev_handle *hDev, short RegAddr, long *RegData);
short __stdcall xxusb_stack_read(usb_dev_handle *hDev, short StackAddr, long *StackData);
short __stdcall xxusb_stack_write(usb_dev_handle *hDev, short StackAddr, long *StackData);
short __stdcall xxusb_stack_execute(usb_dev_handle *hDev, long *StackData);
short __stdcall xxusb_longstack_execute(usb_dev_handle *hDev, void *DataBuffer, int lDataLen, int timeout);
short __stdcall xxusb_register_write(usb_dev_handle *hDev, short RegAddr, long RegData);
short __stdcall xxusb_usbfifo_read(usb_dev_handle *hDev, long *DataBuffer, short lDataLen, int timeout);
short __stdcall xxusb_bulk_read(usb_dev_handle *hDev, char *DataBuffer, short lDataLen, int timeout);
short __stdcall xxusb_bulk_write(usb_dev_handle *hDev, char *DataBuffer, short lDataLen, int timeout);
short __stdcall xxusb_reset_toggle(usb_dev_handle *hDev);
 
short __stdcall xxusb_devices_find(xxusb_device_type *xxusbDev);
short __stdcall xxusb_device_close(usb_dev_handle *hDev);
usb_dev_handle* __stdcall xxusb_device_open(struct usb_device *dev);
short __stdcall xxusb_flash_program(usb_dev_handle *hDev, char *config, short nsect);
short __stdcall xxusb_flashblock_program(usb_dev_handle *hDev, UCHAR *config);
usb_dev_handle* __stdcall xxusb_serial_open(char *SerialString);
 
short __stdcall VME_register_write(usb_dev_handle *hdev, long VME_Address, long Data);
short __stdcall VME_register_read(usb_dev_handle *hdev, long VME_Address, long *Data);
short __stdcall VME_LED_settings(usb_dev_handle *hdev, int LED, int code, int invert, int latch);
 
short __stdcall VME_DGG(usb_dev_handle *hdev, unsigned short channel, unsigned short trigger,unsigned short output, long delay, unsigned short gate, unsigned short invert, unsigned short latch);
 
short __stdcall VME_Output_settings(usb_dev_handle *hdev, int Channel, int code, int invert, int latch);
 
short __stdcall VME_read_16(usb_dev_handle *hdev,short Address_Modifier, long VME_Address, long *Data);
short __stdcall VME_read_32(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long *Data);
short __stdcall VME_BLT_read_32(usb_dev_handle *hdev, short Address_Modifier, int count, long VME_Address, long Data[]);
short __stdcall VME_write_16(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long Data);
short __stdcall VME_write_32(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long Data);
 
 
void _VI_FUNC WIENER_VMUSB_load (const char* module_path)
{
if (module_path == NULL)
if (module_path == NULL) {
DLLHandle = LoadLibrary("libxxusb.dll");
else
} else {
DLLHandle = LoadLibrary(module_path);
}
if (!DLLHandle) {
printf ("\n\nFailed to Open libxxusb.dll \n");
return;
return;
}
if (!(xxusb_register_read_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_register_read"))) exit(1);
if (!(xxusb_register_read_Ptr = (void *) GetProcAddress(DLLHandle,"xxusb_register_read"))) exit(1);
if (!(xxusb_stack_read_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_stack_read"))) exit(1);
if (!(xxusb_stack_write_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_stack_write"))) exit(1);
if (!(xxusb_stack_execute_Ptr = (void*) GetProcAddress(DLLHandle,"xxusb_stack_execute"))) exit(1);
44,13 → 105,13
if (!(VME_write_32_Ptr = (void*) GetProcAddress(DLLHandle,"VME_write_32"))) exit(1);
}
 
void _VI_FUNC WIENER_VMUSB_open (char *serial)
void _VI_FUNC WIENER_VMUSB_open (const char *serial)
{
xxusb_device_type devices[100];
struct usb_device *dev;
if (serial != NULL)
WUSB_udev = xxusb_serial_open(serial);
WUSB_udev = xxusb_serial_open((char *) serial);
else {
//Find XX_USB devices and open the first one found
xxusb_devices_find(devices);
189,10 → 250,10
if (!WUSB_udev) return -222;
switch (DW){
case VME_D16: nb= VME_read_16(WUSB_udev, AM,VME_Address,Data); break;
case VME_D32: nb= VME_read_32(WUSB_udev, AM,VME_Address,Data); break;
default: return 0;
}
case VME_D16: nb= VME_read_16(WUSB_udev, AM,VME_Address,(long int *) Data); break;
case VME_D32: nb= VME_read_32(WUSB_udev, AM,VME_Address,(long int *)Data); break;
default: return 0;
}
//printf("R 0x%02x 0x%02x 0x%08x %x\n", AM , DW, VME_Address, *Data);
if (nb<0) printf("%s %d %d %s\n",__FILE__,__LINE__,nb, strerror(-nb) );
 
/cvi/instr/WUSBVME_DLL/wusbvme_dll.h
1,12 → 1,16
#ifndef _WUSBVME_DLL_H
#define _WUSBVME_DLL_H
 
#ifdef _CVI_
#include <ansi_c.h>
#include <windows.h>
#include <cvidef.h>
#include <ivi.h>
#include "usb.h"
#else
#include "/usr/include/usb.h"
#endif
 
#include "usb.h"
#include "xxusb_dll.h"
 
 
54,8 → 58,8
void WIENER_VMUSB_StackPrint();
 
 
void _VI_FUNC WIENER_VMUSB_load (char *module_path);
void _VI_FUNC WIENER_VMUSB_open (char *serial);
void _VI_FUNC WIENER_VMUSB_load (const char *module_path);
void _VI_FUNC WIENER_VMUSB_open (const char *serial);
void _VI_FUNC WIENER_VMUSB_close (void);
 
#define WIENER_VMUSB_VME_START(NODE) WIENER_VMUSB_load(NULL);WIENER_VMUSB_open((NODE));
75,17 → 79,17
#define WIENER_VMUSB_VME_A32D32_W(VME,DATA) VME_write_32(WUSB_udev, Ext_NoPriv_Data, (VME), (DATA))
 
 
short __stdcall WIENER_VMUSB_VME_R( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
extern short __stdcall WIENER_VMUSB_VME_R( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
 
short __stdcall WIENER_VMUSB_VME_W( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
extern short __stdcall WIENER_VMUSB_VME_W( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
 
short __stdcall WIENER_VMUSB_VME_MW( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
short __stdcall WIENER_VMUSB_VME_MWRST( void );
short __stdcall WIENER_VMUSB_VME_MWEXEC( void );
extern short __stdcall WIENER_VMUSB_VME_MW( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
extern short __stdcall WIENER_VMUSB_VME_MWRST( void );
extern short __stdcall WIENER_VMUSB_VME_MWEXEC( void );
 
short __stdcall WIENER_VMUSB_VME_MR( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
short __stdcall WIENER_VMUSB_VME_MRRST( void );
short __stdcall WIENER_VMUSB_VME_MREXEC( uint32_t *Data );
extern short __stdcall WIENER_VMUSB_VME_MR( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
extern short __stdcall WIENER_VMUSB_VME_MRRST( void );
extern short __stdcall WIENER_VMUSB_VME_MREXEC( uint32_t *Data );
 
#endif
 
/cvi/instr/WUSBVME_DLL/xxusb_dll.h
54,36 → 54,36
#define VME_write_16 (*VME_write_16_Ptr)
#define VME_write_32 (*VME_write_32_Ptr)
 
short __stdcall xxusb_register_read(usb_dev_handle *hDev, short RegAddr, long *RegData);
short __stdcall xxusb_stack_read(usb_dev_handle *hDev, short StackAddr, long *StackData);
short __stdcall xxusb_stack_write(usb_dev_handle *hDev, short StackAddr, long *StackData);
short __stdcall xxusb_stack_execute(usb_dev_handle *hDev, long *StackData);
short __stdcall xxusb_longstack_execute(usb_dev_handle *hDev, void *DataBuffer, int lDataLen, int timeout);
short __stdcall xxusb_register_write(usb_dev_handle *hDev, short RegAddr, long RegData);
short __stdcall xxusb_usbfifo_read(usb_dev_handle *hDev, long *DataBuffer, short lDataLen, int timeout);
short __stdcall xxusb_bulk_read(usb_dev_handle *hDev, char *DataBuffer, short lDataLen, int timeout);
short __stdcall xxusb_bulk_write(usb_dev_handle *hDev, char *DataBuffer, short lDataLen, int timeout);
short __stdcall xxusb_reset_toggle(usb_dev_handle *hDev);
extern short __stdcall xxusb_register_read(usb_dev_handle *hDev, short RegAddr, long *RegData);
extern short __stdcall xxusb_stack_read(usb_dev_handle *hDev, short StackAddr, long *StackData);
extern short __stdcall xxusb_stack_write(usb_dev_handle *hDev, short StackAddr, long *StackData);
extern short __stdcall xxusb_stack_execute(usb_dev_handle *hDev, long *StackData);
extern short __stdcall xxusb_longstack_execute(usb_dev_handle *hDev, void *DataBuffer, int lDataLen, int timeout);
extern short __stdcall xxusb_register_write(usb_dev_handle *hDev, short RegAddr, long RegData);
extern short __stdcall xxusb_usbfifo_read(usb_dev_handle *hDev, long *DataBuffer, short lDataLen, int timeout);
extern short __stdcall xxusb_bulk_read(usb_dev_handle *hDev, char *DataBuffer, short lDataLen, int timeout);
extern short __stdcall xxusb_bulk_write(usb_dev_handle *hDev, char *DataBuffer, short lDataLen, int timeout);
extern short __stdcall xxusb_reset_toggle(usb_dev_handle *hDev);
 
short __stdcall xxusb_devices_find(xxusb_device_type *xxusbDev);
short __stdcall xxusb_device_close(usb_dev_handle *hDev);
usb_dev_handle* __stdcall xxusb_device_open(struct usb_device *dev);
short __stdcall xxusb_flash_program(usb_dev_handle *hDev, char *config, short nsect);
short __stdcall xxusb_flashblock_program(usb_dev_handle *hDev, UCHAR *config);
usb_dev_handle* __stdcall xxusb_serial_open(char *SerialString);
extern short __stdcall xxusb_devices_find(xxusb_device_type *xxusbDev);
extern short __stdcall xxusb_device_close(usb_dev_handle *hDev);
extern usb_dev_handle* __stdcall xxusb_device_open(struct usb_device *dev);
extern short __stdcall xxusb_flash_program(usb_dev_handle *hDev, char *config, short nsect);
extern short __stdcall xxusb_flashblock_program(usb_dev_handle *hDev, UCHAR *config);
extern usb_dev_handle* __stdcall xxusb_serial_open(char *SerialString);
 
short __stdcall VME_register_write(usb_dev_handle *hdev, long VME_Address, long Data);
short __stdcall VME_register_read(usb_dev_handle *hdev, long VME_Address, long *Data);
short __stdcall VME_LED_settings(usb_dev_handle *hdev, int LED, int code, int invert, int latch);
extern short __stdcall VME_register_write(usb_dev_handle *hdev, long VME_Address, long Data);
extern short __stdcall VME_register_read(usb_dev_handle *hdev, long VME_Address, long *Data);
extern short __stdcall VME_LED_settings(usb_dev_handle *hdev, int LED, int code, int invert, int latch);
 
short __stdcall VME_DGG(usb_dev_handle *hdev, unsigned short channel, unsigned short trigger,unsigned short output, long delay, unsigned short gate, unsigned short invert, unsigned short latch);
extern short __stdcall VME_DGG(usb_dev_handle *hdev, unsigned short channel, unsigned short trigger,unsigned short output, long delay, unsigned short gate, unsigned short invert, unsigned short latch);
 
short __stdcall VME_Output_settings(usb_dev_handle *hdev, int Channel, int code, int invert, int latch);
extern short __stdcall VME_Output_settings(usb_dev_handle *hdev, int Channel, int code, int invert, int latch);
 
short __stdcall VME_read_16(usb_dev_handle *hdev,short Address_Modifier, long VME_Address, long *Data);
short __stdcall VME_read_32(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long *Data);
short __stdcall VME_BLT_read_32(usb_dev_handle *hdev, short Address_Modifier, int count, long VME_Address, long Data[]);
short __stdcall VME_write_16(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long Data);
short __stdcall VME_write_32(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long Data);
extern short __stdcall VME_read_16(usb_dev_handle *hdev,short Address_Modifier, long VME_Address, long *Data);
extern short __stdcall VME_read_32(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long *Data);
extern short __stdcall VME_BLT_read_32(usb_dev_handle *hdev, short Address_Modifier, int count, long VME_Address, long Data[]);
extern short __stdcall VME_write_16(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long Data);
extern short __stdcall VME_write_32(usb_dev_handle *hdev, short Address_Modifier, long VME_Address, long Data);
 
#endif
/cvi/instr/WIENVME_DLL/wienvme_dll.c
1,8 → 1,28
#include <ansi_c.h>
#include "wienvme_dll.h"
#include <stdlib.h>
#include <stdio.h>
 
#ifdef _CVI_
#include <utility.h>
#endif
 
#ifdef LINUX
#include <dlfcn.h>
#define LoadLibrary(x) dlopen( (x), RTLD_NOW );
#define GetProcAddress(x,y) dlsym((x),(y))
static int GetCurrentPlatform(void ){return 0;};
#define __stdcall
#define UCHAR unsigned char
#define HINSTANCE void *
#define _VI_FUNC
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#endif
 
#include "wienvme_dll.h"
//----------- DEFINES -----------------------------------------------------
#define DEVICENAME_LINUX "/dev/pcivme_0" // a device name 'template' for WINNT
#define DEVICENAME_NT "\\\\.\\PCIVME:\\VMEMMxx" // a device name 'template' for WINNT
#define DEVICENAME_9X "\\\\.\\C:\\windows\\system\\VWIENVMED.vxd" // the same for WIN95/98
#define MODULE_NUMBER 1 // number of connected CC32 module
21,8 → 41,10
int hHandle24, hHandle32;
int VMEmodule;
 
static HINSTANCE DLLHandle;
void WIENVME_load (char* module_path)
{
/*
int stat;
if (module_path == NULL)
30,12 → 52,28
("c:\\home\\CVI\\instr\\WIENVME_DLL\\pcivme_ni.lib");
else
VMEmodule = LoadExternalModule (module_path);
vme_init = GetExternalModuleAddr (VMEmodule, "VMEinit", &stat);
vme_read = GetExternalModuleAddr (VMEmodule, "VMEread", &stat);
vme_write = GetExternalModuleAddr (VMEmodule, "VMEwrite", &stat);
vme_reset = GetExternalModuleAddr (VMEmodule, "VMEreset", &stat);
vme_close = GetExternalModuleAddr (VMEmodule, "VMEclose", &stat);
*/
if (module_path == NULL) {
DLLHandle = LoadLibrary("c:\\home\\CVI\\instr\\WIENVME_DLL\\pcivme_ni.lib");
} else {
DLLHandle = LoadLibrary(module_path);
}
if (!DLLHandle) {
printf ("\n\nFailed to Open libxxusb.dll \n");
return;
}
vme_init = (void *) GetProcAddress (DLLHandle , "VMEinit");
vme_read = (void *) GetProcAddress (DLLHandle , "VMEread");
vme_write =(void *) GetProcAddress (DLLHandle , "VMEwrite");
vme_reset =(void *) GetProcAddress (DLLHandle , "VMEreset");
vme_close =(void *) GetProcAddress (DLLHandle , "VMEclose");
 
return;
}
49,6 → 87,8
if (device_name == NULL)
switch (GetCurrentPlatform ())
{
case 0:
device_name = DEVICENAME_LINUX;
case 2:
device_name = DEVICENAME_9X;
break;
87,7 → 127,7
 
void WIENVME_unload ()
{
UnloadExternalModule (VMEmodule);
//UnloadExternalModule (VMEmodule);
return;
}
 
143,7 → 183,7
/* D8 read */
result = VMEread(hHandle, at, 1, n, buff);
if (result) {
printf("D8 read at 0x%X failed!\n", at);
printf("D8 read at 0x%lX failed!\n", at);
}
// printf("0x%X, 0x%X, 0x%X, 0x%X\n", hHandle, at, n, * (unsigned short *) buff);
return (result);
156,7 → 196,7
/* D16 read */
result = VMEread(hHandle, at, 2, n, buff);
if (result) {
printf("D16 read at 0x%X failed!\n", at);
printf("D16 read at 0x%lX failed!\n", at);
}
// printf("0x%X, 0x%X, 0x%X, 0x%X\n", hHandle, at, n, * (unsigned short *) buff);
return (result);
169,7 → 209,7
/* D32 read */
result = VMEread(hHandle, at, 4, n, buff);
if (result) {
printf("D32 read at 0x%X failed!\n", at);
printf("D32 read at 0x%lX failed!\n", at);
}
//printf("0x%X, 0x%X, 0x%X, 0x%X\n", hHandle, at, n, * (unsigned short *) buff);
return (result);
182,7 → 222,7
/* D8 write */
result = VMEwrite(hHandle, at, 1, n, buff);
if (result) {
printf("D8 write at 0x%X failed!\n", at);
printf("D8 write at 0x%lX failed!\n", at);
}
return (result);
}
194,7 → 234,7
/* D16 write */
result = VMEwrite(hHandle, at, 2, n, buff);
if (result) {
printf("D16 write at 0x%X failed!\n", at);
printf("D16 write at 0x%lX failed!\n", at);
}
return (result);
}
206,7 → 246,7
/* D32 write */
result = VMEwrite(hHandle, at, 4, n, buff);
if (result) {
printf("D32 write at 0x%X failed!\n", at);
printf("D32 write at 0x%lX failed!\n", at);
}
//printf("D32 write at 0x%X buff=0x%X\n", at,((int*) buff)[0]);
return (result);
/cvi/instr/WIENVME_DLL/wienvme_dll.h
1,10 → 1,12
#ifndef _WIENVME_DLL_H
#define _WIENVME_DLL_H
 
#ifdef _CVI_
#include <ansi_c.h>
#include <stdint.h>
#include <windows.h>
#include <cvidef.h>
#endif
 
extern int hHandle24, hHandle32;
 
/cvi/instr/vme/vme.c
1,5 → 1,18
#include "vme.h"
 
 
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 );
 
/*
#ifdef _CVI_
#include "c:\home\CVI\instr\WIENVME_DLL\wienvme_dll.h"
19,7 → 32,7
return VME_interface;
}
 
short VME_START (int interface)
short __stdcall VME_START (int interface)
{
85,7 → 98,7
return 0;
}
 
short VME_STOP ()
short __stdcall VME_STOP ()
{
switch (VME_interface){
case CAEN_V1718:
/cvi/instr/vme/vme.h
3,6 → 3,12
 
#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
57,17 → 63,17
#define VME_MREXEC (*VME_MREXEC_Ptr)
 
 
short __stdcall VME_R( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
extern 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);
extern 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 );
extern short __stdcall VME_MW( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t Data);
extern short __stdcall VME_MWRST( void );
extern 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 );
extern short __stdcall VME_MR( uint16_t AM, uint16_t DW, uint32_t VME_Address, uint32_t *Data);
extern short __stdcall VME_MRRST( void );
extern short __stdcall VME_MREXEC( uint32_t *Data );
 
#endif
 
/cvi/instr/vme/Makefile
0,0 → 1,23
 
libvme.a: vme.c ../WUSBVME_DLL/wusbvme_dll.c ../CAENV1718/CAENV1718.c ../WIENVME_DLL
g++ -c -DLINUX -I../WIENVME_DLL -I../WUSBVME_DLL -I../CAENV1718 -shared vme.c -o vme.o
g++ -c -DLINUX -I../CAENV1718 ../CAENV1718/CAENV1718.c -o CAENV1718.o
g++ -c -fpermissive -DLINUX -I../WUSBVME_DLL ../WUSBVME_DLL/wusbvme_dll.c -o wusbvme_dll.o
g++ -c -fpermissive -DLINUX -I../WIENVME_DLL ../WIENVME_DLL/wienvme_dll.c -o wienvme_dll.o
ar r libvme.a CAENV1718.o wusbvme_dll.o wienvme_dll.o vme.o
 
.cc.o:
$(CXX) -c $<
ar r $(LIBFILE) $@
 
.cpp.o:
$(CXX) -c $<
ar r $(LIBFILE) $@
 
.c.o:
$(CXX) -c $<
ar r $(LIBFILE) $@
 
wusbxx_dll.o:wusbxx_dll.c wusbxx_dll.h
 
libxxusb.o: libxxusb.cpp libxxusb.h
/cvi/instr/CAENV1718/CAENV1718.c
7,9 → 7,16
#include <CAENVMEoslib.h>
#include <CAENVMEtypes.h>
 
#ifndef _CVI_
#define __stdcall
#define UCHAR unsigned char
#define _VI_FUNC
#endif
 
#include "CAENV1718.h"
 
 
 
int32_t CAEN_udev;
 
int VMEerrors;
23,7 → 30,7
printf(" Check usb cable, usb udev permissions and restart! Exiting .....\n");
return (-1);
}
if (serial == NULL) serial = malloc(100*sizeof(char));
if (serial == NULL) serial = (char *) malloc(100*sizeof(char));
CAENVME_BoardFWRelease(CAEN_udev, serial);
return result;
187,16 → 194,16
 
 
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);
return CAEN_VME_read( CAEN_udev, VME_Address, (void *)Data, (CVAddressModifier) AddressModifier, (CVDataWidth) 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, &Data, AddressModifier, DataWidth);
return CAEN_VME_write( CAEN_udev, VME_Address, &Data, (CVAddressModifier) AddressModifier, (CVDataWidth) 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) ;
return CAEN_VME_appendwrite( VME_Address, &Data ,(CVAddressModifier) AM , (CVDataWidth) DW) ;
 
}
short __stdcall CAEN_VME_MWRST( void ){
212,7 → 219,7
 
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) ;
return CAEN_VME_appendread( VME_Address, Data ,(CVAddressModifier) AM , (CVDataWidth) DW) ;
 
}
short __stdcall CAEN_VME_MRRST( void ){