/* C code for program rfResStep, generated by snc from ../../src/rf/rfresstep.st */ #include #include #include #include #include "seq_snc.h" # line 33 "../../src/rf/rfresstep.st" void debugPrintFull(char *pCM, char *pCAV, char *debug_msg, int inhib, int otto, int hAbort, int sgnLim, int absLim, int limA, int dirA, int limB); void debugPrint(char *pCM, char *pCAV, char *debug_msg); /* Variable declarations */ struct seqg_vars { # line 43 "../../src/rf/rfresstep.st" short debug_on; # line 47 "../../src/rf/rfresstep.st" string debug_msg; # line 49 "../../src/rf/rfresstep.st" int stat_msg; # line 66 "../../src/rf/rfresstep.st" char *stat_strings[13]; # line 77 "../../src/rf/rfresstep.st" int uGoPos; # line 82 "../../src/rf/rfresstep.st" int uGoNeg; # line 87 "../../src/rf/rfresstep.st" int uGoSteps; # line 92 "../../src/rf/rfresstep.st" int uAbort; # line 97 "../../src/rf/rfresstep.st" int uClear; # line 106 "../../src/rf/rfresstep.st" int hSteps; # line 110 "../../src/rf/rfresstep.st" int hGo; # line 114 "../../src/rf/rfresstep.st" int hAbort; # line 119 "../../src/rf/rfresstep.st" int hClrDone; # line 125 "../../src/rf/rfresstep.st" int dirAA; # line 130 "../../src/rf/rfresstep.st" int otto; # line 137 "../../src/rf/rfresstep.st" int moving; # line 141 "../../src/rf/rfresstep.st" int dirA; # line 145 "../../src/rf/rfresstep.st" int limB; # line 149 "../../src/rf/rfresstep.st" int limA; # line 153 "../../src/rf/rfresstep.st" int inhib; # line 157 "../../src/rf/rfresstep.st" int sgnLim; # line 161 "../../src/rf/rfresstep.st" int absLim; # line 172 "../../src/rf/rfresstep.st" char *pCM; # line 173 "../../src/rf/rfresstep.st" char *pCAV; # line 175 "../../src/rf/rfresstep.st" int movReqDir; }; /* Function declarations */ #define seqg_var (*(struct seqg_vars *const *)seqg_env) /* Program init func */ static void seqg_init(PROG_ID seqg_env) { { # line 67 "../../src/rf/rfresstep.st" static char *seqg_initvar_stat_strings[13] = {"Await req", "Move req", "Move cmd", "Abort cmd", "Clear cmd", "Moving", "Inhibit", "Auto mode", "Abort", "Sign lim", "Abs lim", "Lim A", "Lim B"}; memcpy(&seqg_var->stat_strings, &seqg_initvar_stat_strings, sizeof(seqg_initvar_stat_strings)); } } /****** Code for state "Init" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "Init" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_Init(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { if (TRUE) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "Init" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_Init(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 185 "../../src/rf/rfresstep.st" seqg_var->pCM = seq_macValueGet(seqg_env, "CM"); # line 186 "../../src/rf/rfresstep.st" seqg_var->pCAV = seq_macValueGet(seqg_env, "CAV"); # line 187 "../../src/rf/rfresstep.st" printf("%s%s0: Entered rfResStep\n", seqg_var->pCM, seqg_var->pCAV); # line 188 "../../src/rf/rfresstep.st" seqg_var->hGo = 0; # line 188 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 8/*hGo*/, DEFAULT, DEFAULT_TIMEOUT); # line 189 "../../src/rf/rfresstep.st" seqg_var->hAbort = 0; # line 189 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 9/*hAbort*/, DEFAULT, DEFAULT_TIMEOUT); # line 190 "../../src/rf/rfresstep.st" seqg_var->hClrDone = 0; # line 190 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 10/*hClrDone*/, DEFAULT, DEFAULT_TIMEOUT); # line 191 "../../src/rf/rfresstep.st" seqg_var->movReqDir = 0; } return; } } /****** Code for state "WaitForButton" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "WaitForButton" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_WaitForButton(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 196 "../../src/rf/rfresstep.st" if ((seqg_var->uGoPos != 0) && (seqg_var->uGoNeg != 0)) { *seqg_pnst = 8; *seqg_ptrn = 0; return TRUE; } # line 203 "../../src/rf/rfresstep.st" if (seqg_var->uGoPos != 0) { *seqg_pnst = 2; *seqg_ptrn = 1; return TRUE; } # line 213 "../../src/rf/rfresstep.st" if (seqg_var->uGoNeg != 0) { *seqg_pnst = 2; *seqg_ptrn = 2; return TRUE; } # line 223 "../../src/rf/rfresstep.st" if (seqg_var->uAbort != 0) { *seqg_pnst = 9; *seqg_ptrn = 3; return TRUE; } # line 235 "../../src/rf/rfresstep.st" if (seqg_var->uClear != 0) { *seqg_pnst = 10; *seqg_ptrn = 4; return TRUE; } return FALSE; } /* Action function for state "WaitForButton" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_WaitForButton(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 197 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 198 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Pos and Neg move requests. Abort"); # line 199 "../../src/rf/rfresstep.st" debugPrintFull(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg, seqg_var->inhib, seqg_var->otto, seqg_var->hAbort, seqg_var->sgnLim, seqg_var->absLim, seqg_var->limA, seqg_var->dirA, seqg_var->limB); } } return; case 1: { # line 204 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 1; # line 205 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 1/*stat_msg*/, DEFAULT, DEFAULT_TIMEOUT); # line 206 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 207 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Received positive move request"); # line 208 "../../src/rf/rfresstep.st" debugPrintFull(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg, seqg_var->inhib, seqg_var->otto, seqg_var->hAbort, seqg_var->sgnLim, seqg_var->absLim, seqg_var->limA, seqg_var->dirA, seqg_var->limB); } # line 210 "../../src/rf/rfresstep.st" seqg_var->movReqDir = 1; } return; case 2: { # line 214 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 1; # line 215 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 1/*stat_msg*/, DEFAULT, DEFAULT_TIMEOUT); # line 216 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 217 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Received negative move request"); # line 218 "../../src/rf/rfresstep.st" debugPrintFull(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg, seqg_var->inhib, seqg_var->otto, seqg_var->hAbort, seqg_var->sgnLim, seqg_var->absLim, seqg_var->limA, seqg_var->dirA, seqg_var->limB); } # line 220 "../../src/rf/rfresstep.st" seqg_var->movReqDir = -1; } return; case 3: { # line 224 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 225 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Abort request. Set/clear abort bit"); # line 226 "../../src/rf/rfresstep.st" debugPrint(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); } # line 228 "../../src/rf/rfresstep.st" seqg_var->hAbort = 1; # line 228 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 9/*hAbort*/, DEFAULT, DEFAULT_TIMEOUT); # line 229 "../../src/rf/rfresstep.st" epicsThreadSleep((0.1)); # line 230 "../../src/rf/rfresstep.st" seqg_var->hAbort = 0; # line 230 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 9/*hAbort*/, DEFAULT, DEFAULT_TIMEOUT); # line 231 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 3; # line 232 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 1/*stat_msg*/, DEFAULT, DEFAULT_TIMEOUT); } return; case 4: { # line 236 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 237 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Clear request. Set/clear clear bit"); # line 238 "../../src/rf/rfresstep.st" debugPrint(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); } # line 240 "../../src/rf/rfresstep.st" seqg_var->hClrDone = 1; # line 240 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 10/*hClrDone*/, DEFAULT, DEFAULT_TIMEOUT); # line 241 "../../src/rf/rfresstep.st" epicsThreadSleep((0.1)); # line 242 "../../src/rf/rfresstep.st" seqg_var->hClrDone = 0; # line 242 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 10/*hClrDone*/, DEFAULT, DEFAULT_TIMEOUT); # line 243 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 4; # line 244 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 1/*stat_msg*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "GoButtonPushed" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "GoButtonPushed" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_GoButtonPushed(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 252 "../../src/rf/rfresstep.st" if (seqg_var->moving || seqg_var->inhib || seqg_var->otto || seqg_var->hAbort || (seqg_var->limB && (seqg_var->movReqDir == 1)) || (seqg_var->limA && (seqg_var->movReqDir == -1))) { *seqg_pnst = 8; *seqg_ptrn = 0; return TRUE; } # line 287 "../../src/rf/rfresstep.st" if (seq_delay(seqg_env, (0.1))) { *seqg_pnst = 3; *seqg_ptrn = 1; return TRUE; } return FALSE; } /* Action function for state "GoButtonPushed" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_GoButtonPushed(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 253 "../../src/rf/rfresstep.st" if (seqg_var->moving) # line 254 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 5; else # line 255 "../../src/rf/rfresstep.st" if (seqg_var->inhib) # line 256 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 6; else # line 257 "../../src/rf/rfresstep.st" if (seqg_var->otto) # line 258 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 7; else # line 259 "../../src/rf/rfresstep.st" if (seqg_var->hAbort) { # line 260 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 8; # line 261 "../../src/rf/rfresstep.st" seqg_var->hAbort = 0; # line 261 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 9/*hAbort*/, DEFAULT, DEFAULT_TIMEOUT); } else # line 276 "../../src/rf/rfresstep.st" if (seqg_var->limB && (seqg_var->movReqDir == 1)) # line 277 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 12; else # line 278 "../../src/rf/rfresstep.st" if (seqg_var->limA && (seqg_var->movReqDir == -1)) # line 279 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 11; # line 281 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 1/*stat_msg*/, DEFAULT, DEFAULT_TIMEOUT); # line 282 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 283 "../../src/rf/rfresstep.st" printf("Move failed: %s\n", seqg_var->stat_strings[seqg_var->stat_msg]); } } return; case 1: { # line 288 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 289 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Move command.uGoPos %i, uGoNeg %i, movReqDir %i", seqg_var->uGoPos, seqg_var->uGoNeg, seqg_var->movReqDir); # line 290 "../../src/rf/rfresstep.st" debugPrint(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); } } return; } } /****** Code for state "Step0" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "Step0" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_Step0(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { if (TRUE) { *seqg_pnst = 4; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "Step0" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_Step0(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 298 "../../src/rf/rfresstep.st" seqg_var->hSteps = seqg_var->uGoSteps; # line 298 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 7/*hSteps*/, DEFAULT, DEFAULT_TIMEOUT); # line 300 "../../src/rf/rfresstep.st" if (seqg_var->movReqDir >= 0.0) { # line 301 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 302 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Positive move. Set direction/steps"); } # line 304 "../../src/rf/rfresstep.st" seqg_var->dirAA = 0; # line 304 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 11/*dirAA*/, DEFAULT, DEFAULT_TIMEOUT); # line 305 "../../src/rf/rfresstep.st" seqg_var->uGoNeg = 0; # line 305 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 3/*uGoNeg*/, DEFAULT, DEFAULT_TIMEOUT); } else { # line 308 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 309 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Negative move. Set direction/steps"); } # line 311 "../../src/rf/rfresstep.st" seqg_var->dirAA = 1; # line 311 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 11/*dirAA*/, DEFAULT, DEFAULT_TIMEOUT); # line 312 "../../src/rf/rfresstep.st" seqg_var->uGoPos = 0; # line 312 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 2/*uGoPos*/, DEFAULT, DEFAULT_TIMEOUT); } # line 315 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 316 "../../src/rf/rfresstep.st" printf("%s%s0: %s\n", seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); # line 317 "../../src/rf/rfresstep.st" printf("%s%s0: %d %d %i\n", seqg_var->pCM, seqg_var->pCAV, seqg_var->uGoSteps, seqg_var->hSteps, seqg_var->dirAA); } } return; } } /****** Code for state "Step1" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "Step1" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_Step1(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 323 "../../src/rf/rfresstep.st" if (seq_delay(seqg_env, (0.1))) { *seqg_pnst = 5; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "Step1" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_Step1(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 324 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 325 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Set/reset clear bit"); # line 326 "../../src/rf/rfresstep.st" debugPrint(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); } # line 328 "../../src/rf/rfresstep.st" seqg_var->hClrDone = 1; # line 328 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 10/*hClrDone*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "Step2" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "Step2" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_Step2(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 333 "../../src/rf/rfresstep.st" if (seq_delay(seqg_env, (0.1))) { *seqg_pnst = 6; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "Step2" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_Step2(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 334 "../../src/rf/rfresstep.st" seqg_var->hClrDone = 0; # line 334 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 10/*hClrDone*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "Step3" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "Step3" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_Step3(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 339 "../../src/rf/rfresstep.st" if (seq_delay(seqg_env, (0.1))) { *seqg_pnst = 7; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "Step3" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_Step3(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 340 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 2; # line 341 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 1/*stat_msg*/, DEFAULT, DEFAULT_TIMEOUT); # line 342 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 343 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Set/reset go bit"); # line 344 "../../src/rf/rfresstep.st" debugPrint(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); } # line 346 "../../src/rf/rfresstep.st" seqg_var->stat_msg = 2; # line 347 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 1/*stat_msg*/, DEFAULT, DEFAULT_TIMEOUT); # line 348 "../../src/rf/rfresstep.st" seqg_var->hGo = 1; # line 348 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 8/*hGo*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "Step4" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "Step4" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_Step4(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 353 "../../src/rf/rfresstep.st" if (seq_delay(seqg_env, (0.1))) { *seqg_pnst = 8; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "Step4" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_Step4(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 354 "../../src/rf/rfresstep.st" seqg_var->hGo = 0; # line 354 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 8/*hGo*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "GoDelay" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "GoDelay" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_GoDelay(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 359 "../../src/rf/rfresstep.st" if (seq_delay(seqg_env, (0.1))) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "GoDelay" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_GoDelay(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 360 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 361 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Clear all requests. Await next request\n"); # line 362 "../../src/rf/rfresstep.st" debugPrint(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); } # line 364 "../../src/rf/rfresstep.st" seqg_var->movReqDir = 0; # line 365 "../../src/rf/rfresstep.st" seqg_var->uGoPos = 0; # line 365 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 2/*uGoPos*/, DEFAULT, DEFAULT_TIMEOUT); # line 366 "../../src/rf/rfresstep.st" seqg_var->uGoNeg = 0; # line 366 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 3/*uGoNeg*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "AbortDelay" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "AbortDelay" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_AbortDelay(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 371 "../../src/rf/rfresstep.st" if (seq_delay(seqg_env, (0.1))) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "AbortDelay" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_AbortDelay(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 372 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 373 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Clear abort request\n"); # line 374 "../../src/rf/rfresstep.st" debugPrint(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); } # line 376 "../../src/rf/rfresstep.st" seqg_var->uAbort = 0; # line 376 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 5/*uAbort*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } /****** Code for state "ClearDelay" in state set "RES_HI_HW_LINK" ******/ /* Event function for state "ClearDelay" in state set "RES_HI_HW_LINK" */ static seqBool seqg_event_RES_HI_HW_LINK_0_ClearDelay(SS_ID seqg_env, int *seqg_ptrn, int *seqg_pnst) { # line 381 "../../src/rf/rfresstep.st" if (seq_delay(seqg_env, (0.1))) { *seqg_pnst = 1; *seqg_ptrn = 0; return TRUE; } return FALSE; } /* Action function for state "ClearDelay" in state set "RES_HI_HW_LINK" */ static void seqg_action_RES_HI_HW_LINK_0_ClearDelay(SS_ID seqg_env, int seqg_trn, int *seqg_pnst) { switch(seqg_trn) { case 0: { # line 382 "../../src/rf/rfresstep.st" if (seqg_var->debug_on) { # line 383 "../../src/rf/rfresstep.st" sprintf(seqg_var->debug_msg, "Clear clear request\n"); # line 384 "../../src/rf/rfresstep.st" debugPrint(seqg_var->pCM, seqg_var->pCAV, seqg_var->debug_msg); } # line 386 "../../src/rf/rfresstep.st" seqg_var->uClear = 0; # line 386 "../../src/rf/rfresstep.st" seq_pvPutTmo(seqg_env, 6/*uClear*/, DEFAULT, DEFAULT_TIMEOUT); } return; } } #undef seqg_var /************************ Tables ************************/ /* Channel table */ static seqChan seqg_chans[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"{CM}{CAV}0:STEP:DBGCTRL", offsetof(struct seqg_vars, debug_on), "debug_on", P_SHORT, 1, 1, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:STATMSG", offsetof(struct seqg_vars, stat_msg), "stat_msg", P_INT, 1, 2, 0, 0, 0, 0}, {"{CM}{CAV}0:STEP:MOV_REQ_POS", offsetof(struct seqg_vars, uGoPos), "uGoPos", P_INT, 1, 3, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:MOV_REQ_NEG", offsetof(struct seqg_vars, uGoNeg), "uGoNeg", P_INT, 1, 4, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:NSTEPS", offsetof(struct seqg_vars, uGoSteps), "uGoSteps", P_INT, 1, 5, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:ABORT_REQ", offsetof(struct seqg_vars, uAbort), "uAbort", P_INT, 1, 6, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:CLEAR_REQ", offsetof(struct seqg_vars, uClear), "uClear", P_INT, 1, 7, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:REG_NSTEPS", offsetof(struct seqg_vars, hSteps), "hSteps", P_INT, 1, 8, 0, 0, 0, 0}, {"{CM}{CAV}0:STEP:CTRLWRD.B0", offsetof(struct seqg_vars, hGo), "hGo", P_INT, 1, 9, 0, 0, 0, 0}, {"{CM}{CAV}0:STEP:CTRLWRD.B3", offsetof(struct seqg_vars, hAbort), "hAbort", P_INT, 1, 10, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:CTRLWRD.B4", offsetof(struct seqg_vars, hClrDone), "hClrDone", P_INT, 1, 11, 0, 0, 0, 0}, {"{CM}{CAV}0:STEP:CTRLWRD.B5", offsetof(struct seqg_vars, dirAA), "dirAA", P_INT, 1, 12, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:CTRLWRD.B7", offsetof(struct seqg_vars, otto), "otto", P_INT, 1, 13, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:STATWRD.B0", offsetof(struct seqg_vars, moving), "moving", P_INT, 1, 14, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:STATWRD.B1", offsetof(struct seqg_vars, dirA), "dirA", P_INT, 1, 15, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:STATWRD.B3", offsetof(struct seqg_vars, limB), "limB", P_INT, 1, 16, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:STATWRD.B4", offsetof(struct seqg_vars, limA), "limA", P_INT, 1, 17, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:STATWRD.B6", offsetof(struct seqg_vars, inhib), "inhib", P_INT, 1, 18, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:STATWRD.B8", offsetof(struct seqg_vars, sgnLim), "sgnLim", P_INT, 1, 19, 0, 1, 0, 0}, {"{CM}{CAV}0:STEP:STATWRD.B9", offsetof(struct seqg_vars, absLim), "absLim", P_INT, 1, 20, 0, 1, 0, 0}, }; /* Event masks for state set "RES_HI_HW_LINK" */ static const seqMask seqg_mask_RES_HI_HW_LINK_0_Init[] = { 0x00000000, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_WaitForButton[] = { 0x000000d8, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_GoButtonPushed[] = { 0x00076400, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_Step0[] = { 0x00000000, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_Step1[] = { 0x00000000, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_Step2[] = { 0x00000000, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_Step3[] = { 0x00000000, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_Step4[] = { 0x00000000, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_GoDelay[] = { 0x00000000, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_AbortDelay[] = { 0x00000000, }; static const seqMask seqg_mask_RES_HI_HW_LINK_0_ClearDelay[] = { 0x00000000, }; /* State table for state set "RES_HI_HW_LINK" */ static seqState seqg_states_RES_HI_HW_LINK[] = { { /* state name */ "Init", /* action function */ seqg_action_RES_HI_HW_LINK_0_Init, /* event function */ seqg_event_RES_HI_HW_LINK_0_Init, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_Init, /* state options */ (0) }, { /* state name */ "WaitForButton", /* action function */ seqg_action_RES_HI_HW_LINK_0_WaitForButton, /* event function */ seqg_event_RES_HI_HW_LINK_0_WaitForButton, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_WaitForButton, /* state options */ (0) }, { /* state name */ "GoButtonPushed", /* action function */ seqg_action_RES_HI_HW_LINK_0_GoButtonPushed, /* event function */ seqg_event_RES_HI_HW_LINK_0_GoButtonPushed, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_GoButtonPushed, /* state options */ (0) }, { /* state name */ "Step0", /* action function */ seqg_action_RES_HI_HW_LINK_0_Step0, /* event function */ seqg_event_RES_HI_HW_LINK_0_Step0, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_Step0, /* state options */ (0) }, { /* state name */ "Step1", /* action function */ seqg_action_RES_HI_HW_LINK_0_Step1, /* event function */ seqg_event_RES_HI_HW_LINK_0_Step1, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_Step1, /* state options */ (0) }, { /* state name */ "Step2", /* action function */ seqg_action_RES_HI_HW_LINK_0_Step2, /* event function */ seqg_event_RES_HI_HW_LINK_0_Step2, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_Step2, /* state options */ (0) }, { /* state name */ "Step3", /* action function */ seqg_action_RES_HI_HW_LINK_0_Step3, /* event function */ seqg_event_RES_HI_HW_LINK_0_Step3, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_Step3, /* state options */ (0) }, { /* state name */ "Step4", /* action function */ seqg_action_RES_HI_HW_LINK_0_Step4, /* event function */ seqg_event_RES_HI_HW_LINK_0_Step4, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_Step4, /* state options */ (0) }, { /* state name */ "GoDelay", /* action function */ seqg_action_RES_HI_HW_LINK_0_GoDelay, /* event function */ seqg_event_RES_HI_HW_LINK_0_GoDelay, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_GoDelay, /* state options */ (0) }, { /* state name */ "AbortDelay", /* action function */ seqg_action_RES_HI_HW_LINK_0_AbortDelay, /* event function */ seqg_event_RES_HI_HW_LINK_0_AbortDelay, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_AbortDelay, /* state options */ (0) }, { /* state name */ "ClearDelay", /* action function */ seqg_action_RES_HI_HW_LINK_0_ClearDelay, /* event function */ seqg_event_RES_HI_HW_LINK_0_ClearDelay, /* entry function */ 0, /* exit function */ 0, /* event mask array */ seqg_mask_RES_HI_HW_LINK_0_ClearDelay, /* state options */ (0) }, }; /* State set table */ static seqSS seqg_statesets[] = { { /* state set name */ "RES_HI_HW_LINK", /* states */ seqg_states_RES_HI_HW_LINK, /* number of states */ 11 }, }; /* Program table (global) */ seqProgram rfResStep = { /* magic number */ 2002004, /* program name */ "rfResStep", /* channels */ seqg_chans, /* num. channels */ 20, /* state sets */ seqg_statesets, /* num. state sets */ 1, /* user var size */ sizeof(struct seqg_vars), /* param */ "", /* num. event flags */ 0, /* encoded options */ (0 | OPT_CONN | OPT_NEWEF | OPT_REENT), /* init func */ seqg_init, /* entry func */ 0, /* exit func */ 0, /* num. queues */ 0 }; # line 393 "../../src/rf/rfresstep.st" void debugPrintFull(char *pCM, char *pCAV, char *debug_msg, int inhib, int otto, int hAbort, int sgnLim, int absLim, int limA, int dirA, int limB) { printf("%s%s0: %s\n", pCM, pCAV, debug_msg); printf("%s%s0: %d %d %d %d %d %d %d %d %d\n", pCM, pCAV, inhib, otto, hAbort, sgnLim, absLim, limA, dirA, limB, !dirA); } void debugPrint(char *pCM, char *pCAV, char *debug_msg) { printf("%s%s0: %s\n", pCM, pCAV, debug_msg); } /* Register sequencer commands and program */ #include "epicsExport.h" static void rfResStepRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&rfResStep); } epicsExportRegistrar(rfResStepRegistrar);