/*============================================================================ Name: bpmstruc.h Abs: This include file contains structures that contain BPMS, TORO, ARRY, WIRE, DUGADC, pulse id data used by bpm threads in the slcIOC. Auth: 22-JUN-2005, Debbie Rogind: created from bpmstruc.hc Rev: -----------------------------------------------------------------------------*/ #include "copyright_SLAC.h" /* SLAC copyright comments */ /*----------------------------------------------------------------------------- Mod: (newest to oldest) =============================================================================*/ #ifndef bpmstruc_H /* guard macro */ #define bpmstruc_H /* guard macro */ /*============================================================================== **CMS**=C_INC Name: bpmstruc.hc Abs: Define structures to contain BPMS, BWMS, TORO, and DUGADC data. Prev: slctxt:bpmparam.hc MAX_ARRY_CHAN, MAX_FIFO_CHAN, MAX_WIRE_CHAN, MAX_WVFM_FPTS. Auth: 1984, Joanne Bogart (JRB) ****************************************************************************** ****************************************************************************** *** *** *** NOTE: There also exists a FORTRAN header file; SLCTXT:BPMSTRUC.TXT *** *** If you modify one file, please modify the other. *** *** For structure of beginning of message containing the structures *** *** given below, see BPM_REQREPLY_STRUC.HC. For meas_def_ts, see *** *** BPM_MEASDEF_STRUC.H. *** *** *** ****************************************************************************** ****************************************************************************** Mod: 10-Oct-1997, Ron MacKenzie (RONM): Add ws_ structures containing arrays which correspond to ws_ structs which don't have arrays. This is so we can address the data using an index instead of the struct element name. This same approach is already taken in bpmstruc.txt. 09-Oct-1997, Tony Gromme (TEG): Put rms's back just in ws_wire_data_ts for PT. 01-Oct-1997, Ron MacKenzie (RONM): Added ws_puid_data_ts. 15-Oct-1996, Tony Gromme (TEG): Removed rms's from scan-type BPM, TORO, ARRY, etc. data structures. 15-Nov-1995, Mike Zelazny (MIKE): Added ws_ptgm_data_ts and ws_ptgm_item_ts for PEP2 trigger generator. 10-Oct-1994, Tony Gromme (TEG): Added per-channel info to DUGADC data struct's. 06-Oct-1994, Tony Gromme (TEG): Split into BPMSTRUC.HC and BPM_MEASDEF_STRUC.H. 04-Oct-1994, Tony Gromme (TEG): Get rid of MWIRADCN and MFIFOWC; use MAX_WIRE_CHAN and MAX_FIFO_CHAN from BPMPARAM.HC instead. Use MAX_ARRY_CHAN in arry_data_ts and ws_arry_data_ts. Eliminate all instances of variant_union and variant_struct. 12-Jan-1994, Tony Gromme (TEG): Make wire position readback in /WS_WIRE_DATA_STRUC/ be doublet. 07-Jul-1992, Lee Ann Yasukawa (LEEANN): Add structures for PIOP which include primaries of KLYS and SBST. Also, deleted BWM. 15-May-1992, Steve Levitt (LEVITT): Corrected arry_data_ts & slit_data_ts. 13-Apr-1992, Steve Levitt (LEVITT): Modified pulse_id to 4 bytes. 28-Jan-1992, Steve Levitt (LEVITT): Added FIFO stuff. 12-Dec-1991, Linda Hendrickson (LJH): Add second PP value for bpm definitions. 25-Oct-1991, Steve Levitt (LEVITT): Translated to C from Vax Fortran. 24-Sep-1990, Linda Hendrickson (LJH): Modify BPMS_DATA_STRUC to map DATA onto X,Y,etc. Add display scales for RMS in BPM_DISPLAY_CONTEXT. 28-Feb-1990, Nan Phinney: Add structures for more WS data types. 03-Oct-1989, Linda Hendrickson (LJH): Add position field to WS_WIRE_DATA_STRUC. 03-Jun-1988, TEG & MICK: Added stuff for wire scan readback. ==============================================================================*/ /* */ /* Data block structures: */ /* */ /* change define below if bpms_data_ts fields do not fall on even 4 byte boundaries */ #define BPMS_DATA_SIZE sizeof(bpms_data_ts) typedef struct { float x, y, tmit; float x_rms, y_rms, tmit_rms; unsigned short qraw[4]; unsigned short stat, goodmeas; } bpms_data_ts; typedef struct { float data[MAX_BPM_CHAN]; unsigned short qraw[MAX_BPM_RAW_CHAN]; unsigned short stat, goodmeas; } bpms_data_array_ts; /* another form of bpms_data_ts */ typedef struct { float x_phase, x_ampl, y_phase, y_ampl, x_rms, y_rms; unsigned short stat; } rinq_sine_data_ts; #define TORO_DATA_SIZE 14 /* byte count of toro_data_ts */ typedef struct { float tmit, tmit_rms; unsigned short qraw; unsigned short stat, goodmeas; } toro_data_ts; typedef struct { float data[MAX_WIRE_CHAN], drms[MAX_WIRE_CHAN]; unsigned short raw[MAX_WIRE_CHAN]; unsigned short stat[MAX_WIRE_CHAN], goodmeas[MAX_WIRE_CHAN]; } wire_data_ts; /* change define below if arry_data_ts fields do not fall on even 4 byte boundaries */ #define ARRY_DATA_SIZE sizeof(arry_data_ts) typedef struct { float data[MAX_ARRY_CHAN], drms[MAX_ARRY_CHAN]; unsigned short raw[MAX_ARRY_CHAN]; unsigned short stat[MAX_ARRY_CHAN], goodmeas[MAX_ARRY_CHAN]; } arry_data_ts; typedef struct { float data[MAX_WVFM_FPTS], drms[MAX_WVFM_FPTS]; unsigned short raw[MAX_WVFM_FPTS]; unsigned short stat, goodmeas; } wvfm_data_ts; typedef struct { float data[MAX_SLIT_CHAN], drms[MAX_SLIT_CHAN]; unsigned short raw[MAX_SLIT_CHAN]; unsigned short stat[MAX_SLIT_CHAN], goodmeas[MAX_SLIT_CHAN]; } slit_data_ts; typedef struct { float data, drms; unsigned short raw; unsigned short stat, goodmeas; } gapm_data_ts; typedef struct { float dat[MAX_FIFO_CHAN], dat_var[MAX_FIFO_CHAN]; unsigned short stat, goodmeas; } fifo_data_ts; typedef struct /* KLYS/SBST structure for regular (non-scan) data. */ { float phas, /* PIOP status word */ prms; /* variance of PIOP status word */ unsigned short stat, goodmeas; } klys_data_ts; typedef klys_data_ts sbst_data_ts; #define PUID_DATA_SIZE sizeof(bpm_pulseid_data_ts) typedef struct { unsigned short navg, nmuxmin; unsigned long tstamp[2], pulseid[1]; /* navg*nmuxmin values. */ } bpm_pulseid_data_ts; /* Stuff for wire scans. **********************************/ #define WS_BPM_DATA_SIZE sizeof(ws_bpm_data_ts) typedef struct { float x, y, tmit; unsigned short stat, goodmeas; } ws_bpm_data_ts; /* if you change this, change the next array struct */ typedef struct { float data[3]; unsigned short stat, goodmeas; } ws_bpm_data_array_ts; /* another form of ws_bpm_data_ts */ typedef struct { float x_phase, x_ampl, y_phase, y_ampl, x_rms, y_rms; unsigned short stat; } ws_rinq_sine_data_ts; /* if you change this, change the next array struct */ typedef struct { float data[6]; unsigned short stat; } ws_rinq_sine_data_array_ts; /* another form of previous struct with array */ #define WS_TORO_DATA_SIZE sizeof(ws_toro_data_ts) typedef struct { float tmit; unsigned short stat, goodmeas; } ws_toro_data_ts; /* if you change this, change the next array struct */ typedef struct { float data[1]; unsigned short stat, goodmeas; } ws_toro_data_array_ts; /* another form of previous struct with array */ /* Note that ws_wire_data_ts (and its synonym ws_wire_data_array_ts) apply */ /* only to the unit given in wun, and any other units of WIRE have data */ /* structure (not represented here) of same shape as any other DUGADC, */ /* namely: just (data[],stat[],goodmeas[]) for each scan step, though */ /* that structure is justified at beginning of space for ws_wire_data_ts */ /* with some space wasted for each scan step. */ typedef struct { float value[MAX_WIRE_CHAN], valrms[MAX_WIRE_CHAN]; unsigned short stat[MAX_WIRE_CHAN], goodmeas[MAX_WIRE_CHAN]; float position_smc, /* Position in wire steps, */ position_opt; /* and in optical counts. */ } ws_wire_data_ts; /* if you change this, change the next array struct */ typedef struct { float data[MAX_WIRE_CHAN], /* needs to be named data, not value*/ drms[MAX_WIRE_CHAN]; unsigned short stat[MAX_WIRE_CHAN], goodmeas[MAX_WIRE_CHAN]; float position_smc, /* Position in wire steps, */ position_opt; /* and in optical counts. */ } ws_wire_data_array_ts; /* another form of previous struct with array */ #define WS_ARRY_DATA_SIZE sizeof(ws_arry_data_ts) typedef struct { float data[MAX_ARRY_CHAN]; unsigned short stat[MAX_ARRY_CHAN], goodmeas[MAX_ARRY_CHAN]; } ws_arry_data_ts; typedef ws_arry_data_ts ws_arry_data_array_ts; /* another form of same */ /* Note: if WVFMLARGBIT is set then wv_wvfm_data_ts */ typedef struct /* is used instead of ws_wvfm_data_ts. */ { float data[MAX_WVFM_FPTS]; unsigned short stat, goodmeas; } ws_wvfm_data_ts; typedef struct { float data[MAX_SLIT_CHAN]; unsigned short stat[MAX_SLIT_CHAN], goodmeas[MAX_SLIT_CHAN]; } ws_slit_data_ts; typedef ws_slit_data_ts ws_slit_data_array_ts; /* another form of same */ typedef struct { float data; unsigned short stat, goodmeas; } ws_gapm_data_ts; /* if you change this, change the next array struct */ typedef struct { float data[1]; unsigned short stat[1], goodmeas; } ws_gapm_data_array_ts; /* another form of previous struct with array */ typedef struct { float dat[MAX_FIFO_CHAN]; unsigned short stat; } ws_fifo_data_ts; /* if you change this, change the next array struct */ typedef struct { float data[MAX_FIFO_CHAN]; /* we need it named data, not dat */ unsigned short stat; } ws_fifo_data_array_ts; /* another form of previous struct with array */ typedef struct /* KLYS/SBST structure for scanned data */ { float phas; /* PIOP status word */ unsigned short stat; } ws_klys_data_ts; /* if you change this, change the next array struct */ typedef struct /* KLYS/SBST structure for scanned data */ { float data[1]; unsigned short stat; } ws_klys_data_array_ts; /* another form of previous struct with array */ typedef ws_klys_data_ts ws_sbst_data_ts; typedef ws_klys_data_array_ts ws_sbst_data_array_ts; /* Structure of one repetition */ typedef struct /* of one pseudounit of SRBK. */ { union { float rbk; long int idata; } a_u; } ws_rbk_data_ts; /* Note that each unit of each of the above ws_* data */ /* structures except SRBK is repeated NRPOS times. */ /* Each unit of SRBK is repeated NRPOS+1 times; the */ /* first PAU readback is done before any dac output */ /* is done at all. */ #define WS_PUID_DATA_SIZE sizeof(ws_puid_ts) typedef struct /* PUID (pulse id) exists only as unit 1. */ { unsigned short navg, nmuxmin; unsigned long tstamp[2], pulseid[1]; /* nscanpos*navg*nmuxmin values. */ } ws_puid_ts; typedef struct /* Pulse id's */ { unsigned long pulseid; } ws_puid_data_ts; typedef struct { unsigned short ppyy[3]; unsigned long vetobus; } ws_ppyy_veto_item_ts; typedef struct /* VBUS (veto bus data) exists only as unit 1. */ { unsigned short navg, nmuxmin; ws_ppyy_veto_item_ts item[1]; /* nscanpos*navg*nmuxmin items. */ } ws_ppyy_veto_ts; typedef struct /* Single PTGM (PEP2 trigger generator) item */ { unsigned short stat, tdc1, spare_1, bukt, phas, spare_2; } ws_ptgm_item_ts; typedef struct /* PTGM (PEP2 trigger generator) exists only as unit 1. */ { unsigned short navg, nmuxmin; ws_ptgm_item_ts item[1]; /* nscanpos*navg*nmuxmin items. */ } ws_ptgm_data_ts; /* The following structure is returned only after */ /* a waveform-scan request, i.e., function code */ /* BPMO_SCANPREP with WVFMLARGBIT set. The size */ /* 316 in the following structure is in fact */ /* variable, and will be the value given in npts */ typedef struct /* below, obtained from the 7th word of GADC:HPED. */ { unsigned short npts, stat, spare[2]; float data[316]; } wv_wvfm_data_ts; /* Note: For meas_def_ts, see */ /* BPM_MEASDEF_STRUC.H. */ #endif