Commit 1b1c1244 authored by Andrey Filippov's avatar Andrey Filippov

start of merging with master

parent 03c34e84
This diff is collapsed.
...@@ -31,9 +31,6 @@ unsigned int circbuf_poll (struct file *file, poll_table *wait); ...@@ -31,9 +31,6 @@ unsigned int circbuf_poll (struct file *file, poll_table *wait);
*!======================================================================================*/ *!======================================================================================*/
extern wait_queue_head_t circbuf_wait_queue; extern wait_queue_head_t circbuf_wait_queue;
extern unsigned long *ccam_dma_buf_ptr;
//unsigned long *circbuf_get_ccam_ptr(void);
// private data // private data
struct circbuf_priv_t { struct circbuf_priv_t {
int minor; int minor;
...@@ -42,4 +39,11 @@ struct circbuf_priv_t { ...@@ -42,4 +39,11 @@ struct circbuf_priv_t {
}; };
extern struct circbuf_priv_t *circbuf_priv_ptr; extern struct circbuf_priv_t *circbuf_priv_ptr;
/* debug code follows */
extern unsigned short circbuf_quality;
extern unsigned short circbuf_height;
extern unsigned short circbuf_width;
extern unsigned char circbuf_byrshift;
/* end of debug code */
#endif /* _CIRCBUF_H */ #endif /* _CIRCBUF_H */
...@@ -415,12 +415,12 @@ static int elphel393_clock10359_probe(struct platform_device *pdev) ...@@ -415,12 +415,12 @@ static int elphel393_clock10359_probe(struct platform_device *pdev)
static int elphel393_clock10359_remove(struct platform_device *pdev) static int elphel393_clock10359_remove(struct platform_device *pdev)
{ {
dev_info(&pdev->dev,"Removing elphel393-sensor-i2c"); dev_info(&pdev->dev,"Removing elphel393_clock10359");
return 0; return 0;
} }
static struct of_device_id elphel393_clock10359_of_match[] = { static struct of_device_id elphel393_clock10359_of_match[] = {
{ .compatible = "elphel,elphel393-sensor-i2c-1.00", }, { .compatible = "elphel,elphel393_clock10359-1.00", },
{ /* end of table */} { /* end of table */}
}; };
...@@ -430,7 +430,7 @@ static struct platform_driver elphel393_clock10359 = { ...@@ -430,7 +430,7 @@ static struct platform_driver elphel393_clock10359 = {
.probe = elphel393_clock10359_probe, .probe = elphel393_clock10359_probe,
.remove = elphel393_clock10359_remove, .remove = elphel393_clock10359_remove,
.driver = { .driver = {
.name = "elphel393-sensor-i2c", .name = DRV_NAME,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = elphel393_clock10359_of_match, .of_match_table = elphel393_clock10359_of_match,
.pm = NULL, /* power management */ .pm = NULL, /* power management */
...@@ -440,7 +440,7 @@ static struct platform_driver elphel393_clock10359 = { ...@@ -440,7 +440,7 @@ static struct platform_driver elphel393_clock10359 = {
module_platform_driver(elphel393_clock10359); module_platform_driver(elphel393_clock10359);
MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>"); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>");
MODULE_DESCRIPTION("Elphel 10393 sensor ports i2c"); MODULE_DESCRIPTION("Elphel 10393 10359");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
...@@ -176,12 +176,24 @@ ssize_t minor_file_size(int minor) { //return current file size for different mi ...@@ -176,12 +176,24 @@ ssize_t minor_file_size(int minor) { //return current file size for different mi
} }
ssize_t minor_max_size(int minor) { //return max file size for different minors ssize_t minor_max_size(int minor) { //return max file size for different minors
switch (minor) { switch (minor) {
case X3X3_EXIF_TEMPLATE: return MAX_EXIF_SIZE; case X3X3_EXIF_TEMPLATE:
case X3X3_EXIF_EXIF: return MAX_EXIF_SIZE * (MAX_EXIF_FRAMES+1); return MAX_EXIF_SIZE;
case X3X3_EXIF_META: return MAX_EXIF_SIZE; case X3X3_EXIF_EXIF_CHN_0:
case X3X3_EXIF_METADIR: return MAX_EXIF_FIELDS * sizeof(struct exif_dir_table_t); case X3X3_EXIF_EXIF_CHN_1:
case X3X3_EXIF_TIME: return sizeof(struct exif_time_t); case X3X3_EXIF_EXIF_CHN_2:
default:return 0; case X3X3_EXIF_EXIF_CHN_3:
return MAX_EXIF_SIZE * (MAX_EXIF_FRAMES+1);
case X3X3_EXIF_META_CHN_0:
case X3X3_EXIF_META_CHN_1:
case X3X3_EXIF_META_CHN_2:
case X3X3_EXIF_META_CHN_3:
return MAX_EXIF_SIZE;
case X3X3_EXIF_METADIR:
return MAX_EXIF_FIELDS * sizeof(struct exif_dir_table_t);
case X3X3_EXIF_TIME:
return sizeof(struct exif_time_t);
default:
return 0;
} }
} }
void exif_invalidate(void) { // 393: OK, only invalidates all ayt once void exif_invalidate(void) { // 393: OK, only invalidates all ayt once
...@@ -231,6 +243,7 @@ int exif_rebuild_chn(int sensor_port, int frames) { ...@@ -231,6 +243,7 @@ int exif_rebuild_chn(int sensor_port, int frames) {
return -1; return -1;
} }
memset(meta_buffer, 0, aexif_meta_size[sensor_port] * (MAX_EXIF_FRAMES+1)); memset(meta_buffer, 0, aexif_meta_size[sensor_port] * (MAX_EXIF_FRAMES+1));
ameta_buffer[sensor_port] = meta_buffer;
aexif_valid[sensor_port] = 1; aexif_valid[sensor_port] = 1;
return 0; return 0;
} }
...@@ -507,7 +520,6 @@ static loff_t exif_lseek (struct file * file, loff_t offset, int orig) { ...@@ -507,7 +520,6 @@ static loff_t exif_lseek (struct file * file, loff_t offset, int orig) {
int maxsize=minor_max_size(p); int maxsize=minor_max_size(p);
// int sensor_port; // int sensor_port;
int fp; int fp;
switch (orig) { switch (orig) {
case SEEK_SET: case SEEK_SET:
file->f_pos = offset; file->f_pos = offset;
...@@ -539,44 +551,44 @@ static loff_t exif_lseek (struct file * file, loff_t offset, int orig) { ...@@ -539,44 +551,44 @@ static loff_t exif_lseek (struct file * file, loff_t offset, int orig) {
default:return -EINVAL; default:return -EINVAL;
} }
break; break;
case X3X3_EXIF_EXIF_CHN_0: case X3X3_EXIF_EXIF_CHN_0:
case X3X3_EXIF_EXIF_CHN_1: case X3X3_EXIF_EXIF_CHN_1:
case X3X3_EXIF_EXIF_CHN_2: case X3X3_EXIF_EXIF_CHN_2:
case X3X3_EXIF_EXIF_CHN_3: case X3X3_EXIF_EXIF_CHN_3:
// sensor_port = p - X3X3_EXIF_EXIF_CHN_0; // sensor_port = p - X3X3_EXIF_EXIF_CHN_0;
if (offset > MAX_EXIF_FRAMES) return -EOVERFLOW; //larger than buffer if (offset > MAX_EXIF_FRAMES) return -EOVERFLOW; //larger than buffer
// file->f_pos=exif_meta_size * offset; // file->f_pos=exif_meta_size * offset;
file->f_pos=exif_template_size * offset; file->f_pos=exif_template_size * offset;
break;
case X3X3_EXIF_META: // iterate
fp= dir_find_tag (offset);
if (fp < 0) return -EOVERFLOW; // tag is not in the directory
file->f_pos=fp;
break;
case X3X3_EXIF_META_CHN_0:
case X3X3_EXIF_META_CHN_1:
case X3X3_EXIF_META_CHN_2:
case X3X3_EXIF_META_CHN_3:
file->f_pos=offset*sizeof(struct exif_dir_table_t);
break;
case X3X3_EXIF_TIME:
switch (offset) {
case EXIF_LSEEK_TOMORROW_DATE:
file->f_pos=exif_time.tomorrow_date - ((char *) &exif_time);
break; break;
case X3X3_EXIF_META: // iterate case EXIF_LSEEK_TOMORROW_SEC:
fp= dir_find_tag (offset); file->f_pos=((char *) &exif_time.tomorrow_sec) - ((char *) &exif_time);
if (fp < 0) return -EOVERFLOW; // tag is not in the directory
file->f_pos=fp;
break; break;
case X3X3_EXIF_META_CHN_0: case EXIF_LSEEK_TODAY_DATE:
case X3X3_EXIF_META_CHN_1: file->f_pos=exif_time.today_date - ((char *) &exif_time);
case X3X3_EXIF_META_CHN_2:
case X3X3_EXIF_META_CHN_3:
file->f_pos=offset*sizeof(struct exif_dir_table_t);
break; break;
case X3X3_EXIF_TIME: case EXIF_LSEEK_TODAY_SEC:
switch (offset) { file->f_pos=((char *) &exif_time.today_sec) - ((char *) &exif_time);
case EXIF_LSEEK_TOMORROW_DATE:
file->f_pos=exif_time.tomorrow_date - ((char *) &exif_time);
break;
case EXIF_LSEEK_TOMORROW_SEC:
file->f_pos=((char *) &exif_time.tomorrow_sec) - ((char *) &exif_time);
break;
case EXIF_LSEEK_TODAY_DATE:
file->f_pos=exif_time.today_date - ((char *) &exif_time);
break;
case EXIF_LSEEK_TODAY_SEC:
file->f_pos=((char *) &exif_time.today_sec) - ((char *) &exif_time);
break;
default:return -EINVAL;
}
break; break;
default:return -EINVAL; default:return -EINVAL;
}
break;
default:return -EINVAL;
} }
} }
break; break;
......
...@@ -25,10 +25,10 @@ int exif_enable_chn(int sensor_port, int en); // enable/disable Exif process ...@@ -25,10 +25,10 @@ int exif_enable_chn(int sensor_port, int en); // enable/disable Exif process
int exif_enable(int en); // For all sensor ports int exif_enable(int en); // For all sensor ports
int dir_find_tag (unsigned long tag); //!find location of the tag field in meta page using long tag (Exif tag and tag group) int dir_find_tag (unsigned long tag); //!find location of the tag field in meta page using long tag (Exif tag and tag group)
inline void write_meta_raw_irq(int sensor_port, char * data, int offset, int len); //write data to meta, called from IRQ void write_meta_raw_irq(int sensor_port, char * data, int offset, int len); //write data to meta, called from IRQ
inline int write_meta_irq(int sensor_port, char * data, int * indx, unsigned long ltag, int len); //write data to meta, called from IRQ(len==0 => use field length) int write_meta_irq(int sensor_port, char * data, int * indx, unsigned long ltag, int len); //write data to meta, called from IRQ(len==0 => use field length)
inline void putlong_meta_raw_irq(int sensor_port, unsigned long data, int offset); //write data to meta (4 bytes, big endian), called from IRQ void putlong_meta_raw_irq(int sensor_port, unsigned long data, int offset); //write data to meta (4 bytes, big endian), called from IRQ
inline int putlong_meta_irq(int sensor_port, unsigned long data, int * indx, unsigned long ltag); //write data to meta (4 bytes, big endian), from IRQ int putlong_meta_irq(int sensor_port, unsigned long data, int * indx, unsigned long ltag); //write data to meta (4 bytes, big endian), from IRQ
//void write_meta_raw_irq(char * data, int offset, int len); //write data to meta, called from IRQ //void write_meta_raw_irq(char * data, int offset, int len); //write data to meta, called from IRQ
//int write_meta_irq(char * data, int * indx, unsigned long ltag, int len); //write data to meta, called from IRQ(len==0 => use field length). Returns index of the written data, -1 if not written //int write_meta_irq(char * data, int * indx, unsigned long ltag, int len); //write data to meta, called from IRQ(len==0 => use field length). Returns index of the written data, -1 if not written
...@@ -37,7 +37,7 @@ int write_meta(int sensor_port, char * data, int * indx, unsigned long ltag, in ...@@ -37,7 +37,7 @@ int write_meta(int sensor_port, char * data, int * indx, unsigned long ltag, in
void putlong_meta_raw(int sensor_port, unsigned long data, int offset); //write data to meta (4 bytes, big endian), called from outside IRQ (atomic) void putlong_meta_raw(int sensor_port, unsigned long data, int offset); //write data to meta (4 bytes, big endian), called from outside IRQ (atomic)
int putlong_meta(int sensor_port, unsigned long data, int * indx, unsigned long ltag); //write data to meta (4 bytes, big endian), from outside IRQ (atomic). Returns index of the written data, -1 if not written int putlong_meta(int sensor_port, unsigned long data, int * indx, unsigned long ltag); //write data to meta (4 bytes, big endian), from outside IRQ (atomic). Returns index of the written data, -1 if not written
char * encode_time(unsigned long sec, unsigned long usec); char * encode_time(char buf[27], unsigned long sec, unsigned long usec);
int store_meta(int sensor_port); //called from IRQ service - put current metadata to meta_buffer, return page index int store_meta(int sensor_port); //called from IRQ service - put current metadata to meta_buffer, return page index
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
*/ */
//copied from cxi2c.c - TODO:remove unneeded //copied from cxi2c.c - TODO:remove unneeded
#undef JTAG_BRANCH
#include <linux/types.h> /// div for 64 #include <linux/types.h> /// div for 64
#include <asm/div64.h> /// div for 64 #include <asm/div64.h> /// div for 64
...@@ -147,7 +147,9 @@ wait_queue_head_t aframepars_wait_queue[SENSOR_PORTS];/// used to wait for ...@@ -147,7 +147,9 @@ wait_queue_head_t aframepars_wait_queue[SENSOR_PORTS];/// used to wait for
/* Remove after compilation OK */ /* Remove after compilation OK */
struct sensorproc_t * sensorproc = NULL; struct sensorproc_t * sensorproc = NULL;
#ifdef JTAG_BRANCH
void camera_interrupts (int on) {} void camera_interrupts (int on) {}
#endif
#if 0 #if 0
#define wait_event_interruptible(wq, condition) \ #define wait_event_interruptible(wq, condition) \
({ \ ({ \
...@@ -1340,7 +1342,7 @@ int framepars_remove(struct platform_device *pdev) ...@@ -1340,7 +1342,7 @@ int framepars_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef JTAG_BRANCH
static const struct of_device_id elphel393_framepars_of_match[] = { static const struct of_device_id elphel393_framepars_of_match[] = {
{ .compatible = "elphel,elphel393-framepars-1.00" }, { .compatible = "elphel,elphel393-framepars-1.00" },
{ /* end of list */ } { /* end of list */ }
...@@ -1361,3 +1363,4 @@ module_platform_driver(elphel393_framepars); ...@@ -1361,3 +1363,4 @@ module_platform_driver(elphel393_framepars);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>."); MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
MODULE_DESCRIPTION(X3X3_FRAMEPARS_DRIVER_NAME); MODULE_DESCRIPTION(X3X3_FRAMEPARS_DRIVER_NAME);
#endif
\ No newline at end of file
This diff is collapsed.
...@@ -4,13 +4,13 @@ ...@@ -4,13 +4,13 @@
*/ */
#ifndef _ASM_CMOSCAM_H #ifndef _ASM_CMOSCAM_H
#define _ASM_CMOSCAM_HPARS_FRAMES #define _ASM_CMOSCAM_H
#define SAFE_CHECK 1 // perform more verification on the paremeters #define SAFE_CHECK 1 // perform more verification on the paremeters
//#define ELPHEL_DEBUG 0 //global debug on/off in multiple files //#define ELPHEL_DEBUG 0 //global debug on/off in multiple files
//#define ELPHEL_DEBUG_STARTUP 000a4c00 ; //#define ELPHEL_DEBUG_STARTUP 000a4c00 ;
//#define ELPHEL_DEBUG_STARTUP 0 ; // removed - add write to fpga init script //#define ELPHEL_DEBUG_STARTUP 0 ; // removed - add write to fpga init script
//#define ELPHEL_DEBUG 0 //global debug on/off in multiple files //#define ELPHEL_DEBUG 0 //global debug on/off in multiple files
#define ELPHEL_DEBUG 1 //global debug on/off in multiple files #define ELPHEL_DEBUG 0 //global debug on/off in multiple files
#define ELPHEL_DEBUG_DELAY 100000 //delay after some printk-s #define ELPHEL_DEBUG_DELAY 100000 //delay after some printk-s
#define ELP_KERR(x) printk("%s:%d:%s: ERROR ",__FILE__,__LINE__,__FUNCTION__);x #define ELP_KERR(x) printk("%s:%d:%s: ERROR ",__FILE__,__LINE__,__FUNCTION__);x
#define ELP_FERR(x) fprintf(stderr,"%s:%d:%s: ERROR ",__FILE__,__LINE__,__FUNCTION__);x #define ELP_FERR(x) fprintf(stderr,"%s:%d:%s: ERROR ",__FILE__,__LINE__,__FUNCTION__);x
...@@ -911,7 +911,7 @@ struct framepars_past_t { ...@@ -911,7 +911,7 @@ struct framepars_past_t {
// size should be PAGE_SIZE aligned // size should be PAGE_SIZE aligned
struct framepars_all_t { struct framepars_all_t {
struct framepars_t framePars[PARS_FRAMES]; struct framepars_t framePars[PARS_FRAMES];
struct framepars_t func2call; /// func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used struct framepars_t func2call; /// func2call.pars[] - each parameter has a 32-bit mask of what pgm_function to call - other fields not used
unsigned long globalPars[NUM_GPAR]; /// parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W unsigned long globalPars[NUM_GPAR]; /// parameters that are not frame-related, their changes do not initiate any actions so they can be mmaped for both R/W
struct framepars_past_t pastPars [PASTPARS_SAVE_ENTRIES]; struct framepars_past_t pastPars [PASTPARS_SAVE_ENTRIES];
unsigned long multiSensIndex[P_MAX_PAR_ROUNDUP]; /// indexes of individual sensor register shadows (first of 3) - now for all parameters, not just sensor ones unsigned long multiSensIndex[P_MAX_PAR_ROUNDUP]; /// indexes of individual sensor register shadows (first of 3) - now for all parameters, not just sensor ones
...@@ -1377,6 +1377,8 @@ struct p_names_t { ...@@ -1377,6 +1377,8 @@ struct p_names_t {
#define LSEEK_CIRC_WAIT 11 #define LSEEK_CIRC_WAIT 11
#define LSEEK_CIRC_FREE 12 #define LSEEK_CIRC_FREE 12
#define LSEEK_CIRC_USED 13 #define LSEEK_CIRC_USED 13
#define LSEEK_CIRC_STOP_COMPRESSOR 14
#define LSEEK_CIRC_UTIME 15
#define LSEEK_HUFFMAN_DC0 1 #define LSEEK_HUFFMAN_DC0 1
#define LSEEK_HUFFMAN_AC0 2 #define LSEEK_HUFFMAN_AC0 2
...@@ -1525,7 +1527,7 @@ struct p_names_t { ...@@ -1525,7 +1527,7 @@ struct p_names_t {
/* For past compatibility, CCMA_DMA_SIZE... /* For past compatibility, CCMA_DMA_SIZE...
*/ */
//#define CCAM_DMA_SIZE CCAM_WORDS_PER_DMABUF //#define CCAM_DMA_SIZE CCAM_WORDS_PER_DMABUF
#define CCAM_DMA_SIZE 0x1000000 #define CCAM_DMA_SIZE 0x4000000
#define CIRCBUF_START_OFFSET 0x100000 #define CIRCBUF_START_OFFSET 0x100000
/* /*
......
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