# Record Configuration 

# DTYP 
# field (DTYP, "stream")

# Format of INP / OUT link 
# field (INP, "@file protocol port address")
# field (OUT, "@file protocol port address")
#
# field (INP, "@file protocol(arg) port address")
# field (OUT, "@file protocol(arg1,arg2,arg3) port address")

# file  - Name of the protocol file. The file is searched in the /cfg directory of the IOC 
# protocol - Name of the protocol in the file 
# port - Name of the port as configured in the startup script 
# address - Address of the device for ports with addresses like GPIB. Optional. 
# Some protocol require arguments.
# In this case append arguments to the protocol name in parentheses without spaces: 

record(bo,"SIOC:B044:FM01:RFFreqDisable") {
  field(DESC,"Disable Readback")
  field(ASG,"Internal")
  field(DOL,"1")
  field(ZNAM,"On")
  field(ONAM,"Off")
  field(OSV,"MAJOR")
}
record(seq,"SIOC:B044:FM01:RFFreqSetSeq") {
  field(DESC,"Set Config")
  field(ASG,"Internal")
  field(PINI,"YES")
  field(DOL1,"1")
  field(LNK1,"SIOC:B044:FM01:RFFreqDisable  PP")
  field(LNK2,"SIOC:B044:FM01:RFFreqConfigSetpt.PROC  PP")
  field(DLY3,"0.2")
  field(LNK3,"SIOC:B044:FM01:RFFreqArmStartSetpt.PROC  PP")
  field(DLY4,"0.2")
  field(LNK4,"SIOC:B044:FM01:RFFreqArmStopSetpt.PROC  PP")
  field(DLY5,"0.2")
  field(LNK5,"SIOC:B044:FM01:RFFreqArmTimerSetpt.PROC  PP")
  field(DLY6,"0.2")
  field(LNK6,"SIOC:B044:FM01:RFFreqTrigContSetpt.PROC  PP")
  field(FLNK,"SIOC:B044:FM01:RFFreqSetSeq2")
}

record(seq,"SIOC:B044:FM01:RFFreqSetSeq2") {
  field(DESC,"Set Config")
  field(ASG,"Internal")
  field(DLY1,"0.2")
  field(LNK1,"SIOC:B044:FM01:RFFreqAttn.PROC  PP")
  field(DLY2,"0.2")
  field(LNK2,"SIOC:B044:FM01:RFFreqFiltState.PROC  PP")
  field(DLY3,"0.2")
  field(LNK3,"SIOC:B044:FM01:RFFreqCoupling.PROC  PP")
  field(DLY4,"0.2")
  field(LNK4,"SIOC:B044:FM01:RFFreqImped.PROC  PP")
  field(DLY5,"0.2")
  field(LNK5,"SIOC:B044:FM01:RFFreqArm.PROC  PP")
  field(DLY6,"1")
  field(LNK6,"SIOC:B044:FM01:RFFreqDisable  PP")
  field(LNK7,"SIOC:B044:FM01:RFFreqID.PROC  PP")
  field(DLY8,"0.2")
  field(LNK8,"SIOC:B044:FM01:RFFreqStatus.PROC  PP")
}

record(ai, "SIOC:B044:FM01:RFFreqHz") {
  field(DESC, "Frequency in Hz")
  field(DTYP, "stream")
  field(INP, "@Hp53181A.proto.db GET_CH_VAL 2 3")    
  field(EGU, "Hz")
  field(PREC, "2")
  field(MDEL, "0.01")
  field(SCAN, "10 second")
  field(FLNK, "SIOC:B044:FM01:RFFreqHzNo476")
  field(SDIS,"SIOC:B044:FM01:RFFreqDisable  NPP NMS")
}

record(calc, "SIOC:B044:FM01:RFFreqHzNo476") {
  field(DESC, "Freq in Hz - base")
  field(CALC, "A-B")
  field(INPA, "SIOC:B044:FM01:RFFreqHz NPP NMS")
  field(INPB, "476316000")
  field(EGU, "Hz")
  field(PREC, "2")
  field(MDEL, "0.01")
  field(FLNK, "SIOC:B044:FM01:RFFreq")
}

record(calc, "SIOC:B044:FM01:RFFreq") {
  field(DESC, "Frequency")
  field(CALC, "A/1000000.0")
  field(INPA, "SIOC:B044:FM01:RFFreqHz NPP MS")
  field(EGU, "MHz")
  field(PREC, "7")
  field(MDEL, "0.00000005")
  field(HSV, "MINOR")
  field(LSV, "MINOR")
  field(HHSV, "MAJOR")
  field(LLSV, "MAJOR")
  field(HOPR, "476.4")
  field(LOPR, "476.2")
  field(HIGH, "476.35")
  field(LOW, "476.25")
  field(HIHI, "476.37")
  field(LOLO, "476.23")
  field(FLNK, "SIOC:B044:FM01:RFFreqArm")
}

