From 26c0af6061710ee25b0de54c60796c6c0d9d5eac Mon Sep 17 00:00:00 2001 From: Jan Michel Date: Fri, 19 Jul 2013 17:25:12 +0200 Subject: [PATCH] writeram via libtrbnet for debugging --- soft/toolbox/jtag_atomic/ui_writeram.pl | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/soft/toolbox/jtag_atomic/ui_writeram.pl b/soft/toolbox/jtag_atomic/ui_writeram.pl index 90c6cd9..e69f319 100755 --- a/soft/toolbox/jtag_atomic/ui_writeram.pl +++ b/soft/toolbox/jtag_atomic/ui_writeram.pl @@ -324,7 +324,7 @@ foreach my $chain (keys %allchains) { $word = $word + scalar @irs; ### $word = ($word<<16) + pack("L", scalar(@irs)); print $handle "0x" . uc (substr(reverse(join('',unpack("h8", pack("L", $word)))),0,8)) . "\t# IRlen & numregs \n"; - push(@{$memhash->{$setting_name}},$word); + push(@{$memhash->{$memfilename}},$word); #####print $handle "0x" .uc (substr(reverse(join('',unpack("h8", pack("L", scalar($this_irlen))))),4,4)) . uc (substr(reverse(join('',unpack("h8", pack("L", scalar(@irs))))),4,4)) . "\t# IRlen & numregs \n"; #print "reverse test: " . reverse32bit(0x00000001)."\n"; @@ -336,7 +336,7 @@ foreach my $chain (keys %allchains) { # write DEV_ID $word = 0x4D323601; print $handle "0x" . uc (substr(reverse(join('',unpack("h8", pack("L", $word)))),0,8)) . "\t# DEV_ID \n"; - push(@{$memhash->{$setting_name}},$word); + push(@{$memhash->{$memfilename}},$word); $crcword = pack("L", reverse32bit($word)); $crc0 = crc32($crcword, $crc0); my $crc0_rn = ~reverse32bit($crc0); @@ -350,14 +350,14 @@ foreach my $chain (keys %allchains) { $crcword = pack("L", reverse32bit($word)); $crc0 = crc32($crcword, $crc0); print $handle "0x" . uc (substr(reverse(join('',unpack("h8", pack("L", $word)))),0,8)) . "\t# Pointer + reserved \n"; - push(@{$memhash->{$setting_name}},$word); + push(@{$memhash->{$memfilename}},$word); $word = $drlen; $crcword = pack("L", reverse32bit($word)); $crc0 = crc32($crcword, $crc0); #print $handle "0x0000". uc (substr(reverse(join('',unpack("h8", pack("L", scalar($drlen))))),4,4)) . "\t# Length\n"; print $handle "0x" . uc (substr(reverse(join('',unpack("h8",pack("L", $word)))),0,8)) . "\t# Length\n"; - push(@{$memhash->{$setting_name}},$word); + push(@{$memhash->{$memfilename}},$word); $offset += floor(($drlen+31)/32); } # write CRC-32 @@ -366,7 +366,7 @@ foreach my $chain (keys %allchains) { #printf "CRC: %0.8X.\n", $crc0_rn, 1; my $line_crc = sprintf "%0.8X", $crc0_rn; print $handle "0x". substr($line_crc,length($line_crc)-8,8) . "\t# CRC-32\n"; - push(@{$memhash->{$setting_name}},$crc0_rn); + push(@{$memhash->{$memfilename}},$crc0_rn); my $crc1 = 0xFFFFFFFF; # write IRs @@ -378,7 +378,7 @@ foreach my $chain (keys %allchains) { $crcword = pack("L", reverse32bit($word)); $crc1 = crc32($crcword, $crc1); print $handle "0x".("0"x(8-length($ir))).uc($ir) . "\t# IR\n"; - push(@{$memhash->{$setting_name}},hex($ir)); + push(@{$memhash->{$memfilename}},hex($ir)); } # write BYPASSREG IR @@ -386,7 +386,7 @@ foreach my $chain (keys %allchains) { $crcword = pack("L", reverse32bit($word)); $crc1 = crc32($crcword, $crc1); print $handle "0x".("0"x(8-length($bypassreg))).uc($bypassreg) . "\t# IR BYPASS\n"; - push(@{$memhash->{$setting_name}},hex($bypassreg)); + push(@{$memhash->{$memfilename}},hex($bypassreg)); # write DRs for(my $reg_i=0;$reg_i<@irs;$reg_i++) { @@ -401,14 +401,14 @@ foreach my $chain (keys %allchains) { $crc1 = crc32($crcword, $crc1); my $linestr = "0x". substr($drs[$reg_i],($numwords-$i-1)*8,8) . "\t# DR" . $reg_i . "\n"; print $handle $linestr; - push(@{$memhash->{$setting_name}},hex(substr($drs[$reg_i],($numwords-$i-1)*8,8))); + push(@{$memhash->{$memfilename}},hex(substr($drs[$reg_i],($numwords-$i-1)*8,8))); } } #write CRC-32 my $crc1_rn = ~reverse32bit($crc1); $line_crc = sprintf "%0.8X", $crc1_rn; print $handle "0x". substr($line_crc,length($line_crc)-8,8) . "\t# CRC-32\n"; - push(@{$memhash->{$setting_name}},$crc1_rn); + push(@{$memhash->{$memfilename}},$crc1_rn); } } # my $numchips_hex = int_to_32bit_hex(scalar @sensors); @@ -439,7 +439,14 @@ foreach my $chain (keys %allchains) { #if(not defined($opt_quiet)) { print "trbcmd wm $fpga_addr $ram_addr 0 $memfilenames[$i]\n"; } #$result = `trbcmd wm $fpga_addr $ram_addr 0 $memfilenames[$i]`; execute_shell_command("trbcmd wm $fpga_addr $ram_addr 0 $memfilenames[$i]", ""); + + print "---------------\n"; + foreach my $s ($memhash->{$memfilenames[$i]}) { + printf("0x%08X\n",$s); + } + print "---------------\n"; } + #if(not defined($opt_quiet)){ print "trbcmd w $fpga_addr $cmd_reg_addr 0x00000009\n"; } # CMD_START #$result = `trbcmd w $fpga_addr $cmd_reg_addr 0x00000009\n`; # CMD_START trb_register_write($fpga_addr, $cmd_reg_addr, 0x00000009); @@ -449,9 +456,7 @@ foreach my $chain (keys %allchains) { print "done.\n"; syslog("INFO", "$chain done.\n"); } -print "---------------\n"; -print Dumper $memhash; -print "---------------\n"; + print $handle_lastprog $initmem_folder; # #print "data registers for FPGA $fpga_addr:", map { "$_ => $drs_binary{$_}\n" } keys %drs_binary; # $drs_offset{$irs[0]} = 4+(scalar @irs)*2; -- 2.43.0