]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
first version of new network map
authorJan Michel <j.michel@gsi.de>
Thu, 22 May 2014 14:02:26 +0000 (16:02 +0200)
committerJan Michel <j.michel@gsi.de>
Thu, 22 May 2014 14:02:35 +0000 (16:02 +0200)
web/htdocs/index.pl
web/htdocs/layout/styles.css
web/htdocs/network/map.pl

index f17dbbe7492cd85e9d4978399fd9968f58113ce1..aaf15d53dc70398e24bc75e275510bac3c83df3c 100755 (executable)
@@ -53,7 +53,7 @@ The main documentation of the network can be found in these documents and locati
 <li><a href="network/trbnet.pl">TrbNet status</a>
 <li><a href="network/hub.pl">Network Hubs</a>
 <li><a href="network/gbe.htm">GbE status</a>
-<li><a href="network/map.htm">Network Map</a>
+<li><a href="network/map.pl">Network Map</a>
 </ul>
 </div>
 </div>
index f2fcc0a135b9295e4de97f788f3836f23aa41dde..28eee2e1aa216a2ffb0012db5126a8288c63c47d 100644 (file)
@@ -234,10 +234,14 @@ width: 89px;
   width:100px;
 }
 
-table#content.map td {border-bottom:none; margin-left:10px; text-align:right}
-table#content.map td:first-child {text-align:left;padding-left:10px; width:100px;}
-table#content.map td + td + td + td {width:200px;}
-table#content.map td + td + td + td + td{width:120px;}
+table#content.map tr {transition:background .4s;}
+table#content.map tr:hover {background:#eed;}
+table#content.map td {border-bottom:none; margin-left:10px; text-align:right; cursor:default;}
+table#content.map td:first-child {text-align:left;padding-left:10px; width:10px;}
+table#content.map td:nth-child(2)  {width:180px; text-align:left}
+table#content.map td:nth-child(3)  {width:280px;}
+table#content.map td:nth-child(4)  {width:150px;}
+table#content.map td:nth-child(5)  {width:100px;}
 
 #content .level1 {background:#f5f5f5;}
 #content .level2 {background:#eaeaea;}
index 8c84b688a8d20551c07ba8e67064ee781de692b4..6ddfee049954bb44da0cf57be132992e4c1e96c1 100755 (executable)
@@ -5,23 +5,189 @@ if ($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) {
   }
 else {
   use lib '..';
-  use if (!($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i)), apacheEnv;
+#  use if (!($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i)), apacheEnv;
   print "Content-type: text/html\n\n";
   }
 
 use CGI ':standard';
+use HADES::TrbNet;
 use POSIX;
 use CGI::Carp qw(fatalsToBrowser);
-
 use lib qw|../commands htdocs/commands|;
 use xmlpage;
