]> jspc29.x-matter.uni-frankfurt.de Git - daqtools.git/commitdiff
user files for trb3 test
authorTim <tim@kp1pc105.gsi.de>
Mon, 28 Oct 2013 13:51:39 +0000 (14:51 +0100)
committerTim <tim@kp1pc105.gsi.de>
Mon, 28 Oct 2013 13:51:39 +0000 (14:51 +0100)
users/gsi_trb3_test/configure_trb3.sh [new file with mode: 0755]
users/gsi_trb3_test/merge_serial_address.pl [new file with mode: 0755]
users/gsi_trb3_test/startup.sh [new file with mode: 0755]

diff --git a/users/gsi_trb3_test/configure_trb3.sh b/users/gsi_trb3_test/configure_trb3.sh
new file mode 100755 (executable)
index 0000000..1af363f
--- /dev/null
@@ -0,0 +1,58 @@
+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 0xc0a80002   # destination IP-address: 192.168.0.2
+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 0xc0a80115   # source IP trb021
+#trbcmd w 0x8000 0x8106 0xc0a80123   # source IP trb035
+trbcmd w 0x8000 0x8106 0xc0a80159   # source IP trb089
+trbcmd w 0x8000 0x8107 0xc353       # source Port
+trbcmd w 0x8000 0x8108 0x578        # MTU
+
+
+
+###################################################################################
+# # slave                                                                        #
+# 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 0xc0a80002   # destination IP-address: 192.168.0.2      #
+# 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 0xc0a80115   # source IP trb021                         #
+# #trbcmd w 0x8001 0x8106 0xc0a80123   # source IP trb035                        #
+# trbcmd w 0x8001 0x8107 0xc353       # source Port                              #
+# trbcmd w 0x8001 0x8108 0x578        # MTU                                      #
+###################################################################################
diff --git a/users/gsi_trb3_test/merge_serial_address.pl b/users/gsi_trb3_test/merge_serial_address.pl
new file mode 100755 (executable)
index 0000000..8684ecd
--- /dev/null
@@ -0,0 +1,71 @@
+#!/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;
+}
diff --git a/users/gsi_trb3_test/startup.sh b/users/gsi_trb3_test/startup.sh
new file mode 100755 (executable)
index 0000000..1a94a45
--- /dev/null
@@ -0,0 +1,52 @@
+#!/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 0x0000000f ## channel 01-31 enable
+trbcmd w 0xfe48 0xc803 0x00000000 ## channel 32-63 enable
+trbcmd w 0xfe48 0xc804 0x00000080 ## 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
+trbcmd w 0x8000 0xa138 0x00002710
+
+# pulser enable
+#trbcmd setbit 0x8000 0xa101 0x2
+trbcmd clearbit 0x8000 0xa101 0x2
+trbcmd setbit 0x8000 0xa101 0x4