mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 10:07:59 +02:00
removed gotthard functions not used
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -32,7 +32,6 @@ int detectorFirstServer = 1;
|
||||
int dacValues[NDAC] = {0};
|
||||
enum detectorSettings thisSettings = UNINITIALIZED;
|
||||
enum externalSignalFlag signalMode = 0;
|
||||
int digitalTestBit = 0;
|
||||
|
||||
// roi configuration
|
||||
int adcConfigured = -1;
|
||||
@ -245,12 +244,7 @@ int detectorTest( enum digitalTestMode arg, int ival) {
|
||||
return OK;
|
||||
#endif
|
||||
switch(arg){
|
||||
case DIGITAL_BIT_TEST:
|
||||
if (ival > -1) {
|
||||
digitalTestBit = (ival == 0) ? 0 : 1;
|
||||
FILE_LOG(logINFO, ("Digital Test bit set: %d\n", digitalTestBit));
|
||||
}
|
||||
return digitalTestBit;
|
||||
case IMAGE_TEST: return testImage(ival);
|
||||
case DETECTOR_FIRMWARE_TEST: return testFpga();
|
||||
case DETECTOR_BUS_TEST: return testBus();
|
||||
default:
|
||||
@ -260,6 +254,19 @@ int detectorTest( enum digitalTestMode arg, int ival) {
|
||||
return OK;
|
||||
}
|
||||
|
||||
int testImage(int ival) {
|
||||
uint32_t addr = MULTI_PURPOSE_REG;
|
||||
if (ival >= 0) {
|
||||
if (ival == 0) {
|
||||
FILE_LOG(logINFO, ("Switching on Image Test\n"));
|
||||
bus_w (addr, bus_r(addr) & ~DGTL_TST_MSK);
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("Switching off Image Test\n"));
|
||||
bus_w (addr, bus_r(addr) | DGTL_TST_MSK);
|
||||
}
|
||||
}
|
||||
return ((bus_r(addr) & DGTL_TST_MSK) >> DGTL_TST_OFST);
|
||||
}
|
||||
|
||||
/* Ids */
|
||||
|
||||
@ -1351,13 +1358,6 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t
|
||||
(long long unsigned int)destmac));
|
||||
FILE_LOG(logINFO, ("\tDest. Port : %d (0x%08x)\n",udpport, udpport));
|
||||
|
||||
// set/ unset the digital test bit
|
||||
if (digitalTestBit)
|
||||
bus_w (addr, bus_r(addr) | DGTL_TST_MSK);
|
||||
else
|
||||
bus_w (addr, bus_r(addr) & ~DGTL_TST_MSK);
|
||||
FILE_LOG(logDEBUG1, ("\tDigital Test Bit. MultiPurpose reg: 0x%x\n", bus_r(addr)));
|
||||
|
||||
//reset mac
|
||||
bus_w (addr, bus_r(addr) | RST_MSK);
|
||||
FILE_LOG(logDEBUG1, ("\tReset Mac. MultiPurpose reg: 0x%x\n", bus_r(addr)));
|
||||
@ -1518,107 +1518,6 @@ int getAdcConfigured(){
|
||||
}
|
||||
|
||||
|
||||
/* gotthard specific - loadimage, read/reset counter block */
|
||||
|
||||
void loadImage(enum imageType index, short int imageVals[]){
|
||||
u_int32_t addr = DARK_IMAGE_REG;
|
||||
if (index == GAIN_IMAGE)
|
||||
addr = GAIN_IMAGE_REG;
|
||||
int dataBytes = calculateDataBytes();
|
||||
|
||||
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
|
||||
memcpy((char*)ptr, (char*)imageVals, dataBytes);
|
||||
|
||||
FILE_LOG(logINFO, ("Loaded %s image at 0x%p\n",
|
||||
(index == GAIN_IMAGE) ? "Gain" : "Dark", (void*) ptr));
|
||||
}
|
||||
|
||||
int readCounterBlock(int startACQ, short int counterVals[]){
|
||||
FILE_LOG(logINFO, ("Reading Counter Block with start Acq :%d\n", startACQ));
|
||||
|
||||
// stop any current acquisition
|
||||
if (runBusy()) {
|
||||
if (stopStateMachine() == FAIL)
|
||||
return FAIL;
|
||||
// waiting for the last frame read to be done
|
||||
while(runBusy())
|
||||
usleep(500);
|
||||
FILE_LOG(logDEBUG1, ("State machine stopped\n"));
|
||||
}
|
||||
|
||||
// copy memory
|
||||
u_int32_t addr = COUNTER_MEMORY_REG;
|
||||
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
|
||||
int dataBytes = calculateDataBytes();
|
||||
memcpy((char*)counterVals, (char*)ptr, dataBytes);
|
||||
|
||||
// unreset counter
|
||||
addr = MULTI_PURPOSE_REG;
|
||||
bus_w(addr, (bus_r(addr) &~ RST_CNTR_MSK));
|
||||
FILE_LOG(logDEBUG1, ("\tUnsetting reset Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
|
||||
|
||||
// start state machine
|
||||
if (startACQ == 1){
|
||||
startStateMachine();
|
||||
if (runBusy()) {
|
||||
FILE_LOG(logINFO, ("State machine RUNNING\n"));
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("State machine IDLE\n"));
|
||||
}
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
|
||||
int resetCounterBlock(int startACQ){
|
||||
FILE_LOG(logINFO, ("Resetting Counter Block with start Acq :%d\n", startACQ));
|
||||
|
||||
// stop any current acquisition
|
||||
if (runBusy()) {
|
||||
if (stopStateMachine() == FAIL)
|
||||
return FAIL;
|
||||
// waiting for the last frame read to be done
|
||||
while(runBusy())
|
||||
usleep(500);
|
||||
FILE_LOG(logDEBUG1, ("State machine stopped\n"));
|
||||
}
|
||||
|
||||
// reset counter
|
||||
u_int32_t addr = MULTI_PURPOSE_REG;
|
||||
bus_w(addr, (bus_r(addr) | RST_CNTR_MSK));
|
||||
FILE_LOG(logDEBUG1, ("\tResetting Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
|
||||
|
||||
// copy memory
|
||||
addr = COUNTER_MEMORY_REG;
|
||||
volatile u_int16_t *ptr = (u_int16_t*)(CSP0BASE + addr * 2);
|
||||
int dataBytes = calculateDataBytes();
|
||||
char *counterVals = NULL;
|
||||
counterVals = realloc(counterVals, dataBytes);
|
||||
memcpy((char*)counterVals, (char*)ptr, dataBytes);
|
||||
|
||||
// unreset counter
|
||||
addr = MULTI_PURPOSE_REG;
|
||||
bus_w(addr, (bus_r(addr) &~ RST_CNTR_MSK));
|
||||
FILE_LOG(logDEBUG1, ("\tUnsetting reset Counter. Multi Purpose Reg: 0x%x\n", bus_r(addr)));
|
||||
|
||||
// start state machine
|
||||
if (startACQ == 1){
|
||||
startStateMachine();
|
||||
if (runBusy()) {
|
||||
FILE_LOG(logINFO, ("State machine RUNNING\n"));
|
||||
} else {
|
||||
FILE_LOG(logINFO, ("State machine IDLE\n"));
|
||||
}
|
||||
}
|
||||
|
||||
if (sizeof(counterVals) <= 0){
|
||||
FILE_LOG(logERROR, ("\tSize of counterVals: %d\n", (int)sizeof(counterVals)));
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
||||
/* aquisition */
|
||||
|
||||
int startStateMachine(){
|
||||
|
Binary file not shown.
@ -27,6 +27,7 @@ int testBus();
|
||||
|
||||
#ifdef GOTTHARDD
|
||||
int detectorTest(enum digitalTestMode arg, int ival);
|
||||
int testImage(int ival);
|
||||
#elif defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD)
|
||||
int detectorTest(enum digitalTestMode arg);
|
||||
#endif
|
||||
@ -301,14 +302,8 @@ void setPatternBitMask(uint64_t mask);
|
||||
uint64_t getPatternBitMask();
|
||||
#endif
|
||||
|
||||
// gotthard specific - image, pedestal
|
||||
#ifdef GOTTHARDD
|
||||
void loadImage(enum imageType index, short int imageVals[]);
|
||||
int readCounterBlock(int startACQ, short int counterVals[]);
|
||||
int resetCounterBlock(int startACQ);
|
||||
|
||||
// jungfrau specific - powerchip, autocompdisable, clockdiv, asictimer, clock, pll, flashing firmware
|
||||
#elif JUNGFRAUD
|
||||
#ifdef JUNGFRAUD
|
||||
void initReadoutConfiguration();
|
||||
int powerChip (int on);
|
||||
int autoCompDisable(int on);
|
||||
|
@ -197,9 +197,6 @@ const char* getFunctionName(enum detFuncs func) {
|
||||
case F_SET_PORT: return "F_SET_PORT";
|
||||
case F_UPDATE_CLIENT: return "F_UPDATE_CLIENT";
|
||||
case F_CONFIGURE_MAC: return "F_CONFIGURE_MAC";
|
||||
case F_LOAD_IMAGE: return "F_LOAD_IMAGE";
|
||||
case F_READ_COUNTER_BLOCK: return "F_READ_COUNTER_BLOCK";
|
||||
case F_RESET_COUNTER_BLOCK: return "F_RESET_COUNTER_BLOCK";
|
||||
case F_ENABLE_TEN_GIGA: return "F_ENABLE_TEN_GIGA";
|
||||
case F_SET_ALL_TRIMBITS: return "F_SET_ALL_TRIMBITS";
|
||||
case F_SET_PATTERN_IO_CONTROL: return "F_SET_PATTERN_IO_CONTROL";
|
||||
@ -288,9 +285,6 @@ void function_table() {
|
||||
flist[F_SET_PORT] = &set_port;
|
||||
flist[F_UPDATE_CLIENT] = &update_client;
|
||||
flist[F_CONFIGURE_MAC] = &configure_mac;
|
||||
flist[F_LOAD_IMAGE] = &load_image;
|
||||
flist[F_READ_COUNTER_BLOCK] = &read_counter_block;
|
||||
flist[F_RESET_COUNTER_BLOCK] = &reset_counter_block;
|
||||
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;
|
||||
@ -619,7 +613,7 @@ int digital_test(int file_des) {
|
||||
case DETECTOR_FIRMWARE_TEST:
|
||||
case DETECTOR_BUS_TEST:
|
||||
#ifdef GOTTHARDD
|
||||
case DIGITAL_BIT_TEST:
|
||||
case IMAGE_TEST:
|
||||
retval = detectorTest(mode, ival);
|
||||
break;
|
||||
#else
|
||||
@ -2498,131 +2492,6 @@ int configure_mac(int file_des) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int load_image(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int args[2] = {-1, -1};
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
enum imageType index = args[0];
|
||||
int numChannels = args[1];
|
||||
short int imageVals[numChannels];
|
||||
memset(imageVals, 0, numChannels * sizeof(short int));
|
||||
if (numChannels > 0) {
|
||||
if (receiveData(file_des, imageVals, numChannels * sizeof(short int), OTHER) < 0) {
|
||||
return printSocketReadError();
|
||||
}
|
||||
}
|
||||
FILE_LOG(logDEBUG1, ("Loading %s image (ind:%d)\n", (index == DARK_IMAGE) ? "dark" :
|
||||
((index == GAIN_IMAGE) ? "gain" : "unknown"), index));
|
||||
|
||||
#ifndef GOTTHARDD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
|
||||
// set only
|
||||
if (Server_VerifyLock() == OK) {
|
||||
switch (index) {
|
||||
case DARK_IMAGE :
|
||||
case GAIN_IMAGE :
|
||||
// size of image does not match expected size
|
||||
if (numChannels != (calculateDataBytes()/sizeof(short int))) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not load image. "
|
||||
"Number of Channels do not match. Expected %d, got %d\n",
|
||||
calculateDataBytes(), numChannels);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else
|
||||
loadImage(index, imageVals);
|
||||
break;
|
||||
default:
|
||||
modeNotImplemented("Image index", (int)index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int read_counter_block(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int args[2] = {-1, -1};
|
||||
|
||||
if (receiveData(file_des, args, sizeof(args), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
int startACQ = args[0];
|
||||
int numChannels = args[1];
|
||||
short int retval[numChannels];
|
||||
memset(retval, 0, numChannels * sizeof(short int));
|
||||
FILE_LOG(logDEBUG1, ("Read counter block with start acq bit: %d\n", startACQ));
|
||||
|
||||
#ifndef GOTTHARDD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
// size of image does not match expected size
|
||||
if (numChannels != (calculateDataBytes()/sizeof(short int))) {
|
||||
ret = FAIL;
|
||||
sprintf(mess, "Could not load image. "
|
||||
"Number of Channels do not match. Expected %d, got %d\n",
|
||||
calculateDataBytes(), numChannels);
|
||||
FILE_LOG(logERROR,(mess));
|
||||
} else {
|
||||
ret = readCounterBlock(startACQ, retval);
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess, "Could not read counter block\n");
|
||||
FILE_LOG(logERROR,(mess));
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, OTHER, UPDATE, retval, numChannels * sizeof(short int));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int reset_counter_block(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int startACQ = -1;
|
||||
|
||||
if (receiveData(file_des, &startACQ, sizeof(startACQ), INT32) < 0)
|
||||
return printSocketReadError();
|
||||
FILE_LOG(logDEBUG1, ("Reset counter block with start acq bit: %d\n", startACQ));
|
||||
|
||||
#ifndef GOTTHARDD
|
||||
functionNotImplemented();
|
||||
#else
|
||||
// only set
|
||||
if (Server_VerifyLock() == OK) {
|
||||
ret = resetCounterBlock(startACQ);
|
||||
if (ret == FAIL) {
|
||||
strcpy(mess, "Could not reset counter block\n");
|
||||
FILE_LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return Server_SendResult(file_des, INT32, UPDATE, NULL, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int enable_ten_giga(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
|
@ -58,9 +58,6 @@ int set_port(int);
|
||||
int update_client(int);
|
||||
int send_update(int);
|
||||
int configure_mac(int);
|
||||
int load_image(int);
|
||||
int read_counter_block(int);
|
||||
int reset_counter_block(int);
|
||||
int calibrate_pedestal(int);
|
||||
int enable_ten_giga(int);
|
||||
int set_all_trimbits(int);
|
||||
|
Reference in New Issue
Block a user