#define JPEG_MARKER_LEN 2 ///< The size in bytes of JPEG marker
#define JPEG_TRAILER_LEN 2 ///< The size in bytes of JPEG trailer
#define CIRCBUF_ALIGNMENT_SIZE 32 ///< Align of CIRCBUF entries
// Switching CHUNK -> SEGMENT
#define PAGE_PHYS 4096 // 512 // alignment size for O_DIRECT, may be different from LBA block size that is 512
enumsegments{
SEGMENT_GLUE,///< pointer to a page-aligned buffer to accommodate over-page of data, trailer, zeros, header and start of the data
SEGMENT_FIRST,///< first (or the only) continuous page-aligned data segment that does not need to be copied (may start with ofset to PAGE_PHYS-aligned)
SEGMENT_SECOND,///< optional second part of the data buffer, end PAGE_PHYS-aligned
SEGMENTS_NUMBER///< Just to get number of segment types
D6(fprintf(debug_file,"\ndump iovect array for port %u\n",state->port_num));
D6(fprintf(debug_file,"\ndump iovect array for port %u, chunk_index=%u, chunk_data_index=%u, data_segments=%u\n",state->port_num,state->chunk_index,state->chunk_data_index,state->data_segments));
pthread_cond_signal(¶ms->main_cond);// ********** Do not signal if can write more !
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 @ %07d\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)));
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)));
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
pthread_mutex_unlock(¶ms->writer_mutex);// do not release untill waiting for emul_writev() or waiting for data to write