readnlines->partialread, better debugging for TCP socket interface bug

This commit is contained in:
2021-08-13 12:34:50 +02:00
parent eb652557b6
commit 62d697e91f
35 changed files with 131 additions and 119 deletions

View File

@ -409,8 +409,8 @@ int setQuad(int value);
int getQuad();
int setInterruptSubframe(int value);
int getInterruptSubframe();
int setReadNLines(int value);
int getReadNLines();
int setPartialReadout(int value);
int getPartialReadout();
#endif
#if defined(CHIPTESTBOARDD) || defined(MOENCHD) || defined(EIGERD) || \
defined(MYTHEN3D)

View File

@ -144,8 +144,8 @@ int set_quad(int);
int get_quad(int);
int set_interrupt_subframe(int);
int get_interrupt_subframe(int);
int set_read_n_lines(int);
int get_read_n_lines(int);
int set_partial_readout(int);
int get_partial_readout(int);
void calculate_and_set_position();
int set_detector_position(int);
int check_detector_idle();

View File

@ -273,8 +273,8 @@ void function_table() {
flist[F_GET_QUAD] = &get_quad;
flist[F_SET_INTERRUPT_SUBFRAME] = &set_interrupt_subframe;
flist[F_GET_INTERRUPT_SUBFRAME] = &get_interrupt_subframe;
flist[F_SET_READ_N_LINES] = &set_read_n_lines;
flist[F_GET_READ_N_LINES] = &get_read_n_lines;
flist[F_SET_PARTIAL_READOUT] = &set_partial_readout;
flist[F_GET_PARTIAL_READOUT] = &get_partial_readout;
flist[F_SET_POSITION] = &set_detector_position;
flist[F_SET_SOURCE_UDP_MAC] = &set_source_udp_mac;
flist[F_GET_SOURCE_UDP_MAC] = &get_source_udp_mac;
@ -4717,14 +4717,14 @@ int get_interrupt_subframe(int file_des) {
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
}
int set_read_n_lines(int file_des) {
int set_partial_readout(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int arg = 0;
if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0)
return printSocketReadError();
LOG(logINFO, ("Setting read n lines: %u\n", arg));
LOG(logDEBUG1, ("Setting partial readout: %u\n", arg));
#ifndef EIGERD
functionNotImplemented();
@ -4734,7 +4734,7 @@ int set_read_n_lines(int file_des) {
if (arg <= 0 || arg > MAX_ROWS_PER_READOUT) {
ret = FAIL;
sprintf(mess,
"Could not set number of lines readout. Must be between 1 "
"Could not set partial readout. Must be between 1 "
"and %d\n",
MAX_ROWS_PER_READOUT);
LOG(logERROR, (mess));
@ -4746,24 +4746,24 @@ int set_read_n_lines(int file_des) {
if ((arg * maxnp) % maxnl) {
ret = FAIL;
sprintf(mess,
"Could not set %d number of lines readout. For %d bit "
"Could not set %d partial readout. For %d bit "
"mode and 10 giga %s, (%d (num "
"lines) x %d (max num packets for this mode)) must be "
"rows) x %d (max num packets for this mode)) must be "
"divisible by %d\n",
arg, dr, isTenGiga ? "enabled" : "disabled", arg, maxnp,
maxnl);
LOG(logERROR, (mess));
} else {
if (setReadNLines(arg) == FAIL) {
if (setPartialReadout(arg) == FAIL) {
ret = FAIL;
sprintf(mess, "Could not set read n lines to %d.\n", arg);
sprintf(mess, "Could not set partial readout to %d.\n", arg);
LOG(logERROR, (mess));
} else {
int retval = getReadNLines();
int retval = getPartialReadout();
if (arg != retval) {
ret = FAIL;
sprintf(mess,
"Could not set read n lines. Set %d, but "
"Could not set partial readout. Set %d, but "
"read %d\n",
retval, arg);
LOG(logERROR, (mess));
@ -4776,24 +4776,24 @@ int set_read_n_lines(int file_des) {
return Server_SendResult(file_des, INT32, NULL, 0);
}
int get_read_n_lines(int file_des) {
int get_partial_readout(int file_des) {
ret = OK;
memset(mess, 0, sizeof(mess));
int retval = -1;
LOG(logDEBUG1, ("Getting read n lines\n"));
LOG(logDEBUG1, ("Getting partial readout\n"));
#ifndef EIGERD
functionNotImplemented();
#else
// get only
retval = getReadNLines();
retval = getPartialReadout();
if (retval == -1) {
ret = FAIL;
sprintf(mess, "Could not get read n lines. \n");
sprintf(mess, "Could not get partial readout. \n");
LOG(logERROR, (mess));
} else {
LOG(logDEBUG1, ("Read N Lines retval: %u\n", retval));
LOG(logDEBUG1, ("Partial readout retval: %u\n", retval));
}
#endif
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
@ -7126,9 +7126,9 @@ int get_receiver_parameters(int file_des) {
if (n < 0)
return printSocketReadError();
// readnlines
// partialReadout
#ifdef EIGERD
i32 = getReadNLines();
i32 = getPartialReadout();
#else
i32 = 0;
#endif