record(stringout,"SIOC:B044:FM01:RFFreqArm") {
  field(DESC,"Arm")
  field(ASG,"Internal")
  field(VAL,"INIT")
  field(DTYP, "stream")
  field(OUT, "@Hp53181A.proto.db SET_CH_VAL 2 3")    
}

record(bo, "SIOC:B044:FM01:RFFreqAttn") {
  field(DESC, "Freq Counter Inp Atten ")
  field(DTYP, "stream")
  field(DOL,"0")  
  field(OUT, "@Hp53181A.proto.db SET_INP_ATT(0) 2 3")    
}

record(bo, "SIOC:B044:FM01:RFFreqFiltState") {
  field(DESC, "Freq Counter Filter Off/On")
  field(DTYP, "stream")   
  field(DOL,"0")
  field(OUT, "@Hp53181A.proto.db SET_INP_FILT(0) 2 3")      
}

record(bo, "SIOC:B044:FM01:RFFreqCoupling") {
  field(DESC, "Freq Counter Inp Coupling")
  field(DTYP, "stream") 
  field(DOL,"0")
  field(OUT, "@Hp53181A.proto.db SET_INP_COUP(0) 2 3")        
}

record(bo, "SIOC:B044:FM01:RFFreqImped") {
  field(DESC, "Freq Counter Inp Impedance")
  field(DTYP, "stream") 
  field(DOL,"0")
  field(OUT, "@Hp53181A.proto.db SET_INP_IMP(0) 2 3")    
}

record(stringin, "SIOC:B044:FM01:RFFreqID") {
  field(DESC, "Freq Counter ID String")
  field(DTYP, "stream") 
  field(INP, "@Hp53181A.proto.db GET_IDN 2 3")   
  field(FLNK, "SIOC:B044:FM01:RFFreqOption")
  field(SDIS,"SIOC:B044:FM01:RFFreqDisable  NPP NMS")
}

record(stringin, "SIOC:B044:FM01:RFFreqOption") {
  field(DESC, "Freq Counter Option String")
  field(DTYP, "stream")
  field(INP, "@Hp53181A.proto.db GET_OPT 2 3")  
  field(SDIS,"SIOC:B044:FM01:RFFreqDisable  NPP NMS")
}

record(stringin, "SIOC:B044:FM01:RFFreqStatus") {
  field(DESC, "Freq Counter Status")
  field(DTYP, "stream")
  field(INP, "@Hp53181A.proto.db GET_SYST_ERR 2 3")
  field(SDIS,"SIOC:B044:FM01:RFFreqDisable  NPP NMS")
}
record(stringout,"SIOC:B044:FM01:RFFreqAnythingSetpt") {
	field(DESC,"Set Anything")
	field(ASG,"Internal")
	field(VAL,"")
    field(DTYP, "stream")
    field(OUT, "@Hp53181A.proto.db SET_CH_VAL 2 3")   
}
record(stringout,"SIOC:B044:FM01:RFFreqArmStartSetpt") {
	field(DESC,"Set ArmStart")
	field(ASG,"Internal")
	field(VAL,"FREQ:ARM:START:SOURCE IMM")
    field(DTYP, "stream")
    field(OUT, "@Hp53181A.proto.db SET_CH_VAL 2 3")   
}
record(stringout,"SIOC:B044:FM01:RFFreqArmStopSetpt") {
	field(DESC,"Set ArmStop")
	field(ASG,"Internal")
	field(VAL,"FREQ:ARM:STOP:SOURCE TIMER")
    field(DTYP, "stream")
    field(OUT, "@Hp53181A.proto.db SET_CH_VAL 2 3")   
}
record(stringout,"SIOC:B044:FM01:RFFreqArmTimerSetpt") {
	field(DESC,"Set ArmTimer")
	field(ASG,"Internal")
	field(VAL,"FREQ:ARM:STOP:TIMER 0.8")
    field(DTYP, "stream")
    field(OUT, "@Hp53181A.proto.db SET_CH_VAL 2 3")   
}
record(stringout,"SIOC:B044:FM01:RFFreqTrigContSetpt") {
	field(DESC,"Set TrigCont")
	field(ASG,"Internal")
	field(VAL,"INIT:CONT OFF")
    field(DTYP, "stream")
    field(OUT, "@Hp53181A.proto.db SET_CH_VAL 2 3")   
}
record(stringout,"SIOC:B044:FM01:RFFreqConfigSetpt") {
	field(DESC,"Set Config")
	field(ASG,"Internal")
	field(VAL,"CONF:FREQ 476.3MHz,0.01Hz,(@2)")
    field(DTYP, "stream")
    field(OUT, "@Hp53181A.proto.db SET_CH_VAL 2 3")   
}
