• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

epics/apps/cbm_jul12/cbmApp/src/HVCAENx527.h (r4864/r2306)

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <dbDefs.h>
00004 #include <dbAccess.h>
00005 #include <recSup.h>
00006 #include <devSup.h>
00007 #include <callback.h>
00008 #include <sys/time.h>
00009 
00010 #define EVNTNO_UPDATE   10
00011 #define EVNTNO_T1       11
00012 #define EVNTNO_T2       12
00013 #define EVNTNO_T3       13
00014 
00015 /* Turn on (1) or off (0) scan server mode */
00016 /* This may be needed if the CAEN driver can't handle asynchronous
00017    monitoring of parameters, i.e. a get for one channel is mixed up
00018    with the get for another. */
00019 /* Update: This definitely is needed. */
00020 #define SCAN_SERVER 1
00021 
00022 typedef struct ParProp
00023 {
00024         char pname[16];
00025         union
00026         {
00027                 float f;
00028                 long l;
00029                 double d;
00030         } pval;
00031         union
00032         {
00033                 float f;
00034                 long l;
00035                 double d;
00036         } pvalset;
00037         unsigned long Type, Mode;
00038         float Minval, Maxval;
00039         unsigned short Unit;    /* engineering unit */
00040         short Exp;              /* exponent of numbers, e.g. +3 = kilo */
00041         char Onstate[32], Offstate[32]; /* Labels associated with state */
00042         struct HVChan *hvchan;
00043         /* EPICS-related variables */
00044         char PVname[32];
00045         /* "period" is here for future implementation */
00046         double period;  /* desired scan period, -1 == not scanned */
00047         int evntno;     /* EPICS event number, -1 == not scanned */
00048         struct dbAddr PVaddr;
00049         CALLBACK pcallback;
00050 } PARPROP;
00051 
00052 typedef struct HVChan
00053 {
00054         unsigned short *crate, slot, chan; /* crate, slot, channel number */
00055         char chaddr[16];
00056         char chname[16];
00057         /* The Channel Name is an oddball parameter.  The CAEN driver
00058                 treats it separately from other channel parameters, so
00059                 we're treating its scan parameters specially here, too */
00060         double chname_period;
00061         int chname_evntno;
00062         short npar;
00063         PARPROP *pplist;                /* parameters list */
00064         struct HVCrate *hvcrate;        /* crate data connector */
00065         /* EPICS-related variables */
00066         short epicsenabled;     /* 1 = PV exists, 0 = no PV */
00067 } HVCHAN;
00068 
00069 typedef struct HVSlot
00070 {
00071         char slname[64];
00072         short nchan;
00073         HVCHAN **hvchan;        /* channel list */
00074 } HVSLOT;
00075 
00076 typedef struct CrateScanList
00077 {
00078         char pname[16];
00079         double period;  /* default desired scan period, -1 == not scanned */
00080         int evntno;     /* default EPICS event number, -1 == not scanned */
00081         /* RU! consider putting the channel number lists here */
00082         struct CrateScanList *next;
00083 } CRATESCANLIST;
00084 
00085 typedef struct HVCrate
00086 {
00087         char name[64];
00088         char IPaddr[64];
00089         unsigned short crate;   /* crate number */
00090         short nsl;      /* max number of slots in crate */
00091         short nchan;    /* total number of channels (#slot * #nchperslot) */
00092         HVCHAN *hvchan; /* list of HV channels controlled by this crate */
00093         HVSLOT *hvchmap;        /* slot X chan lookup table of *hvchan */
00094         CRATESCANLIST *csl;
00095         short connected;
00096 } HVCRATE;
00097 
00098 extern short DEBUG;
00099 #define PDEBUG(LEVEL)   if( DEBUG >= LEVEL)
00100 /*
00101         DEBUG level guideline
00102          0 - none
00103          1 - unrepeated initialization and shutdown messages, 
00104              messages about the crate and slots that appear only once 
00105              during run-time
00106          2 - messages about the crate that appear once per crate scan
00107          3 - messages about channels that appear only once during run-time
00108          4 - messages about channel parameters that appear only once 
00109              during run-time
00110          5 - messages about channels that appear once per crate scan
00111          6 - messages about channels parameters that appear once per crate scan
00112         10 - all messages
00113 */
00114 
00115 float ScanChannelsPeriod;
00116 
00117 int ConnectCrate( char *name, char *linkaddr);
00118 void ParseCrateAddr( char (*straddr)[], short naddr);
00119 void Shutdown();
00120 #if 0
00121 void iCallback( CALLBACK *pcallback);
00122 void oCallback( CALLBACK *pcallback);
00123 #endif
00124 void *CAENx527ParseDevArgs( char *saddr);
00125 void *CAENx527GetChParVal( PARPROP *pp);
00126 int CAENx527SetChParVal( PARPROP *pp);
00127 char *CAENx527GetChName( HVCHAN *hvch);
00128 int CAENx527SetChName( HVCHAN *hvch, char *chname);
00129 short CAENx527mbbi2state( PARPROP *pp);
00130 void CAENx527mbbi2bits( PARPROP *pp, char *bits, short nbits);
00131 char *CAENx527GetParUnit( PARPROP *pp, char *fieldval);

Generated on Tue Dec 10 2013 04:52:22 for ROCsoft by  doxygen 1.7.1