Commit 89e5d3c7 authored by Mikhail Karpenko's avatar Mikhail Karpenko

Merge branch 'master' of https://github.com/Elphel/meta-elphel393

parents 9e4fc291 559ea36a
/**/ /**/
/ { / {
chosen { chosen {
bootargs = "cma=128M console=ttyPS0,115200 root=/dev/mmcblk0p2 rw ip=192.168.0.8 earlyprintk rootwait rootfstype=ext4"; bootargs = "cma=336M console=ttyPS0,115200 root=/dev/mmcblk0p2 rw ip=192.168.0.8 earlyprintk rootwait rootfstype=ext4";
linux,stdout-path = "/amba@0/serial@e0000000"; linux,stdout-path = "/amba@0/serial@e0000000";
}; };
}; };
/**/ /**/
/ { / {
chosen { chosen {
bootargs = "cma=128M console=ttyPS0,115200 root=ubi0:elphel393-rootfs rw ip=192.168.0.8 earlyprintk rootwait rootfstype=ubifs ubi.mtd=4,2048"; bootargs = "cma=336M console=ttyPS0,115200 root=ubi0:elphel393-rootfs rw ip=192.168.0.8 earlyprintk rootwait rootfstype=ubifs ubi.mtd=4,2048";
linux,stdout-path = "/amba@0/serial@e0000000"; linux,stdout-path = "/amba@0/serial@e0000000";
}; };
}; };
/**/ /**/
/ { / {
chosen { chosen {
bootargs = "cma=128M console=ttyPS0,115200 root=/dev/ram rw ip=192.168.0.8 earlyprintk ramdisk_size=262144"; bootargs = "cma=336M console=ttyPS0,115200 root=/dev/ram rw ip=192.168.0.8 earlyprintk ramdisk_size=262144";
linux,stdout-path = "/amba@0/serial@e0000000"; linux,stdout-path = "/amba@0/serial@e0000000";
}; };
}; };
...@@ -186,7 +186,8 @@ ...@@ -186,7 +186,8 @@
elphel393_mem: elphel393-mem@0 { elphel393_mem: elphel393-mem@0 {
compatible = "elphel,elphel393-mem-1.00"; compatible = "elphel,elphel393-mem-1.00";
memsize = <25600>; /*memsize = <25600>;*/
memsize = <76800>;
} ; } ;
elphel393_init: elphel393-init { elphel393_init: elphel393-init {
......
...@@ -22,6 +22,9 @@ SRC_URI = "file://controls.html \ ...@@ -22,6 +22,9 @@ SRC_URI = "file://controls.html \
file://setup.js \ file://setup.js \
file://setup.php \ file://setup.php \
file://index.html \ file://index.html \
file://camogm.html \
file://camogm.js \
file://camogm.php \
" "
S = "${WORKDIR}/" S = "${WORKDIR}/"
...@@ -42,6 +45,9 @@ do_install_append() { ...@@ -42,6 +45,9 @@ do_install_append() {
install -m 0644 ${WORKDIR}/setup.js ${D}/www/pages install -m 0644 ${WORKDIR}/setup.js ${D}/www/pages
install -m 0644 ${WORKDIR}/setup.php ${D}/www/pages install -m 0644 ${WORKDIR}/setup.php ${D}/www/pages
install -m 0644 ${WORKDIR}/index.html ${D}/www/pages install -m 0644 ${WORKDIR}/index.html ${D}/www/pages
install -m 0644 ${WORKDIR}/camogm.html ${D}/www/pages
install -m 0644 ${WORKDIR}/camogm.js ${D}/www/pages
install -m 0644 ${WORKDIR}/camogm.php ${D}/www/pages
} }
PACKAGES = " apps-web" PACKAGES = " apps-web"
......
<html>
<head>
<script src="js/jquery-2.2.3.min.js"></script>
<script src="camogm.js"></script>
<script src="js/bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="js/bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="setup.css"/>
</head>
<body onload='init()'>
</body>
</html>
var interval_get_files;
var interval_refresh_images;
function init(){
var t = $("<table>").html("\
<tr>\
<td id='controls' valign='top' rowspan='2'></td>\
<td id='pic1'></td>\
<td id='pic2'></td>\
</tr><tr>\
<td id='pic3'></td>\
<td id='pic4'></td>\
</tr>");
$("body").append(t);
var port = 2323;
for(i=0;i<4;i++){
var url = "http://"+window.location.hostname+":"+(port+i)+"/noexif/img";
var ref = "http://"+window.location.hostname+":"+(port+i)+"/noexif/mimg";
a = $("<a>",{href:ref});
img = $("<img>",{id:"chn"+i}).css({
width: "400px"
});
img.attr("src",url);
img.attr("src_init",url);
$("#pic"+(i+1)).append($("<div>").append(a.append(img)));
/*
img.load(function(){
d = new Date();
n = d.getTime();
this.src = $(this).attr("src_init")+"&"+n;
});
*/
}
ct = $("<div style='padding-top:10px;'>");
tmpstr = "<table>\
<tr>\
<td>Sensors type:</td>\
<td><button id='s5'><b>5 MPix</b></button></td>\
<td><button id='s14'><b>14 MPix</b></button></td>\
</tr>\
</table>";
ct.html(tmpstr);
$("#controls").append(ct);
$("#s5").addClass("btn nooutline");
$("#s14").addClass("btn nooutline");
ct2 = $("<div style='padding-top:20px;'>");
tmpstr = "Absolute path: <input id='abspath' style='text' value='/mnt/sda1' class='ap' />";
ct2.html(tmpstr);
$("#controls").append(ct2);
$(".ap").css({
width:"150px",
padding:"2px 5px",
"text-align":"left"
});
$("#abspath").change(function(){
//console.log($(this).val());
$.ajax({url:"camogm.php?cmd=create_symlink&path="+$(this).val()});
});
ct3 = $("<div style='padding-top:20px;'>");
tmpstr = "<table>\n";
tmpstr += "<tr><td>Chn&nbsp;</td><td>Prefix&nbsp;</td><td colspan='2'>Recording</td></tr>";
for(i=0;i<4;i++){
tmpstr += "\
<tr>\
<td valign='bottom'>"+(i+1)+"</td>\
<td valign='bottom'><input type='text' id='prefix"+i+"' value='c"+(i+1)+"_' class='pfx'/></td>\
<td valign='bottom'><button id='rec"+i+"' class='rec btn btn-success nooutline'>start</button></td>\
</tr>\
";
}
tmpstr += "</table>";
ct3.html(tmpstr);
$("#controls").append(ct3);
$(".rec").css({
"font-weight":"bold",
padding:"3px 10px"
});
$(".rec").click(function(){
$(this).toggleClass('btn-success');
$(this).toggleClass('btn-danger');
var tmp = $(this).attr("id");
var index = tmp[3];
var cmd = $(this).text();
if (cmd=="start") {
$(this).text("stop");
console.log("starting: "+index);
}else{
$(this).text("start");
}
$.ajax({url:"camogm.php?chn="+index+"&cmd="+cmd});
});
$(".pfx").css({
width:"50px",
"padding-right":"3px",
"text-align":"right"
});
ct4 = $("<div style='padding-top:20px;'>");
tmpstr = "<table>\
<tr><td class='filelist'>Files:</td></tr>\
<tr><td class='filelist'><div id='filelist'></div></td></tr>\
</table>\
";
ct4.html(tmpstr);
$("#controls").append(ct4);
$(".filelist").css({
"text-align":"left"
});
init_sensor_type();
for(var i=0;i<4;i++) get_camogm_state(i);
init_path();
init_files();
init_images();
}
function init_files(){
interval_get_files = setInterval(get_files,1000);
}
function init_images(){
interval_refresh_images = setInterval(function(){
for(var j=0;j<4;j++){
d = new Date();
n = d.getTime();
$("#chn"+j).attr("src",$("#chn"+j).attr("src_init")+"&"+n);
}
},1000);
}
function get_camogm_state(index){
$.ajax({
url: "camogm.php?cmd=status&chn="+index,
complete: function(data){
var xml = data.responseXML;
var tmp = $(xml).find("state");
var tmpstr = $(tmp[0]).text();
//trim "
tmpstr = tmpstr.replace(/^"+|"+$/g,'');
if (tmpstr=="stopped"){
$("#rec"+index).removeClass("btn-danger");
$("#rec"+index).addClass("btn-success");
$("#rec"+index).text("start");
init_default(index);
}else{
$("#rec"+index).removeClass("btn-success");
$("#rec"+index).addClass("btn-danger");
$("#rec"+index).text("stop");
}
}
});
}
function get_files(){
console.log("get files");
$.ajax({
url: "camogm.php?cmd=list&path="+$("#abspath").val(),
complete: function(data){
var xml = data.responseXML;
var files = $(xml).find("f");
$("#filelist").html("");
rstr = "<ul>";
for(var i=0;i<files.length;i++){
var tmp = $(files[i]).text();
tmp = tmp.substring(tmp.lastIndexOf("/")+1);
rstr += "<li><a class='vd' href='video/"+tmp+"'>"+tmp+"</a></li>\n";
}
rstr += "</ul>\n";
$("#filelist").html(rstr);
$(".vd").css({
cursor:"pointer"
});
}
});
}
function init_path(){
$.ajax({
url:"camogm.php?cmd=list&path=/mnt",
complete: function(data){
var xml = data.responseXML;
var dirs = $(xml).find("d");
var res = false;
for(var i=0;i<dirs.length;i++){
var tmp = $(dirs[i]).text();
if (tmp=="/mnt/sda1") {
$("#abspath").val(tmp);
res = true;
}
}
if (!res){
console.log("init path failed");
}
}
});
}
function init_default(index){
var prefix = $("#abspath").val()+"/";
$.ajax({url:"camogm.php?chn="+index+"&cmd=format=mov;exif=0;duration=600;length=1073741824;prefix="+prefix+$("#prefix"+index).val()});
}
/*
function init_defaults(){
var prefix = $("#abspath").val()+"/";
for(var i=0;i<4;i++){
$.ajax({url:"camogm.php?chn="+i+"&cmd=format=mov;exif=0;duration=600;length=1073741824;prefix="+prefix+$("#prefix"+i).val()});
}
$.ajax({url:"camogm.php?cmd=create_symlink&path="+prefix});
}
*/
function init_sensor_type(){
$.ajax({
url: "setup.php?cmd=get_sensor_type",
complete: function(data){
r = JSON.parse(data.responseText);
if (r.sensortype==5){
sensortype=5;
$("#s5").addClass("btn-success");
}
if (r.sensortype==14){
sensortype=14;
$("#s14").addClass("btn-success");
}
}
});
}
<?php
/*
*!******************************************************************************
*! File: camogm.php
*! Description: command interface for the camogm recorder based on
*! http://elphel.cvs.sourceforge.net/viewvc/elphel/elphel353-8.0/packages/web/353/camogmgui/camogm_interface.php?revision=1.23&content-type=text%2Fplain
*!
*! Copyright (C) 2016 Elphel, Inc
*! -----------------------------------------------------------------------------**
*! This program is free software: you can redistribute it and/or modify
*! it under the terms of the GNU General Public License as published by
*! the Free Software Foundation, either version 3 of the License, or
*! (at your option) any later version.
*!
*! This program is distributed in the hope that it will be useful,
*! but WITHOUT ANY WARRANTY; without even the implied warranty of
*! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
*! GNU General Public License for more details.
*!
*! You should have received a copy of the GNU General Public License
*! along with this program. If not, see <http://www.gnu.org/licenses/>.
*! -----------------------------------------------------------------------------**
*/
$chn = 0;
$cmd = "donothing";
$debug = false;
$debuglev = 6;
if (isset($_GET['chn'])) $chn = $_GET['chn'];
if (isset($_GET['cmd'])) $cmd = $_GET['cmd'];
if (isset($_GET['debug']) ) $debug = $_GET['debug'];
if (isset($_GET['debuglev'])) $debuglev = $_GET['debuglev'];
$r_pipe="/tmp/camogm$chn.status";
$c_pipe="/var/volatile/camogm_cmd$chn";
if ($cmd=="status"){
$mode=0777;
if(!is_file($r_pipe)){
umask(0);
posix_mkfifo($r_pipe,$mode);
}
$fcmd=fopen($c_pipe,"w");
fprintf($fcmd, "xstatus=%s\n",$r_pipe);
fclose($fcmd);
$res=file_get_contents($r_pipe);
xml_response($res);
}
if ($cmd=="list") {
$res="";
if (isset($_GET['path'])) $path = $_GET['path'];
else {
$res = "<res>the path is not set</res>\n";
}
if (is_dir($path)) {
$files = scandir($path);
foreach ($files as $file){
if (is_file("$path/$file")) $res .= "<f>$path/$file</f>\n";
if (is_dir("$path/$file")) $res .= "<d>$path/$file</d>\n";
}
}else{
$res = "<res>directory not found</res>\n";
}
xml_response("<camogm>\n$res</camogm>\n",true);
}
if ($cmd=="create_symlink"){
if (isset($_GET['path'])) {
$path = $_GET['path'];
if (is_dir($path)){
exec("ln -sf $path /www/pages/video;sync");
}
}
break;
}
//camogm pipe commands
$fcmd = fopen($c_pipe, "w");
if ($cmd=="start"){
fprintf($fcmd,"start;\n");
}else if ($cmd=="stop"){
fprintf($fcmd,"stop;\n");
exec('sync');
}else if ($cmd=="exit"){
fprintf($fcmd,"exit;\n");
exec('sync');
}else if ($cmd=="default"){
fprintf($fcmd,"format=mov;exif=0;prefix=/mnt/sda1/;\n");
}else{
fprintf($fcmd,"$cmd\n");
//exec('sync');
}
fclose($fcmd);
$res = "<channel>$chn</channel>\n";
$res .= "<cmd>$cmd</cmd>\n";
xml_response("<camogm>\n$res</camogm>\n",true);
die("done");
function xml_response($msg,$addheader=false){
if ($addheader) $msg = "<?xml version='1.0' standalone='yes' ?>\n$msg";
header("Content-Type: text/xml");
header("Content-Length: ".strlen($msg)."\n");
header("Pragma: no-cache\n");
echo $msg;
flush();
die();
}
?>
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
<ul> <ul>
<li><a href="controls.html">Controls</a> (exposure, w/b, quality)</li> <li><a href="controls.html">Controls</a> (exposure, w/b, quality)</li>
<li><a href="hwmon.html">Temperature monitor</a> (CPU)</li> <li><a href="hwmon.html">Temperature monitor</a> (CPU)</li>
<li><a href="setup.html">Other</a> (Test patterns)</li> <li><a href="setup.html">Other</a> (test patterns)</li>
<li><a href="camogm.html">Camogm</a> (recorder)</li>
</ul> </ul>
</div> </div>
</td> </td>
......
<html> <html>
<head> <head>
<script src="js/jquery-2.2.3.min.js"></script> <script src="js/jquery-2.2.3.min.js"></script>
<script src="setup.js"></script> <script src="setup.js"></script>
......
<?php <?php
$port = 8888;
if (isset($_GET['cmd'])) if (isset($_GET['cmd']))
$cmd = $_GET['cmd']; $cmd = $_GET['cmd'];
else else
...@@ -30,10 +32,10 @@ if ($cmd=="set_test_pattern"){ ...@@ -30,10 +32,10 @@ if ($cmd=="set_test_pattern"){
} }
} }
$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes -c write_sensor_i2c $chn 1 0 $regval"; $str = "write_sensor_i2c $chn 1 0 $regval"."\r\n";
echo $str;
exec($str);
echo send_cmd($port,$str);
//$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes -c ";
} }
if ($cmd=="set_sensor_phase"){ if ($cmd=="set_sensor_phase"){
...@@ -49,6 +51,19 @@ if ($cmd=="set_sensor_phase"){ ...@@ -49,6 +51,19 @@ if ($cmd=="set_sensor_phase"){
$regval = "0x31c0".dechex($val)."000"; $regval = "0x31c0".dechex($val)."000";
} }
$str = "write_sensor_i2c $chn 1 0 $regval"."\r\n";
$str .= "compressor_control $chn 1"."\r\n";
$str .= "control_sensor_memory $chn stop"."\r\n";
$str .= "control_sensor_memory $chn reset"."\r\n";
$str .= "control_sensor_memory $chn repetitive"."\r\n";
$str .= "sleep_ms 500"."\r\n";
$str .= "compressor_control $chn 0"."\r\n";
$str .= "sleep_ms 500"."\r\n";
$str .= "compressor_control $chn 3"."\r\n";
echo send_cmd($port,$str);
/*
$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes \ $str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes \
-c write_sensor_i2c $chn 1 0 $regval\ -c write_sensor_i2c $chn 1 0 $regval\
-c compressor_control $chn 1\ -c compressor_control $chn 1\
...@@ -63,9 +78,23 @@ if ($cmd=="set_sensor_phase"){ ...@@ -63,9 +78,23 @@ if ($cmd=="set_sensor_phase"){
echo $str; echo $str;
exec($str); exec($str);
*/
} }
if ($cmd=="find_sdram_phase"){ if ($cmd=="find_sdram_phase"){
$str = "compressor_control $chn 1"."\r\n";
$str .= "compressor_control $chn 0"."\r\n";
$str .= "control_sensor_memory $chn stop"."\r\n";
$str .= "control_sensor_memory $chn reset"."\r\n";
$str .= "measure_all \"*DI\""."\r\n";
$str .= "measure_all"."\r\n";
$str .= "control_sensor_memory $chn repetitive"."\r\n";
$str .= "compressor_control $chn 3"."\r\n";
echo send_cmd($port,$str);
/*
$str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes \ $str = "cd /usr/local/verilog/;/usr/local/bin/test_mcntrl.py @includes \
-c compressor_control $chn 1\ -c compressor_control $chn 1\
-c compressor_control $chn 0\ -c compressor_control $chn 0\
...@@ -79,6 +108,7 @@ if ($cmd=="find_sdram_phase"){ ...@@ -79,6 +108,7 @@ if ($cmd=="find_sdram_phase"){
echo $str; echo $str;
exec($str); exec($str);
*/
} }
function get_sensor_type(){ function get_sensor_type(){
...@@ -89,4 +119,16 @@ function get_sensor_type(){ ...@@ -89,4 +119,16 @@ function get_sensor_type(){
return $res[1]; return $res[1];
} }
function send_cmd($port,$msg){
$fp = fsockopen("localhost", $port, $errno, $errstr, 30);
if (!$fp) {
return "$errstr ($errno)<br />\n";
}else{
fwrite($fp,"$msg\r\n");
fclose($fp);
echo "sent: $msg";
}
}
?> ?>
...@@ -42,6 +42,8 @@ IMAGE_INSTALL_append += " python-core \ ...@@ -42,6 +42,8 @@ IMAGE_INSTALL_append += " python-core \
init-tempmon \ init-tempmon \
ahci-blacklist \ ahci-blacklist \
udev-rules \ udev-rules \
e2fsprogs \
gstreamer1.0 \
" "
#kernel-modules #kernel-modules
......
...@@ -13,6 +13,9 @@ case "$1" in ...@@ -13,6 +13,9 @@ case "$1" in
start) start)
echo -n "Starting $DESC: " echo -n "Starting $DESC: "
echo "$NAME:" echo "$NAME:"
#add commands here
#mount here #mount here
echo " Mounting Memory Card to $MNTPOINT" echo " Mounting Memory Card to $MNTPOINT"
if [ ! -d $MNTPOINT ]; then if [ ! -d $MNTPOINT ]; then
......
...@@ -9,10 +9,12 @@ IMGSRV_PORT=2323 ...@@ -9,10 +9,12 @@ IMGSRV_PORT=2323
# camogm command pipe name # camogm command pipe name
CAMOGM_PIPE=/var/volatile/camogm_cmd CAMOGM_PIPE=/var/volatile/camogm_cmd
# enable SATA, set this to 1 if camera is equipped with SSD drive # enable SATA, set this to 1 if camera is equipped with SSD drive
SATA_EN=0 SATA_EN=1
ifconfig eth0 192.168.0.9 ifconfig eth0 192.168.0.9
cd /usr/local/verilog/ cd /usr/local/verilog/
if [ $SENSOR_TYPE -eq 5 ]; then if [ $SENSOR_TYPE -eq 5 ]; then
/usr/local/bin/test_mcntrl.py @startup5 >> /dev/null 2>&1 & /usr/local/bin/test_mcntrl.py @startup5 >> /dev/null 2>&1 &
ln -sf /usr/local/verilog/x393_parallel.bit /usr/local/verilog/x393.bit ln -sf /usr/local/verilog/x393_parallel.bit /usr/local/verilog/x393.bit
...@@ -107,6 +109,8 @@ echo file jpeghead.c -pfl > /sys/kernel/debug/dynamic_debug/control ...@@ -107,6 +109,8 @@ echo file jpeghead.c -pfl > /sys/kernel/debug/dynamic_debug/control
/usr/local/bin/test_mcntrl.py @includes -c compressor_control all 3 None None None None None /usr/local/bin/test_mcntrl.py @includes -c compressor_control all 3 None None None None None
cd ~
if [ -f /usr/bin/imgsrv ]; then if [ -f /usr/bin/imgsrv ]; then
imgsrv -p $IMGSRV_PORT & imgsrv -p $IMGSRV_PORT &
fi fi
...@@ -118,5 +122,5 @@ if [ $SATA_EN -eq 1 ]; then ...@@ -118,5 +122,5 @@ if [ $SATA_EN -eq 1 ]; then
/usr/local/bin/x393sata.py /usr/local/bin/x393sata.py
modprobe ahci_elphel & modprobe ahci_elphel &
sleep 2 sleep 2
echo 1 > /sys//devices/soc0/amba@0/80000000.elphel-ahci/load_module echo 1 > /sys/devices/soc0/amba@0/80000000.elphel-ahci/load_module
fi fi
...@@ -5,8 +5,11 @@ AUTHOR = "Elphel Inc." ...@@ -5,8 +5,11 @@ AUTHOR = "Elphel Inc."
HOMEPAGE = "http://www3.elphel.com/" HOMEPAGE = "http://www3.elphel.com/"
PRIORITY = "optional" PRIORITY = "optional"
LICENSE = "GPLv3" #LICENSE = "GPLv3"
LIC_FILES_CHKSUM = "file://LICENSE;beginline=21;endline=699;md5=ccd2fef7dee090f3b211c6677c3e34cc" #LIC_FILES_CHKSUM = "file://LICENSE;beginline=21;endline=699;md5=ccd2fef7dee090f3b211c6677c3e34cc"
LICENSE = "GPL-3.0+"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-3.0;md5=c79ff39f19dfec6d293b95dea7b07891"
SRCDATE = "20131202" SRCDATE = "20131202"
......
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