Commit 01956c03 authored by Andrey Filippov's avatar Andrey Filippov

working on logger driver

parent d5584335
...@@ -69,7 +69,7 @@ static struct elphel_buf_t _elphel_buf = { ...@@ -69,7 +69,7 @@ static struct elphel_buf_t _elphel_buf = {
// Device to host stream DMA buffer for the logger // Device to host stream DMA buffer for the logger
.logger_vaddr = NULL, .logger_vaddr = NULL,
.logger_paddr = 0, .logger_paddr = 0,
.logger_size = 1024 .logger_size = 1024 // should be 2**n !
}; };
...@@ -523,23 +523,23 @@ static int elphel393_mem_probe(struct platform_device *pdev) ...@@ -523,23 +523,23 @@ static int elphel393_mem_probe(struct platform_device *pdev)
printk("H2D stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> h2d_vaddr); printk("H2D stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> h2d_vaddr);
printk("H2D stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> h2d_paddr); printk("H2D stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> h2d_paddr);
printk("H2D stream buffer length: 0x%08X\n",(u32) pElphel_buf -> h2d_size * PAGE_SIZE); printk("H2D stream buffer length: 0x%08lX\n",(u32) pElphel_buf -> h2d_size * PAGE_SIZE);
printk("D2H stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> d2h_vaddr); printk("D2H stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> d2h_vaddr);
printk("D2H stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> d2h_paddr); printk("D2H stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> d2h_paddr);
printk("D2H stream buffer length: 0x%08X\n",(u32) pElphel_buf -> d2h_size * PAGE_SIZE); printk("D2H stream buffer length: 0x%08lX\n",(u32) pElphel_buf -> d2h_size * PAGE_SIZE);
printk("Bidirectional stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> bidir_vaddr); printk("Bidirectional stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> bidir_vaddr);
printk("Bidirectional stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> bidir_paddr); printk("Bidirectional stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> bidir_paddr);
printk("Bidirectional stream buffer length: 0x%08X\n",(u32) pElphel_buf -> bidir_size * PAGE_SIZE); printk("Bidirectional stream buffer length: 0x%08lX\n",(u32) pElphel_buf -> bidir_size * PAGE_SIZE);
printk("HISTOGRAMS stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> histograms_vaddr); printk("HISTOGRAMS stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> histograms_vaddr);
printk("HISTOGRAMS stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> histograms_paddr); printk("HISTOGRAMS stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> histograms_paddr);
printk("HISTOGRAMS stream buffer length: 0x%08X\n",(u32) pElphel_buf -> histograms_size * PAGE_SIZE); printk("HISTOGRAMS stream buffer length: 0x%08lX\n",(u32) pElphel_buf -> histograms_size * PAGE_SIZE);
printk("LOGGER stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> logger_vaddr); printk("LOGGER stream buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> logger_vaddr);
printk("LOGGER stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> logger_paddr); printk("LOGGER stream buffer paddr: 0x%08X\n",(u32) pElphel_buf -> logger_paddr);
printk("LOGGER stream buffer length: 0x%08X\n",(u32) pElphel_buf -> logger_size * PAGE_SIZE); printk("LOGGER stream buffer length: 0x%08lX\n",(u32) pElphel_buf -> logger_size * PAGE_SIZE);
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
void x313_dma1_start(void); void logger_dma_start(void);
int x313_dma1_stop(void); int logger_dma_stop(void);
int x313_is_dma1_on(void); int logger_is_dma_on(void);
unsigned long x313_dma1_init(void); unsigned long x313_dma1_init(void);
void logger_irq_cmd(int cmd);
...@@ -609,7 +609,8 @@ For displaying histograms - try use latest available - not waiting fro a particu ...@@ -609,7 +609,8 @@ For displaying histograms - try use latest available - not waiting fro a particu
// HISTOGRAMS_WAKEUP_ALWAYS if 0 will only wakeup processes waiting for histograms when they become available, maybe never if they are disabled // HISTOGRAMS_WAKEUP_ALWAYS if 0 will only wakeup processes waiting for histograms when they become available, maybe never if they are disabled
// if defined 1 - will wakeup each frame, regardless of the availability of the histograms // if defined 1 - will wakeup each frame, regardless of the availability of the histograms
//#define HISTOGRAMS_WAKEUP_ALWAYS 0 //#define HISTOGRAMS_WAKEUP_ALWAYS 0
void tasklet_fpga_function(unsigned long arg) { void tasklet_fpga_function(unsigned long arg)
{
int is_compressor_irq = 1; // TODO: add interrupts from frame sync if compressor is off int is_compressor_irq = 1; // TODO: add interrupts from frame sync if compressor is off
int hist_en; int hist_en;
int sensor_port = image_acq_priv.jpeg_ptr[arg].chn_num; int sensor_port = image_acq_priv.jpeg_ptr[arg].chn_num;
...@@ -669,7 +670,7 @@ void tasklet_fpga_function(unsigned long arg) { ...@@ -669,7 +670,7 @@ void tasklet_fpga_function(unsigned long arg) {
default: // calculate always (safer) default: // calculate always (safer)
hist_en=1; hist_en=1;
} }
//#ifdef TEST_DISABLE_CODE //#ifdef TEST_DISABLE_CODE
if (hist_en) { if (hist_en) {
// after updateFramePars gammaHash are from framepars[this-1] // after updateFramePars gammaHash are from framepars[this-1]
for (subchn=0;subchn<MAX_SENSORS;subchn++) if (((hist_indx=get_hist_index(sensor_port,subchn)))>=0){ for (subchn=0;subchn<MAX_SENSORS;subchn++) if (((hist_indx=get_hist_index(sensor_port,subchn)))>=0){
...@@ -687,52 +688,44 @@ void tasklet_fpga_function(unsigned long arg) { ...@@ -687,52 +688,44 @@ void tasklet_fpga_function(unsigned long arg) {
} }
PROFILE_NOW(3); PROFILE_NOW(3);
// Time is out? // Time is out?
// Old 353 if ((getThisFrameNumber(sensor_port) ^ X3X3_I2C_FRAME) & PARS_FRAMES_MASK) return; // already next frame // Old 353 if ((getThisFrameNumber(sensor_port) ^ X3X3_I2C_FRAME) & PARS_FRAMES_MASK) return; // already next frame
if ((getThisFrameNumber(sensor_port) ^ getHardFrameNumber(sensor_port,is_compressor_irq)) & PARS_FRAMES_MASK) return; // already next frame if ((getThisFrameNumber(sensor_port) ^ getHardFrameNumber(sensor_port,is_compressor_irq)) & PARS_FRAMES_MASK) return; // already next frame
#if HISTOGRAMS_WAKEUP_ALWAYS #if HISTOGRAMS_WAKEUP_ALWAYS
} }
wake_up_interruptible(&hist_y_wait_queue); // wait queue for the G1 histogram (used as Y) wake_up_interruptible(&hist_y_wait_queue); // wait queue for the G1 histogram (used as Y)
#else #else
wake_up_interruptible(&hist_y_wait_queue); // wait queue for the G1 histogram (used as Y) wake_up_interruptible(&hist_y_wait_queue); // wait queue for the G1 histogram (used as Y)
} }
#endif #endif
//#endif /* TEST_DISABLE_CODE */ // Process parameters
// Process parameters if ((tasklet_disable & (1 << TASKLET_CTL_PGM)) == 0) {
if ((tasklet_disable & (1 << TASKLET_CTL_PGM)) == 0) {
processPars (sensor_port, sensorproc, getThisFrameNumber(sensor_port), get_globalParam(sensor_port, G_MAXAHEAD)); // program parameters processPars (sensor_port, sensorproc, getThisFrameNumber(sensor_port), get_globalParam(sensor_port, G_MAXAHEAD)); // program parameters
PROFILE_NOW(4); PROFILE_NOW(4);
} }
// Time is out? // Time is out?
if ((getThisFrameNumber(sensor_port) ^ getHardFrameNumber(sensor_port,is_compressor_irq)) & PARS_FRAMES_MASK) return; // already next frame if ((getThisFrameNumber(sensor_port) ^ getHardFrameNumber(sensor_port,is_compressor_irq)) & PARS_FRAMES_MASK) return; // already next frame
// Are C histograms needed? // Are C histograms needed?
switch ((tasklet_disable >> TASKLET_CTL_HISTC_BIT) & 7) { switch ((tasklet_disable >> TASKLET_CTL_HISTC_BIT) & 7) {
case TASKLET_HIST_NEVER: // never calculate case TASKLET_HIST_NEVER: // never calculate
hist_en=0; hist_en=0;
break; break;
case TASKLET_HIST_HALF: // calculate each even (0,2,4,6 frme of 8) case TASKLET_HIST_HALF: // calculate each even (0,2,4,6 frme of 8)
hist_en= ((thisFrameNumber & 1) ==0) || (get_imageParamsPrev(sensor_port, P_HISTRQ) & (1<<HISTRQ_BIT_C)); hist_en= ((thisFrameNumber & 1) ==0) || (get_imageParamsPrev(sensor_port, P_HISTRQ) & (1<<HISTRQ_BIT_C));
break; break;
case TASKLET_HIST_QUATER: // calculate twice per 8 (0, 4) case TASKLET_HIST_QUATER: // calculate twice per 8 (0, 4)
hist_en= ((thisFrameNumber & 3) ==0) || (get_imageParamsPrev(sensor_port, P_HISTRQ) & (1<<HISTRQ_BIT_C)); hist_en= ((thisFrameNumber & 3) ==0) || (get_imageParamsPrev(sensor_port, P_HISTRQ) & (1<<HISTRQ_BIT_C));
break; break;
case TASKLET_HIST_ONCE: // calculate once per 8 (0) case TASKLET_HIST_ONCE: // calculate once per 8 (0)
hist_en= ((thisFrameNumber & 7) ==0) || (get_imageParamsPrev(sensor_port, P_HISTRQ) & (1<<HISTRQ_BIT_C)); hist_en= ((thisFrameNumber & 7) ==0) || (get_imageParamsPrev(sensor_port, P_HISTRQ) & (1<<HISTRQ_BIT_C));
break; break;
case TASKLET_HIST_RQONLY: // calculate only when specifically requested case TASKLET_HIST_RQONLY: // calculate only when specifically requested
hist_en= (get_imageParamsPrev(sensor_port, P_HISTRQ) & (1<<HISTRQ_BIT_C)); hist_en= (get_imageParamsPrev(sensor_port, P_HISTRQ) & (1<<HISTRQ_BIT_C));
break; break;
case TASKLET_HIST_ALL: // calculate each frame case TASKLET_HIST_ALL: // calculate each frame
default: // calculate always (safer) default: // calculate always (safer)
hist_en=1; hist_en=1;
} }
/* if (hist_en) {
GLOBALPARS(0x1040)=((thisFrameNumber & 1) ==0);
GLOBALPARS(0x1041)=((thisFrameNumber & 3) ==0);
GLOBALPARS(0x1042)=((thisFrameNumber & 7) ==0);
GLOBALPARS(0x1043)=hist_en;
GLOBALPARS(0x1044)=thisFrameNumber;
*/
if (hist_en) {
// after updateFramePars gammaHash are from framepars[this-1] // after updateFramePars gammaHash are from framepars[this-1]
// after updateFramePars gammaHash are from framepars[this-1] // after updateFramePars gammaHash are from framepars[this-1]
for (subchn=0;subchn<MAX_SENSORS;subchn++) if (((hist_indx=get_hist_index(sensor_port,subchn)))>=0){ for (subchn=0;subchn<MAX_SENSORS;subchn++) if (((hist_indx=get_hist_index(sensor_port,subchn)))>=0){
...@@ -751,15 +744,12 @@ if (hist_en) { ...@@ -751,15 +744,12 @@ if (hist_en) {
PROFILE_NOW(5); PROFILE_NOW(5);
// Time is out? // Time is out?
if ((getThisFrameNumber(sensor_port) ^ getHardFrameNumber(sensor_port,is_compressor_irq)) & PARS_FRAMES_MASK) return; // already next frame if ((getThisFrameNumber(sensor_port) ^ getHardFrameNumber(sensor_port,is_compressor_irq)) & PARS_FRAMES_MASK) return; // already next frame
#if HISTOGRAMS_WAKEUP_ALWAYS #if HISTOGRAMS_WAKEUP_ALWAYS
} }
wake_up_interruptible(&hist_c_wait_queue); // wait queue for all the other (R,G2,B) histograms (color) wake_up_interruptible(&hist_c_wait_queue); // wait queue for all the other (R,G2,B) histograms (color)
#else #else
wake_up_interruptible(&hist_c_wait_queue); // wait queue for all the other (R,G2,B) histograms (color) wake_up_interruptible(&hist_c_wait_queue); // wait queue for all the other (R,G2,B) histograms (color)
} }
#endif #endif
} }
...@@ -855,7 +845,7 @@ int image_acq_init(struct platform_device *pdev) ...@@ -855,7 +845,7 @@ int image_acq_init(struct platform_device *pdev)
dev_err(dev, "can not allocate Elphel FPGA interrupts\n"); dev_err(dev, "can not allocate Elphel FPGA interrupts\n");
return -EBUSY; return -EBUSY;
} }
image_acq_priv.jpeg_ptr[i].irq_num_sens = irq;
irq = platform_get_irq_byname(pdev, compressor_irq_names[i]); irq = platform_get_irq_byname(pdev, compressor_irq_names[i]);
if (request_irq(irq, if (request_irq(irq,
compressor_irq_handler, compressor_irq_handler,
...@@ -865,7 +855,6 @@ int image_acq_init(struct platform_device *pdev) ...@@ -865,7 +855,6 @@ int image_acq_init(struct platform_device *pdev)
dev_err(dev, "can not allocate Elphel FPGA interrupts\n"); dev_err(dev, "can not allocate Elphel FPGA interrupts\n");
return -EBUSY; return -EBUSY;
} }
image_acq_priv.jpeg_ptr[i].irq_num_sens = irq;
image_acq_priv.jpeg_ptr[i].irq_num_comp = irq; image_acq_priv.jpeg_ptr[i].irq_num_comp = irq;
image_acq_priv.jpeg_ptr[i].chn_num = i; image_acq_priv.jpeg_ptr[i].chn_num = i;
} }
......
...@@ -1552,11 +1552,12 @@ struct p_names_t { ...@@ -1552,11 +1552,12 @@ struct p_names_t {
* CCAM_MMAP_SIZE -- no. of bytes to mmap. * CCAM_MMAP_SIZE -- no. of bytes to mmap.
*/ */
// CCAM_DMA1_SIZE should be 2^N // CCAM_DMA1_SIZE should be 2^N
#ifdef NC353
#define CCAM_CHUNK_PER_DMA1BUF 16 /* no. of 64Kbyte chunks per buffer */ #define CCAM_CHUNK_PER_DMA1BUF 16 /* no. of 64Kbyte chunks per buffer */
#define CCAM_WORDS_PER_DMA1BUF (CCAM_CHUNK_PER_DMA1BUF<<14) /*32bit words...*/ #define CCAM_WORDS_PER_DMA1BUF (CCAM_CHUNK_PER_DMA1BUF<<14) /*32bit words...*/
#define CCAM_BYTES_PER_DMA1BUF (CCAM_CHUNK_PER_DMA1BUF<<16) #define CCAM_BYTES_PER_DMA1BUF (CCAM_CHUNK_PER_DMA1BUF<<16)
#define CCAM_DMA1_SIZE CCAM_WORDS_PER_DMA1BUF #define CCAM_DMA1_SIZE CCAM_WORDS_PER_DMA1BUF
#endif
#define CCAM_MMAP_OFFSET_MMAP_HEADER 0 #define CCAM_MMAP_OFFSET_MMAP_HEADER 0
......
...@@ -17,12 +17,12 @@ ...@@ -17,12 +17,12 @@
//#define IMAGERAW_MAJOR 139 //#define IMAGERAW_MAJOR 139
#define IMAGERAW_MAJOR 131 #define IMAGERAW_MAJOR 131
#define IMAGEACQ_MAJOR 140 #define IMAGEACQ_MAJOR 140
#define IMU_MAJOR 141 #define LOGGER_MAJOR 141
/// MINORS /// MINORS
#define IMU_MINOR 1 #define LOGGER_MINOR 1
#define IMU_CTL_MINOR 2 #define LOGGER_CTL_MINOR 2
#define IMAGERAW_MINOR_FRAME 1 #define IMAGERAW_MINOR_FRAME 1
#define IMAGERAW_MINOR_FPN 2 #define IMAGERAW_MINOR_FPN 2
#define IMAGERAW_MINOR_UNLOCK 3 #define IMAGERAW_MINOR_UNLOCK 3
......
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