...
 
Commits (27)
......@@ -9,9 +9,7 @@ sysroots
/.externalToolBuilders
/.settings
/.pydevproject
html
*.directory
doxygen.tag
# auto-generated files from x393 project
src/drivers/elphel/x393.c
src/drivers/elphel/x393.h
......@@ -20,8 +18,18 @@ src/drivers/elphel/x393_map.h
src/drivers/elphel/x393_types.h
all_sources.lst
excluding.lst
including.lst
attic
board_elphel393
scp
bitbake-logs
device-tree-logs
all_sources.lst
excluding.lst
including.lst
doxygen.tag
/image
/scripts
/html
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,7 +2,7 @@
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/scripts/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="clean"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="linux-xlnx -c compile -f"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
......
......@@ -3,7 +3,7 @@
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/scripts/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="linux-xlnx -c compile"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
......
......@@ -3,7 +3,7 @@
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LAUNCH_CONFIGURATION_BUILD_SCOPE" value="${none}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/scripts/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="incremental,"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="linux-xlnx -c deploy"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
......
......@@ -2,7 +2,7 @@
<launchConfiguration type="org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType">
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_BUILDER_ENABLED" value="false"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/linux-elphel/scripts/run_bitbake.sh}"/>
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="linux-xlnx -c compile_kernelmodules -f"/>
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
</launchConfiguration>
#!/usr/bin/env python
# encoding: utf-8
from __future__ import division
from __future__ import print_function
"""
# @file khelper.py
# @brief Extract file access data after build, modify CDT project configuration
# (.cproject) accordingly
# @copyright Copyright (C) 2016, Elphel.inc.
# @param <b>License</b>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
@author: Andrey Filippov
@license: GPLv3.0+
@contact: andrey@elphel.coml
@deffield updated: Updated
"""
__author__ = "Andrey Filippov"
__copyright__ = "Copyright 2016, Elphel, Inc."
__license__ = "GPL"
__version__ = "3.0+"
__maintainer__ = "Andrey Filippov"
__email__ = "andrey@elphel.com"
__status__ = "Development"
import sys
import os
import time
import xml.etree.ElementTree as ET
'''
TODO:Automate, find out why separate touch commands are needed
Run this program twice:
1-st run ./khelper.py linux -1
and save shown timestamp
Then run (some mystery here)
touch src/drivers/ata/ahci_elphel.c
touch src/drivers/elphel/sensor_common.c
Wait 5 seconds and run (in a different console with appropriate sourcing)
bitbake linux-xlnx -c compile -f
Then again
./khelper.py linux <timestamp_from_the_first_run>
If somethong went wrong you will need to resore .cproject from eclipse_project_setup directory
'''
def file_tree(flist): # Each file in list is a file, no directories
ftree={}
for p in flist:
node = ftree
seg_list=p.split(os.sep)
last_i=len(seg_list)-1
for i,segm in enumerate(seg_list):
if not segm in node:
if i == last_i:
node[segm] = None
else:
node[segm] = {}
node=node[segm]
return ftree
def exclude_list(ftree, flist):
mark = "*" # no file/dir name can be "*"
def list_tree_recursive(root):
rslt = []
if not mark in root:
return [[""]] # convert to trailing "/" for directories
for n in root:
if not n == mark:
if root[n] is None:
rslt.append([n])
else:
for l in list_tree_recursive(root[n]):
rslt.append([n]+l)
return rslt
ftree[mark]=None # mark top level dir
for p in flist:
node = ftree
for segm in p.split(os.sep)[:-1]:
node=node[segm]
node[mark]=None # [mark] means used in flist
del node[p.split(os.sep)[-1]]
#print (ftree)
# for k in ftree:
# print(k)
#Now prune unused directories
#prune_recursive(ftree) # (assuming root is used)
# now create list
files_list_list = list_tree_recursive(ftree)
# print (files_list_list)
#converrt to file paths
pl = []
for l in files_list_list:
pl.append(os.path.join(*(l[1:])))
pl = sorted (pl)
return pl
def proc_tree():
DEBUG = True
extensions = [".h",".c",".cpp"]
exclude_start = ["linux"+os.sep+"scripts"+os.sep,"linux"+os.sep+"source"+os.sep+"scripts"+os.sep]
delta_t = 3 # seconds
try:
root_path = sys.argv[1]
except:
print ("Calling %s <root directory path> [timestamp]"%(os.path.basename(sys.argv[0])))
try:
start_time = float(sys.argv[2])
except:
start_time = 0.0
touch_files= start_time < 0.0
print ("root_path = %s"%(root_path))
# root_path = "/home/eyesis/git/poky/linux-elphel/linux/"
lstFiles = []
# Append files to a list
for path, _, files in os.walk(root_path, followlinks = True):
for f in files:
for ext in extensions:
if f.endswith(ext):
lstFiles.append(os.path.join(path, f))
break
all_tree= file_tree(sorted(lstFiles))
include_lst=[]
lst_a = []
latest_at=0
for p in lstFiles:
if touch_files:
if os.path.islink(p):
os.utime(os.path.realpath(p), None)
else:
os.utime(p, None)
else:
# at = time.ctime(os.stat(p).st_atime)
at = os.stat(p).st_atime
l = None
if os.path.islink(p):
l = os.path.realpath(p)
at = os.stat(l).st_atime
latest_at = max((latest_at,at))
if at > (start_time + delta_t):
#Scripts/lexers result in problems
exclude=False
for exStr in exclude_start:
if p.startswith(exStr):
exclude=True
break
if exclude:
break
#exclude_start
lst_a.append([p,at,l])
include_lst.append(p)
if touch_files:
print (len(lstFiles), "last time = ", time.time())
return
excluding = exclude_list(all_tree, include_lst)
# print (all_tree)
# print (sorted(include_lst))
# print ("|".join(excluding))
if DEBUG:
with open("all_sources.lst","w" ) as f:
for p in sorted(lstFiles):
at = os.stat(p).st_atime
lnk=""
if os.path.islink(p):
at = os.stat(os.path.realpath(p)).st_atime
lnk = os.path.realpath(p)
print (p,at,lnk, file=f)
with open("excluding.lst","w" ) as f:
for p in excluding:
print (p, file=f)
# include_tree= file_tree(sorted(include_lst))
# print(include_tree)
root_dir=include_lst[0].split(os.sep)[0]
print ("root_dir=",root_dir)
xml= ET.parse(".cproject")
root=xml.getroot()
# for child in root:
# print(child.tag, child.attrib)
for child in root.iter('sourceEntries'):
for gchild in child:
print(gchild.tag)
for child in root.iter('sourceEntries'):
for gchild in child:
if gchild.tag == 'entry':
attr = gchild.attrib
try:
if (attr['kind'] == 'sourcePath') and (attr['name'] == root_dir):
child.remove (gchild)
print ("Removed existing entry ",gchild.tag)
break
except:
print ("error matching attributes for ",gchild.tag)
pass
break #after first 'sourceEntries' - should be just one?
ET.SubElement(child, 'entry', {"flags":"VALUE_WORKSPACE_PATH", "kind":"sourcePath", "name":root_dir, "excluding":"|".join(excluding)})
for child in root.iter('sourceEntries'):
for gchild in child:
print(gchild.tag)
oneliner= ET.tostring(root)
#overwrites original .cproject, may change to somethong different
with open(".cproject", "wr") as f:
f.write("""<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?fileVersion 4.0.0?>""")
f.write(oneliner)
print (len(lstFiles), len(lst_a), "last access time = ",latest_at)
if __name__ == '__main__':
proc_tree()
\ No newline at end of file
/**/
/ {
chosen {
bootargs = "cma=336M console=ttyPS0,115200 root=/dev/mmcblk0p2 rw ip=192.168.0.8 earlyprintk rootwait rootfstype=ext4";
bootargs = "cma=336M console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootwait rootfstype=ext4";
linux,stdout-path = "/amba@0/serial@e0000000";
};
};
/**/
/ {
chosen {
bootargs = "cma=336M console=ttyPS0,115200 root=ubi0:elphel393-rootfs rw ip=192.168.0.8 earlyprintk rootwait rootfstype=ubifs ubi.mtd=4,2048";
bootargs = "cma=336M console=ttyPS0,115200 root=ubi0:elphel393-rootfs earlyprintk rootwait rootfstype=ubifs ubi.mtd=4,2048";
linux,stdout-path = "/amba@0/serial@e0000000";
};
};
/**/
/ {
chosen {
bootargs = "cma=336M console=ttyPS0,115200 root=/dev/ram rw ip=192.168.0.8 earlyprintk ramdisk_size=262144";
bootargs = "cma=336M console=ttyPS0,115200 root=/dev/ram rw earlyprintk ramdisk_size=262144";
linux,stdout-path = "/amba@0/serial@e0000000";
};
};
......@@ -11,7 +11,7 @@
} ;
chosen {
/* bootargs = "console=ttyPS0,115200 debug root=/dev/ram rw ip=192.168.0.9 earlyprintk ramdisk_size=262144";*/
bootargs = "cma=128M console=ttyPS0,115200 root=/dev/mmcblk0p2 rw ip=192.168.0.8 earlyprintk rootwait rootfstype=ext4";
bootargs = "cma=128M console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootwait rootfstype=ext4";
linux,stdout-path = "/amba@0/serial@e0000000";
} ;
cpus {
......
This diff is collapsed.
......@@ -37,7 +37,10 @@
#define LAST_BLOCK (1 << 3) ///< Flag indicating that the remaining chunk of data will be recorded
#define DELAYED_FINISH (1 << 4) ///< Flag indicating that recording should be stopped right after the last chunk of data is written
#define LOCK_TAIL (1 << 5) ///< Lock current command slot until all data buffers are assigned and the frame is aligned
#define START_EH (1 << 6) ///< start error handling procedure
#define START_EH (1 << 6) ///< Start error handling procedure
#define WAIT_EH (1 << 7) ///< Wait for error handler completion
#define DELAYED_IRQ_RCVD (1 << 8) ///< Delayed interrupt received and should be processed
#define IRQ_PROCESSED (1 << 9) ///< Tell command guard timer that IRQ is received and EH should not be started
#define CMD_FIS_LEN 5 ///< The length of a command FIS in double words
#define ADDR_MASK_28_BIT ((u64)0xfffffff)///< This is used to get 28-bit address from 64-bit value
#define MAX_PRDT_LEN 0x3fffff ///< A maximum of length of 4MB may exist for PRDT entry
......@@ -60,7 +63,42 @@
#define INCLUDE_REM 1 ///< Include REM buffer to total size calculation
#define EXCLUDE_REM 0 ///< Exclude REM buffer from total size calculation
#define SPEED_SAMPLES_NUM 5 ///< Maximum number of samples for disk recording speed measurement
#define DEFAULT_CMD_TIMEOUT 500 ///< Default timeout for commands, in ms
#define DEFAULT_CMD_TIMEOUT 200 ///< Default timeout for commands, in ms
#define WAIT_IRQ_TIMEOUT 5000 ///< Wait delayed interrupt for this amount of time, in ms
#define TSTMP_CMD_SYS 1 ///< command issued by system
#define TSTMP_CMD_DRV 2 ///< command issued by driver
#define TSTMP_IRQ_SYS 3 ///< irq processed by system
#define TSTMP_IRQ_DRV 4 ///< irq processed by driver
#define TSTMP_IRQ_MARK_1 5 ///< additional time stamp mark
enum {
PORT_VS = 0x70, ///< vendor specific port address
PORT_TIMESTAMP_ADDR = 0x78 ///< datascope timestamp register
};
enum {
REG_NUM = 128, ///< total number of DWs in status buffer
REG_HOST_IS = 0, ///< value of host IS register in data buffer
REG_PxIS, ///< value of PxIS in data buffer
REG_PxIE, ///< value of PxIE in data buffer
REG_PxSERR, ///< value of PxSERR in data buffer
IRQ_COUNTER, ///< interrupts counter for internal commands
IRQ_COUNTER_SYS, ///< interrupts counter for system commands
CMD_SENT, ///< number of commands sent
CMD_RCVD ///< number of commands received
};
struct datascope {
void __iomem *timestamp_reg; ///< register in vendor specific address range (PxVS) where timestamp can be written
unsigned int cmd_cntr; ///< command counter, its value can be found in timestamp (2 bits only)
unsigned int enable; ///< enable/disable timestamps
uint32_t reg_stat[REG_NUM]; ///< buffer for registers' status, filled in in IRQ
};
/** Data for error handler */
struct error_handler {
uint32_t s_error; ///< the content of PxSERR register
uint32_t irq_stat; ///< the content of PxIS register
wait_queue_head_t wait; ///< wait queue for delayed interrupts
};
/** This structure is for collecting some recording statistics */
struct rec_stat {
......@@ -68,6 +106,8 @@ struct rec_stat {
unsigned int samples[SPEED_SAMPLES_NUM]; ///< calculated recording speed samples, the value of recording speed
///< presented via sysfs is a median of this array
sec_usec_t start_time; ///< time when current command has been issued
unsigned long last_irq_delay; ///< late interrupt delay, in ms
unsigned int stat_ready; ///< flag indicating that new statisics sample is ready
};
/** This structure holds raw device buffer pointers */
......@@ -130,6 +170,9 @@ struct elphel_ahci_priv {
struct timer_list cmd_timer; ///< command execution guard timer
unsigned int cmd_timeout; ///< command timeout, in ms
unsigned int io_error_flag; ///< flag indicating IO error was detected, this is flag is exported via sysfs
struct datascope datascope;
struct error_handler eh; ///< error handler data
};
#endif /* _AHCI_ELPHEL_EXT */
This diff is collapsed.
......@@ -50,8 +50,11 @@
/** @brief Driver name displayed in system logs */
//#define CIRCBUF_DRIVER_NAME "circbuf driver"
/** @brief Wait queue for the processes waiting for a new frame to appear in the circular buffer */
wait_queue_head_t circbuf_wait_queue;
/** @brief Wait queue for the processes waiting for a new frame to appear in the circular buffer. Each channel has
* its own instance of wait queue to prevent race conditions when one channel wakes up the queue while the other
* channel is processing interrupt and moved its write pointer, but has not finished all other functions yet.
*/
wait_queue_head_t circbuf_wait_queue[SENSOR_PORTS];
struct circbuf_priv_t circbuf_priv[SENSOR_PORTS];
struct circbuf_priv_t *circbuf_priv_ptr = circbuf_priv;
/** @brief Global pointer to basic device structure. This pointer is used in debugfs output functions */
......@@ -690,13 +693,13 @@ loff_t circbuf_lseek(struct file * file, loff_t offset, int orig) {
break;
case LSEEK_CIRC_WAIT:
while (((fvld=circbufValidPointer(file->f_pos, &fp, chn)))==0) { //! only while not ready, ready or BAD - return
wait_event_interruptible (circbuf_wait_queue,(camSeqGetJPEG_wp(chn)<<2)!=file->f_pos);
wait_event_interruptible (circbuf_wait_queue[chn],(camSeqGetJPEG_wp(chn)<<2)!=file->f_pos);
}
if (fvld < 0) return -ESPIPE; //!invalid seek - have better code?
return file->f_pos ; //! data already available, return file pointer
default:
if ((offset & ~0x1f)==LSEEK_DAEMON_CIRCBUF) {
wait_event_interruptible (circbuf_wait_queue, get_imageParamsFrame(chn, P_DAEMON_EN, camSeqGetJPEG_frame(chn)) & (1<<(offset & 0x1f)));
wait_event_interruptible (circbuf_wait_queue[chn], get_imageParamsFrame(chn, P_DAEMON_EN, camSeqGetJPEG_frame(chn)) & (1<<(offset & 0x1f)));
}
}
dev_dbg(g_dev_ptr, "return SEEK_END file->f_pos =0x%08llx\n",file->f_pos);
......@@ -835,7 +838,7 @@ unsigned int circbuf_poll (struct file *file, poll_table *wait)
return POLLIN | POLLRDNORM; // there was frame already available
} else {
// pointer valid, no frame yet
poll_wait(file, &circbuf_wait_queue, wait);
poll_wait(file, &circbuf_wait_queue[chn], wait);
// Frame might become available during call to poll_wait so nobody will wake us up,
// let's see if there is still no frame.
w_ptr = camseq_get_jpeg_wp(chn) << 2;
......@@ -863,7 +866,7 @@ static struct file_operations circbuf_fops = {
*/
static int circbuf_all_init(struct platform_device *pdev)
{
int res;
int res, i;
struct device *dev = &pdev->dev;
const struct of_device_id *match;
......@@ -897,7 +900,8 @@ static int circbuf_all_init(struct platform_device *pdev)
}
dev_dbg(dev, "initialize circbuf wait queue\n");
init_waitqueue_head(&circbuf_wait_queue);
for (i = 0; i < SENSOR_PORTS; i++)
init_waitqueue_head(&circbuf_wait_queue[i]);
dev_dbg(dev, "initialize Huffman tables with default data\n");
g_dev_ptr = dev;
......
......@@ -40,7 +40,7 @@ struct circbuf_priv_t {
};
struct circbuf_priv_t *get_circbuf(int chn); // alternative to use of extern struct circbuf_priv_ptr;
extern struct circbuf_priv_t *circbuf_priv_ptr;
extern wait_queue_head_t circbuf_wait_queue;
extern wait_queue_head_t circbuf_wait_queue[SENSOR_PORTS];
int circbuf_all_open (struct inode *inode, struct file *filp); // set file size
int circbuf_all_release(struct inode *inode, struct file *filp);
......
......@@ -264,6 +264,7 @@ static ssize_t enable_por_store(struct device *dev, struct device_attribute *att
static ssize_t gpio_10389_get(struct device *dev, struct device_attribute *attr, char *buf);
static ssize_t gpio_10389_set(struct device *dev, struct device_attribute *attr, char *buf, size_t count);
static ssize_t gpio_poweroff(struct device *dev, struct device_attribute *attr, char *buf, size_t count);
static ssize_t detected_10389_get(struct device *dev, struct device_attribute *attr, char *buf);
static int gpio_shutdown(struct device *dev);
static int por_ctrl(struct device *dev, int disable_por);
......@@ -331,6 +332,7 @@ static DEVICE_ATTR(power_off, SYSFS_PERMISSIONS , NULL,
* P7-P4 - NC, 0xX0X0 - not supported even on this driver level.
*/
static DEVICE_ATTR(gpio_10389, SYSFS_PERMISSIONS, gpio_10389_get, gpio_10389_set);
static DEVICE_ATTR(detected_10389, SYSFS_PERMISSIONS & SYSFS_READONLY, detected_10389_get, NULL);
static struct attribute *root_dev_attrs[] = {
&dev_attr_simulate.attr,
......@@ -343,6 +345,7 @@ static struct attribute *root_dev_attrs[] = {
&dev_attr_enable_por.attr,
&dev_attr_power_off.attr,
&dev_attr_gpio_10389.attr,
&dev_attr_detected_10389.attr,
NULL
};
static const struct attribute_group dev_attr_root_group = {
......@@ -633,6 +636,12 @@ static ssize_t gpio_10389_get(struct device *dev, struct device_attribute *attr,
return sprintf(buf,"%02x\n",res);
}
static ssize_t detected_10389_get(struct device *dev, struct device_attribute *attr, char *buf)
{
int res=1;
return sprintf(buf,"%i",res);
}
static ssize_t gpio_poweroff(struct device *dev, struct device_attribute *attr, char *buf, size_t count)
{
int rc=gpio_shutdown(dev);
......@@ -1275,6 +1284,7 @@ static int elphel393_pwr_probe(struct platform_device *pdev)
if (base[2]==NULL){
device_remove_file(&pdev->dev, &dev_attr_gpio_10389);
device_remove_file(&pdev->dev, &dev_attr_detected_10389);
}
for (i=0;i<ARRAY_SIZE(pwr_gpio);i++){
......
......@@ -251,6 +251,8 @@
#define MD1(x)
#endif
#define BUGFIX_HISTWND_HEIGHT
static struct device *g_dev_ptr=NULL; ///< Global pointer to basic device structure. This pointer is used in debugfs output functions
void pgm_functions_set_device(struct device *dev)
{
......@@ -1782,6 +1784,10 @@ int pgm_hist (int sensor_port, ///< sensor port number (0..3
long height;
} hist_setup_data;
struct frameparspair_t pars_to_update[4* MAX_SENSORS];
#ifdef BUGFIX_HISTWND_HEIGHT
int actual_height;
#endif
/*
struct frameparspair_t pars_to_update[4]={
{P_HISTWND_LEFT, 0},
......@@ -1797,17 +1803,31 @@ int pgm_hist (int sensor_port, ///< sensor port number (0..3
poffs = HIST_SUBCHN_OFFSET * sub_chn;
// int fpga_addr=(frame16 <0) ? X313_SEQ_ASAP : (X313_SEQ_FRAME0+frame16);
// calculate absolute window from the relative, apply limits
hist_setup_data.width= ((thispars->pars[P_HISTWND_RWIDTH + poffs] * thispars->pars[P_ACTUAL_WIDTH])>>16) & 0xffe;
hist_setup_data.width= ((thispars->pars[P_HISTWND_RWIDTH + poffs] * thispars->pars[P_ACTUAL_WIDTH])>>16) & 0xfffe;
if (hist_setup_data.width<2) hist_setup_data.width=2;
else if (hist_setup_data.width > thispars->pars[P_ACTUAL_WIDTH]) hist_setup_data.width = thispars->pars[P_ACTUAL_WIDTH];
hist_setup_data.left= ((thispars->pars[P_HISTWND_RLEFT + poffs] * (thispars->pars[P_ACTUAL_WIDTH]-hist_setup_data.width)) >>16) & 0xffe;
hist_setup_data.left= ((thispars->pars[P_HISTWND_RLEFT + poffs] * (thispars->pars[P_ACTUAL_WIDTH]-hist_setup_data.width)) >>16) & 0xfffe;
if (hist_setup_data.left> (thispars->pars[P_ACTUAL_WIDTH]-hist_setup_data.width)) hist_setup_data.left = thispars->pars[P_ACTUAL_WIDTH]-hist_setup_data.width;
hist_setup_data.height= ((thispars->pars[P_HISTWND_RHEIGHT + poffs] * thispars->pars[P_ACTUAL_HEIGHT])>>16) & 0xffe;
#ifdef BUGFIX_HISTWND_HEIGHT
// bug 1: if not "-2" from hist_setup_data.height - there will be a blue/green bar near 0 (pix value)
// bug 2: NOT FIXED ... hist_setup_data.top=0 and rheight=100% - port 3 blue gets to port 2 blue channel
// lowering actual_height does not fix
actual_height = thispars->pars[P_ACTUAL_HEIGHT] - 2;
hist_setup_data.height= ((thispars->pars[P_HISTWND_RHEIGHT + poffs] * actual_height)>>16) & 0xfffe;
if (hist_setup_data.height<2) hist_setup_data.height=2;
else if (hist_setup_data.height > actual_height) hist_setup_data.height = actual_height;
hist_setup_data.top= ((thispars->pars[P_HISTWND_RTOP + poffs] * (actual_height-hist_setup_data.height)) >>16) & 0xfffe;
if (hist_setup_data.top > (actual_height-hist_setup_data.height)) hist_setup_data.top = actual_height-hist_setup_data.height;
#else
hist_setup_data.height= ((thispars->pars[P_HISTWND_RHEIGHT + poffs] * thispars->pars[P_ACTUAL_HEIGHT])>>16) & 0xfffe;
if (hist_setup_data.height<2) hist_setup_data.height=2;
else if (hist_setup_data.height > thispars->pars[P_ACTUAL_HEIGHT]) hist_setup_data.height = thispars->pars[P_ACTUAL_HEIGHT];
hist_setup_data.top= ((thispars->pars[P_HISTWND_RTOP + poffs] * (thispars->pars[P_ACTUAL_HEIGHT]-hist_setup_data.height)) >>16) & 0xffe;
hist_setup_data.top= ((thispars->pars[P_HISTWND_RTOP + poffs] * (thispars->pars[P_ACTUAL_HEIGHT]-hist_setup_data.height)) >>16) & 0xfffe;
if (hist_setup_data.top > (thispars->pars[P_ACTUAL_HEIGHT]-hist_setup_data.height)) hist_setup_data.top = thispars->pars[P_ACTUAL_HEIGHT]-hist_setup_data.height;
#endif
if ((hist_setup_data.left != thispars->pars[P_HISTWND_LEFT + poffs]) ||
(hist_setup_data.width != thispars->pars[P_HISTWND_WIDTH + poffs]) ||
......
......@@ -694,7 +694,7 @@ static irqreturn_t compressor_irq_handler(int irq, void *dev_id)
* @brief Tasklet - software interrupt
* lower priority tasks
* try to implement some balancing - if job is not finished - reduce FPS for it (alternate jobs)?
* @param arg not used
* @param arg sensor port number
*/
void tasklet_compressor_function(unsigned long arg)
......@@ -724,7 +724,7 @@ void tasklet_compressor_function(unsigned long arg)
outer_inv_range(phys_addr_start, phys_addr_end);
__cpuc_flush_dcache_area(virt_addr_start, sz - ccam_dma_size);
}
wake_up_interruptible(&circbuf_wait_queue); // should be done in here (after cache invalidation), not in ISR
wake_up_interruptible(&circbuf_wait_queue[arg]); // should be done in here (after cache invalidation), not in ISR
}
/*!TODO:
......
......@@ -25,6 +25,7 @@
#define DRV_CMD_WRITE (1 << 0)
#define DRV_CMD_FINISH (1 << 1)
#define DRV_CMD_EXIF (1 << 2)
#define DRV_CMD_WRITE_TEST (1 << 3)
#define _NAME_TO_STR(...) #__VA_ARGS__
#define NAME_TO_STR(NAME) _NAME_TO_STR(NAME)
......
......@@ -25,7 +25,7 @@
#define _ASM_CMOSCAM_H
#define SAFE_CHECK 1 // perform more verification on the paremeters
//#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 0 //global debug on/off in multiple files
#define ELPHEL_DEBUG 0 //global debug on/off in multiple files
......@@ -171,7 +171,7 @@
#ifndef I2C_16_WRITEARG
#define I2C_16_WRITEREG 0x3 // write 2 bytes to an i2c register
#define I2C_16_READREG 0x4 // read 2 bytes from an i2c register
#define I2C_16_WRITEARG(slave, reg, value) (((slave) << 24) | ((reg) << 16) | (value))
#define I2C_16_READARG(slave, reg) (((slave) << 24) | ((reg) << 16))
......@@ -312,6 +312,7 @@
<li> bit 4 - global reset release (GRR) mode - (only when combined with bit 2)
</ul>*/
#define P_BGFRAME 16 ///< Background measurement mode - will use 16-bit mode and no FPN correction
#define P_CLK_SENSPIX 17 ///< Sensor's internal pixel clock in Hz (if defined as in MT9F002)
//#define P_IMGSZMEM 17 ///< image size in video memory (calculated when channel 0 is programmed) NC393: Not used ???
//#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
......@@ -865,9 +866,9 @@
//#define P_HISTRQ 67 // per-frame enabling of histogram calculation - bit 0 - Y (G), bit 2 - C (R,G2,B)
//#define HISTRQ_BITY 0
//#define HISTRQ_BITC 1
//#define HISTRQ_BITC 1
#define HISTRQ_BIT_Y 0
#define HISTRQ_BIT_C 1
#define HISTRQ_BIT_C 1
#define P_HISTRQ_Y (P_HISTRQ | FRAMEPAIR_FRAME_BITS(1, HISTRQ_BIT_Y) | FRAMEPAIR_JUST_THIS) ///< request calculation of the Y-histogram for just this frame
#define P_HISTRQ_C (P_HISTRQ | FRAMEPAIR_FRAME_BITS(1, HISTRQ_BIT_C) | FRAMEPAIR_JUST_THIS) ///< request calculation of the C-histogram for just this frame
......@@ -1552,6 +1553,9 @@ struct p_names_t {
#define LSEEK_FSDRAM_RESET 0x01 // re-program FSDRAM (to be programmed again when accessed)
// Videomem/raw image commands
#define LSEEK_VIDEOMEM_START 0x10 // setup and start membridge transfer
#define JPEG_CTRL_MONOCHROME 0x400
#define JPEG_CTRL_MONOCHROME_BLOCKED 0x1000
#define JPEG_CTRL_NOMOSAIC 0x1000
......@@ -1647,14 +1651,16 @@ struct p_names_t {
/* For past compatibility, CCMA_DMA_SIZE...
*/
//#define CCAM_DMA_SIZE CCAM_WORDS_PER_DMABUF
// Will be Moved to DT in Rocko
#define CCAM_DMA_SIZE 0x4000000 ///< Each channel buffer size in BYTES (was in DWORDS in NC353) TODO NC393: use only for initial allocation, move to DT
// Will be Moved to DT in Rocko
#define CIRCBUF_START_OFFSET 0x100000 ///< Offset for the first bufer TODO NC393: use only for initial allocation, move to DT
/*
* CCAM_MMAP_OFFSET... -- offsets in bytes in memory mapped region.
* 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_WORDS_PER_DMA1BUF (CCAM_CHUNK_PER_DMA1BUF<<14) /*32bit words...*/
......@@ -1746,7 +1752,7 @@ struct sensorproc_t {
*! Structure also includes 8 bytes of timestamp (after 2 bytes skipped) - they will be obtained from the circbuf data
*! that goes after the encoded frame, so total is 36 bytes (26+2+8)
!****************************************************************************************************/
// move fram x353.h
// move fram x353.h
#define DEFAULT_COLOR_SATURATION_BLUE 0x90 ///< 100*relative saturation blue
#define DEFAULT_COLOR_SATURATION_RED 0xb6 ///< 100*relative saturation red
......@@ -1804,7 +1810,7 @@ struct i2c_timing_t {
unsigned char slave2master; //0x01, //! slave -> master
unsigned char master2slave; //0x01, //! master -> slave
unsigned char filter_sda; //0x07, //! filter SDA read data by testing multiple times - currently just zero/non zero
unsigned char filter_scl; //0x07};//! filter SCL read data by testing multiple times - currently just zero/non zero
unsigned char filter_scl; //0x07};//! filter SCL read data by testing multiple times - currently just zero/non zero
};
/// Gamma data for one component, including direct and reverse tables, hash (i.e. black level+gamma) and links for caching
......@@ -1895,7 +1901,7 @@ struct __attribute__((__packed__)) gamma_stuct_t {
#define HISTOGRAM_CACHE_NUMBER 8 // 16 // Was 8 // number of frames histograms are kept after acquisition (should be 2^n)
#define COLOR_RED 0
#define COLOR_GREEN1 1
#define COLOR_GREEN2 2
#define COLOR_GREEN2 2
#define COLOR_BLUE 3
......@@ -2089,7 +2095,7 @@ struct huffman_encoded_t {
///NOTE page 0 is write protected, page 15 (0x0f) is "default" page
#define AUTOCAMPARS_CMD_RESTORE 1 /// restore specified groups of parameters from the specified page
#define AUTOCAMPARS_CMD_SAVE 2 /// save all current parameters to the specified group (page 0 is write-protected)
#define AUTOCAMPARS_CMD_DFLT 3 /// make selected page the default one (used at startup), page 0 OK
#define AUTOCAMPARS_CMD_DFLT 3 /// make selected page the default one (used at startup), page 0 OK
#define AUTOCAMPARS_CMD_SAVEDFLT 4 /// save all current parameters to the specified group (page 0 is write-protected) and make it default (used at startup)
#define AUTOCAMPARS_CMD_INIT 5 /// reset sensor/sequencers, restore all parameters from the specified page
......
......@@ -112,7 +112,7 @@
#define DEV393_MT9X001 ("", "elphel393-mt9x001", -1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
#define DEV393_KLOGGER ("klogger_393", "klogger_393", 144, 1, "0666", "c") ///< kernel event logger to memory (no i/o)
#define _DEV393_DEVNAME(n, ...) n
#define _DEV393_PATH(n, ...) "/dev/"n
#define _DEV393_NAME(a,n, ...) n
#define _DEV393_MAJOR(a,b,n, ...) n
......@@ -120,6 +120,7 @@
#define _DEV393_PERMISSIONS(a,b,c,d,n, ...) n
#define _DEV393_TYPE(a,b,c,d,e,n,...) n
#define DEV393_DEVNAME(LIST) _DEV393_DEVNAME LIST ///< @return the device node name as string ("somediviceN")
#define DEV393_PATH(LIST) _DEV393_PATH LIST ///< @return full path of the device node as string ("/dev/somedivice")
#define DEV393_NAME(LIST) _DEV393_NAME LIST ///< @return driver name
#define DEV393_MAJOR(LIST) _DEV393_MAJOR LIST ///< @return device major number
......
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c
index db591d1..fa8ede7 100644
--- a/drivers/usb/serial/garmin_gps.c
+++ b/drivers/usb/serial/garmin_gps.c
@@ -1166,6 +1166,8 @@ static void garmin_read_process(struct garmin_data *garmin_data_p,
send_to_tty(garmin_data_p->port, data,
data_length);
}
+ } else {
+ send_to_tty(garmin_data_p->port, data, data_length);
}
/* ignore system layer packets ... */
}