mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
removed ndac from sls_detector_module and from the servers (not used), fixed setting module by eiger bug in sending number of channels
This commit is contained in:
parent
d1c8d0b01c
commit
a99584a0da
@ -1020,7 +1020,7 @@ unsigned int* Feb_Control_GetTrimbits() {
|
||||
|
||||
|
||||
unsigned int Feb_Control_AddressToAll() {
|
||||
FILE_LOG(logINFO, ("in Feb_Control_AddressToAll()\n"));
|
||||
FILE_LOG(logDEBUG1, ("in Feb_Control_AddressToAll()\n"));
|
||||
|
||||
|
||||
|
||||
|
@ -17,7 +17,7 @@ all: clean versioning $(PROGS) #hv9m_blackfin_server
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
versioning:
|
||||
versioning:
|
||||
@echo `tput setaf 6; ./updateGitVersion.sh; tput sgr0;`
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,9 +1,9 @@
|
||||
Path: slsDetectorPackage/slsDetectorServers/eigerDetectorServer
|
||||
URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git
|
||||
Repsitory UUID: aec8c031dee83a17174c316415c3bd314b31aa8e
|
||||
Revision: 8
|
||||
Repsitory UUID: d1c8d0b01c4c306ab8148fd5c39d09aeeac77a17
|
||||
Revision: 12
|
||||
Branch: refactor
|
||||
Last Changed Author: Dhanya_Thattil
|
||||
Last Changed Rev: 4155
|
||||
Last Changed Date: 2018-10-31 14:35:43.000000002 +0100 ./Beb.c
|
||||
Last Changed Rev: 4164
|
||||
Last Changed Date: 2018-11-02 15:52:57.000000002 +0100 ./Makefile
|
||||
|
@ -1,6 +1,6 @@
|
||||
#define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git"
|
||||
#define GITREPUUID "aec8c031dee83a17174c316415c3bd314b31aa8e"
|
||||
#define GITREPUUID "d1c8d0b01c4c306ab8148fd5c39d09aeeac77a17"
|
||||
#define GITAUTH "Dhanya_Thattil"
|
||||
#define GITREV 0x4155
|
||||
#define GITDATE 0x20181031
|
||||
#define GITREV 0x4164
|
||||
#define GITDATE 0x20181102
|
||||
#define GITBRANCH "refactor"
|
||||
|
@ -30,7 +30,6 @@ enum detectorSettings thisSettings;
|
||||
sls_detector_module *detectorModules=NULL;
|
||||
int *detectorChans=NULL;
|
||||
int *detectorDacs=NULL;
|
||||
int *detectorAdcs=NULL;
|
||||
|
||||
int send_to_ten_gig = 0;
|
||||
int ndsts_in_use=32;
|
||||
@ -380,16 +379,12 @@ void allocateDetectorStructureMemory() {
|
||||
detectorModules = malloc(sizeof(sls_detector_module));
|
||||
detectorChans = malloc(NCHIP*NCHAN*sizeof(int));
|
||||
detectorDacs = malloc(NDAC*sizeof(int));
|
||||
detectorAdcs = malloc(NADC*sizeof(int));
|
||||
FILE_LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules));
|
||||
FILE_LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans));
|
||||
FILE_LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs));
|
||||
FILE_LOG(logDEBUG1, ("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs));
|
||||
(detectorModules)->dacs = detectorDacs;
|
||||
(detectorModules)->adcs = detectorAdcs;
|
||||
(detectorModules)->chanregs = detectorChans;
|
||||
(detectorModules)->ndac = NDAC;
|
||||
(detectorModules)->nadc = NADC;
|
||||
(detectorModules)->nchip = NCHIP;
|
||||
(detectorModules)->nchan = NCHIP * NCHAN;
|
||||
(detectorModules)->reg = 0;
|
||||
@ -1782,10 +1777,10 @@ void readFrame(int *ret, char *mess) {
|
||||
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
|
||||
int idac, ichan, iadc;
|
||||
int idac, ichan;
|
||||
int ret=OK;
|
||||
|
||||
FILE_LOG(logDEBUG1, ("Copying module %x to module %x\n",srcMod,destMod));
|
||||
FILE_LOG(logDEBUG1, ("Copying module\n"));
|
||||
|
||||
if (srcMod->serialnumber>=0) {
|
||||
|
||||
@ -1800,16 +1795,10 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
FILE_LOG(logINFO, ("Number of dacs of source is larger than number of dacs of destination\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if ((srcMod->nadc)>(destMod->nadc)) {
|
||||
FILE_LOG(logINFO, ("Number of dacs of source is larger than number of dacs of destination\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac));
|
||||
FILE_LOG(logDEBUG1, ("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc));
|
||||
FILE_LOG(logDEBUG1, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan));
|
||||
destMod->ndac=srcMod->ndac;
|
||||
destMod->nadc=srcMod->nadc;
|
||||
destMod->nchip=srcMod->nchip;
|
||||
destMod->nchan=srcMod->nchan;
|
||||
if (srcMod->reg>=0)
|
||||
@ -1835,10 +1824,6 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) {
|
||||
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac);
|
||||
}
|
||||
}
|
||||
for (iadc=0; iadc<(srcMod->nadc); iadc++) {
|
||||
if (*((srcMod->adcs)+iadc)>=0)
|
||||
*((destMod->adcs)+iadc)=*((srcMod->adcs)+iadc);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1856,7 +1841,6 @@ int calculateDataBytes() {
|
||||
int getTotalNumberOfChannels() {return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
||||
int getNumberOfChips() {return NCHIP;}
|
||||
int getNumberOfDACs() {return NDAC;}
|
||||
int getNumberOfADCs() {return NADC;}
|
||||
int getNumberOfChannelsPerChip() {return NCHAN;}
|
||||
|
||||
|
||||
|
@ -1,13 +1,4 @@
|
||||
/*
|
||||
* slsDetectorServer_defs.h
|
||||
*
|
||||
* Created on: Jan 24, 2013
|
||||
* Author: l_maliakal_d
|
||||
*/
|
||||
|
||||
#ifndef SLSDETECTORSERVER_DEFS_H_
|
||||
#define SLSDETECTORSERVER_DEFS_H_
|
||||
|
||||
#pragma once
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
#define GOODBYE (-200)
|
||||
@ -46,7 +37,6 @@ enum {E_PARALLEL, E_NON_PARALLEL, E_SAFE};
|
||||
/* Hardware Definitions */
|
||||
#define NCHAN (256 * 256)
|
||||
#define NCHIP (4)
|
||||
#define NADC (0)
|
||||
#define NDAC (16)
|
||||
|
||||
|
||||
@ -90,5 +80,3 @@ enum {E_PARALLEL, E_NON_PARALLEL, E_SAFE};
|
||||
#define SLAVE_HIGH_VOLTAGE_READ_VAL (-999)
|
||||
#define HIGH_VOLTAGE_TOLERANCE (5)
|
||||
|
||||
|
||||
#endif /* SLSDETECTORSERVER_DEFS_H_ */
|
||||
|
@ -1,315 +0,0 @@
|
||||
#ifndef REGISTERS_G_H
|
||||
#define REGISTERS_G_H
|
||||
|
||||
|
||||
#include "sls_detector_defs.h"
|
||||
|
||||
|
||||
/* Definitions for FPGA*/
|
||||
#define CSP0 0x20200000
|
||||
#define MEM_SIZE 0x100000
|
||||
|
||||
|
||||
|
||||
/* values defined for FPGA */
|
||||
#define MCSNUM 0x0
|
||||
#define FIXED_PATT_VAL 0xacdc1980
|
||||
|
||||
|
||||
#define FPGA_INIT_PAT 0x60008
|
||||
#define FPGA_INIT_ADDR 0xb0000000
|
||||
|
||||
|
||||
|
||||
|
||||
/* registers defined in FPGA */
|
||||
#define PCB_REV_REG 0x2c<<11
|
||||
#define GAIN_REG 0x10<<11
|
||||
//#define FLOW_CONTROL_REG 0x11<<11
|
||||
//#define FLOW_STATUS_REG 0x12<<11
|
||||
//#define FRAME_REG 0x13<<11
|
||||
#define MULTI_PURPOSE_REG 0x14<<11
|
||||
#define DAQ_REG 0x15<<11
|
||||
//#define TIME_FROM_START_REG 0x16<<11
|
||||
#define MCB_CNTRL_REG_OFF 0x17<<11// control the dacs
|
||||
//ADC
|
||||
#define ADC_SPI_REG 0x18<<11
|
||||
|
||||
#define ADC_SERIAL_CLK_OUT_OFST (0)
|
||||
#define ADC_SERIAL_CLK_OUT_MSK (0x00000001 << ADC_SERIAL_CLK_OUT_OFST)
|
||||
#define ADC_SERIAL_DATA_OUT_OFST (1)
|
||||
#define ADC_SERIAL_DATA_OUT_MSK (0x00000001 << ADC_SERIAL_DATA_OUT_OFST)
|
||||
#define ADC_SERIAL_CS_OUT_OFST (2)
|
||||
#define ADC_SERIAL_CS_OUT_MSK (0x0000000F << ADC_SERIAL_CS_OUT_OFST)
|
||||
|
||||
|
||||
#define ADC_SYNC_REG 0x19<<11
|
||||
//#define MUTIME_REG 0x1a<<11
|
||||
//temperature
|
||||
#define TEMP_IN_REG 0x1b<<11
|
||||
#define TEMP_OUT_REG 0x1c<<11
|
||||
//configure MAC
|
||||
#define TSE_CONF_REG 0x1d<<11
|
||||
#define ENET_CONF_REG 0x1e<<11
|
||||
//#define WRTSE_SHAD_REG 0x1f<<11
|
||||
//HV
|
||||
#define HV_REG 0x20<<11
|
||||
|
||||
|
||||
#define DUMMY_REG 0x21<<11
|
||||
#define FPGA_VERSION_REG 0x22<<11
|
||||
#define FIX_PATT_REG 0x23<<11
|
||||
#define CONTROL_REG 0x24<<11
|
||||
#define STATUS_REG 0x25<<11
|
||||
#define CONFIG_REG 0x26<<11
|
||||
#define EXT_SIGNAL_REG 0x27<<11
|
||||
#define FPGA_SVN_REG 0x29<<11
|
||||
|
||||
|
||||
#define CHIP_OF_INTRST_REG 0x2A<<11
|
||||
|
||||
//FIFO
|
||||
#define LOOK_AT_ME_REG 0x28<<11
|
||||
|
||||
#define FIFO_DATA_REG_OFF 0x50<<11 ///////
|
||||
|
||||
|
||||
//to read back dac registers
|
||||
#define MOD_DACS1_REG 0x65<<11
|
||||
#define MOD_DACS2_REG 0x66<<11
|
||||
#define MOD_DACS3_REG 0x67<<11
|
||||
|
||||
//user entered
|
||||
#define SET_DELAY_LSB_REG 0x68<<11
|
||||
#define SET_DELAY_MSB_REG 0x69<<11
|
||||
#define GET_DELAY_LSB_REG 0x6a<<11
|
||||
#define GET_DELAY_MSB_REG 0x6b<<11
|
||||
|
||||
#define SET_TRAINS_LSB_REG 0x6c<<11
|
||||
#define SET_TRAINS_MSB_REG 0x6d<<11
|
||||
#define GET_TRAINS_LSB_REG 0x6e<<11
|
||||
#define GET_TRAINS_MSB_REG 0x6f<<11
|
||||
|
||||
#define SET_FRAMES_LSB_REG 0x70<<11
|
||||
#define SET_FRAMES_MSB_REG 0x71<<11
|
||||
#define GET_FRAMES_LSB_REG 0x72<<11
|
||||
#define GET_FRAMES_MSB_REG 0x73<<11
|
||||
|
||||
#define SET_PERIOD_LSB_REG 0x74<<11
|
||||
#define SET_PERIOD_MSB_REG 0x75<<11
|
||||
#define GET_PERIOD_LSB_REG 0x76<<11
|
||||
#define GET_PERIOD_MSB_REG 0x77<<11
|
||||
|
||||
#define SET_EXPTIME_LSB_REG 0x78<<11
|
||||
#define SET_EXPTIME_MSB_REG 0x79<<11
|
||||
#define GET_EXPTIME_LSB_REG 0x7a<<11
|
||||
#define GET_EXPTIME_MSB_REG 0x7b<<11
|
||||
|
||||
#define SET_GATES_LSB_REG 0x7c<<11
|
||||
#define SET_GATES_MSB_REG 0x7d<<11
|
||||
#define GET_GATES_LSB_REG 0x7e<<11
|
||||
#define GET_GATES_MSB_REG 0x7f<<11
|
||||
|
||||
|
||||
|
||||
|
||||
//image
|
||||
#define DARK_IMAGE_REG 0x81<<11
|
||||
#define GAIN_IMAGE_REG 0x82<<11
|
||||
|
||||
//counter block memory
|
||||
#define COUNTER_MEMORY_REG 0x85<<11
|
||||
|
||||
|
||||
#define GET_MEASUREMENT_TIME_LSB_REG 0x023000
|
||||
#define GET_MEASUREMENT_TIME_MSB_REG 0x024000
|
||||
|
||||
#define GET_ACTUAL_TIME_LSB_REG 0x025000
|
||||
#define GET_ACTUAL_TIME_MSB_REG 0x026000
|
||||
|
||||
|
||||
//not used
|
||||
//#define MCB_DOUT_REG_OFF 0x200000
|
||||
//#define FIFO_CNTRL_REG_OFF 0x300000
|
||||
//#define FIFO_COUNTR_REG_OFF 0x400000
|
||||
//not used so far
|
||||
//#define SPEED_REG 0x006000
|
||||
//#define SET_NBITS_REG 0x008000
|
||||
//not used
|
||||
//#define GET_SHIFT_IN_REG 0x022000
|
||||
|
||||
|
||||
|
||||
#define SHIFTMOD 2
|
||||
#define SHIFTFIFO 9
|
||||
|
||||
/** for PCB_REV_REG */
|
||||
#define DETECTOR_TYPE_MASK 0xF0000
|
||||
#define DETECTOR_TYPE_OFFSET 16
|
||||
#define BOARD_REVISION_MASK 0xFFFF
|
||||
#define MOENCH_MODULE 2
|
||||
|
||||
|
||||
|
||||
|
||||
/* for control register */
|
||||
#define START_ACQ_BIT 0x00000001
|
||||
#define STOP_ACQ_BIT 0x00000002
|
||||
#define START_FIFOTEST_BIT 0x00000004 // ?????
|
||||
#define STOP_FIFOTEST_BIT 0x00000008 // ??????
|
||||
#define START_READOUT_BIT 0x00000010
|
||||
#define STOP_READOUT_BIT 0x00000020
|
||||
#define START_EXPOSURE_BIT 0x00000040
|
||||
#define STOP_EXPOSURE_BIT 0x00000080
|
||||
#define START_TRAIN_BIT 0x00000100
|
||||
#define STOP_TRAIN_BIT 0x00000200
|
||||
#define SYNC_RESET 0x00000400
|
||||
|
||||
/* for status register */
|
||||
#define RUN_BUSY_BIT 0x00000001
|
||||
#define READOUT_BUSY_BIT 0x00000002
|
||||
#define FIFOTEST_BUSY_BIT 0x00000004 //????
|
||||
#define WAITING_FOR_TRIGGER_BIT 0x00000008
|
||||
#define DELAYBEFORE_BIT 0x00000010
|
||||
#define DELAYAFTER_BIT 0x00000020
|
||||
#define EXPOSING_BIT 0x00000040
|
||||
#define COUNT_ENABLE_BIT 0x00000080
|
||||
#define READSTATE_0_BIT 0x00000100
|
||||
#define READSTATE_1_BIT 0x00000200
|
||||
#define READSTATE_2_BIT 0x00000400
|
||||
|
||||
#define RUNSTATE_0_BIT 0x00001000
|
||||
#define RUNSTATE_1_BIT 0x00002000
|
||||
#define RUNSTATE_2_BIT 0x00004000
|
||||
#define SOME_FIFO_FULL_BIT 0x00008000 // error!
|
||||
#define ALL_FIFO_EMPTY_BIT 0x00010000 // data ready
|
||||
#define RUNMACHINE_BUSY_BIT 0x00020000
|
||||
#define READMACHINE_BUSY_BIT 0x00040000
|
||||
#define STOPPED_BIT 0x00100000
|
||||
|
||||
|
||||
|
||||
/* for fifo status register */
|
||||
#define FIFO_ENABLED_BIT 0x80000000
|
||||
#define FIFO_DISABLED_BIT 0x01000000
|
||||
#define FIFO_ERROR_BIT 0x08000000
|
||||
#define FIFO_EMPTY_BIT 0x04000000
|
||||
#define FIFO_DATA_READY_BIT 0x02000000
|
||||
#define FIFO_COUNTER_MASK 0x000001ff
|
||||
#define FIFO_NM_MASK 0x00e00000
|
||||
#define FIFO_NM_OFF 21
|
||||
#define FIFO_NC_MASK 0x001ffe00
|
||||
#define FIFO_NC_OFF 9
|
||||
|
||||
/* for config register *///not really used yet
|
||||
#define TOT_ENABLE_BIT 0x00000002
|
||||
#define TIMED_GATE_BIT 0x00000004
|
||||
#define CONT_RO_ENABLE_BIT 0x00080000
|
||||
#define CPU_OR_RECEIVER_BIT 0x00001000
|
||||
|
||||
|
||||
|
||||
/* for speed register */
|
||||
#define CLK_DIVIDER_MASK 0x000000ff
|
||||
#define CLK_DIVIDER_OFFSET 0
|
||||
#define SET_LENGTH_MASK 0x00000f00
|
||||
#define SET_LENGTH_OFFSET 8
|
||||
#define WAIT_STATES_MASK 0x0000f000
|
||||
#define WAIT_STATES_OFFSET 12
|
||||
#define TOTCLK_DIVIDER_MASK 0xff000000
|
||||
#define TOTCLK_DIVIDER_OFFSET 24
|
||||
#define TOTCLK_DUTYCYCLE_MASK 0x00ff0000
|
||||
#define TOTCLK_DUTYCYCLE_OFFSET 16
|
||||
|
||||
/* for external signal register */
|
||||
#define SIGNAL_OFFSET 4
|
||||
#define SIGNAL_MASK 0xF
|
||||
#define EXT_SIG_OFF 0x0
|
||||
#define EXT_GATE_IN_ACTIVEHIGH 0x1
|
||||
#define EXT_GATE_IN_ACTIVELOW 0x2
|
||||
#define EXT_TRIG_IN_RISING 0x3
|
||||
#define EXT_TRIG_IN_FALLING 0x4
|
||||
#define EXT_RO_TRIG_IN_RISING 0x5
|
||||
#define EXT_RO_TRIG_IN_FALLING 0x6
|
||||
#define EXT_GATE_OUT_ACTIVEHIGH 0x7
|
||||
#define EXT_GATE_OUT_ACTIVELOW 0x8
|
||||
#define EXT_TRIG_OUT_RISING 0x9
|
||||
#define EXT_TRIG_OUT_FALLING 0xA
|
||||
#define EXT_RO_TRIG_OUT_RISING 0xB
|
||||
#define EXT_RO_TRIG_OUT_FALLING 0xC
|
||||
|
||||
|
||||
/* for temperature register */
|
||||
#define T1_CLK_BIT 0x00000001
|
||||
#define T1_CS_BIT 0x00000002
|
||||
#define T2_CLK_BIT 0x00000004
|
||||
#define T2_CS_BIT 0x00000008
|
||||
|
||||
|
||||
|
||||
/* fifo control register */
|
||||
#define FIFO_RESET_BIT 0x00000001
|
||||
#define FIFO_DISABLE_TOGGLE_BIT 0x00000002
|
||||
|
||||
|
||||
//chip shiftin register meaning
|
||||
#define OUTMUX_OFF 20
|
||||
#define OUTMUX_MASK 0x1f
|
||||
#define PROBES_OFF 4
|
||||
#define PROBES_MASK 0x7f
|
||||
#define OUTBUF_OFF 0
|
||||
#define OUTBUF_MASK 1
|
||||
|
||||
|
||||
/* multi purpose register */
|
||||
#define PHASE_STEP_BIT 0x00000001
|
||||
#define PHASE_STEP_OFFSET 0
|
||||
// #define xxx_BIT 0x00000002
|
||||
#define RESET_COUNTER_BIT 0x00000004
|
||||
#define RESET_COUNTER_OFFSET 2
|
||||
//#define xxx_BIT 0x00000008
|
||||
//#define xxx_BIT 0x00000010
|
||||
#define SW1_BIT 0x00000020
|
||||
#define SW1_OFFSET 5
|
||||
#define WRITE_BACK_BIT 0x00000040
|
||||
#define WRITE_BACK_OFFSET 6
|
||||
#define RESET_BIT 0x00000080
|
||||
#define RESET_OFFSET 7
|
||||
#define PLL_CLK_SEL_MSK 0x00000700
|
||||
#define PLL_CLK_SEL_OFFSET 8
|
||||
#define PLL_CLK_SEL_MASTER_VAL ((0x1 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
|
||||
#define PLL_CLK_SEL_MASTER_ADC_VAL ((0x2 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
|
||||
#define PLL_CLK_SEL_SLAVE_VAL ((0x3 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
|
||||
#define PLL_CLK_SEL_SLAVE_ADC_VAL ((0x4 << PLL_CLK_SEL_OFFSET) & PLL_CLK_SEL_MSK)
|
||||
#define ENET_RESETN_BIT 0x00000800
|
||||
#define ENET_RESETN_OFFSET 11
|
||||
#define INT_RSTN_BIT 0x00001000
|
||||
#define INT_RSTN_OFFSET 12
|
||||
#define DIGITAL_TEST_BIT 0x00004000
|
||||
#define DIGITAL_TEST_OFFSET 14
|
||||
//#define CHANGE_AT_POWER_ON_BIT 0x00008000
|
||||
//#define CHANGE_AT_POWER_ON_OFFSET 15
|
||||
#define RST_TO_SW1_DELAY_MSK 0x000F0000
|
||||
#define RST_TO_SW1_DELAY_OFFSET 16
|
||||
#define START_ACQ_DELAY_MSK 0x00F00000
|
||||
#define START_ACQ_DELAY_OFFSET 20
|
||||
|
||||
/* settings/conf gain register */
|
||||
#define GAIN_MASK 0x000000ff
|
||||
#define GAIN_OFFSET 0
|
||||
#define SETTINGS_MASK 0x0000ff00
|
||||
#define SETTINGS_OFFSET 8
|
||||
|
||||
|
||||
/* CHIP_OF_INTRST_REG */
|
||||
#define CHANNEL_MASK 0xffff0000
|
||||
#define CHANNEL_OFFSET 16
|
||||
#define ACTIVE_ADC_MASK 0x0000001f
|
||||
|
||||
|
||||
|
||||
/**ADC SYNC CLEAN FIFO*/
|
||||
#define ADCSYNC_CLEAN_FIFO_BITS 0x300000
|
||||
|
||||
#endif
|
||||
|
Binary file not shown.
@ -23,7 +23,6 @@ char firmware_message[MAX_STR_LENGTH];
|
||||
|
||||
sls_detector_module *detectorModules = NULL;
|
||||
int *detectorDacs = NULL;
|
||||
int *detectorAdcs =NULL;
|
||||
|
||||
#ifdef VIRTUAL
|
||||
pthread_t pthread_virtual_tid;
|
||||
@ -394,17 +393,12 @@ void allocateDetectorStructureMemory(){
|
||||
//Allocation of memory
|
||||
if (detectorModules != NULL) free(detectorModules);
|
||||
if (detectorDacs != NULL) free(detectorDacs);
|
||||
if (detectorAdcs != NULL) free(detectorAdcs);
|
||||
detectorModules = malloc(sizeof(sls_detector_module));
|
||||
detectorDacs = malloc(NDAC*sizeof(int));
|
||||
detectorAdcs = malloc(NADC*sizeof(int));
|
||||
FILE_LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules));
|
||||
FILE_LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs));
|
||||
FILE_LOG(logDEBUG1, ("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs));
|
||||
(detectorModules)->dacs = detectorDacs;
|
||||
(detectorModules)->adcs = detectorAdcs;
|
||||
(detectorModules)->ndac = NDAC;
|
||||
(detectorModules)->nadc = NADC;
|
||||
(detectorModules)->nchip = NCHIP;
|
||||
(detectorModules)->nchan = NCHIP * NCHAN;
|
||||
(detectorModules)->reg = 0;
|
||||
@ -1629,13 +1623,12 @@ u_int32_t runBusy(void) {
|
||||
//jungfrau doesnt require chips and chans (save memory)
|
||||
int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
|
||||
int idac, iadc;
|
||||
int idac;
|
||||
int ret=OK;
|
||||
|
||||
FILE_LOG(logDEBUG1, ("Copying module\n"));
|
||||
|
||||
if (srcMod->serialnumber>=0){
|
||||
|
||||
destMod->serialnumber=srcMod->serialnumber;
|
||||
}
|
||||
if ((srcMod->nchip)>(destMod->nchip)) {
|
||||
@ -1650,19 +1643,10 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
FILE_LOG(logERROR, ("Number of dacs of source is larger than number of dacs of destination\n"));
|
||||
return FAIL;
|
||||
}
|
||||
if ((srcMod->nadc)>(destMod->nadc)) {
|
||||
FILE_LOG(logERROR, ("Number of dacs of source is larger than number of dacs of destination\n"));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac));
|
||||
FILE_LOG(logDEBUG1, ("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc));
|
||||
FILE_LOG(logDEBUG1, ("Chips: src %d, dest %d\n",srcMod->nchip,destMod->nchip));
|
||||
FILE_LOG(logDEBUG1, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan));
|
||||
destMod->ndac=srcMod->ndac;
|
||||
destMod->nadc=srcMod->nadc;
|
||||
destMod->nchip=srcMod->nchip;
|
||||
destMod->nchan=srcMod->nchan;
|
||||
|
||||
if (srcMod->reg>=0)
|
||||
destMod->reg=srcMod->reg;
|
||||
FILE_LOG(logDEBUG1, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg ));
|
||||
@ -1671,10 +1655,6 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
|
||||
if (*((srcMod->dacs)+idac)>=0)
|
||||
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac);
|
||||
}
|
||||
for (iadc=0; iadc<(srcMod->nadc); iadc++) {
|
||||
if (*((srcMod->adcs)+iadc)>=0)
|
||||
*((destMod->adcs)+iadc)=*((srcMod->adcs)+iadc);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -1686,7 +1666,6 @@ int calculateDataBytes(){
|
||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
||||
int getNumberOfChips(){return NCHIP;}
|
||||
int getNumberOfDACs(){return NDAC;}
|
||||
int getNumberOfADCs(){return NADC;}
|
||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
#ifndef SLSDETECTORSERVER_DEFS_H
|
||||
#define SLSDETECTORSERVER_DEFS_H
|
||||
|
||||
#pragma once
|
||||
#include "sls_detector_defs.h" //default dynamicgain in settings
|
||||
#include "RegisterDefs.h"
|
||||
|
||||
@ -48,7 +46,6 @@ enum NETWORKINDEX { TXN_FRAME };
|
||||
/* Hardware Definitions */
|
||||
#define NCHAN (256 * 256)
|
||||
#define NCHIP (8)
|
||||
#define NADC (0)
|
||||
#define NDAC (8)
|
||||
#define NDAC_OLDBOARD (16)
|
||||
#define DYNAMIC_RANGE (16)
|
||||
@ -171,6 +168,3 @@ enum NETWORKINDEX { TXN_FRAME };
|
||||
#define PLL_CHARGEPUMP_REG (0x09)
|
||||
#define PLL_VCO_DIV_REG (0x1c)
|
||||
#define PLL_MIF_REG (0x1f)
|
||||
|
||||
|
||||
#endif /* SLSDETECTORSERVER_DEFS_H */
|
||||
|
@ -356,8 +356,6 @@ int sendModule(int file_des, sls_detector_module *myMod) {
|
||||
if (!n) return -1; ts += n;
|
||||
n = sendData(file_des,&(myMod->ndac), sizeof(myMod->ndac), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
n = sendData(file_des,&(myMod->nadc), sizeof(myMod->nadc), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
n = sendData(file_des,&(myMod->reg), sizeof(myMod->reg), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
n = sendData(file_des,&(myMod->iodelay), sizeof(myMod->iodelay), INT32);
|
||||
@ -369,9 +367,6 @@ int sendModule(int file_des, sls_detector_module *myMod) {
|
||||
// dacs
|
||||
n = sendData(file_des,myMod->dacs, sizeof(int)*(myMod->ndac), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
// adcs
|
||||
n = sendData(file_des,myMod->adcs, sizeof(int)*(myMod->nadc), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
// channels
|
||||
#ifdef EIGERD
|
||||
n = sendData(file_des,myMod->chanregs, sizeof(int) * (myMod->nchan), INT32);
|
||||
@ -384,58 +379,60 @@ int sendModule(int file_des, sls_detector_module *myMod) {
|
||||
|
||||
|
||||
int receiveModule(int file_des, sls_detector_module* myMod) {
|
||||
TLogLevel level = logDEBUG1;
|
||||
FILE_LOG(level, ("Receiving Module\n"));
|
||||
int ts = 0, n = 0;
|
||||
int nDacs = myMod->ndac;
|
||||
int nAdcs = myMod->nadc;
|
||||
#ifdef EIGERD
|
||||
int nChans = myMod->nchan; // can be zero for no trimbits
|
||||
FILE_LOG(level, ("nChans: %d\n",nChans));
|
||||
#endif
|
||||
n = receiveData(file_des,&(myMod->serialnumber), sizeof(myMod->serialnumber), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("serialno received. %d bytes. serialno: %d\n", n, myMod->serialnumber));
|
||||
n = receiveData(file_des,&(myMod->nchan), sizeof(myMod->nchan), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("nchan received. %d bytes. nchan: %d\n", n, myMod->nchan));
|
||||
n = receiveData(file_des,&(myMod->nchip), sizeof(myMod->nchip), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("nchip received. %d bytes. nchip: %d\n", n, myMod->nchip));
|
||||
n = receiveData(file_des,&(myMod->ndac), sizeof(myMod->ndac), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
n = receiveData(file_des,&(myMod->nadc), sizeof(myMod->nadc), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("ndac received. %d bytes. ndac: %d\n", n, myMod->ndac));
|
||||
n = receiveData(file_des,&(myMod->reg), sizeof(myMod->reg), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("reg received. %d bytes. reg: %d\n", n, myMod->reg));
|
||||
n = receiveData(file_des,&(myMod->iodelay), sizeof(myMod->iodelay), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("iodelay received. %d bytes. iodelay: %d\n", n, myMod->iodelay));
|
||||
n = receiveData(file_des,&(myMod->tau), sizeof(myMod->tau), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("tau received. %d bytes. tau: %d\n", n, myMod->tau));
|
||||
n = receiveData(file_des,&(myMod->eV), sizeof(myMod->eV), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("eV received. %d bytes. eV: %d\n", n, myMod->eV));
|
||||
// dacs
|
||||
if (nDacs != (myMod->ndac)) {
|
||||
FILE_LOG(logERROR, ("received wrong number of dacs. "
|
||||
"Expected %d, got %d\n", nDacs, myMod->ndac));
|
||||
"Expected %d, got %d\n", nDacs, myMod->ndac));
|
||||
return 0;
|
||||
}
|
||||
n = receiveData(file_des,&(myMod->dacs), sizeof(int) * (myMod->ndac), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
// adcs
|
||||
if (nAdcs != (myMod->nadc)) {
|
||||
FILE_LOG(logERROR, ("received wrong number of adcs. "
|
||||
"Expected %d, got %d\n", nAdcs, myMod->nadc));
|
||||
return 0;
|
||||
}
|
||||
n = receiveData(file_des,&(myMod->adcs), sizeof(int) * (myMod->nadc), INT32);
|
||||
n = receiveData(file_des, myMod->dacs, sizeof(int) * (myMod->ndac), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
FILE_LOG(level, ("dacs received. %d bytes.\n", n));
|
||||
// channels
|
||||
#ifdef EIGERD
|
||||
if (((myMod->nchan) != 0 ) || // no trimbits
|
||||
if (((myMod->nchan) != 0 ) && // no trimbits
|
||||
(nChans != (myMod->nchan))) { // with trimbits
|
||||
FILE_LOG(logERROR, ("received wrong number of channels. "
|
||||
"Expected %d, got %d\n", nChans, (myMod->nchan)));
|
||||
return 0;
|
||||
}
|
||||
n = receiveData(file_des,&(myMod->chanregs), sizeof(int) * (myMod->nchan), INT32);
|
||||
if (!n) return -1; ts += n;
|
||||
n = receiveData(file_des, myMod->chanregs, sizeof(int) * (myMod->nchan), INT32);
|
||||
FILE_LOG(level, ("chanregs received. %d bytes.\n", n));
|
||||
if (!n) return -1; ts += n;
|
||||
#endif
|
||||
FILE_LOG(logDEBUG1, ("received module of size %d register %x\n",ts,myMod->reg));
|
||||
FILE_LOG(level, ("received module of size %d register %x\n",ts,myMod->reg));
|
||||
return ts;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,6 @@ int calculateDataBytes();
|
||||
int getTotalNumberOfChannels();
|
||||
int getNumberOfChips();
|
||||
int getNumberOfDACs();
|
||||
int getNumberOfADCs();
|
||||
int getNumberOfChannelsPerChip();
|
||||
|
||||
|
||||
|
@ -839,10 +839,8 @@ int set_module(int file_des) {
|
||||
|
||||
sls_detector_module module;
|
||||
int *myDac = NULL;
|
||||
int *myAdc = NULL;
|
||||
int *myChan = NULL;
|
||||
module.dacs = NULL;
|
||||
module.adcs = NULL;
|
||||
module.chanregs = NULL;
|
||||
|
||||
// allocate to receive arguments
|
||||
@ -856,18 +854,6 @@ int set_module(int file_des) {
|
||||
} else
|
||||
module.dacs = myDac;
|
||||
|
||||
// allocate adcs
|
||||
if (ret == OK) {
|
||||
myAdc = (int*)malloc(getNumberOfADCs() * sizeof(int));
|
||||
// error
|
||||
if (getNumberOfADCs() > 0 && myAdc == NULL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Could not allocate adcs\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else
|
||||
module.adcs = myAdc;
|
||||
}
|
||||
|
||||
// allocate chans
|
||||
#ifdef EIGERD
|
||||
if (ret == OK) {
|
||||
@ -885,22 +871,20 @@ int set_module(int file_des) {
|
||||
module.nchip = getNumberOfChips();
|
||||
module.nchan = getTotalNumberOfChannels();
|
||||
module.ndac = getNumberOfDACs();
|
||||
module.nadc = getNumberOfADCs();
|
||||
int ts = receiveModule(file_des, &module);
|
||||
if (ts < 0) {
|
||||
if (myChan != NULL) free(myChan);
|
||||
if (myDac != NULL) free(myDac);
|
||||
if (myAdc != NULL) free(myAdc);
|
||||
return printSocketReadError();
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("module register is %d, nchan %d, nchip %d, "
|
||||
"ndac %d, nadc %d, iodelay %d, tau %d, eV %d\n",
|
||||
"ndac %d, iodelay %d, tau %d, eV %d\n",
|
||||
module.reg, module.nchan, module.nchip,
|
||||
module.ndac, module.nadc, module.iodelay, module.tau, module.eV));
|
||||
module.ndac, module.iodelay, module.tau, module.eV));
|
||||
// should at least have a dac
|
||||
if (ts <= sizeof(sls_detector_module)) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Cannot set module. Received incorrect number of dacs or adcs or channels\n");
|
||||
sprintf(mess, "Cannot set module. Received incorrect number of dacs or channels\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
@ -923,6 +907,7 @@ int set_module(int file_des) {
|
||||
case VERYHIGHGAIN:
|
||||
case VERYLOWGAIN:
|
||||
#elif JUNGFRAUD
|
||||
case GET_SETTINGS:
|
||||
case DYNAMICGAIN:
|
||||
case DYNAMICHG0:
|
||||
case FIXGAIN1:
|
||||
@ -949,7 +934,6 @@ int set_module(int file_des) {
|
||||
}
|
||||
if (myChan != NULL) free(myChan);
|
||||
if (myDac != NULL) free(myDac);
|
||||
if (myAdc != NULL) free(myAdc);
|
||||
return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
@ -961,10 +945,8 @@ int get_module(int file_des) {
|
||||
memset(mess, 0, sizeof(mess));
|
||||
sls_detector_module module;
|
||||
int *myDac = NULL;
|
||||
int *myAdc = NULL;
|
||||
int *myChan = NULL;
|
||||
module.dacs = NULL;
|
||||
module.adcs = NULL;
|
||||
module.chanregs = NULL;
|
||||
|
||||
// allocate to send arguments
|
||||
@ -978,18 +960,6 @@ int get_module(int file_des) {
|
||||
} else
|
||||
module.dacs = myDac;
|
||||
|
||||
// allocate adcs
|
||||
if (ret == OK) {
|
||||
myAdc = (int*)malloc(getNumberOfADCs() * sizeof(int));
|
||||
// error
|
||||
if (getNumberOfADCs() > 0 && myAdc == NULL) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"Could not allocate adcs\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else
|
||||
module.adcs=myAdc;
|
||||
}
|
||||
|
||||
// allocate chans
|
||||
#ifdef EIGERD
|
||||
if (ret == OK) {
|
||||
@ -1008,7 +978,6 @@ int get_module(int file_des) {
|
||||
module.nchip = getNumberOfChips();
|
||||
module.nchan = getTotalNumberOfChannels();
|
||||
module.ndac = getNumberOfDACs();
|
||||
module.nadc = getNumberOfADCs();
|
||||
|
||||
// only get
|
||||
FILE_LOG(logDEBUG1, ("Getting module\n"));
|
||||
@ -1024,7 +993,6 @@ int get_module(int file_des) {
|
||||
}
|
||||
if (myChan != NULL) free(myChan);
|
||||
if (myDac != NULL) free(myDac);
|
||||
if (myAdc != NULL) free(myAdc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ slsDetector::slsDetector(detectorType type, int multiId, int id, bool verify)
|
||||
dataSocket(0),
|
||||
detectorModules(0),
|
||||
dacs(0),
|
||||
adcs(0),
|
||||
chanregs(0) {
|
||||
/* called from put hostname command,
|
||||
* so sls shared memory will be created */
|
||||
@ -67,7 +66,6 @@ slsDetector::slsDetector(int multiId, int id, bool verify)
|
||||
dataSocket(0),
|
||||
detectorModules(0),
|
||||
dacs(0),
|
||||
adcs(0),
|
||||
chanregs(0) {
|
||||
/* called from multi constructor to populate structure,
|
||||
* so sls shared memory will be opened, not created */
|
||||
@ -316,7 +314,6 @@ void slsDetector::setDetectorSpecificParameters(detectorType type, detParameterL
|
||||
list.nChipX = 10;
|
||||
list.nChipY = 1;
|
||||
list.nDacs = 8;
|
||||
list.nAdcs = 5;
|
||||
list.dynamicRange = 16;
|
||||
list.nGappixelsX = 0;
|
||||
list.nGappixelsY = 0;
|
||||
@ -326,8 +323,7 @@ void slsDetector::setDetectorSpecificParameters(detectorType type, detParameterL
|
||||
list.nChanY = 256;
|
||||
list.nChipX = 4;
|
||||
list.nChipY = 2;
|
||||
list.nDacs = 16;
|
||||
list.nAdcs = 0;
|
||||
list.nDacs = 8;
|
||||
list.dynamicRange = 16;
|
||||
list.nGappixelsX = 0;
|
||||
list.nGappixelsY = 0;
|
||||
@ -338,7 +334,6 @@ void slsDetector::setDetectorSpecificParameters(detectorType type, detParameterL
|
||||
list.nChipX = 1;
|
||||
list.nChipY = 1;
|
||||
list.nDacs = 16;
|
||||
list.nAdcs = 9;//???? When calculating size, only d+a=16 how come?FIXME
|
||||
list.dynamicRange =16;
|
||||
list.nGappixelsX = 0;
|
||||
list.nGappixelsY = 0;
|
||||
@ -349,7 +344,6 @@ void slsDetector::setDetectorSpecificParameters(detectorType type, detParameterL
|
||||
list.nChipX = 4;
|
||||
list.nChipY = 1;
|
||||
list.nDacs = 16;
|
||||
list.nAdcs = 0;
|
||||
list.dynamicRange = 16;
|
||||
list.nGappixelsX = 6;
|
||||
list.nGappixelsY = 1;
|
||||
@ -367,11 +361,11 @@ int slsDetector::calculateSharedMemorySize(detectorType type) {
|
||||
setDetectorSpecificParameters(type, detlist);
|
||||
int nch = detlist.nChanX * detlist.nChanY;
|
||||
int nc = detlist.nChipX * detlist.nChipY;
|
||||
int nd = detlist.nDacs + detlist.nAdcs;
|
||||
int nd = detlist.nDacs;
|
||||
|
||||
/** The size of the shared memory is
|
||||
* size of shared structure +
|
||||
* ffcoefficents+fferrors+modules+dacs+adcs+chans */
|
||||
* ffcoefficents+fferrors+modules+dacs+chans */
|
||||
int sz = sizeof(sharedSlsDetector) +
|
||||
2 * nch * nc * sizeof(double) +
|
||||
sizeof(sls_detector_module) +
|
||||
@ -486,7 +480,6 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->nChip[X] = detlist.nChipX;
|
||||
thisDetector->nChip[Y] = detlist.nChipY;
|
||||
thisDetector->nDacs = detlist.nDacs;
|
||||
thisDetector->nAdcs = detlist.nAdcs;
|
||||
thisDetector->dynamicRange = detlist.dynamicRange;
|
||||
thisDetector->nGappixels[X] = detlist.nGappixelsX;
|
||||
thisDetector->nGappixels[Y] = detlist.nGappixelsY;
|
||||
@ -513,13 +506,11 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
|
||||
/** calculates the memory offsets for
|
||||
* flat field coefficients and errors,
|
||||
* module structures, dacs, adcs, chips and channels */
|
||||
* module structures, dacs, channels */
|
||||
thisDetector->modoff = sizeof(sharedSlsDetector);
|
||||
thisDetector->dacoff = thisDetector->modoff +
|
||||
sizeof(sls_detector_module);
|
||||
thisDetector->adcoff = thisDetector->dacoff +
|
||||
sizeof(int) * thisDetector->nDacs;
|
||||
thisDetector->chanoff = thisDetector->adcoff +
|
||||
thisDetector->chanoff = thisDetector->dacoff +
|
||||
sizeof(int) * thisDetector->nChips;
|
||||
}
|
||||
|
||||
@ -530,7 +521,6 @@ void slsDetector::initializeMembers() {
|
||||
char *goff = (char*)thisDetector;
|
||||
detectorModules = (sls_detector_module*)(goff + thisDetector->modoff);
|
||||
dacs = (int*)(goff + thisDetector->dacoff);
|
||||
adcs = (int*)(goff + thisDetector->adcoff);
|
||||
chanregs = (int*)(goff + thisDetector->chanoff);
|
||||
if (thisDetectorControl) {
|
||||
delete thisDetectorControl;
|
||||
@ -562,12 +552,11 @@ void slsDetector::initializeDetectorStructurePointers() {
|
||||
thisMod->nchan = thisDetector->nChans*thisDetector->nChips;
|
||||
thisMod->nchip = thisDetector->nChips;
|
||||
thisMod->ndac = thisDetector->nDacs;
|
||||
thisMod->nadc = thisDetector->nAdcs;
|
||||
thisMod->reg = 0;
|
||||
thisMod->iodelay = 0;
|
||||
thisMod->tau = 0;
|
||||
thisMod->eV = 0;
|
||||
// dacs, adcs and chanregs for thisMod is not allocated in
|
||||
// dacs and chanregs for thisMod is not allocated in
|
||||
// detectorModules in shared memory as they are already allocated separately
|
||||
// in shared memory (below)
|
||||
|
||||
@ -575,10 +564,6 @@ void slsDetector::initializeDetectorStructurePointers() {
|
||||
for (int i = 0; i < thisDetector->nDacs; ++i) {
|
||||
*(dacs + i) = 0;
|
||||
}
|
||||
// initializes the adc values to 0
|
||||
for (int i = 0; i < thisDetector->nAdcs; ++i) {
|
||||
*(adcs + i) = 0;
|
||||
}
|
||||
// initializes the channel registers to 0
|
||||
for (int i = 0; i < thisDetector->nChans * thisDetector->nChips; ++i) {
|
||||
*(chanregs + i) = -1;
|
||||
@ -594,27 +579,23 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule() {
|
||||
slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType type) {
|
||||
// get the detector parameters based on type
|
||||
detParameterList detlist;
|
||||
int nch = 0, nc = 0, nd = 0, na = 0;
|
||||
int nch = 0, nc = 0, nd = 0;
|
||||
try {
|
||||
setDetectorSpecificParameters(type, detlist);
|
||||
nch = detlist.nChanX * detlist.nChanY;
|
||||
nc = detlist.nChipX * detlist.nChipY;
|
||||
nd = detlist.nDacs;
|
||||
na = detlist.nAdcs;
|
||||
} catch(...) {
|
||||
return NULL;
|
||||
}
|
||||
int *dacs = new int[nd];
|
||||
int *adcs = new int[na];
|
||||
int *chanregs = new int[nch*nc];
|
||||
|
||||
sls_detector_module *myMod = (sls_detector_module*)malloc(sizeof(sls_detector_module));
|
||||
myMod->ndac = nd;
|
||||
myMod->nadc = na;
|
||||
myMod->nchip = nc;
|
||||
myMod->nchan = nch*nc;
|
||||
myMod->dacs = dacs;
|
||||
myMod->adcs = adcs;
|
||||
myMod->chanregs = chanregs;
|
||||
return myMod;
|
||||
}
|
||||
@ -622,7 +603,6 @@ slsDetectorDefs::sls_detector_module* slsDetector::createModule(detectorType ty
|
||||
|
||||
void slsDetector::deleteModule(sls_detector_module *myMod) {
|
||||
delete [] myMod->dacs;
|
||||
delete [] myMod->adcs;
|
||||
delete [] myMod->chanregs;
|
||||
delete myMod;
|
||||
}
|
||||
@ -693,21 +673,51 @@ void slsDetector::disconnectStop() {
|
||||
|
||||
|
||||
int slsDetector::sendModule(sls_detector_module *myMod) {
|
||||
TLogLevel level = logDEBUG1;
|
||||
FILE_LOG(level) << "Sending Module";
|
||||
int ts = 0;
|
||||
ts += controlSocket->SendDataOnly(&(myMod->serialnumber), sizeof(myMod->serialnumber));
|
||||
ts += controlSocket->SendDataOnly(&(myMod->nchan), sizeof(myMod->nchan));
|
||||
ts += controlSocket->SendDataOnly(&(myMod->nchip), sizeof(myMod->nchip));
|
||||
ts += controlSocket->SendDataOnly(&(myMod->ndac), sizeof(myMod->ndac));
|
||||
ts += controlSocket->SendDataOnly(&(myMod->nadc), sizeof(myMod->nadc));
|
||||
ts += controlSocket->SendDataOnly(&(myMod->reg), sizeof(myMod->reg));
|
||||
ts += controlSocket->SendDataOnly(&(myMod->iodelay), sizeof(myMod->iodelay));
|
||||
ts += controlSocket->SendDataOnly(&(myMod->tau), sizeof(myMod->tau));
|
||||
ts += controlSocket->SendDataOnly(&(myMod->eV), sizeof(myMod->eV));
|
||||
int n = 0;
|
||||
|
||||
n = controlSocket->SendDataOnly(&(myMod->serialnumber), sizeof(myMod->serialnumber));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "Serial number sent. " << n << " bytes. serialno: " << myMod->serialnumber;
|
||||
|
||||
n = controlSocket->SendDataOnly(&(myMod->nchan), sizeof(myMod->nchan));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "nchan sent. " << n << " bytes. serialno: " << myMod->nchan;
|
||||
|
||||
n = controlSocket->SendDataOnly(&(myMod->nchip), sizeof(myMod->nchip));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "nchip sent. " << n << " bytes. serialno: " << myMod->nchip;
|
||||
|
||||
n = controlSocket->SendDataOnly(&(myMod->ndac), sizeof(myMod->ndac));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "ndac sent. " << n << " bytes. serialno: " << myMod->ndac;
|
||||
|
||||
n = controlSocket->SendDataOnly(&(myMod->reg), sizeof(myMod->reg));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "reg sent. " << n << " bytes. serialno: " << myMod->reg;
|
||||
|
||||
n = controlSocket->SendDataOnly(&(myMod->iodelay), sizeof(myMod->iodelay));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "iodelay sent. " << n << " bytes. serialno: " << myMod->iodelay;
|
||||
|
||||
n = controlSocket->SendDataOnly(&(myMod->tau), sizeof(myMod->tau));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "tau sent. " << n << " bytes. serialno: " << myMod->tau;
|
||||
|
||||
n = controlSocket->SendDataOnly(&(myMod->eV), sizeof(myMod->eV));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "ev sent. " << n << " bytes. serialno: " << myMod->eV;
|
||||
|
||||
n = controlSocket->SendDataOnly(myMod->dacs, sizeof(int) * (myMod->ndac));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "dacs sent. " << n << " bytes";
|
||||
|
||||
ts += controlSocket->SendDataOnly(myMod->dacs, sizeof(int) * (myMod->ndac));
|
||||
ts += controlSocket->SendDataOnly(myMod->adcs, sizeof(int) * (myMod->nadc));
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
ts += controlSocket->SendDataOnly(myMod->chanregs, sizeof(int) * (myMod->nchan));
|
||||
n = controlSocket->SendDataOnly(myMod->chanregs, sizeof(int) * (myMod->nchan));
|
||||
ts += n;
|
||||
FILE_LOG(level) << "channels sent. " << n << " bytes";
|
||||
}
|
||||
return ts;
|
||||
}
|
||||
@ -719,7 +729,6 @@ int slsDetector::receiveModule(sls_detector_module* myMod) {
|
||||
ts += controlSocket->ReceiveDataOnly(&(myMod->nchan), sizeof(myMod->nchan));
|
||||
ts += controlSocket->ReceiveDataOnly(&(myMod->nchip), sizeof(myMod->nchip));
|
||||
ts += controlSocket->ReceiveDataOnly(&(myMod->ndac), sizeof(myMod->ndac));
|
||||
ts += controlSocket->ReceiveDataOnly(&(myMod->nadc), sizeof(myMod->nadc));
|
||||
ts += controlSocket->ReceiveDataOnly(&(myMod->reg), sizeof(myMod->reg));
|
||||
ts += controlSocket->ReceiveDataOnly(&(myMod->iodelay), sizeof(myMod->iodelay));
|
||||
ts += controlSocket->ReceiveDataOnly(&(myMod->tau), sizeof(myMod->tau));
|
||||
@ -727,8 +736,6 @@ int slsDetector::receiveModule(sls_detector_module* myMod) {
|
||||
|
||||
ts += controlSocket->ReceiveDataOnly(myMod->dacs,sizeof(int)*(myMod->ndac));
|
||||
FILE_LOG(logDEBUG1) << "received dacs of size "<< ts;
|
||||
ts += controlSocket->ReceiveDataOnly(myMod->adcs,sizeof(int)*(myMod->nadc));
|
||||
FILE_LOG(logDEBUG1) << "received adc of size "<< ts;
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
ts += controlSocket->ReceiveDataOnly(myMod->chanregs, sizeof(int)*(myMod->nchan));
|
||||
FILE_LOG(logDEBUG1) << "nchans= " << thisDetector->nChans << " nchips= " << thisDetector->nChips
|
||||
@ -4342,30 +4349,26 @@ int slsDetector::setModule(sls_detector_module module, int tb) {
|
||||
|
||||
// update client structure
|
||||
if (ret == OK) {
|
||||
if (detectorModules) {
|
||||
if (thisDetector->myDetectorType == EIGER && tb && chanregs) {
|
||||
for (int ichip = 0; ichip < thisDetector->nChips; ++ichip) {
|
||||
for (int i = 0; i < thisDetector->nChans; ++i) {
|
||||
chanregs[i + ichip * thisDetector->nChans] =
|
||||
module.chanregs[ichip * thisDetector->nChans + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (adcs) {
|
||||
for (int i = 0; i < thisDetector->nAdcs; ++i) {
|
||||
adcs[i] = module.adcs[i];
|
||||
}
|
||||
if (dacs) {
|
||||
for (int i = 0; i < thisDetector->nDacs; ++i)
|
||||
dacs[i] = module.dacs[i];
|
||||
}
|
||||
(detectorModules)->serialnumber = module.serialnumber;
|
||||
(detectorModules)->reg = module.reg;
|
||||
(detectorModules)->iodelay = module.iodelay;
|
||||
(detectorModules)->tau = module.tau;
|
||||
(detectorModules)->eV = module.eV;
|
||||
}
|
||||
}
|
||||
if (detectorModules) {
|
||||
if (thisDetector->myDetectorType == EIGER && tb && chanregs) {
|
||||
for (int ichip = 0; ichip < thisDetector->nChips; ++ichip) {
|
||||
for (int i = 0; i < thisDetector->nChans; ++i) {
|
||||
chanregs[i + ichip * thisDetector->nChans] =
|
||||
module.chanregs[ichip * thisDetector->nChans + i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (dacs) {
|
||||
for (int i = 0; i < thisDetector->nDacs; ++i)
|
||||
dacs[i] = module.dacs[i];
|
||||
}
|
||||
(detectorModules)->serialnumber = module.serialnumber;
|
||||
(detectorModules)->reg = module.reg;
|
||||
(detectorModules)->iodelay = module.iodelay;
|
||||
(detectorModules)->tau = module.tau;
|
||||
(detectorModules)->eV = module.eV;
|
||||
|
||||
}
|
||||
if (module.eV != -1) {
|
||||
thisDetector->currentThresholdEV = module.eV;
|
||||
}
|
||||
@ -4412,10 +4415,6 @@ slsDetectorDefs::sls_detector_module *slsDetector::getModule() {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (adcs) {
|
||||
for (int i = 0; i < thisDetector->nAdcs; ++i)
|
||||
adcs[i] = myMod->adcs[i];
|
||||
}
|
||||
if (dacs) {
|
||||
for (int i = 0; i < thisDetector->nDacs; ++i) {
|
||||
dacs[i] = myMod->dacs[i];
|
||||
@ -5708,14 +5707,6 @@ slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string
|
||||
names.push_back("VDAC5");
|
||||
names.push_back("VDAC6");
|
||||
names.push_back("VDAC7");
|
||||
names.push_back("VDAC8");
|
||||
names.push_back("VDAC9");
|
||||
names.push_back("VDAC10");
|
||||
names.push_back("VDAC11");
|
||||
names.push_back("VDAC12");
|
||||
names.push_back("VDAC13");
|
||||
names.push_back("VDAC14");
|
||||
names.push_back("VDAC15");
|
||||
break;
|
||||
default:
|
||||
FILE_LOG(logERROR) << "Unknown detector type - unknown format for settings file";
|
||||
@ -5762,6 +5753,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string
|
||||
setErrorMask((getErrorMask())|(OTHER_ERROR_CODE));
|
||||
if (modCreated)
|
||||
deleteModule(myMod);
|
||||
infile.close();
|
||||
return NULL;
|
||||
}
|
||||
for(int i = 0; i < myMod->ndac; ++i)
|
||||
@ -5776,6 +5768,8 @@ slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string
|
||||
std::string str;
|
||||
while(infile.good()) {
|
||||
getline(infile,str);
|
||||
if (!str.length())
|
||||
break;
|
||||
FILE_LOG(logDEBUG1) << str;
|
||||
std::string sargname;
|
||||
int ival = 0;
|
||||
@ -5795,15 +5789,17 @@ slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string
|
||||
setErrorMask((getErrorMask())|(OTHER_ERROR_CODE));
|
||||
if (modCreated)
|
||||
deleteModule(myMod);
|
||||
infile.close();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// not all read
|
||||
if (idac != names.size()) {
|
||||
FILE_LOG(logERROR) << "Could read only " << idac << " dacs. Expected " << names.size() << "dacs";
|
||||
FILE_LOG(logERROR) << "Could read only " << idac << " dacs. Expected " << names.size() << " dacs";
|
||||
setErrorMask((getErrorMask())|(OTHER_ERROR_CODE));
|
||||
if (modCreated)
|
||||
deleteModule(myMod);
|
||||
infile.close();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,6 @@ typedef struct detParameterList {
|
||||
int nChipX;
|
||||
int nChipY;
|
||||
int nDacs;
|
||||
int nAdcs;
|
||||
int dynamicRange;
|
||||
int nGappixelsX;
|
||||
int nGappixelsY;
|
||||
@ -109,9 +108,6 @@ private:
|
||||
/** number of dacs per module*/
|
||||
int nDacs;
|
||||
|
||||
/** number of adcs per module */
|
||||
int nAdcs;
|
||||
|
||||
/** dynamic range of the detector data */
|
||||
int dynamicRange;
|
||||
|
||||
@ -149,9 +145,6 @@ private:
|
||||
/** memory offsets for the dac arrays */
|
||||
int dacoff;
|
||||
|
||||
/** memory offsets for the adc arrays */
|
||||
int adcoff;
|
||||
|
||||
/** memory offsets for the channel register arrays -trimbits*/
|
||||
int chanoff;
|
||||
|
||||
@ -1833,9 +1826,6 @@ private:
|
||||
/** pointer to dac valuse in shared memory */
|
||||
int *dacs;
|
||||
|
||||
/** pointer to adc valuse in shared memory */
|
||||
int *adcs;
|
||||
|
||||
/** pointer to channal registers in shared memory */
|
||||
int *chanregs;
|
||||
};
|
||||
|
@ -239,13 +239,11 @@ public:
|
||||
int nchan; /**< is the number of channels on the module*/
|
||||
int nchip; /**< is the number of chips on the module */
|
||||
int ndac; /**< is the number of dacs on the module */
|
||||
int nadc; /**< is the number of adcs on the module */
|
||||
int reg; /**< is the module register settings (gain level) */
|
||||
int iodelay; /**< iodelay */
|
||||
int tau; /**< tau */
|
||||
int eV; /**< threshold energy */
|
||||
int *dacs; /**< is the pointer to the array of the dac values (in V) */
|
||||
int *adcs; /**< is the pointer to the array of the adc values (in V) */
|
||||
int *chanregs; /**< is the pointer to the array of the channel registers */
|
||||
} sls_detector_module;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user