/* $Id: devBoOnln.c,v 1.4 2007/04/27 05:56:07 strauman Exp $ */ /*============================================================================= Name: devBoOnln.c Abs: Onln Device support for Bo. Auth: 10-oct-2006, Till Straumann (TSS) Rev: -----------------------------------------------------------------------------*/ #if 0 #include "copyright_SLAC.h" /* SLAC copyright comments */ #endif /*----------------------------------------------------------------------------- Mod: (see CVS log) =============================================================================*/ #include #include #include #include #include #include #include #include #include #include #include #define DEVSUPNAM "devBoOnln" static long report(int interest) { epicsPrintf(DEVSUPNAM": Onln device support for bo\n"); epicsPrintf(" (switch data stream from PAD on/off)\n"); return 0; } static long init_record(void *record_p) { boRecord *bo_ps = record_p; unsigned c; if ( VME_IO != bo_ps->out.type ) { epicsPrintf(DEVSUPNAM": Invalid link type; must be VMEIO\n"); bo_ps->pact = 1; return -1; } c = bo_ps->out.value.vmeio.card; if ( c >= MAX_BPM ) { epicsPrintf(DEVSUPNAM": Invalid card/PAD #%u; must < %i\n", c, MAX_BPM); bo_ps->pact = 1; return -1; } return 0; } static long write_bo(void *record_p) { boRecord *bo_ps = record_p; unsigned c = bo_ps->out.value.vmeio.card; long rval; #ifdef DEBUG epicsPrintf("%s: BO WRITE %i\n", bo_ps->name, bo_ps->val); #endif if ( bo_ps->rval ) { if ( (rval = drvPadUdpCommStrmStartReq( c )) ) { #ifdef DEBUG epicsPrintf("Starting"); #endif } } else { if ( (rval = drvPadUdpCommStrmStopReq( c )) ) { #ifdef DEBUG epicsPrintf("Stopping"); #endif } } if ( rval ) { epicsPrintf(" PAD stream (#%i) failed: %s\n", c, strerror(-rval)); recGblSetSevr((dbCommon*)record_p, WRITE_ALARM, MAJOR_ALARM); /* stream command will still be re-send; don't restore * the old status for now. */ #if 0 bo_ps->rbv = bo_ps->orbv; bo_ps->rval = bo_ps->oraw; bo_ps->val = bo_ps->mlst; #endif } bo_ps->rbv = bo_ps->val; return rval; } struct { long number; DEVSUPFUN report; DEVSUPFUN init; DEVSUPFUN init_record; DEVSUPFUN get_ioint_info; DEVSUPFUN write; } devBoOnln = { 5, report, 0, init_record, 0, write_bo }; epicsExportAddress(dset, devBoOnln);