/* Generated with snc from chirpControl.i */ /* Program "chirpControl" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ # line 3 "../chirpControl.st" static short chirpState = 0; # line 7 "../chirpControl.st" static double chirpValue = 0; # line 10 "../chirpControl.st" static double chirpDesired = 0; # line 13 "../chirpControl.st" static short chirpReady = 0; /* Program init func */ static void G_prog_init(struct UserVar *pVar) { } /****** Code for state "INIT" in state set "chirpCheck" ******/ /* Delay function for state "INIT" in state set "chirpCheck" */ static void D_chirpCheck_INIT(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "INIT" in state set "chirpCheck" */ static seqBool E_chirpCheck_INIT(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { if (TRUE) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "INIT" in state set "chirpCheck" */ static void A_chirpCheck_INIT(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 19 "../chirpControl.st" seq_pvGet(ssId, 1/*chirpValue*/, 2); # line 20 "../chirpControl.st" printf("*** INITAL STATE *** %f ***\n", chirpValue); } return; } } /****** Code for state "CHIRP_OFF" in state set "chirpCheck" ******/ /* Delay function for state "CHIRP_OFF" in state set "chirpCheck" */ static void D_chirpCheck_CHIRP_OFF(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "CHIRP_OFF" in state set "chirpCheck" */ static seqBool E_chirpCheck_CHIRP_OFF(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 26 "../chirpControl.st" if (chirpState > 0) { *pNextState = 2; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "CHIRP_OFF" in state set "chirpCheck" */ static void A_chirpCheck_CHIRP_OFF(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 27 "../chirpControl.st" printf("CHIRP went ON - getting current CHIRP\n"); # line 28 "../chirpControl.st" seq_pvGet(ssId, 1/*chirpValue*/, 1); # line 29 "../chirpControl.st" chirpReady = 0; # line 30 "../chirpControl.st" seq_pvPut(ssId, 3/*chirpReady*/, 1); } return; } } /****** Code for state "WAIT_CHIRP" in state set "chirpCheck" ******/ /* Delay function for state "WAIT_CHIRP" in state set "chirpCheck" */ static void D_chirpCheck_WAIT_CHIRP(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "WAIT_CHIRP" in state set "chirpCheck" */ static seqBool E_chirpCheck_WAIT_CHIRP(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 35 "../chirpControl.st" if (seq_pvGetComplete(ssId, 1/*chirpValue*/) && seq_pvGetComplete(ssId, 3/*chirpReady*/)) { *pNextState = 3; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "WAIT_CHIRP" in state set "chirpCheck" */ static void A_chirpCheck_WAIT_CHIRP(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 36 "../chirpControl.st" printf("CHIRP went ON - setting CHIRPDES\n"); # line 37 "../chirpControl.st" chirpDesired = chirpValue; # line 38 "../chirpControl.st" seq_pvPut(ssId, 2/*chirpDesired*/, 2); # line 39 "../chirpControl.st" chirpReady = 1; # line 40 "../chirpControl.st" seq_pvPut(ssId, 3/*chirpReady*/, 1); } return; } } /****** Code for state "WAIT_CHIRP_READY" in state set "chirpCheck" ******/ /* Delay function for state "WAIT_CHIRP_READY" in state set "chirpCheck" */ static void D_chirpCheck_WAIT_CHIRP_READY(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "WAIT_CHIRP_READY" in state set "chirpCheck" */ static seqBool E_chirpCheck_WAIT_CHIRP_READY(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 45 "../chirpControl.st" if (seq_pvGetComplete(ssId, 3/*chirpReady*/)) { *pNextState = 4; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "WAIT_CHIRP_READY" in state set "chirpCheck" */ static void A_chirpCheck_WAIT_CHIRP_READY(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 46 "../chirpControl.st" printf("CHIRPREADY has been set to YES\n"); } return; } } /****** Code for state "CHIRP_ON" in state set "chirpCheck" ******/ /* Delay function for state "CHIRP_ON" in state set "chirpCheck" */ static void D_chirpCheck_CHIRP_ON(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "CHIRP_ON" in state set "chirpCheck" */ static seqBool E_chirpCheck_CHIRP_ON(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 52 "../chirpControl.st" if (chirpState <= 0) { *pNextState = 5; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "CHIRP_ON" in state set "chirpCheck" */ static void A_chirpCheck_CHIRP_ON(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 53 "../chirpControl.st" printf("CHIRP went OFF\n"); } return; } } /****** Code for state "WAIT_CHIRP_NOT_READY" in state set "chirpCheck" ******/ /* Delay function for state "WAIT_CHIRP_NOT_READY" in state set "chirpCheck" */ static void D_chirpCheck_WAIT_CHIRP_NOT_READY(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "WAIT_CHIRP_NOT_READY" in state set "chirpCheck" */ static seqBool E_chirpCheck_WAIT_CHIRP_NOT_READY(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 58 "../chirpControl.st" if (seq_pvGetComplete(ssId, 3/*chirpReady*/)) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "WAIT_CHIRP_NOT_READY" in state set "chirpCheck" */ static void A_chirpCheck_WAIT_CHIRP_NOT_READY(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 59 "../chirpControl.st" chirpReady = 0; # line 60 "../chirpControl.st" seq_pvPut(ssId, 3/*chirpReady*/, 1); # line 61 "../chirpControl.st" printf("CHIRPREADY has been set to NO\n"); } return; } } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"FBCK:{IOC}:{LOOP}:CHIRPSTATE", (size_t)&chirpState, "chirpState", "short", 1, 1, 0, 1, 0, 0}, {"FBCK:LI22:1:CHIRP", (size_t)&chirpValue, "chirpValue", "double", 1, 2, 0, 0, 0, 0}, {"FBCK:{IOC}:{LOOP}:CHIRPDES", (size_t)&chirpDesired, "chirpDesired", "double", 1, 3, 0, 0, 0, 0}, {"FBCK:{IOC}:{LOOP}:CHIRPREADY", (size_t)&chirpReady, "chirpReady", "short", 1, 4, 0, 0, 0, 0} }; /* Event masks for state set "chirpCheck" */ static const seqMask EM_chirpCheck_INIT[] = { 0x00000000, }; static const seqMask EM_chirpCheck_CHIRP_OFF[] = { 0x00000002, }; static const seqMask EM_chirpCheck_WAIT_CHIRP[] = { 0x00000014, }; static const seqMask EM_chirpCheck_WAIT_CHIRP_READY[] = { 0x00000010, }; static const seqMask EM_chirpCheck_CHIRP_ON[] = { 0x00000002, }; static const seqMask EM_chirpCheck_WAIT_CHIRP_NOT_READY[] = { 0x00000010, }; /* State table for state set "chirpCheck" */ static seqState G_chirpCheck_states[] = { { /* state name */ "INIT", /* action function */ A_chirpCheck_INIT, /* event function */ E_chirpCheck_INIT, /* delay function */ D_chirpCheck_INIT, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_chirpCheck_INIT, /* state options */ (0) }, { /* state name */ "CHIRP_OFF", /* action function */ A_chirpCheck_CHIRP_OFF, /* event function */ E_chirpCheck_CHIRP_OFF, /* delay function */ D_chirpCheck_CHIRP_OFF, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_chirpCheck_CHIRP_OFF, /* state options */ (0) }, { /* state name */ "WAIT_CHIRP", /* action function */ A_chirpCheck_WAIT_CHIRP, /* event function */ E_chirpCheck_WAIT_CHIRP, /* delay function */ D_chirpCheck_WAIT_CHIRP, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_chirpCheck_WAIT_CHIRP, /* state options */ (0) }, { /* state name */ "WAIT_CHIRP_READY", /* action function */ A_chirpCheck_WAIT_CHIRP_READY, /* event function */ E_chirpCheck_WAIT_CHIRP_READY, /* delay function */ D_chirpCheck_WAIT_CHIRP_READY, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_chirpCheck_WAIT_CHIRP_READY, /* state options */ (0) }, { /* state name */ "CHIRP_ON", /* action function */ A_chirpCheck_CHIRP_ON, /* event function */ E_chirpCheck_CHIRP_ON, /* delay function */ D_chirpCheck_CHIRP_ON, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_chirpCheck_CHIRP_ON, /* state options */ (0) }, { /* state name */ "WAIT_CHIRP_NOT_READY", /* action function */ A_chirpCheck_WAIT_CHIRP_NOT_READY, /* event function */ E_chirpCheck_WAIT_CHIRP_NOT_READY, /* delay function */ D_chirpCheck_WAIT_CHIRP_NOT_READY, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_chirpCheck_WAIT_CHIRP_NOT_READY, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "chirpCheck", /* states */ G_chirpCheck_states, /* number of states */ 6, /* number of delays */ 0 }, }; /* Program table (global) */ seqProgram chirpControl = { /* magic number */ 2001003, /* program name */ "chirpControl", /* channels */ G_channels, /* num. channels */ 4, /* state sets */ G_state_sets, /* num. state sets */ 1, /* user var size */ 0, /* param */ "", /* num. event flags */ 0, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF), /* init func */ G_prog_init, /* entry func */ NULL, /* exit func */ NULL, /* num. queues */ 0 }; /* Register sequencer commands and program */ #include "epicsExport.h" static void chirpControlRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&chirpControl); } epicsExportRegistrar(chirpControlRegistrar);