Adding counter support.

r1343 | ffr | 2006-12-04 09:46:43 +1100 (Mon, 04 Dec 2006) | 2 lines
This commit is contained in:
Ferdi Franceschini
2006-12-04 09:46:43 +11:00
committed by Douglas Clowes
parent 31f0fca6f5
commit 602a1a5f1b
6 changed files with 273 additions and 92 deletions

View File

@@ -1,30 +1,73 @@
# Makes hipadaba scripts for sics devices.
# Defines the makeHdb<device> commands which create hipadaba nodes along
# with their read and write scripts. The makeHdb<device> commands are called
# by sourcing the hipadaba_configuration.tcl script when SICS is launched.
source ParList.tcl
proc makeHdbCounter {hpath treename sicsname} {
global countParList;
append Name $hpath "/" $treename
eval hmake $Name spy none
foreach {name priv type} $countParList {
set parName [format "%s/%s" $Name $name]
eval hmakescript $parName \"$sicsname $name\" \"$sicsname $name\" float
# Common code for making Motor and ConfigurableVirtualMotor hdb scripts.
set hdbMakeAnyMotorScript {
append devPath $hpath "/" $treename
eval hmake $devPath spy none
foreach {ppName ppPriv ppType ppVal} $primaryProperty {
eval hmakescript "$devPath/$ppName" \"$sicsname\" \"run $sicsname\" $ppType;
}
foreach {name priv type value} $parList {
eval hmakescript "$devPath/$name" \"$sicsname $name\" \"$sicsname $name\" $type
}
}
# These commands make a hipadaba script in their devices namespace
proc ::deviceType::Motor::hdbMakeScript {hpath treename sicsname} {
variable parList;
variable primaryProperty;
global hdbMakeAnyMotorScript;
eval $hdbMakeAnyMotorScript;
}
proc ::deviceType::ConfigurableVirtualMotor::hdbMakeScript {hpath treename sicsname} {
variable parList;
variable primaryProperty;
global hdbMakeAnyMotorScript;
eval $hdbMakeAnyMotorScript;
}
proc ::deviceType::SingleCounter::hdbMakeScript {hpath treename sicsname} {
variable parList;
variable primaryProperty;
append devPath $hpath "/" $treename;
eval hmake $devPath spy none;
foreach {ppName ppPriv ppType ppVal} $primaryProperty {
eval hmakescript "$devPath/$ppName" \"$sicsname getcounts\" \"\" $ppType
}
foreach {name priv type value} $parList {
switch $name {
counting {
set cmd ::deviceType::SingleCounter::counting
eval hmakescript "$devPath/$name" \"\" \"$cmd $sicsname\" $type
}
default {
eval hmakescript "$devPath/$name" \"$sicsname $name\" \"$sicsname $name\" $type
}
}
}
}
# These commands will be called when the hipadaba configuration file is sourced
proc makeHdbMotor {hpath treename sicsname} {
global motParList;
append motName $hpath "/" $treename
eval hmake $motName spy none
eval hmakescript "$motName/position" \"$sicsname\" \"run $sicsname\" float
foreach {name priv type} $motParList {
set parName [format "%s/%s" $motName $name]
eval hmakescript $parName \"$sicsname $name\" \"$sicsname $name\" float
}
::deviceType::Motor::hdbMakeScript $hpath $treename $sicsname;
}
proc makeHdbVirtMotor {hpath treename sicsname} {
append motName $hpath "/" $treename
eval hmake $motName spy none
eval hmakescript "$motName/position" \"$sicsname\" \"run $sicsname\" float
::deviceType::ConfigurableVirtualMotor::hdbMakeScript $hpath $treename $sicsname;
}
proc makeHdbCounter {hpath treename sicsname} {
::deviceType::SingleCounter::hdbMakeScript $hpath $treename $sicsname;
}
#FIXME implement makeHdbHM
proc makeHdbHM {hpath treename sicsname} {
}