/* $Id: devMbboOnln.c,v 1.1 2008/08/13 18:15:43 dayle Exp $ */ /*============================================================================= Name: devMbboOnln.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 "devMbboOnln" static long report(int interest) { epicsPrintf(DEVSUPNAM": Onln device support for mbbo\n"); epicsPrintf(" (switch data stream from PAD on/off)\n"); return 0; } static long init_record(void *record_p) { mbboRecord *mbbo_ps = record_p; unsigned c; if ( VME_IO != mbbo_ps->out.type ) { epicsPrintf(DEVSUPNAM": Invalid link type; must be VMEIO\n"); mbbo_ps->pact = 1; return -1; } c = mbbo_ps->out.value.vmeio.card; if ( c >= MAX_BPM ) { epicsPrintf(DEVSUPNAM": Invalid card/PAD #%u; must < %i\n", c, MAX_BPM); mbbo_ps->pact = 1; return -1; } return 0; } static long write_mbbo(void *record_p) { mbboRecord *mbbo_ps = record_p; unsigned c = mbbo_ps->out.value.vmeio.card; long rval; #ifdef DEBUG epicsPrintf("%s: MBBO WRITE %i\n", mbbo_ps->name, mbbo_ps->val); #endif if ( mbbo_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)); #if 0 /* don't set severity (won'd be cleared when the device eventually comes online. This is a work-around... */ recGblSetSevr((dbCommon*)record_p, WRITE_ALARM, MAJOR_ALARM); #endif /* stream command will still be re-send; don't restore * the old status for now. */ #if 0 mbbo_ps->rbv = mbbo_ps->orbv; mbbo_ps->rval = mbbo_ps->oraw; mbbo_ps->val = mbbo_ps->mlst; #endif } mbbo_ps->rbv = mbbo_ps->val; return rval; } struct { long number; DEVSUPFUN report; DEVSUPFUN init; DEVSUPFUN init_record; DEVSUPFUN get_ioint_info; DEVSUPFUN write; } devMbboOnln = { 5, report, 0, init_record, 0, write_mbbo }; epicsExportAddress(dset, devMbboOnln);