break;// frame sent OK, nothing to do (TODO: check file length/duration)
break;// frame sent OK, nothing to do (TODO: check file length/duration)
...
@@ -1714,7 +1716,7 @@ int listener_loop(camogm_state *state)
...
@@ -1714,7 +1716,7 @@ int listener_loop(camogm_state *state)
// we'll wait for a frame, not to waste resources. But if the compressor is stopped this program will not respond to any commands
// we'll wait for a frame, not to waste resources. But if the compressor is stopped this program will not respond to any commands
// TODO - add another wait with (short) timeout?
// TODO - add another wait with (short) timeout?
wait_frame_sync(state->fd_fparmsall[curr_port]);
wait_frame_sync(state->fd_fparmsall[curr_port]);
D6(fprintf(debug_file,"No compressed frame ready, waited for the next frame sync for port %d @ %06d\n",curr_port,get_fpga_usec(state->fd_fparmsall[0],0)));
D6(fprintf(debug_file,"No compressed frame ready, waited for the next frame sync for port %d @ %07d\n",curr_port,get_fpga_usec(state->fd_fparmsall[0],0)));
break;
break;
// do not analyze next frame (may be non-existing), will do that next time
// do not analyze next frame (may be non-existing), will do that next time
/*
/*
...
@@ -1728,7 +1730,7 @@ int listener_loop(camogm_state *state)
...
@@ -1728,7 +1730,7 @@ int listener_loop(camogm_state *state)
D0(fprintf(debug_file, "%s:line %d got broken frame (%d) while waiting for ready. Before that fp0=0x%x\n", __FILE__, __LINE__, fp1, fp0));
D0(fprintf(debug_file, "%s:line %d got broken frame (%d) while waiting for ready. Before that fp0=0x%x\n", __FILE__, __LINE__, fp1, fp0));
rslt = CAMOGM_FRAME_BROKEN;
rslt = CAMOGM_FRAME_BROKEN;
} else {
} else {
D6(fprintf(debug_file, "No compressed frame ready, skipped 1 frame sync for port %d @ %06d\n",curr_port,get_fpga_usec(state->fd_fparmsall[0], 0)));
D6(fprintf(debug_file, "No compressed frame ready, skipped 1 frame sync for port %d @ %07d\n",curr_port,get_fpga_usec(state->fd_fparmsall[0], 0)));
break;
break;
}
}
}
}
...
@@ -1798,14 +1800,14 @@ int listener_loop(camogm_state *state)
...
@@ -1798,14 +1800,14 @@ int listener_loop(camogm_state *state)
// add port number to error code to facilitate debugging
// add port number to error code to facilitate debugging
state->last_error_code=rslt+100*state->port_num;
state->last_error_code=rslt+100*state->port_num;
}elseif(state->prog_state==STATE_READING){
}elseif(state->prog_state==STATE_READING){
D6(fprintf(debug_file,"COMMAND_LOOP_DELAY start for STATE_READING@ %06d\n",get_fpga_usec(state->fd_fparmsall[0],0)));
D6(fprintf(debug_file,"COMMAND_LOOP_DELAY start for STATE_READING@ %07d\n",get_fpga_usec(state->fd_fparmsall[0],0)));
usleep(COMMAND_LOOP_DELAY);
usleep(COMMAND_LOOP_DELAY);
D6(fprintf(debug_file,"COMMAND_LOOP_DELAY end for STATE_READING@ %06d\n",get_fpga_usec(state->fd_fparmsall[0],0)));
D6(fprintf(debug_file,"COMMAND_LOOP_DELAY end for STATE_READING@ %07d\n",get_fpga_usec(state->fd_fparmsall[0],0)));
}else{// not running, not starting
}else{// not running, not starting
state->rawdev.thread_state=STATE_RUNNING;
state->rawdev.thread_state=STATE_RUNNING;
D6(fprintf(debug_file,"COMMAND_LOOP_DELAY start for STATE_RUNNING@ %06d\n",get_fpga_usec(state->fd_fparmsall[0],0)));
D6(fprintf(debug_file,"COMMAND_LOOP_DELAY start for STATE_RUNNING@ %07d\n",get_fpga_usec(state->fd_fparmsall[0],0)));
usleep(COMMAND_LOOP_DELAY);// make it longer but interruptible by signals?
usleep(COMMAND_LOOP_DELAY);// make it longer but interruptible by signals?
D6(fprintf(debug_file,"COMMAND_LOOP_DELAY end for STATE_RUNNING@ %06d\n",get_fpga_usec(state->fd_fparmsall[0],0)));
D6(fprintf(debug_file,"COMMAND_LOOP_DELAY end for STATE_RUNNING@ %07d\n",get_fpga_usec(state->fd_fparmsall[0],0)));
}
}
#ifdef USE_POLL
#ifdef USE_POLL
// } // if pfd.revents & POLLIN
// } // if pfd.revents & POLLIN
...
@@ -2011,25 +2013,24 @@ unsigned int select_port(camogm_state *state)
...
@@ -2011,25 +2013,24 @@ unsigned int select_port(camogm_state *state)