projects
/
x300-pci
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
5fc0572
)
specify bsdl file and read boundary length from it
author
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 12 Jun 2016 13:54:32 +0000
(15:54 +0200)
committer
Dobrica Pavlinusic
<dpavlin@rot13.org>
Sun, 12 Jun 2016 13:54:32 +0000
(15:54 +0200)
openocd-jtag-boundary-scan.pl
patch
|
blob
|
history
diff --git
a/openocd-jtag-boundary-scan.pl
b/openocd-jtag-boundary-scan.pl
index
3169f1b
..
1e381e7
100755
(executable)
--- a/
openocd-jtag-boundary-scan.pl
+++ b/
openocd-jtag-boundary-scan.pl
@@
-8,6
+8,8
@@
use IO::Socket::INET;
use Storable;
my $openocd_remote = shift @ARGV || 'picam:4444';
use Storable;
my $openocd_remote = shift @ARGV || 'picam:4444';
+my $bsdl_file = $ENV{BSDL} || '_3128at100.bsd';
+my $BOUNDARY_LENGTH = 288;
my $bit2pin;
my $io2bit;
my $bit2pin;
my $io2bit;
@@
-18,7
+20,7
@@
my $pin_map = '';
$|=1; # flush stdout
$|=1; # flush stdout
-open(my $bsdl, '<',
'_3128at100.bsd'
);
+open(my $bsdl, '<',
$bsdl_file
);
while(<$bsdl>) {
if ( m/PIN_MAP_STRING/ ) {
$pin_map .= $_;
while(<$bsdl>) {
if ( m/PIN_MAP_STRING/ ) {
$pin_map .= $_;
@@
-30,7
+32,11
@@
while(<$bsdl>) {
} elsif ( m/"(\d+)\s+\(BC_\d+,\s+(\S+),\s+(\S+)/ ) {
$bit2pin->{$1} = [ $2, $3 ];
push @{ $io2bit->{$2} }, $1;
} elsif ( m/"(\d+)\s+\(BC_\d+,\s+(\S+),\s+(\S+)/ ) {
$bit2pin->{$1} = [ $2, $3 ];
push @{ $io2bit->{$2} }, $1;
+ } elsif ( m/attribute\s+BOUNDARY_LENGTH\s+of\s+\S+\s*:\s*entity\s+is\s+(\d+);/ ) {
+ $BOUNDARY_LENGTH = $1;
+ warn "# BSDL $bsdl_file BOUNDARY_LENGTH = $BOUNDARY_LENGTH\n";
}
}
+
}
close($bsdl);
}
close($bsdl);
@@
-118,7
+124,7
@@
my $BSR;
# first sample
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
# first sample
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
-print $sock "drscan x300.tap
288
0\n";
+print $sock "drscan x300.tap
$BOUNDARY_LENGTH
0\n";
while(1) {
while(1) {
@@
-148,7
+154,7
@@
sub diff_bits {
if ( $o[$i] eq $n[$i] ) {
$o[$i]='.';
} else {
if ( $o[$i] eq $n[$i] ) {
$o[$i]='.';
} else {
- my $pin = $bit2pin->{
288
- ($i * 3) - 3 }->[0];
+ my $pin = $bit2pin->{
$BOUNDARY_LENGTH
- ($i * 3) - 3 }->[0];
$o[$i] = " $pin:" . $o[$i] . '>' . $n[$i];
}
}
$o[$i] = " $pin:" . $o[$i] . '>' . $n[$i];
}
}
@@
-181,7
+187,7
@@
if ( $cmd =~ /(p|o)(\d+)=(\d+)/ ) {
;
;
- } elsif ( $what eq 'o' && $p <
288
) {
+ } elsif ( $what eq 'o' && $p <
$BOUNDARY_LENGTH
) {
my $o = $p;
#$b = substr($old_bsr,0,$o) . reverse $v . substr($old_bsr,$o+length($v));
$b = ( "0" x $o ) . reverse $v . ( "0" x ( length($old_bsr) - $o - length($v) ) );
my $o = $p;
#$b = substr($old_bsr,0,$o) . reverse $v . substr($old_bsr,$o+length($v));
$b = ( "0" x $o ) . reverse $v . ( "0" x ( length($old_bsr) - $o - length($v) ) );
@@
-196,17
+202,17
@@
warn "XXX",length($old_bsr), " == ",length($b);
diff_bits( $BSR, $b ), $/;
# print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
diff_bits( $BSR, $b ), $/;
# print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
- print $sock "drscan x300.tap
288
0x", bin2hex($b), "\n";
+ print $sock "drscan x300.tap
$BOUNDARY_LENGTH
0x", bin2hex($b), "\n";
print $sock "irscan x300.tap 0x00\n"; # EXTEST
print $sock "irscan x300.tap 0x00\n"; # EXTEST
-# print $sock "drscan x300.tap
288
0x", bin2hex($b), "\n";
+# print $sock "drscan x300.tap
$BOUNDARY_LENGTH
0x", bin2hex($b), "\n";
} elsif ( $cmd =~ m/\?/ ) {
$last_bits = '';
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
} elsif ( $cmd =~ m/\?/ ) {
$last_bits = '';
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
- print $sock "drscan x300.tap
288
0\n";
+ print $sock "drscan x300.tap
$BOUNDARY_LENGTH
0\n";
} else {
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
} else {
print $sock "irscan x300.tap 0x55\n"; # SAMPLE/PRELOAD
- print $sock "drscan x300.tap
288
0\n";
+ print $sock "drscan x300.tap
$BOUNDARY_LENGTH
0\n";
}
}