From 932ea866e9945d463364f65f341c244a0b1212cf Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Wed, 13 Mar 2013 18:27:08 +0100 Subject: [PATCH] some error checking --- soft/toolbox/jtag_atomic/the_gui.pl | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/soft/toolbox/jtag_atomic/the_gui.pl b/soft/toolbox/jtag_atomic/the_gui.pl index f3663b7..161c6a4 100755 --- a/soft/toolbox/jtag_atomic/the_gui.pl +++ b/soft/toolbox/jtag_atomic/the_gui.pl @@ -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; -- 2.43.0