/* Generated with snc from ../klysSbstTctl.stt */ /* Program "klysSbstTctl" */ #include #include #include #include #include "epicsTypes.h" #include "seqCom.h" /* Variable declarations */ struct UserVar { # line 151 "../klysSbstTctl.stt" char *prim; # line 152 "../klysSbstTctl.stt" char *loca; # line 153 "../klysSbstTctl.stt" char *unit; # line 154 "../klysSbstTctl.stt" char *sys; # line 157 "../klysSbstTctl.stt" string pvname; # line 161 "../klysSbstTctl.stt" string name; # line 165 "../klysSbstTctl.stt" string trigname; # line 168 "../klysSbstTctl.stt" string trigtctl; # line 171 "../klysSbstTctl.stt" short trigtctldisa; # line 174 "../klysSbstTctl.stt" string trigtsta; # line 177 "../klysSbstTctl.stt" short trigtctlproc; # line 181 "../klysSbstTctl.stt" string tctl; # line 185 "../klysSbstTctl.stt" string tsta; # line 189 "../klysSbstTctl.stt" unsigned long stat; # line 193 "../klysSbstTctl.stt" string request_bc1; # line 199 "../klysSbstTctl.stt" string request_bc2; # line 205 "../klysSbstTctl.stt" string request_bc3; # line 211 "../klysSbstTctl.stt" string request_bc4; # line 218 "../klysSbstTctl.stt" string debug_msg_bc; # line 221 "../klysSbstTctl.stt" string debug_msg; # line 224 "../klysSbstTctl.stt" short debug_msg_on; # line 229 "../klysSbstTctl.stt" short msg; # line 233 "../klysSbstTctl.stt" string msgvbs; # line 237 "../klysSbstTctl.stt" string msg_str; # line 240 "../klysSbstTctl.stt" string log_msg; # line 250 "../klysSbstTctl.stt" short request; # line 253 "../klysSbstTctl.stt" string beamcode; # line 259 "../klysSbstTctl.stt" unsigned long hsta; # line 263 "../klysSbstTctl.stt" string sectsbst; # line 267 "../klysSbstTctl.stt" unsigned long tmsk[2]; # line 271 "../klysSbstTctl.stt" unsigned long tmsk_bc[2]; # line 277 "../klysSbstTctl.stt" string sbsttrigname; # line 280 "../klysSbstTctl.stt" string sbsttrigtctl; # line 283 "../klysSbstTctl.stt" short sbsttrigtctldisa; # line 286 "../klysSbstTctl.stt" short sbsttrigtctlproc; # line 289 "../klysSbstTctl.stt" string sbsttrigtsta; # line 293 "../klysSbstTctl.stt" short sbstmsg; # line 297 "../klysSbstTctl.stt" string sbstmsgvbs; # line 301 "../klysSbstTctl.stt" string sbstdebug_msg; # line 304 "../klysSbstTctl.stt" short sbstdebug_msg_on; # line 310 "../klysSbstTctl.stt" string o_trigname; # line 313 "../klysSbstTctl.stt" string o_trigtsta; # line 316 "../klysSbstTctl.stt" string o_sectsbst; # line 319 "../klysSbstTctl.stt" unsigned long o_hsta; # line 322 "../klysSbstTctl.stt" string i_s; # line 323 "../klysSbstTctl.stt" string sbstname; # line 324 "../klysSbstTctl.stt" int deact_check; # line 325 "../klysSbstTctl.stt" unsigned long sector_mask; # line 326 "../klysSbstTctl.stt" string o_name; # line 327 "../klysSbstTctl.stt" int act_check; # line 330 "../klysSbstTctl.stt" int i; # line 331 "../klysSbstTctl.stt" int j; # line 332 "../klysSbstTctl.stt" int init_pass_bc1; # line 333 "../klysSbstTctl.stt" int init_pass_bc2; # line 334 "../klysSbstTctl.stt" int init_pass_bc3; # line 335 "../klysSbstTctl.stt" int init_pass_bc4; # line 336 "../klysSbstTctl.stt" int tmsk_stat; }; /* C code definitions */ # line 138 "../klysSbstTctl.stt" #include /* Waiting for channels to connect, etc. (seconds) */ #define TIMEOUT 5 # line 328 "../klysSbstTctl.stt" time_t t; # line 329 "../klysSbstTctl.stt" time_t tnow; /* 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, "", 0, 0, 0, 0, 0, 0, 0, 0, }; *pVar = pVarInit; } /****** Code for state "init" in state set "main" ******/ /* Entry function for state "init" in state set "main" */ static void I_main_init(SS_ID ssId, struct UserVar *pVar) { # line 413 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 414 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Entered init entry"); # line 415 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } } /* Delay function for state "init" in state set "main" */ static void D_main_init(SS_ID ssId, struct UserVar *pVar) { # line 419 "../klysSbstTctl.stt" seq_delayInit(ssId, 0, (15)); } /* Event function for state "init" in state set "main" */ static seqBool E_main_init(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 419 "../klysSbstTctl.stt" if ((seq_pvConnectCount(ssId) == seq_pvAssignCount(ssId)) && seq_delay(ssId, 0)) { *pNextState = 1; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "init" in state set "main" */ static void A_main_init(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 420 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 421 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "init; pvConnect=pvAssign"); # line 422 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 426 "../klysSbstTctl.stt" pVar->init_pass_bc1 = 1; # line 427 "../klysSbstTctl.stt" pVar->init_pass_bc2 = 1; # line 428 "../klysSbstTctl.stt" pVar->init_pass_bc3 = 1; # line 429 "../klysSbstTctl.stt" pVar->init_pass_bc4 = 1; # line 431 "../klysSbstTctl.stt" pVar->prim = seq_macValueGet(ssId, "PRIM"); # line 432 "../klysSbstTctl.stt" pVar->loca = seq_macValueGet(ssId, "LOCA"); # line 433 "../klysSbstTctl.stt" pVar->unit = seq_macValueGet(ssId, "UNIT"); # line 434 "../klysSbstTctl.stt" pVar->sys = seq_macValueGet(ssId, "SYS"); # line 435 "../klysSbstTctl.stt" sprintf(pVar->name, "%s:%s:%s", pVar->prim, pVar->loca, pVar->unit); # line 436 "../klysSbstTctl.stt" seq_pvGet(ssId, 2/*trigname*/, 0); # line 439 "../klysSbstTctl.stt" if (strstr(pVar->name, "KLYS")) { # line 440 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 441 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "init: Klys-specific init"); # line 442 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 445 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:SECTSBST", pVar->name); # line 446 "../klysSbstTctl.stt" seq_pvAssign(ssId, 24/*sectsbst*/, pVar->pvname); } # line 450 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 5/*ef_act_go*/); # line 451 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 6/*ef_deact_go*/); # line 452 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 7/*ef_reset_request*/); # line 457 "../klysSbstTctl.stt" seq_efSet(ssId, 1/*ef_request_bc1*/); # line 458 "../klysSbstTctl.stt" seq_efSet(ssId, 2/*ef_request_bc2*/); # line 459 "../klysSbstTctl.stt" seq_efSet(ssId, 3/*ef_request_bc3*/); # line 460 "../klysSbstTctl.stt" seq_efSet(ssId, 4/*ef_request_bc4*/); } return; } } /****** Code for state "init_klys_sbst" in state set "main" ******/ /* Delay function for state "init_klys_sbst" in state set "main" */ static void D_main_init_klys_sbst(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "init_klys_sbst" in state set "main" */ static seqBool E_main_init_klys_sbst(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 467 "../klysSbstTctl.stt" if (seq_pvConnectCount(ssId) == seq_pvAssignCount(ssId)) { *pNextState = 2; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "init_klys_sbst" in state set "main" */ static void A_main_init_klys_sbst(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 469 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 470 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Entered klys_sect_sbst"); # line 471 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 476 "../klysSbstTctl.stt" if (strstr(pVar->name, "KLYS")) { # line 478 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 479 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "klys_sect_sbst: Klys-specific"); # line 480 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 482 "../klysSbstTctl.stt" seq_pvGet(ssId, 24/*sectsbst*/, 0); # line 483 "../klysSbstTctl.stt" if (strcmp(pVar->sectsbst, "YES") == 0) { # line 485 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 486 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "klys_sect_sbst: sectsbst=YES"); # line 487 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 489 "../klysSbstTctl.stt" sprintf(pVar->sbstname, "SBST:%s:1", pVar->loca); # line 490 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:TRIG_DEVNAME", pVar->sbstname); # line 491 "../klysSbstTctl.stt" seq_pvAssign(ssId, 27/*sbsttrigname*/, pVar->pvname); } } } return; } } /****** Code for state "ready_for_request" in state set "main" ******/ /* Entry function for state "ready_for_request" in state set "main" */ static void I_main_ready_for_request(SS_ID ssId, struct UserVar *pVar) { # line 500 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 501 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Ready to receive request"); # line 502 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 506 "../klysSbstTctl.stt" if (!pVar->init_pass_bc1) # line 507 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 1/*ef_request_bc1*/); # line 508 "../klysSbstTctl.stt" if (!pVar->init_pass_bc2) # line 509 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 2/*ef_request_bc2*/); # line 510 "../klysSbstTctl.stt" if (!pVar->init_pass_bc3) # line 511 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 3/*ef_request_bc3*/); # line 512 "../klysSbstTctl.stt" if (!pVar->init_pass_bc4) # line 513 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 4/*ef_request_bc4*/); } /* Delay function for state "ready_for_request" in state set "main" */ static void D_main_ready_for_request(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "ready_for_request" in state set "main" */ static seqBool E_main_ready_for_request(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 516 "../klysSbstTctl.stt" if (seq_efTestAndClear(ssId, 1/*ef_request_bc1*/)) { *pNextState = 3; *pTransNum = 0; return TRUE; } # line 530 "../klysSbstTctl.stt" if (seq_efTestAndClear(ssId, 2/*ef_request_bc2*/)) { *pNextState = 3; *pTransNum = 1; return TRUE; } # line 544 "../klysSbstTctl.stt" if (seq_efTestAndClear(ssId, 3/*ef_request_bc3*/)) { *pNextState = 3; *pTransNum = 2; return TRUE; } # line 558 "../klysSbstTctl.stt" if (seq_efTestAndClear(ssId, 4/*ef_request_bc4*/)) { *pNextState = 3; *pTransNum = 3; return TRUE; } return FALSE; } /* Action function for state "ready_for_request" in state set "main" */ static void A_main_ready_for_request(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 517 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 518 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Received request on BC 1"); # line 519 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 521 "../klysSbstTctl.stt" sprintf(pVar->beamcode, "1"); # line 522 "../klysSbstTctl.stt" sprintf(pVar->pvname, "TRIG:%s:1:BEAMCODE%s_TMSK", pVar->sys, pVar->beamcode); # line 523 "../klysSbstTctl.stt" seq_pvAssign(ssId, 26/*tmsk_bc*/, pVar->pvname); # line 526 "../klysSbstTctl.stt" pVar->init_pass_bc1 = 0; } return; case 1: { # line 531 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 532 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Received request on BC 2"); # line 533 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 535 "../klysSbstTctl.stt" sprintf(pVar->beamcode, "2"); # line 536 "../klysSbstTctl.stt" sprintf(pVar->pvname, "TRIG:%s:1:BEAMCODE%s_TMSK", pVar->sys, pVar->beamcode); # line 537 "../klysSbstTctl.stt" seq_pvAssign(ssId, 26/*tmsk_bc*/, pVar->pvname); # line 540 "../klysSbstTctl.stt" pVar->init_pass_bc2 = 0; } return; case 2: { # line 545 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 546 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Received request on BC 3"); # line 547 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 549 "../klysSbstTctl.stt" sprintf(pVar->beamcode, "3"); # line 550 "../klysSbstTctl.stt" sprintf(pVar->pvname, "TRIG:%s:1:BEAMCODE%s_TMSK", pVar->sys, pVar->beamcode); # line 551 "../klysSbstTctl.stt" seq_pvAssign(ssId, 26/*tmsk_bc*/, pVar->pvname); # line 554 "../klysSbstTctl.stt" pVar->init_pass_bc3 = 0; } return; case 3: { # line 560 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 561 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Received request on BC 4"); # line 562 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 564 "../klysSbstTctl.stt" sprintf(pVar->beamcode, "4"); # line 565 "../klysSbstTctl.stt" sprintf(pVar->pvname, "TRIG:%s:1:BEAMCODE%s_TMSK", pVar->sys, pVar->beamcode); # line 566 "../klysSbstTctl.stt" seq_pvAssign(ssId, 26/*tmsk_bc*/, pVar->pvname); # line 569 "../klysSbstTctl.stt" pVar->init_pass_bc4 = 0; } return; } } /****** Code for state "request_received" in state set "main" ******/ /* Delay function for state "request_received" in state set "main" */ static void D_main_request_received(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "request_received" in state set "main" */ static seqBool E_main_request_received(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 577 "../klysSbstTctl.stt" if (seq_pvConnectCount(ssId) == seq_pvAssignCount(ssId)) { *pNextState = 4; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "request_received" in state set "main" */ static void A_main_request_received(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 578 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 579 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Enter request_received"); # line 580 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 584 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 585 "../klysSbstTctl.stt" sprintf(pVar->debug_msg, "Assigning variables"); # line 586 "../klysSbstTctl.stt" seq_pvPut(ssId, 15/*debug_msg*/, SYNC); } # line 588 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TCTL", pVar->name, pVar->beamcode); # line 589 "../klysSbstTctl.stt" seq_pvAssign(ssId, 7/*tctl*/, pVar->pvname); # line 590 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TSTAT", pVar->name, pVar->beamcode); # line 591 "../klysSbstTctl.stt" seq_pvAssign(ssId, 8/*tsta*/, pVar->pvname); # line 592 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TCTL", pVar->trigname, pVar->beamcode); # line 593 "../klysSbstTctl.stt" seq_pvAssign(ssId, 3/*trigtctl*/, pVar->pvname); # line 594 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TCTL.DISA", pVar->trigname, pVar->beamcode); # line 595 "../klysSbstTctl.stt" seq_pvAssign(ssId, 4/*trigtctldisa*/, pVar->pvname); # line 596 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TCTL.PROC", pVar->trigname, pVar->beamcode); # line 597 "../klysSbstTctl.stt" seq_pvAssign(ssId, 6/*trigtctlproc*/, pVar->pvname); # line 598 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TSTAT", pVar->trigname, pVar->beamcode); # line 599 "../klysSbstTctl.stt" seq_pvAssign(ssId, 5/*trigtsta*/, pVar->pvname); # line 600 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_MSG", pVar->name, pVar->beamcode); # line 601 "../klysSbstTctl.stt" seq_pvAssign(ssId, 17/*msg*/, pVar->pvname); # line 602 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_MSGVBS", pVar->name, pVar->beamcode); # line 603 "../klysSbstTctl.stt" seq_pvAssign(ssId, 18/*msgvbs*/, pVar->pvname); # line 604 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_SNLMSG", pVar->name, pVar->beamcode); # line 605 "../klysSbstTctl.stt" seq_pvAssign(ssId, 14/*debug_msg_bc*/, pVar->pvname); # line 608 "../klysSbstTctl.stt" if (strstr(pVar->name, "KLYS")) { # line 609 "../klysSbstTctl.stt" seq_pvGet(ssId, 24/*sectsbst*/, 0); # line 610 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_STAT", pVar->name, pVar->beamcode); # line 611 "../klysSbstTctl.stt" seq_pvAssign(ssId, 9/*stat*/, pVar->pvname); # line 614 "../klysSbstTctl.stt" if (strcmp(pVar->sectsbst, "YES") == 0) { # line 615 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 616 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Klys uses shared sbst"); # line 617 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 619 "../klysSbstTctl.stt" seq_pvGet(ssId, 27/*sbsttrigname*/, 0); # line 620 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TCTL", pVar->sbsttrigname, pVar->beamcode); # line 621 "../klysSbstTctl.stt" seq_pvAssign(ssId, 28/*sbsttrigtctl*/, pVar->pvname); # line 622 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TCTL.DISA", pVar->sbsttrigname, pVar->beamcode); # line 623 "../klysSbstTctl.stt" seq_pvAssign(ssId, 29/*sbsttrigtctldisa*/, pVar->pvname); # line 624 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TCTL.PROC", pVar->sbsttrigname, pVar->beamcode); # line 625 "../klysSbstTctl.stt" seq_pvAssign(ssId, 30/*sbsttrigtctlproc*/, pVar->pvname); # line 626 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TSTAT", pVar->sbsttrigname, pVar->beamcode); # line 627 "../klysSbstTctl.stt" seq_pvAssign(ssId, 31/*sbsttrigtsta*/, pVar->pvname); # line 628 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_MSG", pVar->sbstname, pVar->beamcode); # line 629 "../klysSbstTctl.stt" seq_pvAssign(ssId, 32/*sbstmsg*/, pVar->pvname); # line 630 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_MSGVBS", pVar->sbstname, pVar->beamcode); # line 631 "../klysSbstTctl.stt" seq_pvAssign(ssId, 33/*sbstmsgvbs*/, pVar->pvname); # line 632 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_SNLMSG", pVar->sbstname, pVar->beamcode); # line 633 "../klysSbstTctl.stt" seq_pvAssign(ssId, 34/*sbstdebug_msg*/, pVar->pvname); # line 634 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:SNLMSG_CTL", pVar->sbstname); # line 635 "../klysSbstTctl.stt" seq_pvAssign(ssId, 35/*sbstdebug_msg_on*/, pVar->pvname); } } # line 638 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 639 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Exit request_received"); # line 640 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } return; } } /****** Code for state "process_request" in state set "main" ******/ /* Delay function for state "process_request" in state set "main" */ static void D_main_process_request(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "process_request" in state set "main" */ static seqBool E_main_process_request(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 647 "../klysSbstTctl.stt" if (seq_pvConnectCount(ssId) == seq_pvAssignCount(ssId)) { *pNextState = 5; *pTransNum = 0; return TRUE; } return FALSE; } /* Action function for state "process_request" in state set "main" */ static void A_main_process_request(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 649 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 650 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Enter process_request"); # line 651 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 654 "../klysSbstTctl.stt" seq_pvGet(ssId, 7/*tctl*/, 0); # line 655 "../klysSbstTctl.stt" seq_pvGet(ssId, 8/*tsta*/, 0); # line 657 "../klysSbstTctl.stt" if (strcmp(pVar->tctl, "Activate") == 0) # line 657 "../klysSbstTctl.stt" pVar->request = ACT; else # line 658 "../klysSbstTctl.stt" if (strcmp(pVar->tctl, "Reactivate") == 0) # line 658 "../klysSbstTctl.stt" pVar->request = REACT; else # line 659 "../klysSbstTctl.stt" pVar->request = DEACT; # line 661 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 662 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Request %s BC %s", pVar->tctl, pVar->beamcode); # line 663 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 666 "../klysSbstTctl.stt" pVar->msg = MSG_NEW_REQUEST; # line 667 "../klysSbstTctl.stt" seq_pvPut(ssId, 17/*msg*/, SYNC); # line 668 "../klysSbstTctl.stt" sprintf(pVar->msgvbs, "New %s request...", pVar->tctl); # line 669 "../klysSbstTctl.stt" seq_pvPut(ssId, 18/*msgvbs*/, SYNC); # line 672 "../klysSbstTctl.stt" if (pVar->request == DEACT) { # line 674 "../klysSbstTctl.stt" seq_efSet(ssId, 6/*ef_deact_go*/); # line 675 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 676 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Ready to deact on bc %s", pVar->beamcode); # line 677 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } else { # line 683 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 684 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "User requested (re)activate"); # line 685 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 689 "../klysSbstTctl.stt" if (strstr(pVar->name, "KLYS")) { # line 692 "../klysSbstTctl.stt" seq_pvGet(ssId, 23/*hsta*/, 0); # line 693 "../klysSbstTctl.stt" seq_pvGet(ssId, 25/*tmsk*/, 0); # line 694 "../klysSbstTctl.stt" seq_pvGet(ssId, 26/*tmsk_bc*/, 0); # line 695 "../klysSbstTctl.stt" pVar->tmsk_stat = klysTmskCheck(pVar->tmsk, pVar->tmsk_bc); # line 705 "../klysSbstTctl.stt" if (pVar->tmsk_stat != TMSK_OK) { # line 707 "../klysSbstTctl.stt" pVar->msg = MSG_TMSK; # line 708 "../klysSbstTctl.stt" seq_pvPut(ssId, 17/*msg*/, SYNC); # line 709 "../klysSbstTctl.stt" sprintf(pVar->msg_str, "TMSK conflict"); # line 710 "../klysSbstTctl.stt" sprintf(pVar->msgvbs, "%s failed: %s", pVar->tctl, pVar->msg_str); # line 711 "../klysSbstTctl.stt" seq_pvPut(ssId, 18/*msgvbs*/, SYNC); # line 712 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "(Re)act on bc %s failed: %s", pVar->beamcode, pVar->msg_str); # line 713 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 714 "../klysSbstTctl.stt" sprintf(pVar->tctl, "Deactivate"); # line 715 "../klysSbstTctl.stt" seq_pvPut(ssId, 7/*tctl*/, 0); # line 716 "../klysSbstTctl.stt" seq_efSet(ssId, 6/*ef_deact_go*/); # line 718 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 719 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "TMSK conflict"); # line 720 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } else # line 724 "../klysSbstTctl.stt" if (!(pVar->hsta & HSTA_GOOD)) { # line 726 "../klysSbstTctl.stt" pVar->msg = MSG_BAD_HSTA; # line 727 "../klysSbstTctl.stt" seq_pvPut(ssId, 17/*msg*/, SYNC); # line 728 "../klysSbstTctl.stt" sprintf(pVar->msg_str, "Bad HSTA"); # line 729 "../klysSbstTctl.stt" sprintf(pVar->msgvbs, "%s failed: %s", pVar->tctl, pVar->msg_str); # line 730 "../klysSbstTctl.stt" seq_pvPut(ssId, 18/*msgvbs*/, SYNC); # line 731 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "(Re)act on bc %s failed: %s", pVar->beamcode, pVar->msg_str); # line 732 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 733 "../klysSbstTctl.stt" sprintf(pVar->tctl, "Deactivate"); # line 734 "../klysSbstTctl.stt" seq_pvPut(ssId, 7/*tctl*/, 0); # line 736 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 737 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Bad HSTA"); # line 738 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 740 "../klysSbstTctl.stt" seq_efSet(ssId, 6/*ef_deact_go*/); } else { # line 746 "../klysSbstTctl.stt" pVar->act_check = 0; # line 749 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 750 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "No TMSK or HSTA problem"); # line 751 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 755 "../klysSbstTctl.stt" if (strcmp(pVar->sectsbst, "YES") == 0) { # line 757 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 758 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Uses sector sbst"); # line 759 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 762 "../klysSbstTctl.stt" seq_pvGet(ssId, 31/*sbsttrigtsta*/, 0); # line 765 "../klysSbstTctl.stt" if (strcmp(pVar->sbsttrigtsta, "Activated") != 0) { # line 768 "../klysSbstTctl.stt" sprintf(pVar->sbsttrigtctl, "Reactivate"); # line 769 "../klysSbstTctl.stt" seq_pvPut(ssId, 28/*sbsttrigtctl*/, 0); # line 770 "../klysSbstTctl.stt" pVar->sbsttrigtctlproc = 1; # line 771 "../klysSbstTctl.stt" seq_pvPut(ssId, 30/*sbsttrigtctlproc*/, 0); t = time( NULL ); # line 773 "../klysSbstTctl.stt" tnow = t; # line 774 "../klysSbstTctl.stt" seq_pvGet(ssId, 31/*sbsttrigtsta*/, 0); # line 777 "../klysSbstTctl.stt" while (((tnow - t) < TIMEOUT) && (strcmp(pVar->sbsttrigtsta, "Activated") != 0)) { # line 778 "../klysSbstTctl.stt" seq_pvGet(ssId, 31/*sbsttrigtsta*/, 0); tnow = time( NULL ); # line 780 "../klysSbstTctl.stt" epicsThreadSleep(0.01); } # line 783 "../klysSbstTctl.stt" if (strcmp(pVar->sbsttrigtsta, "Activated") != 0) { # line 785 "../klysSbstTctl.stt" pVar->msg = MSG_SBST_NOT_ACT; # line 786 "../klysSbstTctl.stt" seq_pvPut(ssId, 17/*msg*/, SYNC); # line 787 "../klysSbstTctl.stt" sprintf(pVar->msg_str, "Sbst not act"); # line 788 "../klysSbstTctl.stt" sprintf(pVar->msgvbs, "%s failed: %s", pVar->tctl, pVar->msg_str); # line 789 "../klysSbstTctl.stt" seq_pvPut(ssId, 18/*msgvbs*/, SYNC); # line 790 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "(Re)act on bc %s failed: %s", pVar->beamcode, pVar->msg_str); # line 791 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 792 "../klysSbstTctl.stt" sprintf(pVar->tctl, "Deactivate"); # line 793 "../klysSbstTctl.stt" seq_pvPut(ssId, 7/*tctl*/, 0); # line 794 "../klysSbstTctl.stt" seq_efSet(ssId, 6/*ef_deact_go*/); # line 795 "../klysSbstTctl.stt" pVar->act_check = -1; # line 796 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 797 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Sbst not active"); # line 798 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } else { # line 802 "../klysSbstTctl.stt" sprintf(pVar->sbstmsgvbs, "Reactivate successful"); # line 803 "../klysSbstTctl.stt" seq_pvPut(ssId, 33/*sbstmsgvbs*/, 0); # line 804 "../klysSbstTctl.stt" pVar->sbstmsg = MSG_ACT_COMP; # line 805 "../klysSbstTctl.stt" seq_pvPut(ssId, 32/*sbstmsg*/, 0); # line 807 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "(Re)act on bc %s complete", pVar->beamcode); # line 808 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->sbstname, pVar->log_msg); # line 809 "../klysSbstTctl.stt" seq_pvGet(ssId, 35/*sbstdebug_msg_on*/, 0); # line 810 "../klysSbstTctl.stt" if (pVar->sbstdebug_msg_on) { # line 811 "../klysSbstTctl.stt" sprintf(pVar->sbstdebug_msg, "(Re)act on bc %s complete", pVar->beamcode); # line 812 "../klysSbstTctl.stt" seq_pvPut(ssId, 34/*sbstdebug_msg*/, 0); } } } } } } else # line 820 "../klysSbstTctl.stt" pVar->act_check = 0; # line 823 "../klysSbstTctl.stt" if (pVar->act_check == 0) { # line 824 "../klysSbstTctl.stt" seq_efSet(ssId, 5/*ef_act_go*/); # line 825 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 826 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Ready to (re)act on bc %s", pVar->beamcode); # line 827 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } } } return; } } /****** Code for state "perform_act_deact" in state set "main" ******/ /* Delay function for state "perform_act_deact" in state set "main" */ static void D_main_perform_act_deact(SS_ID ssId, struct UserVar *pVar) { } /* Event function for state "perform_act_deact" in state set "main" */ static seqBool E_main_perform_act_deact(SS_ID ssId, struct UserVar *pVar, int *pTransNum, int *pNextState) { # line 836 "../klysSbstTctl.stt" if (seq_efTestAndClear(ssId, 6/*ef_deact_go*/)) { *pNextState = 2; *pTransNum = 0; return TRUE; } # line 1001 "../klysSbstTctl.stt" if (seq_efTestAndClear(ssId, 5/*ef_act_go*/)) { *pNextState = 2; *pTransNum = 1; return TRUE; } # line 1046 "../klysSbstTctl.stt" if (seq_efTestAndClear(ssId, 7/*ef_reset_request*/)) { *pNextState = 2; *pTransNum = 2; return TRUE; } return FALSE; } /* Action function for state "perform_act_deact" in state set "main" */ static void A_main_perform_act_deact(SS_ID ssId, struct UserVar *pVar, int transNum, int *pNextState) { switch(transNum) { case 0: { # line 838 "../klysSbstTctl.stt" pVar->deact_check = 0; # line 840 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 841 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Entered deact section BC %s", pVar->beamcode); # line 842 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 846 "../klysSbstTctl.stt" if (strstr(pVar->name, "SBST")) { # line 848 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 849 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Sbst deact; begin loop klystrons"); # line 850 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } int i; # line 856 "../klysSbstTctl.stt" for (pVar->i = 1; pVar->i <= MAX_N_KLYS; pVar->i++) { # line 857 "../klysSbstTctl.stt" sprintf(pVar->i_s, "%hi", pVar->i); # line 858 "../klysSbstTctl.stt" sprintf(pVar->o_name, "KLYS:%s:%s1", pVar->loca, pVar->i_s); # line 859 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:TRIG_DEVNAME", pVar->o_name); # line 860 "../klysSbstTctl.stt" seq_pvAssign(ssId, 36/*o_trigname*/, pVar->pvname); t = time( NULL ); # line 862 "../klysSbstTctl.stt" tnow = t; # line 865 "../klysSbstTctl.stt" while (((tnow - t) < TIMEOUT) && !seq_pvConnected(ssId, 36/*o_trigname*/)) { /* C code definitions */ # line 866 "../klysSbstTctl.stt" tnow = time( NULL ); # line 867 "../klysSbstTctl.stt" epicsThreadSleep(0.01); } # line 871 "../klysSbstTctl.stt" if ((tnow - t) >= TIMEOUT) { # line 872 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "%s PV no connect", pVar->pvname); # line 873 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 874 "../klysSbstTctl.stt" seq_pvAssign(ssId, 36/*o_trigname*/, ""); # line 876 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 877 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "K%s BC%s doesn't exist", pVar->i_s, pVar->beamcode); # line 878 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } else { # line 884 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:SECTSBST", pVar->o_name); # line 885 "../klysSbstTctl.stt" seq_pvAssign(ssId, 38/*o_sectsbst*/, pVar->pvname); # line 886 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:HSTA", pVar->o_name); # line 887 "../klysSbstTctl.stt" seq_pvAssign(ssId, 39/*o_hsta*/, pVar->pvname); t = time( NULL ); # line 889 "../klysSbstTctl.stt" tnow = t; # line 892 "../klysSbstTctl.stt" while (((tnow - t) < TIMEOUT) && !(seq_pvConnected(ssId, 39/*o_hsta*/) && seq_pvConnected(ssId, 38/*o_sectsbst*/))) { /* C code definitions */ # line 893 "../klysSbstTctl.stt" tnow = time( NULL ); # line 894 "../klysSbstTctl.stt" epicsThreadSleep(0.01); } # line 900 "../klysSbstTctl.stt" if ((tnow - t) >= TIMEOUT) { # line 901 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "%s PV no connect", pVar->pvname); # line 902 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 903 "../klysSbstTctl.stt" seq_pvAssign(ssId, 39/*o_hsta*/, ""); # line 904 "../klysSbstTctl.stt" seq_pvAssign(ssId, 38/*o_sectsbst*/, ""); # line 906 "../klysSbstTctl.stt" pVar->deact_check = -1; # line 908 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 909 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Don't deact; K%s BC%s HSTA/SECT", pVar->i_s, pVar->beamcode); # line 910 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } else { # line 916 "../klysSbstTctl.stt" seq_pvGet(ssId, 38/*o_sectsbst*/, 0); # line 917 "../klysSbstTctl.stt" seq_pvGet(ssId, 39/*o_hsta*/, 0); # line 918 "../klysSbstTctl.stt" seq_pvGet(ssId, 36/*o_trigname*/, 0); # line 921 "../klysSbstTctl.stt" if ((strcmp(pVar->o_sectsbst, "YES") == 0) && !(pVar->hsta & HSTA_DEAD)) { # line 922 "../klysSbstTctl.stt" sprintf(pVar->pvname, "%s:BEAMCODE%s_TSTAT", pVar->o_trigname, pVar->beamcode); # line 923 "../klysSbstTctl.stt" seq_pvAssign(ssId, 37/*o_trigtsta*/, pVar->pvname); t = time( NULL ); # line 925 "../klysSbstTctl.stt" tnow = t; # line 928 "../klysSbstTctl.stt" while (((tnow - t) < TIMEOUT) && !seq_pvConnected(ssId, 37/*o_trigtsta*/)) { /* C code definitions */ # line 929 "../klysSbstTctl.stt" tnow = time( NULL ); # line 930 "../klysSbstTctl.stt" epicsThreadSleep(0.01); } # line 933 "../klysSbstTctl.stt" if ((tnow - t) >= TIMEOUT) { # line 934 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "%s PV no connect", pVar->pvname); # line 935 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 936 "../klysSbstTctl.stt" seq_pvAssign(ssId, 37/*o_trigtsta*/, ""); # line 937 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 938 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "K%s BC%s doesn't exist; TSTAT", pVar->i_s, pVar->beamcode); # line 939 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } else { # line 945 "../klysSbstTctl.stt" seq_pvGet(ssId, 37/*o_trigtsta*/, 0); # line 948 "../klysSbstTctl.stt" if (strcmp(pVar->o_trigtsta, "Deactivated") != 0) { # line 950 "../klysSbstTctl.stt" pVar->deact_check = -1; # line 951 "../klysSbstTctl.stt" pVar->msg = MSG_KLYS_ACT; # line 952 "../klysSbstTctl.stt" seq_pvPut(ssId, 17/*msg*/, SYNC); # line 953 "../klysSbstTctl.stt" sprintf(pVar->msg_str, "Active klys in sector"); # line 954 "../klysSbstTctl.stt" sprintf(pVar->msgvbs, "%s failed: %s", pVar->tctl, pVar->msg_str); # line 955 "../klysSbstTctl.stt" seq_pvPut(ssId, 18/*msgvbs*/, SYNC); # line 956 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "Deact on bc %s failed: %s", pVar->beamcode, pVar->msg_str); # line 957 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 958 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 959 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "BC %s: Active klystron in sector", pVar->beamcode); # line 960 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } break; } } } } } } } # line 975 "../klysSbstTctl.stt" if (pVar->deact_check == 0) { # line 976 "../klysSbstTctl.stt" sprintf(pVar->trigtctl, "Deactivate"); # line 977 "../klysSbstTctl.stt" seq_pvPut(ssId, 3/*trigtctl*/, SYNC); # line 978 "../klysSbstTctl.stt" pVar->trigtctlproc = 1; # line 979 "../klysSbstTctl.stt" seq_pvPut(ssId, 6/*trigtctlproc*/, SYNC); # line 986 "../klysSbstTctl.stt" if (pVar->request == DEACT) { # line 987 "../klysSbstTctl.stt" pVar->msg = MSG_DEACT_COMP; # line 988 "../klysSbstTctl.stt" seq_pvPut(ssId, 17/*msg*/, SYNC); # line 989 "../klysSbstTctl.stt" sprintf(pVar->msgvbs, "Deactivate successful"); # line 990 "../klysSbstTctl.stt" seq_pvPut(ssId, 18/*msgvbs*/, SYNC); } # line 992 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "Deact on bc %s complete", pVar->beamcode); # line 993 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 994 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 995 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Deact on bc %s complete", pVar->beamcode); # line 996 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } } return; case 1: { # line 1003 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 1004 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Entered (re)act section"); # line 1005 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } # line 1011 "../klysSbstTctl.stt" if (pVar->request == REACT) # line 1011 "../klysSbstTctl.stt" sprintf(pVar->trigtctl, "Reactivate"); else # line 1012 "../klysSbstTctl.stt" sprintf(pVar->trigtctl, "Activate"); # line 1013 "../klysSbstTctl.stt" seq_pvPut(ssId, 3/*trigtctl*/, SYNC); # line 1014 "../klysSbstTctl.stt" pVar->trigtctlproc = 1; # line 1015 "../klysSbstTctl.stt" seq_pvPut(ssId, 6/*trigtctlproc*/, SYNC); # line 1022 "../klysSbstTctl.stt" if (pVar->request == ACT) { # line 1023 "../klysSbstTctl.stt" sprintf(pVar->tctl, "Reactivate"); # line 1024 "../klysSbstTctl.stt" seq_pvPut(ssId, 7/*tctl*/, 0); # line 1025 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 1/*ef_request_bc1*/); # line 1026 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 2/*ef_request_bc2*/); # line 1027 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 3/*ef_request_bc3*/); # line 1028 "../klysSbstTctl.stt" seq_efTestAndClear(ssId, 4/*ef_request_bc4*/); } # line 1031 "../klysSbstTctl.stt" sprintf(pVar->msgvbs, "Reactivate successful"); # line 1032 "../klysSbstTctl.stt" seq_pvPut(ssId, 18/*msgvbs*/, SYNC); # line 1033 "../klysSbstTctl.stt" pVar->msg = MSG_ACT_COMP; # line 1034 "../klysSbstTctl.stt" seq_pvPut(ssId, 17/*msg*/, SYNC); # line 1036 "../klysSbstTctl.stt" sprintf(pVar->log_msg, "(Re)act on bc %s complete", pVar->beamcode); # line 1037 "../klysSbstTctl.stt" errlogPrintfNoConsole("%s: %s\n", pVar->name, pVar->log_msg); # line 1038 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 1039 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "(Re)act on bc %s complete", pVar->beamcode); # line 1040 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } return; case 2: { # line 1048 "../klysSbstTctl.stt" if (pVar->debug_msg_on) { # line 1049 "../klysSbstTctl.stt" sprintf(pVar->debug_msg_bc, "Enter reset request section"); # line 1050 "../klysSbstTctl.stt" seq_pvPut(ssId, 14/*debug_msg_bc*/, SYNC); } } return; } } /************************ Tables ************************/ /* Channel table */ static seqChan G_channels[] = { /* chName, offset, varName, varType, count, eventNum, efId, monitored, queueSize, queueIndex */ {"", offsetof(struct UserVar, pvname), "pvname", "string", 1, 8, 0, 0, 0, 0}, {"", offsetof(struct UserVar, name), "name", "string", 1, 9, 0, 0, 0, 0}, {"{PRIM}:{LOCA}:{UNIT}:TRIG_DEVNAME", offsetof(struct UserVar, trigname), "trigname", "string", 1, 10, 0, 0, 0, 0}, {"", offsetof(struct UserVar, trigtctl), "trigtctl", "string", 1, 11, 0, 0, 0, 0}, {"", offsetof(struct UserVar, trigtctldisa), "trigtctldisa", "short", 1, 12, 0, 0, 0, 0}, {"", offsetof(struct UserVar, trigtsta), "trigtsta", "string", 1, 13, 0, 0, 0, 0}, {"", offsetof(struct UserVar, trigtctlproc), "trigtctlproc", "short", 1, 14, 0, 0, 0, 0}, {"", offsetof(struct UserVar, tctl), "tctl", "string", 1, 15, 0, 0, 0, 0}, {"", offsetof(struct UserVar, tsta), "tsta", "string", 1, 16, 0, 0, 0, 0}, #if LONG_MAX > 0x7fffffffL # line 189 "../klysSbstTctl.stt" #error variable 'unsigned long stat' cannot be assigned to a PV (on the chosen target system)\ because Channel Access does not support integral types longer than 4 bytes.\ You can use 'unsigned int' instead, or the fixed size type 'uint32_t'. #endif {"", offsetof(struct UserVar, stat), "stat", "unsigned long", 1, 17, 0, 0, 0, 0}, {"{PRIM}:{LOCA}:{UNIT}:BEAMCODE1_TCTLGO", offsetof(struct UserVar, request_bc1), "request_bc1", "string", 1, 18, 1, 1, 0, 0}, {"{PRIM}:{LOCA}:{UNIT}:BEAMCODE2_TCTLGO", offsetof(struct UserVar, request_bc2), "request_bc2", "string", 1, 19, 2, 1, 0, 0}, {"{PRIM}:{LOCA}:{UNIT}:BEAMCODE3_TCTLGO", offsetof(struct UserVar, request_bc3), "request_bc3", "string", 1, 20, 3, 1, 0, 0}, {"{PRIM}:{LOCA}:{UNIT}:BEAMCODE4_TCTLGO", offsetof(struct UserVar, request_bc4), "request_bc4", "string", 1, 21, 4, 1, 0, 0}, {"", offsetof(struct UserVar, debug_msg_bc), "debug_msg_bc", "string", 1, 22, 0, 0, 0, 0}, {"{PRIM}:{LOCA}:{UNIT}:SNLMSG", offsetof(struct UserVar, debug_msg), "debug_msg", "string", 1, 23, 0, 0, 0, 0}, {"{PRIM}:{LOCA}:{UNIT}:SNLMSG_CTL", offsetof(struct UserVar, debug_msg_on), "debug_msg_on", "short", 1, 24, 0, 1, 0, 0}, {"", offsetof(struct UserVar, msg), "msg", "short", 1, 25, 0, 0, 0, 0}, {"", offsetof(struct UserVar, msgvbs), "msgvbs", "string", 1, 26, 0, 0, 0, 0}, {"", offsetof(struct UserVar, msg_str), "msg_str", "string", 1, 27, 0, 0, 0, 0}, {"", offsetof(struct UserVar, log_msg), "log_msg", "string", 1, 28, 0, 0, 0, 0}, {"", offsetof(struct UserVar, request), "request", "short", 1, 29, 0, 0, 0, 0}, {"", offsetof(struct UserVar, beamcode), "beamcode", "string", 1, 30, 0, 0, 0, 0}, #if LONG_MAX > 0x7fffffffL # line 259 "../klysSbstTctl.stt" #error variable 'unsigned long hsta' cannot be assigned to a PV (on the chosen target system)\ because Channel Access does not support integral types longer than 4 bytes.\ You can use 'unsigned int' instead, or the fixed size type 'uint32_t'. #endif {"{PRIM}:{LOCA}:{UNIT}:HSTA", offsetof(struct UserVar, hsta), "hsta", "unsigned long", 1, 31, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sectsbst), "sectsbst", "string", 1, 32, 0, 0, 0, 0}, #if LONG_MAX > 0x7fffffffL # line 267 "../klysSbstTctl.stt" #error variable 'unsigned long tmsk[2]' cannot be assigned to a PV (on the chosen target system)\ because Channel Access does not support integral types longer than 4 bytes.\ You can use 'unsigned int' instead, or the fixed size type 'uint32_t'. #endif {"{PRIM}:{LOCA}:{UNIT}:TMSK", offsetof(struct UserVar, tmsk), "tmsk", "unsigned long", 2, 33, 0, 0, 0, 0}, #if LONG_MAX > 0x7fffffffL # line 271 "../klysSbstTctl.stt" #error variable 'unsigned long tmsk_bc[2]' cannot be assigned to a PV (on the chosen target system)\ because Channel Access does not support integral types longer than 4 bytes.\ You can use 'unsigned int' instead, or the fixed size type 'uint32_t'. #endif {"", offsetof(struct UserVar, tmsk_bc), "tmsk_bc", "unsigned long", 2, 34, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbsttrigname), "sbsttrigname", "string", 1, 35, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbsttrigtctl), "sbsttrigtctl", "string", 1, 36, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbsttrigtctldisa), "sbsttrigtctldisa", "short", 1, 37, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbsttrigtctlproc), "sbsttrigtctlproc", "short", 1, 38, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbsttrigtsta), "sbsttrigtsta", "string", 1, 39, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbstmsg), "sbstmsg", "short", 1, 40, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbstmsgvbs), "sbstmsgvbs", "string", 1, 41, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbstdebug_msg), "sbstdebug_msg", "string", 1, 42, 0, 0, 0, 0}, {"", offsetof(struct UserVar, sbstdebug_msg_on), "sbstdebug_msg_on", "short", 1, 43, 0, 0, 0, 0}, {"", offsetof(struct UserVar, o_trigname), "o_trigname", "string", 1, 44, 0, 0, 0, 0}, {"", offsetof(struct UserVar, o_trigtsta), "o_trigtsta", "string", 1, 45, 0, 0, 0, 0}, {"", offsetof(struct UserVar, o_sectsbst), "o_sectsbst", "string", 1, 46, 0, 0, 0, 0}, #if LONG_MAX > 0x7fffffffL # line 319 "../klysSbstTctl.stt" #error variable 'unsigned long o_hsta' cannot be assigned to a PV (on the chosen target system)\ because Channel Access does not support integral types longer than 4 bytes.\ You can use 'unsigned int' instead, or the fixed size type 'uint32_t'. #endif {"", offsetof(struct UserVar, o_hsta), "o_hsta", "unsigned long", 1, 47, 0, 0, 0, 0} }; /* Event masks for state set "main" */ static const seqMask EM_main_init[] = { 0x00000000, 0x00000000, }; static const seqMask EM_main_init_klys_sbst[] = { 0x00000000, 0x00000000, }; static const seqMask EM_main_ready_for_request[] = { 0x0000001e, 0x00000000, }; static const seqMask EM_main_request_received[] = { 0x00000000, 0x00000000, }; static const seqMask EM_main_process_request[] = { 0x00000000, 0x00000000, }; static const seqMask EM_main_perform_act_deact[] = { 0x000000e0, 0x00000000, }; /* State table for state set "main" */ static seqState G_main_states[] = { { /* state name */ "init", /* action function */ A_main_init, /* event function */ E_main_init, /* delay function */ D_main_init, /* entry function */ I_main_init, /* exit function */ 0, /* event mask array */ EM_main_init, /* state options */ (0) }, { /* state name */ "init_klys_sbst", /* action function */ A_main_init_klys_sbst, /* event function */ E_main_init_klys_sbst, /* delay function */ D_main_init_klys_sbst, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_main_init_klys_sbst, /* state options */ (0) }, { /* state name */ "ready_for_request", /* action function */ A_main_ready_for_request, /* event function */ E_main_ready_for_request, /* delay function */ D_main_ready_for_request, /* entry function */ I_main_ready_for_request, /* exit function */ 0, /* event mask array */ EM_main_ready_for_request, /* state options */ (0) }, { /* state name */ "request_received", /* action function */ A_main_request_received, /* event function */ E_main_request_received, /* delay function */ D_main_request_received, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_main_request_received, /* state options */ (0) }, { /* state name */ "process_request", /* action function */ A_main_process_request, /* event function */ E_main_process_request, /* delay function */ D_main_process_request, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_main_process_request, /* state options */ (0) }, { /* state name */ "perform_act_deact", /* action function */ A_main_perform_act_deact, /* event function */ E_main_perform_act_deact, /* delay function */ D_main_perform_act_deact, /* entry function */ 0, /* exit function */ 0, /* event mask array */ EM_main_perform_act_deact, /* state options */ (0) }, }; /* State set table */ static seqSS G_state_sets[] = { { /* state set name */ "main", /* states */ G_main_states, /* number of states */ 6, /* number of delays */ 1 }, }; /* Program table (global) */ seqProgram klysSbstTctl = { /* magic number */ 2001006, /* program name */ "klysSbstTctl", /* channels */ G_channels, /* num. channels */ 40, /* state sets */ G_state_sets, /* num. state sets */ 1, /* user var size */ sizeof(struct UserVar), /* param */ "", /* num. event flags */ 7, /* encoded options */ (0 | OPT_CONN | 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 klysSbstTctlRegistrar (void) { seqRegisterSequencerCommands(); seqRegisterSequencerProgram (&klysSbstTctl); } epicsExportRegistrar(klysSbstTctlRegistrar);