mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-24 23:30:03 +02:00
fix in ltc, added moench, separated servers, left to do max1932, client side for moench and more detailed in ctb server side
This commit is contained in:
parent
89d9204e1c
commit
f161d68efc
@ -122,7 +122,7 @@ void qDrawPlot::SetupWidgetWindow(){
|
||||
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
|
||||
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
|
||||
if (detType == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25;// for moench 03
|
||||
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES, -1) * 2)/25;// for moench 03
|
||||
nPixelsX = npixelsx_jctb;
|
||||
nPixelsY = npixelsy_jctb;
|
||||
}
|
||||
@ -586,7 +586,7 @@ void qDrawPlot::SetScanArgument(int scanArg){
|
||||
nPixelsX = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::X);
|
||||
nPixelsY = myDet->getTotalNumberOfChannelsInclGapPixels(slsDetectorDefs::Y);
|
||||
if (detType == slsDetectorDefs::CHIPTESTBOARD) {
|
||||
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES_JCTB, -1) * 2)/25; // for moench 03
|
||||
npixelsy_jctb = (myDet->setTimer(slsDetectorDefs::SAMPLES, -1) * 2)/25; // for moench 03
|
||||
nPixelsX = npixelsx_jctb;
|
||||
nPixelsY = npixelsy_jctb;
|
||||
}
|
||||
|
@ -1,11 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
/* Definitions for FPGA */
|
||||
#ifdef JCTB
|
||||
#define MEM_MAP_SHIFT 11
|
||||
#else
|
||||
#define MEM_MAP_SHIFT 1
|
||||
#endif
|
||||
|
||||
/* FPGA Version RO register */
|
||||
#define FPGA_VERSION_REG (0x00 << MEM_MAP_SHIFT)
|
||||
@ -14,7 +10,6 @@
|
||||
#define FPGA_VERSION_BRD_RVSN_MSK (0x00FFFFFF << FPGA_VERSION_BRD_RVSN_OFST)
|
||||
#define FPGA_VERSION_DTCTR_TYP_OFST (24)
|
||||
#define FPGA_VERSION_DTCTR_TYP_MSK (0x000000FF << FPGA_VERSION_DTCTR_TYP_OFST)
|
||||
#define FPGA_VERSION_DTCTR_TYP_JCTB_VAL ((0x2 << FPGA_VERSION_DTCTR_TYP_OFST) & FPGA_VERSION_DTCTR_TYP_MSK)
|
||||
#define FPGA_VERSION_DTCTR_TYP_CTB_VAL ((0x3 << FPGA_VERSION_DTCTR_TYP_OFST) & FPGA_VERSION_DTCTR_TYP_MSK)
|
||||
|
||||
/* Fix pattern RO register */
|
||||
|
@ -64,7 +64,7 @@ void basictests() {
|
||||
firmware_check_done = 0;
|
||||
memset(firmware_message, 0, MAX_STR_LENGTH);
|
||||
#ifdef VIRTUAL
|
||||
FILE_LOG(logINFOBLUE, ("******** %s Virtual Server *****************\n", DETNAME));
|
||||
FILE_LOG(logINFOBLUE, ("******** Chip Test Board Virtual Server *****************\n"));
|
||||
if (mapCSP0() == FAIL) {
|
||||
strcpy(firmware_message,
|
||||
"Could not map to memory. Dangerous to continue.\n");
|
||||
@ -110,7 +110,7 @@ void basictests() {
|
||||
|
||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
||||
sw_fw_apiversion = getDetectorId(SOFTWARE_FIRMWARE_API_VERSION);
|
||||
FILE_LOG(logINFOBLUE, ("************ %s Server *********************\n"
|
||||
FILE_LOG(logINFOBLUE, ("************ Chip Test Board Server *********************\n"
|
||||
"Hardware Version:\t\t 0x%x\n"
|
||||
"Hardware Serial Nr:\t\t 0x%x\n"
|
||||
|
||||
@ -123,7 +123,6 @@ void basictests() {
|
||||
"Required Firmware Version:\t 0x%x\n"
|
||||
"Client-Software API Version:\t 0x%llx\n"
|
||||
"********************************************************\n",
|
||||
DETNAME,
|
||||
hversion, hsnumber,
|
||||
ipadd,
|
||||
(long long unsigned int)macadd,
|
||||
@ -189,13 +188,10 @@ int checkType() {
|
||||
uint32_t type = ((bus_r(FPGA_VERSION_REG) & FPGA_VERSION_DTCTR_TYP_MSK) >> FPGA_VERSION_DTCTR_TYP_OFST);
|
||||
|
||||
uint32_t expectedType = FPGA_VERSION_DTCTR_TYP_CTB_VAL;
|
||||
#ifdef JCTB
|
||||
expectedType = FPGA_VERSION_DTCTR_TYP_JCTB_VAL;
|
||||
#endif
|
||||
|
||||
if (type != expectedType) {
|
||||
FILE_LOG(logERROR, ("This is not a %s Server (read %d, expected %d)\n",
|
||||
DETNAME, type, expectedType));
|
||||
FILE_LOG(logERROR, ("This is not a Chip Test Board Server (read %d, expected %d)\n",
|
||||
type, expectedType));
|
||||
return FAIL;
|
||||
}
|
||||
return OK;
|
||||
@ -529,7 +525,7 @@ void setupDetector() {
|
||||
resetCore();
|
||||
|
||||
//Initialization of acquistion parameters
|
||||
setTimer(SAMPLES_JCTB, DEFAULT_NUM_SAMPLES); // update databytes and allocate ram
|
||||
setTimer(SAMPLES, DEFAULT_NUM_SAMPLES); // update databytes and allocate ram
|
||||
setTimer(FRAME_NUMBER, DEFAULT_NUM_FRAMES);
|
||||
setTimer(CYCLES_NUMBER, DEFAULT_NUM_CYCLES);
|
||||
setTimer(FRAME_PERIOD, DEFAULT_PERIOD);
|
||||
@ -937,7 +933,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) {
|
||||
FILE_LOG(logDEBUG1, ("Getting #cycles: %lld\n", (long long int)retval));
|
||||
break;
|
||||
|
||||
case SAMPLES_JCTB:
|
||||
case SAMPLES:
|
||||
if(val >= 0) {
|
||||
FILE_LOG(logINFO, ("Setting #samples: %lld\n", (long long int)val));
|
||||
nSamples = val;
|
||||
|
@ -10,12 +10,6 @@
|
||||
#define PROGRAMMING_MODE (0x2)
|
||||
#define CTRL_SRVR_INIT_TIME_US (300 * 1000)
|
||||
|
||||
#ifdef JCTB
|
||||
#define DETNAME = "Jungfrau Chip Test Board";
|
||||
#else
|
||||
#define DETNAME = "Chip Test Board";
|
||||
#endif
|
||||
|
||||
/* Struct Definitions */
|
||||
typedef struct ip_header_struct {
|
||||
uint16_t ip_len;
|
||||
@ -86,11 +80,7 @@ enum DACINDEX {D0, D1, D2, D3, D4, D5, D6, D7, D8, D9,
|
||||
#define VCHIP_POWER_INCRMNT (200)
|
||||
|
||||
#define IP_PACKETSIZE (0x2032)
|
||||
#ifndef JCTB
|
||||
#define ADC_PORT_INVERT_VAL (0x453b2593)
|
||||
#else
|
||||
#define ADC_PORT_INVERT_VAL (0x453b2593)
|
||||
#endif
|
||||
#define MAXIMUM_ADC_CLK (40)
|
||||
#define PLL_VCO_FREQ_MHZ (400)
|
||||
|
||||
|
@ -123,7 +123,7 @@ int LTC2620_VoltageToDac(int voltage, int* dacval) {
|
||||
* @returns FAIL when voltage outside limits, OK if conversion successful
|
||||
*/
|
||||
int LTC2620_DacToVoltage(int dacval, int* voltage) {
|
||||
return Common_VoltageToDac(dacval, voltage, LTC2620_MIN_MV, LTC2620_MaxMV, LTC2620_MAX_STEPS);
|
||||
return Common_DacToVoltage(dacval, voltage, LTC2620_MIN_MV, LTC2620_MaxMV, LTC2620_MAX_STEPS);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,11 +147,11 @@ void LTC2620_Configure(){
|
||||
|
||||
|
||||
/**
|
||||
* Set Dac value (obtains dacaddr, command and ichip and calls LTC2620_Set)
|
||||
* Set Dac (obtains dacaddr, command and ichip and calls LTC2620_Set)
|
||||
* @param dacnum dac number
|
||||
* @param data dac value to set
|
||||
*/
|
||||
void LTC2620_SetDACValue (int dacnum, int data) {
|
||||
void LTC2620_SetDAC (int dacnum, int data) {
|
||||
FILE_LOG(logDEBUG1, ("\tSetting dac %d to %d\n", dacnum, data));
|
||||
// LTC2620 index
|
||||
int ichip = dacnum / LTC2620_NUMCHANNELS;
|
||||
|
@ -16,6 +16,8 @@ const enum detectorType myDetectorType = EIGER;
|
||||
const enum detectorType myDetectorType = JUNGFRAU;
|
||||
#elif CHIPTESTBOARDD
|
||||
const enum detectorType myDetectorType = CHIPTESTBOARD;
|
||||
#elif MOENCHD
|
||||
const enum detectorType myDetectorType = MOENCH;
|
||||
#else
|
||||
const enum detectorType myDetectorType = GENERIC;
|
||||
#endif
|
||||
@ -33,7 +35,7 @@ extern char mess[MAX_STR_LENGTH];
|
||||
// Variables that will be exported
|
||||
int sockfd = 0;
|
||||
int debugflag = 0;
|
||||
#ifdef CHIPTESTBOARDD
|
||||
#if defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
int dataBytes = 0;
|
||||
uint16_t *ramValues = 0;
|
||||
int nframes = 0;
|
||||
@ -131,7 +133,7 @@ const char* getTimerName(enum timerIndex ind) {
|
||||
case MEASUREMENTS_NUMBER: return "measurements_number";
|
||||
case FRAMES_FROM_START: return "frames_from_start";
|
||||
case FRAMES_FROM_START_PG: return "frames_from_start_pg";
|
||||
case SAMPLES_JCTB: return "samples_jctb";
|
||||
case SAMPLES: return "samples";
|
||||
case SUBFRAME_ACQUISITION_TIME: return "subframe_acquisition_time";
|
||||
case SUBFRAME_DEADTIME: return "subframe_deadtime";
|
||||
case STORAGE_CELL_NUMBER: return "storage_cell_number";
|
||||
@ -1509,7 +1511,7 @@ int set_timer(int file_des) {
|
||||
#endif
|
||||
case FRAME_PERIOD:
|
||||
case CYCLES_NUMBER:
|
||||
case SAMPLES_JCTB:
|
||||
case SAMPLES:
|
||||
#if defined(GOTTHARDD) || defined(JUNGFRAUD) || defined(CHIPTESTBOARDD)
|
||||
case DELAY_AFTER_TRIGGER:
|
||||
#endif
|
||||
@ -1568,7 +1570,7 @@ int set_timer(int file_des) {
|
||||
case STORAGE_CELL_NUMBER:
|
||||
validate64(tns, retval, vtimerName, DEC); // no conversion, so all good
|
||||
break;
|
||||
case SAMPLES_JCTB:
|
||||
case SAMPLES:
|
||||
if (retval == -1) {
|
||||
ret = FAIL;
|
||||
retval = setTimer(ind, -1);
|
||||
|
@ -1176,7 +1176,7 @@ int64_t multiSlsDetector::setTimer(timerIndex index, int64_t t, int detPos) {
|
||||
auto r = parallelCall(&slsDetector::setTimer, index, t);
|
||||
int64_t ret = sls::minusOneIfDifferent(r);
|
||||
|
||||
if (index == SAMPLES_JCTB)
|
||||
if (index == SAMPLES)
|
||||
setDynamicRange();
|
||||
|
||||
// set progress
|
||||
|
@ -413,7 +413,7 @@ void slsDetector::initializeDetectorStructure(detectorType type) {
|
||||
thisDetector->timerValue[MEASUREMENTS_NUMBER] = 1;
|
||||
thisDetector->timerValue[FRAMES_FROM_START] = 0;
|
||||
thisDetector->timerValue[FRAMES_FROM_START_PG] = 0;
|
||||
thisDetector->timerValue[SAMPLES_JCTB] = 1;
|
||||
thisDetector->timerValue[SAMPLES] = 1;
|
||||
thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME] = 0;
|
||||
thisDetector->timerValue[STORAGE_CELL_NUMBER] = 0;
|
||||
thisDetector->timerValue[SUBFRAME_DEADTIME] = 0;
|
||||
@ -903,7 +903,7 @@ int slsDetector::getTotalNumberOfChannels() {
|
||||
}
|
||||
thisDetector->nChans = thisDetector->nChan[X];
|
||||
thisDetector->dataBytes = thisDetector->nChans * thisDetector->nChips * 2
|
||||
* thisDetector->timerValue[SAMPLES_JCTB];
|
||||
* thisDetector->timerValue[SAMPLES];
|
||||
}
|
||||
|
||||
FILE_LOG(logDEBUG1) << "Total number of channels: " <<
|
||||
@ -1408,7 +1408,7 @@ int slsDetector::updateDetectorNoWait() {
|
||||
if (thisDetector->myDetectorType == CHIPTESTBOARD) {
|
||||
n += controlSocket->ReceiveDataOnly(&i64, sizeof(i64));
|
||||
if (i64 >= 0)
|
||||
thisDetector->timerValue[SAMPLES_JCTB] = i64;
|
||||
thisDetector->timerValue[SAMPLES] = i64;
|
||||
|
||||
n += controlSocket->ReceiveDataOnly(&i32, sizeof(i32));
|
||||
thisDetector->roFlags = (readOutFlags)i32;
|
||||
@ -2253,7 +2253,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
||||
if (oldtimer != thisDetector->timerValue[index]) {
|
||||
// jctb: change samples, change databytes
|
||||
if (thisDetector->myDetectorType == CHIPTESTBOARD) {
|
||||
if (index == SAMPLES_JCTB) {
|
||||
if (index == SAMPLES) {
|
||||
setDynamicRange();
|
||||
FILE_LOG(logINFO) << "Changing samples: data size = " << thisDetector->dataBytes;
|
||||
}
|
||||
@ -2279,7 +2279,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
||||
case ACQUISITION_TIME:
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
case SUBFRAME_DEADTIME:
|
||||
case SAMPLES_JCTB:
|
||||
case SAMPLES:
|
||||
case STORAGE_CELL_NUMBER:
|
||||
// send
|
||||
fnum = F_SET_RECEIVER_TIMER;
|
||||
@ -2318,7 +2318,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) {
|
||||
break;
|
||||
case SUBFRAME_ACQUISITION_TIME:
|
||||
case SUBFRAME_DEADTIME:
|
||||
case SAMPLES_JCTB:
|
||||
case SAMPLES:
|
||||
setErrorMask((getErrorMask())|(RECEIVER_TIMER_NOT_SET));
|
||||
break;
|
||||
case FRAME_NUMBER:
|
||||
@ -2950,7 +2950,7 @@ std::string slsDetector::setReceiver(std::string receiverIP) {
|
||||
"\nframe number:" << (thisDetector->timerValue[FRAME_NUMBER]) <<
|
||||
"\nsub exp time:" << (thisDetector->timerValue[SUBFRAME_ACQUISITION_TIME]) <<
|
||||
"\nsub dead time:" << (thisDetector->timerValue[SUBFRAME_DEADTIME]) <<
|
||||
"\nsamples:" << (thisDetector->timerValue[SAMPLES_JCTB]) <<
|
||||
"\nsamples:" << (thisDetector->timerValue[SAMPLES]) <<
|
||||
"\ndynamic range:" << thisDetector->dynamicRange <<
|
||||
"\nflippeddatax:" << (thisDetector->flippedData[X]) <<
|
||||
"\nactivated: " << thisDetector->activated <<
|
||||
@ -2987,7 +2987,7 @@ std::string slsDetector::setReceiver(std::string receiverIP) {
|
||||
setTimer(SUBFRAME_DEADTIME,thisDetector->timerValue[SUBFRAME_DEADTIME]);
|
||||
}
|
||||
if (thisDetector->myDetectorType == CHIPTESTBOARD)
|
||||
setTimer(SAMPLES_JCTB,thisDetector->timerValue[SAMPLES_JCTB]);
|
||||
setTimer(SAMPLES,thisDetector->timerValue[SAMPLES]);
|
||||
setDynamicRange(thisDetector->dynamicRange);
|
||||
if (thisDetector->myDetectorType == EIGER) {
|
||||
setFlippedData(X,-1);
|
||||
|
@ -4253,7 +4253,7 @@ std::string slsDetectorCommand::cmdTimer(int narg, char *args[], int action, int
|
||||
else if (cmd == "measurements")
|
||||
index = MEASUREMENTS_NUMBER;
|
||||
else if (cmd == "samples")
|
||||
index = SAMPLES_JCTB;
|
||||
index = SAMPLES;
|
||||
else if (cmd == "storagecells")
|
||||
index = STORAGE_CELL_NUMBER;
|
||||
else if (cmd == "storagecell_start") {
|
||||
|
@ -803,7 +803,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
case SUBFRAME_DEADTIME:
|
||||
receiver->setSubPeriod(index[1] + receiver->getSubExpTime());
|
||||
break;
|
||||
case SAMPLES_JCTB:
|
||||
case SAMPLES:
|
||||
if (myDetectorType != CHIPTESTBOARD) {
|
||||
modeNotImplemented("(Samples) Timer index", (int)index[0]);
|
||||
break;
|
||||
@ -835,7 +835,7 @@ int slsReceiverTCPIPInterface::set_timer() {
|
||||
case SUBFRAME_DEADTIME:
|
||||
retval=(receiver->getSubPeriod() - receiver->getSubExpTime());
|
||||
break;
|
||||
case SAMPLES_JCTB:
|
||||
case SAMPLES:
|
||||
if (myDetectorType != CHIPTESTBOARD) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,"This timer mode (%lld) does not exist for this receiver type\n", (long long int)index[0]);
|
||||
|
@ -86,7 +86,8 @@ public:
|
||||
EIGER, /**< eiger */
|
||||
GOTTHARD, /**< gotthard */
|
||||
JUNGFRAU, /**< jungfrau */
|
||||
CHIPTESTBOARD /**< CTB */
|
||||
CHIPTESTBOARD, /**< CTB */
|
||||
MOENCH /**< moench */
|
||||
};
|
||||
|
||||
|
||||
@ -117,7 +118,7 @@ public:
|
||||
MEASUREMENTS_NUMBER,
|
||||
FRAMES_FROM_START,
|
||||
FRAMES_FROM_START_PG,
|
||||
SAMPLES_JCTB,
|
||||
SAMPLES,
|
||||
SUBFRAME_ACQUISITION_TIME, /**< subframe exposure time */
|
||||
STORAGE_CELL_NUMBER, /**<number of storage cells */
|
||||
SUBFRAME_DEADTIME, /**< subframe deadtime */
|
||||
@ -787,8 +788,8 @@ public:
|
||||
}};
|
||||
|
||||
/** returns std::string from timer index
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES_JCTB,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_DEADTIME
|
||||
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples_jctb,subframe_acquisition_time,storage_cell_number, SUBFRAME_DEADTIME
|
||||
\param s can be FRAME_NUMBER,ACQUISITION_TIME,FRAME_PERIOD, DELAY_AFTER_TRIGGER,GATES_NUMBER, CYCLES_NUMBER, ACTUAL_TIME,MEASUREMENT_TIME, PROGRESS,MEASUREMENTS_NUMBER,FRAMES_FROM_START,FRAMES_FROM_START_PG,SAMPLES,SUBFRAME_ACQUISITION_TIME,STORAGE_CELL_NUMBER, SUBFRAME_DEADTIME
|
||||
\returns std::string frame_number,acquisition_time,frame_period, delay_after_trigger,gates_number, cycles_number, actual_time,measurement_time, progress,measurements_number,frames_from_start,frames_from_start_pg,samples,subframe_acquisition_time,storage_cell_number, SUBFRAME_DEADTIME
|
||||
*/
|
||||
static std::string getTimerType(timerIndex t){ \
|
||||
switch (t) { \
|
||||
@ -804,7 +805,7 @@ public:
|
||||
case MEASUREMENTS_NUMBER: return std::string("measurements_number"); \
|
||||
case FRAMES_FROM_START: return std::string("frames_from_start"); \
|
||||
case FRAMES_FROM_START_PG: return std::string("frames_from_start_pg"); \
|
||||
case SAMPLES_JCTB: return std::string("samples_jctb"); \
|
||||
case SAMPLES: return std::string("samples"); \
|
||||
case SUBFRAME_ACQUISITION_TIME: return std::string("subframe_acquisition_time"); \
|
||||
case SUBFRAME_DEADTIME: return std::string("subframe_deadtime"); \
|
||||
case STORAGE_CELL_NUMBER: return std::string("storage_cell_number"); \
|
||||
|
@ -4,4 +4,5 @@
|
||||
#define APIJUNGFRAU 0x181102
|
||||
#define APIGOTTHARD 0x181009
|
||||
#define APICTB 0x180101
|
||||
#define APIMOENCH 0x180101
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user