/* Generated with snc from undOff.i */ /* Program "undOff" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar { # line 17 "../undOff.st" int retry; # line 18 "../undOff.st" int retryMax; # line 20 "../undOff.st" int offCmd; # line 23 "../undOff.st" int m1Dis; # line 24 "../undOff.st" int m2Dis; # line 25 "../undOff.st" int m3Dis; # line 26 "../undOff.st" int m4Dis; # line 28 "../undOff.st" int m1; # line 29 "../undOff.st" int m2; # line 30 "../undOff.st" int m3; # line 31 "../undOff.st" int m4; # line 32 "../undOff.st" float m1Rbv; # line 33 "../undOff.st" float m2Rbv; # line 34 "../undOff.st" float m3Rbv; # line 35 "../undOff.st" float m4Rbv; # line 38 "../undOff.st" double m1Off; # line 39 "../undOff.st" double m2Off; # line 40 "../undOff.st" double m3Off; # line 41 "../undOff.st" double m4Off; # line 44 "../undOff.st" int undSt; # line 47 "../undOff.st" int dmov1; # line 48 "../undOff.st" int dmov2; # line 49 "../undOff.st" int dmov3; # line 50 "../undOff.st" int dmov4; # line 53 "../undOff.st" int cnen1; # line 54 "../undOff.st" int cnen2; # line 55 "../undOff.st" int cnen3; # line 56 "../undOff.st" int cnen4; }; /* Program init func */ static void G_prog_init(struct UserVar *pVar) { static struct UserVar pVarInit = { # line 17 "../undOff.st" 0, # line 18 "../undOff.st" 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; *pVar = pVarInit; } /****** Code for state "s_Stby" in state set "undOff" ******/ /* Delay function for state "s_Stby" in state set "undOff" */ static void D_undOff_s_Stby(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Stby" in state set "undOff" */ static seqBool E_undOff_s_Stby(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 63 "../undOff.st" if (pVar->offCmd == 1) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "s_Stby" in state set "undOff" */ static void A_undOff_s_Stby(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 64 "../undOff.st" pVar->retry++; # line 65 "../undOff.st" pVar->m1 = pVar->m1Off; # line 66 "../undOff.st" seq_pvPut(ssId, 5/*m1*/, 0); # line 67 "../undOff.st" pVar->m2 = pVar->m1Off; # line 68 "../undOff.st" seq_pvPut(ssId, 6/*m2*/, 0); # line 69 "../undOff.st" pVar->m3 = pVar->m1Off; # line 70 "../undOff.st" seq_pvPut(ssId, 7/*m3*/, 0); # line 71 "../undOff.st" pVar->m4 = pVar->m1Off; # line 72 "../undOff.st" seq_pvPut(ssId, 8/*m4*/, 0); } return; } } /****** Code for state "s_Movn" in state set "undOff" ******/ /* Delay function for state "s_Movn" in state set "undOff" */ static void D_undOff_s_Movn(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Movn" in state set "undOff" */ static seqBool E_undOff_s_Movn(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 77 "../undOff.st" if (pVar->offCmd == 0) { *pNextState = 4; *pTransNum = 0; return TRUE; } # line 79 "../undOff.st" if (pVar->dmov1 == 1 && pVar->dmov2 == 1 && pVar->dmov3 == 1 && pVar->dmov4 == 1) { *pNextState = 2; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "s_Movn" in state set "undOff" */ static void A_undOff_s_Movn(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { } return; } } /****** Code for state "s_Chk" in state set "undOff" ******/ /* Delay function for state "s_Chk" in state set "undOff" */ static void D_undOff_s_Chk(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Chk" in state set "undOff" */ static seqBool E_undOff_s_Chk(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 84 "../undOff.st" if (pVar->offCmd == 0) { *pNextState = 4; *pTransNum = 0; return TRUE; } # line 86 "../undOff.st" if (pVar->undSt == 0) { *pNextState = 3; *pTransNum = 1; return TRUE; } # line 88 "../undOff.st" if (pVar->undSt == 1 && pVar->retry < pVar->retryMax) { *pNextState = 0; *pTransNum = 2; return TRUE; } return FALSE; } /* Action function for state "s_Chk" in state set "undOff" */ static void A_undOff_s_Chk(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { } return; case 2: { } return; } } /****** Code for state "s_Off" in state set "undOff" ******/ /* Entry function for state "s_Off" in state set "undOff" */ static void I_undOff_s_Off(SS_ID ssId, struct UserVar *pVar) { # line 94 "../undOff.st" pVar->m1Dis = 0; # line 95 "../undOff.st" seq_pvPut(ssId, 1/*m1Dis*/, 0); # line 96 "../undOff.st" pVar->m2Dis = 0; # line 97 "../undOff.st" seq_pvPut(ssId, 2/*m2Dis*/, 0); # line 98 "../undOff.st" pVar->m3Dis = 0; # line 99 "../undOff.st" seq_pvPut(ssId, 3/*m3Dis*/, 0); # line 100 "../undOff.st" pVar->m4Dis = 0; # line 101 "../undOff.st" seq_pvPut(ssId, 4/*m4Dis*/, 0); } /* Delay function for state "s_Off" in state set "undOff" */ static void D_undOff_s_Off(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Off" in state set "undOff" */ static seqBool E_undOff_s_Off(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 103 "../undOff.st" if (pVar->offCmd == 0) { *pNextState = 4; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "s_Off" in state set "undOff" */ static void A_undOff_s_Off(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /****** Code for state "s_Enbl" in state set "undOff" ******/ /* Entry function for state "s_Enbl" in state set "undOff" */ static void I_undOff_s_Enbl(SS_ID ssId, struct UserVar *pVar) { # line 109 "../undOff.st" pVar->m1 = pVar->m1Rbv; # line 110 "../undOff.st" seq_pvPut(ssId, 5/*m1*/, 0); # line 111 "../undOff.st" pVar->m2 = pVar->m1Rbv; # line 112 "../undOff.st" seq_pvPut(ssId, 6/*m2*/, 0); # line 113 "../undOff.st" pVar->m3 = pVar->m1Rbv; # line 114 "../undOff.st" seq_pvPut(ssId, 7/*m3*/, 0); # line 115 "../undOff.st" pVar->m4 = pVar->m1Rbv; # line 116 "../undOff.st" seq_pvPut(ssId, 8/*m4*/, 0); } /* Delay function for state "s_Enbl" in state set "undOff" */ static void D_undOff_s_Enbl(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Enbl" in state set "undOff" */ static seqBool E_undOff_s_Enbl(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { if (TRUE) { *pNextState = 0; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "s_Enbl" in state set "undOff" */ static void A_undOff_s_Enbl(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 119 "../undOff.st" pVar->m1Dis = 1; # line 120 "../undOff.st" seq_pvPut(ssId, 1/*m1Dis*/, 0); # line 121 "../undOff.st" pVar->m2Dis = 1; # line 122 "../undOff.st" seq_pvPut(ssId, 2/*m2Dis*/, 0); # line 123 "../undOff.st" pVar->m3Dis = 1; # line 124 "../undOff.st" seq_pvPut(ssId, 3/*m3Dis*/, 0); # line 125 "../undOff.st" pVar->m4Dis = 1; # line 126 "../undOff.st" seq_pvPut(ssId, 4/*m4Dis*/, 0); # line 127 "../undOff.st" pVar->retry = 0; } return; } } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"{USEG}:OFF", offsetof(struct UserVar, offCmd), "offCmd", "int", 1, 1, 0, 1, 0, 0}, {"{USEG}:1:MOTR.DISV", offsetof(struct UserVar, m1Dis), "m1Dis", "int", 1, 2, 0, 1, 0, 0}, {"{USEG}:2:MOTR.DISV", offsetof(struct UserVar, m2Dis), "m2Dis", "int", 1, 3, 0, 1, 0, 0}, {"{USEG}:3:MOTR.DISV", offsetof(struct UserVar, m3Dis), "m3Dis", "int", 1, 4, 0, 1, 0, 0}, {"{USEG}:4:MOTR.DISV", offsetof(struct UserVar, m4Dis), "m4Dis", "int", 1, 5, 0, 1, 0, 0}, {"{USEG}:1:MOTR", offsetof(struct UserVar, m1), "m1", "int", 1, 6, 0, 1, 0, 0}, {"{USEG}:2:MOTR", offsetof(struct UserVar, m2), "m2", "int", 1, 7, 0, 1, 0, 0}, {"{USEG}:3:MOTR", offsetof(struct UserVar, m3), "m3", "int", 1, 8, 0, 1, 0, 0}, {"{USEG}:4:MOTR", offsetof(struct UserVar, m4), "m4", "int", 1, 9, 0, 1, 0, 0}, {"{USEG}:1:MOTR.RBV", offsetof(struct UserVar, m1Rbv), "m1Rbv", "float", 1, 10, 0, 1, 0, 0}, {"{USEG}:2:MOTR.RBV", offsetof(struct UserVar, m2Rbv), "m2Rbv", "float", 1, 11, 0, 1, 0, 0}, {"{USEG}:3:MOTR.RBV", offsetof(struct UserVar, m3Rbv), "m3Rbv", "float", 1, 12, 0, 1, 0, 0}, {"{USEG}:4:MOTR.RBV", offsetof(struct UserVar, m4Rbv), "m4Rbv", "float", 1, 13, 0, 1, 0, 0}, {"{USEG}:1:MOFF", offsetof(struct UserVar, m1Off), "m1Off", "double", 1, 14, 0, 1, 0, 0}, {"{USEG}:2:MOFF", offsetof(struct UserVar, m2Off), "m2Off", "double", 1, 15, 0, 1, 0, 0}, {"{USEG}:3:MOFF", offsetof(struct UserVar, m3Off), "m3Off", "double", 1, 16, 0, 1, 0, 0}, {"{USEG}:4:MOFF", offsetof(struct UserVar, m4Off), "m4Off", "double", 1, 17, 0, 1, 0, 0}, {"{USEG}:OFFACT", offsetof(struct UserVar, undSt), "undSt", "int", 1, 18, 0, 1, 0, 0}, {"{USEG}:1:MOTR.DMOV", offsetof(struct UserVar, dmov1), "dmov1", "int", 1, 19, 0, 1, 0, 0}, {"{USEG}:2:MOTR.DMOV", offsetof(struct UserVar, dmov2), "dmov2", "int", 1, 20, 0, 1, 0, 0}, {"{USEG}:3:MOTR.DMOV", offsetof(struct UserVar, dmov3), "dmov3", "int", 1, 21, 0, 1, 0, 0}, {"{USEG}:4:MOTR.DMOV", offsetof(struct UserVar, dmov4), "dmov4", "int", 1, 22, 0, 1, 0, 0}, {"{USEG}:1:MOTR.CNEN", offsetof(struct UserVar, cnen1), "cnen1", "int", 1, 23, 0, 1, 0, 0}, {"{USEG}:2:MOTR.CNEN", offsetof(struct UserVar, cnen2), "cnen2", "int", 1, 24, 0, 1, 0, 0}, {"{USEG}:3:MOTR.CNEN", offsetof(struct UserVar, cnen3), "cnen3", "int", 1, 25, 0, 1, 0, 0}, {"{USEG}:4:MOTR.CNEN", offsetof(struct UserVar, cnen4), "cnen4", "int", 1, 26, 0, 1, 0, 0} }; /* Event masks for state set "undOff" */ static const seqMask EM_undOff_s_Stby[] = { 0x00000002, }; static const seqMask EM_undOff_s_Movn[] = { 0x00780002, }; static const seqMask EM_undOff_s_Chk[] = { 0x00040002, }; static const seqMask EM_undOff_s_Off[] = { 0x00000002, }; static const seqMask EM_undOff_s_Enbl[] = { 0x00000000, }; /* State table for state set "undOff" */ static seqState G_undOff_states[] = { { /* state name */ "s_Stby", /* action function */ A_undOff_s_Stby, /* event function */ E_undOff_s_Stby, /* delay function */ D_undOff_s_Stby, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_undOff_s_Stby, /* state options */ (0) }, { /* state name */ "s_Movn", /* action function */ A_undOff_s_Movn, /* event function */ E_undOff_s_Movn, /* delay function */ D_undOff_s_Movn, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_undOff_s_Movn, /* state options */ (0) }, { /* state name */ "s_Chk", /* action function */ A_undOff_s_Chk, /* event function */ E_undOff_s_Chk, /* delay function */ D_undOff_s_Chk, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_undOff_s_Chk, /* state options */ (0) }, { /* state name */ "s_Off", /* action function */ A_undOff_s_Off, /* event function */ E_undOff_s_Off, /* delay function */ D_undOff_s_Off, /* entry function */ I_undOff_s_Off, /* exit function */ 0, /* event mask array */ EM_undOff_s_Off, /* state options */ (0) }, { /* state name */ "s_Enbl", /* action function */ A_undOff_s_Enbl, /* event function */ E_undOff_s_Enbl, /* delay function */ D_undOff_s_Enbl, /* entry function */ I_undOff_s_Enbl, /* exit function */ 0, /* event mask array */ EM_undOff_s_Enbl, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "undOff", /* states */ G_undOff_states, /* number of states */ 5, /* number of delays */ 0 }, }; /* Program table (global) */ seqProgram undOff = { /* magic number */ 2001006, /* program name */ "undOff", /* channels */ G_channels, /* num. channels */ 26, /* state sets */ G_state_sets, /* num. state sets */ 1, /* user var size */ sizeof(struct UserVar), /* param */ "", /* num. event flags */ 0, /* encoded options */ (0 | OPT_DEBUG | 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 undOffRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&undOff); } epicsExportRegistrar(undOffRegistrar);