/* Generated with snc from ../sncPau.stt */ /* Program "sncPau" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar { # line 19 "../sncPau.stt" int index; # line 21 "../sncPau.stt" int feedback_mode; # line 25 "../sncPau.stt" double offset[4]; # line 30 "../sncPau.stt" double fcom[4]; # line 47 "../sncPau.stt" double master; # line 50 "../sncPau.stt" int admin; }; /* C code definitions */ # line 10 "../sncPau.stt" #define ADMIN_OFF 0 #define ADMIN_ON 1 #define ADMIN_UNAVAILABLE 2 #define FBCK_OFF 0 #define FBCK_ON 1 /* Program init func */ static void G_prog_init(struct UserVar *pVar) { static struct UserVar pVarInit = { 0, 0, {0,0,0,0}, {0,0,0,0}, 0, 0, }; *pVar = pVarInit; } /****** Code for state "calc_bwProp" in state set "bwProp" ******/ /* Delay function for state "calc_bwProp" in state set "bwProp" */ static void D_bwProp_calc_bwProp(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "calc_bwProp" in state set "bwProp" */ static seqBool E_bwProp_calc_bwProp(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 61 "../sncPau.stt" if (pVar->feedback_mode && seq_efTestAndClear(ssId, 1/*ev_fcom_0*/)) { *pNextState = 0; *pTransNum = 0; return TRUE; } # line 68 "../sncPau.stt" if (pVar->feedback_mode && seq_efTestAndClear(ssId, 2/*ev_fcom_1*/)) { *pNextState = 0; *pTransNum = 1; return TRUE; } # line 76 "../sncPau.stt" if (pVar->feedback_mode && seq_efTestAndClear(ssId, 3/*ev_fcom_2*/)) { *pNextState = 0; *pTransNum = 2; return TRUE; } # line 83 "../sncPau.stt" if (pVar->feedback_mode && seq_efTestAndClear(ssId, 4/*ev_fcom_3*/)) { *pNextState = 0; *pTransNum = 3; return TRUE; } return FALSE; } /* Action function for state "calc_bwProp" in state set "bwProp" */ static void A_bwProp_calc_bwProp(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 62 "../sncPau.stt" pVar->master = pVar->fcom[0]; # line 63 "../sncPau.stt" pVar->offset[0] = pVar->fcom[0] - pVar->master; # line 64 "../sncPau.stt" seq_pvPut(ssId, 1/*offset*/ + (VAR_ID)(0), 0); # line 65 "../sncPau.stt" seq_pvPut(ssId, 9/*master*/, 0); } return; case 1: { # line 69 "../sncPau.stt" pVar->master = pVar->fcom[0]; # line 70 "../sncPau.stt" pVar->offset[1] = pVar->fcom[1] - pVar->master; # line 71 "../sncPau.stt" seq_pvPut(ssId, 1/*offset*/ + (VAR_ID)(1), 0); # line 72 "../sncPau.stt" seq_pvPut(ssId, 9/*master*/, 0); } return; case 2: { # line 77 "../sncPau.stt" pVar->master = pVar->fcom[0]; # line 78 "../sncPau.stt" pVar->offset[2] = pVar->fcom[2] - pVar->master; # line 79 "../sncPau.stt" seq_pvPut(ssId, 1/*offset*/ + (VAR_ID)(2), 0); # line 80 "../sncPau.stt" seq_pvPut(ssId, 9/*master*/, 0); } return; case 3: { # line 84 "../sncPau.stt" pVar->master = pVar->fcom[0]; # line 85 "../sncPau.stt" pVar->offset[3] = pVar->fcom[3] - pVar->master; # line 86 "../sncPau.stt" seq_pvPut(ssId, 1/*offset*/ + (VAR_ID)(3), 0); # line 87 "../sncPau.stt" seq_pvPut(ssId, 9/*master*/, 0); } return; } } /****** Code for state "init" in state set "iocAdmin" ******/ /* Delay function for state "init" in state set "iocAdmin" */ static void D_iocAdmin_init(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "init" in state set "iocAdmin" */ static seqBool E_iocAdmin_init(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 98 "../sncPau.stt" if (pVar->admin == ADMIN_UNAVAILABLE) { *pNextState = 1; *pTransNum = 0; return TRUE; } # line 103 "../sncPau.stt" if (1) { *pNextState = 1; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "init" in state set "iocAdmin" */ static void A_iocAdmin_init(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 99 "../sncPau.stt" pVar->admin = ADMIN_OFF; # line 100 "../sncPau.stt" seq_pvPut(ssId, 10/*admin*/, 0); } return; case 1: { } return; } } /****** Code for state "check_mode" in state set "iocAdmin" ******/ /* Delay function for state "check_mode" in state set "iocAdmin" */ static void D_iocAdmin_check_mode(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "check_mode" in state set "iocAdmin" */ static seqBool E_iocAdmin_check_mode(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 109 "../sncPau.stt" if (1) { *pNextState = 2; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "check_mode" in state set "iocAdmin" */ static void A_iocAdmin_check_mode(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 110 "../sncPau.stt" if (pVar->admin == ADMIN_OFF) { # line 110 "../sncPau.stt" pVar->feedback_mode = FBCK_OFF; # line 110 "../sncPau.stt" seq_pvPut(ssId, 0/*feedback_mode*/, 0); } # line 111 "../sncPau.stt" if (pVar->admin == ADMIN_ON) { # line 111 "../sncPau.stt" pVar->feedback_mode = FBCK_ON; # line 111 "../sncPau.stt" seq_pvPut(ssId, 0/*feedback_mode*/, 0); } # line 112 "../sncPau.stt" if (pVar->admin == ADMIN_UNAVAILABLE) { # line 112 "../sncPau.stt" pVar->feedback_mode = FBCK_OFF; # line 112 "../sncPau.stt" seq_pvPut(ssId, 0/*feedback_mode*/, 0); } } return; } } /****** Code for state "wait_admin" in state set "iocAdmin" ******/ /* Delay function for state "wait_admin" in state set "iocAdmin" */ static void D_iocAdmin_wait_admin(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "wait_admin" in state set "iocAdmin" */ static seqBool E_iocAdmin_wait_admin(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 118 "../sncPau.stt" if (seq_efTestAndClear(ssId, 5/*ev_admin*/)) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "wait_admin" in state set "iocAdmin" */ static void A_iocAdmin_wait_admin(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"{MUX_NAME}:FBCK", offsetof(struct UserVar, feedback_mode), "feedback_mode", "int", 1, 6, 0, 1, 0, 0}, {"{MUX_NAME}:OFFSET_0", offsetof(struct UserVar, offset[0]), "offset[0]", "double", 1, 7, 0, 0, 0, 0}, {"{MUX_NAME}:OFFSET_1", offsetof(struct UserVar, offset[1]), "offset[1]", "double", 1, 8, 0, 0, 0, 0}, {"{MUX_NAME}:OFFSET_2", offsetof(struct UserVar, offset[2]), "offset[2]", "double", 1, 9, 0, 0, 0, 0}, {"{MUX_NAME}:OFFSET_3", offsetof(struct UserVar, offset[3]), "offset[3]", "double", 1, 10, 0, 0, 0, 0}, {"{MUX_NAME}:GETFCOM_0", offsetof(struct UserVar, fcom[0]), "fcom[0]", "double", 1, 11, 1, 1, 0, 0}, {"{MUX_NAME}:GETFCOM_1", offsetof(struct UserVar, fcom[1]), "fcom[1]", "double", 1, 12, 2, 1, 0, 0}, {"{MUX_NAME}:GETFCOM_2", offsetof(struct UserVar, fcom[2]), "fcom[2]", "double", 1, 13, 3, 1, 0, 0}, {"{MUX_NAME}:GETFCOM_3", offsetof(struct UserVar, fcom[3]), "fcom[3]", "double", 1, 14, 4, 1, 0, 0}, {"{MUX_NAME}", offsetof(struct UserVar, master), "master", "double", 1, 15, 0, 0, 0, 0}, {"{ADMIN_NAME}", offsetof(struct UserVar, admin), "admin", "int", 1, 16, 5, 1, 0, 0} }; /* Event masks for state set "bwProp" */ static const seqMask EM_bwProp_calc_bwProp[] = { 0x0000005e, }; /* State table for state set "bwProp" */ static seqState G_bwProp_states[] = { { /* state name */ "calc_bwProp", /* action function */ A_bwProp_calc_bwProp, /* event function */ E_bwProp_calc_bwProp, /* delay function */ D_bwProp_calc_bwProp, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_bwProp_calc_bwProp, /* state options */ (0) }, }; /* Event masks for state set "iocAdmin" */ static const seqMask EM_iocAdmin_init[] = { 0x00010000, }; static const seqMask EM_iocAdmin_check_mode[] = { 0x00000000, }; static const seqMask EM_iocAdmin_wait_admin[] = { 0x00000020, }; /* State table for state set "iocAdmin" */ static seqState G_iocAdmin_states[] = { { /* state name */ "init", /* action function */ A_iocAdmin_init, /* event function */ E_iocAdmin_init, /* delay function */ D_iocAdmin_init, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_iocAdmin_init, /* state options */ (0) }, { /* state name */ "check_mode", /* action function */ A_iocAdmin_check_mode, /* event function */ E_iocAdmin_check_mode, /* delay function */ D_iocAdmin_check_mode, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_iocAdmin_check_mode, /* state options */ (0) }, { /* state name */ "wait_admin", /* action function */ A_iocAdmin_wait_admin, /* event function */ E_iocAdmin_wait_admin, /* delay function */ D_iocAdmin_wait_admin, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_iocAdmin_wait_admin, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "bwProp", /* states */ G_bwProp_states, /* number of states */ 1, /* number of delays */ 0 }, { /* state set name */ "iocAdmin", /* states */ G_iocAdmin_states, /* number of states */ 3, /* number of delays */ 0 }, }; /* Program table (global) */ seqProgram sncPau = { /* magic number */ 2001006, /* program name */ "sncPau", /* channels */ G_channels, /* num. channels */ 11, /* state sets */ G_state_sets, /* num. state sets */ 2, /* user var size */ sizeof(struct UserVar), /* param */ "", /* num. event flags */ 5, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF | OPT_REENT), /* init func */ G_prog_init, /* entry func */ NULL, /* exit func */ NULL, /* num. queues */ 0 }; /* Register sequencer commands and program */ #include "epicsExport.h" static void sncPauRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&sncPau); } epicsExportRegistrar(sncPauRegistrar);