Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
linux-elphel
Commits
6405f029
Commit
6405f029
authored
Mar 04, 2021
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugging Boson driver, other warnings cleanup
parent
384c0d4b
Changes
15
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
2407 additions
and
88 deletions
+2407
-88
elphel393-common.dtsi
src/arch/arm/boot/dts/elphel393-common.dtsi
+2
-2
Makefile
src/drivers/elphel/Makefile
+1
-0
boson640.c
src/drivers/elphel/boson640.c
+1893
-0
boson640.h
src/drivers/elphel/boson640.h
+370
-0
detect_sensors.c
src/drivers/elphel/detect_sensors.c
+3
-3
jpeghead.h
src/drivers/elphel/jpeghead.h
+1
-0
param_depend.h
src/drivers/elphel/param_depend.h
+4
-0
pgm_functions.c
src/drivers/elphel/pgm_functions.c
+75
-53
pgm_functions.h
src/drivers/elphel/pgm_functions.h
+2
-1
quantization_tables.h
src/drivers/elphel/quantization_tables.h
+1
-1
sensor_common.h
src/drivers/elphel/sensor_common.h
+10
-8
sensor_i2c.c
src/drivers/elphel/sensor_i2c.c
+30
-8
x393_videomem.c
src/drivers/elphel/x393_videomem.c
+6
-7
c313a.h
src/include/uapi/elphel/c313a.h
+8
-5
x393_devices.h
src/include/uapi/elphel/x393_devices.h
+1
-0
No files found.
src/arch/arm/boot/dts/elphel393-common.dtsi
View file @
6405f029
...
@@ -278,8 +278,8 @@
...
@@ -278,8 +278,8 @@
"sensor_temp 0x18 1 2 100",
"sensor_temp 0x18 1 2 100",
"cy22393 0x69 1 1 100",
"cy22393 0x69 1 1 100",
"lepton35 0x2a 2 2 500",
"lepton35 0x2a 2 2 500",
/*Update elphel393-sensor-i2c to support uart instead of the i2c */
/*Update elphel393-sensor-i2c to support uart instead of the i2c
. 0x81 - 80 - extif/!i2c, 1 - extif mode,rah:2lsbs - bytes
*/
"boson640 0x
2a
2 2 500";
"boson640 0x
81
2 2 500";
} ;
} ;
framepars_operations: elphel393-framepars@0 {
framepars_operations: elphel393-framepars@0 {
compatible = "elphel,elphel393-framepars-1.00";
compatible = "elphel,elphel393-framepars-1.00";
...
...
src/drivers/elphel/Makefile
View file @
6405f029
...
@@ -28,6 +28,7 @@ obj-$(CONFIG_ELPHEL393) += pgm_functions.o
...
@@ -28,6 +28,7 @@ obj-$(CONFIG_ELPHEL393) += pgm_functions.o
obj-$(CONFIG_ELPHEL393)
+=
mt9x001.o
obj-$(CONFIG_ELPHEL393)
+=
mt9x001.o
obj-$(CONFIG_ELPHEL393)
+=
mt9f002.o
obj-$(CONFIG_ELPHEL393)
+=
mt9f002.o
obj-$(CONFIG_ELPHEL393)
+=
lepton.o
obj-$(CONFIG_ELPHEL393)
+=
lepton.o
obj-$(CONFIG_ELPHEL393)
+=
boson640.o
obj-$(CONFIG_ELPHEL393)
+=
multi10359.o
obj-$(CONFIG_ELPHEL393)
+=
multi10359.o
obj-$(CONFIG_ELPHEL393)
+=
imu_log393.o
obj-$(CONFIG_ELPHEL393)
+=
imu_log393.o
...
...
src/drivers/elphel/boson640.c
0 → 100644
View file @
6405f029
This diff is collapsed.
Click to expand it.
src/drivers/elphel/boson640.h
0 → 100644
View file @
6405f029
This diff is collapsed.
Click to expand it.
src/drivers/elphel/detect_sensors.c
View file @
6405f029
...
@@ -489,9 +489,9 @@ int detect_sensors_par2addr_init(int port,int sub_chn){
...
@@ -489,9 +489,9 @@ int detect_sensors_par2addr_init(int port,int sub_chn){
break
;
break
;
case
SENSOR_BOSON640
:
// temporary, set later to actual one
case
SENSOR_BOSON640
:
// temporary, set later to actual one
dev_warn
(
g_dev_ptr
,
"FIX temporary data in detect_sensors for Boson640
\n
"
);
dev_warn
(
g_dev_ptr
,
"FIX temporary data in detect_sensors for Boson640
\n
"
);
par2addr
=
lepton
_par2addr
;
par2addr
=
boson640
_par2addr
;
pages
=
lepton
_pages
;
pages
=
boson640
_pages
;
atab
=
lepton
_ahead_tab
;
atab
=
boson640
_ahead_tab
;
break
;
break
;
}
}
if
(
par2addr
){
if
(
par2addr
){
...
...
src/drivers/elphel/jpeghead.h
View file @
6405f029
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
#ifndef _JPEGHEAD
#ifndef _JPEGHEAD
#define _JPEGHEAD
#define _JPEGHEAD
#include <linux/platform_device.h>
struct
huffman_fpga_code_t
{
struct
huffman_fpga_code_t
{
unsigned
short
value
;
/// code value
unsigned
short
value
;
/// code value
...
...
src/drivers/elphel/param_depend.h
View file @
6405f029
...
@@ -159,6 +159,10 @@ const unsigned long param_depend_tab[]=
...
@@ -159,6 +159,10 @@ const unsigned long param_depend_tab[]=
P_SENSOR
,
ONCHANGE_DETECTSENSOR
|
ONCHANGE_RECALCSEQ
|
ONCHANGE_INITSENSOR
|
ONCHANGE_AFTERINIT
|
ONCHANGE_MULTISENS
|
\
P_SENSOR
,
ONCHANGE_DETECTSENSOR
|
ONCHANGE_RECALCSEQ
|
ONCHANGE_INITSENSOR
|
ONCHANGE_AFTERINIT
|
ONCHANGE_MULTISENS
|
\
ONCHANGE_WINDOW
|
ONCHANGE_EXPOSURE
|
ONCHANGE_HIST
|
ONCHANGE_AEXP
|
ONCHANGE_FOCUSMODE
|
ONCHANGE_LIMITFPS
|
ONCHANGE_HIST
|
\
ONCHANGE_WINDOW
|
ONCHANGE_EXPOSURE
|
ONCHANGE_HIST
|
ONCHANGE_AEXP
|
ONCHANGE_FOCUSMODE
|
ONCHANGE_LIMITFPS
|
ONCHANGE_HIST
|
\
ONCHANGE_MEMSENSOR
|
ONCHANGE_MEMCOMPRESSOR
|
ONCHANGE_COMPMODE
|
ONCHANGE_COMPSTOP
|
ONCHANGE_COMPRESTART
,
ONCHANGE_MEMSENSOR
|
ONCHANGE_MEMCOMPRESSOR
|
ONCHANGE_COMPMODE
|
ONCHANGE_COMPSTOP
|
ONCHANGE_COMPRESTART
,
P_BOOTED
,
ONCHANGE_RECALCSEQ
|
ONCHANGE_INITSENSOR
|
ONCHANGE_AFTERINIT
|
ONCHANGE_MULTISENS
|
\
ONCHANGE_WINDOW
|
ONCHANGE_EXPOSURE
|
ONCHANGE_HIST
|
ONCHANGE_AEXP
|
ONCHANGE_FOCUSMODE
|
ONCHANGE_LIMITFPS
|
ONCHANGE_HIST
|
\
ONCHANGE_MEMSENSOR
|
ONCHANGE_MEMCOMPRESSOR
|
ONCHANGE_COMPMODE
|
ONCHANGE_COMPSTOP
|
ONCHANGE_COMPRESTART
,
P_BAYER
,
ONCHANGE_SENSORIN
,
// | ONCHANGE_COMPMODE , // ONCHANGE_COMPMODE added for NC393
P_BAYER
,
ONCHANGE_SENSORIN
,
// | ONCHANGE_COMPMODE , // ONCHANGE_COMPMODE added for NC393
P_CLK_FPGA
,
ONCHANGE_I2C
|
ONCHANGE_LIMITFPS
|
ONCHANGE_HIST
|
\
P_CLK_FPGA
,
ONCHANGE_I2C
|
ONCHANGE_LIMITFPS
|
ONCHANGE_HIST
|
\
ONCHANGE_MEMSENSOR
|
ONCHANGE_MEMCOMPRESSOR
|
ONCHANGE_COMPMODE
|
ONCHANGE_COMPSTOP
|
ONCHANGE_COMPRESTART
,
ONCHANGE_MEMSENSOR
|
ONCHANGE_MEMCOMPRESSOR
|
ONCHANGE_COMPMODE
|
ONCHANGE_COMPSTOP
|
ONCHANGE_COMPRESTART
,
...
...
src/drivers/elphel/pgm_functions.c
View file @
6405f029
This diff is collapsed.
Click to expand it.
src/drivers/elphel/pgm_functions.h
View file @
6405f029
...
@@ -62,7 +62,7 @@ unsigned long sensor_to_camsync(unsigned long pixel_time, unsigned long sensor_c
...
@@ -62,7 +62,7 @@ unsigned long sensor_to_camsync(unsigned long pixel_time, unsigned long sensor_c
* @param p parameter index (all high bits/attributes will be removed, only 12 LSBs preserved)
* @param p parameter index (all high bits/attributes will be removed, only 12 LSBs preserved)
* @param v parameter value(32 bits) */
* @param v parameter value(32 bits) */
#define SETFRAMEPARS_UPDATE_SET(p,v) { pars_to_update[nupdate ].num= (p) ; pars_to_update[nupdate++].val=thispars->pars[(p) & 0xffff]?thispars->pars[(p) & 0xffff]:(v);}
#define SETFRAMEPARS_UPDATE_SET(p,v) { pars_to_update[nupdate ].num= (p) ; pars_to_update[nupdate++].val=thispars->pars[(p) & 0xffff]?thispars->pars[(p) & 0xffff]:(v);}
/** Adds new parameter/value pair to the modification queue only if it is different from t
g
he current
/** Adds new parameter/value pair to the modification queue only if it is different from the current
* @param p parameter index (all high bits/attributes will be removed, only 12 LSBs preserved)
* @param p parameter index (all high bits/attributes will be removed, only 12 LSBs preserved)
* @param v parameter value(32 bits) */
* @param v parameter value(32 bits) */
#define SETFRAMEPARS_COND(p,v) { if (unlikely((v)!=thispars->pars[(p) & 0xffff])) { pars_to_update[nupdate ].num= (p) ; pars_to_update[nupdate++].val=(v);} }
#define SETFRAMEPARS_COND(p,v) { if (unlikely((v)!=thispars->pars[(p) & 0xffff])) { pars_to_update[nupdate ].num= (p) ; pars_to_update[nupdate++].val=(v);} }
...
@@ -99,6 +99,7 @@ extern struct sensor_port_config_t *pSensorPortConfig;
...
@@ -99,6 +99,7 @@ extern struct sensor_port_config_t *pSensorPortConfig;
* @param reg sensor register address (8-bit)
* @param reg sensor register address (8-bit)
* @param data value to set (16 bits)
* @param data value to set (16 bits)
*/
*/
// is _ADDR&0xffff0000 for Lepton?
#define SET_SENSOR_PAR_LUT(port,frame,reg,data) {\
#define SET_SENSOR_PAR_LUT(port,frame,reg,data) {\
int _I = pSensorPortConfig[(port)].broadcast_addr;\
int _I = pSensorPortConfig[(port)].broadcast_addr;\
int _ADDR = pSensorPortConfig[(port)].par2addr[_I][(reg)];\
int _ADDR = pSensorPortConfig[(port)].par2addr[_I][(reg)];\
...
...
src/drivers/elphel/quantization_tables.h
View file @
6405f029
/// @file quantization_tables.h
/// @file quantization_tables.h
#ifndef _QUANTIZATION_TABLES_H
#ifndef _QUANTIZATION_TABLES_H
#define _QUANTIZATION_TABLES_H
#define _QUANTIZATION_TABLES_H
#include <linux/platform_device.h>
/** @brief Quantization tables cache usage policy */
/** @brief Quantization tables cache usage policy */
enum
{
enum
{
// @brief Use common cache for all compressors
// @brief Use common cache for all compressors
...
...
src/drivers/elphel/sensor_common.h
View file @
6405f029
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
#define _SENSOR_COMMON_H
#define _SENSOR_COMMON_H
#include "detect_sensors.h"
#include "detect_sensors.h"
#include <linux/platform_device.h>
//extern struct sensor_t sensor; // current sensor (will be copied to by sensor driver), made external for the cc353.c to read/write i2c
//extern struct sensor_t sensor; // current sensor (will be copied to by sensor driver), made external for the cc353.c to read/write i2c
extern
struct
sensorproc_t
*
asensorproc
;
extern
struct
sensorproc_t
*
asensorproc
;
...
@@ -98,6 +99,7 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
...
@@ -98,6 +99,7 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
#define name_mt9p006 "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_mt9f002 "mt9f002" // Get name from DT (together with port mask)
#define name_lepton35 "lepton35" // Get name from DT (together with port mask)
#define name_lepton35 "lepton35" // Get name from DT (together with port mask)
#define name_boson640 "boson640" // 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)
#define I2C359_INC 2 ///< slave address increment between sensors in 10359A board (broadcast, 1,2,3) (7 bits SA)
...
@@ -115,15 +117,15 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
...
@@ -115,15 +117,15 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
write_xi2c_reg16_abs_asap((port),(sa7),(frame),(reg),(data));\
write_xi2c_reg16_abs_asap((port),(sa7),(frame),(reg),(data));\
}
}
/** Perform I2C write (8
bits address, 16 bits data in "legacy"
mode,
/** Perform I2C write (8
/16 bits address, 16 bits data in LUT
mode,
* pages matching
slave address
should be registered.
* pages matching
MSB(reg)
should be registered.
*
*
* TODO: Add registering single sensors as in multi10359. Registering twice is OK.
* TODO: Add registering single sensors as in multi10359. Registering twice is OK.
* Slave address is now 7-bit,old was 8-bit, change (10359 already done)
* Slave address is now 7-bit,old was 8-bit, change (10359 already done)
* @param port - sensor port
* @param port - sensor port
* @param frame Frame number to apply, <0 - ASAP
* @param frame Frame number to apply, <0 - ASAP
* @param si - slave device index (for mux board)
* @param si - slave device index (for mux board)
* @param reg sensor register address (16-bit)
* @param reg sensor register address (16-bit
, high byte uses tables
)
* @param data value to set (16 bits) */
* @param data value to set (16 bits) */
//int _ADDR = pSensorPortConfig[(port)].par2addr[si][(reg)];
//int _ADDR = pSensorPortConfig[(port)].par2addr[si][(reg)];
...
@@ -139,7 +141,7 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
...
@@ -139,7 +141,7 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
*
*
* Slave address is now 7-bit,old was 8-bit, change (10359 already done)
* Slave address is now 7-bit,old was 8-bit, change (10359 already done)
* @param port - sensor port
* @param port - sensor port
* @param sa7 I2C slave address, 7 bit
* @param sa7 I2C slave address, 7 bit
: NOT used
* @param reg sensor register address (8-bit)
* @param reg sensor register address (8-bit)
* @param data value to set (16 bits) */
* @param data value to set (16 bits) */
#define X3X3_I2C_SEND2_ASAP(port,sa7,reg,data) {\
#define X3X3_I2C_SEND2_ASAP(port,sa7,reg,data) {\
...
@@ -149,13 +151,13 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
...
@@ -149,13 +151,13 @@ long long get_frame_pos(unsigned int chn, unsigned int pos);
}
}
/** Perform I2C write in immediate mode (
8 bits address, 16 bits data in "legacy"
mode,
/** Perform I2C write in immediate mode (
16 bits address, 16 bits data in LUT
mode,
* pages matching
slav
e address should be registered.
* pages matching
MSB of th
e address should be registered.
*
*
* Slave address is now 7-bit,old was 8-bit, change (10359 already done)
* Slave address is now 7-bit,old was 8-bit, change (10359 already done)
* @param port - sensor port
* @param port - sensor port
* @param si - slave device index (for mux board)
* @param si - slave device index (for mux board
, otherwise 0
)
* @param reg sensor register address (
8
-bit)
* @param reg sensor register address (
16
-bit)
* @param data value to set (16 bits) */
* @param data value to set (16 bits) */
#define X3X3_I2C_SEND2_LUT_ASAP(port,si,reg,data) {\
#define X3X3_I2C_SEND2_LUT_ASAP(port,si,reg,data) {\
int _PAGE = pSensorPortConfig[(port)].haddr2rec[(si)][((reg)>>8)&0xff];\
int _PAGE = pSensorPortConfig[(port)].haddr2rec[(si)][((reg)>>8)&0xff];\
...
...
src/drivers/elphel/sensor_i2c.c
View file @
6405f029
...
@@ -392,7 +392,13 @@ void set_xi2c_wrc( x393_i2c_device_t * dc, ///< device class
...
@@ -392,7 +392,13 @@ void set_xi2c_wrc( x393_i2c_device_t * dc, ///< device class
tb_data
.
nbwr
=
dc
->
address_bytes
+
dc
->
data_bytes
;
tb_data
.
nbwr
=
dc
->
address_bytes
+
dc
->
data_bytes
;
tb_data
.
dly
=
get_bit_delay
(
dc
->
scl_khz
);
tb_data
.
dly
=
get_bit_delay
(
dc
->
scl_khz
);
tb_data
.
tbl_mode
=
2
;
tb_data
.
tbl_mode
=
2
;
dev_dbg
(
sdev
,
"device name %s : port= %d, page = 0x%x, rah = 0x%x
\n
"
,
dc
->
name
,
chn
,
page
,
rah
);
tb_data
.
extif_mode
=
0
;
if
(
tb_data
.
sa
&
0x80
){
// using external interface (currently Boson640 UART)
tb_data
.
extif_mode
=
tb_data
.
sa
&
3
;
tb_data
.
sa
=
(
tb_data
.
rah
>>
6
)
&
3
;
// number of bytes in uart command (later use (rah >> 8) after changing sensor_port_config_t.pages_ptr to 32 bits)
tb_data
.
rah
&=
0x3f
;
// later &= 0xff
}
dev_dbg
(
sdev
,
"device name %s : port= %d, page = 0x%x, rah = 0x%x, sa = 0x%x, extif_mode=0x%x
\n
"
,
dc
->
name
,
chn
,
page
,
tb_data
.
rah
,
tb_data
.
sa
,
tb_data
.
extif_mode
);
/* Table address and data should not interleave with others */
/* Table address and data should not interleave with others */
#ifdef LOCK_BH_SENSORI2C
#ifdef LOCK_BH_SENSORI2C
spin_lock_bh
(
sensori2c_locks
[
chn
]);
spin_lock_bh
(
sensori2c_locks
[
chn
]);
...
@@ -408,7 +414,7 @@ void set_xi2c_wrc( x393_i2c_device_t * dc, ///< device class
...
@@ -408,7 +414,7 @@ void set_xi2c_wrc( x393_i2c_device_t * dc, ///< device class
#endif
#endif
// i2c_pages_shadow[(chn << 8) + page] =tb_data.d32;
// i2c_pages_shadow[(chn << 8) + page] =tb_data.d32;
i2c_pages_shadow
[
chn
][
page
]
=
tb_data
.
d32
;
i2c_pages_shadow
[
chn
][
page
]
=
tb_data
.
d32
;
dev_dbg
(
sdev
,
"DONE: device name %s : port= %d, page = 0x%x, rah = 0x%x
\n
"
,
dc
->
name
,
chn
,
page
,
rah
);
dev_dbg
(
sdev
,
"DONE: device name %s : port= %d, page = 0x%x, rah = 0x%x
, sa = 0x%x, extif_mode=0x%x
\n
"
,
dc
->
name
,
chn
,
page
,
tb_data
.
rah
,
tb_data
.
sa
,
tb_data
.
extif_mode
);
}
}
EXPORT_SYMBOL_GPL
(
set_xi2c_wrc
);
EXPORT_SYMBOL_GPL
(
set_xi2c_wrc
);
/** Set i2c table entry for read operation using known devices
/** Set i2c table entry for read operation using known devices
...
@@ -716,6 +722,10 @@ void read_xi2c (x393_i2c_device_t * dc, ///< device class
...
@@ -716,6 +722,10 @@ void read_xi2c (x393_i2c_device_t * dc, ///< device class
int
page
,
///< Table index (8 bits)
int
page
,
///< Table index (8 bits)
int
addr
)
///< 8/16 bit register address
int
addr
)
///< 8/16 bit register address
{
{
if
((
dc
->
slave7
)
&
0x80
){
dev_warn
(
sdev
,
"Read not implemented for extif"
);
return
;
}
u32
dw
=
((
page
&
0xff
)
<<
24
)
|
(
dc
->
slave7
<<
17
)
|
(
addr
&
0xffff
);
u32
dw
=
((
page
&
0xff
)
<<
24
)
|
(
dc
->
slave7
<<
17
)
|
(
addr
&
0xffff
);
x393_sensi2c_rel
(
dw
,
chn
,
0
);
x393_sensi2c_rel
(
dw
,
chn
,
0
);
dev_dbg
(
sdev
,
"chn=%d, page = %d, addr = %d
\n
"
,
chn
,
page
,
addr
);
dev_dbg
(
sdev
,
"chn=%d, page = %d, addr = %d
\n
"
,
chn
,
page
,
addr
);
...
@@ -732,6 +742,10 @@ void read_xi2c_sa7 (int chn, ///< sensor port
...
@@ -732,6 +742,10 @@ void read_xi2c_sa7 (int chn, ///< sensor port
int
sa7
,
///< 7-bit i2c slave address
int
sa7
,
///< 7-bit i2c slave address
int
addr
)
///< 8/16 bit register address
int
addr
)
///< 8/16 bit register address
{
{
if
(
sa7
&
0x80
){
dev_warn
(
sdev
,
"Read not implemented for extif 2"
);
return
;
}
u32
dw
=
((
page
&
0xff
)
<<
24
)
|
(
sa7
<<
17
)
|
(
addr
&
0xffff
);
u32
dw
=
((
page
&
0xff
)
<<
24
)
|
(
sa7
<<
17
)
|
(
addr
&
0xffff
);
dev_dbg
(
sdev
,
"read_xi2c_sa7(%d,0x%x,0x%x,0x%x): 0x%08x
\n
"
,
chn
,
page
,
sa7
,
addr
,(
int
)
dw
);
dev_dbg
(
sdev
,
"read_xi2c_sa7(%d,0x%x,0x%x,0x%x): 0x%08x
\n
"
,
chn
,
page
,
sa7
,
addr
,(
int
)
dw
);
x393_sensi2c_rel
(
dw
,
chn
,
0
);
x393_sensi2c_rel
(
dw
,
chn
,
0
);
...
@@ -865,7 +879,8 @@ int x393_xi2c_read_reg( const char * cname, ///< device class name
...
@@ -865,7 +879,8 @@ int x393_xi2c_read_reg( const char * cname, ///< device class name
/* Initiate i2c read */
/* Initiate i2c read */
read_xi2c_sa7
(
chn
,
read_xi2c_sa7
(
chn
,
page
&
0xff
,
// page (8 bits)
page
&
0xff
,
// page (8 bits)
(
dc
->
slave7
+
sa7_offs
)
&
0x7f
,
// 7-bit i2c slave address
// (dc->slave7 + sa7_offs) & 0x7f, // 7-bit i2c slave address
(
dc
->
slave7
+
sa7_offs
)
&
0xff
,
// 7-bit i2c slave address -> 8 bit for extif
reg_addr
&
0xffff
);
// 8/16 bit address
reg_addr
&
0xffff
);
// 8/16 bit address
/* Now read required number of bytes with timeout */
/* Now read required number of bytes with timeout */
...
@@ -957,7 +972,8 @@ int legacy_read_i2c_reg( int chn, ///< sensor port number
...
@@ -957,7 +972,8 @@ int legacy_read_i2c_reg( int chn, ///< sensor port number
/* Initiate i2c read */
/* Initiate i2c read */
read_xi2c_sa7
(
chn
,
read_xi2c_sa7
(
chn
,
page
&
0xff
,
// page (8 bits)
page
&
0xff
,
// page (8 bits)
sa7
&
0x7f
,
// 7-bit i2c slave address
// sa7 & 0x7f, // 7-bit i2c slave address
sa7
&
0xff
,
// 7-bit i2c slave address -> 8 bits for extif
reg_addr
&
0xffff
);
// 8/16 bit address
reg_addr
&
0xffff
);
// 8/16 bit address
/* Now read required number of bytes with timeout */
/* Now read required number of bytes with timeout */
...
@@ -1106,7 +1122,7 @@ static ssize_t i2c_class_store(struct device *dev, ///< Linux kerne
...
@@ -1106,7 +1122,7 @@ static ssize_t i2c_class_store(struct device *dev, ///< Linux kerne
char
*
dname
;
char
*
dname
;
ni
=
sscanf
(
buf
,
"%31s %i %i %i %i"
,
name
,
&
sa7
,
&
num_addr
,
&
num_data
,
&
khz
);
ni
=
sscanf
(
buf
,
"%31s %i %i %i %i"
,
name
,
&
sa7
,
&
num_addr
,
&
num_data
,
&
khz
);
if
(
ni
<
5
)
{
if
(
ni
<
5
)
{
dev_err
(
dev
,
"Requires 5 parameters: name, slave addr (7 bit), address width (bytes), data width (bytes), max SCL frequency (kHz)
\n
"
);
dev_err
(
dev
,
"Requires 5 parameters: name, slave addr (7
/8
bit), address width (bytes), data width (bytes), max SCL frequency (kHz)
\n
"
);
return
-
EINVAL
;
return
-
EINVAL
;
}
}
dl
=
i2c_dev_get
(
name
);
dl
=
i2c_dev_get
(
name
);
...
@@ -1285,8 +1301,13 @@ static ssize_t get_i2c_tbl_human(struct device *dev, ///< Linux ker
...
@@ -1285,8 +1301,13 @@ static ssize_t get_i2c_tbl_human(struct device *dev, ///< Linux ker
return
sprintf
(
buf
,
"Read entry: chn=%d page=%d(0x%x) two_byte_addr=%d number bytes to read=%d bit_duration=%d
\n
"
,
return
sprintf
(
buf
,
"Read entry: chn=%d page=%d(0x%x) two_byte_addr=%d number bytes to read=%d bit_duration=%d
\n
"
,
chn
,
page
,
page
,
tb_data
.
nabrd
,
tb_data
.
nbrd
,
tb_data
.
dly
);
chn
,
page
,
page
,
tb_data
.
nabrd
,
tb_data
.
nbrd
,
tb_data
.
dly
);
}
else
{
}
else
{
return
sprintf
(
buf
,
"Write entry: chn=%d page=%d(0x%x) sa=0x%02x rah=0x%02x nbw=%d bit_duration=%d
\n
"
,
if
(
tb_data
.
extif_mode
)
{
chn
,
page
,
page
,
tb_data
.
sa
,
tb_data
.
rah
,
tb_data
.
nbwr
,
tb_data
.
dly
);
return
sprintf
(
buf
,
"Write entry: chn=%d page=%d(0x%x) extif=0x%x extif_byte_mode=%d rah=0x%02x nbw=%d bit_duration=%d
\n
"
,
chn
,
page
,
page
,
tb_data
.
extif_mode
,
tb_data
.
sa
,
(
tb_data
.
rah
&
0x3f
),
tb_data
.
nbwr
,
tb_data
.
dly
);
}
else
{
return
sprintf
(
buf
,
"Write entry: chn=%d page=%d(0x%x) sa=0x%02x rah=0x%02x nbw=%d bit_duration=%d
\n
"
,
chn
,
page
,
page
,
tb_data
.
sa
,
tb_data
.
rah
,
tb_data
.
nbwr
,
tb_data
.
dly
);
}
}
}
}
}
...
@@ -1320,7 +1341,8 @@ static ssize_t set_i2c_tbl_wr_human(struct device *dev, ///< Linux
...
@@ -1320,7 +1341,8 @@ static ssize_t set_i2c_tbl_wr_human(struct device *dev, ///< Linux
}
}
set_xi2c_wr
(
chn
,
set_xi2c_wr
(
chn
,
page
&
0xff
,
// index in lookup table
page
&
0xff
,
// index in lookup table
sa7
&
0x7f
,
// slave address (7 bit)
// sa7 & 0x7f, // slave address (7 bit)
sa7
&
0xff
,
// slave address (7 bit -> 8 bits for extif)
rah
&
0xff
,
// High byte of the i2c register address
rah
&
0xff
,
// High byte of the i2c register address
nbwr
&
0xf
,
// Number of bytes to write (1..10)
nbwr
&
0xf
,
// Number of bytes to write (1..10)
dly
&
0xff
);
// Bit delay - number of mclk periods in 1/4 of the SCL period
dly
&
0xff
);
// Bit delay - number of mclk periods in 1/4 of the SCL period
...
...
src/drivers/elphel/x393_videomem.c
View file @
6405f029
...
@@ -814,7 +814,7 @@ int membridge_start(int sensor_port, unsigned long target_frame){
...
@@ -814,7 +814,7 @@ int membridge_start(int sensor_port, unsigned long target_frame){
width_bursts
=
(
width_marg
>>
4
)
+
((
width_marg
&
0xf
)
?
1
:
0
);
width_bursts
=
(
width_marg
>>
4
)
+
((
width_marg
&
0xf
)
?
1
:
0
);
pr_debug
(
"VIDEOMEM: frame_num=%d width_marg=%d height_marg=%d width_burts=%d"
,
frame_num
,
width_marg
,
height_marg
,
width_bursts
);
pr_debug
(
"VIDEOMEM: frame_num=%
l
d width_marg=%d height_marg=%d width_burts=%d"
,
frame_num
,
width_marg
,
height_marg
,
width_bursts
);
setup_membridge_memory
(
sensor_port
,
///< sensor port number (0..3)
setup_membridge_memory
(
sensor_port
,
///< sensor port number (0..3)
0
,
///< 0 - from fpga mem to system mem, 1 - otherwise
0
,
///< 0 - from fpga mem to system mem, 1 - otherwise
...
@@ -1165,7 +1165,7 @@ static ssize_t show_frames_in_buffer(struct device *dev, struct device_attribute
...
@@ -1165,7 +1165,7 @@ static ssize_t show_frames_in_buffer(struct device *dev, struct device_attribute
static
ssize_t
get_membridge_status
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
static
ssize_t
get_membridge_status
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
{
{
x393_status_membridge_t
status
=
x393_membridge_status
();
x393_status_membridge_t
status
=
x393_membridge_status
();
return
sprintf
(
buf
,
"0x%08x
\n
"
,
status
);
return
sprintf
(
buf
,
"0x%08x
\n
"
,
status
.
d32
);
}
}
static
ssize_t
get_video_frame_num
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
static
ssize_t
get_video_frame_num
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
...
@@ -1194,7 +1194,7 @@ static ssize_t get_raw_frame_info(struct device *dev, struct device_attribute *a
...
@@ -1194,7 +1194,7 @@ static ssize_t get_raw_frame_info(struct device *dev, struct device_attribute *a
buf
+=
sprintf
(
buf
,
"width = %d
\n
"
,
raw_info
.
width
[
sensor_port
]);
buf
+=
sprintf
(
buf
,
"width = %d
\n
"
,
raw_info
.
width
[
sensor_port
]);
buf
+=
sprintf
(
buf
,
"height = %d
\n
"
,
raw_info
.
height
[
sensor_port
]);
buf
+=
sprintf
(
buf
,
"height = %d
\n
"
,
raw_info
.
height
[
sensor_port
]);
buf
+=
sprintf
(
buf
,
"bits per pixel = %d
\n
"
,
raw_info
.
bpp
[
sensor_port
]);
buf
+=
sprintf
(
buf
,
"bits per pixel = %d
\n
"
,
raw_info
.
bpp
[
sensor_port
]);
buf
+=
sprintf
(
buf
,
"buffer offset = 0x%08x
\n
"
,
raw_info
.
offset
[
sensor_port
]);
buf
+=
sprintf
(
buf
,
"buffer offset = 0x%08
ll
x
\n
"
,
raw_info
.
offset
[
sensor_port
]);
return
buf
-
buf0
;
return
buf
-
buf0
;
}
}
...
@@ -1212,13 +1212,13 @@ static ssize_t get_mctrl_status_chn(struct device *dev, struct device_attribute
...
@@ -1212,13 +1212,13 @@ static ssize_t get_mctrl_status_chn(struct device *dev, struct device_attribute
case
4
:
status
=
x393_mcntrl_chn4_status
();
break
;
case
4
:
status
=
x393_mcntrl_chn4_status
();
break
;
}
}
return
sprintf
(
buf
,
"0x%08x
\n
"
,
status
);
return
sprintf
(
buf
,
"0x%08x
\n
"
,
status
.
d32
);
}
}
static
ssize_t
get_cmprs_status
(
struct
device
*
dev
,
struct
device_attribute
*
attr
,
char
*
buf
)
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
));
x393_cmprs_status_t
status
=
x393_cmprs_status
(
get_channel_from_name
(
attr
));
return
sprintf
(
buf
,
"0x%08x
\n
"
,
status
);
return
sprintf
(
buf
,
"0x%08x
\n
"
,
status
.
d32
);
}
}
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
)
...
@@ -1250,8 +1250,7 @@ static ssize_t set_membridge_status_reg(struct device *dev, struct device_attrib
...
@@ -1250,8 +1250,7 @@ static ssize_t set_membridge_status_reg(struct device *dev, struct device_attrib
d
.
d32
=
in
;
d
.
d32
=
in
;
set_x393_membridge_status_cntrl
(
d
);
set_x393_membridge_status_cntrl
(
d
);
d
=
get_x393_membridge_status_cntrl
();
d
=
get_x393_membridge_status_cntrl
();
pr_info
(
"Set membridge status register to 0x%08x, status: 0x%08x
\n
"
,
in
,
d
);
pr_info
(
"Set membridge status register to 0x%08x, status: 0x%08x
\n
"
,
in
,
d
.
d32
);
return
count
;
return
count
;
}
}
...
...
src/include/uapi/elphel/c313a.h
View file @
6405f029
...
@@ -282,7 +282,7 @@
...
@@ -282,7 +282,7 @@
#define SENSORWIDTH_IBIS51300 1280 ///< FillFactory IBIS51300 width
#define SENSORWIDTH_IBIS51300 1280 ///< FillFactory IBIS51300 width
#define SENSORHEIGHT_IBIS51300 1024 ///< FillFactory IBIS51300 height
#define SENSORHEIGHT_IBIS51300 1024 ///< FillFactory IBIS51300 height
#define P_TRIG_MASTER 3 ///< Master channel for setting trigger para
,
eters
#define P_TRIG_MASTER 3 ///< Master channel for setting trigger para
m
eters
#define P_SENSOR_RUN 4 ///< Sensor acquisition mode 0 - stop, 1 - single, 2 - run
#define P_SENSOR_RUN 4 ///< Sensor acquisition mode 0 - stop, 1 - single, 2 - run
#define SENSOR_RUN_STOP 0 ///< Sensor acquisition mode: STOP
#define SENSOR_RUN_STOP 0 ///< Sensor acquisition mode: STOP
#define SENSOR_RUN_SINGLE 1 ///< Sensor acquisition mode: SINGLE FRAME
#define SENSOR_RUN_SINGLE 1 ///< Sensor acquisition mode: SINGLE FRAME
...
@@ -296,7 +296,8 @@
...
@@ -296,7 +296,8 @@
#define COMPRESSOR_RUN_RESET 3 ///< Compressor mode: RESET
#define COMPRESSOR_RUN_RESET 3 ///< Compressor mode: RESET
#define P_BAYER 6 ///< filter number at (0,0) 0-R, 1-G(R), 2-G(B), 3 - B. Write enabled at first, move to WindowSize later
#define P_BAYER 6 ///< filter number at (0,0) 0-R, 1-G(R), 2-G(B), 3 - B. Write enabled at first, move to WindowSize later
#define P_TRIGGERED 7 ///< when trigger occured - 4 LSBs - pixel in DMA word, higher bits - number of DMA word OBSOLETE
//#define P_TRIGGERED 7 ///< when trigger occurred - 4 LSBs - pixel in DMA word, higher bits - number of DMA word OBSOLETE
#define P_BOOTED 7 ///< sensor is fully booted (for Boson640) and ready to accept commands
#define P_PERIOD 8 ///< Frame period in pixel clocks (read only)
#define P_PERIOD 8 ///< Frame period in pixel clocks (read only)
#define P_FP1000SLIM 9 ///< FPS limit, frames per 1000 sec
#define P_FP1000SLIM 9 ///< FPS limit, frames per 1000 sec
#define P_FPSFLAGS 10 //v FPS limit mode - bit 0 - limit fps (not higher than), bit 1 - maintain fps (not lower than)
#define P_FPSFLAGS 10 //v FPS limit mode - bit 0 - limit fps (not higher than), bit 1 - maintain fps (not lower than)
...
@@ -1115,6 +1116,7 @@ struct p_names_t {
...
@@ -1115,6 +1116,7 @@ struct p_names_t {
P_NAME_ENTRY(ACTUAL_WIDTH), \
P_NAME_ENTRY(ACTUAL_WIDTH), \
P_NAME_ENTRY(ACTUAL_HEIGHT), \
P_NAME_ENTRY(ACTUAL_HEIGHT), \
P_NAME_ENTRY(BAYER), \
P_NAME_ENTRY(BAYER), \
P_NAME_ENTRY(BOOTED), \
P_NAME_ENTRY(PERIOD), \
P_NAME_ENTRY(PERIOD), \
P_NAME_ENTRY(FP1000SLIM), \
P_NAME_ENTRY(FP1000SLIM), \
P_NAME_ENTRY(FRAME), \
P_NAME_ENTRY(FRAME), \
...
@@ -1736,9 +1738,10 @@ struct __attribute__((__packed__)) sensor_t {
...
@@ -1736,9 +1738,10 @@ struct __attribute__((__packed__)) sensor_t {
#define SENSOR_NEED_RESET_PHASE 2
#define SENSOR_NEED_RESET_PHASE 2
typedef
enum
FPGA_INTERFACES
{
typedef
enum
FPGA_INTERFACES
{
FPGA_PAR12
=
0
,
FPGA_PAR12
=
0
,
FPGA_HISPI
=
1
,
FPGA_HISPI
=
1
,
FPGA_VOSPI
=
2
FPGA_VOSPI
=
2
,
FPGA_BOSON640
=
3
}
fpga_interfaces_t
;
}
fpga_interfaces_t
;
...
...
src/include/uapi/elphel/x393_devices.h
View file @
6405f029
...
@@ -126,6 +126,7 @@
...
@@ -126,6 +126,7 @@
#define DEV393_MT9X001 ("", "elphel393-mt9x001", -1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
#define DEV393_MT9X001 ("", "elphel393-mt9x001", -1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
#define DEV393_MT9F002 ("", "elphel393-mt9f002", -1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
#define DEV393_MT9F002 ("", "elphel393-mt9f002", -1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
#define DEV393_LEPTON ("", "elphel393-lepton", -1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
#define DEV393_LEPTON ("", "elphel393-lepton", -1, -1, "0666", "c") ///< Used only in sysfs, no character device (yet?)
#define DEV393_BOSON640 ("", "elphel393-boson640", -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_KLOGGER ("klogger_393", "klogger_393",144, 1, "0666", "c") ///< kernel event logger to memory (no i/o)
#define _DEV393_DEVNAME(n, ...) n
#define _DEV393_DEVNAME(n, ...) n
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment