Commit a93c7321 authored by Andrey Filippov's avatar Andrey Filippov
Browse files

fixing circbuf pointers

parent bb96d648
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -658,7 +658,7 @@ loff_t circbuf_lseek(struct file * file, loff_t offset, int orig) {
          case LSEEK_CIRC_FIRST:
          case LSEEK_CIRC_SCND:
//! Starting from the write pointer do be able to count all the frames in the buffer
             rp=camSeqGetJPEG_wp(chn);
             rp=camSeqGetJPEG_wp(chn); // 32-bit words, not byte address
             prev_p=rp;
             preprev_p=prev_p; // for second
             nf=0;
+13 −7
Original line number Diff line number Diff line
@@ -191,12 +191,12 @@ int camseq_get_jpeg_rp(unsigned int chn)
	return (chn < SENSOR_PORTS) ? image_acq_priv.jpeg_ptr[chn].jpeg_rp : 0;
}

void camseq_set_jpeg_rp(unsigned int chn, int ptr)
void camseq_set_jpeg_rp(unsigned int chn, int ptr) // ptr in bytes
{
	if (chn < SENSOR_PORTS) {
		image_acq_priv.jpeg_ptr[chn].jpeg_rp = ptr;
		image_acq_priv.jpeg_ptr[chn].jpeg_rp = ptr >> 2;

	    set_globalParam(chn, G_CIRCBUFRP, ptr);
	    set_globalParam(chn, G_CIRCBUFRP, ptr);  // in bytes (same as in 353)
	    set_globalParam(chn, G_FREECIRCBUF,
	            (((get_globalParam(chn, G_CIRCBUFRP) <= get_globalParam(chn, G_CIRCBUFWP))?
	                    get_globalParam(chn, G_CIRCBUFSIZE):0)+ get_globalParam(chn, G_CIRCBUFRP))
@@ -215,7 +215,7 @@ int camSeqGetJPEG_wp(unsigned int chn)
    return (chn < SENSOR_PORTS) ? image_acq_priv.jpeg_ptr[chn].jpeg_wp : 0;
}

int camSeqGetJPEG_rp(unsigned int chn)
int camSeqGetJPEG_rp(unsigned int chn) // return in DWORDs, not in bytes
{
    return (chn < SENSOR_PORTS) ? image_acq_priv.jpeg_ptr[chn].jpeg_rp : 0;
}
@@ -225,9 +225,11 @@ void camSeqSetJPEG_rp(unsigned int chn, ///< channel (0..3)

{
    if (chn < SENSOR_PORTS) {
        image_acq_priv.jpeg_ptr[chn].jpeg_rp = ptr << 2;
//        image_acq_priv.jpeg_ptr[chn].jpeg_rp = ptr << 2;
        image_acq_priv.jpeg_ptr[chn].jpeg_rp = ptr ;

        set_globalParam(chn, G_CIRCBUFRP, ptr);
//        set_globalParam(chn, G_CIRCBUFRP, ptr); // wrong! should be in bytes
        set_globalParam(chn, G_CIRCBUFRP, ptr << 2); // this is as in nc353
        set_globalParam(chn, G_FREECIRCBUF,
                (((get_globalParam(chn, G_CIRCBUFRP) <= get_globalParam(chn, G_CIRCBUFWP))?
                        get_globalParam(chn, G_CIRCBUFSIZE):0)+ get_globalParam(chn, G_CIRCBUFRP))
@@ -392,7 +394,9 @@ inline void update_irq_circbuf(struct jpeg_ptr_t *jptr) {
	/*set_globalParam (G_CIRCBUFWP, JPEG_wp<<2);set_globalParam (G_FREECIRCBUF, (((get_globalParam (G_CIRCBUFRP) <= get_globalParam (G_CIRCBUFWP))? get_globalParam (G_CIRCBUFSIZE):0)+
                                     get_globalParam (G_CIRCBUFRP)) -    get_globalParam (G_CIRCBUFWP));*/
	/* the concept of global parameters will be changed, use one channel only for testing */
	set_globalParam(jptr->chn_num, G_CIRCBUFWP, jptr->jpeg_wp);
//	set_globalParam(jptr->chn_num, G_CIRCBUFWP, jptr->jpeg_wp);

    set_globalParam(jptr->chn_num, G_CIRCBUFWP, jptr->jpeg_wp << 2); // jptr->jpeg_wp in 32-bit words, G_CIRCBUFWP - in bytes
	set_globalParam (jptr->chn_num, G_FREECIRCBUF,
	        (((get_globalParam (jptr->chn_num, G_CIRCBUFRP) <= get_globalParam (jptr->chn_num, G_CIRCBUFWP))?get_globalParam (jptr->chn_num, G_CIRCBUFSIZE):0)+
			get_globalParam (jptr->chn_num, G_CIRCBUFRP)) -    get_globalParam (jptr->chn_num, G_CIRCBUFWP));
@@ -1002,6 +1006,8 @@ void trigger_restart(void)
{
    u32 period = get_x393_camsync_trig_period();
    if (!(period & ~31)) period = 1; // if 0 or bit length setup

    period = 1; // make it always single/not changing any P_*
    set_x393_camsync_trig_period(period);
    dev_dbg(g_dev_ptr, "Reset trigger period in immediate mode = %d (0x%x)\n", (int) period, (int) period);
}
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ void camseq_set_jpeg_rp(unsigned int chn, int ptr);

int camSeqGetJPEG_frame(unsigned int chn);

// DWORD I/O, same as in NC353
// DWORD I/O, same as in NC353, but was an error later
int camSeqGetJPEG_wp (unsigned int chn);
int camSeqGetJPEG_rp (unsigned int chn);
void camSeqSetJPEG_rp(unsigned int chn, int ptr);
+3 −1
Original line number Diff line number Diff line
@@ -687,7 +687,9 @@

#define FRAMEPAR_GLOBALS   0x01000  ///< start of global (not frame-related) parameters

#define GLOBALS_PRESERVE   0x20     /// number of parameters that are not erased during initGlobalPars
//#define GLOBALS_PRESERVE   0x20     /// number of parameters that are not erased during initGlobalPars
#define GLOBALS_PRESERVE   0x26     /// number of parameters that are not erased during initGlobalPars - include G_CIRCBUFSIZE ==+37 (or move it)
//G_CIRCBUFSIZE

#define GLOBALPARS(p, x)   (aglobalPars[p][(x)-FRAMEPAR_GLOBALS]) ///< should work in drivers and applications, First 32 parameter values are not erased with initGlobalPars
#define GLOBALPARS_SNGL(x) (globalPars[(x)-FRAMEPAR_GLOBALS]) ///< for applications that use just one port