Commit ac2238bd authored by Mikhail Karpenko's avatar Mikhail Karpenko

Rename IMG_CHN_NUM to SENSOR_PORTS

parent cd74a384
...@@ -77,7 +77,7 @@ ...@@ -77,7 +77,7 @@
/** Wait queue for the processes waiting for a new frame to appear in the circular buffer */ /** Wait queue for the processes waiting for a new frame to appear in the circular buffer */
wait_queue_head_t circbuf_wait_queue; 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; struct circbuf_priv_t *circbuf_priv_ptr = circbuf_priv;
static struct device *g_dev_ptr; static struct device *g_dev_ptr;
...@@ -113,7 +113,7 @@ int init_ccam_dma_buf_ptr(struct platform_device *pdev) ...@@ -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].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; circbuf_priv[i].phys_addr = dma_handle + CIRCBUF_START_OFFSET + i * CCAM_DMA_SIZE;
ccam_dma_buf_ptr[i] = circbuf_priv[i].buf_ptr; ccam_dma_buf_ptr[i] = circbuf_priv[i].buf_ptr;
...@@ -525,7 +525,7 @@ loff_t circbuf_lseek(struct file *file, loff_t offset, int orig) ...@@ -525,7 +525,7 @@ loff_t circbuf_lseek(struct file *file, loff_t offset, int orig)
{ {
int s; 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); 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); stop_compressor(s);
dump_state(chn); dump_state(chn);
} }
...@@ -731,7 +731,7 @@ ssize_t circbuf_write(struct file *file, const char *buf, size_t count, loff_t * ...@@ -731,7 +731,7 @@ ssize_t circbuf_write(struct file *file, const char *buf, size_t count, loff_t *
} }
break; break;
case 4: case 4:
for (i = 0; i < IMAGE_CHN_NUM; i++) for (i = 0; i < SENSOR_PORTS; i++)
stop_compressor(i); stop_compressor(i);
dump_state(chn); dump_state(chn);
break; break;
...@@ -740,7 +740,7 @@ ssize_t circbuf_write(struct file *file, const char *buf, size_t count, loff_t * ...@@ -740,7 +740,7 @@ ssize_t circbuf_write(struct file *file, const char *buf, size_t count, loff_t *
{ {
int j, cntr; int j, cntr;
long long res; long long res;
for (i = 0; i < IMAGE_CHN_NUM; i++) { for (i = 0; i < SENSOR_PORTS; i++) {
cntr = get_zero_counter(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", 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)); i, DW2BYTE(camseq_get_jpeg_wp(i)), cntr, get_corrected_offset(i), get_frame_counter(i));
......
...@@ -90,7 +90,7 @@ static struct jpeghead_priv_t { ...@@ -90,7 +90,7 @@ static struct jpeghead_priv_t {
unsigned int fpga_programmed; unsigned int fpga_programmed;
unsigned long jpeg_h_sz; /// JPEG header size (no Exif) unsigned long jpeg_h_sz; /// JPEG header size (no Exif)
unsigned char header[JPEG_HEADER_MAXSIZE]; 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; \ #define HEADER_COPY_SOF(x) {buf[bpl] = sizeof( x ) + 8; \
buf[bp++] = sizeof( x ) / 3; \ buf[bp++] = sizeof( x ) / 3; \
...@@ -748,7 +748,7 @@ int jpeghead_init(struct platform_device *pdev) ...@@ -748,7 +748,7 @@ int jpeghead_init(struct platform_device *pdev)
int i; int i;
g_dev_ptr = &pdev->dev; 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; jpeghead_priv[i].fpga_programmed = 0;
jpeg_htable_init(i); jpeg_htable_init(i);
} }
...@@ -759,7 +759,7 @@ int jpeghead_init(struct platform_device *pdev) ...@@ -759,7 +759,7 @@ int jpeghead_init(struct platform_device *pdev)
if (get_cache_policy() == COMMON_CACHE) { if (get_cache_policy() == COMMON_CACHE) {
reset_qtables(0); reset_qtables(0);
} else if (get_cache_policy() == PER_CHN_CACHE) { } 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); reset_qtables(i);
} }
......
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
/** @brief Total number of quantization table pairs */ /** @brief Total number of quantization table pairs */
#define FPGA_NQTAB 8 #define FPGA_NQTAB 8
#define CORING_SIZE 32 // longs #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 #define COMMON_CACHE_INDEX 0
......
...@@ -117,13 +117,13 @@ struct jpeg_ptr_t { ...@@ -117,13 +117,13 @@ struct jpeg_ptr_t {
*/ */
struct image_acq_pd_t { struct image_acq_pd_t {
int minor; int minor;
struct jpeg_ptr_t jpeg_ptr[IMAGE_CHN_NUM]; struct jpeg_ptr_t jpeg_ptr[SENSOR_PORTS];
}; };
/* debug code follows */ /* debug code follows */
long long zero_counter[IMAGE_CHN_NUM] = {0}; long long zero_counter[SENSOR_PORTS] = {0};
long long corrected_offset[IMAGE_CHN_NUM] = {0}; long long corrected_offset[SENSOR_PORTS] = {0};
long long frame_counter[IMAGE_CHN_NUM] = {0}; long long frame_counter[SENSOR_PORTS] = {0};
long long frame_pos[IMAGE_CHN_NUM][1000] = {0}; long long frame_pos[SENSOR_PORTS][1000] = {0};
long long get_zero_counter(unsigned int chn) long long get_zero_counter(unsigned int chn)
{ {
return zero_counter[chn]; return zero_counter[chn];
...@@ -138,7 +138,7 @@ long long get_frame_counter(unsigned int chn) ...@@ -138,7 +138,7 @@ long long get_frame_counter(unsigned int chn)
} }
long long get_frame_pos(unsigned int chn, unsigned int pos) 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 frame_pos[chn][pos];
return 0; return 0;
} }
...@@ -174,17 +174,17 @@ void camSeqSetJPEG_rp(int p) { ...@@ -174,17 +174,17 @@ void camSeqSetJPEG_rp(int p) {
int camseq_get_jpeg_wp(unsigned int chn) 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) 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) 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; image_acq_priv.jpeg_ptr[chn].jpeg_rp = ptr;
} }
} }
...@@ -236,7 +236,7 @@ DECLARE_TASKLET(tasklet_fpga_0, tasklet_fpga_function, 0); /// 0 - no arguments ...@@ -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_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_2, tasklet_fpga_function, 2); /// 0 - no arguments for now
DECLARE_TASKLET(tasklet_fpga_3, tasklet_fpga_function, 3); /// 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};
/** /**
...@@ -788,7 +788,7 @@ void camera_interrupts (int on) { ...@@ -788,7 +788,7 @@ void camera_interrupts (int on) {
#endif /* TEST_DISABLE_CODE */ #endif /* TEST_DISABLE_CODE */
irq_ctrl.interrupt_cmd = on ? IRQ_ENABLE : IRQ_DISABLE; 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); x393_cmprs_interrupts(irq_ctrl, i);
} }
} }
...@@ -820,7 +820,7 @@ int image_acq_init(struct platform_device *pdev) ...@@ -820,7 +820,7 @@ int image_acq_init(struct platform_device *pdev)
//MDD1(printk("sensorproc=0x%x\n",(int) sensorproc)); //MDD1(printk("sensorproc=0x%x\n",(int) sensorproc));
dev_dbg(dev, "sensorproc address: 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]); irq = platform_get_irq_byname(pdev, frame_sync_irq_names[i]);
if (request_irq(irq, if (request_irq(irq,
frame_sync_irq_handler, frame_sync_irq_handler,
...@@ -866,7 +866,7 @@ int image_acq_init(struct platform_device *pdev) ...@@ -866,7 +866,7 @@ int image_acq_init(struct platform_device *pdev)
dev_dbg(dev, "Elphel FPGA interrupts initialized\n"); dev_dbg(dev, "Elphel FPGA interrupts initialized\n");
dev_dbg(dev, "reset all compressors\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(i);
} }
//reset_compressor(); /// reset compressor and buffer pointers //reset_compressor(); /// reset compressor and buffer pointers
......
...@@ -7,9 +7,6 @@ ...@@ -7,9 +7,6 @@
#include <elphel/driver_numbers.h> #include <elphel/driver_numbers.h>
/** @brief Number of image channels */
#define IMAGE_CHN_NUM 4
/** @brief Resolution of current/OEF pointer in bits */ /** @brief Resolution of current/OEF pointer in bits */
#define OFFSET256_CNTR_RES 26 #define OFFSET256_CNTR_RES 26
...@@ -62,7 +59,7 @@ static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_ty ...@@ -62,7 +59,7 @@ static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_ty
else else
*dev_type = 0; *dev_type = 0;
} }
if ((minor & 0x0f) < IMAGE_CHN_NUM) if ((minor & 0x0f) < SENSOR_PORTS)
return minor & 0x0f; return minor & 0x0f;
else else
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment