add script that burns the mac address only --- mac address is Redwire

IAB + tty number.
This commit is contained in:
Mariano Alvira 2010-09-06 12:48:11 -04:00
parent 4d47f83d8f
commit b3df60972d

32
tools/test-grid/burn-macs.pl Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/perl
use strict;
my $bin = shift;
my $terms = shift;
my $addr = "0x1e000";
my $company_id;
my $iab = 0xabc; # Redwire, LLC's IAB
if(defined($iab)) {
$company_id = (0x0050C2 << 12) | $iab;
}
if (! $terms) {
print "Usage: $0 flasher.bin num-devices\n";
die;
}
for (my $t=0; $t<$terms; $t++) {
my $dev_num = 2 * $t + 1;
my $mac;
if(defined($iab)) {
$mac = ($company_id << 28) | $dev_num;
} else {
$mac = ($company_id << 40) | $dev_num;
}
my $ftdi_num = $terms - $t - 1;
my $cmd = "mc1322x-load.pl -e -f $bin -z -t /dev/ttyUSB$dev_num -c 'bbmc -l redbee-econotag -i $ftdi_num reset' $addr," . sprintf("0x%08X,0x%08X\n", ($mac >> 32), ($mac & 0xffffffff));
print "$cmd\n";
system($cmd);
}