This is our new RELEASE-4_0 branch which was taken from ansto/93d9a7c Conflicts: .gitignore SICSmain.c asynnet.c confvirtualmot.c counter.c devexec.c drive.c event.h exebuf.c exeman.c histmem.c interface.h motor.c motorlist.c motorsec.c multicounter.c napi.c napi.h napi4.c network.c nwatch.c nxscript.c nxxml.c nxxml.h ofac.c reflist.c scan.c sicshipadaba.c sicsobj.c site_ansto/docs/Copyright.txt site_ansto/instrument/lyrebird/config/tasmad/sicscommon/nxsupport.tcl site_ansto/instrument/lyrebird/config/tasmad/taspub_sics/tasscript.tcl statusfile.c tasdrive.c tasub.c tasub.h tasublib.c tasublib.h
85 lines
3.1 KiB
C
85 lines
3.1 KiB
C
/*-------------------------------------------------------------------------
|
|
|
|
C O U N T E R
|
|
|
|
The SICS Interface to a single detector and his associated
|
|
monitors.
|
|
|
|
Mark Koennecke, January 1996
|
|
|
|
copyright: see implementation file.
|
|
|
|
Massively reworked to accomodate second generation counter objects.
|
|
|
|
Mark Koennecke, January 2009
|
|
----------------------------------------------------------------------------*/
|
|
#ifndef SICSCOUNTER
|
|
#define SICSCOUNTER
|
|
#include "countdriv.h"
|
|
|
|
typedef struct __Counter{
|
|
pObjectDescriptor pDes;
|
|
pHdb objectNode;
|
|
char *name;
|
|
int isUpToDate;
|
|
int iExponent;
|
|
pICountable pCountInt;
|
|
pCounterDriver pDriv;
|
|
pICallBack pCall;
|
|
unsigned long tStart;
|
|
int iCallbackCounter;
|
|
int badStatusCount;
|
|
int haltFixFlag; /* solely here to prevent multiple calls to the halt function on overrun timers in countersec.c*/
|
|
int tbLength; /* These two for caching float time bins in second generation HM's */
|
|
float *timeBinning;
|
|
char *error;
|
|
int (*setMode)(struct __Counter *self, CounterMode eMode);
|
|
CounterMode (*getMode)(struct __Counter *self);
|
|
int (*getNMonitor)(struct __Counter *self);
|
|
int (*setPreset)(struct __Counter *self, float val);
|
|
float (*getPreset)(struct __Counter *self);
|
|
float (*getControlValue)(struct __Counter *self);
|
|
long (*getCounts)(struct __Counter *self, SConnection *pCon);
|
|
long (*getMonitor)(struct __Counter *self, int iNum, SConnection *pCon);
|
|
void (*setMonitor)(struct __Counter *self, int iNum, long val);
|
|
float (*getTime)(struct __Counter *self, SConnection *pCon);
|
|
} Counter, *pCounter;
|
|
|
|
/*----------------------------- birth & death -----------------------------*/
|
|
|
|
pCounter CreateSecCounter(SConnection *pCon, char *type, char *name, int length);
|
|
pCounter CreateCounter(char *name, pCounterDriver pDriv);
|
|
void DeleteCounter(void *self);
|
|
int MakeCounter(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|
int argc, char *argv[]);
|
|
/* in countersec.c */
|
|
int MakeSecCter(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|
int argc, char *argv[]);
|
|
/*------------------------- set/get Parameters ----------------------------*/
|
|
int SetCounterMode(pCounter self, CounterMode eNew);
|
|
CounterMode GetCounterMode(pCounter self);
|
|
|
|
int SetCounterPreset(pCounter self, float fVal);
|
|
float GetCounterPreset(pCounter self);
|
|
float GetControlValue(pCounter self);
|
|
|
|
long GetCounts(pCounter self, SConnection * pCon);
|
|
long GetMonitor(pCounter self, int iNum, SConnection * pCon);
|
|
int GetNMonitor(pCounter self);
|
|
int GetControlMonitor(pCounter self);
|
|
int SetControlMonitor(pCounter self, int channel);
|
|
void SetMonitorValue(pCounter self, int index, long value);
|
|
float GetCountTime(pCounter self, SConnection * pCon);
|
|
|
|
int DoCount(pCounter self, float fPreset, SConnection * pCon, int iBlock);
|
|
|
|
/*-------------------------------------------------------------------------
|
|
the real action: starting and checking is packaged with the
|
|
ObjectDescriptor.
|
|
*/
|
|
|
|
int CountAction(SConnection * pCon, SicsInterp * pSics, void *pData,
|
|
int argc, char *argv[]);
|
|
|
|
#endif
|