#*************************************************************************
# Copyright (c) 2013 UChicago Argonne LLC, as Operator of Argonne
#     National Laboratory.
# Copyright (c) 2002 The Regents of the University of California, as
#     Operator of Los Alamos National Laboratory.
# EPICS BASE is distributed subject to a Software License Agreement found
# in file LICENSE that is included with this distribution.
#*************************************************************************


menu(aoOIF) {
    choice(aoOIF_Full,"Full")
    choice(aoOIF_Incremental,"Incremental")
}

recordtype(ao) {


    include "dbCommon.dbd"
    %
    %/* Declare Device Support Entry Table */
    %struct aoRecord;
    %typedef struct aodset {
    %    dset common; /*init_record returns: (0,2)=>(success,success no convert)*/
    %    long (*write_ao)(struct aoRecord *prec); /*(0)=>(success ) */
    %    long (*special_linconv)(struct aoRecord *prec, int after);
    %} aodset;
    %#define HAS_aodset
    %
    field(VAL,DBF_DOUBLE) {
        prompt("Desired Output")
        promptgroup("50 - Output")
        asl(ASL0)
        pp(TRUE)
    }
    field(OVAL,DBF_DOUBLE) {
        prompt("Output Value")
    }
    field(OUT,DBF_OUTLINK) {
        prompt("Output Specification")
        promptgroup("50 - Output")
        interest(1)
    }
    field(OROC,DBF_DOUBLE) {
        prompt("Output Rate of Change")
        promptgroup("50 - Output")
        interest(1)
    }
    field(DOL,DBF_INLINK) {
        prompt("Desired Output Loc")
        promptgroup("40 - Input")
        interest(1)
    }
    field(OMSL,DBF_MENU) {
        prompt("Output Mode Select")
        promptgroup("50 - Output")
        interest(1)
        menu(menuOmsl)
    }
    field(OIF,DBF_MENU) {
        prompt("Out Full/Incremental")
        promptgroup("50 - Output")
        interest(1)
        menu(aoOIF)
    }
    field(PREC,DBF_SHORT) {
        prompt("Display Precision")
        promptgroup("80 - Display")
        interest(1)
        prop(YES)
    }
    field(LINR,DBF_MENU) {
        prompt("Linearization")
        promptgroup("60 - Convert")
        special(SPC_LINCONV)
        pp(TRUE)
        interest(1)
        menu(menuConvert)
    }
    field(EGUF,DBF_DOUBLE) {
        prompt("Eng Units Full")
        promptgroup("60 - Convert")
        special(SPC_LINCONV)
        pp(TRUE)
        interest(1)
    }
    field(EGUL,DBF_DOUBLE) {
        prompt("Eng Units Low")
        promptgroup("60 - Convert")
        special(SPC_LINCONV)
        pp(TRUE)
        interest(1)
    }
    field(EGU,DBF_STRING) {
        prompt("Engineering Units")
        promptgroup("80 - Display")
        interest(1)
        size(16)
        prop(YES)
    }
    field(ROFF,DBF_ULONG) {
        prompt("Raw Offset")
        pp(TRUE)
        interest(2)
    }
    field(EOFF,DBF_DOUBLE) {
        prompt("EGU to Raw Offset")
        promptgroup("60 - Convert")
        pp(TRUE)
        interest(2)
    }
    field(ESLO,DBF_DOUBLE) {
        prompt("EGU to Raw Slope")
        promptgroup("60 - Convert")
        pp(TRUE)
        interest(2)
        initial("1")
    }
    field(DRVH,DBF_DOUBLE) {
        prompt("Drive High Limit")
        promptgroup("30 - Action")
        pp(TRUE)
        interest(1)
        prop(YES)
    }
    field(DRVL,DBF_DOUBLE) {
        prompt("Drive Low Limit")
        promptgroup("30 - Action")
        pp(TRUE)
        interest(1)
        prop(YES)
    }
    field(HOPR,DBF_DOUBLE) {
        prompt("High Operating Range")
        promptgroup("80 - Display")
        interest(1)
        prop(YES)
    }
    field(LOPR,DBF_DOUBLE) {
        prompt("Low Operating Range")
        promptgroup("80 - Display")
        interest(1)
        prop(YES)
    }
    field(AOFF,DBF_DOUBLE) {
        prompt("Adjustment Offset")
        promptgroup("60 - Convert")
        pp(TRUE)
        interest(1)
    }
    field(ASLO,DBF_DOUBLE) {
        prompt("Adjustment Slope")
        promptgroup("60 - Convert")
        pp(TRUE)
        interest(1)
    }
    field(HIHI,DBF_DOUBLE) {
        prompt("Hihi Alarm Limit")
        promptgroup("70 - Alarm")
        pp(TRUE)
        interest(1)
        prop(YES)
    }
    field(LOLO,DBF_DOUBLE) {
        prompt("Lolo Alarm Limit")
        promptgroup("70 - Alarm")
        pp(TRUE)
        interest(1)
        prop(YES)
    }
    field(HIGH,DBF_DOUBLE) {
        prompt("High Alarm Limit")
        promptgroup("70 - Alarm")
        pp(TRUE)
        interest(1)
        prop(YES)
    }
    field(LOW,DBF_DOUBLE) {
        prompt("Low Alarm Limit")
        promptgroup("70 - Alarm")
        pp(TRUE)
        interest(1)
        prop(YES)
    }
    field(HHSV,DBF_MENU) {
        prompt("Hihi Severity")
        promptgroup("70 - Alarm")
        pp(TRUE)
        interest(1)
        prop(YES)
        menu(menuAlarmSevr)
    }
    field(LLSV,DBF_MENU) {
        prompt("Lolo Severity")
        promptgroup("70 - Alarm")
        pp(TRUE)
        interest(1)
        prop(YES)
        menu(menuAlarmSevr)
    }
    field(HSV,DBF_MENU) {
        prompt("High Severity")
        promptgroup("70 - Alarm")
        pp(TRUE)
        interest(1)
        prop(YES)
        menu(menuAlarmSevr)
    }
    field(LSV,DBF_MENU) {
        prompt("Low Severity")
        promptgroup("70 - Alarm")
        pp(TRUE)
        interest(1)
        prop(YES)
        menu(menuAlarmSevr)
    }
    field(HYST,DBF_DOUBLE) {
        prompt("Alarm Deadband")
        promptgroup("70 - Alarm")
        interest(1)
    }
    field(ADEL,DBF_DOUBLE) {
        prompt("Archive Deadband")
        promptgroup("80 - Display")
        interest(1)
    }
    field(MDEL,DBF_DOUBLE) {
        prompt("Monitor Deadband")
        promptgroup("80 - Display")
        interest(1)
    }
    field(RVAL,DBF_LONG) {
        prompt("Current Raw Value")
        pp(TRUE)
    }
    field(ORAW,DBF_LONG) {
        prompt("Previous Raw Value")
        special(SPC_NOMOD)
        interest(3)
    }
    field(RBV,DBF_LONG) {
        prompt("Readback Value")
        special(SPC_NOMOD)
    }
    field(ORBV,DBF_LONG) {
        prompt("Prev Readback Value")
        special(SPC_NOMOD)
        interest(3)
    }
    field(PVAL,DBF_DOUBLE) {
        prompt("Previous value")
        special(SPC_NOMOD)
        interest(3)
    }
    field(LALM,DBF_DOUBLE) {
        prompt("Last Value Alarmed")
        special(SPC_NOMOD)
        interest(3)
    }
    field(ALST,DBF_DOUBLE) {
        prompt("Last Value Archived")
        special(SPC_NOMOD)
        interest(3)
    }
    field(MLST,DBF_DOUBLE) {
        prompt("Last Val Monitored")
        special(SPC_NOMOD)
        interest(3)
    }
    field(PBRK,DBF_NOACCESS) {
        prompt("Ptrto brkTable")
        special(SPC_NOMOD)
        interest(4)
        extra("void *   pbrk")
    }
    field(INIT,DBF_SHORT) {
        prompt("Initialized?")
        special(SPC_NOMOD)
        interest(3)
    }
    field(LBRK,DBF_SHORT) {
        prompt("LastBreak Point")
        special(SPC_NOMOD)
        interest(3)
    }
    field(SIOL,DBF_OUTLINK) {
        prompt("Simulation Output Link")
        promptgroup("90 - Simulate")
        interest(1)
    }
    field(SIML,DBF_INLINK) {
        prompt("Simulation Mode Link")
        promptgroup("90 - Simulate")
        interest(1)
    }
    field(SIMM,DBF_MENU) {
        prompt("Simulation Mode")
        special(SPC_MOD)
        interest(1)
        menu(menuYesNo)
    }
    field(SIMS,DBF_MENU) {
        prompt("Simulation Mode Severity")
        promptgroup("90 - Simulate")
        interest(2)
        menu(menuAlarmSevr)
    }
    field(OLDSIMM,DBF_MENU) {
        prompt("Prev. Simulation Mode")
        special(SPC_NOMOD)
        interest(4)
        menu(menuSimm)
    }
    field(SSCN,DBF_MENU) {
        prompt("Sim. Mode Scan")
        promptgroup("90 - Simulate")
        interest(1)
        menu(menuScan)
        initial("65535")
    }
    field(SDLY,DBF_DOUBLE) {
        prompt("Sim. Mode Async Delay")
        promptgroup("90 - Simulate")
        interest(2)
        initial("-1.0")
    }
    %#include "callback.h"
    field(SIMPVT,DBF_NOACCESS) {
        prompt("Sim. Mode Private")
        special(SPC_NOMOD)
        interest(4)
        extra("epicsCallback            *simpvt")
    }
    field(IVOA,DBF_MENU) {
        prompt("INVALID output action")
        promptgroup("50 - Output")
        interest(2)
        menu(menuIvoa)
    }
    field(IVOV,DBF_DOUBLE) {
        prompt("INVALID output value")
        promptgroup("50 - Output")
        interest(2)
    }
    field(OMOD,DBF_UCHAR) {
        prompt("Was OVAL modified?")
        special(SPC_NOMOD)
    }
}

