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
8861af0a
Commit
8861af0a
authored
Sep 26, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
debugging for 10359 multiplexer
parent
1728e6c0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
383 additions
and
253 deletions
+383
-253
Makefile
src/php_top/Makefile
+2
-1
framepars.php
src/php_top/framepars.php
+23
-5
i2c.php
src/php_top/i2c.php
+355
-245
parsedit.php
src/php_top/parsedit.php
+3
-2
No files found.
src/php_top/Makefile
View file @
8861af0a
...
@@ -9,7 +9,8 @@ CONFS= autocampars.xml
...
@@ -9,7 +9,8 @@ CONFS= autocampars.xml
SYSCONFDIR
=
/etc
SYSCONFDIR
=
/etc
CONFDIR
=
$(SYSCONFDIR)
/elphel393
CONFDIR
=
$(SYSCONFDIR)
/elphel393
PHP_SCRIPTS
=
camvars.php
\
PHP_SCRIPTS
=
i2c.php
\
camvars.php
\
ccam.php
\
ccam.php
\
diag_utils.php
\
diag_utils.php
\
framepars.php
\
framepars.php
\
...
...
src/php_top/framepars.php
View file @
8861af0a
...
@@ -450,14 +450,32 @@ CAPTION;
...
@@ -450,14 +450,32 @@ CAPTION;
elphel_set_P_value
(
$sensor_port
,
ELPHEL_VIGNET_C
,
0x8000
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_VIGNET_C
,
0x8000
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_VIGNET_SHL
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_VIGNET_SHL
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_SENSOR_RUN
,
2
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_SENSOR_RUN
,
2
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_COMPRESSOR_RUN
,
2
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
// / run compressor
// elphel_set_P_value ( $sensor_port, ELPHEL_COMPRESSOR_RUN, 2, $frame + 4, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // / run compressor
elphel_set_P_value
(
$sensor_port
,
ELPHEL_DCM_HOR
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_DCM_VERT
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_BIN_HOR
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_BIN_VERT
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
elphel_set_P_value
(
$sensor_port
,
ELPHEL_DCM_HOR
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
// / run compressor
// elphel_set_P_value ( $sensor_port, ELPHEL_COMPRESSOR_RUN, 2, $frame + 5
, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // / run compressor
elphel_set_P_value
(
$sensor_port
,
ELPHEL_DCM_VERT
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
// / run compressor
// elphel_set_P_value ( $sensor_port, ELPHEL_COMPRESSOR_RUN, 2, $frame + 8
, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // / run compressor
elphel_set_P_value
(
$sensor_port
,
ELPHEL_
BIN_HOR
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
// / run compressor
elphel_set_P_value
(
$sensor_port
,
ELPHEL_
COMPRESSOR_RUN
,
2
,
$frame
+
9
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
// / run compressor
elphel_set_P_value
(
$sensor_port
,
ELPHEL_BIN_VERT
,
1
,
$frame
+
4
,
ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC
);
// / run compressor
// elphel_set_P_value ( $sensor_port, ELPHEL_COMPRESSOR_RUN, 2, $frame + 13
, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // / run compressor
// Turn external trigger at 4fps
/*
elphel_set_P_value ( $sensor_port, ELPHEL_TRIG_PERIOD, 25000000, $frame + 4, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); //0.25 s
elphel_set_P_value ( $sensor_port, ELPHEL_TRIG_BITLENGTH, 31, $frame + 4, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); //0.32 usec
elphel_set_P_value ( $sensor_port, ELPHEL_TRIG_DELAY, 0, $frame + 4, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // no delay
elphel_set_P_value ( $sensor_port, ELPHEL_EXTERN_TIMESTAMP, 1, $frame + 4, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // use external timestamp when available
elphel_set_P_value ( $sensor_port, ELPHEL_XMIT_TIMESTAMP, 1, $frame + 4, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // transmit timestamps, not just pulse
elphel_set_P_value ( $sensor_port, ELPHEL_TRIG_OUT, 0x65555, $frame + 4, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // 0x56555 - ext connector, 0x65555 - internal connector 0x66555 - both, 0x55555 - none
/// change to "internal" (0x8000) when wired
elphel_set_P_value ( $sensor_port, ELPHEL_TRIG_CONDITION, 0, $frame + 4, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // 0x0 - from FPGA, 0x80000 - ext, 0x8000 - int, 0x88000 - any, 0x95555 - add ext, 0x59999 - add int
// elphel_set_P_value ( $sensor_port, ELPHEL_TRIG, 0x4, $frame + 6, ELPHEL_CONST_FRAMEPAIR_FORCE_NEWPROC ); // 0 - free running, 4 - extrnal ERS, 5 - external GRR
*/
$xml
->
addChild
(
'frame_after'
.
strval
(
$sensor_port
),
elphel_get_frame
(
$sensor_port
));
$xml
->
addChild
(
'frame_after'
.
strval
(
$sensor_port
),
elphel_get_frame
(
$sensor_port
));
fclose
(
$framepars_file
);
fclose
(
$framepars_file
);
$gamma
=
57
;
$gamma
=
57
;
$black
=
10
;
$black
=
10
;
...
...
src/php_top/i2c.php
View file @
8861af0a
...
@@ -70,255 +70,365 @@
...
@@ -70,255 +70,365 @@
*!
*!
*/
*/
// In NC393: buses 0..3 - sensors(old bus=0), 4 - aux (old bus=1)
// In NC393: buses 0..3 - sensors(old bus=0), 4 - aux (old bus=1)
, 5 - system i2c (TODO)
set_include_path
(
get_include_path
()
.
PATH_SEPARATOR
.
'/www/pages/include'
);
set_include_path
(
get_include_path
()
.
PATH_SEPARATOR
.
'/www/pages/include'
);
require
'i2c_include.php'
;
require
'i2c_include.php'
;
$width
=
0
;
$width
=
0
;
$bus
=
0
;
$bus
=
0
;
$adr
=-
1
;
$adr
=
-
1
;
$data
=
""
;
$class
=
""
;
$nopars
=
false
;
$sa7offs
=
0
;
$raw
=
0
;
$data
=
""
;
$wprot
=-
1
;
$nopars
=
false
;
$rprot
=-
1
;
$raw
=
0
;
$rslt
=
""
;
$wprot
=
-
1
;
$cmd
=
""
;
$rprot
=
-
1
;
$rslt
=
""
;
$cmd
=
""
;
//
//
$model
=
""
;
$model
=
""
;
$rev
=
""
;
$rev
=
""
;
$brand
=
"Elphel"
;
$brand
=
"Elphel"
;
$serial
=
""
;
$serial
=
""
;
$time
=
""
;
$time
=
""
;
$port
=
""
;
$port
=
""
;
$part
=
""
;
$part
=
""
;
$baud
=
""
;
$baud
=
""
;
$sync
=
""
;
$sync
=
""
;
$slowbus0
=-
1
;
// extra microseconds for SCL low and SCL high
$slowbus0
=
-
1
;
// extra microseconds for SCL low and SCL high
$EEPROM_bus0
=
false
;
$EEPROM_bus0
=
-
1
;
$EEPROM_chn
=
0
;
/// 0 - 10359/single 10338D, 1..3 - 10338D attached to the 10359
$EEPROM_chn
=
0
;
// / 0 - 10359/single 10338D, 1..3 - 10338D attached to the 10359
$application
=
''
;
$application
=
''
;
$applicationMode
=
''
;
$applicationMode
=
''
;
$sensor
=
''
;
$sensor
=
''
;
$temperatureSA
=
0x30
;
$temperatureSA
=
0x30
;
$temperarureDelay
=
1.0
;
// extra microseconds for SCL low/high (nominal 4, but works with 1)
$temperarureDelay
=
1.0
;
// extra microseconds for SCL low/high (nominal 4, but works with 1)
$msg
=
"<?xml version=
\"
1.0
\"
?>
\n
<i2c>
\n
"
;
$msg
=
"<?xml version=
\"
1.0
\"
?>
\n
<i2c>
\n
"
;
if
(
count
(
$_GET
)
==
0
)
{
if
(
count
(
$_GET
)
==
0
)
{
$nopars
=
true
;
$nopars
=
true
;
}
else
{
}
else
{
$pars
=
array
();
$pars
=
array
();
foreach
(
$_GET
as
$key
=>
$value
)
{
foreach
(
$_GET
as
$key
=>
$value
)
{
switch
(
$key
)
{
switch
(
$key
)
{
case
"slow"
:
case
"slow"
:
case
"slowbus0"
:
case
"slowbus0"
:
$slowbus0
=
$value
+
0
;
$slowbus0
=
$value
+
0
;
break
;
break
;
case
"cmd"
:
case
"cmd"
:
switch
(
$value
)
{
switch
(
$value
)
{
case
"fromCMOS"
:
case
"fromCMOS"
:
$rslt
=
i2c_getCMOSClock
()
?
"Set system time error (probably CMOS clock is not set)"
:
(
"System clock is set to "
.
exec
(
"date"
));
// TODO: NC393: implement
break
;
// $rslt=i2c_getCMOSClock()?"Set system time error (probably CMOS clock is not set)":("System clock is set to ".exec("date"));
case
"toCMOS"
:
break
;
$rslt
=
i2c_setCMOSClock
();
case
"toCMOS"
:
break
;
$rslt
=
i2c_setCMOSClock
();
case
"fromEEPROM"
:
break
;
case
"toEEPROM"
:
case
"fromEEPROM"
:
case
"fromEEPROM0"
:
case
"toEEPROM"
:
case
"toEEPROM0"
:
case
"fromEEPROM0"
:
case
"ctl"
:
case
"toEEPROM0"
:
$cmd
=
$value
;
case
"fromEEPROM1"
:
case
"toEEPROM1"
:
case
"fromEEPROM2"
:
case
"toEEPROM2"
:
case
"fromEEPROM3"
:
case
"toEEPROM3"
:
case
"ctl"
:
$cmd
=
$value
;
break
;
break
;
}
}
break
;
break
;
case
"EEPROM_chn"
:
case
"EEPROM_chn"
:
$EEPROM_chn
=
$value
;
$EEPROM_chn
=
$value
;
break
;
break
;
case
"app"
:
case
"app"
:
case
"application"
:
case
"application"
:
$application
=
$value
;
$application
=
$value
;
break
;
break
;
case
"mode"
:
case
"mode"
:
case
"application_mode"
:
case
"application_mode"
:
$application_mode
=
$value
;
$application_mode
=
$value
;
break
;
break
;
case
"sensor"
:
case
"sensor"
:
$sensor
=
$value
;
$sensor
=
$value
;
break
;
break
;
case
"port"
:
case
"port"
:
$port
=
$value
;
$port
=
$value
;
break
;
break
;
case
"part"
:
case
"part"
:
$part
=
$value
;
$part
=
$value
;
break
;
break
;
case
"baud"
:
case
"baud"
:
$baud
=
$value
;
$baud
=
$value
;
break
;
break
;
case
"sync"
:
case
"sync"
:
$sync
=
$value
;
$sync
=
$value
;
break
;
break
;
case
"model"
:
case
"model"
:
$model
=
$value
;
$model
=
$value
;
break
;
break
;
case
"rev"
:
case
"rev"
:
$rev
=
$value
;
$rev
=
$value
;
break
;
break
;
case
"serial"
:
case
"serial"
:
$serial
=
$value
;
$serial
=
$value
;
break
;
break
;
case
"time"
:
// seconds from 1970
case
"time"
:
// seconds from 1970
$time
=
$value
+
0
;
$time
=
$value
+
0
;
break
;
break
;
case
"raw"
:
case
"raw"
:
$adr
=
(
$value
+
0
)
&
~
0x7f
;
$adr
=
(
$value
+
0
)
&
~
0x7f
;
$raw
=
1
;
$raw
=
1
;
$width
=
8
;
$width
=
8
;
break
;
break
;
case
"width"
:
case
"width"
:
$width
=
$value
+
0
;
$width
=
$value
+
0
;
break
;
break
;
case
"bus"
:
case
"bus"
:
$bus
=
$value
+
0
;
$bus
=
$value
+
0
;
break
;
break
;
case
"adr"
:
case
"adr"
:
$adr
=
$value
+
0
;
$adr
=
$value
+
0
;
break
;
break
;
case
"wp"
:
case
"wp"
:
if
(
$value
==
0
)
$wprot
=
0
;
if
(
$value
==
0
)
else
if
(
$value
==
1
)
$wprot
=
1
;
$wprot
=
0
;
else
if
(
$value
==
1
)
$wprot
=
1
;
break
;
break
;
case
"rp"
:
case
"rp"
:
if
(
$value
==
0
)
$rprot
=
0
;
if
(
$value
==
0
)
else
if
(
$value
==
1
)
$rprot
=
1
;
$rprot
=
0
;
else
if
(
$value
==
1
)
$rprot
=
1
;
break
;
break
;
case
"data"
:
case
"data"
:
$data
=
$value
;
$data
=
$value
;
break
;
break
;
case
"length"
:
case
"length"
:
$length
=
$value
+
0
;
$length
=
$value
+
0
;
break
;
case
"class"
:
$class
=
$value
;
break
;
case
"sa7offs"
:
$sa7offs
=
$value
+
0
;
break
;
break
;
}
}
}
}
}
switch
(
$cmd
)
{
case
"fromEEPROM0"
:
case
"fromEEPROM1"
:
case
"fromEEPROM2"
:
case
"fromEEPROM3"
:
$EEPROM_bus0
=
intval
(
substr
(
$cmd
,
10
)
);
// and fall below
case
"fromEEPROM"
:
if
((
$EEPROM_bus0
<
0
)
||
(
$EEPROM_bus0
>
3
))
{
// Not supported in NC393 - TODO: implement with bus=5 for 10389 board serial number
break
;
}
if
((
$EEPROM_chn
<
0
)
||
(
$EEPROM_chn
>
4
))
{
// Not supported in NC393
break
;
}
}
switch
(
$cmd
)
{
// print(i2c_read256b_sensor('sensor_eeprom',3,0));
case
"fromEEPROM0"
:
// $rslt=i2c_read256b(0xa0+($EEPROM_chn*($EEPROM_bus0?4:2)), $EEPROM_bus0?0:1);
$EEPROM_bus0
=
true
;
// and fall below
$rslt
=
i2c_read256b
(
'sensor_eeprom'
,
$EEPROM_bus0
,
2
*
$EEPROM_chn
);
case
"fromEEPROM"
:
$zero
=
strpos
(
$rslt
,
chr
(
0
)
);
$rslt
=
i2c_read256b
(
0xa0
+
(
$EEPROM_chn
*
(
$EEPROM_bus0
?
4
:
2
)),
$EEPROM_bus0
?
0
:
1
);
if
(
$zero
!==
false
)
$zero
=
strpos
(
$rslt
,
chr
(
0
));
$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"
)
{
$xml
=
simplexml_load_string
(
$rslt
);
$xml
=
simplexml_load_string
(
$rslt
);
// $temperatureSA=0x30;
// $temperatureSA=0x30;
// $temperarureDelay=1.0; // extra microseconds for SCL low/high (nominal 4, but works with 1)
// $temperarureDelay=1.0; // extra microseconds for SCL low/high (nominal 4, but works with 1)
// try reading sensor temperature (if available)
// try reading sensor temperature (if available)
if
(
$EEPROM_bus0
>=
0
)
{
if
(
$EEPROM_bus0
)
{
$data
=
i2c_receive_sensor
(
'sensor_temp'
,
$EEPROM_bus0
,
5
,
2
*
$EEPROM_chn
);
$bus
=
0
;
$bus
=
0
;
$sa
=
$temperatureSA
+
(
$EEPROM_chn
*
(
$EEPROM_bus0
?
4
:
2
));
// $sa=$temperatureSA+($EEPROM_chn*($EEPROM_bus0?4:2));
$data
=
i2c_receive_slow
(
16
,
$bus
,
$sa
*
128
+
5
,
0
,
$temperarureDelay
);
// $data=i2c_receive_slow(16,$bus,$sa*128+5,0,$temperarureDelay);
if
(
$data
>=
0
)
{
// <0 - i2c error - not implemented
if
((
$data
>=
0
)
&&
(
$data
!=
0xffff
))
{
// <0 - i2c error - not implemented
$data
=
((
$data
&
0x1000
)
?-
1
:
1
)
*
(
$data
&
0xfff
)
/
16.0
;
$data
=
((
$data
&
0x1000
)
?
-
1
:
1
)
*
(
$data
&
0xfff
)
/
16.0
;
$xml
->
addChild
(
'sensorTemperature'
,
$data
);
$xml
->
addChild
(
'sensorTemperature'
,
$data
);
i2c_send_slow
(
8
,
$bus
,
$sa
*
128
+
8
,
3
,
0
,
$temperarureDelay
);
// set slow conversion, 1/16C resolution - for the next time
// i2c_send_slow(8,$bus,$sa*128+8,3,0,$temperarureDelay); // set slow conversion, 1/16C resolution - for the next time
i2c_send_sensor
(
'sensor_temp'
,
$EEPROM_bus0
,
8
,
3
,
2
*
$EEPROM_chn
);
}
}
}
}
$xml_string
=
$xml
->
asXML
();
$xml_string
=
$xml
->
asXML
();
header
(
"Content-Type: text/xml"
);
header
(
"Content-Type: text/xml"
);
header
(
"Content-Length: "
.
strlen
(
$xml_string
)
.
"
\n
"
);
header
(
"Content-Length: "
.
strlen
(
$xml_string
)
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
printf
(
$xml_string
);
printf
(
$xml_string
);
exit
(
0
);
exit
(
0
);
}
break
;
case
"toEEPROM0"
:
case
"toEEPROM1"
:
case
"toEEPROM2"
:
case
"toEEPROM3"
:
$EEPROM_bus0
=
intval
(
substr
(
$cmd
,
8
)
);
// and fall below
case
"toEEPROM"
:
if
((
$EEPROM_bus0
<
0
)
||
(
$EEPROM_bus0
>
3
))
{
// Not supported in NC393 - TODO: implement with bus=5 for 10389 board serial number
break
;
}
if
((
$EEPROM_chn
<
0
)
||
(
$EEPROM_chn
>
4
))
{
// Not supported in NC393
break
;
}
}
if
(
$wprot
>=
0
)
{
// not implemented in NC393?
// i2c_setprot ($EEPROM_bus0?0:1,0xa0+($EEPROM_chn*($EEPROM_bus0?4:2)),1,(1-$wprot));
}
if
(
$data
==
""
)
{
if
(
$model
===
""
)
{
$rslt
=
"model not specified"
;
break
;
break
;
case
"toEEPROM0"
:
$EEPROM_bus0
=
true
;
// and fall below
case
"toEEPROM"
:
if
(
$wprot
>=
0
)
{
i2c_setprot
(
$EEPROM_bus0
?
0
:
1
,
0xa0
+
(
$EEPROM_chn
*
(
$EEPROM_bus0
?
4
:
2
)),
1
,(
1
-
$wprot
));
}
}
if
(
$data
==
""
)
{
if
(
$rev
===
""
)
{
if
(
$model
===
""
)
{
$rslt
=
"model not specified"
;
break
;}
$rslt
=
"rev not specified"
;
if
(
$rev
===
""
)
{
$rslt
=
"rev not specified"
;
break
;}
break
;
if
(
$serial
===
""
)
{
$rslt
=
"serial not specified"
;
break
;}
if
(
$time
===
""
)
{
$rslt
=
"time not specified"
;
break
;}
$xml
=
new
SimpleXMLElement
(
"<?xml version='1.0' standalone='yes'?><board/>"
);
if
(
$brand
!=
''
)
$xml
->
addChild
(
'brand'
,
$brand
);
if
(
$model
!=
''
)
$xml
->
addChild
(
'model'
,
$model
);
if
(
$rev
!=
''
)
$xml
->
addChild
(
'rev'
,
$rev
);
if
(
$serial
!=
''
)
$xml
->
addChild
(
'serial'
,
$serial
);
if
(
$time
!=
''
)
$xml
->
addChild
(
'time'
,
$time
);
if
(
$application
!=
""
)
$xml
->
addChild
(
'app'
,
$application
);
if
(
$application_mode
!=
""
)
$xml
->
addChild
(
'mode'
,
$application_mode
);
if
(
$sensor
!=
''
)
$xml
->
addChild
(
'sensor'
,
$sensor
);
if
(
$length
!=
''
)
$xml
->
addChild
(
'len'
,
$length
);
if
(
$port
!=
''
)
$xml
->
addChild
(
'port'
,
$port
);
if
(
$part
!=
''
)
$xml
->
addChild
(
'part'
,
$part
);
if
(
$baud
!=
''
)
$xml
->
addChild
(
'baud'
,
$baud
);
if
(
$sync
!=
''
)
$xml
->
addChild
(
'sync'
,
$sync
);
$data
=
$xml
->
asXML
();
}
}
if
(
strlen
(
$data
)
>
256
)
{
if
(
$serial
===
""
)
{
$rslt
=
"data too long - "
.
strlen
(
$data
)
.
" bytes, only 256 are permitt
ed"
;
$rslt
=
"serial not specifi
ed"
;
break
;
break
;
}
}
$rslt
=
"written "
.
i2c_write256b
(
$data
,
0xa0
+
(
$EEPROM_chn
*
(
$EEPROM_bus0
?
4
:
2
)),
$EEPROM_bus0
?
0
:
1
);
if
(
$time
===
""
)
{
i2c_setprot
(
$EEPROM_bus0
?
0
:
1
,
0xa0
+
(
$EEPROM_chn
*
(
$EEPROM_bus0
?
4
:
2
)),
1
,
0
)
;
$rslt
=
"time not specified"
;
break
;
break
;
case
"ctl"
:
}
if
(
$bus
===
""
)
{
$xml
=
new
SimpleXMLElement
(
"<?xml version='1.0' standalone='yes'?><board/>"
);
$rslt
=
"i2c bus number is not specified"
;
if
(
$brand
!=
''
)
$xml
->
addChild
(
'brand'
,
$brand
);
if
(
$model
!=
''
)
$xml
->
addChild
(
'model'
,
$model
);
if
(
$rev
!=
''
)
$xml
->
addChild
(
'rev'
,
$rev
);
if
(
$serial
!=
''
)
$xml
->
addChild
(
'serial'
,
$serial
);
if
(
$time
!=
''
)
$xml
->
addChild
(
'time'
,
$time
);
if
(
$application
!=
""
)
$xml
->
addChild
(
'app'
,
$application
);
if
(
$application_mode
!=
""
)
$xml
->
addChild
(
'mode'
,
$application_mode
);
if
(
$sensor
!=
''
)
$xml
->
addChild
(
'sensor'
,
$sensor
);
if
(
$length
!=
''
)
$xml
->
addChild
(
'len'
,
$length
);
if
(
$port
!=
''
)
$xml
->
addChild
(
'port'
,
$port
);
if
(
$part
!=
''
)
$xml
->
addChild
(
'part'
,
$part
);
if
(
$baud
!=
''
)
$xml
->
addChild
(
'baud'
,
$baud
);
if
(
$sync
!=
''
)
$xml
->
addChild
(
'sync'
,
$sync
);
$data
=
$xml
->
asXML
();
}
if
(
strlen
(
$data
)
>
256
)
{
$rslt
=
"data too long - "
.
strlen
(
$data
)
.
" bytes, only 256 are permitted"
;
break
;
break
;
}
}
$rslt
=
i2c_ctl
(
$bus
,
$data
)
->
asXML
();
// $rslt="written ".i2c_write256b($data,0xa0+($EEPROM_chn*($EEPROM_bus0?4:2)),$EEPROM_bus0?0:1);
header
(
"Content-Type: text/xml"
);
$rslt
=
"written "
.
i2c_write256b_sensor
(
$data
,
'sensor_eeprom'
,
$EEPROM_bus0
,
2
*
$EEPROM_chn
);
header
(
"Content-Length: "
.
strlen
(
$rslt
)
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
// i2c_setprot ($EEPROM_bus0?0:1,0xa0+($EEPROM_chn*($EEPROM_bus0?4:2)),1,0);
printf
(
$rslt
);
break
;
exit
(
0
);
case
"ctl"
:
if
(
$bus
===
""
)
{
$rslt
=
"i2c bus number is not specified"
;
break
;
}
}
if
(
$rslt
==
""
)
{
$rslt
=
i2c_ctl
(
$bus
,
$data
)
->
asXML
();
if
((
$adr
>=
0
)
&&
((
$width
==
8
)
||
(
$width
==
16
)))
{
header
(
"Content-Type: text/xml"
);
$slave
=
(
$adr
>>
((
$width
==
16
)
?
8
:
7
))
&
0xfe
;
header
(
"Content-Length: "
.
strlen
(
$rslt
)
.
"
\n
"
);
if
(
$wprot
>=
0
)
{
header
(
"Pragma: no-cache
\n
"
);
i2c_setprot
(
$bus
,
$slave
,
1
,(
1
-
$wprot
));
printf
(
$rslt
);
exit
(
0
);
}
if
(
$rslt
==
""
)
{
if
(
$bus
>
3
)
{
if
((
$adr
>=
0
)
&&
((
$width
==
8
)
||
(
$width
==
16
)))
{
$slave
=
(
$adr
>>
((
$width
==
16
)
?
8
:
7
))
&
0xfe
;
if
(
$wprot
>=
0
)
{
// i2c_setprot ($bus,$slave,1,(1-$wprot));
}
}
if
(
$rprot
>=
0
)
{
if
(
$rprot
>=
0
)
{
i2c_setprot
(
$bus
,
$slave
,
0
,(
1
-
$rprot
));
//
i2c_setprot ($bus,$slave,0,(1-$rprot));
}
}
$msg
.=
"<width>"
.
$width
.
"</width>
\n
"
;
$msg
.=
"<width>"
.
$width
.
"</width>
\n
"
;
$msg
.=
"<bus>"
.
$bus
.
"</bus>
\n
"
;
$msg
.=
"<bus>"
.
$bus
.
"</bus>
\n
"
;
$msg
.=
"<slave>"
.
(
sprintf
(
"0x%x"
,(
$adr
>>
((
$width
==
8
)
?
7
:
8
))
&
0xfe
))
.
"</slave>
\n
"
;
$msg
.=
"<slave>"
.
(
sprintf
(
"0x%x"
,
(
$adr
>>
((
$width
==
8
)
?
7
:
8
))
&
0xfe
))
.
"</slave>
\n
"
;
if
(
!
$raw
)
{
if
(
!
$raw
)
{
$msg
.=
"<adr>"
.
$adr
.
"</adr>
\n
"
;
$msg
.=
"<adr>"
.
$adr
.
"</adr>
\n
"
;
$msg
.=
"<hex_adr>"
.
sprintf
(
"0x%x"
,
$adr
)
.
"</hex_adr>
\n
"
;
$msg
.=
"<hex_adr>"
.
sprintf
(
"0x%x"
,
$adr
)
.
"</hex_adr>
\n
"
;
}
}
if
(
$data
!=
""
)
{
//! i2c write
if
(
$data
!=
""
)
{
// ! i2c write
$data
+=
0
;
$data
+=
0
;
$msg
.=
"<data>"
.
$data
.
"</data>
\n
"
;
$msg
.=
"<data>"
.
$data
.
"</data>
\n
"
;
$msg
.=
"<wdata>"
.
$data
.
"</wdata>
\n
"
;
$msg
.=
"<wdata>"
.
$data
.
"</wdata>
\n
"
;
$msg
.=
"<hex_data>"
.
sprintf
(
"0x%x"
,
$data
)
.
"</hex_data>
\n
"
;
$msg
.=
"<hex_data>"
.
sprintf
(
"0x%x"
,
$data
)
.
"</hex_data>
\n
"
;
$rslt
=
(
$slowbus0
>=
0
)
?
i2c_send_slow
(
$width
,
$bus
,
$adr
,
$data
,
$raw
,
$slowbus0
)
:
i2c_send
(
$width
,
$bus
,
$adr
,
$data
,
$raw
);;
$rslt
=
(
$slowbus0
>=
0
)
?
i2c_send_slow
(
$width
,
$bus
,
$adr
,
$data
,
$raw
,
$slowbus0
)
:
i2c_send
(
$width
,
$bus
,
$adr
,
$data
,
$raw
);
if
(
!
(
$rslt
>
0
))
$msg
.=
"<error>
\"
i2c write error ("
.
$rslt
.
")
\"
</error>
\n
"
;
;
}
else
{
//!i2c read
if
(
!
(
$rslt
>
0
))
$data
=
(
$slowbus0
>=
0
)
?
i2c_receive_slow
(
$width
,
$bus
,
$adr
,
$raw
,
$slowbus0
)
:
i2c_receive
(
$width
,
$bus
,
$adr
,
$raw
);
$msg
.=
"<error>
\"
i2c write error ("
.
$rslt
.
")
\"
</error>
\n
"
;
$msg
.=
"<data>"
.
$data
.
"</data>
\n
"
;
}
else
{
// !i2c read
$msg
.=
"<rdata>"
.
$data
.
"</rdata>
\n
"
;
$data
=
(
$slowbus0
>=
0
)
?
i2c_receive_slow
(
$width
,
$bus
,
$adr
,
$raw
,
$slowbus0
)
:
i2c_receive
(
$width
,
$bus
,
$adr
,
$raw
);
$msg
.=
"<hex_data>"
.
sprintf
(
"0x%x"
,
$data
)
.
"</hex_data>
\n
"
;
$msg
.=
"<data>"
.
$data
.
"</data>
\n
"
;
if
(
$data
==-
1
)
$msg
.=
"<error>
\"
i2c read error
\"
</error>
\n
"
;
$msg
.=
"<rdata>"
.
$data
.
"</rdata>
\n
"
;
$msg
.=
"<hex_data>"
.
sprintf
(
"0x%x"
,
$data
)
.
"</hex_data>
\n
"
;
if
(
$data
==
-
1
)
$msg
.=
"<error>
\"
i2c read error
\"
</error>
\n
"
;
}
}
}
else
{
}
else
{
if
(
!
$nopars
)
$msg
.=
"<error>
\"
Address (adr or raw) or width are not specified or are not positive.
\"
</error>
\n
"
;
if
(
!
$nopars
)
$msg
.=
"<usage>
\"
open URL: i2c.php?width=www&bus=bbb&adr=aaa&data=ddd
\"
</usage>
\n
"
;
$msg
.=
"<error>
\"
Address (adr or raw) or width are not specified or are not positive.
\"
</error>
\n
"
;
$msg
.=
"<usage>
\"
open URL: i2c.php?width=www&bus=bbb&adr=aaa&data=ddd
\"
</usage>
\n
"
;
}
}
}
else
{
}
else
{
$msg
.=
"<result>
\"
"
.
$rslt
.
"
\"
</result>
\n
"
;
if
((
strlen
(
$class
)
>
0
)
||
(
$adr
>=
0
))
{
$msg
.=
"<class>"
.
$class
.
"</class>
\n
"
;
$msg
.=
"<bus>"
.
$bus
.
"</bus>
\n
"
;
$msg
.=
"<sa7offs>"
.
sprintf
(
"0x%x"
,
$sa7offs
)
.
"</sa7offs>
\n
"
;
$msg
.=
"<adr>"
.
$adr
.
"</adr>
\n
"
;
$msg
.=
"<hex_adr>"
.
sprintf
(
"0x%x"
,
$adr
)
.
"</hex_adr>
\n
"
;
if
(
$data
!=
""
)
{
// ! i2c write
$data
+=
0
;
$msg
.=
"<data>"
.
$data
.
"</data>
\n
"
;
$msg
.=
"<wdata>"
.
$data
.
"</wdata>
\n
"
;
$msg
.=
"<hex_data>"
.
sprintf
(
"0x%x"
,
$data
)
.
"</hex_data>
\n
"
;
$rslt
=
i2c_send_sensor
(
$class
,
$bus
,
$adr
,
$data
,
$sa7offs
);
if
(
!
(
$rslt
>
0
))
$msg
.=
"<error>
\"
i2c write error ("
.
$rslt
.
")
\"
</error>
\n
"
;
}
else
{
// !i2c read
$data
=
i2c_receive_sensor
(
$class
,
$bus
,
$adr
,
$sa7offs
);
$msg
.=
"<data>"
.
$data
.
"</data>
\n
"
;
$msg
.=
"<rdata>"
.
$data
.
"</rdata>
\n
"
;
$msg
.=
"<hex_data>"
.
sprintf
(
"0x%x"
,
$data
)
.
"</hex_data>
\n
"
;
if
(
$data
==
-
1
)
$msg
.=
"<error>
\"
i2c read error
\"
</error>
\n
"
;
}
}
else
{
if
(
!
$nopars
)
$msg
.=
"<error>
\"
Device class name and/or register address are not specified address is not positive.
\"
</error>
\n
"
;
$msg
.=
"<usage>
\"
open URL: i2c.php?class=device_class_name&bus=sensor_port&adr=register_address&data=data_to_write&sa7offs=add_to_slave_address
\"
</usage>
\n
"
;
}
}
}
}
else
{
$msg
.=
"<result>
\"
"
.
$rslt
.
"
\"
</result>
\n
"
;
}
$msg
.=
"</i2c>
\n
"
;
$msg
.=
"</i2c>
\n
"
;
header
(
"Content-Type: text/xml"
);
header
(
"Content-Type: text/xml"
);
header
(
"Content-Length: "
.
strlen
(
$msg
)
.
"
\n
"
);
header
(
"Content-Length: "
.
strlen
(
$msg
)
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
printf
(
$msg
);
printf
(
$msg
);
?>
?>
src/php_top/parsedit.php
View file @
8861af0a
...
@@ -247,7 +247,7 @@ function printDefaultPage() {
...
@@ -247,7 +247,7 @@ function printDefaultPage() {
.
"&EXTERN_TIMESTAMP=1"
/// Use external timestamp when available
.
"&EXTERN_TIMESTAMP=1"
/// Use external timestamp when available
.
"&BITS=8"
/// 8 bit data mode
.
"&BITS=8"
/// 8 bit data mode
.
"&QUALITY=80"
/// 80 percent JPEG image quality
.
"&QUALITY=80"
/// 80 percent JPEG image quality
.
"&COLOR=
1
"
/// regular color mode (not mono or JP4 flavors)
.
"&COLOR=
0
"
/// regular color mode (not mono or JP4 flavors)
.
"&COLOR_SATURATION_BLUE=200"
/// 2.0 (200% blue/green color saturation (to compensate for effect of non-unity gamma)
.
"&COLOR_SATURATION_BLUE=200"
/// 2.0 (200% blue/green color saturation (to compensate for effect of non-unity gamma)
.
"&COLOR_SATURATION_RED=200"
/// 2.0 (200% blue/green color saturation
.
"&COLOR_SATURATION_RED=200"
/// 2.0 (200% blue/green color saturation
.
"&BAYER=0"
/// No bayer shift
.
"&BAYER=0"
/// No bayer shift
...
@@ -414,8 +414,9 @@ $url_ext_trigger=$url_port."embed=0.1&title=External+trigger+controls"
...
@@ -414,8 +414,9 @@ $url_ext_trigger=$url_port."embed=0.1&title=External+trigger+controls"
/// bit 1 - enable(1) or disable(0) external trigger to stop clip
/// bit 1 - enable(1) or disable(0) external trigger to stop clip
/// bit 2 - async (snapshot, ext trigger) mode, 0 - continuous NOTE: Only this bit is used now !
/// bit 2 - async (snapshot, ext trigger) mode, 0 - continuous NOTE: Only this bit is used now !
/// bit 3 - no overlap, single frames: program - acquire/compress same frame
/// bit 3 - no overlap, single frames: program - acquire/compress same frame
/// bit 4 - Global reset release mode
.
"&TRIG_PERIOD=2
0000000"
/// 0.2 sec @96
MHz output sync period (32 bits, in pixel clocks)
.
"&TRIG_PERIOD=2
5000000"
/// 0.25 sec @100
MHz output sync period (32 bits, in pixel clocks)
/// >=256 repetitive with specified period.
/// >=256 repetitive with specified period.
/// NOTE: Currently there is no verification that period is longer than sensor/compressor can handle
/// NOTE: Currently there is no verification that period is longer than sensor/compressor can handle
.
"&TRIG_DELAY"
/// trigger delay, 32 bits in pixel clocks (needed when multiple cameras are synchronized)
.
"&TRIG_DELAY"
/// trigger delay, 32 bits in pixel clocks (needed when multiple cameras are synchronized)
...
...
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