Commit 3c106d1d authored by Andrey Filippov's avatar Andrey Filippov
Browse files

Making driver files compile

parent 581d1d2f
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -23,3 +23,9 @@ obj-$(CONFIG_ELPHEL393) += quantization_tables.o
obj-$(CONFIG_ELPHEL393)           += circbuf.o
obj-$(CONFIG_ELPHEL393)           += circbuf.o
obj-$(CONFIG_ELPHEL393)           += jpeghead.o
obj-$(CONFIG_ELPHEL393)           += jpeghead.o


obj-$(CONFIG_ELPHEL393)           += gamma_tables.o
obj-$(CONFIG_ELPHEL393)           += histograms.o
obj-$(CONFIG_ELPHEL393)           += pgm_functions.o
obj-$(CONFIG_ELPHEL393)           += mt9x001.o
obj-$(CONFIG_ELPHEL393)           += multi10359.o
+89 −88
Original line number Original line Diff line number Diff line
@@ -187,7 +187,8 @@ int x393_getClockFreq(int sensor_port, int nclock) {
EXPORT_SYMBOL_GPL(x393_getClockFreq);
EXPORT_SYMBOL_GPL(x393_getClockFreq);




int x393_setClockFreq(int sensor_port, int nclock, int freq) { // freq now in Hz
int x393_setClockFreq(int sensor_port, int nclock, int freq)
{ // freq now in Hz
    int err=0;
    int err=0;
    sensor_port &= 3;
    sensor_port &= 3;
    nclock &= 3;
    nclock &= 3;
+5 −5
Original line number Original line Diff line number Diff line
@@ -550,10 +550,10 @@ inline void processParsASAP(int sensor_port, struct sensorproc_t * sensorproc, i
					framepars[4].functions, framepars[5].functions, framepars[6].functions, framepars[7].functions));
					framepars[4].functions, framepars[5].functions, framepars[6].functions, framepars[7].functions));


			if (sensorproc->pgm_func[i]) {
			if (sensorproc->pgm_func[i]) {
				rslt = sensorproc->pgm_func[i]    ( &(sensorproc->sensor), procpars, prevpars, -1);
				rslt = sensorproc->pgm_func[i]    (sensor_port, &(sensorproc->sensor), procpars, prevpars, -1);
			} else rslt = 0;                                        // only sensor-specific function, nothing to do common to all sensors
			} else rslt = 0;                                        // only sensor-specific function, nothing to do common to all sensors
			if ((rslt >= 0) && (sensorproc->pgm_func[i + 32])) {    // sensor - specific functions, called after the main ones
			if ((rslt >= 0) && (sensorproc->pgm_func[i + 32])) {    // sensor - specific functions, called after the main ones
				rslt = sensorproc->pgm_func[i + 32] ( &(sensorproc->sensor), procpars, prevpars, -1);
				rslt = sensorproc->pgm_func[i + 32] (sensor_port, &(sensorproc->sensor), procpars, prevpars, -1);
			}
			}
// Nothing to do with errors here - just report?
// Nothing to do with errors here - just report?
			if (rslt < 0) printk("%s:%d:%s - error=%d", __FILE__, __LINE__, __FUNCTION__, rslt);
			if (rslt < 0) printk("%s:%d:%s - error=%d", __FILE__, __LINE__, __FUNCTION__, rslt);
