pva2pva  1.4.1
 All Classes Functions Variables Pages
imagedemo.c
1 
2 #include <stdlib.h>
3 
4 #include <epicsMath.h>
5 #include <dbAccess.h>
6 #include <dbScan.h>
7 #include <recGbl.h>
8 #include <alarm.h>
9 #include <registryFunction.h>
10 
11 #include <aSubRecord.h>
12 
13 #include <epicsExport.h>
14 
21 static
22 long QSRV_image_demo(aSubRecord *prec)
23 {
24  epicsUInt32 H = *(epicsUInt32*)prec->a,
25  W = *(epicsUInt32*)prec->b;
26  epicsUInt16 *I = (epicsUInt16*)prec->vala;
27  epicsUInt32 i, j;
28 
29  if(W*H>prec->nova) {
30  (void)recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
31  return 0;
32  }
33 
34  for(i=0; i<W; i++) {
35  for(j=0; j<H; j++) {
36  if(i%50==49 || j%50==49)
37  I[i*H+j] = 65535;
38  else
39  I[i*H+j] = ((epicsUInt32)j)*65535/H;
40  }
41  }
42 
43  prec->neva = W*H;
44  return 0;
45 }
46 
47 epicsRegisterFunction(QSRV_image_demo);