X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=openocd-jtag-boundary-scan.pl;h=dafd8744d4e0973f4305c2ab11befa899f997b17;hb=0e3e3c9f4e9f91da0493308875a5c1f71bf8cea2;hp=001bb28e61b781bf60e570b51e194b76573e4052;hpb=18a36b9061131de8a7df09ba89c7f4a4ad48d528;p=x300-pci diff --git a/openocd-jtag-boundary-scan.pl b/openocd-jtag-boundary-scan.pl index 001bb28..dafd874 100755 --- a/openocd-jtag-boundary-scan.pl +++ b/openocd-jtag-boundary-scan.pl @@ -5,6 +5,7 @@ use strict; use autodie; use Data::Dump qw(dump); use IO::Socket::INET; +use Storable; my $openocd_remote = shift @ARGV || 'picam:4444'; @@ -56,6 +57,7 @@ foreach my $map ( split(/\s*,\s*/, $pin_map) ) { } warn "# pin2io = ",dump( $pin2io ); +store \$pin2io, '/dev/shm/pin2io.storable'; my @sort = sort { my $aa = $a; $aa =~ s/\D+//g; @@ -63,11 +65,12 @@ my @sort = sort { $aa <=> $bb } keys %$io2bit; warn "# sort = ",dump(@sort); +my $last_bits = ''; sub print_io { my $bits = shift; - my $i = 0; -# foreach my $io ( @sort ) { - print "pin off io___ I C O | " x 4, $openocd_remote,"\n"; + $bits = reverse $bits; # make substr work as expected + + print "pin off io___ ICO prv | " x 4, $openocd_remote,"\n"; foreach my $i ( 0 .. ($#$pin2io/4)-1 ) { foreach my $j ( 0 .. 3 ) { #my $pin = ($i*4) + $j + 1; # rows @@ -75,14 +78,17 @@ sub print_io { my $io = $pin2io->[$pin]; my $o = $io2bit->{$io}->[0]; if ( defined $o ) { - printf "%-3d %-3d %-5s %d %d %d | ", $pin, $o, $io, split(//, substr($bits, $o, 3)); + my $l = $b = substr($bits, $o, 3); + $l = substr($last_bits,$o,3) if $last_bits; + printf "%-3d %-3d %-5s %3s %3s | ", $pin, $o, $io, $b, $b ne $l ? $l : '' } else { - printf "%-3d ... %-5s | ", $pin, $io; + printf "%-3d ... %-5s %3s %3s | ", $pin, $io, '', ''; } } print "\n"; } print "\n"; + $last_bits = $bits; } #foreach my $h (qw(0 1 2 e f 10 11 12 1e 1f 20 30 40 50 100 200 1000)) { @@ -144,7 +150,8 @@ sub diff_bits { $o[$i].='>'.$n[$i]; } } - return join('', @o); + my $diff = join('', @o); + print "# diff_bits $diff\n"; } print "[press enter]\n"; @@ -163,7 +170,7 @@ if ( $cmd =~ /(\d+)=(\d)/ ) { . substr($BSR,$bit+3) ; - print diff_bits( $BSR, $b ), $/; + diff_bits( $BSR, $b ), $/; print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD print $sock "drscan x300.tap 288 0x", bin2hex($b), "\n";