0x0313 59 3
0x8000 59 5
-0x0310 60 0
-0x0311 60 1
-0x0312 60 2
-0x0313 60 3
+0xc000 60 0
+0xc001 60 1
+0x8004 60 2
+0xc003 60 3
0x8000 60 5
-0x0310 61 0
-0x0311 61 1
-0x0312 61 2
-0x0313 61 3
-0x8000 61 5
-
-0x0310 62 0
-0x0311 62 1
-0x0312 62 2
-0x0313 62 3
-0x8000 62 5
-
-0x0310 63 0
-0x0311 63 1
-0x0312 63 2
-0x0313 63 3
-0x8000 63 5
+0xc004 61 0
+0xc005 61 1
+0xc006 61 2
+0xc007 61 3
+0x8001 61 5
+
+0xc008 62 0
+0xc009 62 1
+0xc00a 62 2
+0xc00b 62 3
+0x8002 62 5
+
+0xc00c 63 0
+0xc00d 63 1
+0xc00e 63 2
+0xc00f 63 3
+0x8003 63 5
0x0310 64 0
0x0311 64 1
--- /dev/null
+# Board Chain ChainLen DAC Channel Command Value
+!Reference 3300
+ fe48 1 4 0 0 3 0000 #mV
+ fe48 1 4 0 1 3 0330 #mV
+ fe48 1 4 0 2 3 0660 #mV
+ fe48 1 4 0 3 3 0990 #mV
+ fe48 1 4 0 4 3 1320 #mV
+ fe48 1 4 0 5 3 1650 #mV
+ fe48 1 4 0 6 3 1980 #mV
+ fe48 1 4 0 7 3 2310 #mV
+
+ fe48 1 4 1 0 3 0000 #mV
+ fe48 1 4 1 1 3 0330 #mV
+ fe48 1 4 1 2 3 0660 #mV
+ fe48 1 4 1 3 3 0990 #mV
+ fe48 1 4 1 4 3 1320 #mV
+ fe48 1 4 1 5 3 1650 #mV
+ fe48 1 4 1 6 3 1980 #mV
+ fe48 1 4 1 7 3 2310 #mV
+
+ fe48 1 4 2 0 3 0000 #mV
+ fe48 1 4 2 1 3 0330 #mV
+ fe48 1 4 2 2 3 0660 #mV
+ fe48 1 4 2 3 3 0990 #mV
+ fe48 1 4 2 4 3 1320 #mV
+ fe48 1 4 2 5 3 1650 #mV
+ fe48 1 4 2 6 3 1980 #mV
+ fe48 1 4 2 7 3 2310 #mV
+
+ fe48 1 4 3 0 3 0000 #mV
+ fe48 1 4 3 1 3 0330 #mV
+ fe48 1 4 3 2 3 0660 #mV
+ fe48 1 4 3 3 3 0990 #mV
+ fe48 1 4 3 4 3 1320 #mV
+ fe48 1 4 3 5 3 1650 #mV
+ fe48 1 4 3 6 3 1980 #mV
+ fe48 1 4 3 7 3 2310 #mV
--- /dev/null
+# CTS Board 0x8000
+trbcmd w 0x8000 0x8300 0x8000 # SubeventId
+trbcmd w 0x8000 0x8301 0x00020001 # SubEventDecoding
+trbcmd w 0x8000 0x8302 0x00030062 # Queue decoding
+trbcmd w 0x8000 0x8303 0xea60 # max packet size
+trbcmd w 0x8000 0x8304 0x0578 # max frame size
+trbcmd w 0x8000 0x8305 0x1 # use GbE
+trbcmd w 0x8000 0x8306 0x0 # use TRBnet to send data
+trbcmd w 0x8000 0x8307 0x0 # Multi event queue size
+trbcmd w 0x8000 0x8308 0xffffff # Trigger counter
+trbcmd w 0x8000 0x830b 0x7 # ??
+trbcmd w 0x8000 0x830d 0x1 # enable readout bit
+
+#mac address of the EB
+#kp1pc105 00:1b:21:43:97:ea
+trbcmd w 0x8000 0x8100 0x214397ea # lower 4 bytes
+trbcmd w 0x8000 0x8101 0x001b # upper two bytes
+
+trbcmd w 0x8000 0x8102 0xc0a80001 # destination IP-address: 192.168.0.1
+trbcmd w 0x8000 0x8103 0xc350 # destination port 50000
+trbcmd w 0x8000 0x8104 0xdead0110 # source MAC-address
+trbcmd w 0x8000 0x8105 0x001b # source MAC: upper bytes
+trbcmd w 0x8000 0x8106 0xc0a8013c # source IP trb060
+trbcmd w 0x8000 0x8107 0xc353 # source Port
+trbcmd w 0x8000 0x8108 0x578 # MTU
+
+
+
+# Slave 1 0x8001
+trbcmd w 0x8001 0x8300 0x8001 # SubeventId
+trbcmd w 0x8001 0x8301 0x00020001 # SubEventDecoding
+trbcmd w 0x8001 0x8302 0x00030062 # Queue decoding
+trbcmd w 0x8001 0x8303 0xea60 # max packet size
+trbcmd w 0x8001 0x8304 0x0578 # max frame size
+trbcmd w 0x8001 0x8305 0x1 # use GbE
+trbcmd w 0x8001 0x8306 0x0 # use TRBnet to send data
+trbcmd w 0x8001 0x8307 0x0 # Multi event queue size
+trbcmd w 0x8001 0x8308 0xffffff # Trigger counter
+trbcmd w 0x8001 0x830b 0x7 # ??
+trbcmd w 0x8001 0x830d 0x1 # enable readout bit
+
+#mac address of the EB
+#kp1pc105 00:1b:21:43:97:ea
+trbcmd w 0x8001 0x8100 0x214397ea # lower 4 bytes
+trbcmd w 0x8001 0x8101 0x001b # upper two bytes
+
+trbcmd w 0x8001 0x8102 0xc0a80001 # destination IP-address: 192.168.0.1
+trbcmd w 0x8001 0x8103 0xc352 # destination port 50002
+ # port 50001 is for debug messages from GbE
+trbcmd w 0x8001 0x8104 0xdead0110 # source MAC-address
+trbcmd w 0x8001 0x8105 0x001b # source MAC: upper bytes
+trbcmd w 0x8001 0x8106 0xc0a8013d # source IP trb061
+trbcmd w 0x8001 0x8107 0xc353 # source Port
+trbcmd w 0x8001 0x8108 0x578 # MTU
+
+
+# Slave 2 0x8002
+trbcmd w 0x8002 0x8300 0x8002 # SubeventId
+trbcmd w 0x8002 0x8301 0x00020001 # SubEventDecoding
+trbcmd w 0x8002 0x8302 0x00030062 # Queue decoding
+trbcmd w 0x8002 0x8303 0xea60 # max packet size
+trbcmd w 0x8002 0x8304 0x0578 # max frame size
+trbcmd w 0x8002 0x8305 0x1 # use GbE
+trbcmd w 0x8002 0x8306 0x0 # use TRBnet to send data
+trbcmd w 0x8002 0x8307 0x0 # Multi event queue size
+trbcmd w 0x8002 0x8308 0xffffff # Trigger counter
+trbcmd w 0x8002 0x830b 0x7 # ??
+trbcmd w 0x8002 0x830d 0x1 # enable readout bit
+
+#mac address of the EB
+#kp1pc105 00:1b:21:43:97:ea
+trbcmd w 0x8002 0x8100 0x214397ea # lower 4 bytes
+trbcmd w 0x8002 0x8101 0x001b # upper two bytes
+
+trbcmd w 0x8002 0x8102 0xc0a80001 # destination IP-address: 192.168.0.1
+trbcmd w 0x8002 0x8103 0xc353 # destination port 50003
+ # port 50001 is for debug messages from GbE
+trbcmd w 0x8002 0x8104 0xdead0110 # source MAC-address
+trbcmd w 0x8002 0x8105 0x001b # source MAC: upper bytes
+trbcmd w 0x8002 0x8106 0xc0a8013e # source IP trb062
+trbcmd w 0x8002 0x8107 0xc353 # source Port
+trbcmd w 0x8002 0x8108 0x578 # MTU
+
+
+# Slave 3 0x8003
+trbcmd w 0x8003 0x8300 0x8003 # SubeventId
+trbcmd w 0x8003 0x8301 0x00020001 # SubEventDecoding
+trbcmd w 0x8003 0x8302 0x00030062 # Queue decoding
+trbcmd w 0x8003 0x8303 0xea60 # max packet size
+trbcmd w 0x8003 0x8304 0x0578 # max frame size
+trbcmd w 0x8003 0x8305 0x1 # use GbE
+trbcmd w 0x8003 0x8306 0x0 # use TRBnet to send data
+trbcmd w 0x8003 0x8307 0x0 # Multi event queue size
+trbcmd w 0x8003 0x8308 0xffffff # Trigger counter
+trbcmd w 0x8003 0x830b 0x7 # ??
+trbcmd w 0x8003 0x830d 0x1 # enable readout bit
+
+#mac address of the EB
+#kp1pc105 00:1b:21:43:97:ea
+trbcmd w 0x8003 0x8100 0x214397ea # lower 4 bytes
+trbcmd w 0x8003 0x8101 0x001b # upper two bytes
+
+trbcmd w 0x8003 0x8102 0xc0a80001 # destination IP-address: 192.168.0.1
+trbcmd w 0x8003 0x8103 0xc354 # destination port 50004
+ # port 50001 is for debug messages from GbE
+trbcmd w 0x8003 0x8104 0xdead0110 # source MAC-address
+trbcmd w 0x8003 0x8105 0x001b # source MAC: upper bytes
+trbcmd w 0x8003 0x8106 0xc0a8013f # source IP trb063
+trbcmd w 0x8003 0x8107 0xc353 # source Port
+trbcmd w 0x8003 0x8108 0x578 # MTU
--- /dev/null
+#!/usr/bin/perl
+
+use warnings;
+use strict;
+
+use Data::Dumper;
+use HADES::TrbNet;
+
+my $fn1 = $ARGV[0];
+my $fn2 = $ARGV[1];
+
+&usage if (!$fn1 || !$fn2);
+
+# check input
+
+open my $fh1, "<", $fn1 or die "could not open $fn1: $!";
+open my $fh2, "<", $fn2 or die "could not open $fn2, $!";
+
+
+trb_init_ports() or die trb_strerror();
+
+my %trb;
+foreach my $cur_ln (<$fh1>) {
+ next if($cur_ln =~ /^\s*#/ or $cur_ln =~ /^\s*$/);
+ (my $serial_nr, my $uid) = $cur_ln =~ /(\d+)\s+(\w+)/;
+ next if (!defined $serial_nr);
+ $serial_nr = int($serial_nr);
+ $trb{$serial_nr}->{'uid'} = $uid;
+}
+
+#print Dumper \%trb;
+
+foreach my $cur_ln (<$fh2>) {
+ next if($cur_ln =~ /^\s*#/ or $cur_ln =~ /^\s*$/);
+ (my $address, my $sernr1, my $sernr2) = $cur_ln =~ /(\w+)\s+(\d+)\s+(\d+)/;
+ my $serial_nr = $sernr1*10 + $sernr2;
+ next if (!defined $serial_nr);
+ $trb{$serial_nr}->{'address'} = hex($address);
+ $trb{$serial_nr}->{'endpoint_nr'} = $sernr2;
+}
+
+
+#print Dumper \%trb;
+
+
+foreach my $serial_nr (keys %trb) {
+ next if(!$trb{$serial_nr}->{'address'} || !defined $trb{$serial_nr}->{'uid'});
+ printf "0x%4.4x ", $trb{$serial_nr}->{'address'};
+ print $trb{$serial_nr}->{'uid'} . " ";
+ printf "0x%2.2x\n", $trb{$serial_nr}->{'endpoint_nr'};
+
+ no warnings 'portable';
+ my $uid = hex($trb{$serial_nr}->{'uid'});
+ use warnings 'portable';
+
+ my $ref = trb_set_address($uid, $trb{$serial_nr}->{'endpoint_nr'} , $trb{$serial_nr}->{'address'});
+
+}
+
+
+exit;
+
+sub usage {
+ print <<EOF;
+usage:
+merge_serial_address.pl <serials.db> <address.db>
+
+EOF
+
+exit;
+}
--- /dev/null
+#!/bin/sh
+# PATH should already be marked as exported...
+#PATH=${HOME}/trbsoft/bin:${PATH}
+#PATH=${HOME}/trbsoft/daqdata/bin:${PATH}
+#PATH=${HOME}/trbsoft/trbnettools/bin:${PATH}
+export TRB3_SERVER=trb060
+export DAQOPSERVER=localhost:60
+
+
+##################################################
+## Set addresses
+##################################################
+./merge_serial_address.pl ~/trbsoft/daqtools/base/serials_trb3.db ~/trbsoft/daqtools/base/addresses_trb3.db > /dev/null
+
+##################################################
+## System Reset
+##################################################
+trbcmd reset
+
+##################################################
+## Configure GbE for DAQ
+##################################################
+./configure_trb3.sh # central hub configuration to send data via GbE
+
+##################################################
+## Configure TDCs
+##################################################
+trbcmd setbit 0xfe48 0xc800 0x00001000 ## Triggerless mode
+#trbcmd clearbit 0xfe48 0xc800 0x00001000 ## Triggered mode
+
+trbcmd w 0xfe48 0xc801 0x000f0005 ## trigger window enable & trigger window width
+trbcmd w 0xfe48 0xc802 0x00000000 ## channel 01-31 enable
+trbcmd w 0xfe48 0xc803 0x00000000 ## channel 32-63 enable
+trbcmd w 0xfe48 0xc804 0x00000010 ## data transfer limit
+
+##################################################
+## Other Settings
+##################################################
+# Reset trigger logic - only a workaround for a bug
+trbcmd w 0xffff 0x20 0x33
+
+# timeouts
+trbcmd w 0xfffe 0xc5 0x800050ff
+
+# pulser #1 to 1k Hz
+trbcmd w 0x8000 0xa137 0x0001869f
+
+# pulser enable
+#trbcmd setbit 0x8000 0xa101 0x2
+trbcmd clearbit 0x8000 0xa101 0x2