/*============================================================ Filename: tmSub.h Abs: Structures and definitions shared by SNL and subroutines records. Side: None Auth: 19-Nov-2010 K. Luchini (LUCHINI) Rev: dd-mmm-yyyy, Reviewer's Name (USERNAME) --------------------------------------------------------------*/ /*#include "copyright_SLAC.h" SLAC copyright comments */ /*------------------------------------------------------------- Mod: dd-mmm-yyyy, First Lastname (USERNAME): comment ============================================================== */ #ifndef TMSUB_H #define TMSUB_H #include "epicsTypes.h" /* epicsUInt16 */ #include "epicsMutex.h" /* epicsMutexId */ #include "dbCommon.h" /* struct dbCommon */ #include "dbAddr.h" /* DBADDR */ #include "dbDefs.h" /* PVNAME_SZ,PVNAME_STRINGSZ */ /****************************************************************** ****************************************************************** ******************** Device Support ******************* ******************** Status Codes ******************* ****************************************************************** */ #ifndef OK #define OK 0 #endif #ifndef ERROR #define ERROR -1 #endif /****************************************************************** ****************************************************************** ******************** Miscellenous ******************* ****************************************************************** */ #define INP_ARG_MAX 26 /* maximum longSub INP fields */ #define MIN(x,y) ((x>y) ? y : x) #define MAX(x,y) ((x>y) ? x : y) /****************************************************************** ****************************************************************** ******************** PDU Channel Modes ******************* ****************************************************************** */ /* * Trigger channel mode readback RAW value * :MODE.RVAL */ #define CHNL_MODE_PP0 1 #define CHNL_MODE_PP1 3 #define CHNL_MODE_M36 6 #define CHNL_MODE_RUSE 7 /* * Trigger channel mode readback and setpoint VAL * :MODE * :MODE_SET */ #define N_MODES 4 #define MODE_PP0 0 #define MODE_PP1 1 #define MODE_M36 2 #define MODE_REUSE 3 /****************************************************************** ****************************************************************** ******************** Beam Codes ******************* ****************************************************************** */ /* * The beam code contains the last element in rule (ie. 21st element in wf), * where as the event system contains the beam code in the 0th element. */ #define MIN_BEAMCODE 1 #define MAX_BEAMCODE 255 #define PDU_BEAMCODE(data_a) (((data_a)[PDU_RULE_WF_SIZE-1]) & MAX_BEAMCODE) #define BEAMCODE_OK(bc) ((bc)>0 && (bc)<=N_BEAMCODES) #define N_BEAMCODES 4 /* number of valid beam codes */ /****************************************************************** ****************************************************************** ******************** Rules ******************* ****************************************************************** */ /* * Global Rules: */ #define GLOBAL_RULE_DEVNAME "TRIG:SYS0:1:RULE" #define NUM_GLOBAL_RULES 10 /* * Trigger Channel Rules: */ #define NUM_RULES (N_RULES_PER_CHNL) /* N_RULES_PER_CHNL in devPDUII.h */ #define MAX_CHANNEL_RULES 8 #define RULE_BIT_MASK 0x7 #define INVALID_RULE 65535 #define RULE_OK(ruleNo) (((ruleNo)>=0) && ((ruleNo)