AlcapDAQ  1
Data Structures | Macros | Typedefs | Functions | Variables
dt5720_module.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/io.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include "midas.h"
#include "crate.h"
#include "diag.h"
#include "CAENDigitizer.h"
#include "CAENDigitizerType.h"

Go to the source code of this file.

Data Structures

struct  s_dt5720_odb
 

Macros

#define S_DT5720_ODB_STR   "\[.]\n\software_trigger_mode = BYTE : 0\n\hardware_trigger_mode = BYTE : 0\n\self_trigger_mode = BYTE : 0\n\trigger_positive_edge = BOOL : y\n\max_events_per_block = DWORD : 1024\n\event_aligned_readout = BOOL : y\n\logic_level = STRING : [4] NIM\n\post_trigger_size = BYTE : 20\n\gpi_acquisition_mode = BOOL : n\n\zero_suppression_mode = BYTE : 0\n\event_packing = BOOL : n\n\ext_clock = BOOL : n\n\waveform length = DWORD : 64\n\\n\[Ch00]\n\enable = BOOL : n\n\offset = FLOAT : 0\n\self_trigger_threshhold = FLOAT : 0\n\\n\[Ch01]\n\enable = BOOL : n\n\offset = FLOAT : 0\n\self_trigger_threshhold = FLOAT : 0\n\\n\[Ch02]\n\enable = BOOL : n\n\offset = FLOAT : 0\n\self_trigger_threshhold = FLOAT : 0\n\\n\[Ch03]\n\enable = BOOL : n\n\offset = FLOAT : 0\n\self_trigger_threshhold = FLOAT : 0\"
 

Typedefs

typedef struct timespec timer_start
 
typedef struct s_dt5720_odb S_DT5720_ODB_DEF
 

Functions

static INT dt5720_init ()
 
static void dt5720_exit ()
 
static INT dt5720_pre_bor ()
 
static INT dt5720_eor ()
 
static INT dt5720_poll_live ()
 
static INT dt5720_read (char *pevent)
 
static void dt5720_readout ()
 
static BOOL dt5720_update_digitizer ()
 
static BOOL is_caen_error (CAEN_DGTZ_ErrorCode, int, const char *)
 
static uint32_t analog2adc_trigger (int)
 
static uint32_t analog2adc_offset (int)
 

Variables

static int handle
 
static uint32_t VME_BASE = 0x00000000
 
static char * caen_data_buffer = NULL
 
static uint32_t caen_data_buffer_size = 0
 
static char * data_buffer
 
static uint32_t data_buffer_size
 
static uint32_t data_size
 
bool block_sig
 
struct readout_module dt5720_module
 
static S_DT5720_ODB_DEF S_DT5720_ODB
 
HNDLE hDB
 

Macro Definition Documentation

#define S_DT5720_ODB_STR   "\[.]\n\software_trigger_mode = BYTE : 0\n\hardware_trigger_mode = BYTE : 0\n\self_trigger_mode = BYTE : 0\n\trigger_positive_edge = BOOL : y\n\max_events_per_block = DWORD : 1024\n\event_aligned_readout = BOOL : y\n\logic_level = STRING : [4] NIM\n\post_trigger_size = BYTE : 20\n\gpi_acquisition_mode = BOOL : n\n\zero_suppression_mode = BYTE : 0\n\event_packing = BOOL : n\n\ext_clock = BOOL : n\n\waveform length = DWORD : 64\n\\n\[Ch00]\n\enable = BOOL : n\n\offset = FLOAT : 0\n\self_trigger_threshhold = FLOAT : 0\n\\n\[Ch01]\n\enable = BOOL : n\n\offset = FLOAT : 0\n\self_trigger_threshhold = FLOAT : 0\n\\n\[Ch02]\n\enable = BOOL : n\n\offset = FLOAT : 0\n\self_trigger_threshhold = FLOAT : 0\n\\n\[Ch03]\n\enable = BOOL : n\n\offset = FLOAT : 0\n\self_trigger_threshhold = FLOAT : 0\"

Definition at line 110 of file dt5720_module.c.

Referenced by dt5720_init().

