Commit eb8e7115 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

finished photo finish debugging

parent fc2e9b23
...@@ -1972,7 +1972,14 @@ int pgm_memsensor (int sensor_port, ///< sensor port number ( ...@@ -1972,7 +1972,14 @@ int pgm_memsensor (int sensor_port, ///< sensor port number (
} }
width_bursts = (width_marg >> 4) + ((width_marg & 0xf) ? 1 : 0); width_bursts = (width_marg >> 4) + ((width_marg & 0xf) ? 1 : 0);
pr_debug("PGM: width_marg=%d height_marg=%d width_burts=%d",width_marg, height_marg, width_bursts); pr_debug("PGM_MEMSENSOR: sport=%d width_burts=%d width_marg=%d height_marg=%d left_margin=%d top_margin=%d\n",
sensor_port,
width_bursts,
width_marg,
height_marg,
0,
0
);
/** shorter version: */ /** shorter version: */
//width_bursts = (width_marg+0xf)>>4; //width_bursts = (width_marg+0xf)>>4;
...@@ -2086,7 +2093,6 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number ( ...@@ -2086,7 +2093,6 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
cmprs_frame_format.num_macro_cols_m1 = (width_marg>> 4) - 1; // before adding margins cmprs_frame_format.num_macro_cols_m1 = (width_marg>> 4) - 1; // before adding margins
cmprs_frame_format.num_macro_rows_m1 = (height_marg>> 4) - 1; // before adding margins; cmprs_frame_format.num_macro_rows_m1 = (height_marg>> 4) - 1; // before adding margins;
switch(thispars->pars[P_COLOR]){ switch(thispars->pars[P_COLOR]){
case COLORMODE_COLOR: case COLORMODE_COLOR:
overlap = 2; overlap = 2;
...@@ -2096,6 +2102,9 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number ( ...@@ -2096,6 +2102,9 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
overlap = 4; overlap = 4;
break; break;
} }
cmprs_frame_format.left_margin = cmprs_top; // same as top - only for 18x18 tiles to keep Bayer shift (0/1)
if (overlap){ if (overlap){
width_marg += (2 * COLOR_MARGINS); width_marg += (2 * COLOR_MARGINS);
if ((thispars->pars[P_PF_HEIGHT] & 0xffff)==0) { // not a photofinish if ((thispars->pars[P_PF_HEIGHT] & 0xffff)==0) { // not a photofinish
...@@ -2105,7 +2114,6 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number ( ...@@ -2105,7 +2114,6 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
} else { } else {
tile_width = 4; tile_width = 4;
} }
cmprs_frame_format.left_margin = cmprs_top; // same as top - only for 18x18 tiles to keep Bayer shift (0/1)
width_bursts = (width_marg >> 4) + ((width_marg & 0xf) ? 1 : 0); width_bursts = (width_marg >> 4) + ((width_marg & 0xf) ? 1 : 0);
// Adjusting for tile width. TODO: probably not needed, handled in FPGA - verify (and remove 2 next lines) // Adjusting for tile width. TODO: probably not needed, handled in FPGA - verify (and remove 2 next lines)
...@@ -2113,6 +2121,20 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number ( ...@@ -2113,6 +2121,20 @@ int pgm_memcompressor (int sensor_port, ///< sensor port number (
if ((tile_width>2) && (width_bursts & 2)) width_bursts += 2; if ((tile_width>2) && (width_bursts & 2)) width_bursts += 2;
tile_height = 16 + overlap; tile_height = 16 + overlap;
pr_debug("PGM_MEMCOMPRESSOR: sport=%d width_bursts=%d width_marg=%d height_marg=%d num_macro_rows_m1=%d tile_width=%d tile_height=%d margin_left=%d margin_top=%d P_TILES=%d\n",
sensor_port,
width_bursts,
width_marg,
height_marg,
(cmprs_frame_format.num_macro_rows_m1 + 1) << 4,
tile_width,
tile_height,
0,
cmprs_top,
(cmprs_frame_format.num_macro_cols_m1+1)*(cmprs_frame_format.num_macro_rows_m1+1)
);
setup_compressor_memory (sensor_port, // sensor port number (0..3) setup_compressor_memory (sensor_port, // sensor port number (0..3)
width_bursts, // 13-bit - in 8*16=128 bit bursts width_bursts, // 13-bit - in 8*16=128 bit bursts
(cmprs_frame_format.num_macro_rows_m1 + 1) << 4, (cmprs_frame_format.num_macro_rows_m1 + 1) << 4,
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* 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/>.
*******************************************************************************/ *******************************************************************************/
#define DEBUG //#define DEBUG
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/of_device.h> #include <linux/of_device.h>
...@@ -1192,6 +1192,28 @@ static ssize_t get_raw_frame_info(struct device *dev, struct device_attribute *a ...@@ -1192,6 +1192,28 @@ static ssize_t get_raw_frame_info(struct device *dev, struct device_attribute *a
return buf-buf0; return buf-buf0;
} }
static ssize_t get_mctrl_status_chn(struct device *dev, struct device_attribute *attr, char *buf)
{
int chn = get_channel_from_name(attr);
x393_status_mcntrl_lintile_t status;
switch(chn){
case 1: status = x393_mcntrl_chn1_status(); break;
case 2: status = x393_mcntrl_chn2_status(); break;
case 3: status = x393_mcntrl_chn3_status(); break;
case 4: status = x393_mcntrl_chn4_status(); break;
}
return sprintf(buf,"0x%08x\n", status);
}
static ssize_t get_cmprs_status(struct device *dev, struct device_attribute *attr, char *buf)
{
x393_cmprs_status_t status = x393_cmprs_status(get_channel_from_name(attr));
return sprintf(buf,"0x%08x\n", status);
}
static ssize_t store_frame_start(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) static ssize_t store_frame_start(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
sscanf(buf, "%i", &buffer_settings.frame_start[get_channel_from_name(attr)]); sscanf(buf, "%i", &buffer_settings.frame_start[get_channel_from_name(attr)]);
...@@ -1271,6 +1293,16 @@ static DEVICE_ATTR(raw_frame_info1, SYSFS_PERMISSIONS, get_raw_fram ...@@ -1271,6 +1293,16 @@ static DEVICE_ATTR(raw_frame_info1, SYSFS_PERMISSIONS, get_raw_fram
static DEVICE_ATTR(raw_frame_info2, SYSFS_PERMISSIONS, get_raw_frame_info, NULL); static DEVICE_ATTR(raw_frame_info2, SYSFS_PERMISSIONS, get_raw_frame_info, NULL);
static DEVICE_ATTR(raw_frame_info3, SYSFS_PERMISSIONS, get_raw_frame_info, NULL); static DEVICE_ATTR(raw_frame_info3, SYSFS_PERMISSIONS, get_raw_frame_info, NULL);
static DEVICE_ATTR(mctrl_status_chn1, SYSFS_PERMISSIONS, get_mctrl_status_chn, NULL);
static DEVICE_ATTR(mctrl_status_chn2, SYSFS_PERMISSIONS, get_mctrl_status_chn, NULL);
static DEVICE_ATTR(mctrl_status_chn3, SYSFS_PERMISSIONS, get_mctrl_status_chn, NULL);
static DEVICE_ATTR(mctrl_status_chn4, SYSFS_PERMISSIONS, get_mctrl_status_chn, NULL);
static DEVICE_ATTR(compressor_status0, SYSFS_PERMISSIONS, get_cmprs_status, NULL);
static DEVICE_ATTR(compressor_status1, SYSFS_PERMISSIONS, get_cmprs_status, NULL);
static DEVICE_ATTR(compressor_status2, SYSFS_PERMISSIONS, get_cmprs_status, NULL);
static DEVICE_ATTR(compressor_status3, SYSFS_PERMISSIONS, get_cmprs_status, NULL);
static struct attribute *root_dev_attrs[] = { static struct attribute *root_dev_attrs[] = {
&dev_attr_frame_start0.attr, &dev_attr_frame_start0.attr,
&dev_attr_frame_start1.attr, &dev_attr_frame_start1.attr,
...@@ -1298,6 +1330,14 @@ static struct attribute *root_dev_attrs[] = { ...@@ -1298,6 +1330,14 @@ static struct attribute *root_dev_attrs[] = {
&dev_attr_raw_frame_info1.attr, &dev_attr_raw_frame_info1.attr,
&dev_attr_raw_frame_info2.attr, &dev_attr_raw_frame_info2.attr,
&dev_attr_raw_frame_info3.attr, &dev_attr_raw_frame_info3.attr,
&dev_attr_mctrl_status_chn1.attr,
&dev_attr_mctrl_status_chn2.attr,
&dev_attr_mctrl_status_chn3.attr,
&dev_attr_mctrl_status_chn4.attr,
&dev_attr_compressor_status0.attr,
&dev_attr_compressor_status1.attr,
&dev_attr_compressor_status2.attr,
&dev_attr_compressor_status3.attr,
NULL NULL
}; };
......
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