From 3b890b232faa40401ea456ee5948d44e6795458d Mon Sep 17 00:00:00 2001 From: Hadaq Date: Wed, 12 Dec 2018 12:59:36 +0100 Subject: [PATCH] update spi_slave --- tools/spi_slave.pl | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/spi_slave.pl b/tools/spi_slave.pl index 860ad66..132617a 100755 --- a/tools/spi_slave.pl +++ b/tools/spi_slave.pl @@ -107,15 +107,15 @@ sub conv_input_string_to_number { sub usage { print < <--chain|c=N> [--register=number] [--data=number] - -examples: spi_flash16bit_slaves.pl -e 0x1212 -c 0 -x time # reads the compile time of 0x1212, chain 0 - spi_flash16bit_slaves.pl -e 0x1212 -c 0 -x pwm --channel=1 # reads the threshold setting of channel 1 - spi_flash16bit_slaves.pl -e=0x1212 -c=0 -x=inputenable --data=0xa55a # disables some channels - spi_flash16bit_slaves.pl --endpoint=0x1212 --chain=0 -x dischargedelayinvert -d 0xff # sets the dischargedelayinvert bits - spi_flash16bit_slaves.pl --endpoint=0x1212 --chain=0 -x dischargedelayinvert # reads the dischargedelayinvert register - spi_flash16bit_slaves.pl -e 0x1212 -c 0 --enablecfgflash=1 # enables the access to the config-flash - spi_flash16bit_slaves.pl --endpoint=0x1212 --chain=0 --dumpcfgflash > flash_dump.txt +usage: spi_slave.pl <--endpoint|e=0xYYYY> <--chain|c=N> [--register=number] [--data=number] + +examples: spi_slave.pl -e 0x1212 -c 0 -x time # reads the compile time of 0x1212, chain 0 + spi_slave.pl -e 0x1212 -c 0 -x pwm --channel=1 # reads the threshold setting of channel 1 + spi_slave.pl -e=0x1212 -c=0 -x=inputenable --data=0xa55a # disables some channels + spi_slave.pl --endpoint=0x1212 --chain=0 -x dischargedelayinvert -d 0xff # sets the dischargedelayinvert bits + spi_slave.pl --endpoint=0x1212 --chain=0 -x dischargedelayinvert # reads the dischargedelayinvert register + spi_slave.pl -e 0x1212 -c 0 --enablecfgflash=1 # enables the access to the config-flash + spi_slave.pl --endpoint=0x1212 --chain=0 --dumpcfgflash > flash_dump.txt Some of the commands can also be used directly, i.e. '-rr=0x12' instead of '-x=rr -register=0x12' @@ -478,14 +478,14 @@ if ($execute eq "writecfgflash" | defined $writecfgflash) { sendcmd16(@a); sendcmd(0x51<<$REGNR | $WRITE | 0x4); sendcmd(0x50<<$REGNR | $WRITE | $p); - + $p++; printf(STDERR "\r%d ",$p) if(!($p%10)); } my @a; for (my $i=0;$i<16;$i++) { if ($i eq 11) { - # adds the magic 09 the last page of the config flash + # adds the magic 09 the last page of the config flash push(@a,0x40<<$REGNR | $i << $REGNR | $WRITE | 0x09); } else { push(@a,0x40<<$REGNR | $i << $REGNR | $WRITE | 0x0); @@ -494,10 +494,10 @@ if ($execute eq "writecfgflash" | defined $writecfgflash) { sendcmd16(@a); sendcmd(0x51<<$REGNR | $WRITE | 0x4); if (($version & 0xFF00) eq 0x100) { - sendcmd(0x50<<$REGNR | $WRITE | 0x167e); + sendcmd(0x50<<$REGNR | $WRITE | 0x167e); # dirich2 } else { - sendcmd(0x50<<$REGNR | $WRITE | 0x23fc); - } + sendcmd(0x50<<$REGNR | $WRITE | 0x23fc); #padiwa amps2 + } } ############################################################################### -- 2.43.0