-
+use Data::Dumper;
+use Date::Format;
+use v5.14;
 
 ###############################################################################  
 ##  Network Map
 ###############################################################################  
 if($ENV{'QUERY_STRING'} =~ /getmap/) {
-  print "Getting map";
+#   print "Getting map";
+  
+  trb_init_ports() or
+    die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}");
+    
+  my $boards   = trb_read_uid(0xffff);
+  my $temp     = trb_register_read(0xffff,0);
+  my $ctime    = trb_register_read(0xffff,0x40);
+  my $inclLow  = trb_register_read(0xffff,0x41);
+  my $hardware = trb_register_read(0xffff,0x42);
+  my $inclHigh = trb_register_read(0xffff,0x43);
+  
+  my @store;
+  my $tree;
+  my $lastlayer = 1;
+
+  foreach my $id (keys %{$boards}) {
+    foreach my $f (keys %{$boards->{$id}}) {
+      my $addr = $boards->{$id}->{$f};
+      my @path = trb_nettrace($addr);
+      my $parent, my $port;
+      if(scalar @path == 0) {
+        $parent = 0;
+        $port   = 0;
+        }
+      else {
+        $parent = $path[-1][-1]->{address};
+        $port   = $path[-1][-1]->{port};
+        }
+      $tree->{$parent}->[$port]->{addr}   = $addr;
+      }
+    }
+
+
+  print "<table id=\"content\" class=\"content map\"><tr class=\"head map\"><th>Board<th>Hardware<th>Design<th>Compile Time<th>Temperature\n";
+  printlist(0,1);
+  print "</table>";
+  
+  sub printlist {
+    my ($parent,$layer) = @_;
+    if($layer > 16) {die "More than 16 layers of network devices found. Aborting."}
+    my @o;
+    foreach my $p (keys @{$tree->{$parent}}) {
+      next unless defined $tree->{$parent}->[$p];
+      my $addr = $tree->{$parent}->[$p]->{addr};
+      my $btype = "";
+      for($hardware->{$addr}>>24&0xff) {
+        when (0x90) {$btype= "TRB3 central";}
+        when (0x91) {$btype= "TRB3 periph";}
+        when (0x92) {$btype= "CBM-Rich";}
+        when (0x93) {$btype= "CBM-Tof";}
+        when (0x62) {$btype= "Hub AddOn";}
+        when (0x52) {$btype= "CTS";}
+        when (0x42) {$btype= "Shower AddOn";}
+        when (0x33) {$btype= "RICH ADCM"; }
+        when (0x23) {$btype= "MDC OEP"; }
+        when (0x12) {$btype= "MDC Hub"; }
+        }
+      my $addontype = "";  
+      if(($hardware->{$addr}>>24&0xff) == 0x91) {
+        for($hardware->{$addr}>>12 & 0x7) {
+          when (0) {$addontype= " & ADA v1";}
+          when (1) {$addontype= " & ADA v2";}
+          when (2) {$addontype= " & Multitest";}
+          when (3) {$addontype= " & SFP";}
+          when (4) {$addontype= " & Padiwa";}
+          when (5) {$addontype= " & GPIN";}
+          when (6) {$addontype= " & Nxyter";}
+          when (7) {$addontype= " & 32PinAddOn";}
+          when (9) {$addontype= " & MVD AddOn 13";}
+          }
+        }      
+      my $feat = "";
+      my $table = $inclHigh->{$addr}>>24&0xFF;
+      if($table == 0) {
+        my $hw = $hardware->{$addr};
+        if(($hw>>24&0xff) == 0x91 || ($hw>>24&0xff) == 0x92 || ($hw>>24&0xff) == 0x93) {
+          if(($hw & 0x8000) == 0x8000) {$feat .= "RX sync, ";}
+          if(($hw & 0x0b00) == 0x000 && ($hw>>12 & 0x7) != 6 && ($hw>>12 & 0x7) != 3 && ($hw>>7 & 0x1) != 1) 
+                                                      {$feat .= "TDC, single, ".(2**($hw>>4&0xf))."ch, ";}
+          if(($hw & 0xf000) == 0x6000) {$feat .= "Nxyter RDO, ";}
+          if(($hw & 0x0900) == 0x100)  {$feat .= "TDC, double, ".(2**($hw>>4&0xf))."ch, ";}
+          if(($hw & 0x0900) == 0x800)  {$feat .= "TDC, dbl-sep, ".(2**($hw>>4&0xf))."ch, ";}
+          if(($hw & 0x0200) == 0x200)  {$feat .= "Hub, ";}
+          if(($hw & 0x0400) == 0x400)  {$feat .= "SPI, ";}
+          if(($hw & 0x00f0) == 0x090)  {$feat .= "MVD rdo 2013, ";}
+          $feat = substr($feat,0,-2);
+          }
+        if(($hw>>24&0xff) == 0x90) {
+          if(($hw & 0xf001) == 0xc000) {$feat .= "CTS, ";}
+          if(($hw & 0xf001) == 0xc001) {$feat .= "CTS w/AddOn, ";}
+          if(($hw & 0x0f00) == 0x0e00) {$feat .= "GbE sctrl rdo, ";}
+          if(($hw & 0x0f00) == 0x0d00) {$feat .= "GbE rdo, ";}
+          if(($hw & 0x0010) != 0x0000) {$feat .= "opt. trg in, ";}
+          if(($hw & 0x0020) != 0x0000) {$feat .= "opt. sctrl in, ";}
+          if(($hw & 0x0040) != 0x0000) {$feat .= "opt. trg out, ";}
+          if(($hw & 0x0080) != 0x0000) {$feat .= "opt. sctrl out, ";}
+          $feat = substr($feat,0,-2);          
+          }
+        }
+      if($table == 1) {
+        $feat = "Table1";
+        }
+      if($table == 2) {
+        if($inclLow->{$addr}&0x1000 || 1) {  # ||1 just because this not implemented yet in the test design..
+          $feat .="\nTDC:";
+          my $d = trb_register_read($addr,0xc100);
+          $feat .= " ".($d->{$addr}>>8&0xFF)." channels";
+          for($inclLow->{$addr}&0xFF) {
+            when (0) {$feat .=", input select by mux";}
+            when (1) {$feat .=", input 1-to-1";}
+            when (2) {$feat .=", on every second input";}
+            when (3) {$feat .=", on every fourth input";}
+            }
+          for($inclLow->{$addr}>>8&0xF) {
+            when (0) {$feat .=", single edge";}
+            when (1) {$feat .=", dual edge in same channel";}
+            when (2) {$feat .=", dual edge in alternating channels";}
+            when (3) {$feat .=", dual edge same channel + stretcher";}
+            }
+          }
+        }
+      if($table == 1 || $table == 2) {
+        if ($inclHigh->{$addr} & 0x400) { $feat .= "\nSPI";}
+        if ($inclHigh->{$addr} & 0x800) { $feat .= "\nUART";}
+        if ($inclHigh->{$addr}>>12&0xF) {
+          $feat .= "\nInput monitor:";
+          my $d = trb_register_read($addr,0xcf8f);
+          $feat .= " ".($d->{$addr}>>8&0x1F)." inputs";
+          $feat .= ", single Fifo" if     $d->{$addr}&0x1000;
+          $feat .= ", indiv. Fifos" unless $d->{$addr}&0x1000;
+          }
+        for($inclHigh->{$addr}>>16&0xF) {  
+          when(1) {$feat .="\nTrigger Module: simple or";}
+          when(2) {$feat .="\nTrigger Module: edge detect";}
+          }
+        for($inclHigh->{$addr}>>20&0xF) {  
+          when(0) {$feat .="\nClock: on-board 200 MHz";}
+          when(1) {$feat .="\nClock: on-board 125 MHz";}
+          when(2) {$feat .="\nClock: received 200 MHz";}
+          when(3) {$feat .="\nClock: received 125 MHz";}
+          when(4) {$feat .="\nClock: external 200 MHz";}
+          when(5) {$feat .="\nClock: external 125 MHz";}
+          }    
+        }
+      
+      printf("<tr class=\"level level%i%s\"><td><div>%i</div>0x%04x<td title=\"0x%08x\">%s<td title=\"0x%08x%08x\n%s\">%s<td title=\"0x%08x\">%s<td>%.1f°C\n",
+                      $layer,
+                      ($layer!=$lastlayer?' newlevel':' oldlevel'),
+                      $p,
+                      $addr,
+                      $hardware->{$addr},
+                      $btype.$addontype,
+                      $inclHigh->{$addr},
+                      $inclLow->{$addr},
+                      $feat,
+                      substr($feat,0,40).(length($feat)>40?"...":""),
+                      $ctime->{$addr},
+                      time2str('%Y-%m-%d %H:%M',$ctime->{$addr}),
+                      ($temp->{$addr}>>20)/16);
+      $lastlayer = $layer;
+      printlist($tree->{$parent}->[$p]->{addr},$layer+1);
+      }
+    return 0;
+    }
   }
   
 ###############################################################################  
@@ -37,7 +203,7 @@ else {
   $setup[0]->{name}    = "NetworkMap";
   $setup[0]->{cmd}     = "getmap";
   $setup[0]->{period}  = -1;
-  $setup[0]->{noaddress} = 0;
+  $setup[0]->{noaddress} = 1;
   $setup[0]->{generic}   = 0;
 
   xmlpage::initPage(\@setup,$page);