Commit 385eb407 authored by Andrey Filippov's avatar Andrey Filippov

histograms debugging, project setup files updated

parent 4ddade87
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_DISABLED_BUILDER" value="org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder"/>
<mapAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>
...@@ -11,16 +11,6 @@ ...@@ -11,16 +11,6 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
<dictionary>
<key>LaunchConfigHandle</key>
<value>&lt;project&gt;/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder.launch</value>
</dictionary>
</arguments>
</buildCommand>
<buildCommand> <buildCommand>
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name> <name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
<triggers>clean,</triggers> <triggers>clean,</triggers>
......
...@@ -495,7 +495,7 @@ inline int get_image_start_chn(int last_chunk_offset, unsigned int len32, int ch ...@@ -495,7 +495,7 @@ inline int get_image_start_chn(int last_chunk_offset, unsigned int len32, int ch
return X393_BUFFSUB_CHN(last_chunk_offset + CHUNK_SIZE - INSERTED_BYTES(len32) - CCAM_MMAP_META, len32, chn); return X393_BUFFSUB_CHN(last_chunk_offset + CHUNK_SIZE - INSERTED_BYTES(len32) - CCAM_MMAP_META, len32, chn);
} }
#ifdef PRE_FRAMEPARS
/* debug code follows */ /* debug code follows */
void stop_compressor(unsigned int chn) void stop_compressor(unsigned int chn)
{ {
...@@ -503,8 +503,9 @@ void stop_compressor(unsigned int chn) ...@@ -503,8 +503,9 @@ void stop_compressor(unsigned int chn)
mode.run = 1; mode.run = 1;
mode.run_set = 1; mode.run_set = 1;
x393_cmprs_control_reg(mode, chn); set_x393_cmprs_control_reg(mode, chn);
} }
#endif
void dump_state(unsigned int chn) void dump_state(unsigned int chn)
{ {
int img_start, last_image_chunk; int img_start, last_image_chunk;
......
This diff is collapsed.
...@@ -24,6 +24,8 @@ unsigned long get_imageParamsThis (int sensor_port, int n); ...@@ -24,6 +24,8 @@ unsigned long get_imageParamsThis (int sensor_port, int n);
unsigned long get_imageParamsPrev (int sensor_port, int n); unsigned long get_imageParamsPrev (int sensor_port, int n);
unsigned long get_imageParamsPast(int sensor_port, int n, int frame); unsigned long get_imageParamsPast(int sensor_port, int n, int frame);
unsigned long * get_imageParamsFramePtr(int sensor_port, int n, int frame);
unsigned long * get_imageParamsPastPtr (int sensor_port, int n, int frame);
void set_imageParamsThis (int sensor_port, int n, unsigned long d); void set_imageParamsThis (int sensor_port, int n, unsigned long d);
unsigned long get_globalParam (int sensor_port, int n); unsigned long get_globalParam (int sensor_port, int n);
...@@ -69,9 +71,5 @@ void schedule_this_pgm_func (int sensor_port, struct framepars_t * this_fr ...@@ -69,9 +71,5 @@ void schedule_this_pgm_func (int sensor_port, struct framepars_t * this_fr
//inline void _processParsSeq (int sensor_port, struct sensorproc_t * sensorproc, int frame8, int maxahead); //inline void _processParsSeq (int sensor_port, struct sensorproc_t * sensorproc, int frame8, int maxahead);
int processPars (int sensor_port, struct sensorproc_t * sensorproc, int frame8, int maxahead); int processPars (int sensor_port, struct sensorproc_t * sensorproc, int frame8, int maxahead);
///*** TODO: Add option (flag?) to write "single" (like single compress, single sensor) so it will not make all the next frames "single" // *** TODO: Add option (flag?) to write "single" (like single compress, single sensor) so it will not make all the next frames "single"
int framepars_init (struct platform_device *pdev);
int framepars_remove (struct platform_device *pdev);
#endif #endif
This diff is collapsed.
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/ *******************************************************************************/
#ifndef HISTOGRAMS_H
#define HISTOGRAMS_H
#undef ISR_HISTOGRAMS // to histograms-related disable code in ISR - not needed in NC393
// These wait queues will be advanced each frame after the histogram data is transferred to the FPGA. // These wait queues will be advanced each frame after the histogram data is transferred to the FPGA.
// It will happen even if the corresponding task is disabled, with the only exception: // It will happen even if the corresponding task is disabled, with the only exception:
// hist_c_wait_queue will not be awaken in the current frame if it is too late (frame counter incremented while serving tasklet) // hist_c_wait_queue will not be awaken in the current frame if it is too late (frame counter incremented while serving tasklet)
...@@ -28,3 +32,4 @@ int get_histograms (int sensor_port, int sensor_chn, unsigned long frame, int ne ...@@ -28,3 +32,4 @@ int get_histograms (int sensor_port, int sensor_chn, unsigned long frame, int ne
//int histograms_init_hardware(void); //int histograms_init_hardware(void);
void histograms_dma_ctrl(int mode); // 0 - reset, 1 - disable, 2 - enable void histograms_dma_ctrl(int mode); // 0 - reset, 1 - disable, 2 - enable
#endif
...@@ -690,7 +690,7 @@ static ssize_t imu_write(struct file * file, const char * buf, size_t count, lof ...@@ -690,7 +690,7 @@ static ssize_t imu_write(struct file * file, const char * buf, size_t count, lof
switch ((int) file->private_data) { switch ((int) file->private_data) {
case DEV393_MINOR(DEV393_LOGGER) : case DEV393_MINOR(DEV393_LOGGER) :
case DEV393_MINOR(DEV393_LOGGER_CTRL): case DEV393_MINOR(DEV393_LOGGER_CTRL):
if (!file->f_mode & FMODE_WRITE) { if (!(file->f_mode & FMODE_WRITE)) {
return -EINVAL; // readonly return -EINVAL; // readonly
} }
if (p >= sizeof(wbuf)) return -EINVAL; // bigger than all if (p >= sizeof(wbuf)) return -EINVAL; // bigger than all
......
...@@ -408,7 +408,7 @@ int klogger_393_probe(struct platform_device *pdev) ...@@ -408,7 +408,7 @@ int klogger_393_probe(struct platform_device *pdev)
__func__,buffer_size,buffer_size, (int) klog393_buf); __func__,buffer_size,buffer_size, (int) klog393_buf);
res = register_chrdev(DEV393_MAJOR(DEV393_KLOGGER), DEV393_NAME(DEV393_KLOGGER), &framepars_fops); res = register_chrdev(DEV393_MAJOR(DEV393_KLOGGER), DEV393_NAME(DEV393_KLOGGER), &framepars_fops);
if (res < 0) { if (res < 0) {
dev_err(dev, "framepars_init: couldn't get a major number %d (DEV393_MAJOR(DEV393_KLOGGER)).\n", dev_err(dev, "klogger_393_probe: couldn't get a major number %d (DEV393_MAJOR(DEV393_KLOGGER)).\n",
DEV393_MAJOR(DEV393_KLOGGER)); DEV393_MAJOR(DEV393_KLOGGER));
return res; return res;
} }
......
...@@ -159,7 +159,7 @@ const unsigned long param_depend_tab[]= ...@@ -159,7 +159,7 @@ const unsigned long param_depend_tab[]=
P_SENSOR, ONCHANGE_DETECTSENSOR | ONCHANGE_RECALCSEQ | ONCHANGE_INITSENSOR | ONCHANGE_AFTERINIT | ONCHANGE_MULTISENS | \ P_SENSOR, ONCHANGE_DETECTSENSOR | ONCHANGE_RECALCSEQ | ONCHANGE_INITSENSOR | ONCHANGE_AFTERINIT | ONCHANGE_MULTISENS | \
ONCHANGE_WINDOW | ONCHANGE_EXPOSURE | ONCHANGE_HIST | ONCHANGE_AEXP | ONCHANGE_FOCUSMODE | ONCHANGE_LIMITFPS | ONCHANGE_HIST | \ ONCHANGE_WINDOW | ONCHANGE_EXPOSURE | ONCHANGE_HIST | ONCHANGE_AEXP | ONCHANGE_FOCUSMODE | ONCHANGE_LIMITFPS | ONCHANGE_HIST | \
ONCHANGE_MEMSENSOR | ONCHANGE_MEMCOMPRESSOR | ONCHANGE_COMPMODE | ONCHANGE_COMPSTOP | ONCHANGE_COMPRESTART , ONCHANGE_MEMSENSOR | ONCHANGE_MEMCOMPRESSOR | ONCHANGE_COMPMODE | ONCHANGE_COMPSTOP | ONCHANGE_COMPRESTART ,
P_BAYER , ONCHANGE_SENSORIN , P_BAYER , ONCHANGE_SENSORIN, // | ONCHANGE_COMPMODE , // ONCHANGE_COMPMODE added for NC393
P_CLK_FPGA, ONCHANGE_I2C | ONCHANGE_LIMITFPS | ONCHANGE_HIST | \ P_CLK_FPGA, ONCHANGE_I2C | ONCHANGE_LIMITFPS | ONCHANGE_HIST | \
ONCHANGE_MEMSENSOR | ONCHANGE_MEMCOMPRESSOR | ONCHANGE_COMPMODE | ONCHANGE_COMPSTOP | ONCHANGE_COMPRESTART , ONCHANGE_MEMSENSOR | ONCHANGE_MEMCOMPRESSOR | ONCHANGE_COMPMODE | ONCHANGE_COMPSTOP | ONCHANGE_COMPRESTART ,
/// not need ONCHANGE_INITSENSOR | ONCHANGE_AFTERINIT - they will be scheduled by pgm_sensorphase if needed for the sensor /// not need ONCHANGE_INITSENSOR | ONCHANGE_AFTERINIT - they will be scheduled by pgm_sensorphase if needed for the sensor
...@@ -207,6 +207,8 @@ const unsigned long param_depend_tab[]= ...@@ -207,6 +207,8 @@ const unsigned long param_depend_tab[]=
P_FPNS, ONCHANGE_SENSORIN , P_FPNS, ONCHANGE_SENSORIN ,
P_FPNM, ONCHANGE_SENSORIN , P_FPNM, ONCHANGE_SENSORIN ,
P_VIRTTRIG, ONCHANGE_SENSORIN , P_VIRTTRIG, ONCHANGE_SENSORIN ,
P_COMP_BAYER, ONCHANGE_COMPMODE , // NC393 - derivative from P_BAYER, flips, ...
P_MEMSENSOR_DLY, ONCHANGE_SENSORIN ,
P_COMPMOD_BYRSH, ONCHANGE_COMPMODE, P_COMPMOD_BYRSH, ONCHANGE_COMPMODE,
P_COMPMOD_TILSH, ONCHANGE_COMPMODE, P_COMPMOD_TILSH, ONCHANGE_COMPMODE,
P_COMPMOD_DCSUB, ONCHANGE_COMPMODE, P_COMPMOD_DCSUB, ONCHANGE_COMPMODE,
......
This diff is collapsed.
...@@ -535,7 +535,7 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer ...@@ -535,7 +535,7 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer
unsigned char orientation_short[2]; unsigned char orientation_short[2];
int maker_offset; int maker_offset;
u32 frame = jptr->frame; u32 frame = jptr->frame;
int frame_index = frame & PASTPARS_SAVE_ENTRIES_MASK; // int frame_index = frame & PASTPARS_SAVE_ENTRIES_MASK;
// NC393: current parameters are valid at compressor done interrupt (after frame sync interrupts latest valid is new frame number - 2 // NC393: current parameters are valid at compressor done interrupt (after frame sync interrupts latest valid is new frame number - 2
if (index_time<0) index_time+=get_globalParam (sensor_port, G_CIRCBUFSIZE)>>2; if (index_time<0) index_time+=get_globalParam (sensor_port, G_CIRCBUFSIZE)>>2;
// struct exif_datetime_t // struct exif_datetime_t
...@@ -655,11 +655,12 @@ static irqreturn_t frame_sync_irq_handler(int irq, void *dev_id) ...@@ -655,11 +655,12 @@ static irqreturn_t frame_sync_irq_handler(int irq, void *dev_id)
{ {
struct jpeg_ptr_t *jptr = dev_id; struct jpeg_ptr_t *jptr = dev_id;
x393_cmdframeseq_mode_t cmdframeseq_mode = {.d32 = 0}; x393_cmdframeseq_mode_t cmdframeseq_mode = {.d32 = 0};
cmdframeseq_mode.interrupt_cmd = IRQ_CLEAR;
unsigned long flags; unsigned long flags;
int frame16; int frame16;
u32 aframe;
cmdframeseq_mode.interrupt_cmd = IRQ_CLEAR;
local_irq_save(flags); local_irq_save(flags);
u32 aframe = GLOBALPARS(jptr->chn_num, G_THIS_FRAME); // thisFrameNumber(jptr->chn_num); // current absolute frame number aframe = GLOBALPARS(jptr->chn_num, G_THIS_FRAME); // thisFrameNumber(jptr->chn_num); // current absolute frame number
frame16 = getHardFrameNumber(jptr->chn_num, 0); // Use sensor frame number frame16 = getHardFrameNumber(jptr->chn_num, 0); // Use sensor frame number
updateFramePars (jptr->chn_num, updateFramePars (jptr->chn_num,
frame16); frame16);
...@@ -728,7 +729,7 @@ void tasklet_compressor_function(unsigned long arg) ...@@ -728,7 +729,7 @@ void tasklet_compressor_function(unsigned long arg)
{ {
dma_addr_t phys_addr_start, phys_addr_end; dma_addr_t phys_addr_start, phys_addr_end;
void *virt_addr_start; void *virt_addr_start;
int sensor_port = image_acq_priv.jpeg_ptr[arg].chn_num; // == arg & 3 // int sensor_port = image_acq_priv.jpeg_ptr[arg].chn_num; // == arg & 3
const struct jpeg_ptr_t *jptr = &image_acq_priv.jpeg_ptr[arg]; const struct jpeg_ptr_t *jptr = &image_acq_priv.jpeg_ptr[arg];
unsigned int sz; unsigned int sz;
u32 ccam_dma_size = circbuf_priv_ptr[jptr->chn_num].buf_size; u32 ccam_dma_size = circbuf_priv_ptr[jptr->chn_num].buf_size;
...@@ -760,10 +761,10 @@ implement 2 modes of controlling when to calculate histograms: ...@@ -760,10 +761,10 @@ implement 2 modes of controlling when to calculate histograms:
1 - add mask to 3 frame number LSB (i.e. - 0/10000000/10001000/10101010/11111111) - 3 contol bits - en/dis and mode 1 - add mask to 3 frame number LSB (i.e. - 0/10000000/10001000/10101010/11111111) - 3 contol bits - en/dis and mode
2 - requested in advance (i.e. by autoexposure when writing new exposure or white balance - when writing balance 2 - requested in advance (i.e. by autoexposure when writing new exposure or white balance - when writing balance
mode 1 will provide easy way to display histograms (no need to repetively request them), mode 1 will provide easy way to display histograms (no need to repeatedly request them),
mode 2 - useful for autoexposure mode 2 - useful for autoexposure
Modify waiting (LSEEK_*) for histogrames so they will only unfreeze if the histogram is available (skipping multiple frames)) Modify waiting (LSEEK_*) for histograms so they will only unfreeze if the histogram is available (skipping multiple frames))
For displaying histograms - try use latest available - not waiting fro a particular frame. For displaying histograms - try use latest available - not waiting fro a particular frame.
...@@ -774,19 +775,16 @@ For displaying histograms - try use latest available - not waiting fro a particu ...@@ -774,19 +775,16 @@ For displaying histograms - try use latest available - not waiting fro a particu
//#define HISTOGRAMS_WAKEUP_ALWAYS 0 //#define HISTOGRAMS_WAKEUP_ALWAYS 0
void tasklet_cmdseq_function(unsigned long arg) void tasklet_cmdseq_function(unsigned long arg)
{ {
// 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; // == arg & 3 int sensor_port = image_acq_priv.jpeg_ptr[arg].chn_num; // == arg & 3
int tasklet_disable=get_globalParam(sensor_port, G_TASKLET_CTL); int tasklet_disable=get_globalParam(sensor_port, G_TASKLET_CTL);
unsigned long thisFrameNumber=getThisFrameNumber(sensor_port); unsigned long thisFrameNumber=getThisFrameNumber(sensor_port);
#ifdef ISR_HISTOGRAMS
unsigned long prevFrameNumber=thisFrameNumber-1; unsigned long prevFrameNumber=thisFrameNumber-1;
unsigned long * hash32p=&(aframepars[sensor_port][(thisFrameNumber-1) & PARS_FRAMES_MASK].pars[P_GTAB_R]); // same gamma for all sub-channels unsigned long * hash32p=&(aframepars[sensor_port][(thisFrameNumber-1) & PARS_FRAMES_MASK].pars[P_GTAB_R]); // same gamma for all sub-channels
unsigned long * framep= &(aframepars[sensor_port][(thisFrameNumber-1) & PARS_FRAMES_MASK].pars[P_FRAME]); unsigned long * framep= &(aframepars[sensor_port][(thisFrameNumber-1) & PARS_FRAMES_MASK].pars[P_FRAME]);
// const struct jpeg_ptr_t *jptr = &image_acq_priv.jpeg_ptr[arg];
// dma_addr_t phys_addr_start, phys_addr_end;
// void *virt_addr_start;
// unsigned int sz;
int subchn,hist_indx; int subchn,hist_indx;
#endif
// Time is out? // Time is out?
...@@ -817,8 +815,11 @@ void tasklet_cmdseq_function(unsigned long arg) ...@@ -817,8 +815,11 @@ void tasklet_cmdseq_function(unsigned long arg)
default: // calculate always (safer) default: // calculate always (safer)
hist_en=1; hist_en=1;
} }
// Actually in NC393 nothing has to be done with histograms at interrupts - do all the processing when histograms are requested
//#ifdef TEST_DISABLE_CODE //#ifdef TEST_DISABLE_CODE
if (hist_en) { if (hist_en) {
#ifdef ISR_HISTOGRAMS
histograms_check_init(); // check if histograms are initialized and initialize if not (structures and hardware) histograms_check_init(); // check if histograms are initialized and initialize if not (structures and hardware)
// 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){
...@@ -842,7 +843,7 @@ void tasklet_cmdseq_function(unsigned long arg) ...@@ -842,7 +843,7 @@ void tasklet_cmdseq_function(unsigned long arg)
dev_dbg(g_dev_ptr, "%s : port= %d, === already next frame (1)\n", __func__, sensor_port); dev_dbg(g_dev_ptr, "%s : port= %d, === already next frame (1)\n", __func__, sensor_port);
return; // already next frame return; // already next frame
} }
#endif // ifdef ISR_HISTOGRAMS
#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)
...@@ -882,6 +883,7 @@ void tasklet_cmdseq_function(unsigned long arg) ...@@ -882,6 +883,7 @@ void tasklet_cmdseq_function(unsigned long arg)
hist_en=1; hist_en=1;
} }
if (hist_en) { if (hist_en) {
#ifdef ISR_HISTOGRAMS
histograms_check_init(); // check if histograms are initialized and initialize if not (structures and hardware) histograms_check_init(); // check if histograms are initialized and initialize if not (structures and hardware)
// 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]
...@@ -904,6 +906,7 @@ void tasklet_cmdseq_function(unsigned long arg) ...@@ -904,6 +906,7 @@ void tasklet_cmdseq_function(unsigned long arg)
dev_dbg(g_dev_ptr, "%s : port= %d, === already next frame (1)\n", __func__, sensor_port); dev_dbg(g_dev_ptr, "%s : port= %d, === already next frame (1)\n", __func__, sensor_port);
return; // already next frame return; // already next frame
} }
#endif // ifdef ISR_HISTOGRAMS
#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)
...@@ -1141,7 +1144,6 @@ int image_acq_init(struct platform_device *pdev) ...@@ -1141,7 +1144,6 @@ int image_acq_init(struct platform_device *pdev)
dev_info(dev, "reset_qtables(0) (policy = COMMON_CACHE)\n"); dev_info(dev, "reset_qtables(0) (policy = COMMON_CACHE)\n");
set_cache_policy(COMMON_CACHE); set_cache_policy(COMMON_CACHE);
reset_qtables(0); // force initialization at next access (with COMMON_CACHE chyannel is ignored, with PER_CHN_CACHE - do for each chennel) reset_qtables(0); // force initialization at next access (with COMMON_CACHE chyannel is ignored, with PER_CHN_CACHE - do for each chennel)
// framepars_init(pdev);
pgm_functions_set_device(dev); pgm_functions_set_device(dev);
g_dev_ptr = dev; g_dev_ptr = dev;
return 0; return 0;
......
...@@ -190,7 +190,7 @@ int is_fpga_programmed(void) ///< @return 0 - bitstream is NOT loaded, 1 - bitst ...@@ -190,7 +190,7 @@ int is_fpga_programmed(void) ///< @return 0 - bitstream is NOT loaded, 1 - bitst
if (!zynq_devcfg_ptr){ if (!zynq_devcfg_ptr){
zynq_devcfg_ptr = ioremap(0xf8007000, 0x00010000); zynq_devcfg_ptr = ioremap(0xf8007000, 0x00010000);
if (!zynq_devcfg_ptr) if (!zynq_devcfg_ptr)
return -ENOMEM; return 0; // -ENOMEM;
} }
return (readl(zynq_devcfg_ptr + 0x000c) & 4)? 1: 0; return (readl(zynq_devcfg_ptr + 0x000c) & 4)? 1: 0;
} }
...@@ -125,6 +125,8 @@ int setup_sensor_memory (int num_sensor, ///< sensor port number (0..3) ...@@ -125,6 +125,8 @@ int setup_sensor_memory (int num_sensor, ///< sensor port number (0..3)
/** Control (stop/single/run/reset) memory controller for a sensor channel */ /** Control (stop/single/run/reset) memory controller for a sensor channel */
int control_sensor_memory (int num_sensor, ///< sensor port number (0..3) int control_sensor_memory (int num_sensor, ///< sensor port number (0..3)
int cmd, ///< command: 0 stop, 1 - single, 2 - repetitive, 3 - reset int cmd, ///< command: 0 stop, 1 - single, 2 - repetitive, 3 - reset
int reset_frame, ///< reset addresses to the start of frame, reset buffer (1 of 4) pointer.
///< Should only be used if the channel controller was stopped before
x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer
int frame16) ///< Frame number the command should be applied to (if not immediate mode) int frame16) ///< Frame number the command should be applied to (if not immediate mode)
///< @return 0 -OK ///< @return 0 -OK
...@@ -140,7 +142,9 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3) ...@@ -140,7 +142,9 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3)
.single = 0, // [ 9] (0) run single frame .single = 0, // [ 9] (0) run single frame
.repetitive = 1, // [ 10] (1) run repetitive frames .repetitive = 1, // [ 10] (1) run repetitive frames
.disable_need = 0, // [ 11] (0) disable 'need' generation, only 'want' (compressor channels) .disable_need = 0, // [ 11] (0) disable 'need' generation, only 'want' (compressor channels)
.skip_too_late = 1}; // [ 12] (0) Skip over missed blocks to preserve frame structure (increment pointers) .skip_too_late = 1, // [ 12] (0) Skip over missed blocks to preserve frame structure (increment pointers)
.abort_late = 1};// [ 14] (0) abort frame if not finished by the new frame sync (wait pending memory transfers)
mcntrl_mode.reset_frame = reset_frame;
switch (cmd){ switch (cmd){
case SENSOR_RUN_STOP: case SENSOR_RUN_STOP:
mcntrl_mode.enable = 0; mcntrl_mode.enable = 0;
...@@ -192,7 +196,6 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3) ...@@ -192,7 +196,6 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3)
return 0; return 0;
} }
/** Setup memory controller for a compressor channel */ /** Setup memory controller for a compressor channel */
int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3) int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3)
int window_width, ///< 13-bit - in 8*16=128 bit bursts int window_width, ///< 13-bit - in 8*16=128 bit bursts
...@@ -285,26 +288,30 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3 ...@@ -285,26 +288,30 @@ int setup_compressor_memory (int num_sensor, ///< sensor port number (0..3
/** Control memory controller (stop/single/run/reset) for a compressor channel */ /** Control memory controller (stop/single/run/reset) for a compressor channel */
int control_compressor_memory (int num_sensor, ///< sensor port number (0..3) int control_compressor_memory (int num_sensor, ///< sensor port number (0..3)
int cmd, ///< command: 0 stop, 1 - single, 2 - repetitive, 3 - reset int cmd, ///< command: 0 stop, 1 - single, 2 - repetitive, 3 - reset
int reset_frame, ///< reset addresses to the start of frame, reset buffer (1 of 4) pointer.
///< Should only be used if the channel controller was stopped before
int extra_pages, ///< extra pages needed (1) - number of previous pages to keep in a 4-page buffer int extra_pages, ///< extra pages needed (1) - number of previous pages to keep in a 4-page buffer
int disable_need, ///< disable "need" (yield to sensor channels - they can not wait) int disable_need, ///< disable "need" (yield to sensor channels - they can not wait)
x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer
int frame16) ///< Frame number the command should be applied to (if not immediate mode) int frame16) ///< Frame number the command should be applied to (if not immediate mode)
///< @return 0 - OK ///< @return 0 - OK
{ {
x393_mcntrl_mode_scan_t mcntrl_mode = {.enable = 1, // [ 0] (1) enable requests from this channel ( 0 will let current to finish, but not raise want/need) x393_mcntrl_mode_scan_t mcntrl_mode = {.chn_nreset = 1, // [ 0] (1) 0: immediately reset all the internal circuitry
.chn_nreset = 1, // [ 1] (1) 0: immediately reset all the internal circuitry .enable = 1, // [ 1] (1) enable requests from this channel ( 0 will let current to finish, but not raise want/need)
.write_mem = 0, // [ 2] (0) 0 - read from memory, 1 - write to memory .write_mem = 0, // [ 2] (0) 0 - read from memory, 1 - write to memory
.extra_pages = 1, // [ 4: 3] (0) 2-bit number of extra pages that need to stay (not to be overwritten) in the buffer .extra_pages = 1, // [ 4: 3] (0) 2-bit number of extra pages that need to stay (not to be overwritten) in the buffer
.keep_open = 0, // [ 5] (0) (NA in linescan) for 8 or less rows - do not close page between accesses (not used in scanline mode) .keep_open = 0, // [ 5] (0) (NA in linescan) for 8 or less rows - do not close page between accesses (not used in scanline mode)
.byte32 = 1, // [ 6] (1) (NA in linescan) 32-byte columns (0 - 16-byte), not used in scanline mode .byte32 = 1, // [ 6] (1) (NA in linescan) 32-byte columns (0 - 16-byte), not used in scanline mode
.reset_frame = 0, // [ 8] (0) reset frame number .reset_frame = 1, // [ 8] (0) reset frame number
.single = 0, // [ 9] (0) run single frame .single = 0, // [ 9] (0) run single frame
.repetitive = 1, // [ 10] (1) run repetitive frames .repetitive = 1, // [ 10] (1) run repetitive frames
.disable_need = 1, // [ 11] (0) disable 'need' generation, only 'want' (compressor channels) .disable_need = 1, // [ 11] (0) disable 'need' generation, only 'want' (compressor channels)
.skip_too_late = 1};// [ 12] (0) Skip over missed blocks to preserve frame structure (increment pointers) .skip_too_late = 1, // [ 12] (0) Skip over missed blocks to preserve frame structure (increment pointers)
.copy_frame = 1, // [ 13] (0) Copy frame number from the master (sensor) channel. Combine with reset_frame to reset bjuffer
mcntrl_mode.disable_need = disable_need; // non-constant parameter .abort_late = 1};// [ 14] (0) abort frame if not finished by the new frame sync (wait pending memory transfers)
mcntrl_mode.extra_pages = extra_pages; // non-constant parameter mcntrl_mode.disable_need = disable_need;
mcntrl_mode.extra_pages = extra_pages;
mcntrl_mode.reset_frame = reset_frame;
switch (cmd){ switch (cmd){
case COMPRESSOR_RUN_STOP: case COMPRESSOR_RUN_STOP:
mcntrl_mode.enable = 0; mcntrl_mode.enable = 0;
......
...@@ -27,12 +27,12 @@ struct elphel_video_buf_t ...@@ -27,12 +27,12 @@ struct elphel_video_buf_t
}; };
int setup_sensor_memory (int num_sensor, int window_width, int window_height, int window_left, int setup_sensor_memory (int num_sensor, int window_width, int window_height, int window_left,
int window_top, x393cmd_t x393cmd, int frame16); int window_top, x393cmd_t x393cmd, int frame16);
int control_sensor_memory (int num_sensor, int cmd, x393cmd_t x393cmd, int frame16); int control_sensor_memory (int num_sensor, int cmd, int reset_frame, x393cmd_t x393cmd, int frame16);
int setup_compressor_memory (int num_sensor, int window_width, int window_height, int window_left, int setup_compressor_memory (int num_sensor, int window_width, int window_height, int window_left,
int window_top, int tile_width, int tile_height, int tile_vstep, int window_top, int tile_width, int tile_height, int tile_vstep,
x393cmd_t x393cmd, int frame16); x393cmd_t x393cmd, int frame16);
int control_compressor_memory (int num_sensor, int cmd, int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16); int control_compressor_memory (int num_sensor, int cmd, int reset_frame, int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16);
int frames_in_buffer_minus_one (int num_sensor); int frames_in_buffer_minus_one (int num_sensor);
void memchan_enable (int chn, int enable); void memchan_enable (int chn, int enable);
......
...@@ -306,7 +306,7 @@ ...@@ -306,7 +306,7 @@
<li> bit 3 - no overlap, single frames: program - acquire/compress same frame</ul>*/ <li> bit 3 - no overlap, single frames: program - acquire/compress same frame</ul>*/
#define P_BGFRAME 16 ///< Background measurement mode - will use 16-bit mode and no FPN correction #define P_BGFRAME 16 ///< Background measurement mode - will use 16-bit mode and no FPN correction
//#define P_IMGSZMEM 17 ///< image size in video memory (calculated when channel 0 is programmed) NC393: Not used ??? //#define P_IMGSZMEM 17 ///< image size in video memory (calculated when channel 0 is programmed) NC393: Not used ???
#define P_COMP_BAYER 17 ///< derivative, readonly - calculated from P_BAYER and COMPMOD_BYRSH to separate sensor and compressor channels //#define P_COMP_BAYER 17 ///< -> 119 derivative, readonly - calculated from P_BAYER and COMPMOD_BYRSH to separate sensor and compressor channels
// image page numbers depend on image size/pixel depth, so changing any of them will invalidate all pages // image page numbers depend on image size/pixel depth, so changing any of them will invalidate all pages
#define P_PAGE_ACQ 18 ///< Number of image page buffer to acquire to (0.1?) NC393: Not used ??? #define P_PAGE_ACQ 18 ///< Number of image page buffer to acquire to (0.1?) NC393: Not used ???
#define P_PAGE_READ 19 ///< Number of image page buffer to read from to (0.1?) NC393: Not used ??? #define P_PAGE_READ 19 ///< Number of image page buffer to read from to (0.1?) NC393: Not used ???
...@@ -458,6 +458,8 @@ ...@@ -458,6 +458,8 @@
#define P_RFOCUS_TOP 117 ///< relative (0x10000 - 1.0)focus WOI top margin, inclusive (3 LSB will be zeroed as it should be multiple of 8x8 block height) #define P_RFOCUS_TOP 117 ///< relative (0x10000 - 1.0)focus WOI top margin, inclusive (3 LSB will be zeroed as it should be multiple of 8x8 block height)
#define P_RFOCUS_HEIGHT 118 ///< relative (0x10000 - 1.0)focus WOI height (3 LSB will be zeroed as it should be multiple of 8x8 block height) #define P_RFOCUS_HEIGHT 118 ///< relative (0x10000 - 1.0)focus WOI height (3 LSB will be zeroed as it should be multiple of 8x8 block height)
#define P_COMP_BAYER 119 ///< compressor bayer (before applying P_COMPMOD_BYRSH)
#define P_MEMSENSOR_DLY 120 ///< sensor-to-memory channel frame sync delay in mclk cycles (5ns @200MHz)
// Obsolete in x393, may need something different // Obsolete in x393, may need something different
#ifdef NC353 #ifdef NC353
#define P_SDRAM_CHN20 125 ///< data to be written to the SDRAM CH2 REG 0 (last moment) TODO: Obsolete in x393, may need something different #define P_SDRAM_CHN20 125 ///< data to be written to the SDRAM CH2 REG 0 (last moment) TODO: Obsolete in x393, may need something different
...@@ -501,7 +503,7 @@ ...@@ -501,7 +503,7 @@
// the following 8 values should go in the same sequence as fields in the histogram page // the following 8 values should go in the same sequence as fields in the histogram page
// 393: per sub-channel // 393: per sub-channel
//// Will need to have them per-subchannel (4x) //// Will need to have them per-subchannel (4x)
//Next 8 copied to histograms data
#define P_FRAME 136 ///< Frame number (reset with JPEG pointers) -(read only) #define P_FRAME 136 ///< Frame number (reset with JPEG pointers) -(read only)
#define P_GAINR 137 ///< R channel gain 8.16 (0x10000 - 1.0). Combines both analog gain and digital scaling #define P_GAINR 137 ///< R channel gain 8.16 (0x10000 - 1.0). Combines both analog gain and digital scaling
#define P_GAING 138 ///< G channel gain ("red line") #define P_GAING 138 ///< G channel gain ("red line")
...@@ -510,6 +512,7 @@ ...@@ -510,6 +512,7 @@
#define P_EXPOS 141 ///< P_RW_EXPOS 1 exposure time - now in microseconds? #define P_EXPOS 141 ///< P_RW_EXPOS 1 exposure time - now in microseconds?
#define P_VEXPOS 142 ///< video exposure (if 0 - use P_RW_EXPOS in ms) #define P_VEXPOS 142 ///< video exposure (if 0 - use P_RW_EXPOS in ms)
#define P_FOCUS_VALUE 143 ///< (readonly) - sum of all blocks focus values inside focus WOI #define P_FOCUS_VALUE 143 ///< (readonly) - sum of all blocks focus values inside focus WOI
#define P_COMPMOD_BYRSH 144 ///< Bayer shift in compressor #define P_COMPMOD_BYRSH 144 ///< Bayer shift in compressor
#define P_PORTRAIT 145 ///< Quantization coefficients optimized for vertical scan lines #define P_PORTRAIT 145 ///< Quantization coefficients optimized for vertical scan lines
...@@ -679,6 +682,7 @@ ...@@ -679,6 +682,7 @@
#define GLOBALS_PRESERVE 0x20 /// number of parameters that are not erased during initGlobalPars #define GLOBALS_PRESERVE 0x20 /// number of parameters that are not erased during initGlobalPars
#define GLOBALPARS(p, x) (aglobalPars[p][(x)-FRAMEPAR_GLOBALS]) ///< should work in drivers and applications, First 32 parameter values are not erased with initGlobalPars #define GLOBALPARS(p, x) (aglobalPars[p][(x)-FRAMEPAR_GLOBALS]) ///< should work in drivers and applications, First 32 parameter values are not erased with initGlobalPars
#define GLOBALPARS_SNGL(x) (globalPars[(x)-FRAMEPAR_GLOBALS]) ///< for applications that use just one port
#define G_DEBUG (FRAMEPAR_GLOBALS + 2) ///< Each bit turns on/off some debug outputs #define G_DEBUG (FRAMEPAR_GLOBALS + 2) ///< Each bit turns on/off some debug outputs
#define G_TEST_CTL_BITS (FRAMEPAR_GLOBALS + 3) ///< turn some features on/off in the drivers for debugging purposes #define G_TEST_CTL_BITS (FRAMEPAR_GLOBALS + 3) ///< turn some features on/off in the drivers for debugging purposes
...@@ -879,7 +883,8 @@ ...@@ -879,7 +883,8 @@
/// 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
#define HISTOGRAMS_WAKEUP_ALWAYS 1
/// Number of frames handled in the buffer (increased to 16 for NC393). /// Number of frames handled in the buffer (increased to 16 for NC393).
/// ///
...@@ -1074,7 +1079,6 @@ struct p_names_t { ...@@ -1074,7 +1079,6 @@ struct p_names_t {
P_NAME_ENTRY(TRIG), \ P_NAME_ENTRY(TRIG), \
P_NAME_ENTRY(EXPOS), \ P_NAME_ENTRY(EXPOS), \
P_NAME_ENTRY(BGFRAME), \ P_NAME_ENTRY(BGFRAME), \
P_NAME_ENTRY(COMP_BAYER), \
P_NAME_ENTRY(PAGE_ACQ), \ P_NAME_ENTRY(PAGE_ACQ), \
P_NAME_ENTRY(PAGE_READ), \ P_NAME_ENTRY(PAGE_READ), \
P_NAME_ENTRY(OVERLAP), \ P_NAME_ENTRY(OVERLAP), \
...@@ -1190,6 +1194,8 @@ struct p_names_t { ...@@ -1190,6 +1194,8 @@ struct p_names_t {
P_NAME_ENTRY(RFOCUS_WIDTH), \ P_NAME_ENTRY(RFOCUS_WIDTH), \
P_NAME_ENTRY(RFOCUS_TOP), \ P_NAME_ENTRY(RFOCUS_TOP), \
P_NAME_ENTRY(RFOCUS_HEIGHT), \ P_NAME_ENTRY(RFOCUS_HEIGHT), \
P_NAME_ENTRY(COMP_BAYER), \
P_NAME_ENTRY(MEMSENSOR_DLY), \
P_NAME_ENTRY(SENSOR_IFACE_TIM0), \ P_NAME_ENTRY(SENSOR_IFACE_TIM0), \
P_NAME_ENTRY(SENSOR_IFACE_TIM1), \ P_NAME_ENTRY(SENSOR_IFACE_TIM1), \
P_NAME_ENTRY(SENSOR_IFACE_TIM2), \ P_NAME_ENTRY(SENSOR_IFACE_TIM2), \
......
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