EnglishJapanese Reload Front page List of pages Search Recent changes RSS of recent changes

Back to FrontEnd page

Readout routine for CC/NET

Files

Makefile
Symbolic link to Makefile.24 or Makefile.26. There are two versions of CC/NET (2.4 and 2.6).
babildrv.c
Main routine
bbmodules.h
User header file
startup.c
Startup routine
evt.c
Event-by-event readout routine
sca.c
Buffer-by-buffer readout routine
stop.c
Stop routine

Header file

bbmodules.h

#include "/home/daq/daqconfig/include/segidlist.h"
#define EFN     23     // Event flagment number
#define MAXBUFF 3500   // Maximum buffer size
#define CAMAC
#define CCNET 
#define DBUFF

/* Dummy LAMN */
#define LAMN 0

#define CMDLEN 300

#define USR_CMDLEN 100
#define SCRLEN 12 

Startup

startup.c

 void startup(void){
  int i, val=0;

  /* Startup Function, these two lines are clear registers in CC/NET */
  ccnet_crate_reset();
  check_lam();

  /* Dummy LAM definition, to use LAM, this line is needed */
  crate_define_lam(LAMN);

  /* Create ccnet command frame for event-by-event readout */
  ccnetstartup();
 
  /* Create user command frame for scaler readout */
  usr_ccnet_gen_init(USR_CMDLEN);
  for(i=0;i<SCRLEN;i++){
    usr_ccnet_gen_cc(10, i, 0, val);
  }

  /* Clear modules */
  //control_mod(0, N, 0, 9);      // Clear command
  //write_data(0, N, 0, 17, VAL); // via out put register

  /* from here, user initialization */ 
  /* put clear commands and some initial values */
  control_mod(0, 1, 0, 9);
  control_mod(0, 6, 0, 9);
  control_mod(0, 7, 0, 9);
  control_mod(0, 9, 0, 9);
  control_mod(0, 10, 0, 9);
  write_data(0,2,0,16,0x0000);
  write_data(0,4,0,16,0x0000);
  control_mod(0, 2, 0, 9);
  control_mod(0, 4, 0, 9);
  /* end of user initialization */

  /* Set trigger mode, do not change */
  ccnet_trig();                   // Interrupt by CC/NET front panel
  ccnet_pulsemode();              // Define pulse mode
  ccnet_pulse();                  // Output pulse from CC/NET front panel
} 

Event-by-event readout

evt.c, don't change this.

void evt(void){
  check_lam();

  /* Initialize event */
  init_event();

  /* Read and store ccnet data */
  ccnet_recseg();

}  

ccnetsegment.c, for user event-by-event readout. ccnetsegment.c may be symbolic link to ccnet0X_evt.c .

void ccnetsegment(void){
  /* Event */
  /* event-by-event Scaler */
  init_segment(SEGIDGEN(BIGRIPS,F7,SCALER,C24));
  read_segndata24(2,0,10,0,0);
  end_segment();

  /* F7 */
  /* TDC */
  init_segment(SEGIDGEN(BIGRIPS,F7,PPACT,C16));
  read_segndata(4,0,6,0,0);
  read_segndata(16,0,7,0,0);
  end_segment();
  /* QDC */
  init_segment(SEGIDGEN(BIGRIPS,F7,PPACQ,C16));
  read_segndata(4,0,2,0,2);
  read_segndata(16,0,4,0,2);
  end_segment();
  /* TDC */
  init_segment(SEGIDGEN(BIGRIPS,F7,PLAT,C16));
  read_segdata(0,9,0,0);
  read_segdata(0,9,5,0);
  end_segment();
  /* QDC */
  init_segment(SEGIDGEN(BIGRIPS,F7,PLAQ,C16));
  read_segndata(2,0,2,4,2);
  end_segment();

  /* Clear modules */
  control_mod(0,1,0,9);
  control_mod(0,2,0,9);
  control_mod(0,4,0,9);
  control_mod(0,6,0,9);
  control_mod(0,7,0,9);
  control_mod(0,9,0,9);
}

Stop routine

stop.c, nothing to do.

 void stop(void){
 }

Scaler readout (buffer-by-buffer readout)

sca.c

void sca(void){
  init_ncscaler(CCNET03SCALER); // scaler header (non-clear scaler 24 bit)
  usr_ccnet_scrdata_dma24();  // user function is set in startup.c
  end_ncscaler();
}  

Hardware setting

For now Linux OS is installed on Compact Flash. Netboot system is planed in the future.

Last-modified: Mon, 22 Mar 2010 21:52:25 HADT (5147d)