/* Generated with snc from ../LaserIrisConfig.stt */ /* Program "sncIrisConfig" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ # line 9 "../LaserIrisConfig.stt" static float X_Setp[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; # line 19 "../LaserIrisConfig.stt" static float Ang_Setp[12] = {0,0,0,0,0,0,0,0,0,0,0,0}; # line 29 "../LaserIrisConfig.stt" static short ConfgSel = 0; # line 39 "../LaserIrisConfig.stt" static short ConfgCalc = 0; # line 48 "../LaserIrisConfig.stt" static float X_Act = 0; # line 49 "../LaserIrisConfig.stt" static float Ang_Act = 0; # line 66 "../LaserIrisConfig.stt" static int i = 0; /* Program init func */ static void G_prog_init(struct UserVar *pVar) { } /****** Code for state "init" in state set "ssIrisConfig" ******/ /* Delay function for state "init" in state set "ssIrisConfig" */ static void D_ssIrisConfig_init(SS_ID ssId, struct UserVar *pVar) { # line 77 "../LaserIrisConfig.stt" seq_delayInit(ssId, 0, (10)); } /* Event function for state "init" in state set "ssIrisConfig" */ static seqBool E_ssIrisConfig_init(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 77 "../LaserIrisConfig.stt" if (seq_delay(ssId, 0)) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "init" in state set "ssIrisConfig" */ static void A_ssIrisConfig_init(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 79 "../LaserIrisConfig.stt" printf("state init \n"); } return; } } /****** Code for state "check" in state set "ssIrisConfig" ******/ /* Delay function for state "check" in state set "ssIrisConfig" */ static void D_ssIrisConfig_check(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "check" in state set "ssIrisConfig" */ static seqBool E_ssIrisConfig_check(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 87 "../LaserIrisConfig.stt" if (seq_pvConnectCount(ssId) < seq_pvAssignCount(ssId)) { *pNextState = 2; *pTransNum = 0; return TRUE; } # line 95 "../LaserIrisConfig.stt" if (seq_efTestAndClear(ssId, 2/*ConfgCalc_ef*/)) { *pNextState = 1; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "check" in state set "ssIrisConfig" */ static void A_ssIrisConfig_check(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 89 "../LaserIrisConfig.stt" printf("%i of %i PVs connected \n", seq_pvConnectCount(ssId), seq_pvAssignCount(ssId)); # line 90 "../LaserIrisConfig.stt" printf("state disconnected \n"); } return; case 1: { # line 97 "../LaserIrisConfig.stt" i = ConfgSel; # line 99 "../LaserIrisConfig.stt" X_Act = X_Setp[i]; # line 100 "../LaserIrisConfig.stt" Ang_Act = Ang_Setp[i]; # line 102 "../LaserIrisConfig.stt" printf("IRIS Config # %i Activated: X and Angle Requested Val Updated to %f , %f \n", ConfgSel, X_Act, Ang_Act); # line 104 "../LaserIrisConfig.stt" seq_pvPut(ssId, 26/*X_Act*/, 0); # line 105 "../LaserIrisConfig.stt" seq_pvPut(ssId, 27/*Ang_Act*/, 0); } return; } } /****** Code for state "disconnected" in state set "ssIrisConfig" ******/ /* Delay function for state "disconnected" in state set "ssIrisConfig" */ static void D_ssIrisConfig_disconnected(SS_ID ssId, struct UserVar *pVar) { # line 117 "../LaserIrisConfig.stt" seq_delayInit(ssId, 0, (10)); } /* Event function for state "disconnected" in state set "ssIrisConfig" */ static seqBool E_ssIrisConfig_disconnected(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 112 "../LaserIrisConfig.stt" if (seq_pvConnectCount(ssId) == seq_pvAssignCount(ssId)) { *pNextState = 1; *pTransNum = 0; return TRUE; } # line 117 "../LaserIrisConfig.stt" if (seq_delay(ssId, 0)) { *pNextState = 2; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "disconnected" in state set "ssIrisConfig" */ static void A_ssIrisConfig_disconnected(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 114 "../LaserIrisConfig.stt" printf("All PV's Reconnected \n"); } return; case 1: { # line 119 "../LaserIrisConfig.stt" printf("Warning Some PV's are Disconnected \n"); } return; } } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"IRIS:LR20:118:X_0_CON", (size_t)&X_Setp[0], "X_Setp[0]", "float", 1, 3, 0, 1, 0, 0}, {"IRIS:LR20:118:X_1_CON", (size_t)&X_Setp[1], "X_Setp[1]", "float", 1, 4, 0, 1, 0, 0}, {"IRIS:LR20:118:X_2_CON", (size_t)&X_Setp[2], "X_Setp[2]", "float", 1, 5, 0, 1, 0, 0}, {"IRIS:LR20:118:X_3_CON", (size_t)&X_Setp[3], "X_Setp[3]", "float", 1, 6, 0, 1, 0, 0}, {"IRIS:LR20:118:X_4_CON", (size_t)&X_Setp[4], "X_Setp[4]", "float", 1, 7, 0, 1, 0, 0}, {"IRIS:LR20:118:X_5_CON", (size_t)&X_Setp[5], "X_Setp[5]", "float", 1, 8, 0, 1, 0, 0}, {"IRIS:LR20:118:X_6_CON", (size_t)&X_Setp[6], "X_Setp[6]", "float", 1, 9, 0, 1, 0, 0}, {"IRIS:LR20:118:X_7_CON", (size_t)&X_Setp[7], "X_Setp[7]", "float", 1, 10, 0, 1, 0, 0}, {"IRIS:LR20:118:X_8_CON", (size_t)&X_Setp[8], "X_Setp[8]", "float", 1, 11, 0, 1, 0, 0}, {"IRIS:LR20:118:X_9_CON", (size_t)&X_Setp[9], "X_Setp[9]", "float", 1, 12, 0, 1, 0, 0}, {"IRIS:LR20:118:X_10_CON", (size_t)&X_Setp[10], "X_Setp[10]", "float", 1, 13, 0, 1, 0, 0}, {"IRIS:LR20:118:X_11_CON", (size_t)&X_Setp[11], "X_Setp[11]", "float", 1, 14, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_0_CON", (size_t)&Ang_Setp[0], "Ang_Setp[0]", "float", 1, 15, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_1_CON", (size_t)&Ang_Setp[1], "Ang_Setp[1]", "float", 1, 16, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_2_CON", (size_t)&Ang_Setp[2], "Ang_Setp[2]", "float", 1, 17, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_3_CON", (size_t)&Ang_Setp[3], "Ang_Setp[3]", "float", 1, 18, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_4_CON", (size_t)&Ang_Setp[4], "Ang_Setp[4]", "float", 1, 19, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_5_CON", (size_t)&Ang_Setp[5], "Ang_Setp[5]", "float", 1, 20, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_6_CON", (size_t)&Ang_Setp[6], "Ang_Setp[6]", "float", 1, 21, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_7_CON", (size_t)&Ang_Setp[7], "Ang_Setp[7]", "float", 1, 22, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_8_CON", (size_t)&Ang_Setp[8], "Ang_Setp[8]", "float", 1, 23, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_9_CON", (size_t)&Ang_Setp[9], "Ang_Setp[9]", "float", 1, 24, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_10_CON", (size_t)&Ang_Setp[10], "Ang_Setp[10]", "float", 1, 25, 0, 1, 0, 0}, {"IRIS:LR20:118:ANGLE_11_CON", (size_t)&Ang_Setp[11], "Ang_Setp[11]", "float", 1, 26, 0, 1, 0, 0}, {"IRIS:LR20:118:CONFG_SEL.VAL", (size_t)&ConfgSel, "ConfgSel", "short", 1, 27, 1, 1, 0, 0}, {"IRIS:LR20:118:CONFG_CALC.VAL", (size_t)&ConfgCalc, "ConfgCalc", "short", 1, 28, 2, 1, 0, 0}, {"IRIS:LR20:118:MOTR_X", (size_t)&X_Act, "X_Act", "float", 1, 29, 0, 0, 0, 0}, {"IRIS:LR20:118:MOTR_ANGLE", (size_t)&Ang_Act, "Ang_Act", "float", 1, 30, 0, 0, 0, 0} }; /* Event masks for state set "ssIrisConfig" */ static const seqMask EM_ssIrisConfig_init[] = { 0x00000000, }; static const seqMask EM_ssIrisConfig_check[] = { 0x00000004, }; static const seqMask EM_ssIrisConfig_disconnected[] = { 0x00000000, }; /* State table for state set "ssIrisConfig" */ static seqState G_ssIrisConfig_states[] = { { /* state name */ "init", /* action function */ A_ssIrisConfig_init, /* event function */ E_ssIrisConfig_init, /* delay function */ D_ssIrisConfig_init, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_ssIrisConfig_init, /* state options */ (0) }, { /* state name */ "check", /* action function */ A_ssIrisConfig_check, /* event function */ E_ssIrisConfig_check, /* delay function */ D_ssIrisConfig_check, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_ssIrisConfig_check, /* state options */ (0) }, { /* state name */ "disconnected", /* action function */ A_ssIrisConfig_disconnected, /* event function */ E_ssIrisConfig_disconnected, /* delay function */ D_ssIrisConfig_disconnected, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_ssIrisConfig_disconnected, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "ssIrisConfig", /* states */ G_ssIrisConfig_states, /* number of states */ 3, /* number of delays */ 1 }, }; /* Program table (global) */ seqProgram sncIrisConfig = { /* magic number */ 2001006, /* program name */ "sncIrisConfig", /* channels */ G_channels, /* num. channels */ 28, /* state sets */ G_state_sets, /* num. state sets */ 1, /* user var size */ 0, /* param */ "", /* num. event flags */ 2, /* encoded options */ (0 | OPT_NEWEF), /* init func */ G_prog_init, /* entry func */ NULL, /* exit func */ NULL, /* num. queues */ 0 }; /* Register sequencer commands and program */ #include "epicsExport.h" static void sncIrisConfigRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&sncIrisConfig); } epicsExportRegistrar(sncIrisConfigRegistrar);