use Time::HiRes qw( time );
use Term::ANSIColor;
use Data::Dump qw(dump);
+use POSIX;
my $adc_addr = 0x48;
my $fpga = $params{'fpga'};
my $pulseonly = $params{'pulseonly'};
my $region = $params{'region'};
- my $firstrow = $params{'firstrow'};
- my $lastrow = $params{'lastrow'};
- my $rowdiv = $params{'rowdiv'};
- my $firstcol = $params{'firstcol'};
- my $lastcol = $params{'lastcol'};
- my $coldiv = $params{'coldiv'};
+ my $firstRow = $params{'firstRow'};
+ my $lastRow = $params{'lastRow'};
+ my $rowDiv = $params{'rowDiv'};
my $firstset = $params{'firstset'};
my $lastset = $params{'lastset'};
my $setdiv = $params{'setdiv'};
my $regBit = $regBitHash{$region};
- $firstrow = defined $firstrow ? $firstrow : 0;
- $lastrow = defined $lastrow ? $lastrow : 504;
- $rowdiv = defined $rowdiv ? $rowdiv : 1;
- $firstcol = defined $firstcol ? $firstcol : $collim{$region}->[0];
- $lastcol = defined $lastcol ? $lastcol : $collim{$region}->[1];
- $coldiv = defined $coldiv ? $coldiv : 1;
+ $firstRow = defined $firstRow ? $firstRow : 0;
+ $lastRow = defined $lastRow ? $lastRow : 504;
+ $rowDiv = defined $rowDiv ? $rowDiv : 1;
$firstset = defined $firstset ? $firstset : 0x0;
$lastset = defined $lastset ? $lastset : 0xff;
$setdiv = defined $setdiv ? $setdiv : 1;
$settime = defined $settime ? $settime : 1000;
$slow = defined $slow ? $slow : 10000;
$a = defined $a ? $a : 0;
- $rowsatonce = defined $rowsatonce ? $rowsatonce : $rowAdd{$region};
+ $rowTrain = defined $rowTrain ? $rowTrain : $rowAdd{$region};
$printset = defined $printset ? 1 : 0;
$printrow = defined $printrow ? 1 : 0;
$printcol = defined $printcol ? 1 : 0;
Mimosis::mimosis_register_write( $fpga, 0x0177, $pixpulseD_B_msb, $a ); usleep($slow);
Mimosis::mimosis_register_write( $fpga, 0x007d, $modpulse, $a ); usleep($slow); #set modpulse. possible values: 1f/1, 1f/2, 1f/4, 1f/8, 1f/16, 1f/32, 1f/64, 1f/128
+ my $pipeNameWr = "/tmp/scurvepipewr";
+ my $pipeNameRd = "/tmp/scurvepiperd";
+ my $fdPipeWr = POSIX::open($pipeNameWr, &POSIX::O_WRONLY);
my $rowcounter = 0;
- for ( my $yi = $firstrow; $yi+$rowsatonce-1 <= $lastrow; $yi+=$rowsatonce*$rowdiv )
- {
- for ( my $y = $yi; $y < $yi+$rowsatonce*$rowdiv; $y+=1 )
- {
+ for ( my $yi = $firstRow;
+ $yi+$rowTrain-1 <= $lastRow;
+ $yi+=$rowTrain*$rowDiv ) {
+
+ for ( my $y = $yi;
+ $y < $yi+$rowTrain*$rowDiv;
+ $y+=1 ) {
+
$rowcounter = $rowcounter + 1;
- if( ($rowcounter-1)%$rowdiv != 0) { next; }
+ if( ($rowcounter-1)%$rowDiv != 0) { next; }
my $rAddrR = $y/8;
my $bitR = $y%8;
Mimosis::mimosis_instr_write( $fpga, 0x05 ); usleep($slow); #INSTR set mask pulse
Mimosis::mimosis_register_write( $fpga, 0x4087, 0x0, $a ); usleep($slow); #unselect all pixels (register wise)
Mimosis::mimosis_instr_write( $fpga, 0x3e ); usleep($slow); #INSTR unselect all pixels
+ }
- # my $colcounter = 0;
-
- # for( my $x = $firstcol; $x <= $lastcol; $x+=1 )
- # {
- # $colcounter = $colcounter + 1;
- # if( ($colcounter-1)%$coldiv != 0) { next; }
-
- # my $rAddrC = $x/16; #region address
- # my $bitC = ($x/2)%8; #double column in region
- # my $add_regC = ($rAddrC << 8);
- # if (($x%2 == 1)) { $add_regC += 0x82; }
- # elsif (($x%2 == 0)) { $add_regC += 0x81; }
-
- # Mimosis::mimosis_register_write( $fpga, $add_regC, ( 0x1 << $bitC ), $a ); usleep($slow);
- # Mimosis::mimosis_register_write( $fpga, $add_regR, ( 0x1 << $bitR ), $a ); usleep($slow);
- # Mimosis::mimosis_instr_write( $fpga, 0x05 ); usleep($slow); #INSTR set mask pulse
- # Mimosis::mimosis_register_write( $fpga, 0x4087, 0x0, $a ); usleep($slow); #unselect all pixels (register wise)
-
- # if( $printcol || $printall ) { printf("col: $x\n"); }
- # }
+ my $frameWr = "START-" . $yi . "-" . $rowTrain . "-END";
+ POSIX::write($fdPipeWr,$frameWr,length($frameWr));
+
+ print "Data sent.\n";
+ print "Waiting for ACK\n";
+
+ my $fdPipeRd = POSIX::open($pipeNameRd);
+ my $frameRd;
+ my $reading = 1;
+ while($reading) {
+ my $buf;
+ my $bytes = POSIX::read($fdPipeRd,$buf,1);
+ $frameRd .= $buf;
+ if($frameRd =~ /ACK/) {
+ $reading = 0;
+ }
}
+ POSIX::close($fdPipeRd);
- unless($pulseonly)
- {
+ unless($pulseonly) {
my $setcounter = 0;
- for my $set (reverse ($firstset .. $lastset) )
- {
+ for my $set (reverse ($firstset .. $lastset) ) {
$setcounter = $setcounter + 1;
if( ($setcounter-1)%$setdiv != 0) { next; }
+# sub mimosis_scan_region
+# {
+# my %params = @_;
+
+# my $fpga = $params{'fpga'};
+# my $pulseonly = $params{'pulseonly'};
+# my $region = $params{'region'};
+# my $firstrow = $params{'firstrow'};
+# my $lastrow = $params{'lastrow'};
+# my $rowdiv = $params{'rowdiv'};
+# my $firstcol = $params{'firstcol'};
+# my $lastcol = $params{'lastcol'};
+# my $coldiv = $params{'coldiv'};
+# my $firstset = $params{'firstset'};
+# my $lastset = $params{'lastset'};
+# my $setdiv = $params{'setdiv'};
+# my $settime = $params{'settime'};
+# my $slow = $params{'slow'};
+# my $a = $params{'a'};
+# my $rowsatonce = $params{'rowsatonce'};
+# my $printset = $params{'printset'};
+# my $printrow = $params{'printrow'};
+# my $printcol = $params{'printcol'};
+# my $printall = $params{'printall'};
+# my $analogAlimA = $params{'analogAlimA'};
+# my $analogAlimB = $params{'analogAlimB'};
+# my $analogDlimA = $params{'analogDlimA'};
+# my $analogDlimB = $params{'analogDlimB'};
+# my $modpulse = $params{'modpulse'};
+
+
+# defined $fpga or die "Mimosis::mimosis_scan_region: Must provide $fpga.";
+# defined $region or die "Mimosis::mimosis_scan_region: Must provide $region.";
+
+
+# my %collim = (
+# 'A' => [ 0, 127 ],
+# 'B' => [ 128, 511 ],
+# 'C' => [ 512, 895 ],
+# 'D' => [ 896, 1023 ]
+# );
+
+# my %rowAdd = (
+# 'A' => 4,
+# 'B' => 2,
+# 'C' => 2,
+# 'D' => 4
+# );
+
+# my %regBitHash = (
+# 'A' => 0,
+# 'B' => 1,
+# 'C' => 2,
+# 'D' => 3
+# );
+
+
+# my $regBit = $regBitHash{$region};
+
+
+# $firstrow = defined $firstrow ? $firstrow : 0;
+# $lastrow = defined $lastrow ? $lastrow : 504;
+# $rowdiv = defined $rowdiv ? $rowdiv : 1;
+# $firstcol = defined $firstcol ? $firstcol : $collim{$region}->[0];
+# $lastcol = defined $lastcol ? $lastcol : $collim{$region}->[1];
+# $coldiv = defined $coldiv ? $coldiv : 1;
+# $firstset = defined $firstset ? $firstset : 0x0;
+# $lastset = defined $lastset ? $lastset : 0xff;
+# $setdiv = defined $setdiv ? $setdiv : 1;
+# $settime = defined $settime ? $settime : 1000;
+# $slow = defined $slow ? $slow : 10000;
+# $a = defined $a ? $a : 0;
+# $rowsatonce = defined $rowsatonce ? $rowsatonce : $rowAdd{$region};
+# $printset = defined $printset ? 1 : 0;
+# $printrow = defined $printrow ? 1 : 0;
+# $printcol = defined $printcol ? 1 : 0;
+# $printall = defined $printall ? 1 : 0;
+# $pixpulseA_A = defined $pixpulseA_A ? $pixpulseA_A : 25;
+# $pixpulseA_B = defined $pixpulseA_B ? $pixpulseA_B : 75;
+# $pixpulseD_A = defined $pixpulseD_A ? $pixpulseD_A : 0;
+# $pixpulseD_B = defined $pixpulseD_B ? $pixpulseD_B : 0;
+# $modpulse = defined $modpulse ? $modpulse : 3;
+
+
+# my $pixpulseA_A_msb = ( $pixpulseA_A & 0xff00 ) >> 8;
+# my $pixpulseA_A_lsb = $pixpulseA_A & 0x00ff;
+# my $pixpulseA_B_msb = ( $pixpulseA_B & 0xff00 ) >> 8;
+# my $pixpulseA_B_lsb = $pixpulseA_B & 0x00ff;
+# my $pixpulseD_A_msb = ( $pixpulseD_A & 0xff00 ) >> 8;
+# my $pixpulseD_A_lsb = $pixpulseD_A & 0x00ff;
+# my $pixpulseD_B_msb = ( $pixpulseD_B & 0xff00 ) >> 8;
+# my $pixpulseD_B_lsb = $pixpulseD_B & 0x00ff;
+
+
+# Mimosis::mimosis_register_write( $fpga, 0x0020, 0x40, $a ); usleep($slow); #EN_PIXELMASK to 0 for pulse
+# Mimosis::mimosis_instr_write( $fpga, 0x3f ); usleep($slow); #INSTR select all pixels
+# Mimosis::mimosis_instr_write( $fpga, 0x04 ); usleep($slow); #INSTR reset mask
+# Mimosis::mimosis_instr_write( $fpga, 0x3e ); usleep($slow); #INSTR unselect all pixels
+# Mimosis::mimosis_register_write( $fpga, 0x0066, $pixpulseA_A_lsb, $a ); usleep($slow); #analog pulsing pulse A, limit A
+# Mimosis::mimosis_register_write( $fpga, 0x0166, $pixpulseA_A_msb, $a ); usleep($slow);
+# Mimosis::mimosis_register_write( $fpga, 0x0076, $pixpulseA_B_lsb, $a ); usleep($slow); # analog pulsing pulse A, limit B
+# Mimosis::mimosis_register_write( $fpga, 0x0176, $pixpulseA_B_msb, $a ); usleep($slow);
+# Mimosis::mimosis_register_write( $fpga, 0x0067, $pixpulseD_A_lsb, $a ); usleep($slow); # analog pulsing pulse D, limit A
+# Mimosis::mimosis_register_write( $fpga, 0x0167, $pixpulseD_A_msb, $a ); usleep($slow);
+# Mimosis::mimosis_register_write( $fpga, 0x0077, $pixpulseD_B_lsb, $a ); usleep($slow); # analog pulsing pulse D, limit B
+# Mimosis::mimosis_register_write( $fpga, 0x0177, $pixpulseD_B_msb, $a ); usleep($slow);
+# Mimosis::mimosis_register_write( $fpga, 0x007d, $modpulse, $a ); usleep($slow); #set modpulse. possible values: 1f/1, 1f/2, 1f/4, 1f/8, 1f/16, 1f/32, 1f/64, 1f/128
+
+# my $rowcounter = 0;
+
+# for ( my $yi = $firstrow; $yi+$rowsatonce-1 <= $lastrow; $yi+=$rowsatonce*$rowdiv ) {
+
+# for ( my $y = $yi; $y < $yi+$rowsatonce*$rowdiv; $y+=1 ) {
+
+# $rowcounter = $rowcounter + 1;
+# if( ($rowcounter-1)%$rowdiv != 0) { next; }
+
+# my $rAddrR = $y/8;
+# my $bitR = $y%8;
+# my $add_regR = ( $rAddrR << 8 ) + 0x84;
+
+# if( $printrow || $printall ) { printf("row: $y\n"); }
+
+# Mimosis::mimosis_register_write( $fpga, $add_regR, ( 0x1 << $bitR ), $a ); usleep($slow);
+# Mimosis::mimosis_instr_write( $fpga, 0x27 ); usleep($slow); #INSTR select all pixels
+# Mimosis::mimosis_instr_write( $fpga, 0x05 ); usleep($slow); #INSTR set mask pulse
+# Mimosis::mimosis_register_write( $fpga, 0x4087, 0x0, $a ); usleep($slow); #unselect all pixels (register wise)
+# Mimosis::mimosis_instr_write( $fpga, 0x3e ); usleep($slow); #INSTR unselect all pixels
+
+# # my $colcounter = 0;
+
+# # for( my $x = $firstcol; $x <= $lastcol; $x+=1 )
+# # {
+# # $colcounter = $colcounter + 1;
+# # if( ($colcounter-1)%$coldiv != 0) { next; }
+
+# # my $rAddrC = $x/16; #region address
+# # my $bitC = ($x/2)%8; #double column in region
+# # my $add_regC = ($rAddrC << 8);
+# # if (($x%2 == 1)) { $add_regC += 0x82; }
+# # elsif (($x%2 == 0)) { $add_regC += 0x81; }
+
+# # Mimosis::mimosis_register_write( $fpga, $add_regC, ( 0x1 << $bitC ), $a ); usleep($slow);
+# # Mimosis::mimosis_register_write( $fpga, $add_regR, ( 0x1 << $bitR ), $a ); usleep($slow);
+# # Mimosis::mimosis_instr_write( $fpga, 0x05 ); usleep($slow); #INSTR set mask pulse
+# # Mimosis::mimosis_register_write( $fpga, 0x4087, 0x0, $a ); usleep($slow); #unselect all pixels (register wise)
+
+# # if( $printcol || $printall ) { printf("col: $x\n"); }
+# # }
+# }
+
+# unless($pulseonly) {
+# my $setcounter = 0;
+# for my $set (reverse ($firstset .. $lastset) ) {
+# $setcounter = $setcounter + 1;
+# if( ($setcounter-1)%$setdiv != 0) { next; }
+
+# my $pulseNumber = ($set << 24) + 0x00c00000 + ($regBit << 20) + $yi;
+# trb_register_write_mem( $fpga, 0xa209, 0, [ $pulseNumber ], 1 ); usleep($slow);
+# Mimosis::mimosis_register_write( $fpga, 0x0046, $set, $a ); usleep($settime);
+
+# if( $printset || $printall ) { printf("set: $set\n"); }
+# }
+
+# Mimosis::mimosis_instr_write( $fpga, 0x3f ); usleep($slow);
+# Mimosis::mimosis_instr_write( $fpga, 0x04 ); usleep($slow); #INSTR set mask pulse
+# Mimosis::mimosis_instr_write( $fpga, 0x3e ); usleep($slow); #INSTR set mask pulse
+# }
+# }
+# }
+
+
+
sub mimosis_scan_pixel
{
my %params = @_;
-
my $fpga = $params{'fpga'};
my $colpix = $params{'colpix'};
my $rowpix = $params{'rowpix'};
+sub help_global {
+ my $message = <<'END_MESSAGE';
+ =+- =*=
+ +*==: :##=-
+ -::::-:. .-:::=:. =+@*. .+@+- .-::::::::--:.
+ .= .*-. .=. :#=. .*%- .:-----------=%%=----*+. .:--.
+ .:- .*-..=: =*:..:%%==-::::::::::-#%-::==*- -----: ==..
+ .....=. :*--: ++-==+#+::::::::::::+#*==-.:- +#+--==++. :*:..
+ .......+ - :#= .- .-=+-:::--:::::::::::=*#-....= :%+:.....:=: -*:..
+ ......:- .%+ . .#%+=--=*====##==========#%=....=- *#-.......:+ #=...
+ .......=. =#+= :#*=+ *+:..*@#========*@#======+*+-+#=:........= +*:..
+ .......= **--= :#*-.-- :#+==-#%=::::::-%%-::-=+-. .#*:.........+ **:..
+ .....:= :%+:.-= :#*-...+::-==-:::-=-::::::-=--==-=- *#-.........-- :%+..
+ ...-: =#-...-+#*-..:=*#+===+=====++=====++=-...= =%+:........-- *#-.
+ .= #*:....:-:......:+ :#-..:#%:..:%%:....=. :#*=--------:. .##=.
+ .= :%=. . .-: ++:. -%*..+@= :- :+#+-.
+ :+:::+#-. .=:::-#-. +@--%*. .+-::::::::::::::--=*#*=:.
+ :++++=. .-++++-. .%%%%: :=+++++++++++++++==-:.
+ =@@+
+ ##.
+
+usage: mimosis [GLOBAL OPTIONS] <command> [COMMAND OPTIONS]
+
+GLOBAL OPTIONS are:
+ -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
+ -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
+ -a, --singleaccess -> Select single access mode.
+ -h, --help -> Print this or <command> specific help.
+
+<commands> are:
+ load Load a configuration file for mimosis.
+ dacscan Make a DAC scan.
+ scurves Make a S-Curve scan of mimosis or some parts of it.
+ mask Mask some pixels.
+ instr Send an instruction to mimosis.
+ reg Write into a register.
+ vnc Open a vncviewer with the setup.
+
+For every <command> a short description is accessible with the -h option.
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+
+sub help_load {
+ my $message = <<'END_MESSAGE';
+
+usage: mimosis [GLOBAL OPTIONS] load [COMMAND OPTIONS] PATH
+
+GLOBAL OPTIONS are:
+ -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
+ -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
+ -a, --singleaccess -> Select single access mode.
+ -h, --help -> Print this or <command> specific help.
+
+COMMAND OPTIONS are:
+ -p, --printall -> Print all settings from file to stdout.
+ -w, --printwrong -> Print all settings, that were not loaded to mimosis correctly stdout.
+ -h, --help -> Print this help.
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+
+sub help_dacscan {
+ my $message = <<'END_MESSAGE';
+
+usage: mimosis [GLOBAL OPTIONS] dacscan [COMMAND OPTIONS]
+
+GLOBAL OPTIONS are:
+ -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
+ -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
+ -a, --singleaccess -> Select single access mode.
+ -h, --help -> Print this or <command> specific help.
+
+COMMAND OPTIONS are:
+ -i, --ikf -> Use this flag for scans on the IKFv2 proxy.
+ -m, --imagefile-only -> Print only image files, don't open gnuplot terminal.
+ -n, --name=NAME -> Sensor name. If defined, images and data files will be marked with this name.
+ -c, --cleanup -> Delete data and image files afterwards.
+ -h, --help -> Print this help.
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+
+sub help_scurves {
+ my $message = <<'END_MESSAGE';
+
+usage: mimosis [GLOBAL OPTIONS] scurves [COMMAND OPTIONS]
+
+GLOBAL OPTIONS are:
+ -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
+ -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
+ -a, --singleaccess -> Select single access mode.
+ -h, --help -> Print this or <command> specific help.
+
+COMMAND OPTIONS are:
+ --colpix X -> x value of a single pixel to pulse.
+ --rowpix Y -> y value of a single pixel to pulse.
+ --pulseonly -> if set, mark specified pixels only for pulsing and dont do a scan.
+ -r, --region A|B|C|D -> Region to pulse.
+ --firstrow Y -> First row to scan.
+ --lastrow Y -> Last row to scan.
+ --rowdiv ROWDIV -> Just pulse every ROWDIV row.
+ --firstcol X -> First column to scan.
+ --lastcol X -> Last column to scan.
+ --coldiv COLDIV -> Just pulse every COLDIV column.
+ --firstset S -> Start s-curve scan at VPH_FINE=S
+ --lastset S -> Stop s-curve scan at VPH_FINE=S
+ --setdiv SETDIV -> Just use every SETDIV value of VPH_FINE.
+ --settime T -> Take data for each VPH_FINE for T milliseconds.
+ --vcasn A|B|C|D -> VACSN to vary. Default is the same as specified with --region.
+ --firstvcasn V -> Start s-curve taking with VCASN=V.
+ --lastvcasn V -> Stop s-curve taking at VCASN=V.
+ --vcasndiv V -> Take s-curve every V steps.
+ --nrows N -> How many rows to pulse at once. Default depends on region. For A,D: N = 4, for B,D: N = 2.
+ --printset -> Print the current VPH_FINE setting.
+ --printrow -> Print current row to set.
+ --printcol -> Print current column to set.
+ -p, --printall -> Print all informations available.
+ --analogAlimA -> Not implemented yet.
+ --analogAlimB -> Not implemented yet.
+ --analogDlimA -> Not implemented yet.
+ --analogDlimB -> Not implemented yet.
+ --modpulse MOD -> Exponent of the power of two, which gives the divider of the frames to pulse.
+ -h, --help -> Print this help.
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+sub help_mask {
+ my $message = <<'END_MESSAGE';
+
+usage: mimosis [GLOBAL OPTIONS] mask [COMMAND OPTIONS]
+
+GLOBAL OPTIONS are:
+ -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
+ -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
+ -a, --singleaccess -> Select single access mode.
+ -h, --help -> Print this or <command> specific help.
+
+COMMAND OPTIONS are:
+ --region A|B|C|D -> Region to pulse. If provided, ignores --collow, --colhig, --rowlow and --rowhig
+ -x, --column INT -> Select column of the Pixel to mask. If not specified, but --region is given, all columns in this region are selected. If neither --region nor --column are given, all columns are selected.
+ -y, --row INT -> Select Rows of the Pixel to mask. If not specified, all rows are selected. Pixels whos rows and columns are selected will be masked.
+ --mask-all -> Mask all pixels with via an instructions.
+ --unmask-all -> Unmask all pixels with via an instructions.
+ --hline -> Mask a horizontal line.
+ --vline -> Mask a vertical line.
+ --square -> Mask a square.
+ -h, --help -> Print this help.
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+
+
+sub help_instr {
+ my $message = <<'END_MESSAGE';
+
+usage: mimosis [GLOBAL OPTIONS] instr INSTR
+
+GLOBAL OPTIONS are:
+ -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
+ -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
+ -a, --singleaccess -> Select single access mode.
+ -h, --help -> Print this or <command> specific help.
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+
+sub help_reg {
+ my $message = <<'END_MESSAGE';
+
+usage: mimosis [GLOBAL OPTIONS] reg REGISTER VALUE
+
+GLOBAL OPTIONS are:
+ -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
+ -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
+ -a, --singleaccess -> Select single access mode.
+ -h, --help -> Print this or <command> specific help.
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+
+sub help_vnc {
+ my $message = <<'END_MESSAGE';
+
+usage: mimosis vnc
+
+END_MESSAGE
+
+ print $message;
+ exit 0;
+}
+
+
+
1;
__END__
my @ARGV_bak = @ARGV;
-my $res = GetOptions(
-
- options =>
- {
- 'help|h|?' =>
- {
- handler => \&help_global,
- },
+my $res = GetOptions (
+ options => {
'fpga|f=s' => \$fpga,
'singleaccess|a' => \$a,
'slow|s=s' => \$slow,
},
-
default_subcommand => 'default',
-
- subcommands =>
- {
- default =>
- {
- },
- load =>
- {
- options =>
- {
+ subcommands => {
+ default => {},
+ load => {
+ options => {
'printall|p' => \$printall_load,
'printwrong|w' => \$printwrong_load,
+ 'help|h' => {
+ handler => \&Mimosis::help_load,
+ }
},
},
- dacscan =>
- {
- options =>
- {
+ dacscan => {
+ options => {
"ikf|i" => \$ikf,
"imagefile-only|m" => \$imagefileonly,
"name|n=s" => \$name,
"cleanup|c" => \$cleanup_dacscan,
'printall|p' => \$printall_dacscan,
+ 'help|h' => {
+ handler => \&Mimosis::help_dacscan,
+ }
},
},
- scurves =>
- {
- options =>
- {
+ scurves => {
+ options => {
"colpix=s" => \$colpix_scurves,
"rowpix=s" => \$rowpix_scurves,
"pulseonly" => \$pulseonly_scurves,
"analogDlimA=s" => \$analogDlimA_scurves,
"analogDlimB=s" => \$analogDlimB_scurves,
"modpulse=s" => \$modpulse_scurves,
+ 'help|h' => {
+ handler => \&Mimosis::help_scurves,
+ }
},
},
- mask =>
- {
- options =>
- {
+ mask => {
+ options => {
"region|r=s" => \$region_mask,
"row|y=s" => \$row_mask,
"column|x=s" => \$col_mask,
"vline" => \$vline_mask,
"square" => \$square_mask,
"printall|p" => \$printall_mask,
+ 'help|h' => {
+ handler => \&Mimosis::help_mask,
+ }
},
},
- instr =>
- {
- options => {},
+ instr => {
+ options => {
+ 'help|h' => {
+ handler => \&Mimosis::help_instr,
+ }
+ },
},
- reg =>
- {
- options => {},
+ reg => {
+ options => {
+ 'help|h' => {
+ handler => \&Mimosis::help_reg,
+ }
+ },
},
- vnc =>
- {
- options => {},
+ vnc => {
+ options => {
+ 'help|h' => {
+ handler => \&Mimosis::help_vnc,
+ }
+ },
},
},
-
- completion => sub
- {
+ completion => sub {
my %args = @_;
},
);
die "GetOptions failed!\n" unless $res->{success};
-sub help_global
-{
- if( !defined $_[0] )
- {
- my $message = <<'END_MESSAGE';
-
-usage: mimosis [GLOBAL OPTIONS] <command> [COMMAND OPTIONS]
-
-GLOBAL OPTIONS are:
- -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
- -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
- -a, --singleaccess -> Select single access mode.
- -h, --help -> Print this or <command> specific help.
-
-<commands> are:
- load Load a configuration file for mimosis.
- dacscan Make a DAC scan.
- scurves Make a S-Curve scan of mimosis or some parts of it.
- mask Mask some pixels.
- instr Send an instruction to mimosis.
- reg Write into a register.
- vnc Open a vncviewer with the setup.
-
-For every <command> a short description is accessible with the -h option.
-END_MESSAGE
- print $message;
- exit 0;
- }
- elsif( $_[2]->{_non_options_argv}[0] eq '')
- {
- my $message = <<'END_MESSAGE';
-
-usage: mimosis [GLOBAL OPTIONS] <command> [COMMAND OPTIONS]
-
-GLOBAL OPTIONS are:
- -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
- -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
- -a, --singleaccess -> Select single access mode.
- -h, --help -> Print this or <command> specific help.
-
-<commands> are:
- load Load a configuration file for mimosis.
- dacscan Make a DAC scan.
- scurves Make a S-Curve scan of mimosis or some parts of it.
- mask Mask some pixels.
- instr Send an instruction to mimosis.
- reg Write into a register.
- vnc Open a vncviewer with the setup.
-
-For every <command> a short description is accessible with the -h option.
-END_MESSAGE
- print $message;
- exit 0;
- }
- elsif ( $_[2]->{_non_options_argv}[0] eq 'load' )
- {
- my $message = <<'END_MESSAGE';
-
-usage: mimosis [GLOBAL OPTIONS] load [COMMAND OPTIONS] PATH
-
-GLOBAL OPTIONS are:
- -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
- -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
- -a, --singleaccess -> Select single access mode.
- -h, --help -> Print this or <command> specific help.
-
-COMMAND OPTIONS are:
- -p, --printall -> Print all settings from file to stdout.
- -w, --printwrong -> Print all settings, that were not loaded to mimosis correctly stdout.
- -h, --help -> Print this help.
-END_MESSAGE
- print $message;
- exit 0;
- }
- elsif ( $_[2]->{_non_options_argv}[0] eq 'dacscan' )
- {
- my $message = <<'END_MESSAGE';
-
-usage: mimosis [GLOBAL OPTIONS] dacscan [COMMAND OPTIONS]
-
-GLOBAL OPTIONS are:
- -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
- -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
- -a, --singleaccess -> Select single access mode.
- -h, --help -> Print this or <command> specific help.
-
-COMMAND OPTIONS are:
- -i, --ikf -> Use this flag for scans on the IKFv2 proxy.
- -m, --imagefile-only -> Print only image files, don't open gnuplot terminal.
- -n, --name=NAME -> Sensor name. If defined, images and data files will be marked with this name.
- -c, --cleanup -> Delete data and image files afterwards.
- -h, --help -> Print this help.
-END_MESSAGE
- print $message;
- exit 0;
- }
- elsif ( $_[2]->{_non_options_argv}[0] eq 'scurves' )
- {
- my $message = <<'END_MESSAGE';
-
-usage: mimosis [GLOBAL OPTIONS] scurves [COMMAND OPTIONS]
-
-GLOBAL OPTIONS are:
- -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
- -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
- -a, --singleaccess -> Select single access mode.
- -h, --help -> Print this or <command> specific help.
-
-COMMAND OPTIONS are:
- --colpix X -> x value of a single pixel to pulse.
- --rowpix Y -> y value of a single pixel to pulse.
- --pulseonly -> if set, mark specified pixels only for pulsing and dont do a scan.
- -r, --region A|B|C|D -> Region to pulse.
- --firstrow Y -> First row to scan.
- --lastrow Y -> Last row to scan.
- --rowdiv ROWDIV -> Just pulse every ROWDIV row.
- --firstcol X -> First column to scan.
- --lastcol X -> Last column to scan.
- --coldiv COLDIV -> Just pulse every COLDIV column.
- --firstset S -> Start s-curve scan at VPH_FINE=S
- --lastset S -> Stop s-curve scan at VPH_FINE=S
- --setdiv SETDIV -> Just use every SETDIV value of VPH_FINE.
- --settime T -> Take data for each VPH_FINE for T milliseconds.
- --vcasn A|B|C|D -> VACSN to vary. Default is the same as specified with --region.
- --firstvcasn V -> Start s-curve taking with VCASN=V.
- --lastvcasn V -> Stop s-curve taking at VCASN=V.
- --vcasndiv V -> Take s-curve every V steps.
- --nrows N -> How many rows to pulse at once. Default depends on region. For A,D: N = 4, for B,D: N = 2.
- --printset -> Print the current VPH_FINE setting.
- --printrow -> Print current row to set.
- --printcol -> Print current column to set.
- -p, --printall -> Print all informations available.
- --analogAlimA -> Not implemented yet.
- --analogAlimB -> Not implemented yet.
- --analogDlimA -> Not implemented yet.
- --analogDlimB -> Not implemented yet.
- --modpulse MOD -> Exponent of the power of two, which gives the divider of the frames to pulse.
- -h, --help -> Print this help.
-END_MESSAGE
- print $message;
- exit 0;
- }
- elsif ( $_[2]->{_non_options_argv}[0] eq 'mask' )
- {
- my $message = <<'END_MESSAGE';
-
-usage: mimosis [GLOBAL OPTIONS] mask [COMMAND OPTIONS]
-
-GLOBAL OPTIONS are:
- -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
- -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
- -a, --singleaccess -> Select single access mode.
- -h, --help -> Print this or <command> specific help.
-
-COMMAND OPTIONS are:
- --region A|B|C|D -> Region to pulse. If provided, ignores --collow, --colhig, --rowlow and --rowhig
- -x, --column INT -> Select column of the Pixel to mask. If not specified, but --region is given, all columns in this region are selected. If neither --region nor --column are given, all columns are selected.
- -y, --row INT -> Select Rows of the Pixel to mask. If not specified, all rows are selected. Pixels whos rows and columns are selected will be masked.
- --mask-all -> Mask all pixels with via an instructions.
- --unmask-all -> Unmask all pixels with via an instructions.
- --hline -> Mask a horizontal line.
- --vline -> Mask a vertical line.
- --square -> Mask a square.
- -h, --help -> Print this help.
-END_MESSAGE
- print $message;
- exit 0;
- }
- elsif ( $_[2]->{_non_options_argv}[0] eq 'instr' )
- {
- my $message = <<'END_MESSAGE';
-
-usage: mimosis [GLOBAL OPTIONS] instr INSTR
-
-GLOBAL OPTIONS are:
- -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
- -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
- -a, --singleaccess -> Select single access mode.
- -h, --help -> Print this or <command> specific help.
-END_MESSAGE
- print $message;
- exit 0;
- }
- elsif ( $_[2]->{_non_options_argv}[0] eq 'reg' )
- {
- my $message = <<'END_MESSAGE';
-
-usage: mimosis [GLOBAL OPTIONS] reg REGISTER VALUE
-
-GLOBAL OPTIONS are:
- -f, --fpga=HEX -> Hex address of the FPGA. Defaults to 0xa000.
- -s, --slow=NUM -> Execute I2C commands with a pause of NUM microseconds in between.
- -a, --singleaccess -> Select single access mode.
- -h, --help -> Print this or <command> specific help.
-END_MESSAGE
- print $message;
- exit 0;
- }
- exit 0;
-}
-
if( $res->{subcommand}[0] eq 'default' )
{
- help_global();
+ Mimosis::help_global();
exit;
}