return (($b->{$endpoint} >> 2) & 0x1);
}
+
+sub check_std_io {
+ (my $command, my $register) = @_;
+
+ if ($execute eq $command) {
+ if(!defined $data) {
+ my $b = sendcmd($register<<$REGNR | $READ);
+ foreach my $e (sort keys %$b) {
+ printf("endpoint: 0x%04x chain: %d $command: 0x%04x\n",$e,$chain,$b->{$e}&0xffff);
+ }
+ }
+ else {
+ my $b = sendcmd($register<<$REGNR | $WRITE | ($data & 0xffff));
+ }
+ }
+}
+
+check_std_io("inputenable", 0x20);
+check_std_io("inputstatus", 0x21);
+check_std_io("led", 0x22);
+check_std_io("monitor", 0x23);
+check_std_io("invert", 0x24);
+check_std_io("stretch", 0x25);
+check_std_io("compensation", 0x26);
+check_std_io("dischargedisable", 0x27);
+check_std_io("dischargeoverride", 0x28);
+check_std_io("dischargehighz", 0x29);
+check_std_io("dischargedelayinvert", 0x2a);
+check_std_io("dischargedelayselect", 0x2b);
+
+
if ($execute eq "temp") {
die("not implemented");
my $b = sendcmd(0x10040000);
sendcmd(0x10800000);
}
-
if ($execute eq "uid" || defined $time) {
+ die("not implemented");
my $ids;
for (my $i = 0; $i <= 3; $i++) {
- my $b = sendcmd( (0x10+$i)<<$REGNR );
- #print "uid: send done\n";
- #exit;
+ my $b = sendcmd( (0x60+$i)<<$REGNR );
foreach my $e (sort keys %$b) {
$ids->{$e}->{$i} = $b->{$e}&0xffff;
}
}
foreach my $e (sort keys %$ids) {
- printf("0x%04x\t%d\t0x%04x%04x%04x%04x\n",
+ printf("endpoint: 0x%04x chain: %d raw: 0x%04x%04x%04x%04x\n",
$e, $chain, $ids->{$e}->{3}, $ids->{$e}->{2}, $ids->{$e}->{1}, $ids->{$e}->{0} );
}
}
}
-sub check_std_io {
- (my $command, my $register) = @_;
-
- if ($execute eq $command) {
- if(!defined $data) {
- my $b = sendcmd($register<<$REGNR | $READ);
- foreach my $e (sort keys %$b) {
- printf("endpoint: 0x%04x chain: %d $command: 0x%04x\n",$e,$chain,$b->{$e}&0xffff);
- }
- }
- else {
- my $b = sendcmd($register<<$REGNR | $WRITE | ($data & 0xffff));
- }
- }
-}
-
-check_std_io("inputenable", 0x20);
-check_std_io("inputstatus", 0x21);
-check_std_io("led", 0x22);
-check_std_io("monitor", 0x23);
-check_std_io("invert", 0x24);
-check_std_io("stretch", 0x25);
-check_std_io("compensation", 0x26);
-check_std_io("dischargedisable", 0x27);
-check_std_io("dischargeoverride", 0x28);
-check_std_io("dischargehighz", 0x29);
-check_std_io("dischargedelayinvert", 0x2a);
-check_std_io("dischargedelayselect", 0x2b);
-
if ($execute eq "ledoff") {
my $b = sendcmd(0x22<<$REGNR | $WRITE | 0);
}
my $b = sendcmd(0x22000000+(($mask&0x1f)<< 16));
my $c = sendcmd(0x23000000+(($mask&0x1f)<< 16));
foreach my $e (sort keys %$b) {
- printf("0x%04x\t%d\t%8x\n",$e,$chain,($b->{$e}&0xffff)+($c->{$e}&0xff)*2**16);
+ printf("endpoint: 0x%04x chain: %d counter: %8x\n",$e,$chain,($b->{$e}&0xffff)+($c->{$e}&0xff)*2**16);
}
}
if ($execute eq "readreg" || $execute eq "rr" ) {
if (!defined $register) {
print "for the command readreg an option --register|r is missing.\n";
- usage;
+ exit;
}
-
my $b = sendcmd($register<<$REGNR | $READ);
foreach my $e (sort keys %$b) {
printf("0x%x\n", ($b->{$e}) & 0xffff);
}
if ($execute eq "writereg" | $execute eq "wr") {
+ if (!defined $register) {
+ print "for the command writereg an option --register|r is missing.\n";
+ exit;
+ }
if (!defined $data) {
print "for the command writereg an option --data|d is missing.\n";
- usage;
+ exit;
}
+ #print "write: "; printf "reg: %x, data: %x\n",$register, $data;
my $b = sendcmd($register<<$REGNR | $WRITE | ($data & 0xffff) );
}
}
foreach my $e (sort keys %$ids) {
printf("endpoint: 0x%04x chain: %d version: 0x%02x raw: 0x%04x%04x %s\n",
- $e, $chain, $ids->{$e}->{2}, $ids->{$e}->{1}, $ids->{$e}->{0},
+ $e, $chain, $ids->{$e}->{2}, $ids->{$e}->{1}, $ids->{$e}->{0},
time2str('%Y-%m-%d %H:%M', ( ($ids->{$e}->{1})<<16 | ($ids->{$e}->{0}) )) );
}
}
printf("\n");
}
-###################################################################################################
if (defined $flashcmd) {
#my $c = 0x50800000 + (($mask&0xe)<< 12) + ($value&0x1fff);
if (!defined $flashaddress) {
printf("Sent flash command $flashcmd\n");
}
-###################################################################################################
if (defined $enablecfgflash) {
die "--enableccfgflash can only be 0 or 1\n" unless ($enablecfgflash == 0 || $enablecfgflash == 1);
my $c = 0x5C<<$REGNR | $WRITE | $enablecfgflash;
printf("$str cfgflash.\n");
}
-###################################################################################################
+
if (defined $dumpcfgflash) {
for (my $p = 0; $p<5760; $p++) { #5758
sendcmd(0x50<<$REGNR | $WRITE | $p); # read page $p
printf(STDERR "\r%d / 5760",$p) if(!($p%10));
}
}
-###################################################################################################
if ($execute eq "erasecfgflash") {
while (flash_is_busy()) {
if ($execute eq "fifo" || $execute eq "ffarr") {
my $b = sendcmd(0x200f0000);
foreach my $e (sort keys %$b) {
- printf("0x%04x\t%d\t0x%04x\n",$e,$chain,$b->{$e}&0xffff);
+ printf("endpoint: 0x%04x chain: %d fifo: 0x%04x\n",$e,$chain,$b->{$e}&0xffff);
}
}