Typedef Documentation

typedef struct timespec timer_start

Definition at line 53 of file dt5720_module.c.

Function Documentation

uint32_t analog2adc_offset ( int  ch)
static

Definition at line 569 of file dt5720_module.c.

References s_dt5720_odb::ch00, s_dt5720_odb::ch01, s_dt5720_odb::ch02, s_dt5720_odb::ch03, s_dt5720_odb::offset, and printf().

Referenced by dt5720_update_digitizer().

570 {
571 
572  static const uint32_t adcmax = 65535;
573  static const uint32_t adcmin = 0;
574  static const float analogmax = 1.;
575  static const float analogmin = -1.;
576  static const float slope = (float)(adcmax-adcmin)/(analogmax-analogmin);
577 
578  /*
579  Map analogue voltage offset (-1V-1V) to 16 bit ADC value (0-65535=2^16-1)
580  Dynamic ranges:
581  0x0000 -> -2V to 0V
582  0x8000 -> -1V to 1V
583  0xFFFF -> 0V to 2V
584  */
585  float v;
586  switch(ch)
587  {
588  case 0: v = S_DT5720_ODB.ch00.offset; break;
589  case 1: v = S_DT5720_ODB.ch01.offset; break;
590  case 2: v = S_DT5720_ODB.ch02.offset; break;
591  case 3: v = S_DT5720_ODB.ch03.offset; break;
592  default: return 0x8000;
593  }
594 
595  if(v>analogmax)
596  {
597  cm_msg(MINFO,"dt5720_update_digitizer","Invalid voltage offset. Set to 1V.");
598  return adcmin;
599  }
600  else if(v<analogmin)
601  {
602  cm_msg(MINFO,"dt5720_update_digitizer","Invalid voltage offset. Set to -1V.");
603  return adcmax;
604  }
605 
606  v += 1.;
607 
608  uint32_t dac = slope*v;
609  printf("DAC offset: channel %i DAC %i\n",ch, dac);
610 
611 
612  return dac;
613 }
uint32_t analog2adc_trigger ( int  ch)
static

Definition at line 615 of file dt5720_module.c.

References s_dt5720_odb::ch00, s_dt5720_odb::ch01, s_dt5720_odb::ch02, s_dt5720_odb::ch03, s_dt5720_odb::offset, printf(), and s_dt5720_odb::self_trigger_threshold.

Referenced by dt5720_update_digitizer().

616 {
617  static const float dynamicrange = 2.;
618  static const uint32_t adcmax = 4095;
619  //static const uint32_t adcmax = 65535;
620  static const uint32_t adcmin = 0;
621  static const float slope = (adcmax-adcmin)/dynamicrange;
622 
623  float v, vmin;
624 
625  switch(ch)
626  {
627  case 0:
629  vmin = S_DT5720_ODB.ch00.offset - 1.;
630  break;
631  case 1:
633  vmin = S_DT5720_ODB.ch01.offset - 1.;
634  break;
635  case 2:
637  vmin = S_DT5720_ODB.ch02.offset - 1.;
638  break;
639  case 3:
641  vmin = S_DT5720_ODB.ch03.offset - 1.;
642  break;
643  default:
644  return (adcmax-adcmin)/2;
645  }
646 
647  if(v<vmin || v>(vmin+dynamicrange))
648  {
649  v = vmin+dynamicrange/2.;
650  cm_msg(MINFO,"dt5720_update_digitizer","Invalid self trigger threshold. Set to center.");
651  }
652 
653  uint32_t dac = (v-vmin)*slope;
654  printf("Trigger threshold: channel %i DAC %i DAC\n",ch,dac);
655 
656  return dac;
657 }
INT dt5720_eor ( )
static

Definition at line 255 of file dt5720_module.c.

References caen_data_buffer, CAEN_DGTZ_FreeReadoutBuffer(), CAEN_DGTZ_SWStopAcquisition(), handle, is_caen_error(), and SUCCESS.

