Commit 97ccb7c2 authored by Andrey Filippov's avatar Andrey Filippov

merged with master

parent fb527e25
...@@ -11,6 +11,7 @@ sysroots ...@@ -11,6 +11,7 @@ sysroots
.pydevproject .pydevproject
html html
*.directory *.directory
*.kate-swp
doxygen.tag doxygen.tag
# auto-generated files from x393 project # auto-generated files from x393 project
src/drivers/elphel/x393.c src/drivers/elphel/x393.c
...@@ -18,3 +19,6 @@ src/drivers/elphel/x393.h ...@@ -18,3 +19,6 @@ src/drivers/elphel/x393.h
src/drivers/elphel/x393_defs.h src/drivers/elphel/x393_defs.h
src/drivers/elphel/x393_map.h src/drivers/elphel/x393_map.h
src/drivers/elphel/x393_types.h src/drivers/elphel/x393_types.h
all_sources.lst
excluding.lst
attic
This source diff could not be displayed because it is too large. You can view the blob instead.
#!/usr/bin/env python
# encoding: utf-8
from __future__ import division
from __future__ import print_function
import sys
import os
import time
import xml.etree.ElementTree as ET
'''
TODO: make 2 runs, first before
bitbake linux-xlnx
khelper.py linux -1
#get timestamp
#next 2 commands - I do not understand why their access timestamp is set during previous command and does not change during bitbake
touch /home/eyesis/git/elphel393/linux-elphel/src/drivers/ata/ahci_elphel.c
touch /home/eyesis/git/elphel393/linux-elphel/src/drivers/elphel/sensor_common.c
bitbake linux-xlnx -c compile -f
khelper.py linux <timestamp_from_the_first_run>
'''
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
...@@ -99,9 +99,9 @@ WARN_LOGFILE = ...@@ -99,9 +99,9 @@ WARN_LOGFILE =
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
# Configuration options related to the input files # Configuration options related to the input files
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
INPUT = linux/source/drivers/elphel linux/source/drivers/ata/ahci_elphel.c linux/source/drivers/clk/clk-si5338.c linux/source/drivers/misc/ltc3589.c linux/source/drivers/misc/vsc330x.c linux/source/drivers/mmc/host/sdhci.c linux/source/drivers/mmc/host/sdhci.h linux/source/drivers/mtd/nand/nand_base.c linux/source/drivers/mtd/nand/nand.h linux/source/drivers/mtd/nand/nandchip-micron.c linux/source/drivers/mtd/nand/pl35x_nand.c linux/source/include/elphel linux/source/include/linux/i2c/ltc3589.h INPUT = linux/source/drivers/elphel linux/source/drivers/ata/ahci_elphel.c linux/source/drivers/clk/clk-si5338.c linux/source/drivers/misc/ltc3589.c linux/source/drivers/misc/vsc330x.c linux/source/drivers/mmc/host/sdhci.c linux/source/drivers/mmc/host/sdhci.h linux/source/drivers/mtd/nand/nand_base.c linux/source/drivers/mtd/nand/nand.h linux/source/drivers/mtd/nand/nandchip-micron.c linux/source/drivers/mtd/nand/pl35x-nand.c linux/source/include/elphel linux/source/include/linux/i2c/ltc3589.h
INPUT_ENCODING = UTF-8 INPUT_ENCODING = UTF-8
FILE_PATTERNS = *.h *.cpp *.c *.md FILE_PATTERNS = *.h *.c *.cpp *.md
RECURSIVE = YES RECURSIVE = YES
EXCLUDE = src/logos.cpp src/lodepng.cpp EXCLUDE = src/logos.cpp src/lodepng.cpp
EXCLUDE_SYMLINKS = NO EXCLUDE_SYMLINKS = NO
......
...@@ -17,7 +17,9 @@ obj-$(CONFIG_ELPHEL393) += clock10359.o ...@@ -17,7 +17,9 @@ obj-$(CONFIG_ELPHEL393) += clock10359.o
obj-$(CONFIG_ELPHEL393) += exif393.o obj-$(CONFIG_ELPHEL393) += exif393.o
obj-$(CONFIG_ELPHEL393) += x393_helpers.o obj-$(CONFIG_ELPHEL393) += x393_helpers.o
obj-$(CONFIG_ELPHEL393) += framepars.o obj-$(CONFIG_ELPHEL393) += framepars.o
#obj-$(CONFIG_ELPHEL393) += sensor_common.o x393.o obj-$(CONFIG_ELPHEL393) += sensor_common.o
#obj-$(CONFIG_ELPHEL393) += quantization_tables.o obj-$(CONFIG_ELPHEL393) += x393.o
#obj-$(CONFIG_ELPHEL393) += circbuf.o jpeghead.o obj-$(CONFIG_ELPHEL393) += quantization_tables.o
obj-$(CONFIG_ELPHEL393) += circbuf.o
obj-$(CONFIG_ELPHEL393) += jpeghead.o
This diff is collapsed.
// FILE NAME : cxsdma.h /** @file circbuf.h
// read/write image and FPN buffers from SDRAM *
* @brief Drivers to manipulate large circular buffer that holds compressed
* images/video. Buffer frame data is filled in by the FPGA, frame pointers and
* essential frames metadata filled during servicing of the interrupts.
*
* @copyright Copyright (C) 2016 Elphel, Inc
*
* @par <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/>.
*/
#ifndef _CIRCBUF_H #ifndef _CIRCBUF_H
#define _CIRCBUF_H #define _CIRCBUF_H
#include <linux/poll.h> #include <linux/poll.h>
int circbuf_all_open (struct inode *inode, struct file *filp); // set filesize /** @brief Circular buffer private data */
struct circbuf_priv_t {
int minor; ///< device file minor number
unsigned long *buf_ptr; ///< pointer to circular buffer memory region
dma_addr_t phys_addr; ///< physical address of memory region reported by memory driver
};
extern struct circbuf_priv_t *circbuf_priv_ptr;
extern wait_queue_head_t circbuf_wait_queue;
int circbuf_all_open (struct inode *inode, struct file *filp); // set file size
int circbuf_all_release(struct inode *inode, struct file *filp); int circbuf_all_release(struct inode *inode, struct file *filp);
loff_t circbuf_all_lseek (struct file * file, loff_t offset, int orig); loff_t circbuf_all_lseek (struct file * file, loff_t offset, int orig);
ssize_t circbuf_all_write (struct file * file, const char * buf, size_t count, loff_t *off); ssize_t circbuf_all_write (struct file * file, const char * buf, size_t count, loff_t *off);
ssize_t circbuf_all_read (struct file * file, char * buf, size_t count, loff_t *off); ssize_t circbuf_all_read (struct file * file, char * buf, size_t count, loff_t *off);
int circbuf_all_mmap (struct file *file, struct vm_area_struct *vma); int circbuf_all_mmap (struct file *file, struct vm_area_struct *vma);
unsigned int circbuf_all_poll (struct file *file, poll_table *wait); unsigned int circbuf_all_poll (struct file *file, poll_table *wait);
//!just to notify it is not implemented
int circbuf_all_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg);
int circbuf_open (struct inode *inode, struct file *filp); // set file size
int circbuf_open (struct inode *inode, struct file *filp); // set filesize
loff_t circbuf_lseek (struct file * file, loff_t offset, int orig); loff_t circbuf_lseek (struct file * file, loff_t offset, int orig);
ssize_t circbuf_write (struct file * file, const char * buf, size_t count, loff_t *off); ssize_t circbuf_write (struct file * file, const char * buf, size_t count, loff_t *off);
ssize_t circbuf_read (struct file * file, char * buf, size_t count, loff_t *off); ssize_t circbuf_read (struct file * file, char * buf, size_t count, loff_t *off);
int circbuf_mmap (struct file *file, struct vm_area_struct *vma); int circbuf_mmap (struct file *file, struct vm_area_struct *vma);
unsigned int circbuf_poll (struct file *file, poll_table *wait); unsigned int circbuf_poll (struct file *file, poll_table *wait);
#ifdef USE_OLD_CODE
//int init_ccam_dma_buf_ptr(void); //int init_ccam_dma_buf_ptr(void);
/*!====================================================================================== /*!======================================================================================
* Wait queue for the processes waiting for a new frame to appear in the circular buffer * Wait queue for the processes waiting for a new frame to appear in the circular buffer
*======================================================================================*/ *======================================================================================*/
extern wait_queue_head_t circbuf_wait_queue; extern wait_queue_head_t circbuf_wait_queue;
// private data // private data
struct circbuf_priv_t { struct circbuf_priv_t {
int minor; int minor;
...@@ -38,6 +61,7 @@ struct circbuf_priv_t { ...@@ -38,6 +61,7 @@ struct circbuf_priv_t {
dma_addr_t phys_addr; dma_addr_t phys_addr;
}; };
extern struct circbuf_priv_t *circbuf_priv_ptr; extern struct circbuf_priv_t *circbuf_priv_ptr;
#endif
/* debug code follows */ /* debug code follows */
extern unsigned short circbuf_quality; extern unsigned short circbuf_quality;
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <asm/outercache.h> #include <asm/outercache.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <elphel/elphel393-mem.h> #include <elphel/elphel393-mem.h>
#include "x393_helpers.h"
#define SYSFS_PERMISSIONS 0644 /* default permissions for sysfs files */ #define SYSFS_PERMISSIONS 0644 /* default permissions for sysfs files */
#define SYSFS_READONLY 0444 #define SYSFS_READONLY 0444
...@@ -207,18 +206,6 @@ static ssize_t get_size_bidir(struct device *dev, struct device_attribute *attr, ...@@ -207,18 +206,6 @@ static ssize_t get_size_bidir(struct device *dev, struct device_attribute *attr,
return sprintf(buf,"%u\n", _elphel_buf.bidir_size); return sprintf(buf,"%u\n", _elphel_buf.bidir_size);
} }
/*
static ssize_t get_cache(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf,"Write into this file to flush L1/L2 caches to memory.\n");
}
static ssize_t flush_cache(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
__cpuc_flush_kern_all();
outer_flush_all();
return count;
}
*/
static ssize_t sync_for_cpu_h2d(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) static ssize_t sync_for_cpu_h2d(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ {
dma_addr_t paddr; dma_addr_t paddr;
...@@ -313,47 +300,6 @@ static ssize_t sync_for_device_bidir(struct device *dev, struct device_attribute ...@@ -313,47 +300,6 @@ static ssize_t sync_for_device_bidir(struct device *dev, struct device_attribute
return count; return count;
} }
static ssize_t flush_cpu_cache(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{
const int buff_size = 0x1000000;
const int buff_start_offset = 0x100000;
unsigned int chn;
int start_offset, end_offset;
int num_items;
dma_addr_t phys_addr_start, phys_addr_end;
u32 start_time, end_time;
num_items = sscanf(buf, "%u:%d:%d", &chn, &start_offset, &end_offset);
start_time = get_rtc_usec();
if (num_items == 3) {
// invalidate L2 caches
if (end_offset > start_offset) {
// handle single buffer case
phys_addr_start = _elphel_buf.paddr + buff_start_offset + chn * buff_size + start_offset;
phys_addr_end = _elphel_buf.paddr + buff_start_offset + chn * buff_size + end_offset - 1;
outer_inv_range(phys_addr_start, phys_addr_end);
} else {
// handle split buffer case when pointer rolls over the end
// first, process the peace at the end of the buffer
phys_addr_start = _elphel_buf.paddr + buff_start_offset + chn * buff_size + start_offset;
phys_addr_end = _elphel_buf.paddr + buff_start_offset + ++chn * buff_size - 1;
outer_inv_range(phys_addr_start, phys_addr_end);
// second, process the peace at the start of the buffer
phys_addr_start = _elphel_buf.paddr + buff_start_offset + chn * buff_size;
phys_addr_end = _elphel_buf.paddr + buff_start_offset + chn * buff_size + end_offset - 1;
outer_inv_range(phys_addr_start, phys_addr_end);
}
}
end_time = get_rtc_usec();
if (start_time == 0 && end_time == 0) {
pr_info("Unable to get usec values\n");
} else {
pr_info("Cache invalidate time: %lu\n", end_time - start_time);
}
return count;
}
static ssize_t get_sync_for_device_h2d(struct device *dev, struct device_attribute *attr, char *buf) static ssize_t get_sync_for_device_h2d(struct device *dev, struct device_attribute *attr, char *buf)
{ {
return sprintf(buf,"Write address/length pair into this file to hand this region of the host to device DMA buffer to device (after CPU writes).\n"); return sprintf(buf,"Write address/length pair into this file to hand this region of the host to device DMA buffer to device (after CPU writes).\n");
...@@ -378,11 +324,6 @@ static ssize_t get_sync_for_cpu_bidir(struct device *dev, struct device_attribut ...@@ -378,11 +324,6 @@ static ssize_t get_sync_for_cpu_bidir(struct device *dev, struct device_attribut
{ {
return sprintf(buf,"Write address/length pair into this file to hand this region of the bidirectional DMA buffer to CPU (before CPU reads).\n"); return sprintf(buf,"Write address/length pair into this file to hand this region of the bidirectional DMA buffer to CPU (before CPU reads).\n");
} }
static ssize_t get_flush_cpu_cache(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "Write command and address into this file to flush CPU caches. Format 'chn:start_offset:end_offset' where "
"'chn' is sensor channel, 'start_offset' and 'end_offset' are start and end data offsets in circbuf\n");
}
static DEVICE_ATTR(buffer_address, SYSFS_PERMISSIONS & SYSFS_READONLY, get_paddr, NULL); static DEVICE_ATTR(buffer_address, SYSFS_PERMISSIONS & SYSFS_READONLY, get_paddr, NULL);
static DEVICE_ATTR(buffer_pages, SYSFS_PERMISSIONS & SYSFS_READONLY, get_size, NULL); static DEVICE_ATTR(buffer_pages, SYSFS_PERMISSIONS & SYSFS_READONLY, get_size, NULL);
...@@ -392,14 +333,12 @@ static DEVICE_ATTR(buffer_address_d2h, SYSFS_PERMISSIONS & SYSFS_READONLY, ...@@ -392,14 +333,12 @@ static DEVICE_ATTR(buffer_address_d2h, SYSFS_PERMISSIONS & SYSFS_READONLY,
static DEVICE_ATTR(buffer_pages_d2h, SYSFS_PERMISSIONS & SYSFS_READONLY, get_size_d2h, NULL); static DEVICE_ATTR(buffer_pages_d2h, SYSFS_PERMISSIONS & SYSFS_READONLY, get_size_d2h, NULL);
static DEVICE_ATTR(buffer_address_bidir, SYSFS_PERMISSIONS & SYSFS_READONLY, get_paddr_bidir, NULL); static DEVICE_ATTR(buffer_address_bidir, SYSFS_PERMISSIONS & SYSFS_READONLY, get_paddr_bidir, NULL);
static DEVICE_ATTR(buffer_pages_bidir, SYSFS_PERMISSIONS & SYSFS_READONLY, get_size_bidir, NULL); static DEVICE_ATTR(buffer_pages_bidir, SYSFS_PERMISSIONS & SYSFS_READONLY, get_size_bidir, NULL);
//static DEVICE_ATTR(buffer_flush, SYSFS_PERMISSIONS, get_cache, flush_cache);
static DEVICE_ATTR(sync_for_cpu_h2d, SYSFS_PERMISSIONS, get_sync_for_cpu_h2d, sync_for_cpu_h2d); static DEVICE_ATTR(sync_for_cpu_h2d, SYSFS_PERMISSIONS, get_sync_for_cpu_h2d, sync_for_cpu_h2d);
static DEVICE_ATTR(sync_for_device_h2d, SYSFS_PERMISSIONS, get_sync_for_device_h2d, sync_for_device_h2d); static DEVICE_ATTR(sync_for_device_h2d, SYSFS_PERMISSIONS, get_sync_for_device_h2d, sync_for_device_h2d);
static DEVICE_ATTR(sync_for_cpu_d2h, SYSFS_PERMISSIONS, get_sync_for_cpu_d2h, sync_for_cpu_d2h); static DEVICE_ATTR(sync_for_cpu_d2h, SYSFS_PERMISSIONS, get_sync_for_cpu_d2h, sync_for_cpu_d2h);
static DEVICE_ATTR(sync_for_device_d2h, SYSFS_PERMISSIONS, get_sync_for_device_d2h, sync_for_device_d2h); static DEVICE_ATTR(sync_for_device_d2h, SYSFS_PERMISSIONS, get_sync_for_device_d2h, sync_for_device_d2h);
static DEVICE_ATTR(sync_for_cpu_bidir, SYSFS_PERMISSIONS, get_sync_for_cpu_bidir, sync_for_cpu_bidir); static DEVICE_ATTR(sync_for_cpu_bidir, SYSFS_PERMISSIONS, get_sync_for_cpu_bidir, sync_for_cpu_bidir);
static DEVICE_ATTR(sync_for_device_bidir, SYSFS_PERMISSIONS, get_sync_for_device_bidir, sync_for_device_bidir); static DEVICE_ATTR(sync_for_device_bidir, SYSFS_PERMISSIONS, get_sync_for_device_bidir, sync_for_device_bidir);
static DEVICE_ATTR(flush_cpu_cache, SYSFS_PERMISSIONS, get_flush_cpu_cache, flush_cpu_cache);
static struct attribute *root_dev_attrs[] = { static struct attribute *root_dev_attrs[] = {
&dev_attr_buffer_address.attr, &dev_attr_buffer_address.attr,
...@@ -410,14 +349,12 @@ static struct attribute *root_dev_attrs[] = { ...@@ -410,14 +349,12 @@ static struct attribute *root_dev_attrs[] = {
&dev_attr_buffer_pages_d2h.attr, &dev_attr_buffer_pages_d2h.attr,
&dev_attr_buffer_address_bidir.attr, &dev_attr_buffer_address_bidir.attr,
&dev_attr_buffer_pages_bidir.attr, &dev_attr_buffer_pages_bidir.attr,
// &dev_attr_buffer_flush.attr,
&dev_attr_sync_for_cpu_h2d.attr, &dev_attr_sync_for_cpu_h2d.attr,
&dev_attr_sync_for_device_h2d.attr, &dev_attr_sync_for_device_h2d.attr,
&dev_attr_sync_for_cpu_d2h.attr, &dev_attr_sync_for_cpu_d2h.attr,
&dev_attr_sync_for_device_d2h.attr, &dev_attr_sync_for_device_d2h.attr,
&dev_attr_sync_for_cpu_bidir.attr, &dev_attr_sync_for_cpu_bidir.attr,
&dev_attr_sync_for_device_bidir.attr, &dev_attr_sync_for_device_bidir.attr,
&dev_attr_flush_cpu_cache.attr,
NULL NULL
}; };
......
...@@ -2,20 +2,18 @@ ...@@ -2,20 +2,18 @@
* *
* @brief Helper functions for various routines form x393.h which require several actions to get * @brief Helper functions for various routines form x393.h which require several actions to get
* reliable result. * reliable result.
*/
/* Copyright (C) 2016 Elphel, Inc
* *
* @copyright Copyright (C) 2016 Elphel, Inc
*
* @par <b>License</b>
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*
* 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/>.
*/ */
......
...@@ -2,20 +2,18 @@ ...@@ -2,20 +2,18 @@
* *
* @brief Helper functions for various routines form x393.h which require several actions to get * @brief Helper functions for various routines form x393.h which require several actions to get
* reliable result. * reliable result.
*/
/* Copyright (C) 2016 Elphel, Inc
* *
* @copyright Copyright (C) 2016 Elphel, Inc
*
* @par <b>License</b>
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
*
* 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/>.
*/ */
...@@ -26,7 +24,7 @@ ...@@ -26,7 +24,7 @@
#include <asm/types.h> #include <asm/types.h>
#include "x393.h" #include "x393.h"
/** @brief Number of times to repeat register read sequence while waiting for /** @brief The number of times to repeat register read sequence while waiting for
* sequence number specified. * sequence number specified.
*/ */
#define REPEAT_READ 10 #define REPEAT_READ 10
......
/** /**
* @file x393_macro.h * @file x393_macro.h
* @brief This file contains various macros used in multiple files. * @brief This file contains various macros used in multiple files.
* @copyright Copyright (C) 2016 Elphel, Inc
*
* @par <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/>.
*/ */
#ifndef _X393_MACRO #ifndef _X393_MACRO
#define _X393_MACRO #define _X393_MACRO
...@@ -9,39 +23,46 @@ ...@@ -9,39 +23,46 @@
/** @brief Resolution of current/OEF pointer in bits */ /** @brief Resolution of current/OEF pointer in bits */
#define OFFSET256_CNTR_RES 26 #define OFFSET256_CNTR_RES 26
/** @brief The size of data transfer in bytes */
#define CHUNK_SIZE 32 #define CHUNK_SIZE 32
/** @brief The size of #interframe_params_t structure in double words */ /** @brief The size of #interframe_params_t structure in double words */
#define INTERFRAME_PARAMS_SZ 8 #define INTERFRAME_PARAMS_SZ 8
/** @brief Marker field in frame length double word value */
#define MARKER_FF 0xff000000 #define MARKER_FF 0xff000000
/** @brief #interframe_params_t has a guard field and its value must be equal to MARKER_FFFF, otherwise
* it has been overwritten, as JPEG can not have two subsequent 0xFF */
#define MARKER_FFFF 0xffff #define MARKER_FFFF 0xffff
/** @brief Mask for frame length extraction from double word value */
#define FRAME_LENGTH_MASK 0xffffff #define FRAME_LENGTH_MASK 0xffffff
/** @brief No operations with compressor interrupt control register */
#define IRQ_NOP 0 #define IRQ_NOP 0
/** @brief Clear compressor interrupt status */
#define IRQ_CLEAR 1 #define IRQ_CLEAR 1
/** @brief Disable compressor interrupt */
#define IRQ_DISABLE 2 #define IRQ_DISABLE 2
/** @brief Enable compressor interrupt */
#define IRQ_ENABLE 3 #define IRQ_ENABLE 3
/** @brief Convert size in bytes to size in double words */
#define BYTE2DW(x) ((x) >> 2) #define BYTE2DW(x) ((x) >> 2)
/** @brief Convert size in double words to size in bytes */
#define DW2BYTE(x) ((x) << 2) #define DW2BYTE(x) ((x) << 2)
/** @brief 4 bytes offset, this one comes from Python code x393_cmprs_afi.py */
// 4 bytes offset, this one comes from python code x393_cmprs_afi.py
#define ADJUSTMENT 4 #define ADJUSTMENT 4
#define INSERTED_BYTES(x) (((CHUNK_SIZE - ((((x) % CHUNK_SIZE) + CCAM_MMAP_META) % CHUNK_SIZE) - ADJUSTMENT) % CHUNK_SIZE ) + ADJUSTMENT) #define INSERTED_BYTES(x) (((CHUNK_SIZE - ((((x) % CHUNK_SIZE) + CCAM_MMAP_META) % CHUNK_SIZE) - ADJUSTMENT) % CHUNK_SIZE ) + ADJUSTMENT)
/* These macro were removed from sensor_common.h*/
#define X313_LENGTH_MASK 0xff000000 #define X313_LENGTH_MASK 0xff000000
/** @brief Subtract two offsets considering that the resulting offset can roll over the start of circular buffer */
#define X393_BUFFSUB(x, y) (((x) >= (y)) ? ((x)-(y)) : ((x) + (CCAM_DMA_SIZE -(y)))) #define X393_BUFFSUB(x, y) (((x) >= (y)) ? ((x)-(y)) : ((x) + (CCAM_DMA_SIZE -(y))))
/** @brief Add two offsets considering that the resulting offset car roll over the end of circular buffer */
#define X393_BUFFADD(x, y) ((((x) + (y)) <= CCAM_DMA_SIZE) ? ((x) + (y)) : ((x) - (CCAM_DMA_SIZE -(y)))) #define X393_BUFFADD(x, y) ((((x) + (y)) <= CCAM_DMA_SIZE) ? ((x) + (y)) : ((x) - (CCAM_DMA_SIZE -(y))))
#define TABLE_TYPE_QUANT 0 #define TABLE_TYPE_QUANT 0
#define TABLE_TYPE_CORING 1 #define TABLE_TYPE_CORING 1
#define TABLE_TYPE_FOCUS 2 #define TABLE_TYPE_FOCUS 2
#define TABLE_TYPE_HUFFMAN 3 #define TABLE_TYPE_HUFFMAN 3
/** /**
* @brief Converts file minor number to image compressor channel. * @brief Converts file minor number to image compressor channel.
* *
...@@ -49,7 +70,7 @@ ...@@ -49,7 +70,7 @@
* next nibble contains device type. Channel numbers and device type are defined in #driver_numbers.h * next nibble contains device type. Channel numbers and device type are defined in #driver_numbers.h
* @param[in] minor file minor number * @param[in] minor file minor number
* @param[out] dev_type pointer to a variable which will hold device type or NULL if this value is not needed * @param[out] dev_type pointer to a variable which will hold device type or NULL if this value is not needed
* @return compressor channel number in the range [0..#IMAGE_CHN_NUM) * @return compressor channel number in the range [0..#SENSOR_PORTS)
*/ */
static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_type) static inline unsigned int minor_to_chn(unsigned int minor, unsigned int *dev_type)
{ {
......
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