Commit 732ab22a authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

merged with rocko

parent a63ae561
......@@ -203,7 +203,7 @@ ssize_t circbuf_get_ptr(int sensor_port, size_t offset, size_t len, struct fvec
return ret;
}
EXPORT_SYMBOL_GPL(circbuf_get_ptr);
EXPORT_SYMBOL_GPL(circbuf_get_ptr); // @suppress("Unused function declaration") it is still needed
/**
* @brief Process circular buffer file opening and define further action in accordance
......@@ -1026,7 +1026,7 @@ static struct platform_driver elphel393_circbuf = {
},
};
module_platform_driver(elphel393_circbuf);
module_platform_driver(elphel393_circbuf); // @suppress("Unused variable declaration in file scope") because
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Andrey Filippov <andrey@elphel.com>.");
......
......@@ -100,7 +100,6 @@
//#include <linux/of_fdt.h>
//#include <linux/of_net.h>
#include <linux/sysfs.h>
#include <linux/uaccess.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
......
......@@ -37,6 +37,7 @@
#include "mt9x001.h"
#include "mt9f002.h"
#include "multi10359.h"
#include "lepton.h"
#include "detect_sensors.h"
#define DETECT_SENSORS_MODULE_DESCRIPTION "Detect sensor type(s) attached to each of the ports"
......@@ -78,6 +79,7 @@ const struct sensor_name_t sensor_names[] ={
{.name="mt9f002", .type=1, .iface=HISPI4, .code = SENSOR_MT9F002}, // MT9F002
{.name="ibis51300", .type=1, .iface=PARALLEL12, .code = SENSOR_IBIS51300}, // FillFactory IBIS51300
{.name="kai11002", .type=1, .iface=PARALLEL12, .code = SENSOR_KAI11000}, // Kodak KAI11002
{.name="lepton35", .type=1, .iface=VOSPI, .code = SENSOR_LEPTON35}, // Kodak KAI11002
{.name=NULL, .type=0, .iface=NONE, .code = 0} // end of list
};
static sens_iface_t port_iface[SENSOR_PORTS];
......@@ -182,7 +184,8 @@ void update_port_iface(int port) ///< Sensor port number (0..3)
port_iface[port] = iface;
return;
}
port_iface[port] = get_iface_by_code(get_detected_sensor_code(port,-1), DETECT_MUX); // '-1' - any subchannel
//TODO: Check with 10359. was port_iface[port] = get_iface_by_code(get_detected_sensor_code(port,-1), DETECT_MUX);
port_iface[port] = get_iface_by_code(get_detected_sensor_code(port,-1), DETECT_SENSOR); // '-1' - any subchannel
}
/** Get per-port interface type */
......@@ -369,6 +372,7 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev)
char names[4][80];
struct device_node *node = pdev->dev.of_node;
int num_ports, port, num_sub, sub_chn;
int scode;
if (node) {
config_string = of_get_property(node, OF_PREFIX_NAME",port-mux", NULL); // &len);
pr_info ("Mux config_string = %s (was looking for '%s')\n",config_string, OF_PREFIX_NAME",port-mux");
......@@ -396,6 +400,10 @@ static int elphel393_detect_sensors_sysfs_register(struct platform_device *pdev)
num_sub = sscanf(config_string,"%79s %79s %79s %79s", names[0], names[1], names[2], names[3]);
pr_info ("port %d : %d subchannels\n",port, num_sub);
for (sub_chn = 0; sub_chn < num_sub; sub_chn++){
scode = get_code_by_name(names[sub_chn], DETECT_SENSOR);
if (scode < 0){
pr_err("Invalid sensor/mux name found in device tree: %s\n",names[sub_chn]);
}
pr_info ("Setting sensor %d:%d '%s' (0x%x)\n",port, sub_chn, names[sub_chn], get_code_by_name(names[sub_chn], DETECT_SENSOR));
set_detected_sensor_code(port, sub_chn, get_code_by_name(names[sub_chn], DETECT_SENSOR));
init_port_ahead_table(port,sub_chn);
......@@ -458,7 +466,7 @@ int detect_sensors_par2addr_init(int port,int sub_chn){
u16 haddr2rec[MAX_SENSORS][MAX_FPGA_RECS]; ///< Big LUT (but almost empty). Sensor's page address (haddr of reg addr) to fpga i2c record number (fpga line#)
};
*/
dev_info(g_dev_ptr,"detect_sensors_par2addr_init(): sensorPortConfig[%d].sensor[%d] = 0x%x\n",port, sub_chn, sensorPortConfig[port].sensor[sub_chn]);
switch (sensorPortConfig[port].sensor[sub_chn]) {
case SENSOR_MT9P006:
// get sensor table
......@@ -472,6 +480,11 @@ int detect_sensors_par2addr_init(int port,int sub_chn){
pages = mt9f002_pages;
atab = mt9f002_ahead_tab;
break;
case SENSOR_LEPTON35:
par2addr = lepton_par2addr;
pages = lepton_pages;
atab = lepton_ahead_tab;
break;
}
if (par2addr){
// convert to key-value
......@@ -483,44 +496,6 @@ int detect_sensors_par2addr_init(int port,int sub_chn){
sensorPortConfig[port].ahead_tab[sub_chn] = atab;
}
/*
// all .mux and .sensor are already filled out
for (portx = 0; portx < SENSOR_PORTS; portx++){
// that's from device tree, fpga is not programmed yet
dev_dbg(g_dev_ptr,"port: %d mux: %d sensors: %d %d %d %d\n",
portx,
sensorPortConfig[portx].mux,
sensorPortConfig[portx].sensor[0],
sensorPortConfig[portx].sensor[1],
sensorPortConfig[portx].sensor[2],
sensorPortConfig[portx].sensor[3]
);
// sub_chn = 3 is never used
for (sub_chn = 0; sub_chn < 4; sub_chn++){
//sensorPortConfig[port].sensor[sub_chn];
switch (sensorPortConfig[portx].sensor[sub_chn]) {
case SENSOR_MT9P006:
// get sensor table
par2addr = mt9x001_par2addr;
pages = mt9x001_pages;
break;
case SENSOR_MT9F002:
// get sensor table
par2addr = mt9f002_par2addr;
pages = mt9f002_pages;
break;
}
if (par2addr){
// convert to key-value
par2addr_fill(par2addr,sensorPortConfig[portx].par2addr[sub_chn]);
// save pointer to static LUT
sensorPortConfig[portx].pages_ptr[sub_chn] = pages;
}
}
}
*/
return 0;
}
......
......@@ -45,7 +45,7 @@ struct sensor_port_config_t {
extern struct sensor_port_config_t *pSensorPortConfig;
typedef enum {NONE,PARALLEL12,HISPI4} sens_iface_t; ///< Sensor port interface type
typedef enum {NONE,PARALLEL12,HISPI4,VOSPI} sens_iface_t; ///< Sensor port interface type
int get_code_by_name(const char * name, int type);
const char * get_name_by_code(int code, int type);
......
......@@ -294,46 +294,46 @@ static int __init elphelmem_init(void)
pr_err("ERROR allocating Bidirectional DMA memory buffer\n");
}
pr_info("Coherent buffer vaddr: 0x%08X\n",(u32) pElphel_buf -> vaddr);
pr_info("Coherent buffer paddr: 0x%08X\n",(u32) pElphel_buf -> paddr);
pr_info("Coherent buffer length: 0x%08X\n",(u32) pElphel_buf -> size * PAGE_SIZE);
pr_info("Coherent buffer vaddr: 0x%08x\n",(u32) pElphel_buf -> vaddr);
pr_info("Coherent buffer paddr: 0x%08x\n",(u32) pElphel_buf -> paddr);
pr_info("Coherent buffer length: 0x%08lx\n",(u32) pElphel_buf -> size * PAGE_SIZE);
pr_info(" circbuf channel 0 vaddr: 0x%08X paddr: 0x%08X length 0x%08X\n",
pr_info(" circbuf channel 0 vaddr: 0x%08x paddr: 0x%08x length 0x%08lx\n",
(u32) pElphel_buf -> circbuf_chn0_vaddr,
(u32) pElphel_buf -> circbuf_chn0_paddr,
(u32) pElphel_buf-> circbuf_chn0_size * PAGE_SIZE);
pr_info(" circbuf channel 1 vaddr: 0x%08X paddr: 0x%08X length 0x%08X\n",
pr_info(" circbuf channel 1 vaddr: 0x%08x paddr: 0x%08x length 0x%08lx\n",
(u32) pElphel_buf -> circbuf_chn1_vaddr,
(u32) pElphel_buf -> circbuf_chn1_paddr,
(u32) pElphel_buf-> circbuf_chn1_size * PAGE_SIZE);
pr_info(" circbuf channel 2 vaddr: 0x%08X paddr: 0x%08X length 0x%08X\n",
pr_info(" circbuf channel 2 vaddr: 0x%08x paddr: 0x%08x length 0x%08lx\n",
(u32) pElphel_buf -> circbuf_chn2_vaddr,
(u32) pElphel_buf -> circbuf_chn2_paddr,
(u32) pElphel_buf-> circbuf_chn2_size * PAGE_SIZE);
pr_info(" circbuf channel 3 vaddr: 0x%08X paddr: 0x%08X length 0x%08X\n",
pr_info(" circbuf channel 3 vaddr: 0x%08x paddr: 0x%08x length 0x%08lx\n",
(u32) pElphel_buf -> circbuf_chn3_vaddr,
(u32) pElphel_buf -> circbuf_chn3_paddr,
(u32) pElphel_buf-> circbuf_chn3_size * PAGE_SIZE);
pr_info(" raw channel 0 vaddr: 0x%08X paddr: 0x%08X length 0x%08X\n",
pr_info(" raw channel 0 vaddr: 0x%08x paddr: 0x%08x length 0x%08lx\n",
(u32) pElphel_buf -> raw_chn0_vaddr,
(u32) pElphel_buf -> raw_chn0_paddr,
(u32) pElphel_buf-> raw_chn0_size * PAGE_SIZE);
pr_info(" raw channel 1 vaddr: 0x%08X paddr: 0x%08X length 0x%08X\n",
pr_info(" raw channel 1 vaddr: 0x%08x paddr: 0x%08x length 0x%08lx\n",
(u32) pElphel_buf -> raw_chn1_vaddr,
(u32) pElphel_buf -> raw_chn1_paddr,
(u32) pElphel_buf-> raw_chn1_size * PAGE_SIZE);
pr_info(" raw channel 2 vaddr: 0x%08X paddr: 0x%08X length 0x%08X\n",
pr_info(" raw channel 2 vaddr: 0x%08x paddr: 0x%08x length 0x%08lx\n",
(u32) pElphel_buf -> raw_chn2_vaddr,
(u32) pElphel_buf -> raw_chn2_paddr,
(u32) pElphel_buf-> raw_chn2_size * PAGE_SIZE);
pr_info(" raw channel 3 vaddr: 0x%08X paddr: 0x%08X length 0x%08X\n",
pr_info(" raw channel 3 vaddr: 0x%08x paddr: 0x%08x length 0x%08lx\n",
(u32) pElphel_buf -> raw_chn3_vaddr,
(u32) pElphel_buf -> raw_chn3_paddr,
(u32) pElphel_buf-> raw_chn3_size * PAGE_SIZE);
......
This diff is collapsed.
......@@ -1499,6 +1499,8 @@ int setFramePars(int sensor_port, ///< sensor port number (0
unsigned long *funcs2call =afuncs2call[sensor_port];
dev_dbg(g_devfp_ptr, "port= %d, this_framepars=0x%x numPars=%d\n", sensor_port, (int)this_framepars, numPars);
// dev_info(g_devfp_ptr, "port= %d, this_framepars=0x%x numPars=%d\n", sensor_port, (int)this_framepars, numPars);
MDP(DBGB_FSFP,sensor_port,"this_framepars=0x%x numPars=%d\n", (int)this_framepars, numPars)
for (npar = 0; npar < numPars; npar++) {
......@@ -1506,6 +1508,9 @@ int setFramePars(int sensor_port, ///< sensor port number (0
val = pars[npar].val;
index = pars[npar].num & 0xffff;
dev_dbg(g_devfp_ptr, ": --- frame16=%d index=%d (0x%x) val=0x%x, findex_future = 0x%x\n", frame16, index, (int)pars[npar].num, (int)val, findex_future);
// dev_info(g_devfp_ptr, ": --- frame16=%d index=%d (0x%x) val=0x%x, findex_future = 0x%x\n", frame16, index, (int)pars[npar].num, (int)val, findex_future);
MDP(DBGB_FSFV,sensor_port," --- frame16=%d index=%d (0x%x) val=0x%x\n", frame16, index, (int)pars[npar].num, (int)val)
// remark: code below looks similar to setFramePar function, call it instead
if (index > ((index >= FRAMEPAR_GLOBALS) ? (P_MAX_GPAR + FRAMEPAR_GLOBALS) : P_MAX_PAR)) {
......@@ -2028,12 +2033,14 @@ static ssize_t show_fpga_sensor_interface(struct device *dev, struct device_attr
if (!hardware_initialized)
return -EBUSY;
switch (x393_sensor_interface()){
case 0:
case FPGA_PAR12:
return sprintf(buf,"PAR12\n");
case 1:
case FPGA_HISPI:
return sprintf(buf,"HISPI\n");
case FPGA_VOSPI:
return sprintf(buf,"VOSPI\n");
default:
return sprintf(buf,"0x%08%lx\n", x393_sensor_interface());
return sprintf(buf,"0x%08x\n", (int) x393_sensor_interface());
}
}
......
......@@ -115,7 +115,6 @@
#include <asm/delay.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include <uapi/elphel/x393_devices.h>
#include <uapi/elphel/c313a.h>
#include <uapi/elphel/exifa.h>
......
......@@ -47,8 +47,6 @@
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/uaccess.h>
#include <asm/delay.h>
#include <asm/uaccess.h> // copy_*_user
#include <uapi/elphel/c313a.h>
......
......@@ -27,7 +27,7 @@
#include <linux/fs.h>
#include <asm/uaccess.h> // copy_*_user
#include <linux/of.h> // Device Tree
#include <linux/uaccess.h>
#include <uapi/elphel/c313a.h> // PARS_FRAMES_MASK
......
This diff is collapsed.
......@@ -23,7 +23,7 @@
// bit 9 should have set masking for broken frames
// cleared bit 3 allows writing to some RO registers
//#define MT9F002_RESET_REGISTER_VALUE 0x001c
#define MT9F002_RESET_REGISTER_VALUE 0x0011c
#define MT9F002_RESET_REGISTER_VALUE 0x011c
//#define MT9F002_RESET_REGISTER_VALUE 0x0014
// number of lines to sacrifice before generating Frame Valid
#define MT9F002_VACT_DELAY 2
......
......@@ -1004,6 +1004,9 @@ int mt9x001_pgm_initsensor (int sensor_port, ///< sensor port
if (frame16 >= 0) return -1; // should be ASAP
// reset sensor by applying MRST (low):
// CCAM_MRST_ON;
//FIXME: No master reset here? Should it be here regardless of debug? ****
if (debug_delays & 0xff) {
dev_dbg(g_dev_ptr,"Resetting MT9X001 sensor, port=%d\n",sensor_port);
sensio_ctl.mrst = 0;
......
......@@ -1354,14 +1354,14 @@ int multisensor_pgm_multisens (int sensor_port, ///< sensor port n
// int old_sensor=prev_selected-1; // may be <0
// int new_sensor=selected-1; // >=0
if (multi_unitialized[sensor_port] && (!prev_composite) && (old_sensor>=0)) { // was single-sensor mode, copy P_WOI_* to individual sensor WOI and FLIPS
dev_dbg(g_dev_ptr,"multi_unitialized=%d old_sensor=%x, multi_fliph=%x multi_flipv=%x\n", multi_unitialized, old_sensor, multi_fliph,multi_flipv);
dev_dbg(g_dev_ptr,"multi_unitialized=%d old_sensor=%x, multi_fliph=%x multi_flipv=%x\n", multi_unitialized[old_sensor], old_sensor, multi_fliph,multi_flipv);
wois[(P_MULTI_WIDTH1- P_MULTI_WOI)+old_sensor]= prevpars->pars[P_WOI_WIDTH];
wois[(P_MULTI_HEIGHT1-P_MULTI_WOI)+old_sensor]= prevpars->pars[P_WOI_HEIGHT];
wois[(P_MULTI_LEFT1- P_MULTI_WOI)+old_sensor]= prevpars->pars[P_WOI_LEFT];
wois[(P_MULTI_TOP1- P_MULTI_WOI)+old_sensor]= prevpars->pars[P_WOI_TOP];
multi_fliph= (multi_fliph & (~(1<<old_sensor))) | ((prevpars->pars[P_FLIPH] & 1) << old_sensor);
multi_flipv= (multi_flipv & (~(1<<old_sensor))) | ((prevpars->pars[P_FLIPV] & 1) << old_sensor);
dev_dbg(g_dev_ptr,"multi_unitialized=%d old_sensor=%x, multi_fliph=%x multi_flipv=%x\n", multi_unitialized, old_sensor, multi_fliph,multi_flipv);
dev_dbg(g_dev_ptr,"multi_unitialized=%d old_sensor=%x, multi_fliph=%x multi_flipv=%x\n", multi_unitialized[old_sensor], old_sensor, multi_fliph,multi_flipv);
}
if (multi_unitialized[sensor_port] && (!composite) && (prev_composite || ((new_sensor>=0) && (old_sensor!=new_sensor)))) { // now single-sensor mode, set P_WOI* from saved parameters
if ((wois[(P_MULTI_WIDTH1- P_MULTI_WOI)+new_sensor]==0) || (wois[(P_MULTI_HEIGHT1- P_MULTI_WOI)+new_sensor]==0)) {
......@@ -2181,9 +2181,11 @@ int multisensor_memphase_debug (int sensor_port, ///< Sesnor port number (0..3)
#endif
}
for (i=0; i<8;i++) printk (" %02x ",i); printk("\n");
for (i=0; i<8;i++) printk (" %02x ",i);
printk("\n");
for (n=0;n<64;n+=8) {
for (i=0; i<8;i++) printk ("%04lx ", data[n+i]); printk("\n");
for (i=0; i<8;i++) printk ("%04lx ", data[n+i]);
printk("\n");
}
for (i=0;i<8;i++) setbits[i]=0;
for (n=0;n<64;n++) {
......@@ -2198,7 +2200,8 @@ int multisensor_memphase_debug (int sensor_port, ///< Sesnor port number (0..3)
}
}
OK=(setbits[0]==0) && (setbits[1]==0) && (setbits[2]==0) && (setbits[3]==0x80) && (setbits[4]==0x80) && (setbits[5]==0x80) && (setbits[6]==0) && (setbits[7]==0);
for (i=0; i<8;i++) printk (" %03x ",setbits[i]); printk("\n");
for (i=0; i<8;i++) printk (" %03x ",setbits[i]);
printk("\n");
n=(0x10000*sx)/s;
printk ("Centroid - 0x%x, sx=0x%x, s=0x%x. OK=%d\n",n, sx,s,OK);
return n;
......
This diff is collapsed.
......@@ -450,6 +450,7 @@ extern struct sensor_port_config_t *pSensorPortConfig;
#define SET_SENSOR_MIBPAR_COND_LUT(p,f,i,r,v) {\
int _MINDEX= MULTIREG(p,P_SENSOR_REGS+(r),(i));\
int _I = (i);\
int _ADDR;\
if (_MINDEX) { \
if ((v) != thispars->pars[_MINDEX]) { \
pars_to_update[nupdate ].num= _MINDEX ;\
......@@ -462,7 +463,7 @@ extern struct sensor_port_config_t *pSensorPortConfig;
_I = pSensorPortConfig[(p)].broadcast_addr;\
} \
} \
int _ADDR = pSensorPortConfig[(p)].par2addr[_I][(r)];\
_ADDR = pSensorPortConfig[(p)].par2addr[_I][(r)];\
if (!(_ADDR&0xffff0000)) {\
X3X3_I2C_SEND2_LUT((p), (f), _I, _ADDR, (v));\
}\
......
......@@ -168,6 +168,13 @@ static struct meta_offsets_t { //
int Image_Orientation; ///< EXIF image orientation offset
int Photo_MakerNote; ///< EXIF maker note (custom data for multi-frame composite images) offset
int PageNumber; ///< EXIF subchannel (0..3) number offset
int ImageWidth; ///< TIFF image width (long, 1)
int ImageLength; ///< TIFF image height (long,1)
int Image_BitsPerSample; ///< TIFF bits per sample, now 8 or 16 (short, 1)
int Image_SamplesPerPixel; ///< TIFF samples per pixel, now always 1 (short, 1)
int RowsPerStrip; ///< TIFF now image height (short, 1)
int StripByteCounts ; ///< TIFF with single strip - byte size of the image (W*H*Image_SamplesPerPixel*ceil(Image_BitsPerSample/8)
} meta_offsets;
#ifdef TEST_DISABLE_CODE
......@@ -498,11 +505,12 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer
int index_time = jptr->jpeg_wp - 11;
char time_buff[27];
char * exif_meta_time_string;
// calcualte bayer without flips - extra xor
// calculate bayer without flips - extra xor
int global_flips, extra_flips, bayer;
unsigned char orientations[]="1638274545273816";
unsigned char orientation_short[2];
int maker_offset;
unsigned long width, height, bits;
u32 frame = jptr->frame;
// 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
......@@ -523,7 +531,7 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer
global_flips=extra_flips & 3;
}
// calculate bayer without flips
// calculate Bayer without flips
bayer = get_imageParamsFrame(sensor_port, P_COMP_BAYER, frame);
bayer ^= get_imageParamsFrame(sensor_port, P_COMPMOD_BYRSH, frame);
// subtract flips
......@@ -577,6 +585,22 @@ inline void updateIRQ_Exif(struct jpeg_ptr_t *jptr, ///< pointer
//get_globalParam(G_TASKLET_CTL)
// left 1 long spare (+44)
}
// Tiff-related data:
width = get_imageParamsFrame(sensor_port, P_WOI_WIDTH, frame);
height = get_imageParamsFrame(sensor_port, P_WOI_HEIGHT, frame);
bits = get_imageParamsFrame(sensor_port, P_BITS, frame);
putlong_meta_irq(sensor_port, width, &meta_offsets.ImageWidth, Exif_Image_ImageWidth);
putlong_meta_irq(sensor_port, height, &meta_offsets.ImageLength, Exif_Image_ImageLength);
short_buff[0] = 0;
short_buff[1] = bits; // assuming non 8/16 (10, 12) are OK?
write_meta_irq(sensor_port, short_buff, &meta_offsets.Image_BitsPerSample, Exif_Image_BitsPerSample, 2);
short_buff[1] = 1;
write_meta_irq(sensor_port, short_buff, &meta_offsets.Image_SamplesPerPixel, Exif_Image_SamplesPerPixel, 2);
short_buff[0] = height >> 8;
short_buff[1] = height & 0xff;
write_meta_irq(sensor_port, short_buff, &meta_offsets.RowsPerStrip, Exif_Image_RowsPerStrip, 2);
putlong_meta_irq(sensor_port, height * width * ((bits + 7) >> 3), &meta_offsets.StripByteCounts, Exif_Image_StripByteCounts);
interframe->meta_index=store_meta(sensor_port);
}
......@@ -1235,7 +1259,8 @@ int register_i2c_sensor(int ports_mask) ///< bitmask of the sensor ports to use
bool mux;
bool broadcast_set = false;
dev_dbg(g_dev_ptr,"register_i2c_sensor()\n");
// dev_dbg(g_dev_ptr,"register_i2c_sensor()\n");
dev_info(g_dev_ptr,"register_i2c_sensor()\n");
for(port=0;port<SENSOR_PORTS;port++) if ((1<<port)&ports_mask) {
......@@ -1327,6 +1352,7 @@ int register_i2c_sensor(int ports_mask) ///< bitmask of the sensor ports to use
memcpy(&dev_sensor, class_sensor, sizeof(x393_i2c_device_t));
i2c_page_register(port, LEGACY_READ_PAGE2);
set_xi2c_rdc(&dev_sensor, port, LEGACY_READ_PAGE2);
dev_info(g_dev_ptr,"register_i2c_sensor(): port=%d, page = 0x%x\n", port, LEGACY_READ_PAGE2);
if (mux){
// 'read' recs for 10359
......@@ -1377,7 +1403,8 @@ int legacy_i2c(int ports) ///< bitmask of the sensor ports to use
i2c_page_register(sensor_port, LEGACY_READ_PAGE4);
dev_sensor.data_bytes=4; // for reading 10359 in 32-bit mode
set_xi2c_rdc(&dev_sensor, sensor_port, LEGACY_READ_PAGE4);
dev_dbg(g_dev_ptr, "Initialized sensor i2c for legacy commands, sensor_port= 0x%x\n",sensor_port);
// dev_dbg(g_dev_ptr, "Initialized sensor i2c for legacy commands, sensor_port= 0x%x\n",sensor_port);
dev_info(g_dev_ptr, "Initialized sensor i2c for legacy commands, sensor_port= 0x%x\n",sensor_port);
}
return 0;
/*
......
......@@ -92,10 +92,12 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
#define LEGACY_READ_PAGE2 0xff
#define LEGACY_READ_PAGE4 0xfe
// never used?
#define name_10359 "el10359" // Get name from DT (together with port mask)
#define name_sensor "mt9p006" // Get name from DT (together with port mask)
#define name_mt9p006 "mt9p006" // Get name from DT (together with port mask)
#define name_mt9f002 "mt9f002" // Get name from DT (together with port mask)
#define name_lepton35 "lepton35" // Get name from DT (together with port mask)
#define I2C359_INC 2 ///< slave address increment between sensors in 10359A board (broadcast, 1,2,3) (7 bits SA)
......
......@@ -698,8 +698,10 @@ void write_xi2c_reg16_abs_asap (int chn, ///< sensor port
int addr, ///< low byte of the register address (high is in the table), 8 bits
u32 data) ///< 16 or 8-bit data (LSB aligned), 16 address only for 16 bit data
{
// u32 dw = ((page & 0xff) << 24) | ((addr & 0xff) << 16) | (data & 0xffff);
u32 dw = i2c_combine_page_addr_data8_16(chn, page, addr, data);
// TODO: change to dev_dbg
dev_dbg(sdev, "write_xi2c_reg16_abs_asap(chn=%d, page=0x%x, frame=0x%x addr=0x%x data=0x%x)\n",chn,page,frame,addr,data);
if (frame<0) x393_sensi2c_rel (dw, chn, 0);
else x393_sensi2c_abs (dw, chn, frame & PARS_FRAMES_MASK);
}
......
......@@ -26,9 +26,9 @@
#include <linux/errno.h>
#include <linux/fs.h>
//#include <linux/spinlock.h>
#include <linux/uaccess.h>
#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include "x393.h"
#include "x393_macro.h"
......@@ -89,7 +89,7 @@ static struct class *videomem_dev_class;
// About frame full width:
// https://blog.elphel.com/2015/05/nc393-development-progress-multichannel-memory-controller-for-the-multi-sensor-camera/#Memory_mapping_and_access_types
static struct elphel_video_buf_t buffer_settings = { ///< some default settings, same as in DT
.frame_start = {0x00000000, 0x08000000, 0x10000000, 0x08000000}, /* Frame starts (in bytes) */
.frame_start = {0x00000000, 0x08000000, 0x10000000, 0x18000000}, /* Frame starts (in bytes) */
.frame_full_width = { 8192, 8192, 8192, 8192}, /* Frame full widths (in bytes). 1 memory page is 2048 bytes (128 bursts) */
.frame_height = { 8192, 8192, 8192, 8192}, /* Channel 3 maximal frame height in pixel lines */
.frames_in_buffer = { 2, 2, 2, 2} /* Number of frames in channel 3 buffer */
......@@ -447,15 +447,15 @@ int control_sensor_memory (int num_sensor, ///< sensor port number (0..3)
}
dev_dbg(g_dev_ptr,"{%d} frame16=%d, cmd=%d, x393cms=%d\n",num_sensor,frame16, cmd, (int) x393cmd);
dev_dbg(g_dev_ptr,"mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )\n",
mcntrl_mode.d32, mcntrl_mode.enable, mcntrl_mode.chn_nreset, mcntrl_mode.write_mem, mcntrl_mode.extra_pages,
mcntrl_mode.keep_open, mcntrl_mode.byte32, mcntrl_mode.reset_frame, mcntrl_mode.single, mcntrl_mode.repetitive,
mcntrl_mode.disable_need, mcntrl_mode.skip_too_late);
dev_dbg(g_dev_ptr,"control_sensor_memory mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )\n",
mcntrl_mode.d32, mcntrl_mode.enable, mcntrl_mode.chn_nreset, mcntrl_mode.write_mem,
mcntrl_mode.extra_pages, mcntrl_mode.keep_open, mcntrl_mode.byte32, mcntrl_mode.reset_frame,
mcntrl_mode.single, mcntrl_mode.repetitive, mcntrl_mode.disable_need, mcntrl_mode.skip_too_late);
MDP(DBGB_VM,num_sensor,"frame16=%d, cmd=%d, x393cms=%d\n",frame16, cmd, (int) x393cmd)
MDP(DBGB_VM,num_sensor,"mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )\n",
mcntrl_mode.d32, mcntrl_mode.enable, mcntrl_mode.chn_nreset, mcntrl_mode.write_mem, mcntrl_mode.extra_pages,
mcntrl_mode.keep_open, mcntrl_mode.byte32, mcntrl_mode.reset_frame, mcntrl_mode.single, mcntrl_mode.repetitive,
mcntrl_mode.disable_need, mcntrl_mode.skip_too_late)
MDP(DBGB_VM,num_sensor,"control_sensor_memory mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )\n",
mcntrl_mode.d32, mcntrl_mode.enable, mcntrl_mode.chn_nreset, mcntrl_mode.write_mem,
mcntrl_mode.extra_pages, mcntrl_mode.keep_open, mcntrl_mode.byte32, mcntrl_mode.reset_frame,
mcntrl_mode.single, mcntrl_mode.repetitive,mcntrl_mode.disable_need, mcntrl_mode.skip_too_late)
switch (x393cmd){
......@@ -573,6 +573,7 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
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 linear, ///< 0 tiled, 1 - linescan (for raw images)
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)
x393cmd_t x393cmd, ///< how to apply commands - directly or through channel sequencer
......@@ -585,6 +586,7 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
.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)
.byte32 = 1, // [ 6] (1) (NA in linescan) 32-byte columns (0 - 16-byte), not used in scanline mode
.linear = linear, // [ 7] (1) Use linear mode instead of tiled (for raw image files): extra_pages=0, keep_open=x, byte32=x
.reset_frame = 1, // [ 8] (0) reset frame number
.single = 0, // [ 9] (0) run single frame
.repetitive = 1, // [ 10] (1) run repetitive frames
......@@ -613,15 +615,17 @@ int control_compressor_memory (int num_sensor, ///< sensor port number (0.
return -EINVAL;
}
dev_dbg(g_dev_ptr,"{%d} frame16=%d, cmd=%d, x393cms=%d\n",num_sensor,frame16, cmd, (int) x393cmd);
dev_dbg(g_dev_ptr,"mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )\n",
mcntrl_mode.d32, mcntrl_mode.enable, mcntrl_mode.chn_nreset, mcntrl_mode.write_mem, mcntrl_mode.extra_pages,
mcntrl_mode.keep_open, mcntrl_mode.byte32, mcntrl_mode.reset_frame, mcntrl_mode.single, mcntrl_mode.repetitive,
mcntrl_mode.disable_need, mcntrl_mode.skip_too_late);
dev_dbg(g_dev_ptr,"control_compressor_memory mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, linear=%d, reset_frame=%d, single=%d, repetitive=%d, disable_need=%d, skip_too_late=%d, copy_frame=%d, abort_late=%d)\n",
mcntrl_mode.d32, mcntrl_mode.enable, mcntrl_mode.chn_nreset, mcntrl_mode.write_mem,
mcntrl_mode.extra_pages, mcntrl_mode.keep_open, mcntrl_mode.byte32, mcntrl_mode.linear,
mcntrl_mode.reset_frame, mcntrl_mode.single, mcntrl_mode.repetitive, mcntrl_mode.disable_need,
mcntrl_mode.skip_too_late, mcntrl_mode.copy_frame, mcntrl_mode.abort_late);
MDP(DBGB_VM,num_sensor,"frame16=%d, cmd=%d, x393cms=%d\n",frame16, cmd, (int) x393cmd)
MDP(DBGB_VM,num_sensor,"mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, reset_frame=%d, single=%d,repetitive=%d, disable_need=%d,skip_too_late=%d )\n",
mcntrl_mode.d32, mcntrl_mode.enable, mcntrl_mode.chn_nreset, mcntrl_mode.write_mem, mcntrl_mode.extra_pages,
mcntrl_mode.keep_open, mcntrl_mode.byte32, mcntrl_mode.reset_frame, mcntrl_mode.single, mcntrl_mode.repetitive,
mcntrl_mode.disable_need, mcntrl_mode.skip_too_late)
MDP(DBGB_VM,num_sensor,"control_compressor_memory mode=0x%x (enable=%d, chn_nreset=%d, write_mem=%d, extra_pages=%d, keep_open=%d, byte32=%d, linear=%d, reset_frame=%d, single=%d, repetitive=%d, disable_need=%d, skip_too_late=%d, copy_frame=%d, abort_late=%d)\n",
mcntrl_mode.d32, mcntrl_mode.enable, mcntrl_mode.chn_nreset, mcntrl_mode.write_mem,
mcntrl_mode.extra_pages, mcntrl_mode.keep_open, mcntrl_mode.byte32, mcntrl_mode.linear,
mcntrl_mode.reset_frame, mcntrl_mode.single, mcntrl_mode.repetitive, mcntrl_mode.disable_need,
mcntrl_mode.skip_too_late, mcntrl_mode.copy_frame, mcntrl_mode.abort_late)
switch (x393cmd){
case ASAP:
......
......@@ -32,7 +32,7 @@ int control_sensor_memory (int num_sensor, int cmd, int reset_frame, x393cmd_t
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,
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 control_compressor_memory (int num_sensor, int cmd, int reset_frame, int linear, int extra_pages, int disable_need, x393cmd_t x393cmd, int frame16);
int frames_in_buffer_minus_one (int num_sensor);
void memchan_enable (int chn, int enable);
......
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