256 {
257 
259 #ifdef SW_CONTROL
261  if(is_caen_error(ret,__LINE__-1,"dt5720_bor")) return FE_ERR_HW;
262 #endif /* SW_CONTROL */
264  if(is_caen_error(ret,__LINE__-1,"dt5720_eor")) return FE_ERR_HW;
265 
266  caen_data_buffer = NULL;
267 
268  return SUCCESS;
269 }
void dt5720_exit ( )
static

Definition at line 218 of file dt5720_module.c.

References CAEN_DGTZ_CloseDigitizer(), data_buffer, handle, and is_caen_error().

219 {
220 
223  is_caen_error(ret,__LINE__-1,"dt5720_exit");
224  free(data_buffer);
225 }
INT dt5720_init ( )
static

Definition at line 150 of file dt5720_module.c.

References CAEN_DGTZ_BoardInfo_t::AMC_FirmwareRel, CAEN_DGTZ_ACQ_CONTROL_ADD, CAEN_DGTZ_GetInfo(), CAEN_DGTZ_OpenDigitizer(), CAEN_DGTZ_Reset(), CAEN_DGTZ_USB, CAEN_DGTZ_WriteRegister(), crate_number, s_dt5720_odb::ext_clock, FALSE, handle, hDB, hKey, is_caen_error(), CAEN_DGTZ_BoardInfo_t::ModelName, printf(), CAEN_DGTZ_BoardInfo_t::ROC_FirmwareRel, S_DT5720_ODB_STR, sprintf(), status, and VME_BASE.

151 {
152  printf("Opening CAEN USB interface ...");
153  fflush(stdout);
154 
155  HNDLE hKey;
157  CAEN_DGTZ_BoardInfo_t BoardInfo;
158 
159  /* Grab Board */
160  /* int iLine = 0;
161  ret = CAEN_DGTZ_OpenDigitizer(CAEN_DGTZ_USB,iLine,0,VME_BASE,&handle);*/
163  /*
164  while(ret==CAEN_DGTZ_CommError)
165  {
166  //iLine++;
167  ret = CAEN_DGTZ_OpenDigitizer(CAEN_DGTZ_USB,iLine,0,VME_BASE,&handle);
168  }
169  */
170  if(is_caen_error(ret,__LINE__-1,"dt5720_init")) return FE_ERR_HW;
171 
172  /* Get Board Info */
173  ret = CAEN_DGTZ_GetInfo(handle,&BoardInfo);
174  if(is_caen_error(ret,__LINE__-1,"dt5720_init")) return FE_ERR_HW;
175  printf("\nConnected to CAEN Desktop Digitizer Model %s\n",BoardInfo.ModelName);
176  printf("\tROC FPGA Release is %s\n",BoardInfo.ROC_FirmwareRel);
177  printf("\tAMC FPGA Release is %s\n",BoardInfo.AMC_FirmwareRel);
178 
179  /* Reset Digitizer */
180  ret = CAEN_DGTZ_Reset(handle);
181  if(is_caen_error(ret,__LINE__-1,"dt5720_init")) return FE_ERR_HW;
182 
183  /* Link to Database */
184  //cm_get_experiment_database(&hDB,NULL);
185  char str[1024];
186  sprintf(str,"/Equipment/Crate %i/Settings/CAEN",crate_number);
187  int status = db_check_record(hDB,0,str,S_DT5720_ODB_STR,FALSE);
188  if(status==DB_NO_KEY || status==DB_STRUCT_MISMATCH)
189  {
190  status = db_create_record(hDB,0,str,S_DT5720_ODB_STR);
191  printf("Creating key with status: %d \n",status);
192  }
193  else if (status==DB_INVALID_HANDLE)
194  {
195  printf("Error: Cannot connect to database to setup CAEN DT5720.");
196  }
197 
198  status = db_find_key(hDB,0,str,&hKey);
199  status = db_open_record(hDB,hKey,&S_DT5720_ODB,sizeof(S_DT5720_ODB),MODE_READ,NULL,NULL);
200 
201  // configure clock input
202  if ( S_DT5720_ODB.ext_clock )
203  {
204  printf("Using external clock\n");
206  if(is_caen_error(ret,__LINE__-1,"dt5720_init")) return FE_ERR_HW;
207  }
208  else
209  {
210  printf("Using internal clock\n");
211  }
212 
213 
214  return status;
215 
216 }
INT dt5720_poll_live ( )
static

