break;// frame sent OK, nothing to do (TODO: check file length/duration)
...
...
@@ -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
// TODO - add another wait with (short) timeout?
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;
// do not analyze next frame (may be non-existing), will do that next time
/*
...
...
@@ -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));
rslt = CAMOGM_FRAME_BROKEN;
} 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;
}
}
...
...
@@ -1798,14 +1800,14 @@ int listener_loop(camogm_state *state)
// add port number to error code to facilitate debugging
state->last_error_code=rslt+100*state->port_num;
}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);
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
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?
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
// } // if pfd.revents & POLLIN
...
...
@@ -2011,25 +2013,24 @@ unsigned int select_port(camogm_state *state)
pthread_cond_signal(¶ms->main_cond);// ********** Do not signal if can write more !
D6(fprintf(debug_file,"_w06_: wrote data (%d , %d), buffer empty, signal main thread @ %06d\n",params->chunk_page_prep,params->chunk_page_write,get_fpga_usec(state->fd_fparmsall[0],0)));
D6(fprintf(debug_file,"_w06_: wrote data (%d , %d), buffer empty, signal main thread @ %07d\n",params->chunk_page_prep,params->chunk_page_write,get_fpga_usec(state->fd_fparmsall[0],0)));
}else{
D6(fprintf(debug_file,"_w06a_: wrote data (%d , %d), has more to write, do not signal! @ %06d\n",params->chunk_page_prep,params->chunk_page_write,get_fpga_usec(state->fd_fparmsall[0],0)));
D6(fprintf(debug_file,"_w06a_: wrote data (%d , %d), has more to write, do not signal! @ %07d\n",params->chunk_page_prep,params->chunk_page_write,get_fpga_usec(state->fd_fparmsall[0],0)));
}
pthread_mutex_unlock(¶ms->writer_mutex);// do not release untill waiting for writev() or waiting for data to write