Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
ce5d3e2e
Commit
ce5d3e2e
authored
Nov 07, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speeded up EEPROM read on 10389 (system i2c bus), hard-wired path for autocampars.xml
parent
4e7b7b63
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
5 deletions
+20
-5
i2c.php
src/php_top/i2c.php
+3
-0
i2c_include.php
src/php_top/i2c_include.php
+13
-4
parsedit.php
src/php_top/parsedit.php
+4
-1
No files found.
src/php_top/i2c.php
View file @
ce5d3e2e
...
@@ -234,6 +234,9 @@ switch ($cmd) {
...
@@ -234,6 +234,9 @@ switch ($cmd) {
case
"fromEEPROM"
:
case
"fromEEPROM"
:
if
((
$EEPROM_bus0
==
4
)
||
(
$EEPROM_bus0
==
5
))
{
// using FPGA PIO bus (bus=1 in NC353) for IMU, GPS and such, bus = 5 - 10389 eeprom
if
((
$EEPROM_bus0
==
4
)
||
(
$EEPROM_bus0
==
5
))
{
// using FPGA PIO bus (bus=1 in NC353) for IMU, GPS and such, bus = 5 - 10389 eeprom
$rslt
=
i2c_read256b
(
0xa0
+
(
$EEPROM_chn
*
2
),
$EEPROM_bus0
);
$rslt
=
i2c_read256b
(
0xa0
+
(
$EEPROM_chn
*
2
),
$EEPROM_bus0
);
if
(
!
is_string
(
$rslt
)){
break
;
// will report error
}
$zero
=
strpos
(
$rslt
,
chr
(
0
));
$zero
=
strpos
(
$rslt
,
chr
(
0
));
if
(
$zero
!==
false
)
$rslt
=
substr
(
$rslt
,
0
,
$zero
);
if
(
$zero
!==
false
)
$rslt
=
substr
(
$rslt
,
0
,
$zero
);
if
(
substr
(
$rslt
,
0
,
5
)
==
"<?xml"
)
{
if
(
substr
(
$rslt
,
0
,
5
)
==
"<?xml"
)
{
...
...
src/php_top/i2c_include.php
View file @
ce5d3e2e
...
@@ -418,15 +418,24 @@ function i2c_read256b($slave = 0xa0, $bus = 4, $extrausec = 0) { // will read 25
...
@@ -418,15 +418,24 @@ function i2c_read256b($slave = 0xa0, $bus = 4, $extrausec = 0) { // will read 25
}
}
if
(
$bus
==
2
)
{
// System i2c in nc393 (was 5)
if
(
$bus
==
2
)
{
// System i2c in nc393 (was 5)
$sa7
=
$slave
>>
1
;
$sa7
=
$slave
>>
1
;
for
(
$i
=
0
;
$i
<
256
;
$i
++
)
/* // very slow
for($i = 0; $i < 256; $i ++) {
exec ( 'i2cget -y 0 ' . $sa7 . ' ' . $i . ' b', $i2c_data, $return );
exec ( 'i2cget -y 0 ' . $sa7 . ' ' . $i . ' b', $i2c_data, $return );
if
(
$return
!=
0
)
if ($return != 0)
return
-
1
;
return - 1;
}
$data == "";
$data == "";
foreach ($i2c_data as $c) $data.=chr($c);
foreach ($i2c_data as $c) $data.=chr($c);
*/
exec
(
'i2cdump -y 0 '
.
$sa7
.
' b'
,
$i2c_data
,
$return
);
if
(
$return
!=
0
)
return
-
1
;
// Extract data from dump table
$line
=
""
;
for
(
$j
=
0
;
$j
<
16
;
$j
++
)
$line
.=
substr
(
$i2c_data
[
$j
+
1
],
4
,
48
);
$data
==
""
;
foreach
(
explode
(
' '
,
$line
)
as
$e
)
$data
.=
chr
(
intval
(
$e
,
16
));
return
$data
;
return
$data
;
}
}
$i2c_fn
=
'/dev/xi2c8'
.
((
$bus
==
0
)
?
''
:
'_aux'
);
$i2c_fn
=
'/dev/xi2c8'
.
((
$bus
==
0
)
?
''
:
'_aux'
);
$i2c
=
fopen
(
$i2c_fn
,
'r'
);
$i2c
=
fopen
(
$i2c_fn
,
'r'
);
fseek
(
$i2c
,
$slave
*
128
);
// 256 per slave, but slave are only even
fseek
(
$i2c
,
$slave
*
128
);
// 256 per slave, but slave are only even
...
...
src/php_top/parsedit.php
View file @
ce5d3e2e
...
@@ -1468,15 +1468,18 @@ function getDescription ($compositeName,$descriptions){
...
@@ -1468,15 +1468,18 @@ function getDescription ($compositeName,$descriptions){
*/
*/
function
getParDescriptions
(
$autocampars
)
{
function
getParDescriptions
(
$autocampars
)
{
/*
$file=file($autocampars);
$file=file($autocampars);
$path="";
$path="";
foreach
(
$file
as
$line
)
if
(
strpos
(
$line
,
'$configPath'
)
!==
false
){
foreach ($file as $line) if (
(strpos($line,'$configPath')!==false ) || ((strpos($line,"'configPath'")!==false)
){
$name= strtok ($line,'"');
$name= strtok ($line,'"');
if (strpos ($name,'//')===false) {
if (strpos ($name,'//')===false) {
$path=strtok ('"');
$path=strtok ('"');
break;
break;
}
}
}
}
*/
$path
=
'/etc/elphel393/autocampars0.xml'
;
$path
=
str_replace
(
"0."
,
strval
(
$GLOBALS
[
sensor_port
])
.
"."
,
$path
);
// NC393: here it does not really matter
$path
=
str_replace
(
"0."
,
strval
(
$GLOBALS
[
sensor_port
])
.
"."
,
$path
);
// NC393: here it does not really matter
$xml
=
simplexml_load_file
(
$path
);
$xml
=
simplexml_load_file
(
$path
);
$descriptions
=
array
();
$descriptions
=
array
();
...
...
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