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
1b50e748
Commit
1b50e748
authored
May 21, 2020
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finalized board detection, SENSPGM state checking moved to common part
parent
ac730409
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
29 deletions
+43
-29
lepton.c
src/drivers/elphel/lepton.c
+7
-4
pgm_functions.c
src/drivers/elphel/pgm_functions.c
+36
-25
No files found.
src/drivers/elphel/lepton.c
View file @
1b50e748
...
...
@@ -465,7 +465,7 @@ int lepton_pgm_detectsensor (int sensor_port, ///< sensor port n
// int i2c_data,i2c_rslt;
struct
sensor_t
*
psensor
;
// current sensor
// x393_sensio_ctl_t sensio_ctl = {.d32=0};
x393_status_sens_io_t
status
;
// check board exists
//
x393_status_sens_io_t status; // check board exists
// unsigned short * sensor_multi_regs;
// temporary
...
...
@@ -538,14 +538,17 @@ int lepton_pgm_detectsensor (int sensor_port, ///< sensor port n
return 0; // no sensor found
}
#else
//assume Lepton sesnors if there is some sesnor board attached
// this check is moved to pgm_functions.c, see check_senspgmin_state()
/*
//assume Lepton sensors if there is some sensor board attached
status = x393_sensio_status(sensor_port);
if (!status.senspgmin){
dev_info
(
g_dev_ptr
,
"Some sensor board is attached to port %d, assumi
m
g Lepton 3.5 as FPGA is programmed for it
\n
"
,
sensor_port
);
dev_info(g_dev_ptr,"Some sensor board is attached to port %d, assumi
n
g Lepton 3.5 as FPGA is programmed for it\n",sensor_port);
} else {
dev_info
(
g_dev_ptr
,
"No se
sn
or board is attached to port %d
\n
"
,
sensor_port
);
dev_info(g_dev_ptr,"No se
ns
or board is attached to port %d\n",sensor_port);
return 0; // no sensor found
}
*/
#endif
// Sensor recognized, go on
...
...
src/drivers/elphel/pgm_functions.c
View file @
1b50e748
...
...
@@ -356,6 +356,37 @@ int add_sensor_proc(int port, ///< sensor port
return
0
;
}
/** Check SENSPGM pin state to determine board type connected to
* the sensor_port.
* '1' (pulled up) - nothing or mux board
* '0' (grounded) - some kind of sensor board
* @param sensor_port
* @return pin state
*/
inline
int
check_senspgmin_state
(
int
sensor_port
){
// Need to check a certain pin state, which is
// senspgmin (bit 24 of x393_status_sens_io_t)
// senspgmin = 0 - some sensor board is attached to port
// senspgmin = 1 - mux board or nothing
x393_status_ctrl_t
status_ctrl
=
{.
d32
=
0
};
x393_status_sens_io_t
status
;
int
i
;
// check senspgmin (bit 24 of x393_status_sens_io_t)
status
=
x393_sensio_status
(
sensor_port
);
status_ctrl
.
seq_num
=
status
.
seq_num
+
1
;
status_ctrl
.
mode
=
1
;
set_x393_sensio_status_cntrl
(
status_ctrl
,
sensor_port
);
for
(
i
=
0
;
i
<
10
;
i
++
){
status
=
x393_sensio_status
(
sensor_port
);
if
(
status
.
seq_num
==
status_ctrl
.
seq_num
){
break
;
}
}
return
status
.
senspgmin
;
}
/** Detect and initialize sensor and related data structures
* - detect sensor type
* - set sensor structure (capabilities),
...
...
@@ -373,15 +404,7 @@ int pgm_detectsensor (int sensor_port, ///< sensor port number (
x393_camsync_io_t
camsync_src
=
{.
d32
=
0x00000
};
// all disabled (use internal)
x393_camsync_io_t
camsync_dst
=
{.
d32
=
0x00000
};
// all disable - nothing to output
// Need to check a certain pin state, which is
// senspgmin (bit 24 of x393_status_sens_io_t)
// senspgmin = 0 - some sensor board is attached to port
// senspgmin = 1 - mux board or nothing
x393_status_ctrl_t
status_ctrl
=
{.
d32
=
0
};
x393_status_sens_io_t
status
;
int
i
;
// Setting trigger input, output and preriod to off
// Setting trigger input, output and period to off
int
was_sensor_freq
=
0
;
// 90000000; // getClockFreq(1);
int
qperiod
;
...
...
@@ -484,23 +507,11 @@ int pgm_detectsensor (int sensor_port, ///< sensor port number (
}
else
{
dev_dbg
(
g_dev_ptr
,
"Mux mode for port %d SENSOR_NONE, skipping 10359 detection
\n
"
,
sensor_port
);
MDP
(
DBGB_PADD
,
sensor_port
,
"Mux mode for port %d SENSOR_NONE, skipping 10359 detection
\n
"
,
sensor_port
)
}
// check senspgmin (bit 24 of x393_status_sens_io_t)
status
=
x393_sensio_status
(
sensor_port
);
status_ctrl
.
seq_num
=
status
.
seq_num
+
1
;
status_ctrl
.
mode
=
1
;
set_x393_sensio_status_cntrl
(
status_ctrl
,
sensor_port
);
for
(
i
=
0
;
i
<
10
;
i
++
){
status
=
x393_sensio_status
(
sensor_port
);
if
(
status
.
seq_num
==
status_ctrl
.
seq_num
){
break
;
}
}
// '1' - means empty port (pull up) or mux board
if
(
status
.
senspgmin
==
1
){
dev_info
(
g_dev_ptr
,
"No sensors connected to port %d
\n
"
,
sensor_port
);
return
0
;
if
(
check_senspgmin_state
()
==
1
){
dev_info
(
g_dev_ptr
,
"No sensors connected to port %d
\n
"
,
sensor_port
);
return
0
;
}
}
//if ((thispars->pars[P_SENSOR]==0) || // multisensor not detected
...
...
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