diff --git a/src/epics/util/lib/Adc.pm b/src/epics/util/lib/Adc.pm index 6b4d7007647015b559725cb84cde4e871067ac87..adea7b617ffb3373f9261d7fd95164b44dcf4b67 100644 --- a/src/epics/util/lib/Adc.pm +++ b/src/epics/util/lib/Adc.pm @@ -24,8 +24,7 @@ sub initAdc { if ($num eq undef) { $num = $::adcCnt; } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; + print "ADC in ADC.pm $::adcCnt; type='$type'; num=$num\n"; # Check if this is a supported board type if ($board_types{$type} != 1) { @@ -39,12 +38,16 @@ sub initAdc { $::adcType[$::adcCnt] = $type; $::adcNum[$::adcCnt] = $num; + $::card2array[$::partCnt] = $::adcCnt; + print "foo= $::partCnt with array $::card2array[$::partCnt]\n"; $::adcCnt++; $::partUsed[$::partCnt] = 1; foreach (0 .. $::partCnt) { if ("Adc" eq $::partInputType[$_][0]) { print $_," ", $::xpartName[$_], "\n"; + print "Found adc connect \n"; } + } } @@ -78,27 +81,29 @@ sub printFrontEndVars { # Returns calculated code string sub frontEndInitCode { my ($i) = @_; - my $anum = substr($::xpartName[$i],3,1); - my $calcExp = "// ADC $anum\n"; - #print $calcExp, "\n"; + my $ii; + $ii = $::adcNum[$i]; + my $calcExp = "// ADC $ii\n"; + print $calcExp, "\n"; + print "LOOK Card $ii\n"; %seen = (); foreach (0 .. $::partCnt) { foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $anum == $::partInNum[$_][$inp]) { + if ("Adc" eq $::partInputType[$_][$inp] && $ii == $::partInNum[$_][$inp]) { #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; $seen{$::partInputPort[$_][$inp]}=1; } } } foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; + print $_, ","; $calcExp .= "dWordUsed\["; - $calcExp .= $anum; + $calcExp .= $i; $calcExp .= "\]\["; $calcExp .= $_; $calcExp .= "\] = 1;\n"; } - #print "\n"; + print "\n"; return $calcExp; } @@ -109,8 +114,15 @@ sub frontEndInitCode { sub fromExp { my ($i, $j) = @_; my $card = $::partInNum[$i][$j]; + my $ii; + for($ii=0; $ii < $::adcCnt; $ii++) { + if($::adcNum[$ii] == $card) { + $car = $ii; + }; + } my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; + print "Found card $card $car chan $chan vars $i $j\n"; + return "dWord\[" . $car . "\]\[" . $chan . "\]"; } # Return front end code diff --git a/src/epics/util/lib/Adcx0.pm b/src/epics/util/lib/Adcx0.pm deleted file mode 100644 index d6c0f1319ddea1365d203ca9ff80bcb76723e25d..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx0.pm +++ /dev/null @@ -1,102 +0,0 @@ -package CDS::Adcx0; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - ; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx1.pm b/src/epics/util/lib/Adcx1.pm deleted file mode 100644 index db0b672ef7fe85dc1b09a876c9f9b20ad00c5787..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx1.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx1; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i From adcx1\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx2.pm b/src/epics/util/lib/Adcx2.pm deleted file mode 100644 index b278f66348f8080210b0daf4a0f0c38f3d0356cc..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx2.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx2; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i from adcx2\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx3.pm b/src/epics/util/lib/Adcx3.pm deleted file mode 100644 index 776e9d56acae0ed143ddc7f8b74f86bf2eaf844d..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx3.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx3; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i from adcx3\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx4.pm b/src/epics/util/lib/Adcx4.pm deleted file mode 100644 index 203b1eab381684a4aa3f94560b007dd30469aca5..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx4.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx4; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i from adcx3\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx5.pm b/src/epics/util/lib/Adcx5.pm deleted file mode 100644 index a9b3019271efc7d82b2ec4ca297e45e2b61dfdbc..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx5.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx5; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i from adcx5\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx6.pm b/src/epics/util/lib/Adcx6.pm deleted file mode 100644 index 117f7fa744a7614c7c407afca7e8d1c38507c383..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx6.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx6; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i from adcx6\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx7.pm b/src/epics/util/lib/Adcx7.pm deleted file mode 100644 index 7133b8ca0d7a917b166a2568616c63bc5f77cf33..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx7.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx7; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i from adcx7\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx8.pm b/src/epics/util/lib/Adcx8.pm deleted file mode 100644 index 1f58a9801d9cad159c0adcc3179925736e2ecb77..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx8.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx8; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i from adcx8\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Adcx9.pm b/src/epics/util/lib/Adcx9.pm deleted file mode 100644 index 04cb1f37f5b1b27d55836675bba778ead1d1fb7d..0000000000000000000000000000000000000000 --- a/src/epics/util/lib/Adcx9.pm +++ /dev/null @@ -1,122 +0,0 @@ -package CDS::Adcx9; -use Exporter; -@ISA = ('Exporter'); - -# ADC cards we support -%board_types = ( - GSC_16AI64SSA => 1, # Slow General Standards board - GSC_18AISS6C => 1 # 18-bit 6 channel General Standards board -); - -# default board type (if none specified with type=<type> in block Description) -$default_board_type = "GSC_16AI64SSA"; - -sub initAdc { - my ($node) = @_; - $::adcPartNum[$::adcCnt] = $::partCnt; - # Set ADC type and number - my $desc = ${$node->{FIELDS}}{"Description"}; - my ($type) = $desc =~ m/type=([^,]+)/g; - my ($num) = $desc =~ m/card_num=([^,]+)/g; - if ($type eq undef) { - $type = $default_board_type; - } - if ($num eq undef) { - $num = $::adcCnt; - } - print "ADC $::adcCnt; type='$type'; num=$num\n"; - #print "foo=$board_types{$type}\n"; - - # Check if this is a supported board type - if ($board_types{$type} != 1) { - print "Unsupported board type\n"; - print "Known board types:\n"; - foreach (keys %board_types) { - print "\t$_\n"; - } - exit 1; - } - - $::adcType[$::adcCnt] = $type; - $::adcNum[$::adcCnt] = $num; - $::adcCnt++; - $::partUsed[$::partCnt] = 1; - foreach (0 .. $::partCnt) { - if ("Adc" eq $::partInputType[$_][0]) { - print $_," ", $::xpartName[$_], "\n"; - } - } -} - -sub partType { - return Adc; -} - -# Print Epics communication structure into a header file -# Current part number is passed as first argument -sub printHeaderStruct { - my ($i) = @_; - ; -} - -# Print Epics variable definitions -# Current part number is passed as first argument -sub printEpics { - my ($i) = @_; - ; -} - -# Print variable declarations int front-end file -# Current part number is passed as first argument -sub printFrontEndVars { - my ($i) = @_; - ; -} - -# Return front end initialization code -# Argument 1 is the part number -# Returns calculated code string -sub frontEndInitCode { - my ($i) = @_; - my $calcExp = "// ADC $i from adcx9\n"; - #print $calcExp, "\n"; - %seen = (); - foreach (0 .. $::partCnt) { - foreach $inp (0 .. $::partInCnt[$_]) { - if ("Adc" eq $::partInputType[$_][$inp] && $i == $::partInNum[$_][$inp]) { - #print $_," ", $::xpartName[$_], " ", $::partInputPort[$_][$inp], "\n"; - $seen{$::partInputPort[$_][$inp]}=1; - } - } - } - foreach (sort { $a <=> $b } keys %seen) { - # print $_, ","; - $calcExp .= "dWordUsed\["; - $calcExp .= $i; - $calcExp .= "\]\["; - $calcExp .= $_; - $calcExp .= "\] = 1;\n"; - } - #print "\n"; - return $calcExp; -} - -# Figure out part input code -# Argument 1 is the part number -# Argument 2 is the input number -# Returns calculated input code -sub fromExp { - my ($i, $j) = @_; - my $card = $::partInNum[$i][$j]; - my $chan = $::partInputPort[$i][$j]; - return "dWord\[" . $card . "\]\[" . $chan . "\]"; -} - -# Return front end code -# Argument 1 is the part number -# Returns calculated code string - -sub frontEndCode { - my ($i) = @_; - return ""; -} diff --git a/src/epics/util/lib/Parser3.pm b/src/epics/util/lib/Parser3.pm index 56d366603d318ee53aa15f1c2a6d717d85434c43..fc4b95031d9270e4e030b2adc476f6767b22f6da 100644 --- a/src/epics/util/lib/Parser3.pm +++ b/src/epics/util/lib/Parser3.pm @@ -310,6 +310,9 @@ sub merge_references { my $part_name = transform_part_name(${$node->{FIELDS}}{"SourceBlock"}); if (-e "lib/$part_name.pm") { return 0; # Library part + } else { + my $adcStr = substr($part_name, 0, 3); + return 0 if ($adcStr eq "Adc"); } my $ref = ${$node->{FIELDS}}{"SourceBlock"}; print "Found a library reference $ref\n"; @@ -572,8 +575,16 @@ sub node_processing { $part_name = "Fcn"; # === MA === } # === MA === if (! -e "lib/$part_name.pm") { - die "Can't find part code in lib/$part_name.pm\n"; + my $adcStr = substr($part_name, 0, 3); + if ($adcStr eq "Adc") { + require "lib/Adc.pm"; + CDS::Adc::initAdc($node); + $::partType[$::partCnt] = CDS::Adc::partType($node); + } else { + die "Can't find part code in lib/$part_name.pm\n"; + } } else { + require "lib/$part_name.pm"; if ($part_name eq "Dac") { $::partType[$::partCnt] = CDS::Dac::initDac($node); @@ -629,70 +640,10 @@ sub node_processing { die "Too many Digital I/O modules \(max is $::maxDioMod\)\n"; } } -# Added for ADC PART CHANGE ***************** - if ($part_name eq "Adcx0") { - require "lib/Adc.pm"; - #CDS::Adc::initAdc($node); - CDS::Adcx0::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx0::partType($node); - } - if ($part_name eq "Adcx1") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx1::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx1::partType($node); - } - if ($part_name eq "Adcx2") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx2::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx2::partType($node); - } - if ($part_name eq "Adcx3") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx3::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx3::partType($node); - } - if ($part_name eq "Adcx4") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx4::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx4::partType($node); - } - if ($part_name eq "Adcx5") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx5::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx5::partType($node); - } - if ($part_name eq "Adcx6") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx6::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx6::partType($node); - } - if ($part_name eq "Adcx7") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx7::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx7::partType($node); - } - if ($part_name eq "Adcx8") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx8::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx8::partType($node); - } - if ($part_name eq "Adcx9") { - require "lib/Adc.pm"; - #CDS::Adcx1::initAdc($node); - CDS::Adcx9::initAdc($node); - $::partType[$::partCnt] = CDS::Adcx9::partType($node); - } -# End of ADC PART CHANGE ********************************** $::partType[$::partCnt] = ("CDS::" . $part_name . "::partType") -> ($node, $::partCnt); + + #print "PNAME = $part_name \n"; } } # For easy access