V1495 CODA CRL File

From New IAC Wiki
Jump to navigation Jump to search

#  General User readout list
#
#    David Abbott, TJNAF 2000

readout list GEN_USER
maximum 1024,512
general readout

#Event header label
const GEM_BTYPE     = 0x7513 # G=7 E=5 M=13 th letter of alphabet GEM = 0x47 0x45 0x4D in ASCI tables

# A16 Address for SIS3610 Module
const TRIG_ADDR=0x3800
const V1495ADR = 0x08110000


extern int bigendian_out;

begin download

  s3610Init(TRIG_ADDR,0,0);

# When sending to a Linux Host set bigendian_out = 0
bigendian_out = 0;


  log inform "User Download Executed"

end download
    
begin prestart

  variable jj, adc_id
  short buf;

  log inform "Entering User Prestart"

  init trig source GEN 
 link async trig source GEN 1 to usrtrig and usrtrig_done
  event type 1 then read GEN 1

%%
  v1495Init(V1495ADR);
%%
  log inform "User Prestart Executed"

end prestart

begin end

  CDODISABLE(GEN,1,1);
  log inform "User End Executed"

end end

begin pause

  CDODISABLE(GEN,1,1);

  log inform "User Pause Executed"

end pause

begin go
  
  log inform "Entering User Go"
  
  CDOENABLE(GEN,1,1);

end go

begin trigger usrtrig
 
  variable ii,len,i
  short buf;
  int nwrds=0,BuffWords=0;
  int jj,trigval,numchan,id,latch;

  rol->dabufp = (long *) 0;

  open event type EVTYPE of BT_BANK

/* readout the V1495 */

    open bank GEM_BTYPE of BT_UI4
%%
  nwrds=v1495DataReady();
   
if (nwrds){

      BuffWords= v1495FillData(rol->dabufp);

      rol->dabufp += BuffWords;
 else {
      logMsg("ERROR: v1495ReadEvent returned %d words\n",nwrds,0,0,0,0,0);
   }

%%
    close bank

   close event

end trigger

begin done usrtrig

end done

begin done

# Re-enable Trigger Source here
  s3610IntAck(1);

end done

begin status

end status