Loading src/drivers/elphel/circbuf.c +5 −5 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ /** Wait queue for the processes waiting for a new frame to appear in the circular buffer */ wait_queue_head_t circbuf_wait_queue; struct circbuf_priv_t circbuf_priv[IMAGE_CHN_NUM]; struct circbuf_priv_t circbuf_priv[SENSOR_PORTS]; struct circbuf_priv_t *circbuf_priv_ptr = circbuf_priv; static struct device *g_dev_ptr; Loading Loading @@ -113,7 +113,7 @@ int init_ccam_dma_buf_ptr(struct platform_device *pdev) } } for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { circbuf_priv[i].buf_ptr = dma_buf_ptr + BYTE2DW(CIRCBUF_START_OFFSET + i * CCAM_DMA_SIZE); circbuf_priv[i].phys_addr = dma_handle + CIRCBUF_START_OFFSET + i * CCAM_DMA_SIZE; ccam_dma_buf_ptr[i] = circbuf_priv[i].buf_ptr; Loading Loading @@ -525,7 +525,7 @@ loff_t circbuf_lseek(struct file *file, loff_t offset, int orig) { int s; dev_dbg(g_dev_ptr, "stopping all compressors, current channel %d, fvld = %d, file->f_pos = 0x%llx\n", chn, fvld, file->f_pos); for (s = 0; s < IMAGE_CHN_NUM; s++) for (s = 0; s < SENSOR_PORTS; s++) stop_compressor(s); dump_state(chn); } Loading Loading @@ -731,7 +731,7 @@ ssize_t circbuf_write(struct file *file, const char *buf, size_t count, loff_t * } break; case 4: for (i = 0; i < IMAGE_CHN_NUM; i++) for (i = 0; i < SENSOR_PORTS; i++) stop_compressor(i); dump_state(chn); break; Loading @@ -740,7 +740,7 @@ ssize_t circbuf_write(struct file *file, const char *buf, size_t count, loff_t * { int j, cntr; long long res; for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { cntr = get_zero_counter(i); printk(KERN_DEBUG "channel = %d, hw pointer = 0x%x, zero_counter = %d, corrected_offset = %d, frame_counter = %lld\n", i, DW2BYTE(camseq_get_jpeg_wp(i)), cntr, get_corrected_offset(i), get_frame_counter(i)); Loading src/drivers/elphel/jpeghead.c +3 −3 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ static struct jpeghead_priv_t { unsigned int fpga_programmed; unsigned long jpeg_h_sz; /// JPEG header size (no Exif) unsigned char header[JPEG_HEADER_MAXSIZE]; } jpeghead_priv[IMAGE_CHN_NUM]; } jpeghead_priv[SENSOR_PORTS]; #define HEADER_COPY_SOF(x) {buf[bpl] = sizeof( x ) + 8; \ buf[bp++] = sizeof( x ) / 3; \ Loading Loading @@ -748,7 +748,7 @@ int jpeghead_init(struct platform_device *pdev) int i; g_dev_ptr = &pdev->dev; for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { jpeghead_priv[i].fpga_programmed = 0; jpeg_htable_init(i); } Loading @@ -759,7 +759,7 @@ int jpeghead_init(struct platform_device *pdev) if (get_cache_policy() == COMMON_CACHE) { reset_qtables(0); } else if (get_cache_policy() == PER_CHN_CACHE) { for (i = 0; i < IMAGE_CHN_NUM; i++) for (i = 0; i < SENSOR_PORTS; i++) reset_qtables(i); } Loading src/drivers/elphel/quantization_tables.c +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ /** @brief Total number of quantization table pairs */ #define FPGA_NQTAB 8 #define CORING_SIZE 32 // longs #define QTABLE_SETS_NUM (IMAGE_CHN_NUM + 1) #define QTABLE_SETS_NUM (SENSOR_PORTS + 1) #define COMMON_CACHE_INDEX 0 Loading src/drivers/elphel/sensor_common.c +13 −13 Original line number Diff line number Diff line Loading @@ -117,13 +117,13 @@ struct jpeg_ptr_t { */ struct image_acq_pd_t { int minor; struct jpeg_ptr_t jpeg_ptr[IMAGE_CHN_NUM]; struct jpeg_ptr_t jpeg_ptr[SENSOR_PORTS]; }; /* debug code follows */ long long zero_counter[IMAGE_CHN_NUM] = {0}; long long corrected_offset[IMAGE_CHN_NUM] = {0}; long long frame_counter[IMAGE_CHN_NUM] = {0}; long long frame_pos[IMAGE_CHN_NUM][1000] = {0}; long long zero_counter[SENSOR_PORTS] = {0}; long long corrected_offset[SENSOR_PORTS] = {0}; long long frame_counter[SENSOR_PORTS] = {0}; long long frame_pos[SENSOR_PORTS][1000] = {0}; long long get_zero_counter(unsigned int chn) { return zero_counter[chn]; Loading @@ -138,7 +138,7 @@ long long get_frame_counter(unsigned int chn) } long long get_frame_pos(unsigned int chn, unsigned int pos) { if (chn < IMAGE_CHN_NUM && pos < 1000) if (chn < SENSOR_PORTS && pos < 1000) return frame_pos[chn][pos]; return 0; } Loading Loading @@ -174,17 +174,17 @@ void camSeqSetJPEG_rp(int p) { int camseq_get_jpeg_wp(unsigned int chn) { return (chn < IMAGE_CHN_NUM) ? image_acq_priv.jpeg_ptr[chn].jpeg_wp : 0; return (chn < SENSOR_PORTS) ? image_acq_priv.jpeg_ptr[chn].jpeg_wp : 0; } int camseq_get_jpeg_rp(unsigned int chn) { return (chn < IMAGE_CHN_NUM) ? image_acq_priv.jpeg_ptr[chn].jpeg_rp : 0; return (chn < SENSOR_PORTS) ? image_acq_priv.jpeg_ptr[chn].jpeg_rp : 0; } void camseq_set_jpeg_rp(unsigned int chn, int ptr) { if (chn < IMAGE_CHN_NUM) { if (chn < SENSOR_PORTS) { image_acq_priv.jpeg_ptr[chn].jpeg_rp = ptr; } } Loading Loading @@ -236,7 +236,7 @@ DECLARE_TASKLET(tasklet_fpga_0, tasklet_fpga_function, 0); /// 0 - no arguments DECLARE_TASKLET(tasklet_fpga_1, tasklet_fpga_function, 1); /// 0 - no arguments for now DECLARE_TASKLET(tasklet_fpga_2, tasklet_fpga_function, 2); /// 0 - no arguments for now DECLARE_TASKLET(tasklet_fpga_3, tasklet_fpga_function, 3); /// 0 - no arguments for now static struct tasklet_struct *tasklets[IMAGE_CHN_NUM] = {&tasklet_fpga_0, &tasklet_fpga_1, &tasklet_fpga_2, &tasklet_fpga_3}; static struct tasklet_struct *tasklets[SENSOR_PORTS] = {&tasklet_fpga_0, &tasklet_fpga_1, &tasklet_fpga_2, &tasklet_fpga_3}; /** Loading Loading @@ -788,7 +788,7 @@ void camera_interrupts (int on) { #endif /* TEST_DISABLE_CODE */ irq_ctrl.interrupt_cmd = on ? IRQ_ENABLE : IRQ_DISABLE; for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { x393_cmprs_interrupts(irq_ctrl, i); } } Loading Loading @@ -820,7 +820,7 @@ int image_acq_init(struct platform_device *pdev) //MDD1(printk("sensorproc=0x%x\n",(int) sensorproc)); dev_dbg(dev, "sensorproc address: 0x%x\n", (int)sensorproc); for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { irq = platform_get_irq_byname(pdev, frame_sync_irq_names[i]); if (request_irq(irq, frame_sync_irq_handler, Loading Loading @@ -866,7 +866,7 @@ int image_acq_init(struct platform_device *pdev) dev_dbg(dev, "Elphel FPGA interrupts initialized\n"); dev_dbg(dev, "reset all compressors\n"); for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { reset_compressor(i); } //reset_compressor(); /// reset compressor and buffer pointers Loading src/drivers/elphel/x393_macro.h +1 −4 Original line number Diff line number Diff line Loading @@ -7,9 +7,6 @@ #include <elphel/driver_numbers.h> /** @brief Number of image channels */ #define IMAGE_CHN_NUM 4 /** @brief Resolution of current/OEF pointer in bits */ #define OFFSET256_CNTR_RES 26 Loading Loading @@ -62,7 +59,7 @@ static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_ty else *dev_type = 0; } if ((minor & 0x0f) < IMAGE_CHN_NUM) if ((minor & 0x0f) < SENSOR_PORTS) return minor & 0x0f; else return 0; Loading Loading
src/drivers/elphel/circbuf.c +5 −5 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ /** Wait queue for the processes waiting for a new frame to appear in the circular buffer */ wait_queue_head_t circbuf_wait_queue; struct circbuf_priv_t circbuf_priv[IMAGE_CHN_NUM]; struct circbuf_priv_t circbuf_priv[SENSOR_PORTS]; struct circbuf_priv_t *circbuf_priv_ptr = circbuf_priv; static struct device *g_dev_ptr; Loading Loading @@ -113,7 +113,7 @@ int init_ccam_dma_buf_ptr(struct platform_device *pdev) } } for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { circbuf_priv[i].buf_ptr = dma_buf_ptr + BYTE2DW(CIRCBUF_START_OFFSET + i * CCAM_DMA_SIZE); circbuf_priv[i].phys_addr = dma_handle + CIRCBUF_START_OFFSET + i * CCAM_DMA_SIZE; ccam_dma_buf_ptr[i] = circbuf_priv[i].buf_ptr; Loading Loading @@ -525,7 +525,7 @@ loff_t circbuf_lseek(struct file *file, loff_t offset, int orig) { int s; dev_dbg(g_dev_ptr, "stopping all compressors, current channel %d, fvld = %d, file->f_pos = 0x%llx\n", chn, fvld, file->f_pos); for (s = 0; s < IMAGE_CHN_NUM; s++) for (s = 0; s < SENSOR_PORTS; s++) stop_compressor(s); dump_state(chn); } Loading Loading @@ -731,7 +731,7 @@ ssize_t circbuf_write(struct file *file, const char *buf, size_t count, loff_t * } break; case 4: for (i = 0; i < IMAGE_CHN_NUM; i++) for (i = 0; i < SENSOR_PORTS; i++) stop_compressor(i); dump_state(chn); break; Loading @@ -740,7 +740,7 @@ ssize_t circbuf_write(struct file *file, const char *buf, size_t count, loff_t * { int j, cntr; long long res; for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { cntr = get_zero_counter(i); printk(KERN_DEBUG "channel = %d, hw pointer = 0x%x, zero_counter = %d, corrected_offset = %d, frame_counter = %lld\n", i, DW2BYTE(camseq_get_jpeg_wp(i)), cntr, get_corrected_offset(i), get_frame_counter(i)); Loading
src/drivers/elphel/jpeghead.c +3 −3 Original line number Diff line number Diff line Loading @@ -90,7 +90,7 @@ static struct jpeghead_priv_t { unsigned int fpga_programmed; unsigned long jpeg_h_sz; /// JPEG header size (no Exif) unsigned char header[JPEG_HEADER_MAXSIZE]; } jpeghead_priv[IMAGE_CHN_NUM]; } jpeghead_priv[SENSOR_PORTS]; #define HEADER_COPY_SOF(x) {buf[bpl] = sizeof( x ) + 8; \ buf[bp++] = sizeof( x ) / 3; \ Loading Loading @@ -748,7 +748,7 @@ int jpeghead_init(struct platform_device *pdev) int i; g_dev_ptr = &pdev->dev; for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { jpeghead_priv[i].fpga_programmed = 0; jpeg_htable_init(i); } Loading @@ -759,7 +759,7 @@ int jpeghead_init(struct platform_device *pdev) if (get_cache_policy() == COMMON_CACHE) { reset_qtables(0); } else if (get_cache_policy() == PER_CHN_CACHE) { for (i = 0; i < IMAGE_CHN_NUM; i++) for (i = 0; i < SENSOR_PORTS; i++) reset_qtables(i); } Loading
src/drivers/elphel/quantization_tables.c +1 −1 Original line number Diff line number Diff line Loading @@ -78,7 +78,7 @@ /** @brief Total number of quantization table pairs */ #define FPGA_NQTAB 8 #define CORING_SIZE 32 // longs #define QTABLE_SETS_NUM (IMAGE_CHN_NUM + 1) #define QTABLE_SETS_NUM (SENSOR_PORTS + 1) #define COMMON_CACHE_INDEX 0 Loading
src/drivers/elphel/sensor_common.c +13 −13 Original line number Diff line number Diff line Loading @@ -117,13 +117,13 @@ struct jpeg_ptr_t { */ struct image_acq_pd_t { int minor; struct jpeg_ptr_t jpeg_ptr[IMAGE_CHN_NUM]; struct jpeg_ptr_t jpeg_ptr[SENSOR_PORTS]; }; /* debug code follows */ long long zero_counter[IMAGE_CHN_NUM] = {0}; long long corrected_offset[IMAGE_CHN_NUM] = {0}; long long frame_counter[IMAGE_CHN_NUM] = {0}; long long frame_pos[IMAGE_CHN_NUM][1000] = {0}; long long zero_counter[SENSOR_PORTS] = {0}; long long corrected_offset[SENSOR_PORTS] = {0}; long long frame_counter[SENSOR_PORTS] = {0}; long long frame_pos[SENSOR_PORTS][1000] = {0}; long long get_zero_counter(unsigned int chn) { return zero_counter[chn]; Loading @@ -138,7 +138,7 @@ long long get_frame_counter(unsigned int chn) } long long get_frame_pos(unsigned int chn, unsigned int pos) { if (chn < IMAGE_CHN_NUM && pos < 1000) if (chn < SENSOR_PORTS && pos < 1000) return frame_pos[chn][pos]; return 0; } Loading Loading @@ -174,17 +174,17 @@ void camSeqSetJPEG_rp(int p) { int camseq_get_jpeg_wp(unsigned int chn) { return (chn < IMAGE_CHN_NUM) ? image_acq_priv.jpeg_ptr[chn].jpeg_wp : 0; return (chn < SENSOR_PORTS) ? image_acq_priv.jpeg_ptr[chn].jpeg_wp : 0; } int camseq_get_jpeg_rp(unsigned int chn) { return (chn < IMAGE_CHN_NUM) ? image_acq_priv.jpeg_ptr[chn].jpeg_rp : 0; return (chn < SENSOR_PORTS) ? image_acq_priv.jpeg_ptr[chn].jpeg_rp : 0; } void camseq_set_jpeg_rp(unsigned int chn, int ptr) { if (chn < IMAGE_CHN_NUM) { if (chn < SENSOR_PORTS) { image_acq_priv.jpeg_ptr[chn].jpeg_rp = ptr; } } Loading Loading @@ -236,7 +236,7 @@ DECLARE_TASKLET(tasklet_fpga_0, tasklet_fpga_function, 0); /// 0 - no arguments DECLARE_TASKLET(tasklet_fpga_1, tasklet_fpga_function, 1); /// 0 - no arguments for now DECLARE_TASKLET(tasklet_fpga_2, tasklet_fpga_function, 2); /// 0 - no arguments for now DECLARE_TASKLET(tasklet_fpga_3, tasklet_fpga_function, 3); /// 0 - no arguments for now static struct tasklet_struct *tasklets[IMAGE_CHN_NUM] = {&tasklet_fpga_0, &tasklet_fpga_1, &tasklet_fpga_2, &tasklet_fpga_3}; static struct tasklet_struct *tasklets[SENSOR_PORTS] = {&tasklet_fpga_0, &tasklet_fpga_1, &tasklet_fpga_2, &tasklet_fpga_3}; /** Loading Loading @@ -788,7 +788,7 @@ void camera_interrupts (int on) { #endif /* TEST_DISABLE_CODE */ irq_ctrl.interrupt_cmd = on ? IRQ_ENABLE : IRQ_DISABLE; for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { x393_cmprs_interrupts(irq_ctrl, i); } } Loading Loading @@ -820,7 +820,7 @@ int image_acq_init(struct platform_device *pdev) //MDD1(printk("sensorproc=0x%x\n",(int) sensorproc)); dev_dbg(dev, "sensorproc address: 0x%x\n", (int)sensorproc); for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { irq = platform_get_irq_byname(pdev, frame_sync_irq_names[i]); if (request_irq(irq, frame_sync_irq_handler, Loading Loading @@ -866,7 +866,7 @@ int image_acq_init(struct platform_device *pdev) dev_dbg(dev, "Elphel FPGA interrupts initialized\n"); dev_dbg(dev, "reset all compressors\n"); for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) { reset_compressor(i); } //reset_compressor(); /// reset compressor and buffer pointers Loading
src/drivers/elphel/x393_macro.h +1 −4 Original line number Diff line number Diff line Loading @@ -7,9 +7,6 @@ #include <elphel/driver_numbers.h> /** @brief Number of image channels */ #define IMAGE_CHN_NUM 4 /** @brief Resolution of current/OEF pointer in bits */ #define OFFSET256_CNTR_RES 26 Loading Loading @@ -62,7 +59,7 @@ static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_ty else *dev_type = 0; } if ((minor & 0x0f) < IMAGE_CHN_NUM) if ((minor & 0x0f) < SENSOR_PORTS) return minor & 0x0f; else return 0; Loading