Definition at line 326 of file dt5720_module.c.

References dt5720_readout(), and SUCCESS.

327 {
328 
329  dt5720_readout();
330 
331  return SUCCESS;
332 }
INT dt5720_pre_bor ( )
static

Definition at line 227 of file dt5720_module.c.

References caen_data_buffer, caen_data_buffer_size, CAEN_DGTZ_ClearData(), CAEN_DGTZ_MallocReadoutBuffer(), CAEN_DGTZ_SetAcquisitionMode(), CAEN_DGTZ_SW_CONTROLLED, CAEN_DGTZ_SWStartAcquisition(), data_size, dt5720_update_digitizer(), handle, is_caen_error(), printf(), and SUCCESS.

228 {
230 
231 #ifdef SW_CONTROL
233  if(is_caen_error(ret,__LINE__-1,"dt5720_bor")) return FE_ERR_HW;
235  if(is_caen_error(ret,__LINE__-1,"dt5720_bor")) return FE_ERR_HW;
236 #endif /* SW_CONTROL */
237 
238  /* Setup Digitizer */
239  if(!dt5720_update_digitizer()) return FE_ERR_HW;
240 
241  /* Allocate space for readout from digitizer */
243  if(is_caen_error(ret,__LINE__-1,"dt5720_bor")) return FE_ERR_HW;
244  printf("Allocated %i bytes for CAEN data buffer\n", caen_data_buffer_size);
245 
246  /* Clear any remaining data */
248  if(is_caen_error(ret,__LINE__-1,"dt5720_bor")) return FE_ERR_HW;
249 
250  data_size = 0;
251 
252  return SUCCESS;
253 }
INT dt5720_read ( char *  pevent)
static

Definition at line 271 of file dt5720_module.c.

References data_buffer, data_size, dt5720_readout(), sprintf(), and SUCCESS.

272 {
273  //printf("Read out data from desktop digitizer\n");
274 
275  // =====================================================================================
276  // Read out remaining data from the digitizer
277  // =====================================================================================
278  dt5720_readout();
279 
280  // =====================================================================================
281  // Fill MIDAS event
282  // =====================================================================================
283  bk_init32(pevent);
284  char bk_name[5];
285  char *pdata;
286 
287  sprintf(bk_name,"CND0");
288  bk_create(pevent, bk_name, TID_BYTE, &pdata);
289  if ( data_size > MAX_EVENT_SIZE )
290  {
291  cm_msg(MERROR,"dt5720_read","Event size is too large. Truncating data...\n");
292  data_size = MAX_EVENT_SIZE;
293  }
294  memcpy(pdata, data_buffer, data_size);
295  pdata += data_size;
296  bk_close(pevent, pdata);
297  // reset data couner for the next event
298  data_size = 0;
299 
300  return SUCCESS;
301 }
void dt5720_readout ( )
static

Definition at line 303 of file dt5720_module.c.

References caen_data_buffer, CAEN_DGTZ_ReadData(), CAEN_DGTZ_SLAVE_TERMINATED_READOUT_MBLT, data_buffer, data_buffer_size, data_size, handle, and is_caen_error().

Referenced by dt5720_poll_live(), and dt5720_read().

304 {
305 
306  CAEN_DGTZ_ErrorCode ret;
307  uint32_t caen_data_size;
308 
309  /* Read out data if there is any */
311  is_caen_error(ret,__LINE__-1,"dt5720_readout");
312 
313  /* If there's data, copy from digitizers local buffer to different local buffer */
314  if(caen_data_size > 0)
315  {
316  //printf("data size: %i\n", caen_data_size);
317 
318  if(data_size+caen_data_size < data_buffer_size )
319  {
320  memcpy((data_buffer+data_size), caen_data_buffer, caen_data_size);
321  data_size += caen_data_size;
322  }
323  }
324 }
BOOL dt5720_update_digitizer ( )
static

Definition at line 334 of file dt5720_module.c.

