/* * Copyright Canadian Light Source, Inc. All rights reserved. * - see licence.txt and licence_CAEN.txt for limitations on use. */ /* * HVCAENx527chAio.c: * Analog input record and analog output record device support routines. */ #include "HVCAENx527.h" #include #include /* * devCAENx527chAi */ static long init_bd_record_ai( aiRecord *pior) { struct instio *pinstio; PARPROP *pp = NULL; if( pior->inp.type != INST_IO) { printf( "%s: ai INP field type should be INST_IO\n", pior->name); return( S_db_badField); } /* parse device dependent option string and set data pointer */ pinstio = &(pior->inp.value.instio); if( ( pp = CAENx527ParseDevArgs( pinstio->string)) == NULL) { printf( "%s: Invalid device parameters: \"%s\"\n", pior->name, pinstio->string); return(2); } if( pp->evntno > 0) sprintf( pior->evnt, "%d", pp->evntno ); pior->dpvt = pp; strcpy( pp->PVname, pior->name); // printf("%s::%s::%d:: pp = %x\n", __FILE__, __FUNCTION__, __LINE__, pp); if( pp->Unit) { (void)CAENx527GetParUnit( pp, pior->egu); } // printf("%s::%s::%d:: pp = %x pp->Unit = %d EGU = %s\n", __FILE__, __FUNCTION__, __LINE__, pp, pp->Unit, pior->egu); // pp->hvchan->epicsenabled = 1; PDEBUG(10) printf( "DEBUG: set %s EVNT: %s\n", pp->pname, pior->evnt); return( 0); } static long read_bd_ai( aiRecord *pior) { #if SCAN_SERVER == 0 void *pval; #endif // void *pval; PARPROP *pp = NULL; pp = (PARPROP *)pior->dpvt; // pval = CAENx527GetBdParVal(pp); // if( pval == NULL) // return( 3); // if( pp == NULL || pp->hvchan->epicsenabled == 0 || pp->hvchan->hvcrate->connected == 0) // return( 3); // Nerses: if pp->hvchan->hvcrate->connected == 0 then the READ_ALARM should be set like in the HVCAENx527chAio.c #if SCAN_SERVER == 0 pval = CAENx527GetBdParVal( pp); if( pval == NULL) return( 3); #endif pior->val = (double)(pp->pval.f); pior->udf = FALSE; PDEBUG(10) printf( "DEBUG: get %s = %lf\n", pp->pname, pior->val); return( 2); } struct { long number; DEVSUPFUN report; DEVSUPFUN init; DEVSUPFUN init_bd_record; DEVSUPFUN get_ioint_info; DEVSUPFUN read_bd_ai; DEVSUPFUN special_linconv; } devCAENx527BdAi = { 6, NULL, NULL, init_bd_record_ai, NULL, read_bd_ai, NULL }; #include epicsExportAddress(dset,devCAENx527BdAi);