@@ -627,10 +627,10 @@ inline void processParsSeq(int sensor_port, struct sensorproc_t * sensorproc, in


					if (sensorproc->pgm_func[i]) {
					if (sensorproc->pgm_func[i]) {
						// NOTE: Was (frame8+job_ahead +1) & PARS_FRAMES_MASK
						// NOTE: Was (frame8+job_ahead +1) & PARS_FRAMES_MASK
						rslt = sensorproc->pgm_func[i]    ( &(sensorproc->sensor), procpars, prevpars, seq_frame);
						rslt = sensorproc->pgm_func[i]    (sensor_port, &(sensorproc->sensor), procpars, prevpars, seq_frame);
					} else rslt = 0;                                        // only sensor-specific function, nothing to do common to all sensors
					} else rslt = 0;                                        // only sensor-specific function, nothing to do common to all sensors
					if ((rslt >= 0) && (sensorproc->pgm_func[i + 32])) {    // sensor - specific functions, called after the main ones
					if ((rslt >= 0) && (sensorproc->pgm_func[i + 32])) {    // sensor - specific functions, called after the main ones
						rslt = sensorproc->pgm_func[i + 32] ( &(sensorproc->sensor), procpars, prevpars, seq_frame);
						rslt = sensorproc->pgm_func[i + 32] (sensor_port, &(sensorproc->sensor), procpars, prevpars, seq_frame);
					}
					}
					if (rslt >= 0) {
					if (rslt >= 0) {
						procpars->functions &= ~mask; // mark it done
						procpars->functions &= ~mask; // mark it done
@@ -1113,7 +1113,7 @@ loff_t framepars_lseek(struct file * file, loff_t offset, int orig)
	unsigned long target_frame;
	unsigned long target_frame;
	struct framepars_pd * privData = (struct framepars_pd*) file -> private_data;
	struct framepars_pd * privData = (struct framepars_pd*) file -> private_data;
	int sensor_port = privData -> minor - CMOSCAM_MINOR_FRAMEPARS_CHN_0;
	int sensor_port = privData -> minor - CMOSCAM_MINOR_FRAMEPARS_CHN_0;
	struct framepars_t *framepars = aframepars[sensor_port];
//	struct framepars_t *framepars = aframepars[sensor_port];
	MDF1(printk(" offset=0x%x, orig=0x%x, sensor_port = %d\n", (int)offset, (int)orig, sensor_port));
	MDF1(printk(" offset=0x%x, orig=0x%x, sensor_port = %d\n", (int)offset, (int)orig, sensor_port));
	switch (orig) {
	switch (orig) {
	case SEEK_SET:
	case SEEK_SET:
+4 −3
Original line number Original line Diff line number Diff line
@@ -7,11 +7,11 @@ int is_gamma_current (unsigned short hash16, unsigned short scale, int index);
int is_gamma_valid  (unsigned short hash16, unsigned short scale, int index);
int is_gamma_valid  (unsigned short hash16, unsigned short scale, int index);
//             int prev_locked_color[4];
//             int prev_locked_color[4];


int unlock_gamma_node (int color); /// NOTE: Not needed anymore
int unlock_gamma_node (int color, int sensor_port, int sensor_subchn); /// NOTE: Not needed anymore
///
///
/// return a pointer to the gamma table (single color) encoded in FPGA format (NULL if there is to table ready)
/// return a pointer to the gamma table (single color) encoded in FPGA format (NULL if there is to table ready)
///
///
unsigned long * get_gamma_fpga(int color);
unsigned long * get_gamma_fpga(int color, int sensor_port, int sensor_subchn);


int gamma_new_node(void);
int gamma_new_node(void);
void gamma_encode_fpga(unsigned short * gamma_in, unsigned long * gamma_out);///Hardware-dependent encoding of the FPGA "gamma" table. Converts unsigned short array of 257 16-bit values (only 10 msb-s are used) to 256 unsigned long words to be written to FPGA
void gamma_encode_fpga(unsigned short * gamma_in, unsigned long * gamma_out);///Hardware-dependent encoding of the FPGA "gamma" table. Converts unsigned short array of 257 16-bit values (only 10 msb-s are used) to 256 unsigned long words to be written to FPGA
@@ -27,5 +27,6 @@ void gamma_calc_reverse(unsigned short * gamma_in, unsigned char * gamma_out);/
// #define GAMMA_MODE_HARDWARE     4  // the table is needed to program FPGA: fpga-encoded table will be calculated (if not yet), node will be locked for specified
// #define GAMMA_MODE_HARDWARE     4  // the table is needed to program FPGA: fpga-encoded table will be calculated (if not yet), node will be locked for specified
                                   // color/frame pair
                                   // color/frame pair
int set_gamma_table (unsigned short hash16, unsigned short scale, unsigned short * gamma_proto,  unsigned char mode, int color, int sensor_port, int sensor_subchn);
int set_gamma_table (unsigned short hash16, unsigned short scale, unsigned short * gamma_proto,  unsigned char mode, int color, int sensor_port, int sensor_subchn);
unsigned long get_locked_hash32(int color);
unsigned long get_locked_hash32(int color, int sensor_port,int sensor_subchn);

#endif
#endif
+33 −21
Original line number Original line Diff line number Diff line
@@ -102,7 +102,9 @@
#include <asm/outercache.h>
#include <asm/outercache.h>
#include <asm/cacheflush.h>
#include <asm/cacheflush.h>



#include <linux/dma-mapping.h>
#include <linux/dma-direction.h>
// ##include <asm/dma-mapping.h>


#include <elphel/driver_numbers.h>
#include <elphel/driver_numbers.h>
#include <elphel/c313a.h>
#include <elphel/c313a.h>
@@ -130,6 +132,8 @@
  #define MDF22(x)
  #define MDF22(x)
#endif
#endif


//u32         (*fpga_hist_data)[SENSOR_PORTS][MAX_SENSORS][PARS_FRAMES][4][256]; ///< Array of histogram data, mapped to the memory wheer FPGA sends data
//u32        *fpga_hist_data[SENSOR_PORTS][MAX_SENSORS][PARS_FRAMES][4][256]; ///< Array of histogram data, mapped to the memory wheer FPGA sends data
u32        (*fpga_hist_data)[SENSOR_PORTS][MAX_SENSORS][PARS_FRAMES][4][256]; ///< Array of histogram data, mapped to the memory wheer FPGA sends data
u32        (*fpga_hist_data)[SENSOR_PORTS][MAX_SENSORS][PARS_FRAMES][4][256]; ///< Array of histogram data, mapped to the memory wheer FPGA sends data
dma_addr_t   fpga_hist_phys; // physical address of the start of the received histogram data
dma_addr_t   fpga_hist_phys; // physical address of the start of the received histogram data


@@ -144,6 +148,7 @@ static int numHistChn = 0;
/** Variable-length array (length is the total number of active sensors <=16), each being the same as in 353:
/** Variable-length array (length is the total number of active sensors <=16), each being the same as in 353:
 * consisting of SENSOR_PORTS histogram_stuct_t structures */
 * consisting of SENSOR_PORTS histogram_stuct_t structures */
struct  histogram_stuct_t (*histograms)[HISTOGRAM_CACHE_NUMBER];
struct  histogram_stuct_t (*histograms)[HISTOGRAM_CACHE_NUMBER];
//struct  histogram_stuct_t *histograms;


dma_addr_t histograms_phys; ///< likely not needed, saved during allocation
dma_addr_t histograms_phys; ///< likely not needed, saved during allocation


@@ -193,7 +198,8 @@ int histograms_init_hardware(void)
{
{
    int port, chn;
    int port, chn;
    x393_hist_saxi_addr_t saxi_addr;
    x393_hist_saxi_addr_t saxi_addr;
    fpga_hist_data = (u32 [SENSOR_PORTS][MAX_SENSORS][PARS_FRAMES][4][256]) pElphel_buf->d2h_vaddr; // must be page-aligned!
//    fpga_hist_data = (u32 [SENSOR_PORTS][MAX_SENSORS][PARS_FRAMES][4][256]) pElphel_buf->d2h_vaddr; // must be page-aligned!
    fpga_hist_data = (u32 *) pElphel_buf->d2h_vaddr; // must be page-aligned!
    fpga_hist_phys = pElphel_buf->d2h_paddr;
    fpga_hist_phys = pElphel_buf->d2h_paddr;
    for (port=0; port<SENSOR_PORTS; port++) for (chn=0; chn < MAX_SENSORS; chn++) {
    for (port=0; port<SENSOR_PORTS; port++) for (chn=0; chn < MAX_SENSORS; chn++) {
        saxi_addr.page=(fpga_hist_phys >> PAGE_SHIFT)+ PARS_FRAMES * (chn + MAX_SENSORS *port);// table for 4 colors is exactly 1 page;
        saxi_addr.page=(fpga_hist_phys >> PAGE_SHIFT)+ PARS_FRAMES * (chn + MAX_SENSORS *port);// table for 4 colors is exactly 1 page;
@@ -225,24 +231,29 @@ void init_histograms(int chn_mask) ///< combined subchannels and ports Save mask
    unsigned long flags;
    unsigned long flags;
    int p,s,i, sz,pages;
    int p,s,i, sz,pages;
    numHistChn = 0; //__builtin_popcount (chn_mask & 0xffff);
    numHistChn = 0; //__builtin_popcount (chn_mask & 0xffff);
    if (sz & (PAGE_SIZE-1)) pages++;
    for (p=0; p< SENSOR_PORTS; p++) for (s=0;s <MAX_SENSORS;s++) {
    for (p=0; p< SENSOR_PORTS; p++) for (s=0;s <MAX_SENSORS;s++) {
        i = p * SENSOR_PORTS + s;
        i = p * SENSOR_PORTS + s;
        if (chn_mask & (1 << i)){
        if (chn_mask & (1 << i)){
            histograms_map = numHistChn++;
            histograms_map[p][s] = numHistChn++;
            GLOBALPARS(p, G_HIST_LAST_INDEX + s) =0; // mark as valid
            GLOBALPARS(p, G_HIST_LAST_INDEX + s) =0; // mark as valid
            GLOBALPARS(p, G_SUBCHANNELS) |= 1 << s;
            GLOBALPARS(p, G_SUBCHANNELS) |= 1 << s;
        } else {
        } else {
            histograms_map = -1;
            histograms_map[p][s] = -1;
            GLOBALPARS(p, G_HIST_LAST_INDEX + s) =0xffffffff; // mark as invalid
            GLOBALPARS(p, G_HIST_LAST_INDEX + s) =0xffffffff; // mark as invalid
            GLOBALPARS(p, G_SUBCHANNELS) &= ~(1 << s);
            GLOBALPARS(p, G_SUBCHANNELS) &= ~(1 << s);
        }
        }
    }
    }
    //G_SUBCHANNELS
    //G_SUBCHANNELS
    sz = numHistChn * HISTOGRAM_CACHE_NUMBER * sizeof(struct histogram_stuct_t);
    sz = numHistChn * HISTOGRAM_CACHE_NUMBER * sizeof(struct histogram_stuct_t);
    if (sz & (PAGE_SIZE-1)) pages++;
    pages = sz >> PAGE_SHIFT;
    pages = sz >> PAGE_SHIFT;
    // When device == NULL, dma_alloc_coherent just allocates notmal memory, page aligned, CMA if available
    // When device == NULL, dma_alloc_coherent just allocates notmal memory, page aligned, CMA if available
    histograms = (struct  histogram_stuct_t*[HISTOGRAM_CACHE_NUMBER]) dma_alloc_coherent(NULL,(sz * PAGE_SIZE),&histograms_phys,GFP_KERNEL);
//    histograms = (struct  histogram_stuct_t* [HISTOGRAM_CACHE_NUMBER]) dma_alloc_coherent(NULL,(sz * PAGE_SIZE),&histograms_phys,GFP_KERNEL);
//    histograms = (struct  histogram_stuct_t[HISTOGRAM_CACHE_NUMBER] * ) dma_alloc_coherent(NULL,(sz * PAGE_SIZE),&histograms_phys,GFP_KERNEL);
//    histograms = (struct  histogram_stuct_t[HISTOGRAM_CACHE_NUMBER]) *  dma_alloc_coherent(NULL,(sz * PAGE_SIZE),&histograms_phys,GFP_KERNEL);
    histograms = dma_alloc_coherent(NULL,(sz * PAGE_SIZE),&histograms_phys,GFP_KERNEL); // OK
//    histograms = (struct  histogram_stuct_t * ) dma_alloc_coherent(NULL,(sz * PAGE_SIZE),&histograms_phys,GFP_KERNEL); //<<<assignment from incompatible pointer type [-Wincompatible-pointer-types]>>>

    BUG_ON(!histograms);
    BUG_ON(!histograms);
    histograms_p= (struct histogram_stuct_t *) histograms;
    histograms_p= (struct histogram_stuct_t *) histograms;
    MDF21(printk("\n"));
    MDF21(printk("\n"));
@@ -284,12 +295,12 @@ int set_histograms (int sensor_port, ///< sensor port number (0..3)
    int i, color_start, hist_indx, hist_frame;
    int i, color_start, hist_indx, hist_frame;
    hist_indx=get_hist_index(sensor_port,sensor_chn);
    hist_indx=get_hist_index(sensor_port,sensor_chn);
    if (hist_indx <0 ) return -EINVAL;
    if (hist_indx <0 ) return -EINVAL;
    if (histograms[GLOBALPARS(sensor_port,G_HIST_LAST_INDEX+sensor_chn)].frame!=frame) {
    if (histograms[hist_indx][GLOBALPARS(sensor_port,G_HIST_LAST_INDEX+sensor_chn)].frame!=frame) {
        GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn)=(GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn)+1) & (HISTOGRAM_CACHE_NUMBER-1);
        GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn)=(GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn)+1) & (HISTOGRAM_CACHE_NUMBER-1);
        histograms[hist_indx][GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn)].valid=0;     // overwrite all
        histograms[hist_indx][GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn)].valid=0;     // overwrite all
        histograms[hist_indx][GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn)].frame=frame; // add to existent
        histograms[hist_indx][GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn)].frame=frame; // add to existent
        if (framep)    memcpy (&(histograms[GLOBALPARS(sensor_port,G_HIST_LAST_INDEX)].frame),  framep,    32); // copy provided frame, gains,expos,vexpos, focus
        if (framep)    memcpy (&(histograms[hist_indx][GLOBALPARS(sensor_port,G_HIST_LAST_INDEX)].frame),  framep,    32); // copy provided frame, gains,expos,vexpos, focus
        if (gammaHash) memcpy (&(histograms[GLOBALPARS(sensor_port,G_HIST_LAST_INDEX)].gtab_r), gammaHash, 16); // copy provided 4 hash32 values
        if (gammaHash) memcpy (&(histograms[hist_indx][GLOBALPARS(sensor_port,G_HIST_LAST_INDEX)].gtab_r), gammaHash, 16); // copy provided 4 hash32 values
    } else {
    } else {
        needed &= ~histograms[hist_indx][GLOBALPARS(sensor_port,G_HIST_LAST_INDEX)].valid; // remove those that are already available from the request
        needed &= ~histograms[hist_indx][GLOBALPARS(sensor_port,G_HIST_LAST_INDEX)].valid; // remove those that are already available from the request
    }
    }
@@ -337,9 +348,10 @@ int get_histograms(int sensor_port, ///< sensor port number (0..3)
{
{
    int i, color_start, index;
    int i, color_start, index;
    int hist_indx=get_hist_index(sensor_port,sensor_chn);
    int hist_indx=get_hist_index(sensor_port,sensor_chn);
    int raw_needed;
    if (hist_indx <0 ) return -EINVAL;
    if (hist_indx <0 ) return -EINVAL;
    index=GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn);
    index=GLOBALPARS(sensor_port, G_HIST_LAST_INDEX+sensor_chn);
    int raw_needed=(needed | (needed>>4) | needed>>8) & 0xf;
    raw_needed=(needed | (needed>>4) | needed>>8) & 0xf;
    for (i=0;i<HISTOGRAM_CACHE_NUMBER;i++) {
    for (i=0;i<HISTOGRAM_CACHE_NUMBER;i++) {
        MDF21(printk("index=%d, needed=0x%x\n",index,needed));
        MDF21(printk("index=%d, needed=0x%x\n",index,needed));
        if ((histograms[hist_indx][index].frame <= frame) && ((histograms[hist_indx][index].valid & raw_needed)==raw_needed)) break;
        if ((histograms[hist_indx][index].frame <= frame) && ((histograms[hist_indx][index].valid & raw_needed)==raw_needed)) break;
@@ -403,12 +415,12 @@ inline void histogram_calc_percentiles (unsigned long * cumul_hist, ///< [IN]
    unsigned long v256=0; // running value to be compared against cumulative histogram (it is 256 larger than cumul_hist)
    unsigned long v256=0; // running value to be compared against cumulative histogram (it is 256 larger than cumul_hist)
    unsigned long inc_v256=cumul_hist[255];  // step of v256 increment
    unsigned long inc_v256=cumul_hist[255];  // step of v256 increment
    int shiftl=8;
    int shiftl=8;
    int p=0; // current value of percentile
    int x=0; // current percentile index
    while (inc_v256>0xffffff) { // to protect from unlikely overflow at 16MPix - in the future)
    while (inc_v256>0xffffff) { // to protect from unlikely overflow at 16MPix - in the future)
        inc_v256 >>= 1;
        inc_v256 >>= 1;
        shiftl--;
        shiftl--;
    }
    }
    int p=0; // current value of percentile
    int x=0; // current percentile index
    while ((p<256) && (x<256)) {
    while ((p<256) && (x<256)) {
        percentile[x]=p;
        percentile[x]=p;
        if ((p<255) && ( (cumul_hist[p] << shiftl) <= v256)) {
        if ((p<255) && ( (cumul_hist[p] << shiftl) <= v256)) {
@@ -547,24 +559,24 @@ loff_t histograms_lseek (struct file * file,
                    else                       reqFrame=offset;
                    else                       reqFrame=offset;
                }
                }
                if ((offset < reqFrame) && // if the requested frame is in the past - try to get it first before requesting a new
                if ((offset < reqFrame) && // if the requested frame is in the past - try to get it first before requesting a new
                        (((privData->frame_index = get_histograms (offset, privData->needed))) >=0)) {
                        (((privData->frame_index = get_histograms (privData->port, privData->subchannel, offset, privData->needed))) >=0)) {
//                    file->f_pos=privData->frame_index;
//                    file->f_pos=privData->frame_index;
                    file->f_pos=privData->frame_index + HISTOGRAM_CACHE_NUMBER * get_hist_index(privData->port, privData->subchannel);
                    file->f_pos=privData->frame_index + HISTOGRAM_CACHE_NUMBER * get_hist_index(privData->port, privData->subchannel);
                    return file->f_pos;
                    return file->f_pos;
                }
                }
                // request histogram(s)
                // request histogram(s)
                //             setFramePar(&framepars[reqFrame & PARS_FRAMES_MASK], reqAddr, 1);
                //             setFramePar(&framepars[reqFrame & PARS_FRAMES_MASK], reqAddr, 1);
                setFramePar(&aframepars[privData->port][reqFrame & PARS_FRAMES_MASK], reqAddr, 1);
                setFramePar(privData->port, &aframepars[privData->port][reqFrame & PARS_FRAMES_MASK], reqAddr, 1);
                // make sure (harmful) interrupt did not happen since getThisFrameNumber()
                // make sure (harmful) interrupt did not happen since getThisFrameNumber()
                if (reqFrame < getThisFrameNumber(privData->port)) {
                if (reqFrame < getThisFrameNumber(privData->port)) {
                    //               setFramePar(&framepars[getThisFrameNumber() & PARS_FRAMES_MASK], reqAddr, 1);
                    //               setFramePar(&framepars[getThisFrameNumber() & PARS_FRAMES_MASK], reqAddr, 1);
                    setFramePar(&aframepars[privData->port][getThisFrameNumber(privData->port) & PARS_FRAMES_MASK], reqAddr, 1);
                    setFramePar(privData->port, &aframepars[privData->port][getThisFrameNumber(privData->port) & PARS_FRAMES_MASK], reqAddr, 1);


                }
                }
            }
            }
            if (privData-> wait_mode)  wait_event_interruptible (hist_c_wait_queue,GLOBALPARS(privData->port,G_HIST_C_FRAME + privData->subchannel)>=offset);
            if (privData-> wait_mode)  wait_event_interruptible (hist_c_wait_queue,GLOBALPARS(privData->port,G_HIST_C_FRAME + privData->subchannel)>=offset);
            else                       wait_event_interruptible (hist_y_wait_queue,GLOBALPARS(privData->port,G_HIST_Y_FRAME + privData->subchannel)>=offset);
            else                       wait_event_interruptible (hist_y_wait_queue,GLOBALPARS(privData->port,G_HIST_Y_FRAME + privData->subchannel)>=offset);
            privData->frame_index = get_histograms (offset, privData->needed);
            privData->frame_index = get_histograms (privData->port, privData->subchannel, offset, privData->needed);
            if (privData->frame_index <0) {
            if (privData->frame_index <0) {
                return -EFAULT;
                return -EFAULT;
            } else {
            } else {
@@ -605,12 +617,12 @@ loff_t histograms_lseek (struct file * file,
                    default:
                    default:
                        switch (offset & ~0x1f) {
                        switch (offset & ~0x1f) {
                        case  LSEEK_DAEMON_HIST_Y: // wait for daemon enabled and histograms Y ready
                        case  LSEEK_DAEMON_HIST_Y: // wait for daemon enabled and histograms Y ready
                            MDF21(printk("wait_event_interruptible (hist_y_wait_queue,0x%x & 0x%x)\n",(int) get_imageParamsThis(P_DAEMON_EN), (int) (1<<(offset & 0x1f))));
                            MDF21(printk("wait_event_interruptible (hist_y_wait_queue,0x%x & 0x%x)\n",(int) get_imageParamsThis(privData->port, P_DAEMON_EN), (int) (1<<(offset & 0x1f))));
                            wait_event_interruptible (hist_y_wait_queue, get_imageParamsThis(P_DAEMON_EN) & (1<<(offset & 0x1f)));
                            wait_event_interruptible (hist_y_wait_queue, get_imageParamsThis(privData->port, P_DAEMON_EN) & (1<<(offset & 0x1f)));
                            break;
                            break;
                        case  LSEEK_DAEMON_HIST_C: // wait for daemon enabled and histograms Y ready
                        case  LSEEK_DAEMON_HIST_C: // wait for daemon enabled and histograms Y ready
                            MDF21(printk("wait_event_interruptible (hist_c_wait_queue,0x%x & 0x%x)\n",(int) get_imageParamsThis(P_DAEMON_EN), (int) (1<<(offset & 0x1f))));
                            MDF21(printk("wait_event_interruptible (hist_c_wait_queue,0x%x & 0x%x)\n",(int) get_imageParamsThis(privData->port, P_DAEMON_EN), (int) (1<<(offset & 0x1f))));
                            wait_event_interruptible (hist_c_wait_queue, get_imageParamsThis(P_DAEMON_EN) & (1<<(offset & 0x1f)));
                            wait_event_interruptible (hist_c_wait_queue, get_imageParamsThis(privData->port, P_DAEMON_EN) & (1<<(offset & 0x1f)));
                            break;
                            break;
                        default:
                        default:
                            return -EINVAL;
                            return -EINVAL;
Loading