use warnings;
use File::chdir;
use XML::LibXML;
-use Getopt::Long;
+# use Getopt::Long;
+use CGI ':standard';
+use CGI::Carp qw(fatalsToBrowser);
use Data::Dumper;
use FileHandle;
use Pod::Usage;
use lib "$FindBin::Bin/..";
use Environment;
use HADES::TrbNet;
-trb_init_ports() or die trb_strerror();
sub trb_write {
my($a,$r,$v) = @_;
sub run {
my($c) = @_;
print $c."\n";
- system("DAQOPSERVER=".DAQOPSERVER." ".$c);
+# system("DAQOPSERVER=".DAQOPSERVER." ".$c);
+ system($c);
}
-my $system = $ARGV[0];
+my $isHttpReq = $ENV{HTTP_USER_AGENT};
+print header('text/plain') if $isHttpReq;
+print "<pre>" if $isHttpReq;
+my $q = CGI->new;
+my $system=$q->param('system');
+
+# only for backwards compatibility
+unless(defined($system)){
+ $system = $ARGV[0];
+}
+
unless (defined $system) {die "No system name given\n";}
my $systemFile = SYSTEMDIR."/".$system.".xml";
unless(-e $systemFile) {die "System file $systemFile not found\n";}
for my $n ($db->findnodes("//roc")) {
push(@roc,hex($n->findvalue("./\@address")));
}
+my $daqopserver = $db->findvalue("//daqopserver");
+$ENV{'DAQOPSERVER'} = $daqopserver if (defined($daqopserver));
+
+print "DAQOPSERVER:\t$daqopserver\n";
printf("CCU:\t%04x\n",$ccu);
print("ROC:\t".join(", ", map {sprintf("%04x",$_)} @roc)."\n");
print("HUB:\t".join(", ", map {sprintf("%04x",$_)} @hub)."\n");
print("GBE:\t".join(", ", map {sprintf("%04x",$_)} @gbe)."\n");
-
+
+trb_init_ports() or die trb_strerror();
+
run("trbcmd reset");
sleep 2;
#Send arbiter start signal
trb_write($ccu,0xa000,0x00000001);
+
+print "</pre>" if $isHttpReq;
function startupOnly(){
-
-
-
var setupFile_ = encodeURIComponent(setupFile);
getdata("run.pl?startupOnly=true&runtime=0&setupFile="+setupFile_,"theConsole",false);
-
+}
-
-
+
+
+function exec_init_system(){
+ $.ajax({
+ url: "init_system.pl",
+ cache: false,
+ async: false,
+ dataType: "text",
+ data: {
+ system : systemName
+ },
+ success: function(result) {
+ $("#theConsole").html(result);
+ }
+ });
}
function delete_file(){
$("#advoptbtn").click(function(){
// toggleVis("advancedOptionsContainer");
$("#advancedOptionsContainer").fadeToggle();
- var $target = $('html,body');
+ $('html, body').animate({
+ scrollTop: $("#advancedOptionsContainer").offset().top
+ }, 2000);
+// var $target = $('html,body');
// $target.animate({scrollTop: $target.height()}, 1000);
});
$("#debugbtn").click(function(){
// toggleVis("theConsoleContainer");
$("#theConsoleContainer").fadeToggle();
- var $target = $('html,body');
+ $('html, body').animate({
+ scrollTop: $("#theConsoleContainer").offset().top
+ }, 2000);
+// var $target = $('html,body');
// $target.animate({scrollTop: $target.height()}, 1000);
});
+ $("#button_init_system").click(function(){
+ exec_init_system();
+ });
timer = $.timer(function() {
clear_report();
# so the javascript knows which placeholders to fill with actual plots
print "<script language='javascript'>\n";
print q%var setupFile = '%.$setupFile.q%';%."\n";
+ print q%var systemName = '%.$systemName.q%';%."\n";
print q%var systemFile = '%.SYSTEMDIR."/".$systemName.".xml".q%';%."\n";
print q%var setupDir = '%.SETUPDIR.q%';%."\n";
print "var previewAreaIdHash = new Object();\n";
print q%<input type='button' onClick='startupOnly();' value='startup only'
title="only program JTAG settings and start the sensors, take no data">%;
# print "</td><td>";
+ print q%<input type='button' id='button_init_system' value='init system'
+ title="initialize the readout system (resets the TRB3)">%;
print "</td></tr></table>";