References analog2adc_offset(), analog2adc_trigger(), CAEN_DGTZ_BROAD_CH_CTRL_ADD, CAEN_DGTZ_DISABLE, CAEN_DGTZ_ENABLE, CAEN_DGTZ_IOLevel_NIM, CAEN_DGTZ_IOLevel_TTL, CAEN_DGTZ_ReadRegister(), CAEN_DGTZ_S_IN_CONTROLLED, CAEN_DGTZ_SetAcquisitionMode(), CAEN_DGTZ_SetChannelDCOffset(), CAEN_DGTZ_SetChannelEnableMask(), CAEN_DGTZ_SetChannelSelfTrigger(), CAEN_DGTZ_SetChannelTriggerThreshold(), CAEN_DGTZ_SetEventPackaging(), CAEN_DGTZ_SetExtTriggerInputMode(), CAEN_DGTZ_SetIOLevel(), CAEN_DGTZ_SetMaxNumEventsBLT(), CAEN_DGTZ_SetPostTriggerSize(), CAEN_DGTZ_SetRecordLength(), CAEN_DGTZ_SetSWTriggerMode(), CAEN_DGTZ_SetTriggerPolarity(), CAEN_DGTZ_SetZeroSuppressionMode(), CAEN_DGTZ_Success, CAEN_DGTZ_SW_CONTROLLED, CAEN_DGTZ_TRGMODE_ACQ_AND_EXTOUT, CAEN_DGTZ_TRGMODE_ACQ_ONLY, CAEN_DGTZ_TRGMODE_DISABLED, CAEN_DGTZ_TRGMODE_EXTOUT_ONLY, CAEN_DGTZ_TriggerOnFallingEdge, CAEN_DGTZ_TriggerOnRisingEdge, CAEN_DGTZ_WriteRegister(), CAEN_DGTZ_ZS_AMP, CAEN_DGTZ_ZS_NO, CAEN_DGTZ_ZS_ZLE, s_dt5720_odb::ch00, s_dt5720_odb::ch01, s_dt5720_odb::ch02, s_dt5720_odb::ch03, data_buffer, data_buffer_size, s_dt5720_odb::enable, s_dt5720_odb::event_packing, s_dt5720_odb::gpi_acquisition_mode, handle, s_dt5720_odb::hardware_trigger_mode, is_caen_error(), s_dt5720_odb::logic_level, s_dt5720_odb::max_events_per_block, s_dt5720_odb::post_trigger_size, s_dt5720_odb::self_trigger_mode, s_dt5720_odb::software_trigger_mode, s_dt5720_odb::trigger_positive_edge, s_dt5720_odb::wf_length, and s_dt5720_odb::zero_suppression_mode.

Referenced by dt5720_pre_bor().

