AlcapDAQ  1
Data Structures | Macros | Functions | Variables
lrs2249.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <time.h>
#include "midas.h"
#include "crate.h"
#include "mcstd.h"
#include "odb_wrapper.h"
#include "camac_wrapper.h"
#include "diag.h"

Go to the source code of this file.

Data Structures

struct  lrs2249
 

Macros

#define MAX_LRS2249   8
 
#define N_CH_ADC   12
 

Functions

INT lrs2249_bor ()
 
INT lrs2249_read (char *pevent)
 
INT lrs2249_bor1 (struct lrs2249 *adc)
 
INT lrs2249_read1 (struct lrs2249 *adc, char *pevent)
 

Variables

struct readout_module lrs2249_module
 
struct lrs2249 lrs2249 [MAX_LRS2249]
 

Macro Definition Documentation

#define MAX_LRS2249   8

Definition at line 40 of file lrs2249.cpp.

#define N_CH_ADC   12

Definition at line 43 of file lrs2249.cpp.

Referenced by lrs2249_read1().

Function Documentation

INT lrs2249_bor ( )
INT lrs2249_bor1 ( struct lrs2249 adc)

Definition at line 50 of file lrs2249.cpp.

References cam_init_once(), camc(), lrs2249::crate, crate_number, odb_get_int(), lrs2249::odb_name, lrs2249::slot, and SUCCESS.

51 {
52  // Get the address of the module
53  adc->crate = odb_get_int("/Equipment/Crate %d/Settings/%s/Crate",
54  crate_number, adc->odb_name);
55  adc->slot = odb_get_int("/Equipment/Crate %d/Settings/%s/Slot",
56  crate_number, adc->odb_name);
57 
58  cam_init_once();
59 
60  camc(adc->crate, adc->slot, 0, 9);
61 
62  return SUCCESS;
63 }
INT lrs2249_read ( char *  pevent)
INT lrs2249_read1 ( struct lrs2249 adc,
char *  pevent 
)

Definition at line 109 of file lrs2249.cpp.

References lrs2249::bank_name, camc(), camc_q(), cami(), lrs2249::crate, i, N_CH_ADC, lrs2249::slot, and SUCCESS.

110 {
111  // Check whether the ADC has converted; if not, skip it
112  INT q;
113  camc_q(adc->crate, adc->slot, 0, 8, &q);
114  if(!q) return SUCCESS;
115 
116  // Create the MIDAS bank
117  WORD *pdata;
118  bk_create(pevent, adc->bank_name, TID_WORD, &pdata);
119 
120  // Read ADC
121  for(int i = 0; i < N_CH_ADC; i++) {
122  cami(adc->crate, adc->slot, i, 0, pdata++);
123  }
124 
125  // Clear ADC
126  camc(adc->crate, adc->slot, 0, 9);
127 
128  // Close the bank
129  bk_close(pevent, pdata);
130 
131  return SUCCESS;
132 }

Variable Documentation

Definition at line 41 of file lrs2249.cpp.

struct readout_module lrs2249_module
Initial value:
= {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
}

Definition at line 19 of file lrs2249.cpp.