--- /dev/null
+#!/usr/bin/perl -w
+&htsponse(200, "OK");
+print "Content-type: text/html\r\n\r\n";
+
+
+
+use HADES::TrbNet;
+use Data::Dumper;
+
+ if (!defined &trb_init_ports()) {
+ die("can not connect to trbnet-daemon on the $ENV{'DAQOPSERVER'}");
+ }
+
+my ($board,$task) = split('-',$ENV{'QUERY_STRING'});
+$board = hex($board);
+
+
+
+sub sendcmd {
+ my ($cmd,$chain) = @_;
+ my $c = [$cmd,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1<<$chain,1];
+ trb_register_write_mem($board,0xd400,0,$c,scalar @{$c});
+ return trb_register_read($board,0xd412);
+ }
+
+
+
+
+my $ret;
+my $num = 1;
+
+for(my $i=0; $i < 4; $i++) {
+ if ($task eq "temp") {
+ $ret->[$i] = sendcmd(0x10040000,$i);
+ }
+ elsif ($task eq "id") {
+ $num = 4;
+ $ret->[$i*4+0] = sendcmd(0x10000000,$i);
+ $ret->[$i*4+1] = sendcmd(0x10010000,$i);
+ $ret->[$i*4+2] = sendcmd(0x10020000,$i);
+ $ret->[$i*4+3] = sendcmd(0x10030000,$i);
+ }
+ }
+
+
+
+
+foreach my $b (sort keys %{$ret->[0]}) {
+ printf ("%04x",$b);
+ for(my $i=0; $i < 4*$num; $i++) {
+ if($task eq "id"){
+ printf(" %04x",$ret->[$i]->{$b} & 0xffff);
+ }
+ else {
+ printf(" %d",$ret->[$i]->{$b});
+ }
+ }
+ print "&";
+ }
+
+
+
+exit 1;
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+<link href="styles.css" rel="stylesheet" type="text/css"/>
+<script src="scripts.js" type="text/javascript"></script>
+<title>Padiwa</title>
+</head>
+<body>
+
+
+<h2>Padiwa</h2>
+<form acion="">
+<table class="form"><tr class="head"><th colspan=2>Configuration
+<tr><td>Board<td><input onChange="setValues()" type="text" id="form_board" name="board" maxlength="4" value="fe48">
+<tr><td>Update Interval (ms)<td><input onChange="setValues()" type="text" id="form_rate" name="rate" maxlength="6" value="10000">
+<tr><td>Option<td><select onChange="setValues()" id="form_option" name="option"><option value="temp">Temperature<option value="id">ID</select>
+<tr><td>Min/Max<td><input onChange="setValues()" type="text" id="form_min" name="min" maxlength="6" value="10"><input onChange="setValues()" type="text" id="form_max" name="max" maxlength="6" value="80">
+<tr><td><td><input type="button" onClick="setValues()" value="OK">
+</table>
+</form>
+
+<div style="float:left"><table id="content"><tr><th>Board</table></div>
+
+
+
+<script language="javascript">
+var updaterate = document.getElementById("form_rate").value;
+var board = document.getElementById("form_board").value;
+var option = document.getElementById("form_option").value;
+var min = document.getElementById("form_min").value;
+var max = document.getElementById("form_max").value;
+var updateTask = setTimeout("getdata('getpadiwa.pl?"+board+"-"+option+"',update)",100);
+
+function setValues() {
+ updaterate = document.getElementById("form_rate").value;
+ board = document.getElementById("form_board").value;
+ option = document.getElementById("form_option").value;
+ min = document.getElementById("form_min").value;
+ max = document.getElementById("form_max").value;
+ clearTimeout(updateTask);
+ updateTask = setTimeout("getdata('getpadiwa.pl?"+board+"-"+option+"',update)",100);
+ }
+
+
+function update(data) {
+ if(!document.getElementById("content").innerHTML) return;
+ var b = data.split("&");
+ var c = {};
+ o = "<tr class=\"head\"><th>Board";
+
+ for(j=0;j<b.length-1;j++) {
+ c[j] = b[j].split(" ");
+ o += "<th>"+c[j][0];
+ }
+
+ for(i = 1; i <= 4; i++) {
+ o += "<tr class=\""+(i%2?"odd":"even")+"\"><th>"+(i-1);
+ for(j=0;j<b.length-1;j++) {
+ if(option == "temp") {
+ val = (((c[j][i]) & 0xFFF)/16);
+ if(val == 0 || val > 250) val = "---";
+ else val = val.toFixed(1)
+ o += "<td class=\"under\" style=\"background:"+findcolor(val,min,max,0)+"\">"+(val);
+ }
+ else if(option == "id") {
+ val = c[j][(i-1)*4+4]+c[j][(i-1)*4+3]+c[j][(i-1)*4+2]+c[j][(i-1)*4+1];
+ o += "<td>"+(val);
+ }
+ }
+ }
+ document.getElementById("content").innerHTML = o;
+ clearTimeout(updateTask);
+ updateTask = setTimeout("getdata('getpadiwa.pl?"+board+"-"+option+"',update)",updaterate);
+ }
+
+
+</script>
+
+</body>
+</html>
\ No newline at end of file