Merge branch 'untested' of git://git.devl.org/git/malvira/mc1322x-tests into untested
This commit is contained in:
commit
274f715f22
1 changed files with 24 additions and 12 deletions
|
@ -1,8 +1,9 @@
|
||||||
#!/usr/bin/perl -w
|
#!/usr/bin/perl -w
|
||||||
|
|
||||||
use Device::SerialPort 0.05;
|
use Device::SerialPort;
|
||||||
use Term::ReadKey;
|
use Term::ReadKey;
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
use Time::HiRes qw(usleep);
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
|
@ -33,20 +34,24 @@ if($filename eq '') {
|
||||||
my $ob = Device::SerialPort->new ($term) or die "Can't start $term\n";
|
my $ob = Device::SerialPort->new ($term) or die "Can't start $term\n";
|
||||||
# next test will die at runtime unless $ob
|
# next test will die at runtime unless $ob
|
||||||
|
|
||||||
if(($filename eq '')) die "you must specify a file with -f\n";
|
if ($filename eq '') { die "you must specify a file with -f\n"; }
|
||||||
|
|
||||||
$ob->baudrate($baud);
|
$ob->baudrate($baud);
|
||||||
$ob->parity('none');
|
$ob->parity('none');
|
||||||
$ob->databits(8);
|
$ob->databits(8);
|
||||||
$ob->stopbits(1);
|
$ob->stopbits(1);
|
||||||
$ob->handshake("rts");
|
$ob->handshake("rts");
|
||||||
|
$ob->read_const_time(1000); # 1 second per unfulfilled "read" call
|
||||||
|
|
||||||
|
<<<<<<< HEAD:mc1322x-load.pl
|
||||||
my $s = 0;
|
my $s = 0;
|
||||||
|
|
||||||
SEND:
|
SEND:
|
||||||
do {
|
do {
|
||||||
|
|
||||||
my $c;
|
my $c;
|
||||||
|
my $count;
|
||||||
|
my $ret = '';
|
||||||
|
|
||||||
if($s == 1) { print "performing secondary send\n"; }
|
if($s == 1) { print "performing secondary send\n"; }
|
||||||
|
|
||||||
|
@ -62,13 +67,17 @@ my $s = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
until($ret eq $test) {
|
until($ret eq $test) {
|
||||||
$c = $ob->input;
|
($count,$c) = $ob->read(1);
|
||||||
|
if ($count == 0) {
|
||||||
|
print '.';
|
||||||
|
$ob->write(pack('C','0'));
|
||||||
|
next;
|
||||||
|
}
|
||||||
$ret .= $c;
|
$ret .= $c;
|
||||||
}
|
}
|
||||||
print $ret . "\n";
|
print $ret . "\n";
|
||||||
|
|
||||||
|
if (-e $filename) {
|
||||||
if (defined $filename) {
|
|
||||||
|
|
||||||
my $size = -s $filename;
|
my $size = -s $filename;
|
||||||
|
|
||||||
|
@ -81,19 +90,22 @@ my $s = 0;
|
||||||
my $i = 1;
|
my $i = 1;
|
||||||
while(read(FILE, $c, 1)) {
|
while(read(FILE, $c, 1)) {
|
||||||
print unpack('H',$c) . unpack('h',$c) if $verbose;
|
print unpack('H',$c) . unpack('h',$c) if $verbose;
|
||||||
print "\n" if ($verbose && ($i%4==0));
|
|
||||||
$i++;
|
$i++;
|
||||||
select undef, undef, undef, 0.001;
|
usleep(50); # this is as fast is it can go...
|
||||||
$ob->write($c);
|
$ob->write($c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(-e $second) {$s=1; $filename = $second; continue SEND; }
|
if(-e $second) {$s=1; $filename = $second; next SEND; }
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
print "done.\n";
|
print "done.\n";
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
print $ob->input;
|
||||||
|
}
|
||||||
|
|
||||||
$ob -> close or die "Close failed: $!\n";
|
$ob -> close or die "Close failed: $!\n";
|
||||||
ReadMode 0;
|
ReadMode 0;
|
||||||
undef $ob; # closes port AND frees memory in perl
|
undef $ob; # closes port AND frees memory in perl
|
||||||
|
|
Loading…
Reference in a new issue