image demo

This commit is contained in:
Michael Davidsaver
2017-09-19 16:05:37 -05:00
parent 0e4ba7eceb
commit 1ea57ef799
8 changed files with 111 additions and 3 deletions

View File

@ -0,0 +1,5 @@
TOP = ../..
include $(TOP)/configure/CONFIG
ARCH = linux-x86_64-debug
TARGETS = envPaths
include $(TOP)/configure/RULES.ioc

View File

@ -0,0 +1,40 @@
record(longout, "$(N):ArraySize0_RBV") {
info(Q:group, {
"$(N):Array":{
"foo.dimension[0].size":{+channel:"VAL", +type:"existing"}
}
})
field(FLNK, "$(N):ArraySize1_RBV")
}
record(longout, "$(N):ArraySize1_RBV") {
info(Q:group, {
"$(N):Array":{
"foo.dimension[1].size":{+channel:"VAL", +type:"existing"}
}
})
field(FLNK, "$(N):ArrayData_")
}
record(aSub, "$(N):ArrayData_") {
field(SNAM, "QSRV_image_demo")
field(FTA, "ULONG")
field(FTB, "ULONG")
field(FTVA, "USHORT")
field(NOVA, "262144") # eg. 512x512
field(INPA, "$(N):ArraySize0_RBV NPP MSI")
field(INPB, "$(N):ArraySize1_RBV NPP MSI")
field(OUTA, "$(N):ArrayData PP MSI")
}
record(waveform, "$(N):ArrayData") {
field(FTVL, "UCHAR")
field(NELM, "256")
info(Q:group, {
"$(N):Array":{
"foo":{+type:"NTNDArray", +channel:"VAL", +trigger:"*"}
}
})
}

5
iocBoot/iocimagedemo/st.cmd Executable file
View File

@ -0,0 +1,5 @@
#!../../bin/linux-x86_64-debug/softIocPVA
dbLoadRecords("image.db","N=TST:image1")
iocInit()

View File

@ -38,7 +38,7 @@ record(calc, "$(N)Phase:Q") {
}
record(waveform, "$(N)I") {
field(DTYP, "PDB Demo")
field(DTYP, "QSRV Demo")
field( INP, "$(N)Phase:I")
field(FTVL, "DOUBLE")
field(NELM, "500")
@ -49,7 +49,7 @@ record(waveform, "$(N)I") {
}
record(waveform, "$(N)Q") {
field(DTYP, "PDB Demo")
field(DTYP, "QSRV Demo")
field( INP, "$(N)Phase:Q")
field(FTVL, "DOUBLE")
field(NELM, "500")

View File

@ -15,6 +15,7 @@ qsrv_SRCS += pdb.cpp
qsrv_SRCS += pdbsingle.cpp
#qsrv_SRCS += pvalink.cpp
qsrv_SRCS += demo.cpp
qsrv_SRCS += imagedemo.c
ifdef BASE_3_16
qsrv_SRCS += pdbgroup.cpp

View File

@ -26,6 +26,11 @@ long init_spin(waveformRecord *prec)
long process_spin(waveformRecord *prec)
{
if(prec->dpvt != &dummy) {
(void)recGblSetSevr(prec, COMM_ALARM, INVALID_ALARM);
return 0;
}
const double freq = 360.0*pi_180/100; // rad/sample
double phase = 0;
double *val = static_cast<double*>(prec->bptr);

50
pdbApp/imagedemo.c Normal file
View File

@ -0,0 +1,50 @@
#include <stdlib.h>
#include <epicsMath.h>
#include <dbAccess.h>
#include <dbScan.h>
#include <recGbl.h>
#include <alarm.h>
#include <registryFunction.h>
#include <aSubRecord.h>
#include <epicsExport.h>
/** Generate a test pattern
*
* A - width (ULONG)
* B - height (ULONG)
* VALA - pixel array (USHORT)
*/
static
long QSRV_image_demo(aSubRecord *prec)
{
epicsUInt32 W = *(epicsUInt32*)prec->a,
H = *(epicsUInt32*)prec->b;
epicsUInt16 *I = (epicsUInt16*)prec->vala;
epicsUInt32 i, j;
epicsUInt16 phase;
if(W*H>prec->nova) {
(void)recGblSetSevr(prec, READ_ALARM, INVALID_ALARM);
return 0;
}
for(i=0; i<W; i++) {
phase = 0;
for(j=0; j<H; j++) {
if(i%50==49 || j%50==49)
I[i*H+j] = 65535;
else
I[i*H+j] = phase;
phase += 65535/W;
}
}
prec->neva = W*H;
return 0;
}
epicsRegisterFunction(QSRV_image_demo);

View File

@ -3,4 +3,6 @@ registrar(QSRVRegistrar)
#link("pva", "lsetPVA")
# from demo.cpp
device(waveform, CONSTANT, devWfPDBDemo, "PDB Demo")
device(waveform, CONSTANT, devWfPDBDemo, "QSRV Demo")
# from imagedemo.c
function(QSRV_image_demo)