}
for(my $i = 0; $i < $header->{'itc_len'}; $i++) {
- $self->{'_cts'}->getProperties->{'itc_assignments'}[$i + $header->{'itc_base'}] = "Trigger Input $i";
+ if ($self->{'_cts'}->getProperties->{'itc_assignments'}[$i + $header->{'itc_base'}] eq 'unconnected') {
+ $self->{'_cts'}->getProperties->{'itc_assignments'}[$i + $header->{'itc_base'}] = "Trigger Input $i";
+ }
}
# properties
--- /dev/null
+# Module: AddOn Input Multiplexer (Type 0x12)
+package CtsMod12;
+
+@ISA = (CtsBaseModule);
+
+use warnings;
+use strict;
+use TrbRegister;
+
+sub moduleName {"AddOn Input Multiplexer"}
+
+sub init {
+ my $self = $_[0];
+ my $address = $_[1];
+
+ my $trb = $self->{'_cts'}{'_trb'};
+
+ my $regs = $self->{'_registers'};
+ my $prop = $self->{'_properties'};
+
+ my $header = $self->{'_cts'}{'_enum'}{0x12}->read();
+
+# registers
+ for(my $i = 0; $i < $header->{'len'}; $i++) {
+ my $key = "trg_addon_config$i";
+
+ $regs->{$key} = new TrbRegister($address + 1 + $i, $trb, {
+ 'input' => {'lower' => 0, 'len' => 7, 'type' => 'enum', 'enum' =>
+ {
+ 0 => 'jeclin[0]', 1 => 'jeclin[1]', 2 => 'jeclin[2]', 3 => 'jeclin[3]',
+ 4 => 'jin1[0]', 5 => 'jin1[1]', 6 => 'jin1[2]', 7 => 'jin1[3]',
+ 8 => 'jin2[0]', 9 => 'jin2[1]', 10 => 'jin2[2]', 11 => 'jin2[3]',
+ 12 => 'nimin1', 13 => 'nimin2'
+ }
+ }
+ }, {
+ 'accessmode' => "rw",
+ 'export' => 1,
+ 'monitor' => '1',
+ 'label' => "AddOn Multiplexer $i"
+ });
+ }
+
+ for(my $i = 0; $i < $header->{'itc_len'}; $i++) {
+ $self->{'_cts'}->getProperties->{'itc_assignments'}[$i + $header->{'itc_base'}] = "AddOn Multiplexer $i";
+ }
+
+# properties
+ $prop->{"trg_addon_count"} = $header->{'len'};
+ $prop->{"trg_addon_itc_base"} = $header->{'itc_base'};
+
+}
+
+1;
\ No newline at end of file
my $trb = $self->{'_cts'}->{'_trb'};
my $debug_block = 0xa000;
+
+ $prop->{'cts_clock_frq'} = 1e8;
+ $prop->{'trb_endpoint'} = $trb->getEndpoint;
+ $prop->{'trb_compiletime'} = $trb->read(0x40);
$regs->{'cts_cnt_trg_asserted'} = TrbRegister->new(0x00 + $debug_block, $trb, {}, {
'accessmode' => "ro",
'monitor' => 1,
'export' => 1
});
+
+ if ($prop->{'trb_compiletime'} > 1366287468) {
+ eval {
+ # really ugly solution, but we currently have to read the register in order
+ # to verify its existing ...
+ $regs->{'cts_eventbuilder'} = TrbRegister->new(0x0d + $debug_block, $trb, {
+ 'mask' => {'lower' => 0, 'len' => 16,'type' => 'mask'},
+ 'rr_interval' => {'lower' => 16, 'len' => 8, 'type' => 'uint'},
+ 'cal_eb' => {'lower' => 24, 'len' => 4, 'type' => 'uint'},
+ 'use_cal_eb' => {'lower' => 28, 'len' => 1, 'type' => 'bool'}
+
+ }, {
+ 'accessmode' => "rw",
+ 'label' => "Event Builder Selection",
+ 'monitor' => 1,
+ 'export' => 1
+ });
+ $regs->{'cts_eventbuilder'}->read();
+ 1;
+ } and do {
+ $prop->{'cts_eventbuilder_rr'} = 1;
+ }
+ }
- $prop->{'cts_clock_frq'} = 1e8;
- $prop->{'trb_endpoint'} = $trb->getEndpoint;
- $prop->{'trb_compiletime'} = $trb->read(0x40);
}
1;
# Debugging
use warnings;
use strict;
- use Carp;
- $SIG{ __DIE__ } = sub { Carp::confess( @_ ) };
+
use lib "./include";
}
}
+ our $endpoint;
+ use Carp;
+ $SIG{ __DIE__ } = sub {
+ my $error = $_[0];
+
+ if ($error =~ /unknown address/ and $error =~ /trb_register_read/ and $error =~ /0xa[012]/) {
+ printf("Endpoint (0x%04x) responded, but could not read CTS registers. Does the endpoint contain a CTS?\n" .
+ "If the CTS uses a different address, change the default endpoint address in\n" .
+ "htdocs/CtsConfig.pm, or use the --endpoint parameter when starting the CTS tool.", $endpoint);
+
+ } elsif ($error =~ /no endpoint has been reached/) {
+ printf("Endpoint (0x%04x) not reached. Please ensure that \n" .
+ "(1) the correct DAQOPSERVER is used and\n" .
+ "(2) the CTS is configured to this address.\n" .
+ "If the CTS uses a different address, change the default endpoint address in\n" .
+ "htdocs/CtsConfig.pm, or use the --endpoint parameter when starting the CTS tool.", $endpoint);
+ }
+
+ print "\n\n\n--------------------- More details error description ------------------------------\n";
+ Carp::confess( @_ );
+
+ exit;
+ };
+
use FileHandle;
}
####################################################################################
-my $endpoint = CtsConfig->getDefaultEndpoint;
+$endpoint = CtsConfig->getDefaultEndpoint;
my $updateInterval = 1000;
my $quiet = 0;
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="layout/base.css" rel="Stylesheet" type="text/css" />
<script src="scripts/mootools-core-1.4.5.js" type="text/javascript"></script>
- <script src="scripts/base.js" type="text/javascript"></script>
+ <script src="scripts/cts.js" type="text/javascript"></script>
</head>
<body lang="en">
</div>
</div>
+ <div class="expandable expanded" id="addon-board-expander">
+ <div class="header"><span class="indicator"></span> AddOn-Board Input Multiplexer</div>
+
+ <div class="content">
+ <table id="addon-board-tab">
+ <tr>
+ <th class="num">#</th>
+ <th class="source">Source</th>
+ <th class="rate">Inp. Rate</th>
+ <th class="invert">Invert</th>
+ <th class="delay">Delay</th>
+ <th class="spike"><abbr title="Noise reducing. High pulses shorter than this values are rejeted">Spike Rej.</abbr></th>
+ <th class="override">Override</th>
+ </tr>
+ </table>
+ </div>
+ </div>
+
<div class="expandable expanded" id="coin-expander">
<div class="header"><span class="indicator"></span> Pulsers</div>
<td class="value"><input type="checkbox" class="autoupdate autocommit" slice="cts_readout_config.trg_cnt" /> Trigger statistics</td>
</tr>
- <tr class="alt">
+ <tr class="">
<td> </td>
<td class="value"><input type="checkbox" class="autoupdate autocommit" slice="cts_readout_config.timestamp" /> Timestamp</td>
</tr>
- <tr class="alt">
- <td class="label">TD FSM Limit (debug only):</td>
+ <tr class="eventbuilder_rr alt"><td colspan="2"> </td><tr>
+<!--
+ <tr class="eventbuilder_rr">
+ <td>Active Event Builder</td>
<td class="value">
- <input class="autocommit autoupdate text" slice="cts_fsm_limits.td"
- format="var f=function(x){return parseInt(x)==0xffff ? 'disabled' : (parseInt(x) ? x + ' events' : 'active')}; f"
- interpret="var f=function(x){return (x.trim() == '' || x.match(/disabled|off/)) ? 0xffff : (isNaN(parseInt(x))?0:parseInt(x))}; f" />
+ <pre>15</pre> <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[15]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[14]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[13]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[12]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[11]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[10]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[9]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[8]"> <pre>8</pre> <br />
+ <pre> 7</pre> <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[7]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[6]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[5]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[4]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[3]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[2]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[1]">
+ <input type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.mask[0]"> <pre>0</pre>
+ </td>
+ </tr>
+
+ <tr class="alt eventbuilder_rr">
+ <td>Round-Robin Bin Size</td>
+ <td class="value">
+ <input class="text autoupdate autocommit" slice="cts_eventbuilder.rr_interval" /> events
</td>
</tr>
- <tr>
- <td class="label">RO FSM Limit (debug only):</td>
+ <tr class="eventbuilder_rr">
+ <td>Event Builder for Calibration <br /> Trigger (Type 0xe)</td>
<td class="value">
- <input class="autocommit autoupdate text" slice="cts_fsm_limits.ro"
- format="var f=function(x){return parseInt(x)==0xffff ? 'disabled' : (parseInt(x) ? x + ' events' : 'active')}; f"
- interpret="var f=function(x){return (x.trim() == '' || x.match(/disabled|off/)) ? 0xffff : (isNaN(parseInt(x))?0:parseInt(x))}; f" />
+ <input id="eb_rr_use" type="checkbox" class="autoupdate autocommit" slice="cts_eventbuilder.use_cal_eb" /> use dedicated EB with Id:
+ <input id="eb_rr" class="text autoupdate autocommit" slice="cts_eventbuilder.cal_eb" />
</td>
</tr>
+-->
</table>
</div>
<td class="label">Buffered Trigger (15:0)</td>
<td class="value autoupdate" slice="cts_buf_trg_state" format="var x=function(x,data){return '<pre>'+ data.f.mask + '</pre>, Type: '+data.f.type}; x">n/a</td>
</tr>
+
+ <tr><td colspan="2"> </td><tr>
+
+ <tr class="alt">
+ <td class="label">TD FSM Limit (debug only):</td>
+ <td class="value">
+ <input class="autocommit autoupdate text" slice="cts_fsm_limits.td"
+ format="var f=function(x){return parseInt(x)==0xffff ? 'disabled' : (parseInt(x) ? x + ' events' : 'active')}; f"
+ interpret="var f=function(x){return (x.trim() == '' || x.match(/disabled|off/)) ? 0xffff : (isNaN(parseInt(x))?0:parseInt(x))}; f" />
+ </td>
+ </tr>
+
+ <tr>
+ <td class="label">RO FSM Limit (debug only):</td>
+ <td class="value">
+ <input class="autocommit autoupdate text" slice="cts_fsm_limits.ro"
+ format="var f=function(x){return parseInt(x)==0xffff ? 'disabled' : (parseInt(x) ? x + ' events' : 'active')}; f"
+ interpret="var f=function(x){return (x.trim() == '' || x.match(/disabled|off/)) ? 0xffff : (isNaN(parseInt(x))?0:parseInt(x))}; f" />
+ </td>
+ </tr>
</table>
</div>
</div>
use File::Basename;
+our $endpoint;
+use Carp;
+$SIG{ __DIE__ } = sub {
+ my $error = $_[0];
+
+ print 'HTTP/1.0 500 INTERNAL SERVER ERROR';
+ print "\r\nContent-Type: text/html;\r\n\r\n";
+
+ print "<pre>\r\n";
+
+ if ($error =~ /unknown address/ and $error =~ /trb_register_read/ and $error =~ /0xa[012]/) {
+ printf("Endpoint (0x%04x) responded, but could not read CTS registers. Does the endpoint contain a CTS?\n" .
+ "If the CTS uses a different address, change the default endpoint address in\n" .
+ "htdocs/CtsConfig.pm, or use the --endpoint parameter when starting the CTS tool.", $endpoint);
+
+ } elsif ($error =~ /no endpoint has been reached/) {
+ printf("Endpoint (0x%04x) not reached. Please ensure that \n" .
+ "(1) the correct DAQOPSERVER is used and\n" .
+ "(2) the CTS is configured to this address.\n" .
+ "If the CTS uses a different address, change the default endpoint address in\n" .
+ "htdocs/CtsConfig.pm, or use the --endpoint parameter when starting the CTS tool.", $endpoint);
+ }
+
+ print "\n\n\n--------------------- More details error description ------------------------------\n";
+ print $error;
+
+ print "</pre>\r\n";
+};
BEGIN {
if (eval "require JSON::PP;") {
sub connectToCTS {
my $trb;
- my $endpoint = CtsConfig->getDefaultEndpoint;
+ $endpoint = CtsConfig->getDefaultEndpoint;
my $cache = {'enumCache' => 0};
my $port = int $ENV{'SERVER_PORT'};
my $cts = connectToCTS( );
+#print Dumper $cts;
+
my $query = $ENV{'QUERY_STRING'};
if ($query eq "init") {
text-align: right;
}
+ .eventbuilder_rr {visibility: hidden;}
\ No newline at end of file
this.renderTriggerChannels();
this.renderTriggerInputs();
this.renderCoins();
+ this.renderTriggerAddOnInputs();
this.renderRegularPulsers();
this.renderRandPulsers();
this.renderCTSDetails();
});
this.addEvent('dataUpdate', this.updateStatusIndicator.bind(this));
+ //this.addEvent('dataUpdate', function() {$('eb_rr').set('disabled', !this.currentData.
+
+ this.initEventBuilderRR();
this.initAutoCommit();
-
this.initSliceTitle();
},
}
},
+
writeRegisters: function(values) {
var arrValues = [];
Object.each(values, function(v,r) {arrValues.push(r); arrValues.push(v)});
dup.removeClass('error').set('text', 'Update').setStyle('display', 'block');
// hard-reset. if request's timeout fails, this is the last resort ...
- var manualTimeout = window.location.reload.delay(10000);
+ var manualTimeout = (function(e) {
+ if (console)
+ console.log(e.stack);
+ window.location.reload.delay(10000);
+ }).delay(10000, this, new Error());
new Request.JSON({
url: this.monitorPrefix + 'dump.js',
}.bind(this)
}).send();
},
+
+ initEventBuilderRR: function() {
+ if (!this.defs.properties.cts_eventbuilder_rr) return;
+ $$('.eventbuilder_rr').setStyle('visibility', 'visible');
+ },
/**
* This method handles all "autorate"-elements. It is registered
* should not by called manually.
*/
renderTriggerInputs: function() {
- for(var i=0; i < this.defs.properties.trg_input_count; i++) {
+ var num = this.defs.properties.trg_input_count;
+ num -= (this.defs.properties.trg_addon_count) ? this.defs.properties.trg_addon_count : 0;
+ for(var i=0; i < num; i++) {
var reg = 'trg_input_config' + i;
$('inputs-tab')
.adopt(
}
},
+/**
+ * Creates all active elements of the AddOn Multiplexer Input Configuration
+ * section. It is called by the class' constructor and hence
+ * should not by called manually.
+ */
+ renderTriggerAddOnInputs: function() {
+ if (!this.defs.properties.trg_addon_count) {
+ $('addon-board-expander').setStyle('display', 'none');
+ return;
+ }
+
+ var from = this.defs.properties.trg_input_count - this.defs.properties.trg_addon_count;
+ var to = this.defs.properties.trg_input_count;
+
+ for(var i=from; i < to; i++) {
+ var reg = 'trg_input_config' + i;
+ var areg = 'trg_addon_config' + (i-from);
+ var en = this.defs.registers[areg]._defs.input.enum;
+ $('addon-board-tab')
+ .adopt(
+ new Element('tr', {'class': i%2?'':'alt', 'flashgroup': 'itc-' + (i + parseInt(this.defs.properties.trg_input_itc_base))})
+ .adopt(
+ new Element('td', {'class': 'num', 'text': i}),
+
+ new Element('td', {'class': 'source'})
+ .adopt(
+ new Element('select', {'class': 'text autocommit autoupdate', 'slice': areg + '.input'})
+ .adopt(
+ Object.values(en).map(function (r) {
+ return new Element('option', {'value': r, 'text': r})
+ })
+ )
+ ),
+
+ new Element('td', {'class': 'rate autorate', 'slice': 'trg_input_edge_cnt' + i + '.value', 'text': 'n/a', 'id': 'inp-rate' + i}),
+
+ new Element('td', {'class': 'invert'})
+ .adopt(
+ new Element('input', {'type': 'checkbox', 'class': 'autocommit autoupdate', 'slice': reg + '.invert'})
+ ),
+
+ new Element('td', {'class': 'delay'})
+ .adopt([
+ new Element('input', {'class': 'text autocommit autoupdate', 'slice': reg + '.delay', 'format': 'countToTime', 'interpret': 'timeToCount'}),
+ new Element('span', {'text': ' ns'})
+ ]),
+
+ new Element('td', {'class': 'spike'})
+ .adopt([
+ new Element('input', {'class': 'text autocommit autoupdate', 'slice': reg + '.spike_rej', 'format': 'countToTime', 'interpret': 'timeToCount'}),
+ new Element('span', {'text': ' ns'})
+ ]),
+
+ new Element('td', {'class': 'override'})
+ .adopt(
+ new Element('select', {'class': 'text autocommit autoupdate', 'slice': reg + '.override'})
+ .adopt([
+ new Element('option', {'value': 'off', 'text': 'bypass'}),
+ new Element('option', {'value': 'to_low', 'text': '-> 0'}),
+ new Element('option', {'value': 'to_high', 'text': '-> 1'}),
+ ])
+ )
+ )
+ );
+ }
+ },
+
+
/**
* Creates all active elements of the Trigger Channel Configuration
* section. It is called by the class' constructor and hence
});
function xhrFailure(xhr){
+ console.log(xhr.responseText);
var m = xhr.responseText.match(/<pre>([\s\S]*)<\/pre>/im);
if (m) alert("Server send error response:\n"+m[1].trim());
else alert("An unknown error while contacting the sever. Did you open this file locally? Did the connection or server crash?");
$self->{'_enumCache'} = $enumCache if ref $enumCache;
- my $static = $self->_loadModule("Static") or die("Error while loading mandantory module >CtsModStatic<");
+ my $static = $self->_loadModule("Static") or exit; #die("Error while loading mandantory module >CtsModStatic<");
+
$static->register();
$self->_enumerateTriggerLogic();