Commit fd58a7d1 authored by Mikhail Karpenko's avatar Mikhail Karpenko

WIP: update jpeg_wr from IRQ

parent f632965f
......@@ -139,17 +139,6 @@ wait_queue_head_t circbuf_wait_queue;
*! CMOSCAM_MINOR_CIRCBUF, CMOSCAM_MINOR_JPEAGHEAD - just a new major
*!========================================================================================================*/
#define CIRCBUF_DRIVER_NAME "Elphel (R) Model 353 video buffer device driver"
static struct file_operations circbuf_fops = {
owner: THIS_MODULE,
llseek: circbuf_all_lseek,
read: circbuf_all_read,
write: circbuf_all_write,
//ioctl: circbuf_all_ioctl,
open: circbuf_all_open,
mmap: circbuf_all_mmap,
poll: circbuf_all_poll,
release: circbuf_all_release
};
// Read/write to circular buffer. Needed to find out what Axis DMA is doing
// also - jpeg header
......@@ -514,38 +503,20 @@ MD12(int dbg_i);
* @return number of bytes read form \e buf
*/
ssize_t circbuf_write(struct file * file, const char * buf, size_t count, loff_t *off) {
void __iomem *mmio;
x393_afimux_status_t val;
int port;
unsigned long p;
char *char_pb = (char *)ccam_dma_buf;
struct circbuf_pd *priv = file->private_data;
// convert char to number
port = buf[0] - 0x30;
/*mmio = ioremap(0x40002060, 16);
if (!mmio) {
printk(KERN_DEBUG "ERROR: can not ioremap region");
return count;
}*/
if (init_mmio_ptr() < 0) {
printk(KERN_DEBUG "ERROR: can not remap IO region\n");
/* debug code follows*/
switch (buf[0] - 0x30) {
case 0:
camera_interrupts(0);
break;
case 1:
camera_interrupts(1);
break;
}
if (port >= 0 && port < 4) {
val = x393_afimux0_status(port);
//val.d32 = readl((void*) (0x40002060 + 0x4 * port));
//val.d32 = ioread32(mmio + 0x4 * port);
} else {
printk(KERN_DEBUG "Unrecognized port number\n");
}
printk(KERN_DEBUG "AFI MUX0 port: %d, AFI MUX0 offset: 0x%x, AFI MUX0 sequence number: %d\n", port, val.offset256 * 32, val.seq_num);
printk(KERN_DEBUG "AFI MUX0 raw value: 0x%x\n", val.d32);
printk(KERN_DEBUG "AFI MUX0 offset265: 0x%x, seq_num: 0x%x\n", val.offset256, val.seq_num);
iounmap(mmio);
mmio = NULL;
return count;
/* debug code end */
D(printk("circbuf_write\n"));
/// ************* NOTE: Never use file->f_pos in write() and read() !!!
......@@ -641,6 +612,18 @@ unsigned int circbuf_poll (struct file *file, poll_table *wait) {
return 0; // nothing ready
}
static struct file_operations circbuf_fops = {
.owner = THIS_MODULE,
.llseek = circbuf_all_lseek,
.read = circbuf_all_read,
.write = circbuf_all_write,
//ioctl: circbuf_all_ioctl,
.open = circbuf_all_open,
.mmap = circbuf_all_mmap,
.poll = circbuf_all_poll,
.release = circbuf_all_release
};
/**
* @brief cirbuf driver probing function
* @param[in] pdev pointer to \b platform_device structure
......@@ -660,8 +643,8 @@ static int circbuf_all_init(struct platform_device *pdev)
MDF19(printk("\n"));
res = register_chrdev(CIRCBUF_MAJOR, "circbuf_operations", &circbuf_fops);
if(res < 0) {
printk(KERN_ERR "\ncircbuf_all_init: couldn't get a major number %d.\n",CIRCBUF_MAJOR);
return res;
dev_err(dev, "couldn't get a major number %d.\n", CIRCBUF_MAJOR);
return res;
}
res = init_ccam_dma_buf_ptr(pdev);
......@@ -676,6 +659,12 @@ static int circbuf_all_init(struct platform_device *pdev)
jpeg_htable_init (); /// set default Huffman table, encode it for the FPGA
dev_info(dev, "registered MAJOR: %d\n", CIRCBUF_MAJOR);
res = image_acq_init(pdev);
if (res < 0) {
dev_err(dev, "unable to initialize sensor_common module\n");
return res;
}
return 0;
}
......
......@@ -577,6 +577,10 @@ void updateFramePars(int frame8, struct interframe_params_t * interframe_pars) {
}
}
void update_frame_pars(void)
{
printk(KERN_DEBUG "%s stub\n", __func__);
}
/**
* @brief process parameters that are overdue or due in ASAP mode (not through the sequencer)
......
......@@ -25,6 +25,7 @@ unsigned long get_globalParam (int n);
void set_globalParam (int n, unsigned long d);
void set_imageParamsR_all(int n, unsigned long d);
void update_frame_pars(void);
void updateFramePars(int frame8, struct interframe_params_t * frame_pars); /// called from ISR - advance thisFrameNumber to match hardware frame8, copy parameters as needed.
/// frame8 usually is just next after thisFrameNumber
/// frame_pars - pointer to structure (between frames in the frame buffer) to save a pointer to past parameters
......
This diff is collapsed.
......@@ -45,4 +45,6 @@ struct sensorproc_t * copy_sensorproc (struct sensorproc_t * copy);
#define PROFILE_NEXT(x) {}
#endif
int image_acq_init(struct platform_device *pdev);
#endif
......@@ -5,8 +5,18 @@
#ifndef _X393_MACRO
#define _X393_MACRO
/** @brief Number of image channels*/
#define IMAGE_CHN_NUM 4
/** @brief Number of image channels */
#define IMAGE_CHN_NUM 4
/** @brief Resolution of current/OEF pointer in bits */
#define OFFSET256_CNTR_RES 26
#define CHUNK_SIZE 32
#define IRQ_NOP 0
#define IRQ_CLEAR 1
#define IRQ_DISABLE 2
#define IRQ_ENABLE 3
/* These macro were removed from sensor_common.h*/
#define X313_LENGTH_MASK 0xff000000
......
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