]> jspc29.x-matter.uni-frankfurt.de Git - jtag_mvd.git/commitdiff
some error checking
authorJan Michel <j.michel@gsi.de>
Wed, 13 Mar 2013 17:27:08 +0000 (18:27 +0100)
committerJan Michel <j.michel@gsi.de>
Wed, 13 Mar 2013 17:27:08 +0000 (18:27 +0100)
soft/toolbox/jtag_atomic/the_gui.pl

index f3663b7d447fa016ed39cd3de0039bde5671e846..161c6a4dbfa0c1704182e8756966aaf74337053b 100755 (executable)
@@ -2,6 +2,7 @@
 use strict;
 use warnings;
 use lib "./libs/";
+use BN::CRC32;
 use Config::Abstract::Ini;
 use POSIX qw(strftime);
 use FileHandle;
@@ -17,8 +18,8 @@ if(not( -e "/tmp/jtag_initmem")) {
 #use lib "/d/sugar/bneumann/vhdl/jtag_proj/trb_maps_jtag2/ui/";
 #use lib "/d/sugar/bneumann/vhdl/jtag_proj/trb_maps_jtag2/ui/BN/blib/arch";
 
-use lib "BN/blib/arch";
-use BN::CRC32;
+use lib "libs/blib/arch";
+
 #use String::CRC32;
 
 #use feature "state";
@@ -116,7 +117,7 @@ sub memfile_writeline($$$$) {
 my $gladexml = Gtk2::GladeXML->new('gui/design/window3_libglade.glade');
 my  $textview_msg = $gladexml->get_widget('textview_msg');
 my  $textview_msgdetailed = $gladexml->get_widget('textview_msgdetailed');
-my $logfilehandle = FileHandle->new('gui3log.txt', 'a');
+my $logfilehandle = FileHandle->new('gui3log.txt', 'a') or die "Can't open logfile";
 
 sub report {
         # log to logfile
@@ -207,7 +208,7 @@ sub generate_h_man_maps_reset {
     reportd "regval: ". substr($regval, 8, 10). "\n";
     my $resetnormal = substr($regval, 8, 10);
 #    my $resetinv = int_to_32bit_hex((~(0b10000000000)) & hex_to_32bit_int($resetnormal));
-    my $resetinv = int_to_32bit_hex((~(1<<10)) & hex($resetnormal));
+    my $resetinv = int_to_32bit_hex((~(1 << 10 )) & hex($resetnormal));
     execute_shell_command("trbcmd w $fpga_addr $conf_signals_addr 0x$resetinv 2>&1 && sleep 1 && trbcmd w $fpga_addr $conf_signals_addr $resetnormal 2>&1", "");
   }
 }
@@ -245,11 +246,11 @@ sub generate_h_maps_reset_signal {
     my $newval;
     if($onoroff == 0) {
            #off
-      $newval = int_to_32bit_hex((~(1<<11)) & hex($before));
+      $newval = int_to_32bit_hex((~(1<< 11)) & hex($before));
     }
     else {
            #on
-      $newval = int_to_32bit_hex(((1<<11)) | hex($before));
+      $newval = int_to_32bit_hex(((1<< 11)) | hex($before));
     }
     execute_shell_command("trbcmd w $fpga_addr $conf_signals_addr 0x$newval", "");
   }
@@ -267,11 +268,11 @@ sub generate_h_maps_clk_signal {
     my $newval;
     if($onoroff == 0) {
            #off
-      $newval = int_to_32bit_hex((~(1<<13)) & hex($before));
+      $newval = int_to_32bit_hex((~(1<< 13)) & hex($before));
     }
     else {
            #on
-      $newval = int_to_32bit_hex(((1<<13)) | hex($before));
+      $newval = int_to_32bit_hex(((1<< 13)) | hex($before));
     }
     execute_shell_command("trbcmd w $fpga_addr $conf_signals_addr 0x$newval\n", "");
   }
@@ -704,7 +705,7 @@ sub reload_chainsini {
         @drs_length = ();
         my $sensorfile = $settings{$setting_name};
         reportd "loading sensor file: $sensorfile\n";
-        my $sensorSettingsO = new Config::Abstract::Ini("/daq/toolbox/sensors/".$sensorfile);
+        my $sensorSettingsO = new Config::Abstract::Ini("../sensors/".$sensorfile);
         my %sensorSettings = $sensorSettingsO->get_all_settings;
         my $this_irlen = $sensorSettingsO->get_entry_setting('General', 'IRLEN', '5');
         my $bypassreg  = $sensorSettingsO->get_entry_setting('General', 'BYPASSREG', '1F');
@@ -741,7 +742,7 @@ sub reload_chainsini {
           die ("Error: RAM text file \"$memfilename\" exists.");
         }
         reportd "Opening $memfilename...\n";
-        my $handle = FileHandle->new($memfilename, 'w');
+        my $handle = FileHandle->new($memfilename, 'w') or die "Can't create memfile";
         push(@memfilenames, $memfilename);
         # write numregs + IRlen
         my $word = scalar($this_irlen)<<16;