/* Generated with snc from positionMaintenance.i */ /* Program "positionMaintenance" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar { # line 18 "../positionMaintenance.st" int dmov; # line 19 "../positionMaintenance.st" int inPos; # line 20 "../positionMaintenance.st" int posMainEn; # line 22 "../positionMaintenance.st" float m1; # line 23 "../positionMaintenance.st" float m2; # line 24 "../positionMaintenance.st" float m3; # line 25 "../positionMaintenance.st" float m4; }; /* Program init func */ static void G_prog_init(struct UserVar *pVar) { static struct UserVar pVarInit = { 0, 0, 0, 0, 0, 0, 0, }; *pVar = pVarInit; } /****** Code for state "s_Stby" in state set "posMain" ******/ /* Entry function for state "s_Stby" in state set "posMain" */ static void I_posMain_s_Stby(SS_ID ssId, struct UserVar *pVar) { } /* Delay function for state "s_Stby" in state set "posMain" */ static void D_posMain_s_Stby(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Stby" in state set "posMain" */ static seqBool E_posMain_s_Stby(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 34 "../positionMaintenance.st" if (pVar->posMainEn == 1) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "s_Stby" in state set "posMain" */ static void A_posMain_s_Stby(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; } } /****** Code for state "s_Mon" in state set "posMain" ******/ /* Delay function for state "s_Mon" in state set "posMain" */ static void D_posMain_s_Mon(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Mon" in state set "posMain" */ static seqBool E_posMain_s_Mon(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 39 "../positionMaintenance.st" if (pVar->posMainEn == 0) { *pNextState = 0; *pTransNum = 0; return TRUE; } # line 41 "../positionMaintenance.st" if (pVar->dmov == 1 && pVar->inPos == 0) { *pNextState = 2; *pTransNum = 1; return TRUE; } return FALSE; } /* Action function for state "s_Mon" in state set "posMain" */ static void A_posMain_s_Mon(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { } return; case 1: { } return; } } /****** Code for state "s_Corr" in state set "posMain" ******/ /* Delay function for state "s_Corr" in state set "posMain" */ static void D_posMain_s_Corr(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "s_Corr" in state set "posMain" */ static seqBool E_posMain_s_Corr(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { if (TRUE) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "s_Corr" in state set "posMain" */ static void A_posMain_s_Corr(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 47 "../positionMaintenance.st" seq_pvPut(ssId, 3/*m1*/, 0); # line 48 "../positionMaintenance.st" seq_pvPut(ssId, 4/*m2*/, 0); # line 49 "../positionMaintenance.st" seq_pvPut(ssId, 5/*m3*/, 0); # line 50 "../positionMaintenance.st" seq_pvPut(ssId, 6/*m4*/, 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}:1:MOTR", offsetof(struct UserVar, m1), "m1", "float", 1, 4, 0, 1, 0, 0}, {"{USEG}:2:MOTR", offsetof(struct UserVar, m2), "m2", "float", 1, 5, 0, 1, 0, 0}, {"{USEG}:3:MOTR", offsetof(struct UserVar, m3), "m3", "float", 1, 6, 0, 1, 0, 0}, {"{USEG}:4:MOTR", offsetof(struct UserVar, m4), "m4", "float", 1, 7, 0, 1, 0, 0} }; /* Event masks for state set "posMain" */ static const seqMask EM_posMain_s_Stby[] = { 0x00000008, }; static const seqMask EM_posMain_s_Mon[] = { 0x0000000e, }; static const seqMask EM_posMain_s_Corr[] = { 0x00000000, }; /* State table for state set "posMain" */ static seqState G_posMain_states[] = { { /* state name */ "s_Stby", /* action function */ A_posMain_s_Stby, /* event function */ E_posMain_s_Stby, /* delay function */ D_posMain_s_Stby, /* entry function */ I_posMain_s_Stby, /* exit function */ 0, /* event mask array */ EM_posMain_s_Stby, /* state options */ (0) }, { /* state name */ "s_Mon", /* action function */ A_posMain_s_Mon, /* event function */ E_posMain_s_Mon, /* delay function */ D_posMain_s_Mon, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_posMain_s_Mon, /* state options */ (0) }, { /* state name */ "s_Corr", /* action function */ A_posMain_s_Corr, /* event function */ E_posMain_s_Corr, /* delay function */ D_posMain_s_Corr, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_posMain_s_Corr, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "posMain", /* states */ G_posMain_states, /* number of states */ 3, /* number of delays */ 0 }, }; /* Program table (global) */ seqProgram positionMaintenance = { /* magic number */ 2001006, /* program name */ "positionMaintenance", /* channels */ G_channels, /* num. channels */ 7, /* 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 positionMaintenanceRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&positionMaintenance); } epicsExportRegistrar(positionMaintenanceRegistrar);