/*============================================================ Filename: tmBcTmskSub.c Abs: This file contains Beamcode TMSK routines Device Support Routines: Functions --------------- tmBcTmsk Verify BC TMSK PV is correct Auth: 06-Dec-2010, Kristi Luchini (LUCHINI) Rev: dd-mmm-yyyy, Reviewer's Name (USERNAME --------------------------------------------------------------*/ #include "copyright_SLAC.h" /* SLAC copyright comments */ /*------------------------------------------------------------- Mod: (newest to oldest) dd-mmm-yyyy, First Lastname (USERNAME): comment ==============================================================*/ /* Header files */ #include "stdio.h" #include "stdlib.h" #include "string.h" #include #include "registryFunction.h" /* for epicsExport */ #include "epicsExport.h" /* for epicsRegisterFunctio */ #include "debugPrint.h" /* for DEBUGPRINT,EDEF_MAX */ #include "devLib.h" /* S_dev_noDevice */ #include "dbAccess.h" /* for DBADDR */ #include "dbDefs.h" /* min() and max() macros */ #include "recSup.h" /* for S_rec_outMem */ #include "recGbl.h" /* for recGblRecordError() */ #include "devSup.h" /* for S_dev_noDeviceFound */ #include "dbFldTypes.h" /* for DBF_USHORT */ #include "epicsTypes.h" /* epicsBoolean,MAX_STRING_SIZE */ #include "alarm.h" /* NO_ALARM, MAJOR_ALARM */ #include "aoRecord.h" /* for aoRecord */ #include "subRecord.h" /* for subRecord */ #include "genSubRecord.h" /* for genSubRecord */ #include "waveformRecord.h" /* for waveformRecord */ #include "longSubRecord.h" /* for struct longSubRecord */ #include "evrPattern.h" #include "tmSub.h" /* for tmGetInfo_ts,tmRuleDef */ /* Local prototypes */ static long tmBcTmskInit(genSubRecord *rec_ps); static long tmBcTmsk(genSubRecord *rec_ps); /*============================================================================= Name: tmBcTmskInit Abs: Inialize record that builds TMSK Args: Type Name Access Description ------------------- ----------- ---------- ---------------------------- genSubRecord * rec_ps read point to subroutine record Rem: Init subroutine for :BEAMCODE_TMSK_CHK Input: -------- A = Timing bit-mask first 4-byte longword (from database) B = Timing bit-mask second 4-byte longword (from database) C = Timing bit-mask first 4-byte longword (from TMSK PV) D = Timing bit-mask second 4-byte longword (from TMSK PV) Output: -------- DPVT = Pointer to private device information structure Side: None Ret: long OK - Successful ERROR - Failed initalization ==============================================================================*/ static long tmBcTmskInit(genSubRecord *rec_ps) { long status = ERROR; /* Check that this pv has not already been initialized */ if (rec_ps->dpvt) return(status); else { rec_ps->dpvt = 0; status = OK; } return(status); } /*============================================================================= Name: tmBcTmsk Abs: Build 2-element TMSK waveform from A and B Args: Type Name Access Description ------------------- ----------- ---------- ---------------------------- genSubRecord * sub_ps read point to subroutine record Rem: Subroutine for TRIG:::TMSK. Confirm that the TMSK PV matches the desired hard-coded database TMSK words. Else raise an alarm. Inputs: -------- A = Timing bit-mask first 4-byte longword (from database) B = Timing bit-mask second 4-byte longword (from database) Outputs: --------- VALA = Timing mask 2-element array Ret: Always successful ==============================================================================*/ static long tmBcTmsk(genSubRecord *rec_ps) { long status = OK; unsigned long *tmsk_a = NULL; tmsk_a = (unsigned long *)rec_ps->vala; tmsk_a[0] = *(unsigned long *)rec_ps->a; tmsk_a[1] = *(unsigned long *)rec_ps->b; return(status); } /*=============================================================================*/ epicsRegisterFunction(tmBcTmskInit); epicsRegisterFunction(tmBcTmsk); /* End of file */