9 #include <longinRecord.h>
10 #include <waveformRecord.h>
11 #include <menuFtype.h>
13 #include <epicsExport.h>
18 static const double pi_180 = 0.017453292519943295;
22 long init_spin(waveformRecord *prec)
24 if(prec->ftvl==menuFtypeDOUBLE)
29 long process_spin(waveformRecord *prec)
31 if(prec->dpvt != &dummy) {
32 (void)recGblSetSevr(prec, COMM_ALARM, INVALID_ALARM);
36 const double freq = 360.0*pi_180/100;
38 double *val =
static_cast<double*
>(prec->bptr);
40 long ret = dbGetLink(&prec->inp, DBF_DOUBLE, &phase, 0, 0);
42 (void)recGblSetSevr(prec, LINK_ALARM, INVALID_ALARM);
48 for(
size_t i=0, N=prec->nelm; i<N; i++)
49 val[i] = sin(freq*i+phase);
51 prec->nord = prec->nelm;
54 prec->utag = (prec->utag+1u)&0x7fffffff;
60 long process_repeat(waveformRecord *prec)
63 if(prec->ftvl!=menuFtypeULONG) {
64 recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
65 return S_db_badDbrtype;
69 if(!!(ret = dbGetLink(&prec->inp, DBF_ULONG, &iv, NULL, NULL))) {
70 recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
74 epicsUInt32 *val = (epicsUInt32*)prec->bptr;
75 for(
size_t i=0, N=prec->nelm; i<N; i++) {
84 long process_utag(longinRecord *prec)
86 long status = dbGetLink(&prec->inp, DBR_LONG, &prec->val, 0, 0);
88 prec->utag = prec->val;
90 (void)recGblSetSevr(prec, COMM_ALARM, INVALID_ALARM);
95 template<
typename REC>
101 long (*init_record)(REC *);
102 long (*get_ioint_info)(int, REC *, IOSCANPVT*);
103 long (*process)(REC *);
106 dset5<waveformRecord> devWfPDBDemo = {5,0,0,&init_spin,0,&process_spin};
107 dset5<waveformRecord> devWfPDBDemoRepeat = {5,0,0,0,0,&process_repeat};
108 dset5<longinRecord> devLoPDBUTag = {5,0,0,0,0,&process_utag};
113 epicsExportAddress(dset, devWfPDBDemo);
114 epicsExportAddress(dset, devWfPDBDemoRepeat);
115 epicsExportAddress(dset, devLoPDBUTag);