335 {
337  /* General CAEN settings */
338 
340  {
341  case 0:
343  break;
344  case 1:
346  break;
347  case 2:
349  break;
350  case 3:
352  break;
353  default:
355  cm_msg(MINFO,"dt5720_update_digitizer","Invalid software trigger mode. Set to DISABLED. (%i)",(int)S_DT5720_ODB.software_trigger_mode);
356  break;
357  }
358  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
359 
361  {
362  case 0:
364  break;
365  case 1:
367  break;
368  case 2:
370  break;
371  case 3:
373  break;
374  default:
376  cm_msg(MINFO,"dt5720_update_digitizer","Invalid hardware trigger mode. Set to DISABLED.");
377  break;
378  }
379  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
380 
381  uint32_t caen_self_trigger_mask = 0b1111;
383  {
384  case 0:
386  break;
387  case 1:
389  break;
390  case 2:
392  break;
393  case 3:
395  break;
396  default:
398  cm_msg(MINFO,"dt5720_update_digitizer","Invalid channel self trigger mode. Set to DISABLED. (%i)",(int)S_DT5720_ODB.self_trigger_mode);
399  break;
400  }
401  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
402 
403  // According to correspondence with CAEN, second argument (channel nuumber) is ignored.
404  // But just in case...
406  {
411  }
412  else
413  {
418  }
419  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
420 
422  {
424  }
425  else
426  {
428  cm_msg(MINFO,"dt5720_update_digitizer","Invalid max block size. Set to 1024.");
429  }
430  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
431 
432  if(strcmp(S_DT5720_ODB.logic_level,"NIM") == 0)
434  else if(strcmp(S_DT5720_ODB.logic_level,"TTL") == 0)
436  else
437  {
439  cm_msg(MINFO,"dt5720_update_digitizer","Invalid logic level. Set to NIM.");
440  }
441  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
442 
444  {
446  }
447  else
448  {
450  cm_msg(MINFO,"dt5720_update_digitizer","Invalid post trigger size. Set to 80 percent.");
451  }
452  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
453 
455  {
457  }
458  else
459  {
461  }
462  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
463 
465  {
466  case 0:
468  break;
469  case 2:
471  break;
472  case 3:
474  break;
475  default:
477  cm_msg(MINFO,"dt5720_update_digitizer","Invalid zero suppression mode. Set to none.");
478  break;
479  }
480  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
481 
482 
484  {
486  }
487  else
488  {
490  }
491  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
492 
493  // Channel specific
494  uint32_t caen_channel_mask = 0;
496  caen_channel_mask |= (1 << 0);
498  caen_channel_mask |= (1 << 1);
500  caen_channel_mask |= (1 << 2);
502  caen_channel_mask |= (1 << 3);
503  ret = CAEN_DGTZ_SetChannelEnableMask(handle,caen_channel_mask);
504 
506  0,
507  analog2adc_offset(0));
508  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
510  1,
511  analog2adc_offset(1));
512  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
514  2,
515  analog2adc_offset(2));
516  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
518  3,
519  analog2adc_offset(3));
520  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
521 
523  0,
524  analog2adc_trigger(0));
525  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
527  1,
528  analog2adc_trigger(1));
529  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
531  2,
532  analog2adc_trigger(2));
533  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
535  3,
536  analog2adc_trigger(3));
537  if(is_caen_error(ret,__LINE__,"dt5720_update_digitizer")) return false;
538 
539  // =====================================================================================
540  // Record length
541  // =====================================================================================
543  if ( ret != CAEN_DGTZ_Success )
544  {
545  cm_msg(MERROR,"dt5720_update_digitizer","Cannot SetRecordLength. Error 0x%08x\n",ret);
546  return FE_ERR_HW;
547  }
548 
549  // ======================================================================================
550  // Channel configuration through register 0x8000=CAEN_DGTZ_BROAD_CH_CTRL_ADD
551  // ======================================================================================
552  uint32_t data;
554  if(is_caen_error(ret,__LINE__-1,"dt5720_update_digitizer")) return FE_ERR_HW;
555 
556  // Bit 4 must always be set to 1
557  data |= (1<<4);
558  // enable trigger overlap
559  data |= (1<<1);
561  if(is_caen_error(ret,__LINE__-1,"dt5720_update_digitizer")) return FE_ERR_HW;
562 
563  data_buffer_size = 32*1024*1024;
564  data_buffer = (char*) malloc(data_buffer_size);
565 
566  return true;
567 }
BOOL is_caen_error ( CAEN_DGTZ_ErrorCode  e,
int  l,
const char *  r 
)
static

Definition at line 659 of file dt5720_module.c.

References CAEN_DGTZ_BadBoardType, CAEN_DGTZ_BadEventNumber, CAEN_DGTZ_BadInterruptLev, CAEN_DGTZ_CalibrationError, CAEN_DGTZ_ChannelBusy, CAEN_DGTZ_CommError, CAEN_DGTZ_DigitizerAlreadyOpen, CAEN_DGTZ_DigitizerMemoryCorrupted, CAEN_DGTZ_DigitizerNotFound, CAEN_DGTZ_DigitizerNotReady, CAEN_DGTZ_DPPFirmwareNotSupported, CAEN_DGTZ_EventNotFound, CAEN_DGTZ_FPIOModeInvalid, CAEN_DGTZ_FunctionNotAllowed, CAEN_DGTZ_GenericError, CAEN_DGTZ_InterruptNotConfigured, CAEN_DGTZ_InvalidBuffer, CAEN_DGTZ_InvalidChannelNumber, CAEN_DGTZ_InvalidEvent, CAEN_DGTZ_InvalidHandle, CAEN_DGTZ_InvalidLinkType, CAEN_DGTZ_InvalidParam, CAEN_DGTZ_MaxDevicesError, CAEN_DGTZ_NotYetImplemented, CAEN_DGTZ_OutOfMemory, CAEN_DGTZ_ReadDeviceRegisterFail, CAEN_DGTZ_Success, CAEN_DGTZ_Timeout, CAEN_DGTZ_WriteDeviceRegisterFail, CAEN_DGTZ_WrongAcqMode, FALSE, and TRUE.

