/* C code for program sncIrisConfig, generated by snc from ../LaserIrisConfig.st */ #include #include #include #include #include "seq_snc.h" # line 32 "../LaserIrisConfig.st" static const EF_ID ConfgSel_ef = 1; # line 42 "../LaserIrisConfig.st" static const EF_ID ConfgCalc_ef = 2; /* Variable declarations */ # line 9 "../LaserIrisConfig.st" static float X_Setp[12]; # line 19 "../LaserIrisConfig.st" static float Ang_Setp[12]; # line 29 "../LaserIrisConfig.st" static short ConfgSel; # line 39 "../LaserIrisConfig.st" static short ConfgCalc; # line 48 "../LaserIrisConfig.st" static float X_Act; # line 49 "../LaserIrisConfig.st" static float Ang_Act; # line 66 "../LaserIrisConfig.st" static int i; /* Function declarations */ #define seqg_var (*(struct seqg_vars *const *)seqg_env) /* Program init func */ static void seqg_init(PROG_ID seqg_env) { } /****** Code for state "init" in state set "ssIrisConfig" ******/ /* Event function for state "init" in state set "ssIrisConfig" */ static seqBool seqg_event_ssIrisConfig_0_init(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 77 "../LaserIrisConfig.st" if (seq_delay(seqg_env, 10)) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "init" in state set "ssIrisConfig" */ static void seqg_action_ssIrisConfig_0_init(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 79 "../LaserIrisConfig.st" printf("state init \n"); } return; } } /****** Code for state "check" in state set "ssIrisConfig" ******/ /* Event function for state "check" in state set "ssIrisConfig" */ static seqBool seqg_event_ssIrisConfig_0_check(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 87 "../LaserIrisConfig.st" if (seq_pvConnectCount(seqg_env) < seq_pvAssignCount(seqg_env)) { *seqg_pnst = 2; *seqg_ptrn = 0; return TRUE; } # line 95 "../LaserIrisConfig.st" if (seq_efTestAndClear(seqg_env, ConfgCalc_ef)) { *seqg_pnst = 1; *seqg_ptrn = 1; return TRUE; } return FALSE; } /* Action function for state "check" in state set "ssIrisConfig" */ static void seqg_action_ssIrisConfig_0_check(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 89 "../LaserIrisConfig.st" printf("%i of %i PVs connected \n", seq_pvConnectCount(seqg_env), seq_pvAssignCount(seqg_env)); # line 90 "../LaserIrisConfig.st" printf("state disconnected \n"); } return; case 1: { # line 97 "../LaserIrisConfig.st" i = ConfgSel; # line 99 "../LaserIrisConfig.st" X_Act = X_Setp[i]; # line 100 "../LaserIrisConfig.st" Ang_Act = Ang_Setp[i]; # line 102 "../LaserIrisConfig.st" printf("IRIS Config # %i Activated: X and Angle Requested Val Updated to %f , %f \n", ConfgSel, X_Act, Ang_Act); # line 104 "../LaserIrisConfig.st" seq_pvPutTmo(seqg_env, 26/*X_Act*/, DEFAULT, DEFAULT_TIMEOUT); # line 105 "../LaserIrisConfig.st" seq_pvPutTmo(seqg_env, 27/*Ang_Act*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "disconnected" in state set "ssIrisConfig" ******/ /* Event function for state "disconnected" in state set "ssIrisConfig" */ static seqBool seqg_event_ssIrisConfig_0_disconnected(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 112 "../LaserIrisConfig.st" if (seq_pvConnectCount(seqg_env) == seq_pvAssignCount(seqg_env)) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } # line 117 "../LaserIrisConfig.st" if (seq_delay(seqg_env, 10)) { *seqg_pnst = 2; *seqg_ptrn = 1; return TRUE; } return FALSE; } /* Action function for state "disconnected" in state set "ssIrisConfig" */ static void seqg_action_ssIrisConfig_0_disconnected(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 114 "../LaserIrisConfig.st" printf("All PV's Reconnected \n"); } return; case 1: { # line 119 "../LaserIrisConfig.st" printf("Warning Some PV's are Disconnected \n"); } return; } } #undef seqg_var /************************ Tables ************************/ /* Channel table */ static seqChan seqg_chans[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"IRIS:{LOCA}:{POS}:X_0_CON", (size_t)&X_Setp[0], "X_Setp[0]", P_FLOAT, 1, 3, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_1_CON", (size_t)&X_Setp[1], "X_Setp[1]", P_FLOAT, 1, 4, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_2_CON", (size_t)&X_Setp[2], "X_Setp[2]", P_FLOAT, 1, 5, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_3_CON", (size_t)&X_Setp[3], "X_Setp[3]", P_FLOAT, 1, 6, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_4_CON", (size_t)&X_Setp[4], "X_Setp[4]", P_FLOAT, 1, 7, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_5_CON", (size_t)&X_Setp[5], "X_Setp[5]", P_FLOAT, 1, 8, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_6_CON", (size_t)&X_Setp[6], "X_Setp[6]", P_FLOAT, 1, 9, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_7_CON", (size_t)&X_Setp[7], "X_Setp[7]", P_FLOAT, 1, 10, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_8_CON", (size_t)&X_Setp[8], "X_Setp[8]", P_FLOAT, 1, 11, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_9_CON", (size_t)&X_Setp[9], "X_Setp[9]", P_FLOAT, 1, 12, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_10_CON", (size_t)&X_Setp[10], "X_Setp[10]", P_FLOAT, 1, 13, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:X_11_CON", (size_t)&X_Setp[11], "X_Setp[11]", P_FLOAT, 1, 14, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_0_CON", (size_t)&Ang_Setp[0], "Ang_Setp[0]", P_FLOAT, 1, 15, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_1_CON", (size_t)&Ang_Setp[1], "Ang_Setp[1]", P_FLOAT, 1, 16, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_2_CON", (size_t)&Ang_Setp[2], "Ang_Setp[2]", P_FLOAT, 1, 17, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_3_CON", (size_t)&Ang_Setp[3], "Ang_Setp[3]", P_FLOAT, 1, 18, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_4_CON", (size_t)&Ang_Setp[4], "Ang_Setp[4]", P_FLOAT, 1, 19, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_5_CON", (size_t)&Ang_Setp[5], "Ang_Setp[5]", P_FLOAT, 1, 20, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_6_CON", (size_t)&Ang_Setp[6], "Ang_Setp[6]", P_FLOAT, 1, 21, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_7_CON", (size_t)&Ang_Setp[7], "Ang_Setp[7]", P_FLOAT, 1, 22, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_8_CON", (size_t)&Ang_Setp[8], "Ang_Setp[8]", P_FLOAT, 1, 23, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_9_CON", (size_t)&Ang_Setp[9], "Ang_Setp[9]", P_FLOAT, 1, 24, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_10_CON", (size_t)&Ang_Setp[10], "Ang_Setp[10]", P_FLOAT, 1, 25, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:ANGLE_11_CON", (size_t)&Ang_Setp[11], "Ang_Setp[11]", P_FLOAT, 1, 26, 0, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:CONFG_SEL.VAL", (size_t)&ConfgSel, "ConfgSel", P_SHORT, 1, 27, 1, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:CONFG_CALC.VAL", (size_t)&ConfgCalc, "ConfgCalc", P_SHORT, 1, 28, 2, 1, 0, 0}, {"IRIS:{LOCA}:{POS}:MOTR_X", (size_t)&X_Act, "X_Act", P_FLOAT, 1, 29, 0, 0, 0, 0}, {"IRIS:{LOCA}:{POS}:MOTR_ANGLE", (size_t)&Ang_Act, "Ang_Act", P_FLOAT, 1, 30, 0, 0, 0, 0}, }; /* Event masks for state set "ssIrisConfig" */ static const seqMask seqg_mask_ssIrisConfig_0_init[] = { 0x00000000, }; static const seqMask seqg_mask_ssIrisConfig_0_check[] = { 0x00000004, }; static const seqMask seqg_mask_ssIrisConfig_0_disconnected[] = { 0x00000000, }; /* State table for state set "ssIrisConfig" */ static seqState seqg_states_ssIrisConfig[] = { { /* state name */ "init", /* action function */ seqg_action_ssIrisConfig_0_init, /* event function */ seqg_event_ssIrisConfig_0_init, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_ssIrisConfig_0_init, /* state options */ (0) }, { /* state name */ "check", /* action function */ seqg_action_ssIrisConfig_0_check, /* event function */ seqg_event_ssIrisConfig_0_check, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_ssIrisConfig_0_check, /* state options */ (0) }, { /* state name */ "disconnected", /* action function */ seqg_action_ssIrisConfig_0_disconnected, /* event function */ seqg_event_ssIrisConfig_0_disconnected, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_ssIrisConfig_0_disconnected, /* state options */ (0) }, }; /* State set table */ static seqSS seqg_statesets[] = { { /* state set name */ "ssIrisConfig", /* states */ seqg_states_ssIrisConfig, /* number of states */ 3 }, }; /* Program table (global) */ seqProgram sncIrisConfig = { /* magic number */ 2002004, /* program name */ "sncIrisConfig", /* channels */ seqg_chans, /* num. channels */ 28, /* state sets */ seqg_statesets, /* num. state sets */ 1, /* user var size */ 0, /* param */ "", /* num. event flags */ 2, /* encoded options */ (0 | OPT_NEWEF), /* init func */ seqg_init, /* entry func */ 0, /* exit func */ 0, /* num. queues */ 0 }; /* Register sequencer commands and program */ #include "epicsExport.h" static void sncIrisConfigRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&sncIrisConfig); } epicsExportRegistrar(sncIrisConfigRegistrar);