mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
Merge branch 'developer' into fixtests
This commit is contained in:
Binary file not shown.
@ -470,6 +470,7 @@ void setupDetector() {
|
||||
initReadoutConfiguration();
|
||||
|
||||
// Initialization of acquistion parameters
|
||||
disableCurrentSource();
|
||||
setSettings(DEFAULT_SETTINGS);
|
||||
setGainMode(DEFAULT_GAINMODE);
|
||||
|
||||
@ -499,7 +500,6 @@ void setupDetector() {
|
||||
setFilterResistor(DEFAULT_FILTER_RESISTOR);
|
||||
setFilterCell(DEFAULT_FILTER_CELL);
|
||||
}
|
||||
disableCurrentSource();
|
||||
setReadNRows(MAX_ROWS_PER_READOUT);
|
||||
}
|
||||
|
||||
@ -1106,10 +1106,8 @@ enum detectorSettings setSettings(enum detectorSettings sett) {
|
||||
setDAC(specialDacs[i], dacVals[i], 0);
|
||||
}
|
||||
|
||||
// if chip 1.1, and power chip on, configure chip
|
||||
if (getChipVersion() == 11 && powerChip(-1)) {
|
||||
configureChip();
|
||||
}
|
||||
// if chipv1.1 and powered on
|
||||
configureChip();
|
||||
|
||||
return getSettings();
|
||||
}
|
||||
@ -1726,8 +1724,8 @@ int powerChip(int on) {
|
||||
LOG(logINFOBLUE, ("Powering chip: on\n"));
|
||||
bus_w(CHIP_POWER_REG,
|
||||
bus_r(CHIP_POWER_REG) | CHIP_POWER_ENABLE_MSK);
|
||||
|
||||
configureChip();
|
||||
|
||||
configureChip();
|
||||
} else {
|
||||
LOG(logINFOBLUE, ("Powering chip: off\n"));
|
||||
bus_w(CHIP_POWER_REG,
|
||||
@ -1749,16 +1747,26 @@ int isChipConfigured() {
|
||||
}
|
||||
|
||||
void configureChip() {
|
||||
// only for chipv1.1
|
||||
if (getChipVersion() == 11) {
|
||||
LOG(logINFOBLUE, ("Configuring chip\n"));
|
||||
// only for chipv1.1 and chip is powered on
|
||||
if (getChipVersion() == 11 && powerChip(-1)) {
|
||||
LOG(logINFOBLUE, ("\tConfiguring chip\n"));
|
||||
|
||||
// waiting 500 ms before configuring selection
|
||||
usleep(500 * 1000);
|
||||
|
||||
// write same values to configure selection
|
||||
// if (chip was powered off earlier)
|
||||
LOG(logINFO, ("\tSetting default values for selection\n"))
|
||||
bus_w(CRRNT_SRC_COL_LSB_REG, bus_r(CRRNT_SRC_COL_LSB_REG));
|
||||
bus_w(CRRNT_SRC_COL_MSB_REG, bus_r(CRRNT_SRC_COL_MSB_REG));
|
||||
|
||||
// waiting 500 ms before configuring chip
|
||||
usleep(500 * 1000);
|
||||
|
||||
// write same register values back to configure chip
|
||||
bus_w(CONFIG_V11_REG, bus_r(CONFIG_V11_REG));
|
||||
// default values for current source
|
||||
bus_w(CRRNT_SRC_COL_LSB_REG, BIT32_MASK);
|
||||
bus_w(CRRNT_SRC_COL_MSB_REG, BIT32_MASK);
|
||||
|
||||
LOG(logINFOBLUE, ("\tChip configured\n"));
|
||||
chipConfigured = 1;
|
||||
}
|
||||
}
|
||||
@ -2205,11 +2213,18 @@ void setFilterCell(int iCell) {
|
||||
|
||||
void disableCurrentSource() {
|
||||
LOG(logINFO, ("Disabling Current Source\n"));
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_ENBL_MSK);
|
||||
|
||||
// default values for current source
|
||||
bus_w(CRRNT_SRC_COL_LSB_REG, BIT32_MASK);
|
||||
bus_w(CRRNT_SRC_COL_MSB_REG, BIT32_MASK);
|
||||
// set default values for current source first
|
||||
if (getChipVersion() == 11) {
|
||||
LOG(logINFO, ("\tSetting default values for selection\n"))
|
||||
bus_w(CRRNT_SRC_COL_LSB_REG, BIT32_MASK);
|
||||
bus_w(CRRNT_SRC_COL_MSB_REG, BIT32_MASK);
|
||||
}
|
||||
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_ENBL_MSK);
|
||||
LOG(logINFO, ("\tCurrent Source disabled\n"));
|
||||
|
||||
configureChip();
|
||||
}
|
||||
|
||||
void enableCurrentSource(int fix, uint64_t select, int normal) {
|
||||
@ -2222,15 +2237,17 @@ void enableCurrentSource(int fix, uint64_t select, int normal) {
|
||||
fix, (long long int)select, normal));
|
||||
}
|
||||
disableCurrentSource();
|
||||
LOG(logINFO, ("\tSetting current source parameters\n"));
|
||||
// fix
|
||||
if (fix) {
|
||||
LOG(logINFO, ("\tEnabling fix\n"));
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_CRRNT_SRC_CLMN_FIX_MSK);
|
||||
} else {
|
||||
LOG(logINFO, ("\tDisabling fix\n"));
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_CLMN_FIX_MSK);
|
||||
}
|
||||
if (getChipVersion() == 10) {
|
||||
// select
|
||||
LOG(logINFO, ("\tSetting selection\n"))
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) & ~DAQ_CRRNT_SRC_CLMN_SLCT_MSK);
|
||||
bus_w(DAQ_REG,
|
||||
bus_r(DAQ_REG) | ((select << DAQ_CRRNT_SRC_CLMN_SLCT_OFST) &
|
||||
@ -2238,12 +2255,15 @@ void enableCurrentSource(int fix, uint64_t select, int normal) {
|
||||
|
||||
} else {
|
||||
// select
|
||||
LOG(logINFO, ("\tSetting selection\n"))
|
||||
set64BitReg(select, CRRNT_SRC_COL_LSB_REG, CRRNT_SRC_COL_MSB_REG);
|
||||
// normal
|
||||
if (normal) {
|
||||
LOG(logINFO, ("\tEnabling normal\n"))
|
||||
bus_w(CONFIG_V11_REG,
|
||||
bus_r(CONFIG_V11_REG) & ~CONFIG_V11_CRRNT_SRC_LOW_MSK);
|
||||
} else {
|
||||
LOG(logINFO, ("\tEnabling low\n"))
|
||||
bus_w(CONFIG_V11_REG,
|
||||
bus_r(CONFIG_V11_REG) | CONFIG_V11_CRRNT_SRC_LOW_MSK);
|
||||
}
|
||||
@ -2258,8 +2278,10 @@ void enableCurrentSource(int fix, uint64_t select, int normal) {
|
||||
// acquisition
|
||||
|
||||
// enabling current source
|
||||
LOG(logINFO, ("Enabling Current Source\n"));
|
||||
LOG(logINFO, ("\tEnabling Current Source\n"));
|
||||
bus_w(DAQ_REG, bus_r(DAQ_REG) | DAQ_CRRNT_SRC_ENBL_MSK);
|
||||
|
||||
configureChip();
|
||||
}
|
||||
|
||||
int getCurrentSource() {
|
||||
|
@ -87,7 +87,6 @@ int set_roi(int);
|
||||
int get_roi(int);
|
||||
int lock_server(int);
|
||||
int get_last_client_ip(int);
|
||||
int set_port(int);
|
||||
int calibrate_pedestal(int);
|
||||
int enable_ten_giga(int);
|
||||
int validateAndSetAllTrimbits(int arg);
|
||||
|
@ -230,7 +230,6 @@ void function_table() {
|
||||
flist[F_GET_ROI] = &get_roi;
|
||||
flist[F_LOCK_SERVER] = &lock_server;
|
||||
flist[F_GET_LAST_CLIENT_IP] = &get_last_client_ip;
|
||||
flist[F_SET_PORT] = &set_port;
|
||||
flist[F_ENABLE_TEN_GIGA] = &enable_ten_giga;
|
||||
flist[F_SET_ALL_TRIMBITS] = &set_all_trimbits;
|
||||
flist[F_SET_PATTERN_IO_CONTROL] = &set_pattern_io_control;
|
||||
@ -2880,43 +2879,6 @@ int get_last_client_ip(int file_des) {
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int set_port(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int p_number = -1;
|
||||
uint32_t oldLastClientIP = 0;
|
||||
|
||||
if (receiveData(file_des, &p_number, sizeof(p_number), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// set only
|
||||
int sd = -1;
|
||||
if ((Server_VerifyLock() == OK)) {
|
||||
// port number too low
|
||||
if (p_number < 1024) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "%s port Number (%d) too low\n",
|
||||
(isControlServer ? "control" : "stop"), p_number);
|
||||
LOG(logERROR, (mess));
|
||||
} else {
|
||||
LOG(logINFO, ("Setting %s port to %d\n",
|
||||
(isControlServer ? "control" : "stop"), p_number));
|
||||
oldLastClientIP = lastClientIP;
|
||||
sd = bindSocket(p_number);
|
||||
}
|
||||
}
|
||||
|
||||
Server_SendResult(file_des, INT32, &p_number, sizeof(p_number));
|
||||
// delete old socket
|
||||
if (ret != FAIL) {
|
||||
closeConnection(file_des);
|
||||
exitServer(sockfd);
|
||||
sockfd = sd;
|
||||
lastClientIP = oldLastClientIP;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
int enable_ten_giga(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
Reference in New Issue
Block a user