Subversion Repositories f9daq

Compare Revisions

Regard whitespace Rev 112 → Rev 111

/praktikum/petdaqfmf/LinkDef.h
File deleted
/praktikum/petdaqfmf/VmUsbStack.C
File deleted
/praktikum/petdaqfmf/CAENV965_DEF.h
File deleted
/praktikum/petdaqfmf/gui.C
File deleted
/praktikum/petdaqfmf/VmUsbStack.h
File deleted
/praktikum/petdaqfmf/Dict.h
File deleted
/praktikum/petdaqfmf/vme.h
File deleted
/praktikum/petdaqfmf/Makefile
File deleted
/praktikum/petdaqfmf/VMEModule.cc
File deleted
/praktikum/petdaqfmf/libxxusb.cpp
File deleted
Property changes:
Deleted: svn:executable
Index: petdaqfmf/CAENV965.c
===================================================================
--- petdaqfmf/CAENV965.c (revision 112)
+++ petdaqfmf/CAENV965.c (nonexistent)
@@ -1,107 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include "CAENV965.h"
-#include "CAENV965_DEF.h"
-#include "vme.h"
-
-static unsigned long ModuleAddress[10];
-
-int _VI_FUNC V965_map (int ModuleNumber, unsigned long ModuleOffset, int print)
-{
- int i;
- unsigned short geo, fw, ah, al;
- if (print) {
- printf("CAEN V965_map \n");
- }
- ModuleAddress[ModuleNumber] = ModuleOffset;
- VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV965_FW, &fw);
- geo = 0;
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_CRN, &geo);
- for (i=0;i<32;i++)
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_THM + 2*i, &geo);
- geo = ModuleNumber+1;
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_GEO, &geo);
- geo = 0;
- VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV965_GEO, &geo);
- VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV965_ADH, &ah);
- VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV965_ADL, &al);
- if (print) {
- printf("CAEN V965 offset = 0x%08x\n", ModuleOffset);
- printf(" V965_map firmware = %d.%d\n", (fw>>8)&0xff, fw&0xff);
- printf(" V965_map geo = %d\n", geo&0x1f );
- printf(" V965_map addr = 0x%04X0000\n", (ah<<8)|(al&0xff));
- }
-
- return 0;
-}
-
-
-int _VI_FUNC V965_init (int ModuleNumber, unsigned short ped)
-{
- unsigned short dum16;
-
- dum16= 0x80;
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_BS1, &dum16);
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_BC1, &dum16);
- dum16= ped;
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_PED, &dum16);
- dum16= 0x5000;
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_BS2, &dum16);
- dum16= 0x4;
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_BS2, &dum16);
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_BC2, &dum16);
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_ECR, &dum16);
-
- printf ( " V965_init Module %d initialized!\n", ModuleNumber ) ;
- return 0;
-}
-
-int _VI_FUNC V965_clear (int ModuleNumber)
-{
-
- unsigned short dum16;
-
- dum16= 0x4;
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_BS2, &dum16);
- VME_A24D16_W(ModuleAddress[ModuleNumber] + CAENV965_BC2, &dum16);
- printf("V965_clear\n");
- return 0;
-
-}
-
-int _VI_FUNC V965_status (int ModuleNumber)
-{
- unsigned short dum16;
-
- VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV965_SR1, &dum16);
- //printf("*%d\n",dum16);
- return (int)dum16;
-}
-
-int _VI_FUNC V965_status2 (int ModuleNumber)
-{
-
- unsigned short dum16;
-
- VME_A24D16_R(ModuleAddress[ModuleNumber] + CAENV965_SR2, &dum16);
-
- return (int)dum16;
-}
-
-int _VI_FUNC V965_read (int ModuleNumber, unsigned long whereto[],int len)
-{
- int status, ndata, i;
-
- ndata = 0;
-
- do {
- if (ndata>=len) {
- printf("ERROR V965_read: Increase storage size: ndata=%d\n",ndata);
- break;
- }
- VME_A24D32_R(ModuleAddress[ModuleNumber] + CAENV965_OB, &whereto[ndata]);
- i=(whereto[ndata]>>25)&0x3;
- if (i<3) ndata++;
- } while (i<2);
- return ndata;
-}
Index: petdaqfmf/CAENV965.h
===================================================================
--- petdaqfmf/CAENV965.h (revision 112)
+++ petdaqfmf/CAENV965.h (nonexistent)
@@ -1,13 +0,0 @@
-#ifndef _CAENV965_H
-#define _CAENV965_H
-
-#define _VI_FUNC
-
-int _VI_FUNC V965_map (int ModuleNumber, unsigned long ModuleOffset, int print) ;
-int _VI_FUNC V965_init (int ModuleNumber, unsigned short ped) ;
-int _VI_FUNC V965_clear (int ModuleNumber) ;
-int _VI_FUNC V965_status (int ModuleNumber) ;
-int _VI_FUNC V965_status2 (int ModuleNumber) ;
-int _VI_FUNC V965_read (int ModuleNumber, unsigned long whereto[],int len);
-
-#endif
Index: petdaqfmf/libxxusb.h
===================================================================
--- petdaqfmf/libxxusb.h (revision 112)
+++ petdaqfmf/libxxusb.h (nonexistent)
@@ -1,114 +0,0 @@
-#include <usb.h>
-
-
-#define XXUSB_WIENER_VENDOR_ID 0x16DC /* Wiener, Plein & Baus */
-#define XXUSB_VMUSB_PRODUCT_ID 0x000B /* VM-USB */
-#define XXUSB_CCUSB_PRODUCT_ID 0x0001 /* CC-USB */
-#define XXUSB_ENDPOINT_OUT 2 /* Endpoint 2 Out*/
-#define XXUSB_ENDPOINT_IN 0x86 /* Endpoint 6 In */
-#define XXUSB_FIRMWARE_REGISTER 0
-#define XXUSB_GLOBAL_REGISTER 1
-#define XXUSB_ACTION_REGISTER 10
-#define XXUSB_DELAYS_REGISTER 2
-#define XXUSB_WATCHDOG_REGISTER 3
-#define XXUSB_SELLEDA_REGISTER 6
-#define XXUSB_SELNIM_REGISTER 7
-#define XXUSB_SELLEDB_REGISTER 4
-#define XXUSB_SERIAL_REGISTER 15
-#define XXUSB_LAMMASK_REGISTER 8
-#define XXUSB_LAM_REGISTER 12
-#define XXUSB_READOUT_STACK 2
-#define XXUSB_SCALER_STACK 3
-#define XXUSB_NAF_DIRECT 12
-
-// dodal 19.4.2011 da dela na 64-bit masinah
-typedef unsigned int Uint32_t;
-
-struct XXUSB_STACK
-{
-Uint32_t Data;
-short Hit;
-short APatt;
-short Num;
-short HitMask;
-};
-
-struct XXUSB_CC_COMMAND_TYPE
-{
-short Crate;
-short F;
-short A;
-short N;
-Uint32_t Data;
-short NoS2;
-short LongD;
-short HitPatt;
-short QStop;
-short LAMMode;
-short UseHit;
-short Repeat;
-short AddrScan;
-short FastCam;
-short NumMod;
-short AddrPatt;
-Uint32_t HitMask[4];
-Uint32_t Num;
-};
-
-struct xxusb_device_typ
-{
- struct usb_device *usbdev;
- char SerialString[7];
-};
-
-typedef struct xxusb_device_typ xxusb_device_type;
-typedef unsigned char UCHAR;
-typedef struct usb_bus usb_busx;
-
-
-int xxusb_longstack_execute(usb_dev_handle *hDev, void *DataBuffer, int lDataLen, int timeout);
-int xxusb_bulk_read(usb_dev_handle *hDev, void *DataBuffer, int lDataLen, int timeout);
-int xxusb_bulk_write(usb_dev_handle *hDev, void *DataBuffer, int lDataLen, int timeout);
-int xxusb_usbfifo_read(usb_dev_handle *hDev, int *DataBuffer, int lDataLen, int timeout);
-
-short xxusb_register_read(usb_dev_handle *hDev, short RegAddr, Uint32_t *RegData);
-short xxusb_stack_read(usb_dev_handle *hDev, short StackAddr, Uint32_t *StackData);
-short xxusb_stack_write(usb_dev_handle *hDev, short StackAddr, Uint32_t *StackData);
-short xxusb_stack_execute(usb_dev_handle *hDev, Uint32_t *StackData);
-short xxusb_register_write(usb_dev_handle *hDev, short RegAddr, Uint32_t RegData);
-short xxusb_reset_toggle(usb_dev_handle *hDev);
-
-short xxusb_devices_find(xxusb_device_type *xxusbDev);
-short xxusb_device_close(usb_dev_handle *hDev);
-usb_dev_handle* xxusb_device_open(struct usb_device *dev);
-short xxusb_flash_program(usb_dev_handle *hDev, char *config, short nsect);
-short xxusb_flashblock_program(usb_dev_handle *hDev, UCHAR *config);
-usb_dev_handle* xxusb_serial_open(char *SerialString);
-
-short VME_register_write(usb_dev_handle *hdev, Uint32_t VME_Address, Uint32_t Data);
-short VME_register_read(usb_dev_handle *hdev, Uint32_t VME_Address, Uint32_t *Data);
-short VME_LED_settings(usb_dev_handle *hdev, int LED, int code, int invert, int latch);
-short VME_DGG(usb_dev_handle *hdev, unsigned short channel, unsigned short trigger,unsigned short output, Uint32_t delay, unsigned short gate, unsigned short invert, unsigned short latch);
-
-short VME_Output_settings(usb_dev_handle *hdev, int Channel, int code, int invert, int latch);
-
-short VME_read_16(usb_dev_handle *hdev,short Address_Modifier, Uint32_t VME_Address, Uint32_t *Data);
-short VME_read_32(usb_dev_handle *hdev, short Address_Modifier, Uint32_t VME_Address, Uint32_t *Data);
-short VME_BLT_read_32(usb_dev_handle *hdev, short Address_Modifier, int count, Uint32_t VME_Address, Uint32_t Data[]);
-short VME_write_16(usb_dev_handle *hdev, short Address_Modifier, Uint32_t VME_Address, Uint32_t Data);
-short VME_write_32(usb_dev_handle *hdev, short Address_Modifier, Uint32_t VME_Address, Uint32_t Data);
-
-short CAMAC_DGG(usb_dev_handle *hdev, short channel, short trigger, short output, int delay, int gate, short invert, short latch);
-short CAMAC_register_read(usb_dev_handle *hdev, int A, Uint32_t *Data);
-short CAMAC_register_write(usb_dev_handle *hdev, int A, Uint32_t Data);
-short CAMAC_LED_settings(usb_dev_handle *hdev, int LED, int code, int invert, int latch);
-short CAMAC_Output_settings(usb_dev_handle *hdev, int Channel, int code, int invert, int latch);
-short CAMAC_read_LAM_mask(usb_dev_handle *hdev, Uint32_t *Data);
-short CAMAC_write_LAM_mask(usb_dev_handle *hdev, Uint32_t Data);
-
-short CAMAC_write(usb_dev_handle *hdev, int N, int A, int F, Uint32_t Data, int *Q, int *X);
-short CAMAC_read(usb_dev_handle *hdev, int N, int A, int F, Uint32_t *Data, int *Q, int *X);
-short CAMAC_Z(usb_dev_handle *hdev);
-short CAMAC_C(usb_dev_handle *hdev);
-short CAMAC_I(usb_dev_handle *hdev, int inhibit);
-
/petdaqfmf/libxxusb.h
Property changes:
Deleted: svn:executable
Index: petdaqfmf/daq.C
===================================================================
--- petdaqfmf/daq.C (revision 112)
+++ petdaqfmf/daq.C (nonexistent)
@@ -1,583 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/mman.h>
-#include <errno.h>
-#include <ctype.h>
-#include <time.h>
-#include <sys/time.h>
-#include <sys/stat.h>
-#include <signal.h>
-#include <zlib.h>
-
-#include "CAENV965_DEF.h"
-#include "VmUsbStack.h"
-
-#include "vme.h"
-
-#include "daq.h"
-
-#define VERSION 1.0
-#define TIMEOUT 3
-
-
-/* VME modules */
-
-#define CAEN_V792 0x340000 // IJS V792
-#define CAEN_V792_1 0x530000 // FMF1 V792
-#define CAEN_V792_2 0x630000 // FMF2 V792
-#define CAEN_V965 0x350000 // IJS V965
-int addr[3]={CAEN_V792,CAEN_V792_1,CAEN_V965 };
-int nadc=3;
-
-int gPedestal = 255;
-
-#define BUFF_L 2048
-static int stackwrite[10000];
-static int stackdata[10000],stackdump[27000];
-
-
-/************************************************/
-int weight_while(int num)
-{
- int i, tmp;
-
- for ( i =0; i <num; i++ ) tmp = 0;
- return 0;
-}
-#define WWHILE weight_while(0)
-
-#define TRUE 1
-#define FALSE 0
-
-int timer_out;
-struct sigaction oact;
-void timerast (int signumber)
-{
- timer_out = TRUE;
- fprintf(stderr,"TIMEOUT !!!\n");
-}
-
-void tmlnk (int tout)
-{
- timer_out = FALSE;
- struct sigaction act;
- struct itimerval tdelay;
-
- act.sa_handler = timerast;
- sigemptyset (&act.sa_mask);
- act.sa_flags = 0;
-
- tdelay.it_value.tv_sec = tout / 100;
- tdelay.it_value.tv_usec = 10000 * (tout % 100);
- tdelay.it_interval.tv_sec = 0;
- tdelay.it_interval.tv_usec = 0;
-
- if (sigaction (SIGALRM, &act, &oact) < 0)
- {
- perror ("sigaction(tmlnk)");
- exit (EXIT_FAILURE);
- }
- if (setitimer (ITIMER_REAL, &tdelay, NULL) < 0)
- {
- perror ("setitimer(tmlnk)");
- exit (EXIT_FAILURE);
- }
-}
-
-void tmulk ()
-{
- struct itimerval tdelay;
-
- tdelay.it_value.tv_sec = 0;
- tdelay.it_value.tv_usec = 0;
- tdelay.it_interval.tv_sec = 0;
- tdelay.it_interval.tv_usec = 0;
-
- if (setitimer (ITIMER_REAL, &tdelay, NULL) < 0)
- {
- perror ("setitimer(tmulk)");
- exit (EXIT_FAILURE);
- }
- if (sigaction (SIGALRM, &oact, NULL) < 0)
- {
- perror ("sigaction(tmulk)");
- exit (EXIT_FAILURE);
- }
-}
-
-int fexist( char * path){
- struct stat sbuf;
- int res;
- if(!path || !*path) return 0;
- res=stat(path,&sbuf);
- if (res){
- if (errno==ENOENT) {
- return 0;
- } else {
- return -1;
- }
- }
- return 1;
-}
-
-
-
-
-int daq::init(){
-
- xxusb_register_write(udev,1,0x0); // Stop DAQ mode
- while (xxusb_usbfifo_read(udev,(int *) stackdump,BUFF_L,100)>0);
-
-
- int rate=1000;
- int i=80000000/rate-40; // 80 MHz
- if (i<72) i=72;
- // Set DGG channel A as a pulser, output on O1,
- // with delay =500 x 12.5ns,
- // and width = 500 x 12.5ns,
- // not latching or inverting
- // VME_DGG(udev,0,6,0,24000,6000,0,0);
- VME_DGG(udev,0,6,0,i,40,0,0);
- // Set DGG channel B to trigger on NIM1, output on O2,
- // with delay =200 x 12.5ns,
- // and width = 200 x 12.5ns,
- // not latching or inverting
- VME_DGG(udev,1,1,1,0,10,0,1);
-
-
-// INIT stackdata
- int fPedestal=gPedestal;
- printf("CAEN V965 Pedestal set to %d\n", fPedestal);
- if (fInit != NULL ) delete fInit;
- fInit=new VmUsbStack();
-
- for (int i=0;i<nadc;i++){
- fInit->WriteA24D16( addr[i] + CAENV965_CRN , 0x0);
- fInit->WriteA24D16( addr[i] + CAENV965_GEO , i);
- fInit->ReadA24D16(addr[i] + CAENV965_GEO);
- for (int j=0;j<32;j++){
- fInit->WriteA24D16(addr[i] + CAENV965_THM + 0x02*j, fThreshold[j+i*32]); // threshold/kill for 32 channels
- }
- fInit->WriteA24D16( addr[i] + CAENV965_BS1, 0x80 ); // soft reset
- fInit->WriteA24D16( addr[i] + CAENV965_BC1, 0x80 ); // soft reset
- fInit->WriteA24D16( addr[i] + CAENV965_PED, fPedestal ); // pedestal
- fInit->WriteA24D16( addr[i] + CAENV965_BS2,0x5000);
- fInit->WriteA24D16( addr[i] + CAENV965_BS2,0x4); // clear module
- fInit->WriteA24D16( addr[i] + CAENV965_BC2,0x4);
- }
- fInit->Marker(0xFAFC);
-
-// fInit->Print();
-
-
- // READOUT stackdata
- if (fStack != NULL ) delete fStack;
- fStack=new VmUsbStack();
- fStack->Marker(0xFFAB);
- //fStack->ConditionalRead(addr[i] + CAENV965_SR1,0x1); // TRG wait : loop until bit 0 is on
- // fStack->RepeatRead( CMD_A24, CMD_D32, addr[i] + CAENV965_OB,34,0); // repead read
- //fStack->ConditionalRead(addr[i] + CAENV965_OB ,0x4000000) ; // loop until bit 26 is on, read data
- for (int j=0;j<36;j++) fStack->ReadA24D32(addr[0] + CAENV965_OB);
- for (int j=0;j<36;j++) fStack->ReadA24D32(addr[1] + CAENV965_OB);
- for (int j=0;j<8;j++) fStack->ReadA24D32(addr[2] + CAENV965_OB);// 4 channels connected
- fStack->Marker(0xFAFB);
-
- for (int i=0;i<nadc;i++){
- fStack->WriteA24D16(addr[i] + CAENV965_BS2,0x4); // clear module
- fStack->WriteA24D16(addr[i] + CAENV965_BC2,0x4);
- }
-
- //fStack->Print();
-
- VME_LED_settings(udev, 0,0,0,0); // Set Yellow LED to light with with USB out buffer not empty
- VME_LED_settings(udev, 1,1,0,0); // Set Red LED to light with NIM1
- VME_LED_settings(udev,2,0,0,0); // Set Green LED to light when stack is not empty
-
- Uint32_t vmereg;
- VME_register_read(udev,0x00,&vmereg);
- printf("VMUSB Firmware ID -> 0x%08X\n",vmereg);
-
- VME_register_read(udev,0x04,&vmereg);
- printf("VMUSB Global Mode -> 0x%08X\n",vmereg);
-
- vmereg=(vmereg&0xF000)|0x0004;
- VME_register_write(udev,0x04,vmereg);
- VME_register_write(udev,0x08,0x00000080);
- VME_register_write(udev,0x28,0x0);
- VME_register_write(udev,0x2C,0x0);
- VME_register_write(udev,0x30,0x0);
- VME_register_write(udev,0x34,0x0);
- VME_register_write(udev,0x3C,0x000);
-
- int nb = fInit->Get(10000,stackdata);
- int ret= xxusb_stack_execute(udev,(Uint32_t *)stackdata);
- printf("Init::%d ret=%d\n",nb,ret);
- if (ret>0) for (int i=0;i<ret/2;i++) printf ("stackdata=0x%08X\n",stackdata[i]);
-
- int nb0= fStack->Get(10000,&stackwrite[0]);
- if (nb0>768) {
- fprintf(stderr,"nb0=%d > 768 error xxusb_stack_write\n", nb0);
- exit(-1);
- }
- nb =xxusb_stack_write(udev,0x2,(Uint32_t *) stackwrite);
- nb0=xxusb_stack_read(udev,0x2,(Uint32_t *) stackdata);
- for (int i=0;i<stackwrite[0]+1;i++){
- if (stackdata[i]!=stackwrite[i]) printf("%d %d init err %x %x\n",nb,nb0,stackwrite[i], stackdata[i]);
- }
-
- if (fMode==2) xxusb_register_write(udev,1,0x1); // Start DAQ mode
-
- printf("daq::init() \n");
- return 0;
-}
-
-int daq::connect(){
- VME_START(NULL);
- printf("daq::connect()\n");
- return 0;
-}
-
-int daq::disconnect(){
- /* zakljuci */
- VME_STOP();
- printf("daq::disconnect()\n");
- return 0;
-}
-
-int daq:: clear(){
- return 0;
-}
-
-inline int module_header(int recid,Uint32_t *data,int len){
- data[0] = recid;
- data[1] = (len >0)? len : 0 ;
- return data[1]+2;
-}
-
-
-int daq::event(unsigned int *data, int maxn, int *ctr, int print){
- int tout=200; /* 1/100 of a second */
- const int lsize=sizeof(unsigned Uint32_t);
-
-
- ctr[0]++;
- ctr[1]++;
-
- int count=0;
-
- switch (fMode){
- case 0:// normal calls
- {
- unsigned short clr= 0x4;
- unsigned int status=0;
- Uint32_t mdata;
-
- for (int i=0;i<2;i++){
- // wait for trg
- tmlnk (tout);
- do VME_A24D16_R( addr[i] + CAENV965_SR1, &status); while ( (status&0x1)==0 && timer_out==0 );
- tmulk();
- // readout data
- if (timer_out) return 0;
- int len=0;
-
- do {
- VME_A24D32_R(addr[i] + CAENV965_OB, &mdata);
- mdata=data[count++];
- len++;
- } while ( (mdata & 0x4000000)==0 && timer_out==0) ; // bit 26 EOB or not valid datum
- // clear
- VME_A24D16_W( addr[i] + CAENV965_BS2, &clr);
- VME_A24D16_W( addr[i] + CAENV965_BC2, &clr);
-
- if (count+2<maxn) {
- if (print) printf("V965 %3d\n",len);
- count+=module_header(0x130+i,&data[count],len);
- ctr[2]++;
- ctr[3]+=len;
- }
-
- timer_out=0;
- }
- }
- break;
- case 1:// stack execute
- {
- fStack->Get(10000,(int *)data);
- int ret=xxusb_stack_execute(udev,(Uint32_t *) data); //The first element of the array is the number of bytes.
- if (ret< 0 ) {
- printf ("xxusb_stack_execute error err=%d\n",ret); \
- count = 0;
- } else count= ret/lsize;
-
- }
- break;
- case 2:// stack load
- {
- int ret=xxusb_usbfifo_read(udev,(int *) data,BUFF_L,100);
- if (ret< 0 ) {
- if (ret!=-110) {
- printf ("xxusb_usbfifo_read error err=%d\n",ret);
- end();
- init();
- }
- count = 0;
- } else {
- if (0 && print && ret>0) {
- for (int i=0;i<100;i++) {
- printf ("%4d fifodata=0x%08X\n",i, data[i]);
- if (data[i]==0xFAFB) break;
- }
- /*
-
- 0 fifodata=0x0000000D
- 1 fifodata=0x00000049
- 2 fifodata=0x0000FFAB
- 3 fifodata=0x00002000
- 4 fifodata=0x00000200
- 5 fifodata=0x00004141
- 6 fifodata=0x00000000
- 7 fifodata=0x00004057
- 8 fifodata=0x00000010
- 9 fifodata=0x00004052
- 10 fifodata=0x00000001
- 11 fifodata=0x0000405C
- 12 fifodata=0x00000011
- 13 fifodata=0x0000405D
- 14 fifodata=0x00000002
- 15 fifodata=0x0000405E
- 16 fifodata=0x00000012
- 17 fifodata=0x0000401C
- 18 fifodata=0x00000003
- 19 fifodata=0x0000402F
- 20 fifodata=0x00000013
- 21 fifodata=0x00004024
- 22 fifodata=0x00000004
- 23 fifodata=0x00004076
- 24 fifodata=0x00000014
- 25 fifodata=0x0000412F
- 26 fifodata=0x00000005
- 27 fifodata=0x0000404C
- 28 fifodata=0x00000015
- 29 fifodata=0x00004132
- 30 fifodata=0x00000006
- 31 fifodata=0x00004044
- 32 fifodata=0x00000016
- 33 fifodata=0x0000404A
- 34 fifodata=0x00000007
- 35 fifodata=0x0000409B
- 36 fifodata=0x00000017
- 37 fifodata=0x000040F1
- 38 fifodata=0x00000008
- 39 fifodata=0x00004087
- 40 fifodata=0x00000018
- 41 fifodata=0x00004173
- 42 fifodata=0x00000009
- 43 fifodata=0x0000404C
- 44 fifodata=0x00000019
- 45 fifodata=0x0000406C
- 46 fifodata=0x0000000A
- 47 fifodata=0x00004070
- 48 fifodata=0x0000001A
- 49 fifodata=0x0000406E
- 50 fifodata=0x0000000B
- 51 fifodata=0x00004014
- 52 fifodata=0x0000001B
- 53 fifodata=0x000040B7
- 54 fifodata=0x0000000C
- 55 fifodata=0x000040A9
- 56 fifodata=0x0000001C
- 57 fifodata=0x00004048
- 58 fifodata=0x0000000D
- 59 fifodata=0x00004118
- 60 fifodata=0x0000001D
- 61 fifodata=0x0000409D
- 62 fifodata=0x0000000E
- 63 fifodata=0x0000405B
- 64 fifodata=0x0000001E
- 65 fifodata=0x00004285
- 66 fifodata=0x0000000F
- 67 fifodata=0x00004159
- 68 fifodata=0x0000001F
- 69 fifodata=0x00000035
- 70 fifodata=0x00000400
- 71 fifodata=0x00000035
- 72 fifodata=0x00000600
- 73 fifodata=0x00000035
- 74 fifodata=0x0000FAFB
-
-
- */
- }
- if (print) printf("------------------ret=%d data[0]=%d\n",ret,(int)data[0]);
- count= ret/lsize;
- ctr[2]+=data[0];
- ctr[3]+=count;
- }
- }
- break;
- }
- return count*lsize;
-}
-
-int daq::end(){
-
- xxusb_register_write(udev,1,0x0); // Stop DAQ mode
- while (xxusb_usbfifo_read(udev,(int *) stackdata,BUFF_L,30)>0);
- printf("daq::end()\n");
- return 0;
-}
-
-daq::daq(){
- fMode = 2;
- fPedestal=255;
- for (int i=0;i<128;i++){
- if (i<72) fThreshold.push_back(0);
- else fThreshold.push_back(0x1<<8); // samo 4 kanali na zadnjem modulu so enablani
- }
- fThresholdEnable=0;
- fStop=0;
- fInit=NULL;
- fStack=NULL;
- connect();
-}
-
-daq::~daq(){
-disconnect();
-}
-
-#ifdef MAIN
-/* ------------------- CatchSig ----------------- */
-int ctrlcflag=0;
-
-void SigInt (int sig)
-{
- ctrlcflag = 1;
- timer_out=1;
-}
-
-int main (int argc, char **argv){
- // intercept routine
- if (signal (SIGINT, SigInt) == SIG_ERR) {
- perror ("sigignore");
- }
-
- // print welcome message
- time_t t,told, tstart, tstop;
- time(&t);
- fprintf(stdout,"#############################################\n");
- fprintf(stdout,"Program %s version %2.1f\n",argv[0], VERSION);
- fprintf(stdout,"Compiled on %s %s\n",__DATE__, __TIME__);
- fprintf(stdout,"Runtime %s \n",ctime(&t));
- fprintf(stdout,"#############################################\n");
-
-
- int neve=-1;
- char cfname[100]="test.dat";
- char *fname=cfname;
- char *fpedname=NULL;
-
-#define BSIZE 10000
- Uint32_t data[10000];
-
-
- daq *d= new daq();
- int c;
-
- while ((c = getopt (argc, argv, "p:n:t:o:")) != -1)
- switch (c)
- {
- case 'o':
- sprintf(fname ,"%s", optarg);
- if (fexist(fname)==1){
- fprintf(stdout,"Error !\n");
- fprintf(stdout,"File %s already exist. Appending ....\n",fname);
- //fprintf(stdout,"Remove the file and restart !!!\n");
- //exit(0);
- }
- break; // input file
- case 'n':
- neve = atoi(optarg); // negative argument time ( in s )limited event loop
- break;
- case 't':
- {
-
- sprintf(fpedname ,"%s", optarg);
- FILE *fped=fopen(fpedname,"r");
- int j=0;
- int ndim=400;
- char line[ndim];
- int val=0;
- while (fgets(line,ndim,fped)!=NULL){
- sscanf(line,"%d",&val);
- d->fThreshold[j++]=val;
- }
- d->fThresholdEnable=1;
- //fclose(fped);
- fclose(fped);
- break;
- }
- case 'p':
- gPedestal = atoi(optarg); // injected charge to the qdc
- break;
- }
-
- if (argc==1) {
- fprintf(stdout,"Usage: %s -o [filename] -n [number of events] -t [thresholdfile] -p <qdc inject charge>\n negative number of events = acq time in seconds\n",argv[0]);
- exit(-1);
- }
- //FILE *fp=fopen(fname,"a");
- gzFile fp=gzopen(fname,"a");
-
- d->init();
- d->clear();
-
- int hdr[4]={2}; // recid od run 11 naprej
- int i=0;
- int ntotal=0;
- int counters[30]={0,0,0,0,0, 0,0,0,0,0,0,0};
- char names[10][20]={"TRG","CAEN V965"};
- time(&t);
- tstart=t;
- tstop=tstart+360000;
- if (neve<-1) {
- tstop=tstart-neve;
- neve=-1;
- }
- for (i=0;i!=neve && !ctrlcflag && t<tstop;i++){
- time(&t);
- if (t!=told ) printf("%d in %2.2f min daq::event() %s\n",i, (double)(t-tstart)/60., ctime(&t));
- int nb=d->event(data,BSIZE, counters,t!=told);
- if (nb>0){
- // zapis v datoteko
- hdr[1]=nb+4*sizeof(int);
- hdr[2]=time(NULL);
- hdr[3]=i;
-
- //fwrite(hdr, sizeof(int),4 , fp);
- gzwrite(fp, hdr, sizeof(int)*4); //gzip
- // recid=1 do runa 10. ntotal += fwrite(data, sizeof(int),nb, fp);
- //ntotal += fwrite(data, 1,nb, fp);
- ntotal += gzwrite(fp, data, nb);
- told=t;
- } else i--;
- }
-
- d->end();
- delete d;
- printf("Number of Events: %d\n",i);
- if (ctrlcflag) printf("User Program termination CTRL-C\n");
- if (t>tstop ) printf("Timeout termination tstart# t>tstop: %d# %d >%d\n",(int)t, (int)tstart, (int) tstop);
-
-
- //fclose(fp);
- gzclose(fp);
- fprintf(stdout,"%d bytes written to %s\nCounts:\n", (int) (ntotal*sizeof(int)),fname);
- for (i=0;i<2;i++) fprintf(stdout,"%s\t%d\t%d\n",names[i],counters[2*i],counters[2*i+1]) ;
-
-
- return 0;
-}
-#endif
Index: petdaqfmf/.root_hist
===================================================================
--- petdaqfmf/.root_hist (revision 112)
+++ petdaqfmf/.root_hist (nonexistent)
@@ -1,99 +0,0 @@
-TBrowser tt
-.q
-TBrowser d
-TFile *_file0 = TFile::Open("test100.root")
-ach0->Draw()
-.q
-TFile *_file0 = TFile::Open("test50.root")
-ach0->Draw()
-.q
-TFile *_file0 = TFile::Open("test150.root")
-ach0->Draw()
-TFile *_file0 = TFile::Open("test250.root")
-ach0->Draw()
-TFile *_file0 = TFile::Open("test200.root")
-ach0->Draw()
-TFile *_file0 = TFile::Open("test150.root")
-ach0->Draw()
-TFile *_file0 = TFile::Open("test100.root")
-ach0->Draw()
-TFile *_file0 = TFile::Open("test50.root")
-ach0->Draw()
-.q
-TFile *_file0 = TFile::Open("test80.root")
-ach0->Draw()
-ach0->Draw()
-ach1->Draw()
-ach2->Draw()
-ach3->Draw()
-ach4->Draw()
-ach5->Draw()
-ach6->Draw()
-ach7->Draw()
-ach8->Draw()
-ach9->Draw()
-ach10->Draw()
-ach11->Draw()
-ach12->Draw()
-ach13->Draw()
-ach14->Draw()
-ach15->Draw()
-ach16->Draw()
-ach15->Draw()
-.q
-TFile *_file0 = TFile::Open("test80_reversed.root")
-ach15->Draw()
-ach1->Draw()
-ach2->Draw()
-ach3->Draw()
-ach4->Draw()
-ach4->Draw()
-.q
-TFile *_file0 = TFile::Open("test.root")
-ach4->Draw()
-1->Draw()
-a1->Draw()
-ach5->Draw()
-ach5->Draw()
-ach7->Draw()
-ach16->Draw()
-ach18->Draw()
-ach36->Draw()
-.q
-TFile *_file0 = TFile::Open("test1.root")
-ach7->Draw()
-ach17->Draw()
-ach7->Draw()
-.q
-TFile *_file0 = TFile::Open("test.root")
-ach7->Draw()
-ach27->Draw()
-ach17->Draw()
-ach18->Draw()
-ach16->Draw()
-ach15->Draw()
-ach14->Draw()
-ach13->Draw()
-.ls
-sumadc1->Draw()
-sumadc0->Draw()
-cadc0->Draw()
-pmt0->Draw()
-pmt1->Draw()
-pmt0->Draw()
-sumadc0->Draw()
-.q
-TFile *_file0 = TFile::Open("test_reversed.root")
-sumadc0->Draw()
-tbrowser
-TBrowser
-TBrowser jj
-.q
-TFile *_file0 = TFile::Open("test850.root")
-ach14->Draw()
-ach11->Draw()
-ach0->Draw()
-ach15->Draw()
-ach16->Draw()
-ach15->Draw()
-.q
Index: petdaqfmf/wienvme_dll.h
===================================================================
--- petdaqfmf/wienvme_dll.h (revision 112)
+++ petdaqfmf/wienvme_dll.h (nonexistent)
@@ -1,53 +0,0 @@
-#ifndef _WIENVME_DLL_H
-#define _WIENVME_DLL_H
-
-#include "libxxusb.h"
-
-extern usb_dev_handle *udev;
-
-
-
-int VME_start (char*);
-int VME_close (int);
-int VME_stop (void);
-int VME_reset (void);
-
-
-int VME_read16 (Uint32_t, void*);
-int VME_read32 (Uint32_t, void*);
-
-int VME_write16 ( Uint32_t, void*);
-int VME_write32 ( Uint32_t, void*);
-
-#define VME_START(NODE) VME_start((NODE))
-#define VME_STOP() VME_stop()
-#define VME_RESET() VME_reset()
-
-#define VME_A24D16_R(VME,DATA) VME_read16( (VME), (DATA))
-#define VME_A24D32_R(VME,DATA) VME_read32( (VME), (DATA))
-
-#define VME_A24D16_W(VME,DATA) VME_write16( (VME), (DATA))
-#define VME_A24D32_W(VME,DATA) VME_write32( (VME), (DATA))
-
-#define VME_A32D16_R(VME,DATA) VME_read16( (VME), (DATA))
-#define VME_A32D32_R(VME,DATA) VME_read32( (VME), (DATA))
-
-#define VME_A32D16_W(VME,DATA) VME_write16( (VME), (DATA))
-#define VME_A32D32_W(VME,DATA) VME_write32( (VME), (DATA))
-
-typedef unsigned short ADDRESS_MODIFIER;
-
-#define Std_Sup_Data (ADDRESS_MODIFIER)0x3d
-#define Std_Sup_Prog (ADDRESS_MODIFIER)0x3e
-#define Std_NoPriv_Data (ADDRESS_MODIFIER)0x39
-#define Std_NoPriv_Prog (ADDRESS_MODIFIER)0x3a
-
-#define Short_Sup (ADDRESS_MODIFIER)0x2d
-#define Short_NoPriv (ADDRESS_MODIFIER)0x29
-
-#define Ext_Sup_Data (ADDRESS_MODIFIER)0x0d
-#define Ext_Sup_Prog (ADDRESS_MODIFIER)0x0e
-#define Ext_NoPriv_Data (ADDRESS_MODIFIER)0x09
-#define Ext_NoPriv_Prog (ADDRESS_MODIFIER)0x0a
-
-#endif
/petdaqfmf/wienvme_dll.h
Property changes:
Deleted: svn:executable
Index: petdaqfmf/daq.h
===================================================================
--- petdaqfmf/daq.h (revision 112)
+++ petdaqfmf/daq.h (nonexistent)
@@ -1,24 +0,0 @@
-#ifndef _daq_h_
-#define _daq_h_
-#include <vector>
-class VmUsbStack;
-class daq {
-public:
- VmUsbStack * fStack;
- VmUsbStack * fInit;
- int fPedestal;
- int fThresholdEnable;
- std::vector<int> fThreshold;
- int fStop;
- int fMode;
- int clear();
- int end();
- int event(unsigned int *, int,int*, int );
- int init();
- int connect();
- int disconnect();
- daq();
- ~daq();
-};
-
-#endif
Index: petdaqfmf/VMEModule.hh
===================================================================
--- petdaqfmf/VMEModule.hh (revision 112)
+++ petdaqfmf/VMEModule.hh (nonexistent)
@@ -1,39 +0,0 @@
-/********************\
- VMEModule.hh
-
- update: 04/01/28
-
-\********************/
-
-#ifndef VMEMODULE_HH
-#define VMEMODULE_HH
-
-
-
-#include <stdio.h>
-#include <sys/types.h>
-#include "pcivme_ni.h"
-
-#define VMEA24 (unsigned short)0x39
-#define VMEA32 (unsigned short)0x09
-#define VMEA16 (unsigned short)0x29
-class VMEModule {
-protected:
- int m_fd;
- int m_vmeptr;
- caddr_t m_vmeaddr;
- size_t m_size;
- unsigned long m_baseaddress;
-public:
- VMEModule(int device, caddr_t vmeaddr, size_t size);
- ~VMEModule();
- unsigned long getBaseAddress() { return (unsigned long) m_baseaddress; }
- caddr_t getVmeAddress() { return m_vmeaddr; }
- void write32(unsigned long address, unsigned long value);
- unsigned long read32(unsigned long address);
-
- void write16(unsigned long address, unsigned short value);
- unsigned short read16(unsigned long address);
-};
-
-#endif
Index: petdaqfmf/README
===================================================================
--- petdaqfmf/README (revision 112)
+++ petdaqfmf/README (nonexistent)
@@ -1,2 +0,0 @@
-./daq -o [filename] -n [number of events] -t [thresholdfile] -p <qdc inject charge>
- negative number of events = acq time in seconds
Index: petdaqfmf/pcivme_ni.h
===================================================================
--- petdaqfmf/pcivme_ni.h (revision 112)
+++ petdaqfmf/pcivme_ni.h (nonexistent)
@@ -1,84 +0,0 @@
-#ifndef __PCIVME_NI_H__
-#define __PCIVME_NI_H__
-
-//-------------------------------------------------------------------------------------------
-// pcivme_ni.h - header for ni-labview shared library or dll for ARW pcivme interface
-// this library can also be used for other purposes aside from labview
-//
-// Copyright (C) 2002-2004 ARW Elektronik Germany
-//
-// this source code is published under LGPL (Open Source). You can use, redistrubute and
-// modify it unless this header is not modified or deleted. No warranty is given that
-// this software will work like expected.
-// This product is not authorized for use as critical component in life support systems
-// wihout the express written approval of ARW Elektronik Germany.
-//
-// Please announce changes and hints to ARW Elektronik
-//
-// $Log: pcivme_ni.h,v $
-// Revision 1.8 2004/08/13 19:23:45 klaus
-// conversion to kernel-version 2.6, released version 3.0
-//
-// Revision 1.7 2002/10/20 18:07:18 klaus
-// changed error handling
-//
-// Revision 1.6 2002/10/18 21:56:28 klaus
-// completed functional features, untested
-//
-// Revision 1.5 2002/10/18 21:56:28 klaus
-// completed functional features, untested
-//
-// Revision 1.4 2002/10/17 21:16:03 klaus
-// filled function bodies
-//
-// Revision 1.3 2002/10/17 21:16:03 klaus
-// filled function bodies
-//
-// Revision 1.2 2002/10/17 19:05:03 klaus
-// VME access is working through test to lib to driver
-//
-// Revision 1.1 2002/10/12 22:04:44 klaus
-// first work done
-//
-// what who when
-// first steps AR 17.11.1999
-// VMEerror new AR 07.01.2000
-// made LINUX shared library from windows template AR 12.10.2002
-//
-
-//-------------------------------------------------------------------------------------------
-// INCLUDES
-//
-#define BOOLEAN int
-#if !defined(TRUE) && !defined(FALSE)
- #define FALSE 0
- #define TRUE 1
-#endif
-
-//-------------------------------------------------------------------------------------------
-// PROTOTYPES
-//
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-int VMEopen(const char *cszDeviceName, unsigned char ubAddressModifier, int *pnHandle);
-int VMEinit(const char *cszDeviceName, unsigned short nVMEMM, unsigned char ubAddressModifier, int *pnHandle);
-int setAccessProperties(int nHandle, unsigned char bModifier, unsigned char bAccessType);
-int VMEread(int nHandle, unsigned long ulAddress, unsigned char ubAccessWidth, unsigned long ulElementCount, void *pvBuffer);
-int VMEwrite(int nHandle, unsigned long ulAddress, unsigned char ubAccessWidth, unsigned long ulElementCount, void *pvBuffer);
-int VMEaccessVIC(int nHandle, unsigned char ubAccessMode, unsigned short uwAddress, unsigned char *ubContent);
-int VMEreset(int nHandle);
-int VMETAS(int nHandle, unsigned long ulAddress, unsigned char *ubResult);
-int VMEcontrolInterrupt(int nHandle, BOOLEAN *bEnable);
-int VMEinterrupt(int nHandle, unsigned char *ubVector);
-int VMEsysfailGet(int nHandle, BOOLEAN *bResult);
-int VMEsysfailSet(int nHandle, BOOLEAN bForce);
-int VMEerror(int nHandle);
-int VMEclose(int nHandle);
-int GetLastError(int nHandle);
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* __PCIVME_NI_H__ */
Index: petdaqfmf/wienvmeusb_dll.c
===================================================================
--- petdaqfmf/wienvmeusb_dll.c (revision 112)
+++ petdaqfmf/wienvmeusb_dll.c (nonexistent)
@@ -1,98 +0,0 @@
-#include <stdlib.h>
-#include <stdio.h>
-#include "pcivme_ni.h"
-#include "wienvme_dll.h"
-//----------- DEFINES -----------------------------------------------------
-#define DEVICENAME_LINUX "/dev/vmemm_1" // a device name 'template' for WINNT
-
-usb_dev_handle *udev;
-
-
-
-
-int VME_start (char* serial)
-{
-
- char serial_default[100];
- sprintf(serial_default, "VM0120");
- if (serial != NULL)
- udev = xxusb_serial_open(serial);
- else
- udev = xxusb_serial_open(serial_default);
- printf(" VME_start %s--->udev!=NULL ==>%d\n", serial, udev!=NULL);
- if (!udev) {
- printf(" Check usb udev permissions and restart! Exiting .....\n", serial, udev!=NULL);
- exit(-1);
- }
- return 0;
-}
-
-
-
-int VME_stop ()
-{
- if (udev) xxusb_device_close(udev);
-
-
- return 0;
-}
-
-short Address_Modifier= Std_NoPriv_Data;
-
-int VME_read16 (Uint32_t at, void* buff)
-{
- int result;
-
-/* D16 read */
-
- result = VME_read_16(udev, Address_Modifier, at , (Uint32_t *) buff);
- if (result <0) {
- printf("D16 read at 0x%X failed! err=%d\n", at,result);
- }
-// printf("0x%X, 0x%X, 0x%X, 0x%X\n", hHandle, at, n, * (unsigned short *) buff);
- return (result);
-}
-
-int VME_read32 (Uint32_t at, void* buff)
-{
- int result;
-
-/* D32 read */
-
- result = VME_read_32(udev, Address_Modifier, at , (Uint32_t *) buff);
- if (result < 0) {
- printf("D32 read at 0x%X failed err=%d!\n", at,result);
- }
- //printf("0x%X, 0x%X, 0x%X, 0x%X\n", hHandle, at, n, * (unsigned short *) buff);
- return (result);
-}
-
-int VME_write16 (Uint32_t at, void* buff)
-{
- int result;
- Uint32_t data= *((short *)buff);
-
-/* D16 write */
-
- result = VME_write_16(udev, Address_Modifier, at, data );
- if (result<0) {
- printf("D16 write at 0x%X failed! err=%d\n", at,result);
- }
- return (result);
-}
-
-int VME_write32 ( Uint32_t at, void* buff)
-{
- int result;
- Uint32_t data= *((Uint32_t *)buff);
-
-/* D32 write */
-
- result = VME_write_32(udev, Address_Modifier, at, data );
-
- if (result<0) {
- printf("D32 write at 0x%X failed! err=%d\n", at,result);
- }
- //printf("D32 write at 0x%lX buff=0x%X\n", at,((int*) buff)[0]);
- return (result);
-}
/petdaqfmf/wienvmeusb_dll.c
Property changes:
Deleted: svn:executable