#define OUTFILE_HB_HIT_SPY "./HB_HIT_SPY" #define OUTFILE_HB_ROAD_SPY "./HB_ROAD_SPY" #define OUTFILE_HB_OUT_SPY "./HB_OUT_SPY" #define NO_FILE -103 #define HB_SPY_POINTER_MASK 0x1ffff #define HB_SPY_OVERFLOW 0x20000 #define HB_SPY_FREEZE_ 0x40000 #include #include #include #include #include #include "vmesvt_realvme_ppc.h" #define sc1add 3 #define hb1add 12 #define SC_CRATE "vmesvt1.ts.infn.it" #define HB_CRATE "b0svt01" VISION_SLAVE sc1; VISION_SLAVE hb1; main() { unsigned long i; long result; unsigned long hb_out_hold; unsigned long time_delay; unsigned long reg; int pntr,out_pntr,road_pntr,status,outwrap,hitwrap; int hit_pntr,ams_hit_pntr,ams_out_pntr; int offset =0; int wrap,notwrap,iterations; unsigned long freeze; unsigned long * spy_ptr; unsigned long mask_23bit = 0x7fffff; char hb_cpu[10]; int hbadd; FILE *hb_cpu_file; FILE *tempfile; printf("SPY CONTROL definition..."); SPYCONTROL_DEFINE_N(&sc1,sc1add,SC_CRATE); printf("ok\n"); printf("hit buffer definition..."); if ( (hb_cpu_file = fopen("hb_cpu", "r")) == NULL) { printf("cannot open file hb_cpu \n"); exit (33); } else { fscanf(hb_cpu_file,"%s", hb_cpu); printf("file read, cpu is : %s ", hb_cpu); fscanf(hb_cpu_file,"%d", &hbadd); printf("slot is : %d ", hbadd); } HIT_BUFFER_DEFINE( &hb1, hbadd, hb_cpu); printf("ok\n"); freeze = 1; spycontrol_SvtFreezeGen(sc1, &freeze); hit_buffer_OutSpyRegisterStatus(hb1, ®); out_pntr = reg&0x1FFFF; outwrap = reg>>17&1; if (outwrap) wrap++; if (!outwrap) notwrap++; def_struct(out_pntr,&spy_ptr); if (out_pntr) hit_buffer_OutputSpyBufferRead(hb1, spy_ptr, out_pntr); tempfile = fopen(OUTFILE_HB_OUT_SPY,"w"); if (out_pntr) for (i=0;i>17&1; def_struct(hit_pntr,&spy_ptr); if (hit_pntr) hit_buffer_HitSpyBufferRead(hb1, spy_ptr, hit_pntr); tempfile = fopen(OUTFILE_HB_HIT_SPY,"w"); for (i=0;i