first try at dual stage loading.
This commit is contained in:
parent
4730dc048d
commit
b7b99c15f2
1 changed files with 20 additions and 8 deletions
|
@ -1,8 +1,9 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use Device::SerialPort 0.05;
|
||||
use Device::SerialPort;
|
||||
use Term::ReadKey;
|
||||
use Getopt::Long;
|
||||
use Time::HiRes qw(usleep);
|
||||
|
||||
use strict;
|
||||
|
||||
|
@ -40,13 +41,17 @@ $ob->parity('none');
|
|||
$ob->databits(8);
|
||||
$ob->stopbits(1);
|
||||
$ob->handshake("rts");
|
||||
$ob->read_const_time(1000); # 1 second per unfulfilled "read" call
|
||||
|
||||
<<<<<<< HEAD:mc1322x-load.pl
|
||||
my $s = 0;
|
||||
|
||||
SEND:
|
||||
do {
|
||||
|
||||
my $c;
|
||||
my $count;
|
||||
my $ret = '';
|
||||
|
||||
if($s == 1) { print "performing secondary send\n"; }
|
||||
|
||||
|
@ -62,12 +67,16 @@ my $s = 0;
|
|||
}
|
||||
|
||||
until($ret eq $test) {
|
||||
$c = $ob->input;
|
||||
($count,$c) = $ob->read(1);
|
||||
if ($count == 0) {
|
||||
print '.';
|
||||
$ob->write(pack('C','0'));
|
||||
next;
|
||||
}
|
||||
$ret .= $c;
|
||||
}
|
||||
print $ret . "\n";
|
||||
|
||||
|
||||
if (-e $filename) {
|
||||
|
||||
my $size = -s $filename;
|
||||
|
@ -81,9 +90,8 @@ my $s = 0;
|
|||
my $i = 1;
|
||||
while(read(FILE, $c, 1)) {
|
||||
print unpack('H',$c) . unpack('h',$c) if $verbose;
|
||||
print "\n" if ($verbose && ($i%4==0));
|
||||
$i++;
|
||||
select undef, undef, undef, 0.001;
|
||||
usleep(50); # this is as fast is it can go...
|
||||
$ob->write($c);
|
||||
}
|
||||
}
|
||||
|
@ -94,6 +102,10 @@ my $s = 0;
|
|||
|
||||
print "done.\n";
|
||||
|
||||
while(1) {
|
||||
print $ob->input;
|
||||
}
|
||||
|
||||
$ob -> close or die "Close failed: $!\n";
|
||||
ReadMode 0;
|
||||
undef $ob; # closes port AND frees memory in perl
|
||||
|
|
Loading…
Reference in a new issue