if(!(defined $ARGV[0]) || !(defined $ARGV[1]) || !(defined $ARGV[2])) {
print "usage: padiwa.pl \$FPGA \$chain \$command \$options\n\n";
print "\t uid \t\t read unique ID, no options\n";
+ print "\t time \t\t read compile time. no options\n";
print "\t temp \t\t read temperature, no options\n";
- print "\t resettemp \t\t resets the 1-wire logic\n";
+ print "\t resettemp \t resets the 1-wire logic\n";
print "\t dac \t\t set LTC-DAC value. options: \$channel, \$value\n";
print "\t pwm \t\t set PWM value. options: \$channel, \$value\n";
- print "\t pwm \t\t read PWM value. options: \$channel\n";
+ print "\t \t\t read PWM value. options: \$channel\n";
print "\t disable \t set input diable. options: \$mask\n";
- print "\t disable \t read input disable. no options\n";
+ print "\t \t\t read input disable. no options\n";
print "\t input \t\t read input status. no options\n";
print "\t invert \t set invert status. options: \$mask\n";
- print "\t invert \t read invert status. no options\n";
+ print "\t \t\t read invert status. no options\n";
print "\t led \t\t set led status. options: mask (5 bit, highest bit is override enable)\n";
- print "\t led \t\t read LED status. no options\n";
- print "\t monitor \t set input for monitor output. options: mask (4 bit). \n\t\t\t0x10: OR of all channels, 0x18: or of all channels, extended to 16ns\n";
- print "\t monitor \t read monitor selection. no options\n";
- print "\t stretch \t\t set stretcher status.\n";
- print "\t stretch \t\t read stretcher status. no options\n";
- print "\t time \t\t read compile time. no options\n";
+ print "\t \t\t read LED status. no options\n";
+ print "\t monitor \t set input for monitor output. options: mask (4 bit). \n\t\t\t 0x10: OR of all channels, 0x18: or of all channels, extended to 16ns\n";
+ print "\t \t\t read monitor selection. no options\n";
+ print "\t stretch \t set stretcher status.\n";
+ print "\t \t\t read stretcher status. no options\n";
+ print "\t ram \t\t writes the RAM content, options: 16 byte in hex notation, separated by space, no 0x.\n";
+ print "\t \t\t read the RAM content (16 Byte)\n";
+ print "\t flash \t\t execute flash command, options: \$command, \$page. See manual for commands.\n";
+ print "\t enablecfg\t enable or disable access to configuration flash, options: 1/0\n";
+ print "\t dumpcfg \t Dump content of configuration flash\n";
+
exit;
}
my $board, my $value, my $mask;
}
-
+sub sendcmd16 {
+ my @cmd = @_;
+ my $c = [@cmd,1<<$chain,16+0x80];
+ trb_register_write_mem($board,0xd400,0,$c,scalar @{$c});
+ usleep(1000);
+ }
sub sendcmd {
my ($cmd) = @_;
trb_register_write_mem($board,0xd400,0,$c,scalar @{$c});
# trb_register_write($board,0xd410,1<<$chain) or die "trb_register_write: ", trb_strerror();
# trb_register_write($board,0xd411,1);
- usleep(10000);
+ usleep(1000);
return trb_register_read($board,0xd412);
}
}
}
+if($ARGV[2] eq "ram" && defined $ARGV[18]) {
+ my @a;
+ for(my $i=0;$i<16;$i++) {
+ push(@a,0x40800000+hex($ARGV[3+$i])+($i << 16));
+ }
+ sendcmd16(@a);
+ printf("Wrote RAM\n");
+ }
+
+if($ARGV[2] eq "ram") {
+ for(my $i=0;$i<16;$i++) {
+ my $b = sendcmd(0x40000000 + ($i << 16));
+ foreach my $e (sort keys %$b) {
+ printf(" %02x ",$b->{$e}&0xff);
+ }
+ }
+ printf("\n");
+ }
+
+if($ARGV[2] eq "flash" && defined $ARGV[4]) {
+ my $c = 0x50800000+(($mask&0xe)<< 12)+($value&0x1fff);
+ my $b = sendcmd($c);
+ printf("Sent command\n");
+ }
+
+if($ARGV[2] eq "dumpcfg") {
+ for(my $p = 0; $p<5758; $p++) { #5758
+ sendcmd(0x50800000 + $p);
+ printf("0x%04x:\t",$p);
+ for(my $i=0;$i<16;$i++) {
+ my $b = sendcmd(0x40000000 + ($i << 16));
+ foreach my $e (sort keys %$b) {
+ printf(" %02x ",$b->{$e}&0xff);
+ }
+ }
+ printf("\n");
+ printf(STDERR "\r%d / 5758",$p) if(!($p%10));
+ }
+ }
+
+if($ARGV[2] eq "enablecfg" && defined $ARGV[3]) {
+ my $c = 0x5C800000 + $ARGV[3];
+ my $b = sendcmd($c);
+ printf("Sent command.\n");
+ }
\ No newline at end of file