Referenced by dt5720_eor(), dt5720_exit(), dt5720_init(), dt5720_pre_bor(), dt5720_readout(), and dt5720_update_digitizer().

660 {
661  /*
662  l: line number
663  f: file name
664  r: parent routine
665  */
666 
667  static char* f = __FILE__;
668 
669  if(e==CAEN_DGTZ_Success)
670  return FALSE;
671 
672  switch(e)
673  {
674  case CAEN_DGTZ_CommError:
675  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Communication error.");
676  break;
678  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Generic (unspecified) error.");
679  break;
681  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid parameter error.");
682  break;
684  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid LinkType.");
685  break;
687  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid handle.");
688  break;
690  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Too many devices.");
691  break;
693  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Operation not allowed on this model.");
694  break;
696  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid interrupt level.");
697  break;
699  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid event number.");
700  break;
702  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Unable to read from registry.");
703  break;
705  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Unable to write to registry.");
706  break;
708  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid channel number.");
709  break;
711  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Channel is busy.");
712  break;
714  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid FPIO (?) mode.");
715  break;
717  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid acquisition mode.");
718  break;
720  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Module does not support this function.");
721  break;
722  case CAEN_DGTZ_Timeout:
723  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Communication timed out.");
724  break;
726  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Invalid buffer (readout or event).");
727  break;
729  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Unable to find event.");
730  break;
732  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Event is invalid.");
733  break;
735  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Memory has run out.");
736  break;
738  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Calibration failed.");
739  break;
741  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Unable to locate digitizer.");
742  break;
744  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Digitizer is already open.");
745  break;
747  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Digitizer not ready.");
748  break;
750  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Interrupts not configured.");
751  break;
753  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Flash memory corrupted.");
754  break;
756  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Firmware not supported by these libraries.");
757  break;
759  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Function not yet implemented.");
760  break;
761  default:
762  cm_msg(MT_ERROR,f,l,r,"CAEN DT5720 Unknown error.");
763  break;
764  }
765  return TRUE;
766 }

Variable Documentation

bool block_sig

Definition at line 52 of file dt5720_module.c.

char* caen_data_buffer = NULL
static

Definition at line 31 of file dt5720_module.c.

Referenced by dt5720_eor(), dt5720_pre_bor(), and dt5720_readout().

uint32_t caen_data_buffer_size = 0
static

Definition at line 32 of file dt5720_module.c.

Referenced by dt5720_pre_bor().

char* data_buffer
static

Definition at line 33 of file dt5720_module.c.

Referenced by dt5720_exit(), dt5720_read(), dt5720_readout(), and dt5720_update_digitizer().

uint32_t data_buffer_size
static

Definition at line 34 of file dt5720_module.c.

Referenced by dt5720_readout(), and dt5720_update_digitizer().

uint32_t data_size
static

Definition at line 35 of file dt5720_module.c.

Referenced by dt5720_pre_bor(), dt5720_read(), and dt5720_readout().

struct readout_module dt5720_module
Initial value:

Definition at line 55 of file dt5720_module.c.

int handle
static
HNDLE hDB
S_DT5720_ODB_DEF S_DT5720_ODB
static

Definition at line 108 of file dt5720_module.c.

uint32_t VME_BASE = 0x00000000
static

Definition at line 30 of file dt5720_module.c.

Referenced by dt5720_init().