/* Generated with snc from deltaOff.i */ /* Program "deltaOff" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar { # line 18 "../deltaOff.st" int dmov; # line 19 "../deltaOff.st" int inPos; # line 20 "../deltaOff.st" int posMainEn; # line 21 "../deltaOff.st" int off; # line 22 "../deltaOff.st" int offAct; # line 23 "../deltaOff.st" int mDisv; # line 25 "../deltaOff.st" float d1; # line 26 "../deltaOff.st" float d2; # line 27 "../deltaOff.st" float d3; # line 28 "../deltaOff.st" float d4; # line 30 "../deltaOff.st" float m1Rbv; # line 31 "../deltaOff.st" float m2Rbv; # line 32 "../deltaOff.st" float m3Rbv; # line 33 "../deltaOff.st" float m4Rbv; # line 35 "../deltaOff.st" float m1; # line 36 "../deltaOff.st" float m2; # line 37 "../deltaOff.st" float m3; # line 38 "../deltaOff.st" float m4; # line 40 "../deltaOff.st" float m1Off; # line 41 "../deltaOff.st" float m2Off; # line 42 "../deltaOff.st" float m3Off; # line 43 "../deltaOff.st" float m4Off; }; /* 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; *pVar = pVarInit; } /****** Code for state "s_Stby" in state set "deltaOff" ******/ /* Entry function for state "s_Stby" in state set "deltaOff" */ static void I_deltaOff_s_Stby(SS_ID ssId, struct UserVar *pVar) { # line 50 "../deltaOff.st" pVar->d1 = 1; # line 51 "../deltaOff.st" seq_pvPut(ssId, 6/*d1*/, 0); # line 52 "../deltaOff.st" pVar->d2 = 1; # line 53 "../deltaOff.st" seq_pvPut(ssId, 7/*d2*/, 0); # line 54 "../deltaOff.st" pVar->d3 = 1; # line 55 "../deltaOff.st" seq_pvPut(ssId, 8/*d3*/, 0); # line 56 "../deltaOff.st" pVar->d4 = 1; # line 57 "../deltaOff.st" seq_pvPut(ssId, 9/*d4*/, 0); # line 58 "../deltaOff.st" pVar->mDisv = 1; # line 59 "../deltaOff.st" seq_pvPut(ssId, 5/*mDisv*/, 0); } /* Delay function for state "s_Stby" in state set "deltaOff" */ static void D_deltaOff_s_Stby(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Stby" in state set "deltaOff" */ static seqBool E_deltaOff_s_Stby(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 61 "../deltaOff.st" if (pVar->off == 1) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "s_Stby" in state set "deltaOff" */ static void A_deltaOff_s_Stby(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /****** Code for state "s_Mov" in state set "deltaOff" ******/ /* Delay function for state "s_Mov" in state set "deltaOff" */ static void D_deltaOff_s_Mov(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Mov" in state set "deltaOff" */ static seqBool E_deltaOff_s_Mov(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 66 "../deltaOff.st" if (pVar->off == 0) { *pNextState = 0; *pTransNum = 0; return TRUE; } if (TRUE) { *pNextState = 2; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "s_Mov" in state set "deltaOff" */ static void A_deltaOff_s_Mov(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { # line 69 "../deltaOff.st" pVar->m1 = pVar->m1Off; # line 70 "../deltaOff.st" seq_pvPut(ssId, 14/*m1*/, 0); # line 71 "../deltaOff.st" pVar->m2 = pVar->m2Off; # line 72 "../deltaOff.st" seq_pvPut(ssId, 15/*m2*/, 0); # line 73 "../deltaOff.st" pVar->m3 = pVar->m3Off; # line 74 "../deltaOff.st" seq_pvPut(ssId, 16/*m3*/, 0); # line 75 "../deltaOff.st" pVar->m4 = pVar->m4Off; # line 76 "../deltaOff.st" seq_pvPut(ssId, 17/*m4*/, 0); } return; } } /****** Code for state "s_startMov" in state set "deltaOff" ******/ /* Delay function for state "s_startMov" in state set "deltaOff" */ static void D_deltaOff_s_startMov(SS_ID ssId, struct UserVar *pVar) { # line 82 "../deltaOff.st" seq_delayInit(ssId, 0, (100)); } /* Event function for state "s_startMov" in state set "deltaOff" */ static seqBool E_deltaOff_s_startMov(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 80 "../deltaOff.st" if (seq_pvPutComplete(ssId, 14/*m1*/, 1, 0, 0) && seq_pvPutComplete(ssId, 15/*m2*/, 1, 0, 0) && seq_pvPutComplete(ssId, 16/*m3*/, 1, 0, 0) && seq_pvPutComplete(ssId, 17/*m4*/, 1, 0, 0)) { *pNextState = 3; *pTransNum = 0; return TRUE; } # line 82 "../deltaOff.st" if (seq_delay(ssId, 0)) { *pNextState = 6; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "s_startMov" in state set "deltaOff" */ static void A_deltaOff_s_startMov(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { } return; } } /****** Code for state "s_Wait" in state set "deltaOff" ******/ /* Delay function for state "s_Wait" in state set "deltaOff" */ static void D_deltaOff_s_Wait(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Wait" in state set "deltaOff" */ static seqBool E_deltaOff_s_Wait(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 87 "../deltaOff.st" if (pVar->off == 0) { *pNextState = 0; *pTransNum = 0; return TRUE; } # line 89 "../deltaOff.st" if (pVar->dmov && pVar->inPos && (pVar->offAct == 0)) { *pNextState = 4; *pTransNum = 1; return TRUE; } # line 91 "../deltaOff.st" if (pVar->dmov && !pVar->inPos) { *pNextState = 1; *pTransNum = 2; return TRUE; } return FALSE; } /* Action function for state "s_Wait" in state set "deltaOff" */ static void A_deltaOff_s_Wait(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 "deltaOff" ******/ /* Delay function for state "s_Off" in state set "deltaOff" */ static void D_deltaOff_s_Off(SS_ID ssId, struct UserVar *pVar) { # line 96 "../deltaOff.st" seq_delayInit(ssId, 0, (2)); } /* Event function for state "s_Off" in state set "deltaOff" */ static seqBool E_deltaOff_s_Off(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 96 "../deltaOff.st" if (seq_delay(ssId, 0)) { *pNextState = 5; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "s_Off" in state set "deltaOff" */ static void A_deltaOff_s_Off(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 97 "../deltaOff.st" pVar->d1 = 0; # line 98 "../deltaOff.st" seq_pvPut(ssId, 6/*d1*/, 0); # line 99 "../deltaOff.st" pVar->d2 = 0; # line 100 "../deltaOff.st" seq_pvPut(ssId, 7/*d2*/, 0); # line 101 "../deltaOff.st" pVar->d3 = 0; # line 102 "../deltaOff.st" seq_pvPut(ssId, 8/*d3*/, 0); # line 103 "../deltaOff.st" pVar->d4 = 0; # line 104 "../deltaOff.st" seq_pvPut(ssId, 9/*d4*/, 0); # line 105 "../deltaOff.st" pVar->mDisv = 0; # line 106 "../deltaOff.st" seq_pvPut(ssId, 5/*mDisv*/, 0); } return; } } /****** Code for state "s_StbyEn" in state set "deltaOff" ******/ /* Delay function for state "s_StbyEn" in state set "deltaOff" */ static void D_deltaOff_s_StbyEn(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_StbyEn" in state set "deltaOff" */ static seqBool E_deltaOff_s_StbyEn(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 111 "../deltaOff.st" if (pVar->off == 0) { *pNextState = 0; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "s_StbyEn" in state set "deltaOff" */ static void A_deltaOff_s_StbyEn(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 112 "../deltaOff.st" pVar->m1 = pVar->m1Rbv; # line 113 "../deltaOff.st" seq_pvPut(ssId, 14/*m1*/, SYNC); # line 114 "../deltaOff.st" pVar->m2 = pVar->m2Rbv; # line 115 "../deltaOff.st" seq_pvPut(ssId, 15/*m2*/, SYNC); # line 116 "../deltaOff.st" pVar->m3 = pVar->m3Rbv; # line 117 "../deltaOff.st" seq_pvPut(ssId, 16/*m3*/, SYNC); # line 118 "../deltaOff.st" pVar->m4 = pVar->m4Rbv; # line 119 "../deltaOff.st" seq_pvPut(ssId, 17/*m4*/, SYNC); } return; } } /****** Code for state "s_Err" in state set "deltaOff" ******/ /* Delay function for state "s_Err" in state set "deltaOff" */ static void D_deltaOff_s_Err(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Err" in state set "deltaOff" */ static seqBool E_deltaOff_s_Err(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_Err" in state set "deltaOff" */ static void A_deltaOff_s_Err(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 125 "../deltaOff.st" pVar->off = 1; # line 126 "../deltaOff.st" seq_pvPut(ssId, 3/*off*/, 0); } return; } } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"{USEG}:DMOV", offsetof(struct UserVar, dmov), "dmov", "int", 1, 1, 0, 1, 0, 0}, {"{USEG}:INPOS", offsetof(struct UserVar, inPos), "inPos", "int", 1, 2, 0, 1, 0, 0}, {"{USEG}:POSNMAINEN", offsetof(struct UserVar, posMainEn), "posMainEn", "int", 1, 3, 0, 1, 0, 0}, {"{USEG}:OFFCMD", offsetof(struct UserVar, off), "off", "int", 1, 4, 0, 1, 0, 0}, {"{USEG}:OFFACT", offsetof(struct UserVar, offAct), "offAct", "int", 1, 5, 0, 1, 0, 0}, {"{USEG}:MDISV", offsetof(struct UserVar, mDisv), "mDisv", "int", 1, 6, 0, 1, 0, 0}, {"{USEG}:1:MOTR.DISV", offsetof(struct UserVar, d1), "d1", "float", 1, 7, 0, 1, 0, 0}, {"{USEG}:2:MOTR.DISV", offsetof(struct UserVar, d2), "d2", "float", 1, 8, 0, 1, 0, 0}, {"{USEG}:3:MOTR.DISV", offsetof(struct UserVar, d3), "d3", "float", 1, 9, 0, 1, 0, 0}, {"{USEG}:4:MOTR.DISV", offsetof(struct UserVar, d4), "d4", "float", 1, 10, 0, 1, 0, 0}, {"{USEG}:1:MOTR.RBV", offsetof(struct UserVar, m1Rbv), "m1Rbv", "float", 1, 11, 0, 1, 0, 0}, {"{USEG}:2:MOTR.RBV", offsetof(struct UserVar, m2Rbv), "m2Rbv", "float", 1, 12, 0, 1, 0, 0}, {"{USEG}:3:MOTR.RBV", offsetof(struct UserVar, m3Rbv), "m3Rbv", "float", 1, 13, 0, 1, 0, 0}, {"{USEG}:4:MOTR.RBV", offsetof(struct UserVar, m4Rbv), "m4Rbv", "float", 1, 14, 0, 1, 0, 0}, {"{USEG}:1:MOTR", offsetof(struct UserVar, m1), "m1", "float", 1, 15, 0, 1, 0, 0}, {"{USEG}:2:MOTR", offsetof(struct UserVar, m2), "m2", "float", 1, 16, 0, 1, 0, 0}, {"{USEG}:3:MOTR", offsetof(struct UserVar, m3), "m3", "float", 1, 17, 0, 1, 0, 0}, {"{USEG}:4:MOTR", offsetof(struct UserVar, m4), "m4", "float", 1, 18, 0, 1, 0, 0}, {"{USEG}:1:MOFF", offsetof(struct UserVar, m1Off), "m1Off", "float", 1, 19, 0, 1, 0, 0}, {"{USEG}:2:MOFF", offsetof(struct UserVar, m2Off), "m2Off", "float", 1, 20, 0, 1, 0, 0}, {"{USEG}:3:MOFF", offsetof(struct UserVar, m3Off), "m3Off", "float", 1, 21, 0, 1, 0, 0}, {"{USEG}:4:MOFF", offsetof(struct UserVar, m4Off), "m4Off", "float", 1, 22, 0, 1, 0, 0} }; /* Event masks for state set "deltaOff" */ static const seqMask EM_deltaOff_s_Stby[] = { 0x00000010, }; static const seqMask EM_deltaOff_s_Mov[] = { 0x00000010, }; static const seqMask EM_deltaOff_s_startMov[] = { 0x00078000, }; static const seqMask EM_deltaOff_s_Wait[] = { 0x00000036, }; static const seqMask EM_deltaOff_s_Off[] = { 0x00000000, }; static const seqMask EM_deltaOff_s_StbyEn[] = { 0x00000010, }; static const seqMask EM_deltaOff_s_Err[] = { 0x00000000, }; /* State table for state set "deltaOff" */ static seqState G_deltaOff_states[] = { { /* state name */ "s_Stby", /* action function */ A_deltaOff_s_Stby, /* event function */ E_deltaOff_s_Stby, /* delay function */ D_deltaOff_s_Stby, /* entry function */ I_deltaOff_s_Stby, /* exit function */ 0, /* event mask array */ EM_deltaOff_s_Stby, /* state options */ (0) }, { /* state name */ "s_Mov", /* action function */ A_deltaOff_s_Mov, /* event function */ E_deltaOff_s_Mov, /* delay function */ D_deltaOff_s_Mov, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_deltaOff_s_Mov, /* state options */ (0) }, { /* state name */ "s_startMov", /* action function */ A_deltaOff_s_startMov, /* event function */ E_deltaOff_s_startMov, /* delay function */ D_deltaOff_s_startMov, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_deltaOff_s_startMov, /* state options */ (0) }, { /* state name */ "s_Wait", /* action function */ A_deltaOff_s_Wait, /* event function */ E_deltaOff_s_Wait, /* delay function */ D_deltaOff_s_Wait, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_deltaOff_s_Wait, /* state options */ (0) }, { /* state name */ "s_Off", /* action function */ A_deltaOff_s_Off, /* event function */ E_deltaOff_s_Off, /* delay function */ D_deltaOff_s_Off, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_deltaOff_s_Off, /* state options */ (0) }, { /* state name */ "s_StbyEn", /* action function */ A_deltaOff_s_StbyEn, /* event function */ E_deltaOff_s_StbyEn, /* delay function */ D_deltaOff_s_StbyEn, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_deltaOff_s_StbyEn, /* state options */ (0) }, { /* state name */ "s_Err", /* action function */ A_deltaOff_s_Err, /* event function */ E_deltaOff_s_Err, /* delay function */ D_deltaOff_s_Err, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_deltaOff_s_Err, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "deltaOff", /* states */ G_deltaOff_states, /* number of states */ 7, /* number of delays */ 1 }, }; /* Program table (global) */ seqProgram deltaOff = { /* magic number */ 2001006, /* program name */ "deltaOff", /* channels */ G_channels, /* num. channels */ 22, /* 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 deltaOffRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&deltaOff); } epicsExportRegistrar(deltaOffRegistrar);