mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 11:20:04 +02:00
merge from developer
This commit is contained in:
commit
8cbf3c62a9
Binary file not shown.
@ -56,9 +56,9 @@ uint32_t adcEnableMask_1g = 0;
|
|||||||
uint8_t adcEnableMask_10g = 0;
|
uint8_t adcEnableMask_10g = 0;
|
||||||
|
|
||||||
|
|
||||||
int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
uint32_t clkFrequency[NUM_CLOCKS] = {40, 20, 20, 200};
|
uint32_t clkFrequency[NUM_CLOCKS] = {40, 20, 20, 200};
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {};
|
||||||
// software limit that depends on the current chip on the ctb
|
// software limit that depends on the current chip on the ctb
|
||||||
int vLimit = 0;
|
int vLimit = 0;
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
@ -1420,7 +1420,7 @@ int setHighVoltage(int val){
|
|||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
|
|
||||||
if(arg != GET_TIMING_MODE){
|
if(arg != GET_TIMING_MODE){
|
||||||
switch((int)arg){
|
switch(arg){
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||||
@ -2559,7 +2559,7 @@ int calculateDataBytes(){
|
|||||||
return dataBytes;
|
return dataBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips(){return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs(){return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||||
|
Binary file not shown.
@ -1108,7 +1108,7 @@ int setHighVoltage(int val) {
|
|||||||
void setTiming( enum timingMode arg) {
|
void setTiming( enum timingMode arg) {
|
||||||
enum timingMode ret=GET_TIMING_MODE;
|
enum timingMode ret=GET_TIMING_MODE;
|
||||||
if (arg != GET_TIMING_MODE) {
|
if (arg != GET_TIMING_MODE) {
|
||||||
switch((int)arg) {
|
switch(arg) {
|
||||||
case AUTO_TIMING: ret = 0; break;
|
case AUTO_TIMING: ret = 0; break;
|
||||||
case TRIGGER_EXPOSURE: ret = 2; break;
|
case TRIGGER_EXPOSURE: ret = 2; break;
|
||||||
case BURST_TRIGGER: ret = 1; break;
|
case BURST_TRIGGER: ret = 1; break;
|
||||||
@ -2041,7 +2041,7 @@ int calculateDataBytes() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int getTotalNumberOfChannels() {return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips() {return NCHIP;}
|
int getNumberOfChips() {return NCHIP;}
|
||||||
int getNumberOfDACs() {return NDAC;}
|
int getNumberOfDACs() {return NDAC;}
|
||||||
int getNumberOfChannelsPerChip() {return NCHAN;}
|
int getNumberOfChannelsPerChip() {return NCHAN;}
|
||||||
|
@ -22,7 +22,7 @@ target_include_directories(gotthard2DetectorServer_virtual
|
|||||||
)
|
)
|
||||||
|
|
||||||
target_compile_definitions(gotthard2DetectorServer_virtual
|
target_compile_definitions(gotthard2DetectorServer_virtual
|
||||||
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER
|
PUBLIC GOTTHARD2D VIRTUAL STOP_SERVER DEBUG1
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(gotthard2DetectorServer_virtual
|
target_link_libraries(gotthard2DetectorServer_virtual
|
||||||
|
@ -14,13 +14,33 @@
|
|||||||
|
|
||||||
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
/* Base addresses 0x1806 0000 ---------------------------------------------*/
|
||||||
/* General purpose control and status registers */
|
/* General purpose control and status registers */
|
||||||
#define BASE_CONTROL (0x0000)
|
#define BASE_CONTROL (0x0000) // 0x1806_0000 - 0x1806_00FF
|
||||||
/* Acquisition? TODO */
|
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/ctrl/ctrl.vhd
|
||||||
#define BASE_ACQUISITION (0x0200)
|
|
||||||
|
/* ASIC Control */
|
||||||
|
#define BASE_ASIC (0x0100) // 0x1806_0100 - 0x1806_011F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/asic/asic_ctrl.vhd
|
||||||
|
|
||||||
|
/* ASIC Digital Interface. Data recovery core */
|
||||||
|
#define BASE_ADIF (0x0120) // 0x1806_0120 - 0x1806_012F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/adif/adif_ctrl.vhd
|
||||||
|
|
||||||
|
/* Formatting of data core */
|
||||||
|
#define BASE_FMT (0x0130) // 0x1806_0130 - 0x1806_013F
|
||||||
|
|
||||||
|
/* Packetizer */
|
||||||
|
#define BASE_PKT (0x0140) // 0x1806_0140 - 0x1806_014F
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/gotthard_II_mcb/blob/master/code/hdl/pkt/pkt_ctrl.vhd
|
||||||
|
|
||||||
|
/* Flow control and status registers */
|
||||||
|
#define BASE_FLOW_CONTROL (0x00200) // 0x1806_0200 - 0x1806_02FF
|
||||||
|
// https://git.psi.ch/sls_detectors_firmware/vhdl_library/blob/f37608230b4721661f29aacc20124555705ee705/flow/flow_ctrl.vhd
|
||||||
|
|
||||||
/* UDP datagram generator */
|
/* UDP datagram generator */
|
||||||
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
#define BASE_UDP_RAM (0x01000) // 0x1806_1000 - 0x1806_1FFF
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Clock Generation registers ------------------------------------------------------*/
|
/* Clock Generation registers ------------------------------------------------------*/
|
||||||
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
|
#define PLL_RESET_REG (0x00 * REG_OFFSET + BASE_CLK_GENERATION)
|
||||||
|
|
||||||
@ -30,6 +50,7 @@
|
|||||||
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
|
#define PLL_RESET_SYSTEM_MSK (0x00000001 << PLL_RESET_SYSTEM_OFST)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Control registers --------------------------------------------------*/
|
/* Control registers --------------------------------------------------*/
|
||||||
|
|
||||||
/* Module Control Board Serial Number register */
|
/* Module Control Board Serial Number register */
|
||||||
@ -61,11 +82,6 @@
|
|||||||
/* Status register */
|
/* Status register */
|
||||||
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
|
#define STATUS_REG (0x04 * REG_OFFSET + BASE_CONTROL)
|
||||||
|
|
||||||
#ifdef VIRTUAL
|
|
||||||
#define RUN_BUSY_OFST (0)
|
|
||||||
#define RUN_BUSY_MSK (0x00000001 << RUN_BUSY_OFST)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Look at me read only register */
|
/* Look at me read only register */
|
||||||
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL)
|
#define LOOK_AT_ME_REG (0x05 * REG_OFFSET + BASE_CONTROL)
|
||||||
|
|
||||||
@ -88,43 +104,144 @@
|
|||||||
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
|
#define CONTROL_PRPHRL_RST_MSK (0x00000001 << CONTROL_PRPHRL_RST_OFST)
|
||||||
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
|
#define CONTROL_CLR_ACQSTN_FIFO_OFST (15)
|
||||||
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
#define CONTROL_CLR_ACQSTN_FIFO_MSK (0x00000001 << CONTROL_CLR_ACQSTN_FIFO_OFST)
|
||||||
|
#define CONTROL_PWR_CHIP_OFST (31)
|
||||||
/* Pattern IO Control 64 bit register */
|
#define CONTROL_PWR_CHIP_MSK (0x00000001 << CONTROL_PWR_CHIP_OFST)
|
||||||
#define PATTERN_IO_CTRL_LSB_REG (0x22 * REG_OFFSET + BASE_CONTROL)
|
|
||||||
#define PATTERN_IO_CTRL_MSB_REG (0x23 * REG_OFFSET + BASE_CONTROL)
|
|
||||||
|
|
||||||
/** DTA Offset Register */
|
/** DTA Offset Register */
|
||||||
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
#define DTA_OFFSET_REG (0x24 * REG_OFFSET + BASE_CONTROL)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ASIC registers --------------------------------------------------*/
|
||||||
|
|
||||||
|
/* ASIC Config register */
|
||||||
|
#define ASIC_CONFIG_REG (0x00 * REG_OFFSET + BASE_ASIC)
|
||||||
|
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_OFST (0)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_MSK (0x00000003 << ASIC_CONFIG_RUN_MODE_OFST)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_INT_BURST_VAL ((0x1 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_CONT_VAL ((0x2 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
|
#define ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL ((0x3 << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK)
|
||||||
|
#define ASIC_CONFIG_GAIN_OFST (4)
|
||||||
|
#define ASIC_CONFIG_GAIN_MSK (0x00000003 << ASIC_CONFIG_GAIN_OFST)
|
||||||
|
#define ASIC_CONFIG_DYNAMIC_GAIN_VAL ((0x0 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
#define ASIC_CONFIG_FIX_GAIN_1_VAL ((0x1 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
#define ASIC_CONFIG_FIX_GAIN_2_VAL ((0x2 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
#define ASIC_CONFIG_RESERVED_VAL ((0x3 << ASIC_CONFIG_GAIN_OFST) & ASIC_CONFIG_GAIN_MSK)
|
||||||
|
#define ASIC_CONFIG_RST_DAC_OFST (15)
|
||||||
|
#define ASIC_CONFIG_RST_DAC_MSK (0x00000001 << ASIC_CONFIG_RST_DAC_OFST)
|
||||||
|
#define ASIC_CONFIG_DONE_OFST (31)
|
||||||
|
#define ASIC_CONFIG_DONE_MSK (0x00000001 << ASIC_CONFIG_DONE_OFST)
|
||||||
|
|
||||||
|
/* ASIC Internal Frames Register */
|
||||||
|
#define ASIC_INT_FRAMES_REG (0x01 * REG_OFFSET + BASE_ASIC)
|
||||||
|
|
||||||
|
#define ASIC_INT_FRAMES_OFST (0)
|
||||||
|
#define ASIC_INT_FRAMES_MSK (0x00000FFF << ASIC_INT_FRAMES_OFST)
|
||||||
|
|
||||||
|
/* ASIC Period 64bit Register */
|
||||||
|
#define ASIC_INT_PERIOD_LSB_REG (0x02 * REG_OFFSET + BASE_ASIC)
|
||||||
|
#define ASIC_INT_PERIOD_MSB_REG (0x03 * REG_OFFSET + BASE_ASIC)
|
||||||
|
|
||||||
|
/* ASIC Exptime 64bit Register */
|
||||||
|
#define ASIC_INT_EXPTIME_LSB_REG (0x04 * REG_OFFSET + BASE_ASIC)
|
||||||
|
#define ASIC_INT_EXPTIME_MSB_REG (0x05 * REG_OFFSET + BASE_ASIC)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* Packetizer -------------------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Packetizer Config Register */
|
||||||
|
#define PKT_CONFIG_REG (0x00 * REG_OFFSET + BASE_PKT)
|
||||||
|
|
||||||
|
#define PKT_CONFIG_NRXR_MAX_OFST (0)
|
||||||
|
#define PKT_CONFIG_NRXR_MAX_MSK (0x0000003F << PKT_CONFIG_NRXR_MAX_OFST)
|
||||||
|
#define PKT_CONFIG_RXR_START_ID_OFST (8)
|
||||||
|
#define PKT_CONFIG_RXR_START_ID_MSK (0x0000003F << PKT_CONFIG_RXR_START_ID_OFST)
|
||||||
|
|
||||||
|
/* Module Coordinates Register */
|
||||||
|
#define COORD_0_REG (0x02 * REG_OFFSET + BASE_PKT)
|
||||||
|
#define COORD_ROW_OFST (0)
|
||||||
|
#define COORD_ROW_MSK (0x0000FFFF << COORD_ROW_OFST)
|
||||||
|
#define COORD_COL_OFST (16)
|
||||||
|
#define COORD_COL_MSK (0x0000FFFF << COORD_COL_OFST)
|
||||||
|
|
||||||
|
/* Module ID Register */
|
||||||
|
#define COORD_1_REG (0x03 * REG_OFFSET + BASE_PKT)
|
||||||
|
#define COORD_RESERVED_OFST (0)
|
||||||
|
#define COORD_RESERVED_MSK (0x0000FFFF << COORD_RESERVED_OFST)
|
||||||
|
#define COORD_ID_OFST (16) // Not connected in firmware TODO
|
||||||
|
#define COORD_ID_MSK (0x0000FFFF << COORD_ID_OFST) // Not connected in firmware TODO
|
||||||
|
|
||||||
|
|
||||||
|
/* Flow control registers --------------------------------------------------*/
|
||||||
|
|
||||||
|
/* Flow status Register*/
|
||||||
|
#define FLOW_STATUS_REG (0x00 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
#define FLOW_STATUS_RUN_BUSY_OFST (0)
|
||||||
|
#define FLOW_STATUS_RUN_BUSY_MSK (0x00000001 << FLOW_STATUS_RUN_BUSY_OFST)
|
||||||
|
#define FLOW_STATUS_WAIT_FOR_TRGGR_OFST (3)
|
||||||
|
#define FLOW_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << FLOW_STATUS_WAIT_FOR_TRGGR_OFST)
|
||||||
|
#define FLOW_STATUS_DLY_BFRE_TRGGR_OFST (4)
|
||||||
|
#define FLOW_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_BFRE_TRGGR_OFST)
|
||||||
|
#define FLOW_STATUS_FIFO_FULL_OFST (5)
|
||||||
|
#define FLOW_STATUS_FIFO_FULL_MSK (0x00000001 << FLOW_STATUS_FIFO_FULL_OFST)
|
||||||
|
#define FLOW_STATUS_DLY_AFTR_TRGGR_OFST (15)
|
||||||
|
#define FLOW_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << FLOW_STATUS_DLY_AFTR_TRGGR_OFST)
|
||||||
|
#define FLOW_STATUS_CSM_BUSY_OFST (17)
|
||||||
|
#define FLOW_STATUS_CSM_BUSY_MSK (0x00000001 << FLOW_STATUS_CSM_BUSY_OFST)
|
||||||
|
|
||||||
|
/* Delay left 64bit Register */
|
||||||
|
#define GET_DELAY_LSB_REG (0x02 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define GET_DELAY_MSB_REG (0x03 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Acquisition registers --------------------------------------------------*/
|
|
||||||
//TODO
|
|
||||||
/* Triggers left 64bit Register */
|
/* Triggers left 64bit Register */
|
||||||
#define GET_CYCLES_LSB_REG (0x10 + BASE_ACQUISITION)
|
#define GET_CYCLES_LSB_REG (0x04 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define GET_CYCLES_MSB_REG (0x14 + BASE_ACQUISITION)
|
#define GET_CYCLES_MSB_REG (0x05 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Frames left 64bit Register */
|
/* Frames left 64bit Register */
|
||||||
#define GET_FRAMES_LSB_REG (0x18 + BASE_ACQUISITION)
|
#define GET_FRAMES_LSB_REG (0x06 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define GET_FRAMES_MSB_REG (0x1C + BASE_ACQUISITION)
|
#define GET_FRAMES_MSB_REG (0x07 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
/* Period left 64bit Register */
|
||||||
|
#define GET_PERIOD_LSB_REG (0x08 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define GET_PERIOD_MSB_REG (0x09 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
/* Time from Start 64 bit register */
|
||||||
|
#define TIME_FROM_START_LSB_REG (0x0A * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define TIME_FROM_START_MSB_REG (0x0B * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
/* Get Frames from Start 64 bit register (frames from last reset using CONTROL_CRST) */
|
||||||
|
#define FRAMES_FROM_START_LSB_REG (0x0C * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define FRAMES_FROM_START_MSB_REG (0x0D * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
|
/* Measurement Time 64 bit register (timestamp at a frame start until reset)*/
|
||||||
|
#define START_FRAME_TIME_LSB_REG (0x0E * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define START_FRAME_TIME_MSB_REG (0x0F * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Delay 64bit Write-register */
|
/* Delay 64bit Write-register */
|
||||||
#define SET_DELAY_LSB_REG (0x88 + BASE_ACQUISITION)
|
#define SET_DELAY_LSB_REG (0x22 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_DELAY_MSB_REG (0x8C + BASE_ACQUISITION)
|
#define SET_DELAY_MSB_REG (0x23 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Cylces 64bit Write-register */
|
/* Cylces 64bit Write-register */
|
||||||
#define SET_CYCLES_LSB_REG (0x90 + BASE_ACQUISITION)
|
#define SET_CYCLES_LSB_REG (0x24 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_CYCLES_MSB_REG (0x94 + BASE_ACQUISITION)
|
#define SET_CYCLES_MSB_REG (0x25 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Frames 64bit Write-register */
|
/* Frames 64bit Write-register */
|
||||||
#define SET_FRAMES_LSB_REG (0x98 + BASE_ACQUISITION)
|
#define SET_FRAMES_LSB_REG (0x26 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_FRAMES_MSB_REG (0x9C + BASE_ACQUISITION)
|
#define SET_FRAMES_MSB_REG (0x27 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Period 64bit Write-register */
|
/* Period 64bit Write-register */
|
||||||
#define SET_PERIOD_LSB_REG (0xA0 + BASE_ACQUISITION)
|
#define SET_PERIOD_LSB_REG (0x28 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_PERIOD_MSB_REG (0xA4 + BASE_ACQUISITION)
|
#define SET_PERIOD_MSB_REG (0x29 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
|
||||||
/* Exptime 64bit Write-register */
|
/* External Signal register */
|
||||||
#define SET_EXPTIME_LSB_REG (0xA8 + BASE_ACQUISITION)
|
#define EXT_SIGNAL_REG (0x30 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
#define SET_EXPTIME_MSB_REG (0xBC + BASE_ACQUISITION)
|
|
||||||
|
#define EXT_SIGNAL_OFST (0)
|
||||||
|
#define EXT_SIGNAL_MSK (0x00000001 << EXT_SIGNAL_OFST)
|
||||||
|
|
||||||
|
/* Trigger Delay 64 bit register */
|
||||||
|
#define SET_TRIGGER_DELAY_LSB_REG (0x32 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
#define SET_TRIGGER_DELAY_MSB_REG (0x33 * REG_OFFSET + BASE_FLOW_CONTROL)
|
||||||
|
Binary file not shown.
@ -22,7 +22,9 @@
|
|||||||
|
|
||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int checkModuleFlag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
int initError = OK;
|
int initError = OK;
|
||||||
int initCheckDone = 0;
|
int initCheckDone = 0;
|
||||||
@ -34,19 +36,22 @@ int virtual_status = 0;
|
|||||||
int virtual_stop = 0;
|
int virtual_stop = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0, 0, 0};
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
uint32_t clkFrequency[NUM_CLOCKS] = {0, 0, 0, 0, 0, 0};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
|
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {0};
|
||||||
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {0};
|
int onChipdacValues[ONCHIP_NDAC][NCHIP] = {0};
|
||||||
int defaultDacValues[NDAC] = {0};
|
|
||||||
int defaultOnChipdacValues[ONCHIP_NDAC][NCHIP] = {0};
|
|
||||||
int injectedChannelsOffset = 0;
|
int injectedChannelsOffset = 0;
|
||||||
int injectedChannelsIncrement = 0;
|
int injectedChannelsIncrement = 0;
|
||||||
int vetoReference[NCHIP][NCHAN];
|
int vetoReference[NCHIP][NCHAN];
|
||||||
uint8_t adcConfiguration[NCHIP][NADC];
|
uint8_t adcConfiguration[NCHIP][NADC];
|
||||||
int burstMode = 0;
|
int burstMode = 0;
|
||||||
int detPos[2] = {0, 0};
|
enum burstModeType burstType = INTERNAL;
|
||||||
|
int64_t exptime_ns = 0;
|
||||||
|
int64_t period_ns = 0;
|
||||||
|
int64_t nframes = 0;
|
||||||
|
int detPos[2] = {};
|
||||||
|
|
||||||
int isInitCheckDone() {
|
int isInitCheckDone() {
|
||||||
return initCheckDone;
|
return initCheckDone;
|
||||||
@ -72,6 +77,7 @@ void basictests() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
#else
|
#else
|
||||||
|
FILE_LOG(logINFOBLUE, ("************ Gotthard2 Server *********************\n"));
|
||||||
if (mapCSP0() == FAIL) {
|
if (mapCSP0() == FAIL) {
|
||||||
strcpy(initErrorMessage,
|
strcpy(initErrorMessage,
|
||||||
"Could not map to memory. Dangerous to continue.\n");
|
"Could not map to memory. Dangerous to continue.\n");
|
||||||
@ -97,7 +103,7 @@ void basictests() {
|
|||||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||||
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
||||||
|
|
||||||
FILE_LOG(logINFOBLUE, ("************ Gotthard2 Server *********************\n"
|
FILE_LOG(logINFOBLUE, ("*************************************************\n"
|
||||||
"Hardware Version:\t\t 0x%x\n"
|
"Hardware Version:\t\t 0x%x\n"
|
||||||
|
|
||||||
"Detector IP Addr:\t\t 0x%x\n"
|
"Detector IP Addr:\t\t 0x%x\n"
|
||||||
@ -158,7 +164,6 @@ void basictests() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FILE_LOG(logINFO, ("Compatibility - success\n"));
|
FILE_LOG(logINFO, ("Compatibility - success\n"));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,7 +171,7 @@ int checkType() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
||||||
if (type != GOTTHARD2){
|
if (type != GOTTHARD2){
|
||||||
FILE_LOG(logERROR, ("This is not a Gotthard2 Server (read %d, expected %d)\n", type, GOTTHARD2));
|
FILE_LOG(logERROR, ("This is not a Gotthard2 Server (read %d, expected %d)\n", type, GOTTHARD2));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -340,11 +345,15 @@ void setupDetector() {
|
|||||||
detPos[0] = 0;
|
detPos[0] = 0;
|
||||||
detPos[1] = 0;
|
detPos[1] = 0;
|
||||||
|
|
||||||
|
thisSettings = UNINITIALIZED;
|
||||||
highvoltage = 0;
|
highvoltage = 0;
|
||||||
injectedChannelsOffset = 0;
|
injectedChannelsOffset = 0;
|
||||||
injectedChannelsIncrement = 0;
|
injectedChannelsIncrement = 0;
|
||||||
burstMode = 0;
|
burstMode = 0;
|
||||||
|
burstType = INTERNAL;
|
||||||
|
exptime_ns = 0;
|
||||||
|
period_ns = 0;
|
||||||
|
nframes = 0;
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
for (i = 0; i < NUM_CLOCKS; ++i) {
|
for (i = 0; i < NUM_CLOCKS; ++i) {
|
||||||
@ -352,12 +361,10 @@ void setupDetector() {
|
|||||||
}
|
}
|
||||||
for (i = 0; i < NDAC; ++i) {
|
for (i = 0; i < NDAC; ++i) {
|
||||||
dacValues[i] = 0;
|
dacValues[i] = 0;
|
||||||
defaultDacValues[i] = 0;
|
|
||||||
}
|
}
|
||||||
for (i = 0; i < ONCHIP_NDAC; ++i) {
|
for (i = 0; i < ONCHIP_NDAC; ++i) {
|
||||||
for (j = 0; j < NCHIP; ++j) {
|
for (j = 0; j < NCHIP; ++j) {
|
||||||
onChipdacValues[i][j] = -1;
|
onChipdacValues[i][j] = -1;
|
||||||
defaultOnChipdacValues[i][j] = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < NCHIP; ++i) {
|
for (i = 0; i < NCHIP; ++i) {
|
||||||
@ -386,52 +393,68 @@ void setupDetector() {
|
|||||||
|
|
||||||
// Default values
|
// Default values
|
||||||
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
setHighVoltage(DEFAULT_HIGH_VOLTAGE);
|
||||||
|
|
||||||
|
// check module type attached if not in debug mode
|
||||||
|
{
|
||||||
|
int ret = checkDetectorType();
|
||||||
|
if (checkModuleFlag) {
|
||||||
|
switch (ret) {
|
||||||
|
case -1:
|
||||||
|
sprintf(initErrorMessage, "Could not get the module type attached.\n");
|
||||||
|
initError = FAIL;
|
||||||
|
FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage));
|
||||||
|
return;
|
||||||
|
case -2:
|
||||||
|
sprintf(initErrorMessage, "No Module attached! Run server with -nomodule.\n");
|
||||||
|
initError = FAIL;
|
||||||
|
FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage));
|
||||||
|
return;
|
||||||
|
case FAIL:
|
||||||
|
sprintf(initErrorMessage, "Wrong Module (Not Gotthard2) attached!\n");
|
||||||
|
initError = FAIL;
|
||||||
|
FILE_LOG(logERROR, ("Aborting startup!\n\n", initErrorMessage));
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// power on chip
|
||||||
|
powerChip(1);
|
||||||
|
|
||||||
|
#ifndef VIRTUAL
|
||||||
// also sets default dac and on chip dac values
|
// also sets default dac and on chip dac values
|
||||||
if (readConfigFile() == FAIL) {
|
if (readConfigFile() == FAIL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setBurstMode(1);
|
#endif
|
||||||
|
// set burst mode will take in burstType and also set it
|
||||||
|
burstType = DEFAULT_BURST_TYPE;
|
||||||
|
setBurstMode(DEFAULT_BURST_MODE);
|
||||||
|
setSettings(DEFAULT_SETTINGS);
|
||||||
|
|
||||||
// Initialization of acquistion parameters
|
// Initialization of acquistion parameters
|
||||||
setNumFrames(DEFAULT_NUM_FRAMES);
|
setNumFrames(DEFAULT_NUM_FRAMES);
|
||||||
setNumTriggers(DEFAULT_NUM_CYCLES);
|
setNumTriggers(DEFAULT_NUM_CYCLES);
|
||||||
setExpTime(DEFAULT_EXPTIME);
|
setExpTime(DEFAULT_EXPTIME);
|
||||||
setPeriod(DEFAULT_PERIOD);
|
setPeriod(DEFAULT_PERIOD);
|
||||||
|
setDelayAfterTrigger(DEFAULT_DELAY_AFTER_TRIGGER);
|
||||||
|
setTiming(DEFAULT_TIMING_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int setDefaultDacs() {
|
|
||||||
int ret = OK;
|
|
||||||
FILE_LOG(logINFOBLUE, ("Setting Default Dac values\n"));
|
|
||||||
{
|
|
||||||
int idac = 0;
|
|
||||||
for(idac = 0; idac < NDAC; ++idac) {
|
|
||||||
setDAC((enum DACINDEX)idac, defaultDacValues[idac], 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int setDefaultOnChipDacs() {
|
|
||||||
int ret = OK;
|
|
||||||
FILE_LOG(logINFOBLUE, ("Setting Default On chip Dac values\n"));
|
|
||||||
{
|
|
||||||
int idac = 0, ichip = 0;
|
|
||||||
for(idac = 0; idac < ONCHIP_NDAC; ++idac) {
|
|
||||||
for(ichip = 0; ichip < NCHIP; ++ichip) {
|
|
||||||
setOnChipDAC((enum ONCHIP_DACINDEX)idac, ichip, defaultOnChipdacValues[idac][ichip]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int readConfigFile() {
|
int readConfigFile() {
|
||||||
|
|
||||||
if (initError == FAIL) {
|
if (initError == FAIL) {
|
||||||
return initError;
|
return initError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// inform FPGA that onchip dacs will be configured soon
|
||||||
|
FILE_LOG(logINFO, ("Setting configuration starting bit\n"));
|
||||||
|
bus_w(ASIC_CONFIG_REG, bus_r(ASIC_CONFIG_REG) | ASIC_CONFIG_RST_DAC_MSK);
|
||||||
|
|
||||||
FILE* fd = fopen(CONFIG_FILE, "r");
|
FILE* fd = fopen(CONFIG_FILE, "r");
|
||||||
if(fd == NULL) {
|
if(fd == NULL) {
|
||||||
sprintf(initErrorMessage, "Could not open on-board detector server config file [%s].\n", CONFIG_FILE);
|
sprintf(initErrorMessage, "Could not open on-board detector server config file [%s].\n", CONFIG_FILE);
|
||||||
@ -649,7 +672,7 @@ int readConfigFile() {
|
|||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
for (i = 0; i < NCHIP; ++i) {
|
for (i = 0; i < NCHIP; ++i) {
|
||||||
for (j = 0; j < NADC; ++j) {
|
for (j = 0; j < NADC; ++j) {
|
||||||
FILE_LOG(logDEBUG1, ("adc read %d %d: 0x%02hhx\n", i, j, adcConfiguration[i][j]));
|
FILE_LOG(logDEBUG2, ("adc read %d %d: 0x%02hhx\n", i, j, adcConfiguration[i][j]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -659,10 +682,39 @@ int readConfigFile() {
|
|||||||
FILE_LOG(logERROR, ("%s\n\n", initErrorMessage));
|
FILE_LOG(logERROR, ("%s\n\n", initErrorMessage));
|
||||||
} else {
|
} else {
|
||||||
FILE_LOG(logINFOBLUE, ("Successfully read config file\n"));
|
FILE_LOG(logINFOBLUE, ("Successfully read config file\n"));
|
||||||
|
|
||||||
|
// inform FPGA that onchip dacs will be configured soon
|
||||||
|
FILE_LOG(logINFO, ("Setting configuration done bit\n"));
|
||||||
|
bus_w(ASIC_CONFIG_REG, bus_r(ASIC_CONFIG_REG) | ASIC_CONFIG_DONE_MSK);
|
||||||
}
|
}
|
||||||
return initError;
|
return initError;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* firmware functions (resets) */
|
||||||
|
|
||||||
|
void cleanFifos() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
FILE_LOG(logINFO, ("Clearing Acquisition Fifos\n"));
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CLR_ACQSTN_FIFO_MSK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetCore() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
FILE_LOG(logINFO, ("Resetting Core\n"));
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_CRE_RST_MSK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void resetPeripheral() {
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
|
FILE_LOG(logINFO, ("Resetting Peripheral\n"));
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PRPHRL_RST_MSK);
|
||||||
|
}
|
||||||
|
|
||||||
/* set parameters - dr, roi */
|
/* set parameters - dr, roi */
|
||||||
|
|
||||||
@ -671,16 +723,16 @@ int setDynamicRange(int dr){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* parameters */
|
/* parameters - timer */
|
||||||
void setNumFrames(int64_t val) {
|
void setNumFrames(int64_t val) {
|
||||||
if (val > 0) {
|
if (val > 0) {
|
||||||
FILE_LOG(logINFO, ("Setting number of frames %lld\n", (long long int)val));
|
FILE_LOG(logINFO, ("Setting number of frames %lld [local]\n", (long long int)val));
|
||||||
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
nframes = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getNumFrames() {
|
int64_t getNumFrames() {
|
||||||
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
return nframes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setNumTriggers(int64_t val) {
|
void setNumTriggers(int64_t val) {
|
||||||
@ -699,21 +751,13 @@ int setExpTime(int64_t val) {
|
|||||||
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
FILE_LOG(logERROR, ("Invalid exptime: %lld ns\n", (long long int)val));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
FILE_LOG(logINFO, ("Setting exptime %lld ns\n", (long long int)val));
|
FILE_LOG(logINFO, ("Setting exptime %lld ns [local]\n", (long long int)val));
|
||||||
val *= (1E-9 * READOUT_C0);
|
exptime_ns = val;
|
||||||
set64BitReg(val, SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG);
|
|
||||||
|
|
||||||
// validate for tolerance
|
|
||||||
int64_t retval = getExpTime();
|
|
||||||
val /= (1E-9 * READOUT_C0);
|
|
||||||
if (val != retval) {
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getExpTime() {
|
int64_t getExpTime() {
|
||||||
return get64BitReg(SET_EXPTIME_LSB_REG, SET_EXPTIME_MSB_REG) / (1E-9 * READOUT_C0);
|
return exptime_ns;
|
||||||
}
|
}
|
||||||
|
|
||||||
int setPeriod(int64_t val) {
|
int setPeriod(int64_t val) {
|
||||||
@ -721,21 +765,118 @@ int setPeriod(int64_t val) {
|
|||||||
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
FILE_LOG(logERROR, ("Invalid period: %lld ns\n", (long long int)val));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
FILE_LOG(logINFO, ("Setting period %lld ns\n", (long long int)val));
|
FILE_LOG(logINFO, ("Setting period %lld ns [local]\n", (long long int)val));
|
||||||
val *= (1E-9 * SYSTEM_C0);
|
period_ns = val;
|
||||||
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getPeriod() {
|
||||||
|
return period_ns;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setNumFramesBurst(int64_t val) {
|
||||||
|
FILE_LOG(logINFO, ("Setting number of frames %d [Burst mode]\n", (int)val));
|
||||||
|
bus_w(ASIC_INT_FRAMES_REG, bus_r(ASIC_INT_FRAMES_REG) &~ ASIC_INT_FRAMES_MSK);
|
||||||
|
bus_w(ASIC_INT_FRAMES_REG, bus_r(ASIC_INT_FRAMES_REG) | (((int)val << ASIC_INT_FRAMES_OFST) & ASIC_INT_FRAMES_MSK));
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getNumFramesBurst() {
|
||||||
|
return ((bus_r(ASIC_INT_FRAMES_REG) & ASIC_INT_FRAMES_MSK) >> ASIC_INT_FRAMES_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setNumFramesCont(int64_t val) {
|
||||||
|
FILE_LOG(logINFO, ("Setting number of frames %lld [Continuous mode]\n", (long long int)val));
|
||||||
|
set64BitReg(val, SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getNumFramesCont() {
|
||||||
|
return get64BitReg(SET_FRAMES_LSB_REG, SET_FRAMES_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setExptimeBurst(int64_t val) {
|
||||||
|
FILE_LOG(logINFO, ("Setting exptime %lld ns [Burst mode]\n", (long long int)val));
|
||||||
|
return setExptimeBoth(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setExptimeCont(int64_t val) {
|
||||||
|
FILE_LOG(logINFO, ("Setting exptime %lld ns [Continuous mode]\n", (long long int)val));
|
||||||
|
return setExptimeBoth(val);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setExptimeBoth(int64_t val) {
|
||||||
|
val *= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||||
|
set64BitReg(val, ASIC_INT_EXPTIME_LSB_REG, ASIC_INT_EXPTIME_MSB_REG);
|
||||||
|
|
||||||
// validate for tolerance
|
// validate for tolerance
|
||||||
int64_t retval = getPeriod();
|
int64_t retval = getExptimeBoth();
|
||||||
val /= (1E-9 * SYSTEM_C0);
|
val /= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||||
if (val != retval) {
|
if (val != retval) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getPeriod() {
|
int64_t getExptimeBoth() {
|
||||||
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * SYSTEM_C0);
|
return get64BitReg(ASIC_INT_EXPTIME_LSB_REG, ASIC_INT_EXPTIME_MSB_REG) / (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int setPeriodBurst(int64_t val) {
|
||||||
|
FILE_LOG(logINFO, ("Setting period %lld ns [Burst mode]\n", (long long int)val));
|
||||||
|
val *= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||||
|
set64BitReg(val, ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG);
|
||||||
|
|
||||||
|
// validate for tolerance
|
||||||
|
int64_t retval = getPeriodBurst();
|
||||||
|
val /= (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||||
|
if (val != retval) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getPeriodBurst() {
|
||||||
|
return get64BitReg(ASIC_INT_PERIOD_LSB_REG, ASIC_INT_PERIOD_MSB_REG)/ (1E-9 * clkFrequency[SYSTEM_C0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setPeriodCont(int64_t val) {
|
||||||
|
FILE_LOG(logINFO, ("Setting period %lld ns [Continuous mode]\n", (long long int)val));
|
||||||
|
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
set64BitReg(val, SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG);
|
||||||
|
|
||||||
|
// validate for tolerance
|
||||||
|
int64_t retval = getPeriodCont();
|
||||||
|
val /= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
if (val != retval) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getPeriodCont() {
|
||||||
|
return get64BitReg(SET_PERIOD_LSB_REG, SET_PERIOD_MSB_REG)/ (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
}
|
||||||
|
|
||||||
|
int setDelayAfterTrigger(int64_t val) {
|
||||||
|
if (val < 0) {
|
||||||
|
FILE_LOG(logERROR, ("Invalid delay after trigger: %lld ns\n", (long long int)val));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFO, ("Setting delay after trigger %lld ns\n", (long long int)val));
|
||||||
|
val *= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
set64BitReg(val, SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG);
|
||||||
|
|
||||||
|
// validate for tolerance
|
||||||
|
int64_t retval = getDelayAfterTrigger();
|
||||||
|
val /= (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
if (val != retval) {
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getDelayAfterTrigger() {
|
||||||
|
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getNumFramesLeft() {
|
int64_t getNumFramesLeft() {
|
||||||
@ -746,6 +887,88 @@ int64_t getNumTriggersLeft() {
|
|||||||
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
return get64BitReg(GET_CYCLES_LSB_REG, GET_CYCLES_MSB_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t getDelayAfterTriggerLeft() {
|
||||||
|
return get64BitReg(GET_DELAY_LSB_REG, GET_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getPeriodLeft() {
|
||||||
|
return get64BitReg(GET_PERIOD_LSB_REG, GET_PERIOD_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getFramesFromStart() {
|
||||||
|
return get64BitReg(FRAMES_FROM_START_LSB_REG, FRAMES_FROM_START_MSB_REG);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getActualTime() {
|
||||||
|
return get64BitReg(TIME_FROM_START_LSB_REG, TIME_FROM_START_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
int64_t getMeasurementTime() {
|
||||||
|
return get64BitReg(START_FRAME_TIME_LSB_REG, START_FRAME_TIME_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* parameters - module, settings */
|
||||||
|
enum detectorSettings setSettings(enum detectorSettings sett){
|
||||||
|
if(sett == UNINITIALIZED)
|
||||||
|
return thisSettings;
|
||||||
|
|
||||||
|
// set settings
|
||||||
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
|
uint32_t mask = ASIC_CONFIG_GAIN_MSK;
|
||||||
|
if(sett != GET_SETTINGS) {
|
||||||
|
switch (sett) {
|
||||||
|
case DYNAMICGAIN:
|
||||||
|
bus_w(addr, bus_r(addr) & ~mask);
|
||||||
|
bus_w(addr, bus_r(addr) | ASIC_CONFIG_DYNAMIC_GAIN_VAL);
|
||||||
|
FILE_LOG(logINFO, ("Set settings - Dyanmic Gain, val: 0x%x\n", bus_r(addr) & mask));
|
||||||
|
break;
|
||||||
|
case FIXGAIN1:
|
||||||
|
bus_w(addr, bus_r(addr) & ~mask);
|
||||||
|
bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_1_VAL);
|
||||||
|
FILE_LOG(logINFO, ("Set settings - Fix Gain 1, val: 0x%x\n", bus_r(addr) & mask));
|
||||||
|
break;
|
||||||
|
case FIXGAIN2:
|
||||||
|
bus_w(addr, bus_r(addr) & ~mask);
|
||||||
|
bus_w(addr, bus_r(addr) | ASIC_CONFIG_FIX_GAIN_2_VAL);
|
||||||
|
FILE_LOG(logINFO, ("Set settings - Fix Gain 2, val: 0x%x\n", bus_r(addr) & mask));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR, ("This settings is not defined for this detector %d\n", (int)sett));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
thisSettings = sett;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
enum detectorSettings getSettings(){
|
||||||
|
uint32_t regval = bus_r(ASIC_CONFIG_REG);
|
||||||
|
uint32_t val = regval & ASIC_CONFIG_GAIN_MSK;
|
||||||
|
FILE_LOG(logDEBUG1, ("Getting Settings\n Reading val :0x%x\n", val));
|
||||||
|
|
||||||
|
switch(val) {
|
||||||
|
case ASIC_CONFIG_RESERVED_VAL:
|
||||||
|
case ASIC_CONFIG_DYNAMIC_GAIN_VAL:
|
||||||
|
thisSettings = DYNAMICGAIN;
|
||||||
|
FILE_LOG(logDEBUG1, ("Settings read: Dynamic Gain. val: 0x%x\n", val));
|
||||||
|
break;
|
||||||
|
case ASIC_CONFIG_FIX_GAIN_1_VAL:
|
||||||
|
thisSettings = FIXGAIN1;
|
||||||
|
FILE_LOG(logDEBUG1, ("Settings read: Fix Gain 1. val: 0x%x\n", val));
|
||||||
|
break;
|
||||||
|
case ASIC_CONFIG_FIX_GAIN_2_VAL:
|
||||||
|
thisSettings = FIXGAIN2;
|
||||||
|
FILE_LOG(logDEBUG1, ("Settings read: Fix Gain 2. val: 0x%x\n", val));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
thisSettings = UNDEFINED;
|
||||||
|
FILE_LOG(logERROR, ("Settings read: Undefined. val: 0x%x\n", val));
|
||||||
|
}
|
||||||
|
return thisSettings;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* parameters - dac, hv */
|
/* parameters - dac, hv */
|
||||||
@ -866,6 +1089,31 @@ int setHighVoltage(int val){
|
|||||||
return highvoltage;
|
return highvoltage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* parameters - timing */
|
||||||
|
void setTiming( enum timingMode arg){
|
||||||
|
if(arg != GET_TIMING_MODE){
|
||||||
|
switch(arg){
|
||||||
|
case AUTO_TIMING:
|
||||||
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||||
|
break;
|
||||||
|
case TRIGGER_EXPOSURE:
|
||||||
|
FILE_LOG(logINFO, ("Set Timing: Trigger\n"));
|
||||||
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) | EXT_SIGNAL_MSK);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum timingMode getTiming() {
|
||||||
|
if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
|
||||||
|
return TRIGGER_EXPOSURE;
|
||||||
|
return AUTO_TIMING;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int configureMAC() {
|
int configureMAC() {
|
||||||
|
|
||||||
@ -951,9 +1199,9 @@ int configureMAC() {
|
|||||||
calcChecksum(udp);
|
calcChecksum(udp);
|
||||||
|
|
||||||
//TODO?
|
//TODO?
|
||||||
//cleanFifos();
|
cleanFifos();
|
||||||
//resetCore();
|
resetCore();
|
||||||
|
//alignDeserializer();
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -989,8 +1237,86 @@ void calcChecksum(udp_header* udp) {
|
|||||||
udp->ip_checksum = checksum;
|
udp->ip_checksum = checksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int setDetectorPosition(int pos[]) {
|
||||||
|
memcpy(detPos, pos, sizeof(detPos));
|
||||||
|
|
||||||
|
uint32_t addr = COORD_0_REG;
|
||||||
|
int value = 0;
|
||||||
|
int valueRead = 0;
|
||||||
|
int ret = OK;
|
||||||
|
|
||||||
|
// row
|
||||||
|
value = detPos[X];
|
||||||
|
bus_w(addr, (bus_r(addr) &~COORD_ROW_MSK) | ((value << COORD_ROW_OFST) & COORD_ROW_MSK));
|
||||||
|
valueRead = ((bus_r(addr) & COORD_ROW_MSK) >> COORD_ROW_OFST);
|
||||||
|
if (valueRead != value) {
|
||||||
|
FILE_LOG(logERROR, ("Could not set row. Set %d, read %d\n", value, valueRead));
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// col
|
||||||
|
value = detPos[Y];
|
||||||
|
bus_w(addr, (bus_r(addr) &~COORD_COL_MSK) | ((value << COORD_COL_OFST) & COORD_COL_MSK));
|
||||||
|
valueRead = ((bus_r(addr) & COORD_COL_MSK) >> COORD_COL_OFST);
|
||||||
|
if (valueRead != value) {
|
||||||
|
FILE_LOG(logERROR, ("Could not set column. Set %d, read %d\n", value, valueRead));
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ret == OK) {
|
||||||
|
FILE_LOG(logINFO, ("\tPosition set to [%d, %d]\n", detPos[X], detPos[Y]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int* getDetectorPosition() {
|
||||||
|
return detPos;
|
||||||
|
}
|
||||||
|
|
||||||
// Detector Specific
|
// Detector Specific
|
||||||
|
|
||||||
|
int checkDetectorType() {
|
||||||
|
FILE_LOG(logINFO, ("Checking type of module\n"));
|
||||||
|
FILE* fd = fopen(TYPE_FILE_NAME, "r");
|
||||||
|
if (fd == NULL) {
|
||||||
|
FILE_LOG(logERROR, ("Could not open file %s to get type of the module attached\n", TYPE_FILE_NAME));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
char buffer[MAX_STR_LENGTH];
|
||||||
|
memset(buffer, 0, sizeof(buffer));
|
||||||
|
fread (buffer, MAX_STR_LENGTH, sizeof(char), fd);
|
||||||
|
if (strlen(buffer) == 0) {
|
||||||
|
FILE_LOG(logERROR, ("Could not read file %s to get type of the module attached\n", TYPE_FILE_NAME));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
int type = atoi(buffer);
|
||||||
|
if (type > TYPE_NO_MODULE_STARTING_VAL) {
|
||||||
|
FILE_LOG(logERROR, ("No Module attached! Expected %d for Gotthard2, got %d\n", TYPE_GOTTHARD2_MODULE_VAL, type));
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (abs(type - TYPE_GOTTHARD2_MODULE_VAL) > TYPE_TOLERANCE) {
|
||||||
|
FILE_LOG(logERROR, ("Wrong Module attached! Expected %d for Gotthard2, got %d\n", TYPE_GOTTHARD2_MODULE_VAL, type));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int powerChip (int on){
|
||||||
|
if(on != -1){
|
||||||
|
if(on){
|
||||||
|
FILE_LOG(logINFO, ("Powering chip: on\n"));
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_PWR_CHIP_MSK);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
FILE_LOG(logINFO, ("Powering chip: off\n"));
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) & ~CONTROL_PWR_CHIP_MSK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ((bus_r(CONTROL_REG) & CONTROL_PWR_CHIP_MSK) >> CONTROL_PWR_CHIP_OFST);
|
||||||
|
}
|
||||||
|
|
||||||
int setPhase(enum CLKINDEX ind, int val, int degrees) {
|
int setPhase(enum CLKINDEX ind, int val, int degrees) {
|
||||||
if (ind < 0 || ind >= NUM_CLOCKS) {
|
if (ind < 0 || ind >= NUM_CLOCKS) {
|
||||||
FILE_LOG(logERROR, ("Unknown clock index %d to set phase\n", ind));
|
FILE_LOG(logERROR, ("Unknown clock index %d to set phase\n", ind));
|
||||||
@ -1030,8 +1356,8 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) {
|
|||||||
relativePhase *= -1;
|
relativePhase *= -1;
|
||||||
direction = 0;
|
direction = 0;
|
||||||
}
|
}
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||||
ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, relativePhase, direction);
|
ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, relativePhase, direction);
|
||||||
|
|
||||||
clkPhase[ind] = valShift;
|
clkPhase[ind] = valShift;
|
||||||
@ -1103,7 +1429,7 @@ int getVCOFrequency(enum CLKINDEX ind) {
|
|||||||
FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind));
|
FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
return ALTERA_PLL_C10_GetVCOFrequency(pllIndex);
|
return ALTERA_PLL_C10_GetVCOFrequency(pllIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1121,7 +1447,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
}
|
}
|
||||||
char* clock_names[] = {CLK_NAMES};
|
char* clock_names[] = {CLK_NAMES};
|
||||||
int vcofreq = getVCOFrequency(ind);
|
int vcofreq = getVCOFrequency(ind);
|
||||||
int currentdiv = vcofreq / clkFrequency[ind];
|
int currentdiv = vcofreq / (int)clkFrequency[ind];
|
||||||
int newfreq = vcofreq / val;
|
int newfreq = vcofreq / val;
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq));
|
FILE_LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq));
|
||||||
@ -1137,8 +1463,8 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate and set output frequency
|
// Calculate and set output frequency
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||||
ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq);
|
ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq);
|
||||||
clkFrequency[ind] = newfreq;
|
clkFrequency[ind] = newfreq;
|
||||||
FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind]));
|
FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind]));
|
||||||
@ -1173,7 +1499,7 @@ int getClockDivider(enum CLKINDEX ind) {
|
|||||||
FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind));
|
FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (getVCOFrequency(ind) / clkFrequency[ind]);
|
return (getVCOFrequency(ind) / (int)clkFrequency[ind]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int setInjectChannel(int offset, int increment) {
|
int setInjectChannel(int offset, int increment) {
|
||||||
@ -1244,11 +1570,11 @@ int setVetoPhoton(int chipIndex, int gainIndex, int* values) {
|
|||||||
FILE_LOG(logERROR, ("Unknown gain index %d\n", gainIndex));
|
FILE_LOG(logERROR, ("Unknown gain index %d\n", gainIndex));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG1, ("Adding gain bits\n"));
|
FILE_LOG(logDEBUG2, ("Adding gain bits\n"));
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (i = 0; i < NCHAN; ++i) {
|
for (i = 0; i < NCHAN; ++i) {
|
||||||
values[i] |= gainValue;
|
values[i] |= gainValue;
|
||||||
FILE_LOG(logDEBUG1, ("Value %d: 0x%x\n", i, values[i]));
|
FILE_LOG(logDEBUG2, ("Value %d: 0x%x\n", i, values[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,6 +1752,10 @@ int configureADC() {
|
|||||||
|
|
||||||
int setBurstMode(int burst) {
|
int setBurstMode(int burst) {
|
||||||
FILE_LOG(logINFO, ("Setting %s Mode\n", burst == 1 ? "Burst" : "Continuous"));
|
FILE_LOG(logINFO, ("Setting %s Mode\n", burst == 1 ? "Burst" : "Continuous"));
|
||||||
|
burstMode = burst;
|
||||||
|
setBurstType(burstType);
|
||||||
|
|
||||||
|
FILE_LOG(logINFO, ("\tSetting %s Mode in Chip\n", burst == 1 ? "Burst" : "Continuous"));
|
||||||
int value = burst ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE;
|
int value = burst ? ASIC_GLOBAL_BURST_VALUE : ASIC_GLOBAL_CONT_VALUE;
|
||||||
|
|
||||||
const int padding = 6; // due to address (4) to make it byte aligned
|
const int padding = 6; // due to address (4) to make it byte aligned
|
||||||
@ -1464,28 +1794,123 @@ int setBurstMode(int burst) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
burstMode = burst;
|
|
||||||
return configureADC();
|
return configureADC();
|
||||||
}
|
}
|
||||||
|
|
||||||
int getBurstMode() {
|
int getBurstMode() {
|
||||||
return burstMode;
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
|
int runmode = bus_r (addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
||||||
|
switch (runmode) {
|
||||||
|
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
||||||
|
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
||||||
|
return 1;
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setBurstType(enum burstModeType val) {
|
||||||
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
|
uint32_t runmode = ASIC_CONFIG_RUN_MODE_CONT_VAL;
|
||||||
|
if (burstMode) {
|
||||||
|
switch (val) {
|
||||||
|
case INTERNAL:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_INT_BURST_VAL;
|
||||||
|
break;
|
||||||
|
case EXTERNAL:
|
||||||
|
runmode = ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR, ("Unknown burst type %d\n", val));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FILE_LOG(logDEBUG1, ("Run mode: %d\n", runmode));
|
||||||
|
bus_w(addr, bus_r(addr) &~ ASIC_CONFIG_RUN_MODE_MSK);
|
||||||
|
bus_w(addr, bus_r(addr) | ((runmode << ASIC_CONFIG_RUN_MODE_OFST) & ASIC_CONFIG_RUN_MODE_MSK));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
enum burstModeType getBurstType() {
|
||||||
|
uint32_t addr = ASIC_CONFIG_REG;
|
||||||
|
int runmode = bus_r (addr) & ASIC_CONFIG_RUN_MODE_MSK;
|
||||||
|
switch (runmode) {
|
||||||
|
case ASIC_CONFIG_RUN_MODE_INT_BURST_VAL:
|
||||||
|
return INTERNAL;
|
||||||
|
case ASIC_CONFIG_RUN_MODE_EXT_BURST_VAL:
|
||||||
|
return EXTERNAL;
|
||||||
|
default:
|
||||||
|
FILE_LOG(logERROR, ("Unknown burst type read from FPGA: %d\n", runmode));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* aquisition */
|
/* aquisition */
|
||||||
|
|
||||||
int setDetectorPosition(int pos[]) {
|
int updateAcquisitionRegisters(char* mess) {
|
||||||
memcpy(detPos, pos, sizeof(detPos));
|
// burst mode
|
||||||
|
if (burstMode) {
|
||||||
|
// validate #frames in burst mode
|
||||||
|
if (nframes > MAX_FRAMES_IN_BURST_MODE) {
|
||||||
|
sprintf(mess, "Could not start acquisition because number of frames %lld must be <= %d in burst mode.\n", (long long unsigned int)nframes, MAX_FRAMES_IN_BURST_MODE);
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
setNumFramesBurst(nframes);
|
||||||
|
// exptime
|
||||||
|
if (setExptimeBurst(exptime_ns) == FAIL) {
|
||||||
|
sprintf(mess, "Could not start acquisition because exptime could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)exptime_ns, getExptimeBoth());
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
// period
|
||||||
|
if (setPeriodBurst(period_ns) == FAIL) {
|
||||||
|
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodBurst());
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set continuous values to default (exptime same register)
|
||||||
|
FILE_LOG(logINFO, ("Setting continuous mode registers to defaults\n"));
|
||||||
|
// frames
|
||||||
|
setNumFramesCont(1);
|
||||||
|
// period
|
||||||
|
if (setPeriodCont(0) == FAIL) {
|
||||||
|
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set 0 ns, got %lld ns.\n", getPeriodCont());
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// continuous
|
||||||
|
else {
|
||||||
|
// frames
|
||||||
|
setNumFramesCont(nframes);
|
||||||
|
// exptime
|
||||||
|
if (setExptimeCont(exptime_ns) == FAIL) {
|
||||||
|
sprintf(mess, "Could not start acquisition because exptime could not be set in continuous mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)exptime_ns, getExptimeBoth());
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
// period
|
||||||
|
if (setPeriodCont(period_ns) == FAIL) {
|
||||||
|
sprintf(mess, "Could not start acquisition because period could not be set in continuous mode. Set %lld ns, got %lld ns.\n", (long long unsigned int)period_ns, getPeriodCont());
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set burst values to default (exptime same register)
|
||||||
|
FILE_LOG(logINFO, ("Setting burst mode registers to defaults\n"));
|
||||||
|
setNumFramesBurst(1);
|
||||||
|
// period
|
||||||
|
if (setPeriodBurst(0) == FAIL) {
|
||||||
|
sprintf(mess, "Could not start acquisition because period could not be set in burst mode. Set 0 ns, got %lld ns.\n", getPeriodBurst());
|
||||||
|
FILE_LOG(logERROR,(mess));
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int* getDetectorPosition() {
|
|
||||||
return detPos;
|
|
||||||
}
|
|
||||||
|
|
||||||
int startStateMachine(){
|
int startStateMachine(){
|
||||||
if (burstMode && getNumFrames() > MAX_FRAMES_IN_BURST_MODE) {
|
|
||||||
return FAIL;
|
|
||||||
}
|
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
// create udp socket
|
// create udp socket
|
||||||
if(createUDPSocket(0) != OK) {
|
if(createUDPSocket(0) != OK) {
|
||||||
@ -1503,6 +1928,13 @@ int startStateMachine(){
|
|||||||
FILE_LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
|
FILE_LOG(logINFOGREEN, ("Virtual Acquisition started\n"));
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
|
FILE_LOG(logINFOBLUE, ("Starting State Machine\n"));
|
||||||
|
cleanFifos();
|
||||||
|
|
||||||
|
//start state machine
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STRT_ACQSTN_MSK);
|
||||||
|
|
||||||
|
FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG)));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1513,6 +1945,8 @@ void* start_timer(void* arg) {
|
|||||||
int numFrames = (getNumFrames() *
|
int numFrames = (getNumFrames() *
|
||||||
getNumTriggers() );
|
getNumTriggers() );
|
||||||
int64_t exp_ns = getExpTime();
|
int64_t exp_ns = getExpTime();
|
||||||
|
int datasize = 2560;
|
||||||
|
int packetsize = datasize + sizeof(sls_detector_header);
|
||||||
|
|
||||||
|
|
||||||
int frameNr = 0;
|
int frameNr = 0;
|
||||||
@ -1530,6 +1964,22 @@ void* start_timer(void* arg) {
|
|||||||
usleep(exp_ns / 1000);
|
usleep(exp_ns / 1000);
|
||||||
clock_gettime(CLOCK_REALTIME, &end);
|
clock_gettime(CLOCK_REALTIME, &end);
|
||||||
|
|
||||||
|
char packetData[packetsize];
|
||||||
|
memset(packetData, 0, packetsize);
|
||||||
|
// set header
|
||||||
|
sls_detector_header* header = (sls_detector_header*)(packetData);
|
||||||
|
header->frameNumber = frameNr;
|
||||||
|
header->packetNumber = 0;
|
||||||
|
header->modId = 0;
|
||||||
|
header->row = detPos[X];
|
||||||
|
header->column = detPos[Y];
|
||||||
|
header->detType = (uint16_t)myDetectorType;
|
||||||
|
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||||
|
|
||||||
|
// send 1 packet = 1 frame
|
||||||
|
sendUDPPacket(0, packetData, packetsize);
|
||||||
|
FILE_LOG(logINFO, ("Sent frame: %d\n", frameNr));
|
||||||
|
|
||||||
// calculate time left in period
|
// calculate time left in period
|
||||||
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
int64_t time_ns = ((end.tv_sec - begin.tv_sec) * 1E9 +
|
||||||
(end.tv_nsec - begin.tv_nsec));
|
(end.tv_nsec - begin.tv_nsec));
|
||||||
@ -1544,6 +1994,7 @@ void* start_timer(void* arg) {
|
|||||||
// set register frames left
|
// set register frames left
|
||||||
}
|
}
|
||||||
|
|
||||||
|
closeUDPSocket(0);
|
||||||
// set status to idle
|
// set status to idle
|
||||||
virtual_status = 0;
|
virtual_status = 0;
|
||||||
FILE_LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
FILE_LOG(logINFOBLUE, ("Finished Acquiring\n"));
|
||||||
@ -1558,6 +2009,9 @@ int stopStateMachine(){
|
|||||||
virtual_stop = 0;
|
virtual_stop = 0;
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
|
//stop state machine
|
||||||
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK);
|
||||||
|
FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1571,10 +2025,50 @@ enum runStatus getRunStatus(){
|
|||||||
return RUNNING;
|
return RUNNING;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return IDLE;
|
FILE_LOG(logDEBUG1, ("Getting status\n"));
|
||||||
|
uint32_t retval = bus_r(FLOW_STATUS_REG);
|
||||||
|
FILE_LOG(logINFO, ("Status Register: %08x\n",retval));
|
||||||
|
|
||||||
|
enum runStatus s;
|
||||||
|
|
||||||
|
//running
|
||||||
|
if (retval & FLOW_STATUS_RUN_BUSY_MSK) {
|
||||||
|
if (retval & FLOW_STATUS_WAIT_FOR_TRGGR_MSK) {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Status: WAITING\n"));
|
||||||
|
s = WAITING;
|
||||||
|
} else {
|
||||||
|
if (retval & FLOW_STATUS_DLY_BFRE_TRGGR_MSK) {
|
||||||
|
FILE_LOG(logINFO, ("Status: Delay before Trigger\n"));
|
||||||
|
} else if (retval & FLOW_STATUS_DLY_AFTR_TRGGR_MSK) {
|
||||||
|
FILE_LOG(logINFO, ("Status: Delay after Trigger\n"));
|
||||||
|
}
|
||||||
|
FILE_LOG(logINFOBLUE, ("Status: RUNNING\n"));
|
||||||
|
s = RUNNING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//not running
|
||||||
|
else {
|
||||||
|
// stopped or error
|
||||||
|
if (retval & FLOW_STATUS_FIFO_FULL_MSK) {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Status: STOPPED\n")); //FIFO FULL??
|
||||||
|
s = STOPPED;
|
||||||
|
} else if (retval & FLOW_STATUS_CSM_BUSY_MSK) {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Status: READ MACHINE BUSY\n"));
|
||||||
|
s = TRANSMITTING;
|
||||||
|
} else if (!retval) {
|
||||||
|
FILE_LOG(logINFOBLUE, ("Status: IDLE\n"));
|
||||||
|
s = IDLE;
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logERROR, ("Status: Unknown status %08x\n", retval));
|
||||||
|
s = ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void readFrame(int *ret, char *mess){
|
void readFrame(int *ret, char *mess) {
|
||||||
// wait for status to be done
|
// wait for status to be done
|
||||||
while(runBusy()){
|
while(runBusy()){
|
||||||
usleep(500);
|
usleep(500);
|
||||||
@ -1583,29 +2077,36 @@ void readFrame(int *ret, char *mess){
|
|||||||
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
FILE_LOG(logINFOGREEN, ("acquisition successfully finished\n"));
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
*ret = (int)OK;
|
||||||
|
// frames left to give status
|
||||||
|
int64_t retval = getNumFramesLeft() + 1;
|
||||||
|
|
||||||
|
if ( retval > 0) {
|
||||||
|
FILE_LOG(logERROR, ("No data and run stopped: %lld frames left\n",(long long int)retval));
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t runBusy() {
|
u_int32_t runBusy() {
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return virtual_status;
|
return virtual_status;
|
||||||
#endif
|
#endif
|
||||||
#ifdef VIRTUAL
|
u_int32_t s = (bus_r(FLOW_STATUS_REG) & FLOW_STATUS_RUN_BUSY_MSK);
|
||||||
u_int32_t s = (bus_r(STATUS_REG) & RUN_BUSY_MSK);
|
//FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
||||||
FILE_LOG(logDEBUG1, ("Status Register: %08x\n", s));
|
|
||||||
return s;
|
return s;
|
||||||
#endif
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
|
||||||
int calculateDataBytes(){
|
int calculateDataBytes() {
|
||||||
return getTotalNumberOfChannels() * DYNAMIC_RANGE;
|
return getTotalNumberOfChannels() * DYNAMIC_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips() {return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs() {return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip() {return NCHAN;}
|
@ -17,22 +17,30 @@
|
|||||||
#define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac")
|
#define HV_DRIVER_FILE_NAME ("/etc/devlinks/hvdac")
|
||||||
#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
|
#define DAC_DRIVER_FILE_NAME ("/etc/devlinks/dac")
|
||||||
#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
|
#define ONCHIP_DAC_DRIVER_FILE_NAME ("/etc/devlinks/chipdac")
|
||||||
|
#define TYPE_FILE_NAME ("/etc/devlinks/type")
|
||||||
#define CONFIG_FILE ("config.txt")
|
#define CONFIG_FILE ("config.txt")
|
||||||
#define DAC_MAX_MV (2048)
|
#define DAC_MAX_MV (2048)
|
||||||
#define ONCHIP_DAC_MAX_VAL (0x3FF)
|
#define ONCHIP_DAC_MAX_VAL (0x3FF)
|
||||||
#define ADU_MAX_VAL (0xFFF)
|
#define ADU_MAX_VAL (0xFFF)
|
||||||
#define ADU_MAX_BITS (12)
|
#define ADU_MAX_BITS (12)
|
||||||
#define MAX_FRAMES_IN_BURST_MODE (2720)
|
#define MAX_FRAMES_IN_BURST_MODE (2720)
|
||||||
|
#define TYPE_GOTTHARD2_MODULE_VAL (512)
|
||||||
|
#define TYPE_TOLERANCE (10)
|
||||||
|
#define TYPE_NO_MODULE_STARTING_VAL (800)
|
||||||
|
|
||||||
/** Default Parameters */
|
/** Default Parameters */
|
||||||
|
#define DEFAULT_BURST_MODE (1)
|
||||||
|
#define DEFAULT_BURST_TYPE (INTERNAL)
|
||||||
#define DEFAULT_NUM_FRAMES (1)
|
#define DEFAULT_NUM_FRAMES (1)
|
||||||
#define DEFAULT_NUM_CYCLES (1)
|
#define DEFAULT_NUM_CYCLES (1)
|
||||||
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms
|
#define DEFAULT_EXPTIME (1 * 1000 * 1000) // 1 ms
|
||||||
#define DEFAULT_PERIOD (1 * 1000 * 1000 * 1000) // 1 s
|
#define DEFAULT_PERIOD (1 * 1000 * 1000 * 1000) // 1 s
|
||||||
|
#define DEFAULT_DELAY_AFTER_TRIGGER (0)
|
||||||
#define DEFAULT_HIGH_VOLTAGE (0)
|
#define DEFAULT_HIGH_VOLTAGE (0)
|
||||||
|
#define DEFAULT_TIMING_MODE (AUTO_TIMING)
|
||||||
|
#define DEFAULT_SETTINGS (DYNAMICGAIN)
|
||||||
#define DEFAULT_READOUT_C0 (144444448) // rdo_clk, 144 MHz
|
#define DEFAULT_READOUT_C0 (144444448) // rdo_clk, 144 MHz
|
||||||
#define DEFAULT_READOUT_C1 (288888896) // rdo_x2_clk, 288 MHz
|
#define DEFAULT_READOUT_C1 (144444448) // rdo_x2_clk, 144 MHz
|
||||||
#define DEFAULT_SYSTEM_C0 (144444448) // run_clk, 144 MHz
|
#define DEFAULT_SYSTEM_C0 (144444448) // run_clk, 144 MHz
|
||||||
#define DEFAULT_SYSTEM_C1 (72222224) // chip_clk, 72 MHz
|
#define DEFAULT_SYSTEM_C1 (72222224) // chip_clk, 72 MHz
|
||||||
#define DEFAULT_SYSTEM_C2 (18055556) // sync_clk, 18 MHz
|
#define DEFAULT_SYSTEM_C2 (18055556) // sync_clk, 18 MHz
|
||||||
@ -40,6 +48,7 @@
|
|||||||
|
|
||||||
/* Firmware Definitions */
|
/* Firmware Definitions */
|
||||||
#define IP_HEADER_SIZE (20)
|
#define IP_HEADER_SIZE (20)
|
||||||
|
#define FIXED_PLL_FREQUENCY (020000000) // 20MHz
|
||||||
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // Hz
|
#define READOUT_PLL_VCO_FREQ_HZ (866666688) // Hz
|
||||||
#define SYSTEM_PLL_VCO_FREQ_HZ (722222240) // Hz
|
#define SYSTEM_PLL_VCO_FREQ_HZ (722222240) // Hz
|
||||||
|
|
||||||
|
Binary file not shown.
@ -30,10 +30,10 @@ int virtual_status = 0;
|
|||||||
int virtual_stop = 0;
|
int virtual_stop = 0;
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
#endif
|
#endif
|
||||||
int detPos[2] = {0, 0};
|
int detPos[2] = {};
|
||||||
|
|
||||||
int detectorFirstServer = 1;
|
int detectorFirstServer = 1;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {};
|
||||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
enum externalSignalFlag signalMode = 0;
|
enum externalSignalFlag signalMode = 0;
|
||||||
|
|
||||||
@ -128,7 +128,7 @@ int checkType() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t type = ((bus_r(BOARD_REVISION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
u_int32_t type = ((bus_r(BOARD_REVISION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
||||||
if (type == DETECTOR_TYPE_MOENCH_VAL){
|
if (type == DETECTOR_TYPE_MOENCH_VAL){
|
||||||
FILE_LOG(logERROR, ("This is not a Gotthard Server (read %d, expected ?)\n", type));
|
FILE_LOG(logERROR, ("This is not a Gotthard Server (read %d, expected ?)\n", type));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -1180,7 +1180,7 @@ void setTiming( enum timingMode arg){
|
|||||||
u_int32_t addr = EXT_SIGNAL_REG;
|
u_int32_t addr = EXT_SIGNAL_REG;
|
||||||
|
|
||||||
if (arg != GET_TIMING_MODE){
|
if (arg != GET_TIMING_MODE){
|
||||||
switch((int)arg){
|
switch(arg){
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
bus_w(addr, EXT_SIGNAL_OFF_VAL);
|
bus_w(addr, EXT_SIGNAL_OFF_VAL);
|
||||||
@ -1680,7 +1680,7 @@ int calculateDataBytes(){
|
|||||||
return DATA_BYTES;
|
return DATA_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips(){return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs(){return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||||
|
Binary file not shown.
@ -24,6 +24,7 @@
|
|||||||
// Global variable from slsDetectorServer_funcs
|
// Global variable from slsDetectorServer_funcs
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
extern udpStruct udpDetails;
|
extern udpStruct udpDetails;
|
||||||
|
extern const enum detectorType myDetectorType;
|
||||||
|
|
||||||
int initError = OK;
|
int initError = OK;
|
||||||
int initCheckDone = 0;
|
int initCheckDone = 0;
|
||||||
@ -37,9 +38,9 @@ int virtual_stop = 0;
|
|||||||
|
|
||||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {};
|
||||||
int adcPhase = 0;
|
int adcPhase = 0;
|
||||||
int detPos[4] = {0, 0, 0, 0};
|
int detPos[4] = {};
|
||||||
int numUDPInterfaces = 1;
|
int numUDPInterfaces = 1;
|
||||||
|
|
||||||
|
|
||||||
@ -170,7 +171,7 @@ int checkType() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
||||||
if (type != JUNGFRAU){
|
if (type != JUNGFRAU){
|
||||||
FILE_LOG(logERROR, ("This is not a Jungfrau Server (read %d, expected %d)\n", type, JUNGFRAU));
|
FILE_LOG(logERROR, ("This is not a Jungfrau Server (read %d, expected %d)\n", type, JUNGFRAU));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -920,7 +921,7 @@ int setHighVoltage(int val){
|
|||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
|
|
||||||
if(arg != GET_TIMING_MODE){
|
if(arg != GET_TIMING_MODE){
|
||||||
switch((int)arg){
|
switch(arg){
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||||
@ -1667,7 +1668,7 @@ void* start_timer(void* arg) {
|
|||||||
|
|
||||||
usleep(exp_us);
|
usleep(exp_us);
|
||||||
|
|
||||||
const int size = datasize + 112;
|
const int size = datasize + sizeof(sls_detector_header);
|
||||||
char packetData[size];
|
char packetData[size];
|
||||||
memset(packetData, 0, sizeof(sls_detector_header));
|
memset(packetData, 0, sizeof(sls_detector_header));
|
||||||
|
|
||||||
@ -1679,6 +1680,11 @@ void* start_timer(void* arg) {
|
|||||||
sls_detector_header* header = (sls_detector_header*)(packetData);
|
sls_detector_header* header = (sls_detector_header*)(packetData);
|
||||||
header->frameNumber = frameNr;
|
header->frameNumber = frameNr;
|
||||||
header->packetNumber = i;
|
header->packetNumber = i;
|
||||||
|
header->modId = 0;
|
||||||
|
header->row = detPos[X];
|
||||||
|
header->column = detPos[Y];
|
||||||
|
header->detType = (uint16_t)myDetectorType;
|
||||||
|
header->version = SLS_DETECTOR_HEADER_VERSION - 1;
|
||||||
// fill data
|
// fill data
|
||||||
memcpy(packetData + sizeof(sls_detector_header), imageData + srcOffset, datasize);
|
memcpy(packetData + sizeof(sls_detector_header), imageData + srcOffset, datasize);
|
||||||
srcOffset += datasize;
|
srcOffset += datasize;
|
||||||
@ -1826,7 +1832,7 @@ int calculateDataBytes(){
|
|||||||
return DATA_BYTES;
|
return DATA_BYTES;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips(){return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs(){return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip(){return NCHAN;}
|
||||||
|
@ -4,10 +4,13 @@
|
|||||||
#define REG_OFFSET (4)
|
#define REG_OFFSET (4)
|
||||||
|
|
||||||
/* Base addresses 0x1804 0000 ---------------------------------------------*/
|
/* Base addresses 0x1804 0000 ---------------------------------------------*/
|
||||||
|
|
||||||
/* Reconfiguration core for readout pll */
|
/* Reconfiguration core for readout pll */
|
||||||
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
|
#define BASE_READOUT_PLL (0x0000) // 0x1804_0000 - 0x1804_07FF
|
||||||
|
|
||||||
/* Reconfiguration core for system pll */
|
/* Reconfiguration core for system pll */
|
||||||
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
|
#define BASE_SYSTEM_PLL (0x0800) // 0x1804_0800 - 0x1804_0FFF
|
||||||
|
|
||||||
/* Clock Generation */
|
/* Clock Generation */
|
||||||
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
|
#define BASE_CLK_GENERATION (0x1000) // 0x1804_1000 - 0x1804_XXXX //TODO
|
||||||
|
|
||||||
@ -160,15 +163,15 @@
|
|||||||
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
#define PAT_STATUS_REG (0x00 * REG_OFFSET + BASE_PATTERN_CONTROL)
|
||||||
#define PAT_STATUS_RUN_BUSY_OFST (0)
|
#define PAT_STATUS_RUN_BUSY_OFST (0)
|
||||||
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
|
#define PAT_STATUS_RUN_BUSY_MSK (0x00000001 << PAT_STATUS_RUN_BUSY_OFST)
|
||||||
#define PAT_STATUS_WAIT_FOR_TRGGR_OFST (0)
|
#define PAT_STATUS_WAIT_FOR_TRGGR_OFST (3)
|
||||||
#define PAT_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << PAT_STATUS_WAIT_FOR_TRGGR_OFST)
|
#define PAT_STATUS_WAIT_FOR_TRGGR_MSK (0x00000001 << PAT_STATUS_WAIT_FOR_TRGGR_OFST)
|
||||||
#define PAT_STATUS_DLY_BFRE_TRGGR_OFST (0)
|
#define PAT_STATUS_DLY_BFRE_TRGGR_OFST (4)
|
||||||
#define PAT_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_BFRE_TRGGR_OFST)
|
#define PAT_STATUS_DLY_BFRE_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_BFRE_TRGGR_OFST)
|
||||||
#define PAT_STATUS_FIFO_FULL_OFST (0)
|
#define PAT_STATUS_FIFO_FULL_OFST (5)
|
||||||
#define PAT_STATUS_FIFO_FULL_MSK (0x00000001 << PAT_STATUS_FIFO_FULL_OFST)
|
#define PAT_STATUS_FIFO_FULL_MSK (0x00000001 << PAT_STATUS_FIFO_FULL_OFST)
|
||||||
#define PAT_STATUS_DLY_AFTR_TRGGR_OFST (0)
|
#define PAT_STATUS_DLY_AFTR_TRGGR_OFST (15)
|
||||||
#define PAT_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_AFTR_TRGGR_OFST)
|
#define PAT_STATUS_DLY_AFTR_TRGGR_MSK (0x00000001 << PAT_STATUS_DLY_AFTR_TRGGR_OFST)
|
||||||
#define PAT_STATUS_CSM_BUSY_OFST (0)
|
#define PAT_STATUS_CSM_BUSY_OFST (17)
|
||||||
#define PAT_STATUS_CSM_BUSY_MSK (0x00000001 << PAT_STATUS_CSM_BUSY_OFST)
|
#define PAT_STATUS_CSM_BUSY_MSK (0x00000001 << PAT_STATUS_CSM_BUSY_OFST)
|
||||||
|
|
||||||
/* Delay left 64bit Register */
|
/* Delay left 64bit Register */
|
||||||
|
Binary file not shown.
@ -33,12 +33,12 @@ int virtual_status = 0;
|
|||||||
int virtual_stop = 0;
|
int virtual_stop = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int32_t clkPhase[NUM_CLOCKS] = {0, 0, 0, 0, 0};
|
int32_t clkPhase[NUM_CLOCKS] = {};
|
||||||
uint32_t clkFrequency[NUM_CLOCKS] = {0, 0, 0, 0, 0};
|
uint32_t clkFrequency[NUM_CLOCKS] = {};
|
||||||
|
|
||||||
int highvoltage = 0;
|
int highvoltage = 0;
|
||||||
int dacValues[NDAC] = {0};
|
int dacValues[NDAC] = {0};
|
||||||
int detPos[2] = {0, 0};
|
int detPos[2] = {};
|
||||||
uint32_t countermask = 0; // will be removed later when in firmware converted to mask
|
uint32_t countermask = 0; // will be removed later when in firmware converted to mask
|
||||||
|
|
||||||
int isInitCheckDone() {
|
int isInitCheckDone() {
|
||||||
@ -85,13 +85,10 @@ void basictests() {
|
|||||||
uint64_t macadd = getDetectorMAC();
|
uint64_t macadd = getDetectorMAC();
|
||||||
int64_t fwversion = getFirmwareVersion();
|
int64_t fwversion = getFirmwareVersion();
|
||||||
int64_t swversion = getServerVersion();
|
int64_t swversion = getServerVersion();
|
||||||
int64_t sw_fw_apiversion = 0;
|
int64_t sw_fw_apiversion = getFirmwareAPIVersion();;
|
||||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||||
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
||||||
|
|
||||||
|
|
||||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
|
||||||
sw_fw_apiversion = getFirmwareAPIVersion();
|
|
||||||
FILE_LOG(logINFOBLUE, ("*************************************************\n"
|
FILE_LOG(logINFOBLUE, ("*************************************************\n"
|
||||||
"Hardware Version:\t\t 0x%x\n"
|
"Hardware Version:\t\t 0x%x\n"
|
||||||
|
|
||||||
@ -162,7 +159,7 @@ int checkType() {
|
|||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
return OK;
|
return OK;
|
||||||
#endif
|
#endif
|
||||||
volatile u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
u_int32_t type = ((bus_r(FPGA_VERSION_REG) & DETECTOR_TYPE_MSK) >> DETECTOR_TYPE_OFST);
|
||||||
if (type != MYTHEN3){
|
if (type != MYTHEN3){
|
||||||
FILE_LOG(logERROR, ("This is not a Mythen3 Server (read %d, expected %d)\n", type, MYTHEN3));
|
FILE_LOG(logERROR, ("This is not a Mythen3 Server (read %d, expected %d)\n", type, MYTHEN3));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
@ -610,7 +607,6 @@ int setDelayAfterTrigger(int64_t val) {
|
|||||||
|
|
||||||
int64_t getDelayAfterTrigger() {
|
int64_t getDelayAfterTrigger() {
|
||||||
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
return get64BitReg(SET_TRIGGER_DELAY_LSB_REG, SET_TRIGGER_DELAY_MSB_REG) / (1E-9 * FIXED_PLL_FREQUENCY);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t getNumFramesLeft() {
|
int64_t getNumFramesLeft() {
|
||||||
@ -708,7 +704,7 @@ int setHighVoltage(int val){
|
|||||||
/* parameters - timing */
|
/* parameters - timing */
|
||||||
void setTiming( enum timingMode arg){
|
void setTiming( enum timingMode arg){
|
||||||
if(arg != GET_TIMING_MODE){
|
if(arg != GET_TIMING_MODE){
|
||||||
switch((int)arg){
|
switch (arg) {
|
||||||
case AUTO_TIMING:
|
case AUTO_TIMING:
|
||||||
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
FILE_LOG(logINFO, ("Set Timing: Auto\n"));
|
||||||
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
bus_w(EXT_SIGNAL_REG, bus_r(EXT_SIGNAL_REG) & ~EXT_SIGNAL_MSK);
|
||||||
@ -719,7 +715,6 @@ void setTiming( enum timingMode arg){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
FILE_LOG(logERROR, ("Unknown timing mode %d\n", arg));
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -727,7 +722,7 @@ void setTiming( enum timingMode arg){
|
|||||||
enum timingMode getTiming() {
|
enum timingMode getTiming() {
|
||||||
if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
|
if (bus_r(EXT_SIGNAL_REG) == EXT_SIGNAL_MSK)
|
||||||
return TRIGGER_EXPOSURE;
|
return TRIGGER_EXPOSURE;
|
||||||
return AUTO_TIMING;
|
return AUTO_TIMING;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1143,7 +1138,7 @@ int checkDetectorType() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (abs(type - TYPE_MYTHEN3_MODULE_VAL) > TYPE_TOLERANCE) {
|
if (abs(type - TYPE_MYTHEN3_MODULE_VAL) > TYPE_TOLERANCE) {
|
||||||
FILE_LOG(logERROR, ("Wrong Module attached! Expected %d for Mythen, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type));
|
FILE_LOG(logERROR, ("Wrong Module attached! Expected %d for Mythen3, got %d\n", TYPE_MYTHEN3_MODULE_VAL, type));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@ -1204,8 +1199,8 @@ int setPhase(enum CLKINDEX ind, int val, int degrees) {
|
|||||||
relativePhase *= -1;
|
relativePhase *= -1;
|
||||||
direction = 0;
|
direction = 0;
|
||||||
}
|
}
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||||
ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, relativePhase, direction);
|
ALTERA_PLL_C10_SetPhaseShift(pllIndex, clkIndex, relativePhase, direction);
|
||||||
|
|
||||||
clkPhase[ind] = valShift;
|
clkPhase[ind] = valShift;
|
||||||
@ -1277,7 +1272,7 @@ int getVCOFrequency(enum CLKINDEX ind) {
|
|||||||
FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind));
|
FILE_LOG(logERROR, ("Unknown clock index %d to get vco frequency\n", ind));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
return ALTERA_PLL_C10_GetVCOFrequency(pllIndex);
|
return ALTERA_PLL_C10_GetVCOFrequency(pllIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1295,7 +1290,7 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
}
|
}
|
||||||
char* clock_names[] = {CLK_NAMES};
|
char* clock_names[] = {CLK_NAMES};
|
||||||
int vcofreq = getVCOFrequency(ind);
|
int vcofreq = getVCOFrequency(ind);
|
||||||
int currentdiv = vcofreq / clkFrequency[ind];
|
int currentdiv = vcofreq / (int)clkFrequency[ind];
|
||||||
int newfreq = vcofreq / val;
|
int newfreq = vcofreq / val;
|
||||||
|
|
||||||
FILE_LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq));
|
FILE_LOG(logINFO, ("\tSetting %s clock (%d) divider from %d (%d Hz) to %d (%d Hz). \n\t(Vcofreq: %d Hz)\n", clock_names[ind], ind, currentdiv, clkFrequency[ind], val, newfreq, vcofreq));
|
||||||
@ -1310,8 +1305,8 @@ int setClockDivider(enum CLKINDEX ind, int val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Calculate and set output frequency
|
// Calculate and set output frequency
|
||||||
int pllIndex = ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL;
|
int pllIndex = (int)(ind >= SYSTEM_C0 ? SYSTEM_PLL : READOUT_PLL);
|
||||||
int clkIndex = ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind;
|
int clkIndex = (int)(ind >= SYSTEM_C0 ? ind - SYSTEM_C0 : ind);
|
||||||
ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq);
|
ALTERA_PLL_C10_SetOuputFrequency (pllIndex, clkIndex, newfreq);
|
||||||
clkFrequency[ind] = newfreq;
|
clkFrequency[ind] = newfreq;
|
||||||
FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind]));
|
FILE_LOG(logINFO, ("\t%s clock (%d) divider set to %d (%d Hz)\n", clock_names[ind], ind, val, clkFrequency[ind]));
|
||||||
@ -1345,7 +1340,7 @@ int getClockDivider(enum CLKINDEX ind) {
|
|||||||
FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind));
|
FILE_LOG(logERROR, ("Unknown clock index %d to get clock divider\n", ind));
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (getVCOFrequency(ind) / clkFrequency[ind]);
|
return (getVCOFrequency(ind) / (int)clkFrequency[ind]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* aquisition */
|
/* aquisition */
|
||||||
@ -1482,7 +1477,7 @@ int stopStateMachine(){
|
|||||||
#endif
|
#endif
|
||||||
//stop state machine
|
//stop state machine
|
||||||
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK);
|
bus_w(CONTROL_REG, bus_r(CONTROL_REG) | CONTROL_STP_ACQSTN_MSK);
|
||||||
FILE_LOG(logINFO, ("Status Register: %08x\n",bus_r(STATUS_REG)));
|
FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1539,7 +1534,7 @@ enum runStatus getRunStatus(){
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void readFrame(int *ret, char *mess){
|
void readFrame(int *ret, char *mess) {
|
||||||
// wait for status to be done
|
// wait for status to be done
|
||||||
while(runBusy()){
|
while(runBusy()){
|
||||||
usleep(500);
|
usleep(500);
|
||||||
@ -1559,7 +1554,6 @@ void readFrame(int *ret, char *mess){
|
|||||||
} else {
|
} else {
|
||||||
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
FILE_LOG(logINFOGREEN, ("Acquisition successfully finished\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t runBusy() {
|
u_int32_t runBusy() {
|
||||||
@ -1573,11 +1567,11 @@ u_int32_t runBusy() {
|
|||||||
|
|
||||||
/* common */
|
/* common */
|
||||||
|
|
||||||
int calculateDataBytes(){
|
int calculateDataBytes() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int getTotalNumberOfChannels(){return ((int)getNumberOfChannelsPerChip() * (int)getNumberOfChips());}
|
int getTotalNumberOfChannels() {return (getNumberOfChannelsPerChip() * getNumberOfChips());}
|
||||||
int getNumberOfChips(){return NCHIP;}
|
int getNumberOfChips() {return NCHIP;}
|
||||||
int getNumberOfDACs(){return NDAC;}
|
int getNumberOfDACs() {return NDAC;}
|
||||||
int getNumberOfChannelsPerChip(){return NCHAN;}
|
int getNumberOfChannelsPerChip() {return NCHAN;}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include "sls_detector_defs.h"
|
#include "sls_detector_defs.h"
|
||||||
|
|
||||||
#define REQRD_FRMWRE_VRSN 0x190000
|
#define REQRD_FRMWRE_VRSN 0x190000
|
||||||
#define MIN_REQRD_VRSN_T_RD_API 0x190000
|
|
||||||
|
|
||||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||||
|
|
||||||
@ -46,7 +45,6 @@
|
|||||||
#define READOUT_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
#define READOUT_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
||||||
#define SYSTEM_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
#define SYSTEM_PLL_VCO_FREQ_HZ (1250000000) // 1.25GHz
|
||||||
#define MAX_PATTERN_LENGTH (0x2000) // maximum number of words (64bit)
|
#define MAX_PATTERN_LENGTH (0x2000) // maximum number of words (64bit)
|
||||||
#define WAIT_TIME_US_STP_ACQ (100)
|
|
||||||
|
|
||||||
/** Other Definitions */
|
/** Other Definitions */
|
||||||
#define BIT16_MASK (0xFFFF)
|
#define BIT16_MASK (0xFFFF)
|
||||||
|
@ -84,11 +84,10 @@ int updateDatabytesandAllocateRAM();
|
|||||||
void updateDataBytes();
|
void updateDataBytes();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MYTHEN3D) || GOTTHARD2D
|
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(MYTHEN3D)
|
||||||
int setDefaultDacs();
|
int setDefaultDacs();
|
||||||
#endif
|
#endif
|
||||||
#ifdef GOTTHARD2D
|
#ifdef GOTTHARD2D
|
||||||
int setDefaultOnChipDacs();
|
|
||||||
int readConfigFile();
|
int readConfigFile();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -101,13 +100,13 @@ int readRegister(uint32_t offset, uint32_t* retval);
|
|||||||
uint32_t writeRegister16And32(uint32_t offset, uint32_t data); //FIXME its not there in ctb or moench?
|
uint32_t writeRegister16And32(uint32_t offset, uint32_t data); //FIXME its not there in ctb or moench?
|
||||||
uint32_t readRegister16And32(uint32_t offset);
|
uint32_t readRegister16And32(uint32_t offset);
|
||||||
#else
|
#else
|
||||||
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h
|
extern u_int32_t writeRegister(u_int32_t offset, u_int32_t data); // blackfin.h or nios.h
|
||||||
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h
|
extern u_int32_t readRegister(u_int32_t offset); // blackfin.h or nios.h
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// firmware functions (resets)
|
// firmware functions (resets)
|
||||||
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
void cleanFifos();
|
void cleanFifos();
|
||||||
void resetCore();
|
void resetCore();
|
||||||
void resetPeripheral();
|
void resetPeripheral();
|
||||||
@ -178,6 +177,20 @@ int setExpTime(int64_t val);
|
|||||||
int64_t getExpTime();
|
int64_t getExpTime();
|
||||||
int setPeriod(int64_t val);
|
int setPeriod(int64_t val);
|
||||||
int64_t getPeriod();
|
int64_t getPeriod();
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
void setNumFramesBurst(int64_t val);
|
||||||
|
int64_t getNumFramesBurst();
|
||||||
|
void setNumFramesCont(int64_t val);
|
||||||
|
int64_t getNumFramesCont();
|
||||||
|
int setExptimeBurst(int64_t val);
|
||||||
|
int setExptimeCont(int64_t val);
|
||||||
|
int setExptimeBoth(int64_t val);
|
||||||
|
int64_t getExptimeBoth();
|
||||||
|
int setPeriodBurst(int64_t val);
|
||||||
|
int64_t getPeriodBurst();
|
||||||
|
int setPeriodCont(int64_t val);
|
||||||
|
int64_t getPeriodCont();
|
||||||
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int setSubExpTime(int64_t val);
|
int setSubExpTime(int64_t val);
|
||||||
int64_t getSubExpTime();
|
int64_t getSubExpTime();
|
||||||
@ -203,22 +216,18 @@ void setCounterMask(uint32_t arg);
|
|||||||
uint32_t getCounterMask();
|
uint32_t getCounterMask();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
int setDelayAfterTrigger(int64_t val);
|
int setDelayAfterTrigger(int64_t val);
|
||||||
int64_t getDelayAfterTrigger();
|
int64_t getDelayAfterTrigger();
|
||||||
#endif
|
|
||||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
|
||||||
int64_t getNumFramesLeft();
|
int64_t getNumFramesLeft();
|
||||||
int64_t getNumTriggersLeft();
|
int64_t getNumTriggersLeft();
|
||||||
#endif
|
|
||||||
#if defined(JUNGFRAUD) || defined(GOTTHARDD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
|
||||||
int64_t getDelayAfterTriggerLeft();
|
int64_t getDelayAfterTriggerLeft();
|
||||||
int64_t getPeriodLeft();
|
int64_t getPeriodLeft();
|
||||||
#endif
|
#endif
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
int64_t getExpTimeLeft();
|
int64_t getExpTimeLeft();
|
||||||
#endif
|
#endif
|
||||||
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
int64_t getFramesFromStart();
|
int64_t getFramesFromStart();
|
||||||
int64_t getActualTime();
|
int64_t getActualTime();
|
||||||
int64_t getMeasurementTime();
|
int64_t getMeasurementTime();
|
||||||
@ -230,9 +239,11 @@ int64_t getMeasurementTime();
|
|||||||
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D)) && (!defined(GOTTHARD2D))
|
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D)) && (!defined(GOTTHARD2D))
|
||||||
int setModule(sls_detector_module myMod, char* mess);
|
int setModule(sls_detector_module myMod, char* mess);
|
||||||
int getModule(sls_detector_module *myMod);
|
int getModule(sls_detector_module *myMod);
|
||||||
|
#endif
|
||||||
|
#if (!defined(CHIPTESTBOARDD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D))
|
||||||
enum detectorSettings setSettings(enum detectorSettings sett);
|
enum detectorSettings setSettings(enum detectorSettings sett);
|
||||||
#endif
|
#endif
|
||||||
#if !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
#if !defined(MYTHEN3D)
|
||||||
enum detectorSettings getSettings();
|
enum detectorSettings getSettings();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -293,10 +304,8 @@ int setHighVoltage(int val);
|
|||||||
|
|
||||||
|
|
||||||
// parameters - timing, extsig
|
// parameters - timing, extsig
|
||||||
#if !defined(GOTTHARD2D)
|
|
||||||
void setTiming( enum timingMode arg);
|
void setTiming( enum timingMode arg);
|
||||||
enum timingMode getTiming();
|
enum timingMode getTiming();
|
||||||
#endif
|
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
void setExtSignal(enum externalSignalFlag mode);
|
void setExtSignal(enum externalSignalFlag mode);
|
||||||
int getExtSignal();
|
int getExtSignal();
|
||||||
@ -324,7 +333,6 @@ int getAdcConfigured();
|
|||||||
int configureMAC();
|
int configureMAC();
|
||||||
int setDetectorPosition(int pos[]);
|
int setDetectorPosition(int pos[]);
|
||||||
int* getDetectorPosition();
|
int* getDetectorPosition();
|
||||||
int isConfigurable();
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
@ -447,6 +455,8 @@ int setClockDivider(enum CLKINDEX ind, int val);
|
|||||||
int getClockDivider(enum CLKINDEX ind);
|
int getClockDivider(enum CLKINDEX ind);
|
||||||
|
|
||||||
#elif GOTTHARD2D
|
#elif GOTTHARD2D
|
||||||
|
int checkDetectorType();
|
||||||
|
int powerChip (int on);
|
||||||
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
int setPhase(enum CLKINDEX ind, int val, int degrees);
|
||||||
int getPhase(enum CLKINDEX ind, int degrees);
|
int getPhase(enum CLKINDEX ind, int degrees);
|
||||||
int getMaxPhase(enum CLKINDEX ind);
|
int getMaxPhase(enum CLKINDEX ind);
|
||||||
@ -466,6 +476,8 @@ int configureSingleADCDriver(int chipIndex);
|
|||||||
int configureADC();
|
int configureADC();
|
||||||
int setBurstMode(int burst);
|
int setBurstMode(int burst);
|
||||||
int getBurstMode();
|
int getBurstMode();
|
||||||
|
void setBurstType(enum burstModeType val);
|
||||||
|
enum burstModeType getBurstType();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@ -489,6 +501,9 @@ int setTransmissionDelayRight(int value);
|
|||||||
|
|
||||||
|
|
||||||
// aquisition
|
// aquisition
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
int updateAcquisitionRegisters(char* mess);
|
||||||
|
#endif
|
||||||
#ifdef EIGERD
|
#ifdef EIGERD
|
||||||
int prepareAcquisition();
|
int prepareAcquisition();
|
||||||
#endif
|
#endif
|
||||||
|
@ -199,10 +199,12 @@ int set_inject_channel(int);
|
|||||||
int get_inject_channel(int);
|
int get_inject_channel(int);
|
||||||
int set_veto_photon(int);
|
int set_veto_photon(int);
|
||||||
int get_veto_photon(int);
|
int get_veto_photon(int);
|
||||||
int set_veto_refernce(int);
|
int set_veto_reference(int);
|
||||||
int get_burst_mode(int);
|
int get_burst_mode(int);
|
||||||
int set_burst_mode(int);
|
int set_burst_mode(int);
|
||||||
int set_adc_enable_mask_10g(int);
|
int set_adc_enable_mask_10g(int);
|
||||||
int get_adc_enable_mask_10g(int);
|
int get_adc_enable_mask_10g(int);
|
||||||
int set_counter_mask(int);
|
int set_counter_mask(int);
|
||||||
int get_counter_mask(int);
|
int get_counter_mask(int);
|
||||||
|
int set_burst_type(int);
|
||||||
|
int get_burst_type(int);
|
||||||
|
@ -87,13 +87,9 @@ void ALTERA_PLL_C10_Reconfigure(int pllIndex) {
|
|||||||
void ALTERA_PLL_C10_ResetPLL (int pllIndex) {
|
void ALTERA_PLL_C10_ResetPLL (int pllIndex) {
|
||||||
uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg[pllIndex];
|
uint32_t resetreg = ALTERA_PLL_C10_Reset_Reg[pllIndex];
|
||||||
uint32_t resetmsk = ALTERA_PLL_C10_Reset_Msk[pllIndex];
|
uint32_t resetmsk = ALTERA_PLL_C10_Reset_Msk[pllIndex];
|
||||||
|
|
||||||
#ifdef MYTHEN3D
|
|
||||||
FILE_LOG(logINFO, ("Resetting PLL %d\n", pllIndex));
|
FILE_LOG(logINFO, ("Resetting PLL %d\n", pllIndex));
|
||||||
bus_w_csp1(resetreg, bus_r_csp1(resetreg) | resetmsk);
|
bus_w_csp1(resetreg, bus_r_csp1(resetreg) | resetmsk);
|
||||||
#else
|
|
||||||
FILE_LOG(logWARNING, ("Resetting PLL %d not implemented!\n", pllIndex));
|
|
||||||
#endif
|
|
||||||
usleep(ALTERA_PLL_C10_WAIT_TIME_US);
|
usleep(ALTERA_PLL_C10_WAIT_TIME_US);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,9 @@ int ASIC_Driver_Set (int index, int length, char* buffer) {
|
|||||||
FILE_LOG(logDEBUG1, ("\t]\n"));
|
FILE_LOG(logDEBUG1, ("\t]\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef VIRTUAL
|
||||||
|
return OK;
|
||||||
|
#endif
|
||||||
int fd=open(fname, O_RDWR);
|
int fd=open(fname, O_RDWR);
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
FILE_LOG(logERROR, ("Could not open file %s for writing to control ASIC (%d)\n", fname, index));
|
FILE_LOG(logERROR, ("Could not open file %s for writing to control ASIC (%d)\n", fname, index));
|
||||||
|
@ -19,6 +19,8 @@ extern int ret;
|
|||||||
// Global variables from slsDetectorServer_funcs
|
// Global variables from slsDetectorServer_funcs
|
||||||
extern int sockfd;
|
extern int sockfd;
|
||||||
extern int debugflag;
|
extern int debugflag;
|
||||||
|
extern int checkModuleFlag;
|
||||||
|
|
||||||
|
|
||||||
// Global variables from slsDetectorFunctionList
|
// Global variables from slsDetectorFunctionList
|
||||||
#ifdef GOTTHARDD
|
#ifdef GOTTHARDD
|
||||||
@ -67,7 +69,11 @@ int main(int argc, char *argv[]){
|
|||||||
FILE_LOG(logINFO, ("Detected developer mode\n"));
|
FILE_LOG(logINFO, ("Detected developer mode\n"));
|
||||||
debugflag = 1;
|
debugflag = 1;
|
||||||
}
|
}
|
||||||
else if(!strcasecmp(argv[i],"--port")){
|
else if(!strcasecmp(argv[i],"-nomodule")){
|
||||||
|
FILE_LOG(logINFO, ("Detected No Module mode\n"));
|
||||||
|
checkModuleFlag = 0;
|
||||||
|
}
|
||||||
|
else if(!strcasecmp(argv[i],"-port")){
|
||||||
if ((i + 1) >= argc) {
|
if ((i + 1) >= argc) {
|
||||||
FILE_LOG(logERROR, ("no port value given. Exiting.\n"));
|
FILE_LOG(logERROR, ("no port value given. Exiting.\n"));
|
||||||
return -1;
|
return -1;
|
||||||
@ -105,7 +111,7 @@ int main(int argc, char *argv[]){
|
|||||||
int i;
|
int i;
|
||||||
for (i = 0; i < argc; ++i)
|
for (i = 0; i < argc; ++i)
|
||||||
sprintf(cmd, "%s %s", cmd, argv[i]);
|
sprintf(cmd, "%s %s", cmd, argv[i]);
|
||||||
sprintf(cmd,"%s -stopserver --port %d &", cmd, portno + 1);
|
sprintf(cmd,"%s -stopserver -port %d &", cmd, portno + 1);
|
||||||
FILE_LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd));
|
FILE_LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd));
|
||||||
system(cmd);
|
system(cmd);
|
||||||
}
|
}
|
||||||
|
@ -39,6 +39,7 @@ extern char mess[MAX_STR_LENGTH];
|
|||||||
// Variables that will be exported
|
// Variables that will be exported
|
||||||
int sockfd = 0;
|
int sockfd = 0;
|
||||||
int debugflag = 0;
|
int debugflag = 0;
|
||||||
|
int checkModuleFlag = 1;
|
||||||
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
|
udpStruct udpDetails = {32410, 32411, 50001, 50002, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
int configured = FAIL;
|
int configured = FAIL;
|
||||||
char configureMessage[MAX_STR_LENGTH]="udp parameters not configured yet";
|
char configureMessage[MAX_STR_LENGTH]="udp parameters not configured yet";
|
||||||
@ -307,6 +308,8 @@ const char* getFunctionName(enum detFuncs func) {
|
|||||||
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
||||||
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
||||||
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
||||||
|
case F_SET_BURST_TYPE: return "F_SET_BURST_TYPE";
|
||||||
|
case F_GET_BURST_TYPE: return "F_GET_BURST_TYPE";
|
||||||
|
|
||||||
default: return "Unknown Function";
|
default: return "Unknown Function";
|
||||||
}
|
}
|
||||||
@ -484,13 +487,15 @@ void function_table() {
|
|||||||
flist[F_GET_INJECT_CHANNEL] = &get_inject_channel;
|
flist[F_GET_INJECT_CHANNEL] = &get_inject_channel;
|
||||||
flist[F_SET_VETO_PHOTON] = &set_veto_photon;
|
flist[F_SET_VETO_PHOTON] = &set_veto_photon;
|
||||||
flist[F_GET_VETO_PHOTON] = &get_veto_photon;
|
flist[F_GET_VETO_PHOTON] = &get_veto_photon;
|
||||||
flist[F_SET_VETO_REFERENCE] = &set_veto_refernce;
|
flist[F_SET_VETO_REFERENCE] = &set_veto_reference;
|
||||||
flist[F_GET_BURST_MODE] = &get_burst_mode;
|
flist[F_GET_BURST_MODE] = &get_burst_mode;
|
||||||
flist[F_SET_BURST_MODE] = &set_burst_mode;
|
flist[F_SET_BURST_MODE] = &set_burst_mode;
|
||||||
flist[F_SET_ADC_ENABLE_MASK_10G] = &set_adc_enable_mask_10g;
|
flist[F_SET_ADC_ENABLE_MASK_10G] = &set_adc_enable_mask_10g;
|
||||||
flist[F_GET_ADC_ENABLE_MASK_10G] = &get_adc_enable_mask_10g;
|
flist[F_GET_ADC_ENABLE_MASK_10G] = &get_adc_enable_mask_10g;
|
||||||
flist[F_SET_COUNTER_MASK] = &set_counter_mask;
|
flist[F_SET_COUNTER_MASK] = &set_counter_mask;
|
||||||
flist[F_GET_COUNTER_MASK] = &get_counter_mask;
|
flist[F_GET_COUNTER_MASK] = &get_counter_mask;
|
||||||
|
flist[F_SET_BURST_TYPE] = &set_burst_type;
|
||||||
|
flist[F_GET_BURST_TYPE] = &get_burst_type;
|
||||||
|
|
||||||
// check
|
// check
|
||||||
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
if (NUM_DET_FUNCTIONS >= RECEIVER_ENUM_START) {
|
||||||
@ -685,10 +690,6 @@ int set_timing_mode(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg));
|
||||||
|
|
||||||
#ifdef GOTTHARD2D
|
|
||||||
functionNotImplemented();
|
|
||||||
#else
|
|
||||||
|
|
||||||
// set
|
// set
|
||||||
if ((arg != GET_TIMING_MODE) && (Server_VerifyLock() == OK)) {
|
if ((arg != GET_TIMING_MODE) && (Server_VerifyLock() == OK)) {
|
||||||
switch (arg) {
|
switch (arg) {
|
||||||
@ -709,7 +710,6 @@ int set_timing_mode(int file_des) {
|
|||||||
retval = getTiming();
|
retval = getTiming();
|
||||||
validate((int)arg, (int)retval, "set timing mode", DEC);
|
validate((int)arg, (int)retval, "set timing mode", DEC);
|
||||||
FILE_LOG(logDEBUG1, ("Timing Mode: %d\n",retval));
|
FILE_LOG(logDEBUG1, ("Timing Mode: %d\n",retval));
|
||||||
#endif
|
|
||||||
|
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
@ -1658,7 +1658,7 @@ int set_settings(int file_des) {
|
|||||||
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
|
if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0)
|
||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
|
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D) || defined(GOTTHARD2D)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(MYTHEN3D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
FILE_LOG(logDEBUG1, ("Setting settings %d\n", isett));
|
FILE_LOG(logDEBUG1, ("Setting settings %d\n", isett));
|
||||||
@ -1682,12 +1682,16 @@ int set_settings(int file_des) {
|
|||||||
case LOWGAIN:
|
case LOWGAIN:
|
||||||
case MEDIUMGAIN:
|
case MEDIUMGAIN:
|
||||||
case VERYHIGHGAIN:
|
case VERYHIGHGAIN:
|
||||||
|
#elif GOTTHARD2D
|
||||||
|
case DYNAMICGAIN:
|
||||||
|
case FIXGAIN1:
|
||||||
|
case FIXGAIN2:
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (myDetectorType == EIGER) {
|
if (myDetectorType == EIGER) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
sprintf(mess, "Cannot set settings via SET_SETTINGS, use SET_MODULE\n");
|
sprintf(mess, "Cannot set settings via SET_SETTINGS, use SET_MODULE (set threshold)\n");
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
} else
|
} else
|
||||||
modeNotImplemented("Settings Index", (int)isett);
|
modeNotImplemented("Settings Index", (int)isett);
|
||||||
@ -1700,6 +1704,7 @@ int set_settings(int file_des) {
|
|||||||
FILE_LOG(logDEBUG1, ("Settings: %d\n", retval));
|
FILE_LOG(logDEBUG1, ("Settings: %d\n", retval));
|
||||||
validate((int)isett, (int)retval, "set settings", DEC);
|
validate((int)isett, (int)retval, "set settings", DEC);
|
||||||
#if defined(JUNGFRAUD) || defined (GOTTHARDD)
|
#if defined(JUNGFRAUD) || defined (GOTTHARDD)
|
||||||
|
// gotthard2 does not set default dacs
|
||||||
if (ret == OK && isett >= 0) {
|
if (ret == OK && isett >= 0) {
|
||||||
ret = setDefaultDacs();
|
ret = setDefaultDacs();
|
||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
@ -1782,6 +1787,12 @@ int start_acquisition(int file_des) {
|
|||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
if (updateAcquisitionRegisters(mess) == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
if (configured == FAIL) {
|
if (configured == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -1792,12 +1803,8 @@ int start_acquisition(int file_des) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(VIRTUAL)
|
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(VIRTUAL)
|
||||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
||||||
#else
|
|
||||||
#if defined(GOTTHARD2D)
|
|
||||||
sprintf(mess, "Could not start acquisition due to #frames > %d in burst mode\n", MAX_FRAMES_IN_BURST_MODE);
|
|
||||||
#else
|
#else
|
||||||
sprintf(mess, "Could not start acquisition\n");
|
sprintf(mess, "Could not start acquisition\n");
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
@ -1916,6 +1923,12 @@ int start_and_read_all(int file_des) {
|
|||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef GOTTHARD2D
|
||||||
|
if (updateAcquisitionRegisters(mess) == FAIL) {
|
||||||
|
ret = FAIL;
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
if (configured == FAIL) {
|
if (configured == FAIL) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -1926,12 +1939,8 @@ int start_and_read_all(int file_des) {
|
|||||||
if (ret == FAIL) {
|
if (ret == FAIL) {
|
||||||
#if defined(VIRTUAL) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
#if defined(VIRTUAL) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||||
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
sprintf(mess, "Could not start acquisition. Could not create udp socket in server. Check udp_dstip & udp_dstport.\n");
|
||||||
#else
|
|
||||||
#if defined(GOTTHARD2D)
|
|
||||||
sprintf(mess, "Could not start acquisition due to #frames > %d in burst mode\n", MAX_FRAMES_IN_BURST_MODE);
|
|
||||||
#else
|
#else
|
||||||
sprintf(mess, "Could not start acquisition\n");
|
sprintf(mess, "Could not start acquisition\n");
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
@ -2225,7 +2234,7 @@ int get_delay_after_trigger(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2244,7 +2253,7 @@ int set_delay_after_trigger(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Setting delay after trigger %lld ns\n", (long long int)arg));
|
FILE_LOG(logDEBUG1, ("Setting delay after trigger %lld ns\n", (long long int)arg));
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// only set
|
// only set
|
||||||
@ -2458,7 +2467,7 @@ int get_period_left(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2473,7 +2482,7 @@ int get_delay_after_trigger_left(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(GOTTHARDD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2518,7 +2527,7 @@ int get_frames_from_start(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2533,7 +2542,7 @@ int get_actual_time(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -2548,7 +2557,7 @@ int get_measurement_time(int file_des) {
|
|||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int64_t retval = -1;
|
int64_t retval = -1;
|
||||||
|
|
||||||
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D)
|
#if !defined(JUNGFRAUD) && !defined(CHIPTESTBOARDD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// get only
|
// get only
|
||||||
@ -3836,14 +3845,15 @@ int power_chip(int file_des) {
|
|||||||
return printSocketReadError();
|
return printSocketReadError();
|
||||||
FILE_LOG(logDEBUG1, ("Powering chip to %d\n", arg));
|
FILE_LOG(logDEBUG1, ("Powering chip to %d\n", arg));
|
||||||
|
|
||||||
#if (!defined(JUNGFRAUD)) && (!defined(MOENCHD)) && (!defined(MYTHEN3D))
|
#if !defined(JUNGFRAUD) && !defined(MOENCHD) && !defined(MYTHEN3D) && !defined(GOTTHARD2D)
|
||||||
functionNotImplemented();
|
functionNotImplemented();
|
||||||
#else
|
#else
|
||||||
// set & get
|
// set & get
|
||||||
if ((arg == -1) || (Server_VerifyLock() == OK)) {
|
if ((arg == -1) || (Server_VerifyLock() == OK)) {
|
||||||
#ifdef MYTHEN3D
|
#if defined(MYTHEN3D) || defined(GOTTHARD2D)
|
||||||
// check only when powering on
|
// check only when powering on
|
||||||
if (arg != -1 && arg != 0) {
|
if (arg != -1 && arg != 0) {
|
||||||
|
if (checkModuleFlag) {
|
||||||
int type_ret = checkDetectorType();
|
int type_ret = checkDetectorType();
|
||||||
if (type_ret == -1) {
|
if (type_ret == -1) {
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
@ -3858,6 +3868,9 @@ int power_chip(int file_des) {
|
|||||||
sprintf(mess, "Could not power on chip. Wrong module attached!\n");
|
sprintf(mess, "Could not power on chip. Wrong module attached!\n");
|
||||||
FILE_LOG(logERROR,(mess));
|
FILE_LOG(logERROR,(mess));
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
FILE_LOG(logINFOBLUE, ("In No-Module mode: Ignoring module type. Continuing.\n"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (ret == OK) {
|
if (ret == OK) {
|
||||||
@ -6446,7 +6459,7 @@ int get_veto_photon(int file_des) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int set_veto_refernce(int file_des) {
|
int set_veto_reference(int file_des) {
|
||||||
ret = OK;
|
ret = OK;
|
||||||
memset(mess, 0, sizeof(mess));
|
memset(mess, 0, sizeof(mess));
|
||||||
int args[2] = {-1, -1};
|
int args[2] = {-1, -1};
|
||||||
@ -6581,3 +6594,60 @@ int get_counter_mask(int file_des) {
|
|||||||
#endif
|
#endif
|
||||||
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int set_burst_type(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
enum burstModeType arg = 0;
|
||||||
|
|
||||||
|
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
|
||||||
|
return printSocketReadError();
|
||||||
|
|
||||||
|
FILE_LOG(logINFO, ("Setting burst type: %d\n", arg));
|
||||||
|
|
||||||
|
#ifndef GOTTHARD2D
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// only set
|
||||||
|
if (Server_VerifyLock() == OK) {
|
||||||
|
switch (arg) {
|
||||||
|
case INTERNAL:
|
||||||
|
case EXTERNAL:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
modeNotImplemented("Burst type", (int)arg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ret == OK) {
|
||||||
|
setBurstType(arg);
|
||||||
|
enum burstModeType retval = getBurstType();
|
||||||
|
FILE_LOG(logDEBUG, ("burst type retval: %d\n", retval));
|
||||||
|
if (retval != arg) {
|
||||||
|
ret = FAIL;
|
||||||
|
sprintf(mess, "Could not set burst type. Set %s, got %s\n", (arg == 0 ? "internal" : "external"), (retval == 0 ? "internal" : "external"));
|
||||||
|
FILE_LOG(logERROR, (mess));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int get_burst_type(int file_des) {
|
||||||
|
ret = OK;
|
||||||
|
memset(mess, 0, sizeof(mess));
|
||||||
|
enum burstModeType retval = 0;
|
||||||
|
FILE_LOG(logDEBUG1, ("Getting burst type\n"));
|
||||||
|
|
||||||
|
#ifndef GOTTHARD2D
|
||||||
|
functionNotImplemented();
|
||||||
|
#else
|
||||||
|
// get only
|
||||||
|
retval = getBurstType();
|
||||||
|
FILE_LOG(logDEBUG, ("burst type retval: %d\n", retval));
|
||||||
|
#endif
|
||||||
|
return Server_SendResult(file_des, INT32, UPDATE, &retval, sizeof(retval));
|
||||||
|
}
|
@ -95,10 +95,13 @@ class Detector {
|
|||||||
*/
|
*/
|
||||||
void setDetectorSize(const defs::xy value);
|
void setDetectorSize(const defs::xy value);
|
||||||
|
|
||||||
/** [Jungfrau][Gotthard] */
|
/** [Jungfrau][Gotthard][Gotthard2] */
|
||||||
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
Result<defs::detectorSettings> getSettings(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau][Gotthard] */
|
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
||||||
|
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
||||||
|
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
||||||
|
*/
|
||||||
void setSettings(defs::detectorSettings value, Positions pos = {});
|
void setSettings(defs::detectorSettings value, Positions pos = {});
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
@ -152,23 +155,37 @@ class Detector {
|
|||||||
|
|
||||||
void setPeriod(ns t, Positions pos = {});
|
void setPeriod(ns t, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<ns> getDelayAfterTrigger(Positions pos = {}) const;
|
Result<ns> getDelayAfterTrigger(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
void setDelayAfterTrigger(ns value, Positions pos = {});
|
void setDelayAfterTrigger(ns value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
|
Result<int64_t> getNumberOfFramesLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
|
Result<int64_t> getNumberOfTriggersLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
|
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
|
Result<ns> getDelayAfterTriggerLeft(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
||||||
Result<ns> getPeriodLeft(Positions pos = {}) const;
|
|
||||||
|
/**
|
||||||
|
* [Gotthard][Jungfrau][CTB] Options: AUTO_TIMING, TRIGGER_EXPOSURE
|
||||||
|
* [Eiger] Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER
|
||||||
|
*/
|
||||||
|
void setTimingMode(defs::timingMode value, Positions pos = {});
|
||||||
|
|
||||||
/** [Eiger][Jungfrau] */
|
/** [Eiger][Jungfrau] */
|
||||||
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
|
Result<defs::speedLevel> getSpeed(Positions pos = {}) const;
|
||||||
@ -192,39 +209,45 @@ class Detector {
|
|||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][CTB] */
|
||||||
void setADCPhaseInDegrees(int value, Positions pos = {});
|
void setADCPhaseInDegrees(int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] Hz */
|
/** [Mythen3][Gotthard2] Hz */
|
||||||
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
|
Result<int> getClockFrequency(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [not implemented] Hz */
|
/** [not implemented] Hz */
|
||||||
void setClockFrequency(int clkIndex, int value, Positions pos = {});
|
void setClockFrequency(int clkIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
Result<int> getClockPhase(int clkIndex, Positions pos = {});
|
Result<int> getClockPhase(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockPhase(int clkIndex, int value, Positions pos = {});
|
void setClockPhase(int clkIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
Result<int> getMaxClockPhaseShift(int clkIndex, Positions pos = {});
|
Result<int> getMaxClockPhaseShift(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
Result<int> getClockPhaseinDegrees(int clkIndex, Positions pos = {});
|
Result<int> getClockPhaseinDegrees(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockPhaseinDegrees(int clkIndex, int value, Positions pos = {});
|
void setClockPhaseinDegrees(int clkIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
Result<int> getClockDivider(int clkIndex, Positions pos = {});
|
Result<int> getClockDivider(int clkIndex, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockDivider(int clkIndex, int value, Positions pos = {});
|
void setClockDivider(int clkIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
Result<int> getHighVoltage(Positions pos = {}) const;
|
Result<int> getHighVoltage(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Jungfrau][Mythen3][Gotthard2] */
|
||||||
|
Result<bool> getPowerChip(Positions pos = {}) const;
|
||||||
|
|
||||||
|
/** [Jungfrau][Mythen3][Gotthard2] */
|
||||||
|
void setPowerChip(bool on, Positions pos = {});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Gotthard Options: 0, 90, 110, 120, 150, 180, 200]
|
* [Gotthard] Options: 0, 90, 110, 120, 150, 180, 200
|
||||||
* [Jungfrau, CTB Options: 0, 60 - 200]
|
* [Jungfrau], CTB Options: 0, 60 - 200
|
||||||
* [Eiger Options: 0 - 200]
|
* [Eiger][Mythen3][Gotthard2] Options: 0 - 200
|
||||||
*/
|
*/
|
||||||
void setHighVoltage(int value, Positions pos = {});
|
void setHighVoltage(int value, Positions pos = {});
|
||||||
|
|
||||||
@ -249,14 +272,6 @@ class Detector {
|
|||||||
/* [Gotthard2] */
|
/* [Gotthard2] */
|
||||||
void setOnChipDAC(defs::dacIndex index, int chipIndex, int value, Positions pos = {});
|
void setOnChipDAC(defs::dacIndex index, int chipIndex, int value, Positions pos = {});
|
||||||
|
|
||||||
Result<defs::timingMode> getTimingMode(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* [Gotthard, Jungfrau, CTB Options: AUTO_TIMING, TRIGGER_EXPOSURE]
|
|
||||||
* [Eiger Options: AUTO_TIMING, TRIGGER_EXPOSURE, GATED, BURST_TRIGGER]
|
|
||||||
*/
|
|
||||||
void setTimingMode(defs::timingMode value, Positions pos = {});
|
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
* Acquisition *
|
* Acquisition *
|
||||||
@ -807,12 +822,6 @@ class Detector {
|
|||||||
/** [Jungfrau] */
|
/** [Jungfrau] */
|
||||||
void resetTemperatureEvent(Positions pos = {});
|
void resetTemperatureEvent(Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau] */
|
|
||||||
Result<bool> getPowerChip(Positions pos = {}) const;
|
|
||||||
|
|
||||||
/** [Jungfrau] */
|
|
||||||
void setPowerChip(bool on, Positions pos = {});
|
|
||||||
|
|
||||||
/** [Jungfrau] */
|
/** [Jungfrau] */
|
||||||
Result<bool> getAutoCompDisable(Positions pos = {}) const;
|
Result<bool> getAutoCompDisable(Positions pos = {}) const;
|
||||||
|
|
||||||
@ -906,11 +915,17 @@ class Detector {
|
|||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
void setVetoReference(const int gainIndex, const int value, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] burst mode or continuous mode */
|
/** [Gotthard2] */
|
||||||
|
Result<bool> getBurstMode(Positions pos = {});
|
||||||
|
|
||||||
|
/** [Gotthard2] true = burst mode or false = continuous mode */
|
||||||
void setBurstMode(bool enable, Positions pos = {});
|
void setBurstMode(bool enable, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
Result<bool> getBurstMode(Positions pos = {});
|
Result<defs::burstModeType> getBurstType(Positions pos = {});
|
||||||
|
|
||||||
|
/** [Gotthard2] Options: INTERNAL, EXTERNAL */
|
||||||
|
void setBurstType(defs::burstModeType val, Positions pos = {});
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* *
|
* *
|
||||||
@ -1245,10 +1260,10 @@ class Detector {
|
|||||||
|
|
||||||
void clearBit(uint32_t addr, int bitnr, Positions pos = {});
|
void clearBit(uint32_t addr, int bitnr, Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] */
|
||||||
void executeFirmwareTest(Positions pos = {});
|
void executeFirmwareTest(Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] */
|
||||||
void executeBusTest(Positions pos = {});
|
void executeBusTest(Positions pos = {});
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] not possible to read back*/
|
/** [Gotthard][Jungfrau][CTB] not possible to read back*/
|
||||||
@ -1282,13 +1297,16 @@ class Detector {
|
|||||||
/** Execute a command on the detector server console */
|
/** Execute a command on the detector server console */
|
||||||
void executeCommand(const std::string &value, Positions pos = {});
|
void executeCommand(const std::string &value, Positions pos = {});
|
||||||
|
|
||||||
/** [Jungfrau][CTB] */
|
/** [Jungfrau][Mythen3][CTB]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const;
|
Result<int64_t> getNumberOfFramesFromStart(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau][CTB] Get time from detector start */
|
/** [Jungfrau][Mythen3][CTB] Get time from detector start
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<ns> getActualTime(Positions pos = {}) const;
|
Result<ns> getActualTime(Positions pos = {}) const;
|
||||||
|
|
||||||
/** [Jungfrau][CTB] Get timestamp at a frame start */
|
/** [Jungfrau][Mythen3][CTB] Get timestamp at a frame start
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
Result<ns> getMeasurementTime(Positions pos = {}) const;
|
Result<ns> getMeasurementTime(Positions pos = {}) const;
|
||||||
|
|
||||||
std::string getUserDetails() const;
|
std::string getUserDetails() const;
|
||||||
|
@ -581,6 +581,7 @@ std::string CmdProxy::ClockDivider(int action) {
|
|||||||
return os.str();
|
return os.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** temperature */
|
||||||
/* dacs */
|
/* dacs */
|
||||||
std::string CmdProxy::Dac(int action) {
|
std::string CmdProxy::Dac(int action) {
|
||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
@ -757,11 +758,8 @@ std::string CmdProxy::Threshold(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[eV] [(optinal settings) standard, fast, highgain, dynamicgain, "
|
os << "[eV] [(optinal settings) standard, lowgain, veryhighgain, verylowgain]"
|
||||||
"lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, "
|
"\n\t[Eiger] Threshold in eV" << '\n';
|
||||||
"fixgain2, forceswitchg1, forceswitchg2]\n\t[Eiger] Threshold in "
|
|
||||||
"eV"
|
|
||||||
<< '\n';
|
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
if (!args.empty()) {
|
if (!args.empty()) {
|
||||||
WrongNumberOfParameters(0);
|
WrongNumberOfParameters(0);
|
||||||
@ -792,10 +790,8 @@ std::string CmdProxy::ThresholdNoTb(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[eV] [(optional settings) standard, fast, highgain, "
|
os << "[eV] [(optional settings) standard, lowgain, veryhighgain, verylowgain]"
|
||||||
"dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, "
|
"\n\t[Eiger] Threshold in eV set without setting trimbits"
|
||||||
"fixgain1, fixgain2, forceswitchg1, forceswitchg2]\n\t[Eiger] "
|
|
||||||
"Threshold in eV set without setting trimbits"
|
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
throw sls::RuntimeError("cannot get");
|
throw sls::RuntimeError("cannot get");
|
||||||
@ -1454,7 +1450,7 @@ std::string CmdProxy::Pattern(int action) {
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << cmd << ' ';
|
os << cmd << ' ';
|
||||||
if (action == defs::HELP_ACTION) {
|
if (action == defs::HELP_ACTION) {
|
||||||
os << "[fname]\n\t[Ctb] Loads binary pattern file with only pattern "
|
os << "[fname]\n\t[Mythen3][Ctb] Loads binary pattern file with only pattern "
|
||||||
"words"
|
"words"
|
||||||
<< '\n';
|
<< '\n';
|
||||||
} else if (action == defs::GET_ACTION) {
|
} else if (action == defs::GET_ACTION) {
|
||||||
|
@ -478,6 +478,7 @@ class CmdProxy {
|
|||||||
{"cyclesl", "triggersl"},
|
{"cyclesl", "triggersl"},
|
||||||
{"clkdivider", "speed"},
|
{"clkdivider", "speed"},
|
||||||
|
|
||||||
|
/** temperature */
|
||||||
/** dacs */
|
/** dacs */
|
||||||
{"vcall", "vcal"},
|
{"vcall", "vcal"},
|
||||||
|
|
||||||
@ -578,6 +579,7 @@ class CmdProxy {
|
|||||||
{"triggersl", &CmdProxy::triggersl},
|
{"triggersl", &CmdProxy::triggersl},
|
||||||
{"delayl", &CmdProxy::delayl},
|
{"delayl", &CmdProxy::delayl},
|
||||||
{"periodl", &CmdProxy::periodl},
|
{"periodl", &CmdProxy::periodl},
|
||||||
|
{"timing", &CmdProxy::timing},
|
||||||
{"speed", &CmdProxy::Speed},
|
{"speed", &CmdProxy::Speed},
|
||||||
{"adcphase", &CmdProxy::Adcphase},
|
{"adcphase", &CmdProxy::Adcphase},
|
||||||
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
{"maxadcphaseshift", &CmdProxy::maxadcphaseshift},
|
||||||
@ -586,6 +588,9 @@ class CmdProxy {
|
|||||||
{"maxclkphaseshift", &CmdProxy::MaxClockPhaseShift},
|
{"maxclkphaseshift", &CmdProxy::MaxClockPhaseShift},
|
||||||
{"clkdiv", &CmdProxy::ClockDivider},
|
{"clkdiv", &CmdProxy::ClockDivider},
|
||||||
{"vhighvoltage", &CmdProxy::vhighvoltage},
|
{"vhighvoltage", &CmdProxy::vhighvoltage},
|
||||||
|
{"powerchip", &CmdProxy::powerchip},
|
||||||
|
|
||||||
|
/** temperature */
|
||||||
{"temp_adc", &CmdProxy::temp_adc},
|
{"temp_adc", &CmdProxy::temp_adc},
|
||||||
{"temp_fpga", &CmdProxy::temp_fpga},
|
{"temp_fpga", &CmdProxy::temp_fpga},
|
||||||
{"temp_fpgaext", &CmdProxy::temp_fpgaext},
|
{"temp_fpgaext", &CmdProxy::temp_fpgaext},
|
||||||
@ -595,7 +600,6 @@ class CmdProxy {
|
|||||||
{"temp_sodr", &CmdProxy::temp_sodr},
|
{"temp_sodr", &CmdProxy::temp_sodr},
|
||||||
{"temp_fpgafl", &CmdProxy::temp_fpgafl},
|
{"temp_fpgafl", &CmdProxy::temp_fpgafl},
|
||||||
{"temp_fpgafr", &CmdProxy::temp_fpgafr},
|
{"temp_fpgafr", &CmdProxy::temp_fpgafr},
|
||||||
{"timing", &CmdProxy::timing},
|
|
||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
{"vthreshold", &CmdProxy::vthreshold},
|
{"vthreshold", &CmdProxy::vthreshold},
|
||||||
@ -767,7 +771,6 @@ class CmdProxy {
|
|||||||
{"temp_threshold", &CmdProxy::temp_threshold},
|
{"temp_threshold", &CmdProxy::temp_threshold},
|
||||||
{"temp_control", &CmdProxy::temp_control},
|
{"temp_control", &CmdProxy::temp_control},
|
||||||
{"temp_event", &CmdProxy::TemperatureEvent},
|
{"temp_event", &CmdProxy::TemperatureEvent},
|
||||||
{"powerchip", &CmdProxy::powerchip},
|
|
||||||
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
{"auto_comp_disable", &CmdProxy::auto_comp_disable},
|
||||||
{"storagecells", &CmdProxy::storagecells},
|
{"storagecells", &CmdProxy::storagecells},
|
||||||
{"storagecell_start", &CmdProxy::storagecell_start},
|
{"storagecell_start", &CmdProxy::storagecell_start},
|
||||||
@ -785,6 +788,7 @@ class CmdProxy {
|
|||||||
{"vetophoton", &CmdProxy::VetoPhoton},
|
{"vetophoton", &CmdProxy::VetoPhoton},
|
||||||
{"vetoref", &CmdProxy::VetoReference},
|
{"vetoref", &CmdProxy::VetoReference},
|
||||||
{"burstmode", &CmdProxy::burstmode},
|
{"burstmode", &CmdProxy::burstmode},
|
||||||
|
{"bursttype", &CmdProxy::bursttype},
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
{"counters", &CmdProxy::Counters},
|
{"counters", &CmdProxy::Counters},
|
||||||
@ -911,6 +915,7 @@ class CmdProxy {
|
|||||||
std::string ClockPhase(int action);
|
std::string ClockPhase(int action);
|
||||||
std::string MaxClockPhaseShift(int action);
|
std::string MaxClockPhaseShift(int action);
|
||||||
std::string ClockDivider(int action);
|
std::string ClockDivider(int action);
|
||||||
|
/** temperature */
|
||||||
/* dacs */
|
/* dacs */
|
||||||
std::string Dac(int action);
|
std::string Dac(int action);
|
||||||
std::string DacList(int action);
|
std::string DacList(int action);
|
||||||
@ -993,44 +998,71 @@ class CmdProxy {
|
|||||||
"\n\tSerial number or MAC of detector (hex).");
|
"\n\tSerial number or MAC of detector (hex).");
|
||||||
|
|
||||||
INTEGER_COMMAND(settings, getSettings, setSettings, sls::StringTo<slsDetectorDefs::detectorSettings>,
|
INTEGER_COMMAND(settings, getSettings, setSettings, sls::StringTo<slsDetectorDefs::detectorSettings>,
|
||||||
"[standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2]\n\t[Jungfrau][Gotthard] Detector Settings.\n\t[Eiger] Use threshold or thresholdnotb.");
|
"[standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain, dynamichg0, fixgain1, fixgain2, forceswitchg1, forceswitchg2, verylowgain]"
|
||||||
|
"\n\t[Jungfrau] - Detector Settings [dynamicgain | dynamichg0 | fixgain1 | fixgain2 | forceswitchg1 | forceswitchg2]"
|
||||||
|
"\n\t[Gotthard] - Detector Settings [dynamicgain | highgain | lowgain | mediumgain | veryhighgain]"
|
||||||
|
"\n\t[Gotthard2] - Detector Settings [dynamicgain | fixgain1 | fixgain2]"
|
||||||
|
"\n\t[Eiger] Use threshold or thresholdnotb.");
|
||||||
|
|
||||||
/* acquisition parameters */
|
/* acquisition parameters */
|
||||||
|
|
||||||
INTEGER_COMMAND_NOID(frames, getNumberOfFrames, setNumberOfFrames,
|
INTEGER_COMMAND_NOID(frames, getNumberOfFrames, setNumberOfFrames,
|
||||||
std::stol,
|
std::stol,
|
||||||
"[n_frames]\n\tNumber of frames per aquire. In trigger mode, number of frames per trigger.");
|
"[n_frames]\n\tNumber of frames per aquire. In trigger mode, number of frames per trigger."
|
||||||
|
"\n\t[Gotthard2] Burst mode has a maximum of 2720 frames. Frames number for both modes are uploaded to detector just before acquisition starts");
|
||||||
|
|
||||||
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
|
INTEGER_COMMAND_NOID(triggers, getNumberOfTriggers, setNumberOfTriggers,
|
||||||
std::stol,
|
std::stol,
|
||||||
"[n_triggers]\n\tNumber of triggers per aquire. Use timing command to set timing mode.");
|
"[n_triggers]\n\tNumber of triggers per aquire. Use timing command to set timing mode.");
|
||||||
|
|
||||||
TIME_COMMAND(exptime, getExptime, setExptime,
|
TIME_COMMAND(exptime, getExptime, setExptime,
|
||||||
"[duration] [(optional unit) ns|us|ms|s]\n\tExposure time");
|
"[duration] [(optional unit) ns|us|ms|s]\n\tExposure time"
|
||||||
|
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
|
||||||
|
|
||||||
TIME_COMMAND(period, getPeriod, setPeriod,
|
TIME_COMMAND(period, getPeriod, setPeriod,
|
||||||
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames");
|
"[duration] [(optional unit) ns|us|ms|s]\n\tPeriod between frames"
|
||||||
|
"\n\t[Gotthard2] Uploaded to detector just before acquisition starts");
|
||||||
|
|
||||||
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
|
TIME_COMMAND(delay, getDelayAfterTrigger, setDelayAfterTrigger,
|
||||||
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Ctb][Mythen3] Delay after trigger");
|
"[duration] [(optional unit) ns|us|ms|s]\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Delay after trigger"
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
GET_COMMAND(framesl, getNumberOfFramesLeft,
|
GET_COMMAND(framesl, getNumberOfFramesLeft,
|
||||||
"\n\t[Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] Number of frames left in acquisition.");
|
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Number of frames left in acquisition."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
GET_COMMAND(triggersl, getNumberOfTriggersLeft,
|
GET_COMMAND(triggersl, getNumberOfTriggersLeft,
|
||||||
"\n\t[Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] Number of triggers left in acquisition.");
|
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Number of triggers left in acquisition."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
TIME_GET_COMMAND(delayl, getDelayAfterTriggerLeft,
|
TIME_GET_COMMAND(delayl, getDelayAfterTriggerLeft,
|
||||||
"\n\t[Gotthard][Jungfrau][CTB] DelayLeft Delay Left in Acquisition.");
|
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] DelayLeft Delay Left in Acquisition."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
TIME_GET_COMMAND(periodl, getPeriodLeft,
|
TIME_GET_COMMAND(periodl, getPeriodLeft,
|
||||||
"\n\t[Gotthard][Jungfrau][CTB] Period left for current frame.");
|
"\n\t[Gotthard][Jungfrau][Mythen3][Gotthard2][CTB] Period left for current frame."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, sls::StringTo<slsDetectorDefs::timingMode>,
|
||||||
|
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] [auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
|
||||||
|
|
||||||
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
GET_COMMAND(maxadcphaseshift, getMaxADCPhaseShift,
|
||||||
"\n\t[Jungfrau][CTB] Absolute maximum Phase shift of ADC clock.");
|
"\n\t[Jungfrau][CTB] Absolute maximum Phase shift of ADC clock.");
|
||||||
|
|
||||||
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, std::stoi,
|
INTEGER_COMMAND(vhighvoltage, getHighVoltage, setHighVoltage, std::stoi,
|
||||||
"[n_value]\n\tHigh voltage to the sensor in Voltage.\n\t[Gotthard] [0|90|110|120|150|180|200]\n\t[Eiger] 0-200\n\t[Jungfrau][Ctb] [0|60-200]");
|
"[n_value]\n\tHigh voltage to the sensor in Voltage."
|
||||||
|
"\n\t[Gotthard] [0|90|110|120|150|180|200]"
|
||||||
|
"\n\t[Eiger][Mythen3][Gotthard2] 0-200"
|
||||||
|
"\n\t[Jungfrau][Ctb] [0|60-200]");
|
||||||
|
|
||||||
|
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, std::stoi,
|
||||||
|
"[0, 1]\n\t[Jungfrau][Mythen3][Gotthard2] Power the chip. Default 0."
|
||||||
|
"\n\t[Jungfrau] Get will return power status."
|
||||||
|
"Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled."
|
||||||
|
"\n\t[Mythen3] If module not connected or wrong module, 1 will fail. By default, not powered on"
|
||||||
|
"\n\t[Gotthard2] If module not connected or wrong module, 1 will fail. By default, powered on at server start up.");
|
||||||
|
|
||||||
|
/** temperature */
|
||||||
|
|
||||||
GET_IND_COMMAND(temp_adc, getTemperature, slsDetectorDefs::TEMPERATURE_ADC, " °C",
|
GET_IND_COMMAND(temp_adc, getTemperature, slsDetectorDefs::TEMPERATURE_ADC, " °C",
|
||||||
"[n_value]\n\t[Jungfrau][Gotthard] ADC Temperature");
|
"[n_value]\n\t[Jungfrau][Gotthard] ADC Temperature");
|
||||||
@ -1059,9 +1091,6 @@ class CmdProxy {
|
|||||||
GET_IND_COMMAND(temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C",
|
GET_IND_COMMAND(temp_fpgafr, getTemperature, slsDetectorDefs::TEMPERATURE_FPGA3, " °C",
|
||||||
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga");
|
"[n_value]\n\t[Eiger]Temperature of the left front end board fpga");
|
||||||
|
|
||||||
INTEGER_COMMAND(timing, getTimingMode, setTimingMode, sls::StringTo<slsDetectorDefs::timingMode>,
|
|
||||||
"[auto|trigger|gating|burst_trigger]\n\tTiming Mode of detector.\n\t[Jungfrau][Gotthard][Ctb] [auto|trigger]\n\t[Eiger] [auto|trigger|gating|burst_trigger]");
|
|
||||||
|
|
||||||
/* dacs */
|
/* dacs */
|
||||||
|
|
||||||
DAC_COMMAND(vthreshold, getDAC, setDAC, defs::THRESHOLD,
|
DAC_COMMAND(vthreshold, getDAC, setDAC, defs::THRESHOLD,
|
||||||
@ -1373,8 +1402,7 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND(rx_tcpport, getRxPort, setRxPort, std::stoi,
|
INTEGER_COMMAND(rx_tcpport, getRxPort, setRxPort, std::stoi,
|
||||||
"[port]\n\tTCP port for client-receiver communication. Default is 1954. Must be different if multiple receivers on same pc. Must be first command to set a receiver parameter. Multi command will automatically increment for individual modules.");
|
"[port]\n\tTCP port for client-receiver communication. Default is 1954. Must be different if multiple receivers on same pc. Must be first command to set a receiver parameter. Multi command will automatically increment for individual modules.");
|
||||||
|
|
||||||
INTEGER_COMMAND(
|
INTEGER_COMMAND(rx_fifodepth, getRxFifoDepth, setRxFifoDepth, std::stoi,
|
||||||
rx_fifodepth, getRxFifoDepth, setRxFifoDepth, std::stoi,
|
|
||||||
"[n_frames]\n\tSet the number of frames in the receiver fifo (buffer between listener and writer threads).");
|
"[n_frames]\n\tSet the number of frames in the receiver fifo (buffer between listener and writer threads).");
|
||||||
|
|
||||||
INTEGER_COMMAND(rx_silent, getRxSilentMode, setRxSilentMode, std::stoi,
|
INTEGER_COMMAND(rx_silent, getRxSilentMode, setRxSilentMode, std::stoi,
|
||||||
@ -1502,9 +1530,6 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND(temp_control, getTemperatureControl, setTemperatureControl, std::stoi,
|
INTEGER_COMMAND(temp_control, getTemperatureControl, setTemperatureControl, std::stoi,
|
||||||
"[0, 1]\n\t[Jungfrau] Temperature control enable. Default is 0 (disabled). If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared.");
|
"[0, 1]\n\t[Jungfrau] Temperature control enable. Default is 0 (disabled). If temperature crosses threshold temperature and temperature control is enabled, power to chip will be switched off and temperature event occurs. To power on chip again, temperature has to be less than threshold temperature and temperature event has to be cleared.");
|
||||||
|
|
||||||
INTEGER_COMMAND(powerchip, getPowerChip, setPowerChip, std::stoi,
|
|
||||||
"[0, 1]\n\t[Jungfrau][Mythen3] Power the chip. Default 0. \n\t[Jungfrau] Get will return power status. Can be off if temperature event occured (temperature over temp_threshold with temp_control enabled.");
|
|
||||||
|
|
||||||
INTEGER_COMMAND(auto_comp_disable, getAutoCompDisable, setAutoCompDisable, std::stoi,
|
INTEGER_COMMAND(auto_comp_disable, getAutoCompDisable, setAutoCompDisable, std::stoi,
|
||||||
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. Default 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us).");
|
"[0, 1]\n\t[Jungfrau] Auto comparator disable mode. Default 0 or this mode disabled(comparator enabled throughout). 1 enables mode. 0 disables mode. This mode disables the on-chip gain switching comparator automatically after 93.75% of exposure time (only for longer than 100us).");
|
||||||
|
|
||||||
@ -1532,6 +1557,9 @@ class CmdProxy {
|
|||||||
INTEGER_COMMAND(burstmode, getBurstMode, setBurstMode, std::stoi,
|
INTEGER_COMMAND(burstmode, getBurstMode, setBurstMode, std::stoi,
|
||||||
"[0, 1]\n\t[Gotthard2] 1 sets to burst mode. 0 sets to continuous mode. Default is burst mode.");
|
"[0, 1]\n\t[Gotthard2] 1 sets to burst mode. 0 sets to continuous mode. Default is burst mode.");
|
||||||
|
|
||||||
|
INTEGER_COMMAND(bursttype, getBurstType, setBurstType, sls::StringTo<slsDetectorDefs::burstModeType>,
|
||||||
|
"[internal, external]\n\t[Gotthard2] Default is internal type.");
|
||||||
|
|
||||||
/* Mythen3 Specific */
|
/* Mythen3 Specific */
|
||||||
|
|
||||||
/* CTB Specific */
|
/* CTB Specific */
|
||||||
@ -1677,10 +1705,10 @@ class CmdProxy {
|
|||||||
"\n\t[Jungfrau][Ctb] Reboot controler (blackfin) of detector.");
|
"\n\t[Jungfrau][Ctb] Reboot controler (blackfin) of detector.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(firmwaretest, executeFirmwareTest,
|
EXECUTE_SET_COMMAND(firmwaretest, executeFirmwareTest,
|
||||||
"\n\t[Jungfrau][Ctb][Gotthard] Firmware test, ie. reads a read fixed pattern from a register.");
|
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Firmware test, ie. reads a read fixed pattern from a register.");
|
||||||
|
|
||||||
EXECUTE_SET_COMMAND(bustest, executeBusTest,
|
EXECUTE_SET_COMMAND(bustest, executeBusTest,
|
||||||
"\n\t[Jungfrau][Ctb][Gotthard] Bus test, ie. keeps writing and reading back different values in R/W register.");
|
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][Ctb] Bus test, ie. keeps writing and reading back different values in R/W register.");
|
||||||
|
|
||||||
|
|
||||||
/* Insignificant */
|
/* Insignificant */
|
||||||
@ -1698,13 +1726,16 @@ class CmdProxy {
|
|||||||
"\n\tClient IP Address that last communicated with the detector.");
|
"\n\tClient IP Address that last communicated with the detector.");
|
||||||
|
|
||||||
GET_COMMAND(nframes, getNumberOfFramesFromStart,
|
GET_COMMAND(nframes, getNumberOfFramesFromStart,
|
||||||
"\n\t[Jungfrau][CTB] Number of frames from start run control.");
|
"\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Number of frames from start run control."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
TIME_GET_COMMAND(now, getActualTime,
|
TIME_GET_COMMAND(now, getActualTime,
|
||||||
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][CTB] Time from detector start up.");
|
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Time from detector start up."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
TIME_GET_COMMAND(timestamp, getMeasurementTime,
|
TIME_GET_COMMAND(timestamp, getMeasurementTime,
|
||||||
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][CTB] Timestamp at a frame start.");
|
"[(optional unit) ns|us|ms|s]\n\t[Jungfrau][Mythen3][Gotthard2][Moench][CTB] Timestamp at a frame start."
|
||||||
|
"\n\t[Gotthard2] only in continuous mode.");
|
||||||
|
|
||||||
GET_COMMAND(rx_frameindex, getRxCurrentFrameIndex,
|
GET_COMMAND(rx_frameindex, getRxCurrentFrameIndex,
|
||||||
"\n\tCurrent frame index received in receiver.");
|
"\n\tCurrent frame index received in receiver.");
|
||||||
|
@ -224,6 +224,15 @@ Result<ns> Detector::getPeriodLeft(Positions pos) const {
|
|||||||
return pimpl->Parallel(&slsDetector::getPeriodLeft, pos);
|
return pimpl->Parallel(&slsDetector::getPeriodLeft, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<defs::timingMode> Detector::getTimingMode(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&slsDetector::setTimingMode, pos,
|
||||||
|
defs::GET_TIMING_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
||||||
|
pimpl->Parallel(&slsDetector::setTimingMode, pos, value);
|
||||||
|
}
|
||||||
|
|
||||||
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
Result<defs::speedLevel> Detector::getSpeed(Positions pos) const {
|
||||||
auto res =
|
auto res =
|
||||||
pimpl->Parallel(&slsDetector::getClockDivider, pos, defs::RUN_CLOCK);
|
pimpl->Parallel(&slsDetector::getClockDivider, pos, defs::RUN_CLOCK);
|
||||||
@ -309,6 +318,21 @@ void Detector::setHighVoltage(int value, Positions pos) {
|
|||||||
pimpl->Parallel(&slsDetector::setDAC, pos, value, defs::HIGH_VOLTAGE, 0);
|
pimpl->Parallel(&slsDetector::setDAC, pos, value, defs::HIGH_VOLTAGE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<bool> Detector::getPowerChip(Positions pos) const {
|
||||||
|
return pimpl->Parallel(&slsDetector::powerChip, pos, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setPowerChip(bool on, Positions pos) {
|
||||||
|
if ((pos.empty() || pos[0] == -1) && on && pimpl->size() > 3) {
|
||||||
|
for (int i = 0; i != pimpl->size(); ++i) {
|
||||||
|
pimpl->Parallel(&slsDetector::powerChip, {i}, static_cast<int>(on));
|
||||||
|
usleep(1000 * 1000);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pimpl->Parallel(&slsDetector::powerChip, pos, static_cast<int>(on));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Result<int> Detector::getTemperature(defs::dacIndex index,
|
Result<int> Detector::getTemperature(defs::dacIndex index,
|
||||||
Positions pos) const {
|
Positions pos) const {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
@ -359,15 +383,6 @@ void Detector::setOnChipDAC(defs::dacIndex index, int chipIndex, int value,
|
|||||||
pimpl->Parallel(&slsDetector::setOnChipDAC, pos, index, chipIndex, value);
|
pimpl->Parallel(&slsDetector::setOnChipDAC, pos, index, chipIndex, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<defs::timingMode> Detector::getTimingMode(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&slsDetector::setTimingMode, pos,
|
|
||||||
defs::GET_TIMING_MODE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setTimingMode(defs::timingMode value, Positions pos) {
|
|
||||||
pimpl->Parallel(&slsDetector::setTimingMode, pos, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Acquisition
|
// Acquisition
|
||||||
|
|
||||||
void Detector::acquire() { pimpl->acquire(); }
|
void Detector::acquire() { pimpl->acquire(); }
|
||||||
@ -1069,21 +1084,6 @@ void Detector::resetTemperatureEvent(Positions pos) {
|
|||||||
pimpl->Parallel(&slsDetector::setTemperatureEvent, pos, 0);
|
pimpl->Parallel(&slsDetector::setTemperatureEvent, pos, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getPowerChip(Positions pos) const {
|
|
||||||
return pimpl->Parallel(&slsDetector::powerChip, pos, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Detector::setPowerChip(bool on, Positions pos) {
|
|
||||||
if ((pos.empty() || pos[0] == -1) && on && pimpl->size() > 3) {
|
|
||||||
for (int i = 0; i != pimpl->size(); ++i) {
|
|
||||||
pimpl->Parallel(&slsDetector::powerChip, {i}, static_cast<int>(on));
|
|
||||||
usleep(1000 * 1000);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
pimpl->Parallel(&slsDetector::powerChip, pos, static_cast<int>(on));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Result<bool> Detector::getAutoCompDisable(Positions pos) const {
|
Result<bool> Detector::getAutoCompDisable(Positions pos) const {
|
||||||
return pimpl->Parallel(&slsDetector::setAutoComparatorDisableMode, pos, -1);
|
return pimpl->Parallel(&slsDetector::setAutoComparatorDisableMode, pos, -1);
|
||||||
}
|
}
|
||||||
@ -1180,12 +1180,20 @@ void Detector::setVetoReference(const int gainIndex, const int value, Positions
|
|||||||
pimpl->Parallel(&slsDetector::setVetoReference, pos, gainIndex, value);
|
pimpl->Parallel(&slsDetector::setVetoReference, pos, gainIndex, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result<bool> Detector::getBurstMode(Positions pos) {
|
||||||
|
return pimpl->Parallel(&slsDetector::getBurstMode, pos);
|
||||||
|
}
|
||||||
|
|
||||||
void Detector::setBurstMode(bool enable, Positions pos) {
|
void Detector::setBurstMode(bool enable, Positions pos) {
|
||||||
pimpl->Parallel(&slsDetector::setBurstMode, pos, enable);
|
pimpl->Parallel(&slsDetector::setBurstMode, pos, enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
Result<bool> Detector::getBurstMode(Positions pos) {
|
Result<defs::burstModeType> Detector::getBurstType(Positions pos) {
|
||||||
return pimpl->Parallel(&slsDetector::getBurstMode, pos);
|
return pimpl->Parallel(&slsDetector::getBurstType, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Detector::setBurstType(defs::burstModeType value, Positions pos) {
|
||||||
|
pimpl->Parallel(&slsDetector::setBurstType, pos, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mythen3 Specific
|
// Mythen3 Specific
|
||||||
|
@ -1483,6 +1483,16 @@ int64_t slsDetector::getMeasurementTime() const {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slsDetectorDefs::timingMode slsDetector::setTimingMode(timingMode value) {
|
||||||
|
int fnum = F_SET_TIMING_MODE;
|
||||||
|
//auto arg = static_cast<int>(pol);
|
||||||
|
timingMode retval = GET_TIMING_MODE;
|
||||||
|
FILE_LOG(logDEBUG1) << "Setting communication to mode " << value;
|
||||||
|
sendToDetector(fnum, static_cast<int>(value), retval);
|
||||||
|
FILE_LOG(logDEBUG1) << "Timing Mode: " << retval;
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
int slsDetector::setDynamicRange(int n) {
|
int slsDetector::setDynamicRange(int n) {
|
||||||
// TODO! Properly handle fail
|
// TODO! Properly handle fail
|
||||||
int prevDr = shm()->dynamicRange;
|
int prevDr = shm()->dynamicRange;
|
||||||
@ -1549,16 +1559,6 @@ int slsDetector::getADC(dacIndex index) {
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
slsDetectorDefs::timingMode slsDetector::setTimingMode(timingMode pol) {
|
|
||||||
int fnum = F_SET_TIMING_MODE;
|
|
||||||
auto arg = static_cast<int>(pol);
|
|
||||||
timingMode retval = GET_TIMING_MODE;
|
|
||||||
FILE_LOG(logDEBUG1) << "Setting communication to mode " << pol;
|
|
||||||
sendToDetector(fnum, arg, retval);
|
|
||||||
FILE_LOG(logDEBUG1) << "Timing Mode: " << retval;
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
slsDetectorDefs::externalSignalFlag
|
slsDetectorDefs::externalSignalFlag
|
||||||
slsDetector::setExternalSignalFlags(externalSignalFlag pol) {
|
slsDetector::setExternalSignalFlags(externalSignalFlag pol) {
|
||||||
int fnum = F_SET_EXTERNAL_SIGNAL_FLAG;
|
int fnum = F_SET_EXTERNAL_SIGNAL_FLAG;
|
||||||
@ -2489,6 +2489,19 @@ void slsDetector::setBurstMode(bool enable) {
|
|||||||
sendToDetector(F_SET_BURST_MODE, arg, nullptr);
|
sendToDetector(F_SET_BURST_MODE, arg, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
slsDetectorDefs::burstModeType slsDetector::getBurstType() {
|
||||||
|
int retval = -1;
|
||||||
|
sendToDetector(F_GET_BURST_TYPE, nullptr, retval);
|
||||||
|
FILE_LOG(logDEBUG1) << "Burst mode:" << retval;
|
||||||
|
return static_cast<burstModeType>(retval);
|
||||||
|
}
|
||||||
|
|
||||||
|
void slsDetector::setBurstType (burstModeType val) {
|
||||||
|
int arg = static_cast<int>(val);
|
||||||
|
FILE_LOG(logDEBUG1) << "Setting burst type to " << ToString(val);
|
||||||
|
sendToDetector(F_SET_BURST_TYPE, arg, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
int slsDetector::setCounterBit(int cb) {
|
int slsDetector::setCounterBit(int cb) {
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;
|
FILE_LOG(logDEBUG1) << "Sending counter bit " << cb;
|
||||||
|
@ -389,13 +389,10 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
detectorSettings getSettings();
|
detectorSettings getSettings();
|
||||||
|
|
||||||
/**
|
/** [Jungfrau] Options:DYNAMICGAIN, DYNAMICHG0, FIXGAIN1, FIXGAIN2, FORCESWITCHG1, FORCESWITCHG2
|
||||||
* Load detector settings from the settings file picked from the
|
* [Gotthard] Options: DYNAMICGAIN, HIGHGAIN, LOWGAIN, MEDIUMGAIN, VERYHIGHGAIN
|
||||||
* trimdir/settingsdir Eiger only stores in shared memory ( a get will
|
* [Gotthard2] Options: DYNAMICGAIN, FIXGAIN1, FIXGAIN2
|
||||||
* overwrite this) For Eiger, one must use threshold Gotthard, Propix,
|
* [Eiger] Only stores them locally in shm Options: STANDARD, HIGHGAIN, LOWGAIN, VERYHIGHGAIN, VERYLOWGAIN
|
||||||
* Jungfrau and Moench only sends the settings enum to the detector
|
|
||||||
* @param isettings settings
|
|
||||||
* @returns current settings
|
|
||||||
*/
|
*/
|
||||||
detectorSettings setSettings(detectorSettings isettings);
|
detectorSettings setSettings(detectorSettings isettings);
|
||||||
|
|
||||||
@ -564,10 +561,12 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
void setPeriod(int64_t value);
|
void setPeriod(int64_t value);
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
int64_t getDelayAfterTrigger();
|
int64_t getDelayAfterTrigger();
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
void setDelayAfterTrigger(int64_t value);
|
void setDelayAfterTrigger(int64_t value);
|
||||||
|
|
||||||
/** [Eiger] in 32 bit mode */
|
/** [Eiger] in 32 bit mode */
|
||||||
@ -589,19 +588,22 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
* Options: (0-1638375 ns (resolution of 25ns) */
|
* Options: (0-1638375 ns (resolution of 25ns) */
|
||||||
void setStorageCellDelay(int64_t value);
|
void setStorageCellDelay(int64_t value);
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
int64_t getNumberOfFramesLeft() const;
|
int64_t getNumberOfFramesLeft() const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
int64_t getNumberOfTriggersLeft() const;
|
int64_t getNumberOfTriggersLeft() const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][CTB]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
int64_t getDelayAfterTriggerLeft() const;
|
int64_t getDelayAfterTriggerLeft() const;
|
||||||
|
|
||||||
/** [Gotthard] */
|
/** [Gotthard] */
|
||||||
int64_t getExptimeLeft() const;
|
int64_t getExptimeLeft() const;
|
||||||
|
|
||||||
/** [Gotthard][Jungfrau][CTB] */
|
/** [Gotthard][Jungfrau][CTB][Mythen3][Gotthard2] */
|
||||||
int64_t getPeriodLeft() const;
|
int64_t getPeriodLeft() const;
|
||||||
|
|
||||||
/** [Eiger] minimum two frames */
|
/** [Eiger] minimum two frames */
|
||||||
@ -610,15 +612,25 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
/** [Eiger] */
|
/** [Eiger] */
|
||||||
int64_t getMeasuredSubFramePeriod() const;
|
int64_t getMeasuredSubFramePeriod() const;
|
||||||
|
|
||||||
/** [Jungfrau][CTB] */
|
/** [Jungfrau][CTB][Mythen3]
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
int64_t getNumberOfFramesFromStart() const;
|
int64_t getNumberOfFramesFromStart() const;
|
||||||
|
|
||||||
/** [Jungfrau][CTB] Get time from detector start */
|
/** [Jungfrau][CTB][Mythen3] Get time from detector start
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
int64_t getActualTime() const;
|
int64_t getActualTime() const;
|
||||||
|
|
||||||
/** [Jungfrau][CTB] Get timestamp at a frame start */
|
/** [Jungfrau][CTB][Mythen3] Get timestamp at a frame start
|
||||||
|
* [Gotthard2] only in continuous mode */
|
||||||
int64_t getMeasurementTime() const;
|
int64_t getMeasurementTime() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set/get timing mode
|
||||||
|
* @param value timing mode (-1 gets)
|
||||||
|
* @returns current timing mode
|
||||||
|
*/
|
||||||
|
timingMode setTimingMode(timingMode value = GET_TIMING_MODE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get dynamic range
|
* Set/get dynamic range
|
||||||
* (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to
|
* (Eiger: If i is 32, also sets clkdivider to 2, if 16, sets clkdivider to
|
||||||
@ -652,13 +664,6 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
int getADC(dacIndex index);
|
int getADC(dacIndex index);
|
||||||
|
|
||||||
/**
|
|
||||||
* Set/get timing mode
|
|
||||||
* @param pol timing mode (-1 gets)
|
|
||||||
* @returns current timing mode
|
|
||||||
*/
|
|
||||||
timingMode setTimingMode(timingMode pol = GET_TIMING_MODE);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get external signal flags (to specify triggerinrising edge etc)
|
* Set/get external signal flags (to specify triggerinrising edge etc)
|
||||||
* (Gotthard, Mythen)
|
* (Gotthard, Mythen)
|
||||||
@ -1125,11 +1130,17 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
|
|
||||||
void setVetoReference(const int gainIndex, const int value);
|
void setVetoReference(const int gainIndex, const int value);
|
||||||
|
|
||||||
/** [Gotthard2] burst mode or continuous mode */
|
/** [Gotthard2] */
|
||||||
|
bool getBurstMode();
|
||||||
|
|
||||||
|
/** [Gotthard2] true = burst mode or false = continuous mode */
|
||||||
void setBurstMode(bool enable);
|
void setBurstMode(bool enable);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Gotthard2] */
|
||||||
bool getBurstMode();
|
burstModeType getBurstType();
|
||||||
|
|
||||||
|
/** [Gotthard2] Options: INTERNAL, EXTERNAL */
|
||||||
|
void setBurstType(burstModeType val);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set/get counter bit in detector (Gotthard)
|
* Set/get counter bit in detector (Gotthard)
|
||||||
@ -1836,25 +1847,25 @@ class slsDetector : public virtual slsDetectorDefs {
|
|||||||
*/
|
*/
|
||||||
void setDigitalIODelay(uint64_t pinMask, int delay);
|
void setDigitalIODelay(uint64_t pinMask, int delay);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
int getClockFrequency(int clkIndex);
|
int getClockFrequency(int clkIndex);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockFrequency(int clkIndex, int value);
|
void setClockFrequency(int clkIndex, int value);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
int getClockPhase(int clkIndex, bool inDegrees);
|
int getClockPhase(int clkIndex, bool inDegrees);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockPhase(int clkIndex, int value, bool inDegrees);
|
void setClockPhase(int clkIndex, int value, bool inDegrees);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
int getMaxClockPhaseShift(int clkIndex);
|
int getMaxClockPhaseShift(int clkIndex);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
int getClockDivider(int clkIndex);
|
int getClockDivider(int clkIndex);
|
||||||
|
|
||||||
/** [Gotthard2] */
|
/** [Mythen3][Gotthard2] */
|
||||||
void setClockDivider(int clkIndex, int value);
|
void setClockDivider(int clkIndex, int value);
|
||||||
|
|
||||||
/** [Ctb][Moench] */
|
/** [Ctb][Moench] */
|
||||||
|
@ -598,6 +598,28 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class Gotthard2Data : public GeneralData {
|
||||||
|
public:
|
||||||
|
|
||||||
|
/** Constructor */
|
||||||
|
Gotthard2Data(){
|
||||||
|
myDetectorType = slsDetectorDefs::GOTTHARD2;
|
||||||
|
nPixelsX = 128 * 10;
|
||||||
|
nPixelsY = 1;
|
||||||
|
headerSizeinPacket = sizeof(slsDetectorDefs::sls_detector_header);
|
||||||
|
dataSize = 2560; // 1280 channels * 2 bytes
|
||||||
|
packetSize = headerSizeinPacket + dataSize;
|
||||||
|
packetsPerFrame = 1;
|
||||||
|
imageSize = dataSize * packetsPerFrame;
|
||||||
|
maxFramesPerFile = GOTTHARD2_MAX_FRAMES_PER_FILE;
|
||||||
|
fifoBufferHeaderSize= FIFO_HEADER_NUMBYTES + sizeof(slsDetectorDefs::sls_receiver_header);
|
||||||
|
defaultFifoDepth = 50000;
|
||||||
|
standardheader = true;
|
||||||
|
defaultUdpSocketBufferSize = (1000 * 1024 * 1024);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class ChipTestBoardData : public GeneralData {
|
class ChipTestBoardData : public GeneralData {
|
||||||
private:
|
private:
|
||||||
/** Number of analog channels */
|
/** Number of analog channels */
|
||||||
|
@ -437,6 +437,7 @@ int ClientInterface::set_detector_type(Interface &socket) {
|
|||||||
case MOENCH:
|
case MOENCH:
|
||||||
case JUNGFRAU:
|
case JUNGFRAU:
|
||||||
case MYTHEN3:
|
case MYTHEN3:
|
||||||
|
case GOTTHARD2:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw RuntimeError("Unknown detector type: " + std::to_string(arg));
|
throw RuntimeError("Unknown detector type: " + std::to_string(arg));
|
||||||
@ -581,7 +582,7 @@ int ClientInterface::set_dynamic_range(Interface &socket) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case MYTHEN3:
|
case MYTHEN3:
|
||||||
if (dr == 32) {
|
if (dr == 1 || dr == 4 || dr == 16 || dr == 32) {
|
||||||
exists = true;
|
exists = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -218,6 +218,7 @@ void Implementation::setDetectorType(const detectorType d) {
|
|||||||
case CHIPTESTBOARD:
|
case CHIPTESTBOARD:
|
||||||
case MOENCH:
|
case MOENCH:
|
||||||
case MYTHEN3:
|
case MYTHEN3:
|
||||||
|
case GOTTHARD2:
|
||||||
FILE_LOG(logINFO) << " ***** " << sls::ToString(d)
|
FILE_LOG(logINFO) << " ***** " << sls::ToString(d)
|
||||||
<< " Receiver *****";
|
<< " Receiver *****";
|
||||||
break;
|
break;
|
||||||
@ -245,6 +246,9 @@ void Implementation::setDetectorType(const detectorType d) {
|
|||||||
case MYTHEN3:
|
case MYTHEN3:
|
||||||
generalData = new Mythen3Data();
|
generalData = new Mythen3Data();
|
||||||
break;
|
break;
|
||||||
|
case GOTTHARD2:
|
||||||
|
generalData = new Gotthard2Data();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -204,6 +204,17 @@ inline std::string ToString(const defs::detectorModeType s) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline std::string ToString(const defs::burstModeType s) {
|
||||||
|
switch (s) {
|
||||||
|
case defs::INTERNAL:
|
||||||
|
return std::string("internal");
|
||||||
|
case defs::EXTERNAL:
|
||||||
|
return std::string("external");
|
||||||
|
default:
|
||||||
|
return std::string("Unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// in case we already have a string
|
// in case we already have a string
|
||||||
// causes a copy but might be needed in generic code
|
// causes a copy but might be needed in generic code
|
||||||
inline std::string ToString(const std::string& s) {
|
inline std::string ToString(const std::string& s) {
|
||||||
@ -550,6 +561,16 @@ inline defs::dacIndex StringTo(const std::string& s) {
|
|||||||
throw sls::RuntimeError("Unknown dac Index " + s);
|
throw sls::RuntimeError("Unknown dac Index " + s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
inline defs::burstModeType StringTo(const std::string& s) {
|
||||||
|
if (s == "internal")
|
||||||
|
return defs::INTERNAL;
|
||||||
|
if (s == "external")
|
||||||
|
return defs::EXTERNAL;
|
||||||
|
throw sls::RuntimeError("Unknown burst mode type" + s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** For types with a .str() method use this for conversion */
|
/** For types with a .str() method use this for conversion */
|
||||||
template <typename T>
|
template <typename T>
|
||||||
typename std::enable_if<has_str<T>::value, std::string>::type
|
typename std::enable_if<has_str<T>::value, std::string>::type
|
||||||
|
@ -438,6 +438,14 @@ class slsDetectorDefs {
|
|||||||
ANALOG /** < analog */
|
ANALOG /** < analog */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* burst mode type for gotthard2
|
||||||
|
*/
|
||||||
|
enum burstModeType {
|
||||||
|
INTERNAL,
|
||||||
|
EXTERNAL,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
protected:
|
protected:
|
||||||
|
@ -188,6 +188,8 @@ enum detFuncs{
|
|||||||
F_GET_ADC_ENABLE_MASK_10G,
|
F_GET_ADC_ENABLE_MASK_10G,
|
||||||
F_SET_COUNTER_MASK,
|
F_SET_COUNTER_MASK,
|
||||||
F_GET_COUNTER_MASK,
|
F_GET_COUNTER_MASK,
|
||||||
|
F_SET_BURST_TYPE,
|
||||||
|
F_GET_BURST_TYPE,
|
||||||
NUM_DET_FUNCTIONS,
|
NUM_DET_FUNCTIONS,
|
||||||
|
|
||||||
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
RECEIVER_ENUM_START = 256, /**< detector function should not exceed this (detector server should not compile anyway) */
|
||||||
@ -443,7 +445,8 @@ static const char* getFunctionNameFromEnum(enum detFuncs func) {
|
|||||||
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
case F_GET_ADC_ENABLE_MASK_10G: return "F_GET_ADC_ENABLE_MASK_10G";
|
||||||
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
case F_SET_COUNTER_MASK: return "F_SET_COUNTER_MASK";
|
||||||
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
case F_GET_COUNTER_MASK: return "F_GET_COUNTER_MASK";
|
||||||
|
case F_SET_BURST_TYPE: return "F_SET_BURST_TYPE";
|
||||||
|
case F_GET_BURST_TYPE: return "F_GET_BURST_TYPE";
|
||||||
|
|
||||||
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
case NUM_DET_FUNCTIONS: return "NUM_DET_FUNCTIONS";
|
||||||
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
case RECEIVER_ENUM_START: return "RECEIVER_ENUM_START";
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#define APIRECEIVER 0x190722
|
#define APIRECEIVER 0x190722
|
||||||
#define APIGUI 0x190723
|
#define APIGUI 0x190723
|
||||||
#define APIMOENCH 0x190820
|
#define APIMOENCH 0x190820
|
||||||
#define APIGOTTHARD2 0x191127
|
#define APICTB 0x200122
|
||||||
#define APIGOTTHARD 0x191127
|
#define APIGOTTHARD 0x200122
|
||||||
#define APIJUNGFRAU 0x191127
|
#define APIGOTTHARD2 0x200122
|
||||||
#define APICTB 0x191210
|
#define APIJUNGFRAU 0x200122
|
||||||
#define APIEIGER 0x200121
|
#define APIMYTHEN3 0x200122
|
||||||
#define APIMYTHEN3 0x200121
|
#define APIEIGER 0x200122
|
||||||
|
Loading…
x
Reference in New Issue
Block a user