/* SNC Version 2.0.11: Sat Mar 20 16:04:59 2010: ../sncl2refAlarm.stt */ /* Event flags */ #define ev_l2refPhase 1 /* Program "l2refAlarm" */ #include "seqCom.h" #define NUM_SS 1 #define NUM_CHANNELS 5 #define NUM_EVENTS 1 #define NUM_QUEUES 0 #define MAX_STRING_SIZE 40 #define ASYNC_OPT FALSE #define CONN_OPT TRUE #define DEBUG_OPT FALSE #define MAIN_OPT FALSE #define NEWEF_OPT TRUE #define REENT_OPT FALSE extern struct seqProgram l2refAlarm; /* Variable declarations */ static double l2refPhase; static double l2refPhase_hihi; static double l2refPhase_high; static double l2refPhase_low; static double l2refPhase_lolo; /* Not used (avoids compilation warnings) */ struct UserVar { int dummy; }; /* C code definitions */ # line 19 "../sncl2refAlarm.stt" #define ALARM_MARGINE 1. /* Entry handler */ static void entry_handler(SS_ID ssId, struct UserVar *pVar) { } /* Code for state "l2refMon" in state set "l2refAlarm" */ /* Delay function for state "l2refMon" in state set "l2refAlarm" */ static void D_l2refAlarm_l2refMon(SS_ID ssId, struct UserVar *pVar) { # line 23 "../sncl2refAlarm.stt" } /* Event function for state "l2refMon" in state set "l2refAlarm" */ static long E_l2refAlarm_l2refMon(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 23 "../sncl2refAlarm.stt" if (seq_efTestAndClear(ssId, ev_l2refPhase)) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "l2refMon" in state set "l2refAlarm" */ static void A_l2refAlarm_l2refMon(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { } return; } } /* Code for state "l2refCalc" in state set "l2refAlarm" */ /* Delay function for state "l2refCalc" in state set "l2refAlarm" */ static void D_l2refAlarm_l2refCalc(SS_ID ssId, struct UserVar *pVar) { # line 32 "../sncl2refAlarm.stt" } /* Event function for state "l2refCalc" in state set "l2refAlarm" */ static long E_l2refAlarm_l2refCalc(SS_ID ssId, struct UserVar *pVar, short *pTransNum, short *pNextState) { # line 32 "../sncl2refAlarm.stt" if (1) { *pNextState = 0; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "l2refCalc" in state set "l2refAlarm" */ static void A_l2refAlarm_l2refCalc(SS_ID ssId, struct UserVar *pVar, short transNum) { switch(transNum) { case 0: { # line 28 "../sncl2refAlarm.stt" l2refPhase_hihi = l2refPhase + (ALARM_MARGINE * 2.); # line 28 "../sncl2refAlarm.stt" seq_pvPut(ssId, 1 /* l2refPhase_hihi */, 0); l2refPhase_high = l2refPhase + ALARM_MARGINE; # line 29 "../sncl2refAlarm.stt" seq_pvPut(ssId, 2 /* l2refPhase_high */, 0); l2refPhase_low = l2refPhase - ALARM_MARGINE; # line 30 "../sncl2refAlarm.stt" seq_pvPut(ssId, 3 /* l2refPhase_low */, 0); l2refPhase_lolo = l2refPhase - (ALARM_MARGINE * 2.); # line 31 "../sncl2refAlarm.stt" seq_pvPut(ssId, 4 /* l2refPhase_lolo */, 0); } return; } } /* Exit handler */ static void exit_handler(SS_ID ssId, struct UserVar *pVar) { } /************************ Tables ***********************/ /* Database Blocks */ static struct seqChan seqChan[NUM_CHANNELS] = { {"LLRF:IN20:RH:REF_1_S_PA", (void *)&l2refPhase, "l2refPhase", "double", 1, 2, 1, 1, 0, 0, 0}, {"LLRF:IN20:RH:REF_1_S_PA.HIHI", (void *)&l2refPhase_hihi, "l2refPhase_hihi", "double", 1, 3, 0, 0, 0, 0, 0}, {"LLRF:IN20:RH:REF_1_S_PA.HIGH", (void *)&l2refPhase_high, "l2refPhase_high", "double", 1, 4, 0, 0, 0, 0, 0}, {"LLRF:IN20:RH:REF_1_S_PA.LOW", (void *)&l2refPhase_low, "l2refPhase_low", "double", 1, 5, 0, 0, 0, 0, 0}, {"LLRF:IN20:RH:REF_1_S_PA.LOLO", (void *)&l2refPhase_lolo, "l2refPhase_lolo", "double", 1, 6, 0, 0, 0, 0, 0}, }; /* Event masks for state set l2refAlarm */ /* Event mask for state l2refMon: */ static bitMask EM_l2refAlarm_l2refMon[] = { 0x00000002, }; /* Event mask for state l2refCalc: */ static bitMask EM_l2refAlarm_l2refCalc[] = { 0x00000000, }; /* State Blocks */ static struct seqState state_l2refAlarm[] = { /* State "l2refMon" */ { /* state name */ "l2refMon", /* action function */ (ACTION_FUNC) A_l2refAlarm_l2refMon, /* event function */ (EVENT_FUNC) E_l2refAlarm_l2refMon, /* delay function */ (DELAY_FUNC) D_l2refAlarm_l2refMon, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_l2refAlarm_l2refMon, /* state options */ (0)}, /* State "l2refCalc" */ { /* state name */ "l2refCalc", /* action function */ (ACTION_FUNC) A_l2refAlarm_l2refCalc, /* event function */ (EVENT_FUNC) E_l2refAlarm_l2refCalc, /* delay function */ (DELAY_FUNC) D_l2refAlarm_l2refCalc, /* entry function */ (ENTRY_FUNC) 0, /* exit function */ (EXIT_FUNC) 0, /* event mask array */ EM_l2refAlarm_l2refCalc, /* state options */ (0)}, }; /* State Set Blocks */ static struct seqSS seqSS[NUM_SS] = { /* State set "l2refAlarm" */ { /* ss name */ "l2refAlarm", /* ptr to state block */ state_l2refAlarm, /* number of states */ 2, /* error state */ -1}, }; /* Program parameter list */ static char prog_param[] = ""; /* State Program table (global) */ struct seqProgram l2refAlarm = { /* magic number */ 20000315, /* *name */ "l2refAlarm", /* *pChannels */ seqChan, /* numChans */ NUM_CHANNELS, /* *pSS */ seqSS, /* numSS */ NUM_SS, /* user variable size */ 0, /* *pParams */ prog_param, /* numEvents */ NUM_EVENTS, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF), /* entry handler */ (ENTRY_FUNC) entry_handler, /* exit handler */ (EXIT_FUNC) exit_handler, /* numQueues */ NUM_QUEUES, }; /* Register sequencer commands and program */ void l2refAlarmRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&l2refAlarm); } epicsExportRegistrar(l2refAlarmRegistrar);