/**C*
 *
 * Vaisala software source code file
 *
 * Copyright (c) Vaisala Oyj  2002, 2004, 2007, 2009, 2011, 2012.
 * All rights reserved.
 *
 **C*/

/** @file
 *
 * Parameters and Structures for the RCP8 Radar Control Processor
 *
 * $URL: https://subversion.vaisala.com/svn/repos/sigmet/wr_iris_rda/tags/release8.13.6/rda/rcp8/open/rcp8.h $
 *
 * $Id: rcp8.h 30442 2014-12-19 11:34:22Z sko $
 *
 */

#ifndef SIGMET_RCP8_H
#define SIGMET_RCP8_H 1

#ifdef ENABLE_NLS 
#include <libintl.h> 
#include <locale.h> 
#  undef _ 
#  define _(String) dgettext (GETTEXT_PACKAGE, String) 
#else 
#  define textdomain(String) (String) 
#  define bindtextdomain(Domain,Directory) (Domain) 
#  define _(String) (String) 
#endif

#define RCP8_UNIQUE( VERSION, MINOREV ) ( ((MINOREV) << 8) | (VERSION) )
#define RCP8_UNIQUE_VERSION( UNIQUE ) (  (UNIQUE)        & 0x00FF )
#define RCP8_UNIQUE_MINOREV( UNIQUE ) ( ((UNIQUE) >>  8) & 0x00FF )

/* RCP8 version numbers follow overall RDA numbering scheme
 */
#define RCP8_VERSION RDA_VERSION
#define RCP8_MINOREV RDA_MINOREV
#define RCP8_BUILD   RDA_BUILD

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Tunable parameters
 */
#define NEQUATIONS      80      /* Max number of Boolean equations */

/* Each of the following parameters allocates Logic Equation resources
 * in multiples of eight.
 */
#define NLOC_BYTES       4      /* # of local variable bytes */
#define NTIM_BYTES       2      /* # of timer variable bytes */

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Shutdown error codes
 */
#define SHDN_POWERUP   0x00000001 /* Diagnostics Failed   */
#define SHDN_AZTPCHK   0x00000002 /* AZ Tach Inconsistent */
#define SHDN_ELTPCHK   0x00000004 /* EL Tach Inconsistent */
#define SHDN_AZUNRES   0x00000008 /* AZ Axis Unresponsive */
#define SHDN_ELUNRES   0x00000010 /* EL Axis Unresponsive */
#define SHDN_AZFAST    0x00000020 /* AZ Velocity Exceeded */
#define SHDN_ELFAST    0x00000040 /* EL Velocity Exceeded */
#define SHDN_AZPOSLO   0x00000080 /* AZ-LO Shutdown Limit */
#define SHDN_AZPOSHI   0x00000100 /* AZ-HI Shutdown Limit */
#define SHDN_ELPOSLO   0x00000200 /* EL-LO Shutdown Limit */
#define SHDN_ELPOSHI   0x00000400 /* EL-UP Shutdown Limit */
#define SHDN_LIMSWLO   0x00000800 /* EL Lower Lim Switch  */
#define SHDN_LIMSWHI   0x00001000 /* EL Upper Lim Switch  */
#define SHDN_AZSYN     0x00002000 /* AZ synchro problem   */
#define SHDN_ELSYN     0x00004000 /* EL synchro problem   */
#define SHDN_CANBUS    0x00008000 /* CAN-bus problem      */
#define SHDN_USER1     0x40000000 /* User-Shutdown #1     */
#define SHDN_USER2     0x80000000 /* User-Shutdown #2     */

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Sector blanking definitions
 */
#define NSBLNKS 8
struct rcp8_sblnkdef {          /* Setup definitions */
  UINT1 linuse ;                /*   Include this sector in overall test */
  UINT1 lped_angle ;            /*   Use pedestal angle (else earth angle) */
  char  pad2x2[2] ;
  FLT4  felx, fely ;            /*   Elevation boundaries (degrees) */
  FLT4  fazx, fazy ;            /*   Azimuth boundaries (degrees) */
} ;

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * AZ and EL setup parameters.  This structure contains the setup values
 * in meaningful scientific units.
 */
struct rcp8_aesetup {
  FLT4  fantsim_accel ;         /* Max simulated acceleration (deg/sec/sec) */
  UINT1 lantsim ;               /* Simulate this axis */

  UINT1 inbits ;                /* Number of bits used for input */
  UINT1 lbcd_input ;            /* Angle input is BCD (else binang) */
  UINT1 iang_source ;           /* Where input angles come from */
#define ANG_SOURCE_PARALLEL 0   /*   Parallel 'TAG' inputs */
#define ANG_SOURCE_SYNCHRO  1   /*   Synchro-To-Digital conversion */
#define ANG_SOURCE_SHAFTENC 2   /*   A/B/Index shaft encoder */
#define ANG_SOURCE_CANBUS   3   /*   Canbus thread */
#define ANG_SOURCE_CUSTOM   4   /*   Internal custom thread */
#define ANG_SOURCE_MAX      4

    float fParUpdatePeriodMs;   /* Maximum time between updates on parallel inputs */
  SINT4 iShaftTicksPerIndex ;   /* Number of A/B ticks per Index pulse */
  SINT2 iShaftIndxsPerRevol ;   /* Number of Index pulses per revolution */
  UINT1 lShaftReverseDir ;      /* Reverse A/B counting direction */
  UINT1 lShaftSecIO62 ;         /* Use secondary I/O-62 card */
  SINT2 iShaftProxAngle ;       /* Real binang of the proximity sensor */

  SINT2 iSynchroFreqHZ ;        /* Synchro reference frequency (Hertz) */
  UINT1 lSynchroShdnCheck ;     /* Shutdown on synchro errors */
  FLT4  fSynchroCalGains[2] ;   /* Calibration gains for 3-wire synchros */

  UINT1 ltcal_shdn_check ;      /* Enable tach calibration shutdowns */
  UINT1 luant_shdn_check ;      /* Enable unresponsive ant shutdowns */

  char pad23x5[5] ;
  FLT4 fangle_offset ;          /* Angle offset from true (degrees) */
  FLT4 fangle_mpypre ;          /* Optional multiplier and offset that */
  FLT4 fangle_offpre ;          /*   can be applied to raw angles. */

  FLT4 fMaxDriveVoltage ;       /* Maximum drive voltage magnitude */

  FLT4 fmotor_psustain ;        /* Motor sustain drives in positive and */
  FLT4 fmotor_nsustain ;        /*  negative directions (D-Units) */

  FLT4 fdrive_pslope ;          /* Nominal drive slopes in positive and */
  FLT4 fdrive_nslope ;          /*  negative directions (D/T-Units) */

  FLT4 fmom_inertia ;           /* Moment of inertia (D / dT/dt) */

  FLT4  fintverr_time ;         /* Integral term: Characteristic time */
  FLT4  fintverr_maxd ;         /* Integral term: Maximum additive drive */
  UINT1 lintverr_inuse ;        /* Integral term: Term is being applied */

  char pad73x1[1] ;
  UINT1 iaccelim_zreach ;       /*   Percentage "reach" toward zero drive */
  UINT1 laccelim_on ;           /*   Limiter On/Off */
  FLT4  faccelim_degss ;        /*   Bound in deg/sec/sec. */

  UINT1 iPosServoType ;         /* Type of position servo */
#define SERVO_TYPE_LEGACY  0    /*   Legacy feedback servo */
#define SERVO_TYPE_FEEDFWD 1    /*   Feed-Forward servo */
#define SERVO_TYPE_NUMTYPES  2

  char pad81x3[3];
  /* Parameters for Feed Forward Servo */
  FLT4 fmech_resonance_period ; /* Period of the mechanical resonance [sec] */
  FLT4 fdrive_constant ;        /* Drive constant [deg/(D-unit*sec)] */
  FLT4 iwait_time_mul ;         /* Multiplier for end of drive wait time (T/4) */

  /* Parameters for legacy servo */
  FLT4 fvel_max ;               /* Maximum servo velocity (T-Units) */
  FLT4 fvel_deadzone ;          /* Velocity feedback deadzone (T-Units) */
  FLT4 fvel_slope ;             /* Velocity feedback slope (D/dT-Units) */

  FLT4 fvel_shdn_margin ;       /* Permissible excess velocity (T-Units) */
  FLT4 fvel_shdn_time ;         /* Maximum time of being in excess (sec) */

  FLT4 ftcal_shdn_pcnt ;        /* Tach-check error percent */
  FLT4 ftcal_shdn_efix ;        /* Tach-check fixed error (deg/sec) */

  FLT4 fuant_shdn_terr ;        /* Unres-ant-check permissible tach error */
  FLT4 fuant_shdn_time ;        /* Maximum time of being in excess (sec) */

  FLT4  fTachFiltSecs ;         /* Tach zero-delay-filter window (sec) */
  SINT4 iTachFiltOrder ;        /* Model order for the smoother */

  FLT4 fdrive_slewtime ;        /* Drive slew rate limit Zero-->Max (sec)*/

  FLT4 fpservo_hyst[2] ;        /* Position servo hysteresis (degrees) */
  FLT4 fpservo_pos[2] ;         /* Position servo break angles (degrees) */
  FLT4 fpservo_slope[3] ;       /* Position servo slopes (T-Units / deg) */

  FLT4 fsoftlimits[2] ;         /* Lower and upper soft limits (degrees) */
  FLT4 fshutlimits[2] ;         /* Lower and upper shutdown limits (degrees) */

  UINT1 lsoftlimits_on ;        /* Enforce soft position limits */
  UINT1 lshutlimits_on ;        /* Enforce shutdown position limits */

  UINT1 ltach_positive ;        /* Tachometer sign is okay */
  UINT1 ldrive_positive ;       /* Drive sign is okay */

  FLT4 ftach_cal_level ;        /* Calibration tach level (T-Units) */
  FLT4 ftach_cal_speed ;        /* Calibration velocity (deg/sec) */

  UINT1 lusetach ;              /* Use tachometer for velocities */

  char pad201x3[3] ;
  FLT4 fvtach_fullspeed ;       /* Virtual tach top speed (deg/sec) */
  FLT4 fvtach_time ;            /* Virtual tach differentiation time (sec) */
  FLT4 fvtach_mintravel ;       /* Virtual tach minimum travel in window */
  FLT4 lvtach_model ;           /* Extrapolate tach using antenna model */

  FLT4 ftach_offset ;           /* Tachometer offset value (T-Units) */
  FLT4 fdrive_offset ;          /* Drive offset value (D-Units) */
  SINT1 iDriveUnsigned ;        /* Drive is signed (0), or always NEG/POS (-1/1) */

  char pad229x2[2] ;
  UINT1 lUseBalanceComp ;       /* Apply compensation for unbalanced antenna */
  FLT4 fBalanceCompAngle ;      /*   Neutral angle at which antenna comes to rest */
  FLT4 fBalanceCompDrive ;      /*   Drive required to hold 90Deg offset from neutral */  

  char pad240x3[3] ;
  UINT1 lUseStepper ;           /* This axis is driven by an up/dn stepper motor */
  FLT4 fStepperTicksPerDeg ;    /*   Stepper motor #-ticks per degree of rotation */
} ;

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Structure defining one of three axes of the Inertial Navigation Unit.
 */
struct rcp8_inusetup {
  UINT1 lnegate ;               /* Negate sign of this axis */
  char  pad1x3[3] ;
  FLT4  fangle_offset ;         /* Angle offset from true (degrees) */
  FLT4  fsim_amplitude ;        /* Simulated motion amplitude (degrees) */
  FLT4  fsim_center ;           /* Simulated motion center (degrees) */
  FLT4  fsim_period ;           /* Simulated motion period (seconds) */
} ;

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Boolean Control Constraints
 */
#define BOOLCOMLEN  80          /* Maximum length of comment text */
#define BOOLEQNLEN 120          /* Maximum length of equation text */

struct rcp8_boolean_save {      /* Saved equation definition */
  char  comment[BOOLCOMLEN] ;   /*   Null terminated comment string */
  char equation[BOOLEQNLEN] ;   /*   Null terminated equation string */
} ;

struct rcp8_adcvar {            /* Analog Boolean test variable definition */
  UINT1 linuse ;                /*   This slot is inuse */

  UINT1 iSumChans[4] ;          /*   Channels being summed */
#define ADCHAN_NUM     10       /*     Selected from this many measured inputs */
#define ADCVAR_NOCHAN           /*     Special code for an unused channel */ \
  ( 2 * ADCHAN_NUM )

#define ADCVAR_NAMELEN  8
  char name[ADCVAR_NAMELEN+1] ; /*   User-supplied name for this variable */
  char pad14x2[2] ;
  FLT4 fCmpVolts ;              /*   Comparison value in Volts */
} ;

struct rcp8_antvar {            /* Antenna Boolean test variable definition */
  UINT1 lInuse ;                /*   This slot is inuse */
  UINT1 lDesired ;              /*   Test desired value (else measured) */
  UINT1 lPedestal ;             /*   Test pedestal units (else Earth units) */
  UINT1 lVelocity ;             /*   Test velocity (else position) */
  UINT1 lAzimuth ;              /*   Test azimuth axis (else elevation axis) */
  UINT1 lCompareGT ;            /*   Use greater-than comparison (else less-than) */
  char pad6x4[4] ;
  SINT2 iTestValue ;            /*   Value to be compared against */
} ;

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Structure defining the strategy to be used when making requests for
 * IRIS mode changes in a Dual RCP system.
 */
struct rcp8_drcpIrisModeStrategy {
  UINT1 iStrategy ;             /* Mode switching strategy to use */
  UINT1 lAllowAutoSwitch ;      /* Allow IRIS to switch after setting it */
  UINT1 iDefaultMode ;          /* Default mode for fixed, or if illegal */
  UINT1 lValidModes[7] ;        /* Valid flags for modes 1-7 */
  char  pad10x2[2] ;
} ;
                                /* Mode switching strategies */
#define MODESTGY_NONE       0   /*   Do not make any mode change requests */
#define MODESTGY_FIXED      1   /*   Request a fixed mode selection */
#define MODESTGY_INHERIT    2   /*   Inherit mode from other unit */
#define MODESTGY_RESUME     3   /*   Resume last mode from this unit */

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 * Non-Volatile-RAM structure
 */
struct rcp8_nv {
  /* Version Information
   */
  char sVersion[8] ;            /* IRIS version when saved */

  UINT1 version ;               /* Code version that did the last save */
  UINT1 minorev ;               /* Minor revision of that code */

  /* Physical PCI board (unit number) assignments.  Negative value
   * denotes that that card, along with all cards following it, are
   * not to be used.
   */
#define RCP8MAXIO 2             /* Maximum number of I/O-62 cards per RCP8 */
#if defined(IO62MAXUNITS) && (RCP8MAXIO > IO62MAXUNITS)
#error Inconsistent definition of RCP8MAXIO
#endif
  SINT2 iIo62Cards[RCP8MAXIO] ; /* List of I/O-62 card unit numbers */
  UINT1 lIo62LineDiags ;        /* Run external line diagnostics */

  UINT1 lPCIResetOnShutdown ;   /* Reset all PCI cards upon shutdown */

  UINT1 lNetworkPanel ;         /* Network panel Y/N */
  char   panel_ip[80] ;         /* IP address of panel */
#define SERVO_IO62       0      /* Servo source io62 */
#define SERVO_NETWORK    1      /* Servo source network */
  SINT4 iServoSource ;          /* Servo source */

  UINT1 lRpcIrisServer ;        /* Provide IRIS RPC network status server */

  /* Overall axis setup for AZ and EL
   */
  char pad17x3[3] ;
  struct rcp8_aesetup azsetup ; /* Azimuth axis parameters */
  struct rcp8_aesetup elsetup ; /* Elevation axis parameters */

  /* Inertial Navigation Unit (INU) variables.
   */
  UINT4 inu_deadtime ;          /* Dead INU detection time (ms) */
  UINT1 lstabilized ;           /* Perform all moving platform ops */

  UINT1 lInuSimulate ;          /* Run INU simulation code */

  UINT1 linu_inv_ignore ;       /* Ignore invalid bits from INU */
  UINT1 linu_crcignore ;        /* Ignore CRC errors on reception */

  FLT4  fInuMaxPedEL ;          /* Maximum pedestel EL during INU modes */

  char  inu_device[80] ;        /* Device name of INU serial port */
  SINT4 inu_baudrate ;          /* Baud rate for the INU serial data */
  char  sInuSimDevice[80] ;     /* Device name of INU simulator port */
  SINT4 iInuSimBaudRate ;       /* Baud rate for the INU simulator */

  struct rcp8_inusetup rollsetup ;  /* Roll axis parameters */
  struct rcp8_inusetup pitchsetup ; /* Pitch axis parameters */
  struct rcp8_inusetup headsetup ;  /* Heading axis parameters */

  /* Host computer serial I/O variables.
   */
  SINT4 isio_devType ;          /* Type of host computer I/O device */
#define RCP8DEV_NONE       0    /*   Don't use any device */
#define RCP8DEV_SERIAL     1    /*   Serial port or internal FIFO */
#define RCP8DEV_NETWORK    2    /*   Network socket connection */

  char  sio_device[80] ;        /* File name of serial I/O device */
  char  sio_ipAddr[80] ;        /* IP address of network I/O device */
  char  sio_ipIface[16] ;       /* Interface name for network I/O */
  SINT4 isio_ipPort ;           /* Port number for network I/O */
  SINT4 isio_baudrate ;         /* Baud rate for serial I/O */

  UINT1 lsio_chat_dflt ;        /* Default control via remote chat */
  UINT1 isio_rcvfmt ;           /* Receive format code */
  UINT1 isio_xmtfmt ;           /* Transmit format code */
  UINT1 lsio_sendtrec ;         /* Send time records */
  UINT1 lsio_control_okay ;     /* Accept control packets from host */

  UINT1 lsio_send_intbite ;     /* Send internal BITE packets */
  UINT1 isio_intbite_id ;       /* ID byte of internal BITE packets */

  UINT1 lsio_send_adcbite ;     /* Send A/D converter Q-BITE packets */
  UINT1 isio_adcbite_id ;       /* ID byte of A/D Q-BITE packets */
  UINT1 lsio_sim_adcbite ;      /* Simulate various fake Q-BITE values */

  UINT1 isio_auxstsbite_id ;    /* ID byte of auxiliary status and */
  UINT1 isio_auxcntbite_id ;    /*   control BITE packets */
  UINT1 lsio_send_auxstsbite ;  /* Send/receive auxiliary status */
  UINT1 lsio_recv_auxcntbite ;  /*   and control BITE packets */

  UINT4 isio_trecms ;           /* Time (ms) between time records */
  UINT4 isio_deadtime ;         /* Dead host detection time (ms) */

  FLT4  fsio_xmtrate ;          /* Desired transmit records/second */

  /* Control output variables
   */
  char  pad940x3[3] ;
  UINT1 irad_option ;           /* Radiate control line protocol */
  FLT4  fRadPlength ;           /* Length of radiate On/Off pulses (sec) */

  FLT4 fResetUnsafeSec ;        /* Length of 'unsafe' period after resets */

  /* The following variables determine which of the status input lines
   * from the Antenna/Transmitter/Receiver are actually being used.
   */
  UINT1 lirismode0_sts ;        /* IRIS mode bit 0 */
  UINT1 lirismode1_sts ;        /* IRIS mode bit 1 */
  UINT1 lirismode2_sts ;        /* IRIS mode bit 2 */
  UINT1 lpwidth0_sts ;          /* Pulse-Width bit 0 */
  UINT1 lpwidth1_sts ;          /* Pulse-Width bit 1 */
  UINT1 lradiate_sts ;          /* Radiate */
  UINT1 lservopwr_sts ;         /* Servo Power */
  UINT1 ltrlocal_sts ;          /* TxRx may be controlled remotely */
  UINT1 ltrpower_sts ;          /* Transmitter/Receiver Power */
  UINT1 llocal_sts ;            /* User local mode */
  UINT1 lstandby_sts ;          /* Standby */
  UINT1 linterlock_sts ;        /* Interlock is open */
  UINT1 lmagcurrent_sts ;       /* Magnetron current */
  UINT1 lairflow_sts ;          /* Airflow */
  UINT1 lwavegp_sts ;           /* WaveGuide pressure */
  UINT1 lelimlo_sts ;           /* Lower limit switch encountered */
  UINT1 lelimhi_sts ;           /* Upper limit switch encountered */
  UINT1 lreset_sts ;            /* External reset */
  UINT1 lnoisegen_on_sts ;      /* Noise source Off/On */
  UINT1 lsiggen_on_sts ;        /* Signal generator Off/On */
  UINT1 lsiggen_cw_sts ;        /* Signal generator Pulse/CW output */
  UINT1 lsiggen_fault_sts ;     /* Signal generator fault */
  UINT1 lsiggen_level_sts ;     /* Signal generator level (dBm) */
  char pad975x11[11] ;

  /* Decide whether limit switch encounters will cause a shutdown.
   */
  UINT1 lelimlo_shdn ;          /* Lower EL limit switch causes shutdown */
  UINT1 lelimhi_shdn ;          /* Upper EL limit switch causes shutdown */

  /* Optional serial stream to report TAG angles.
   */
  UINT4 lstag_inuse ;           /* Serial TAG stream in use */
  SINT4 istag_baudrate ;        /* Speed of the interface */
  char   stag_device[80] ;      /* Device name of serial TAG port */
  SINT4 istag_format ;          /* Transmission format (one of RCVnn) */

  /* Optional antenna sector blanking.
   */
  UINT4 lsblnk_inuse ;          /* Implement sector blanking */
  struct rcp8_sblnkdef sblnkdefs[ NSBLNKS ] ; /* Blanked area definitions */

  /* Boolean equations, timers and miscellaneous variables.
   */
  UINT4 lbool_enab ;            /* Enable logic equations */
  struct rcp8_boolean_save boolist[NEQUATIONS] ;

#define NTIMER_VARS (NTIM_BYTES * 8)
  SINT1 itimer_var_modes [ NTIMER_VARS ] ; /* Operating mode */
  UINT4 itimer_var_sec100[ NTIMER_VARS ] ; /* Period in seconds*100 */
  UINT4 itimer_var_hitime[ NTIMER_VARS ] ; /* High time for CLOCKs */
#define TMODE_UNUSED  -1        /* Unused timer (free slot) */
#define TMODE_RETRIG   0        /* Retriggeragle (rising edge resets count) */
#define TMODE_SINGLE   1        /* Rising edges ignored once triggered */
#define TMODE_FILTER   2        /* Simple delay of input */
#define TMODE_RETARD   3        /* Holdoff leading edge */
#define TMODE_EXTEND   4        /* Extend falling edge */
#define TMODE_CLOCK    5        /* Periodic clock tick */
#define TMODE_CHANGE   6        /* Like RETRIG, but for any change */
#define TMODE_FICKLE   7        /* Cleanup a capricious input */
#define TMODE_NAMELIST \
  "Retrig", "Single", "Filter", "Retard", "Extend", "Clock", "Change", "Fickle"
#define TMODE_NAMELIST_LCASE \
  "retrig", "single", "filter", "retard", "extend", "clock", "change", "fickle"
#define TMODE_MODELIST \
  TMODE_RETRIG, TMODE_SINGLE, TMODE_FILTER, TMODE_RETARD, TMODE_EXTEND, \
  TMODE_CLOCK , TMODE_CHANGE, TMODE_FICKLE

  UINT2 iantstop_vel ;          /* Minimum velocity (binang/sec) and time */
  UINT2 iantstop_ms ;           /*  (milliseconds) for stopped antenna. */

#define ADCVAR_NUM 16           /* Boolean vars for user analog voltages */
  struct rcp8_adcvar adcvars[ ADCVAR_NUM ] ;

#define ANTVAR_NUM 16           /* Boolean vars for antenna Pos/Vel tests */
  struct rcp8_antvar antvars[ ANTVAR_NUM ] ;

  /* Optional HPIB devices.
   */
  UINT1 lhpib_inuse ;           /* RCP02 supports HPIB */
  char  shpib_device[80] ;      /* Device name of HIPB/USB interface */

  UINT1 lhpib_sgen_inuse ;      /* Signal generator is attached */
  UINT1 lhpib_sgen_haspulm ;    /* Signal generator has pulse modulation */

  char  pad18023x1[1] ;

  /* Dual-System Parameters
   */
  struct rcp8_drcpIrisModeStrategy drcp_stratInactive ;
  struct rcp8_drcpIrisModeStrategy drcp_stratActive ;

  UINT1 idrcp_pwrMode ;         /* Initial drcp mode to powerup into */
  char  cdrcp_nameCh ;          /* Single-character "name" of this device */

  char  pad17942x2[2] ;

  FLT4  fdrcp_moreTime ;        /* Additional OFF time (sec) between switchings */
  FLT4  fdrcp_coolTime ;        /* Cooldown time after becoming inactive */

  UINT1 ldrcp_inuse ;           /* Dual RCP configuration is being used */
  UINT1 ldrcp_unit_a ;          /* This is the "A" unit */
  UINT1 ldrcp_preferred ;       /* This is the "preferred" of the two units */

  UINT1 ldrcp_reset ;           /* The RCP02 can optionally be reset this */
  UINT2 idrcp_resetTime ;       /*   many seconds after becoming inactive. */

  UINT1 idrcp_MntFixedMode[2] ; /* Fixed IRIS mode and auto switch permission */
  UINT1 ldrcp_MntAutoSw[2] ;    /*   for Maintenance Inactive/Active states. */

  UINT1 ldrcp_allowFlip ;       /* Allow voluntary flipping between units */
  UINT1 ldrcp_wsnst_okay ;      /* Include workstation NST "okay" status */

  /* User-defined text for the two user-defined shutdowns.  This allows
   * a meaningful blinking message to appear on the front panel when the
   * RCP02 is shutdown via logic equations.
   */
  char userShutdownText[2][21] ;
  char pad18006x2[2] ;

  /* Front Panel Display configuration.  Each value is a template that
   * can appear on any of the four lines of the display.
   */
#define FPD_TB       0
#define FPD_EP1      1
#define FPD_EP2      2
#define FPD_EP3      3
#define FPD_PP       4
#define FPD_PV       5
#define FPD_EV1      6
#define FPD_EV2      7
#define FPD_CMD      8
#define FPD_RTS      9
#define FPD_HRP     10
#define FPD_LL      11
#define FPD_TM      12
#define FPD_SS1     13
#define FPD_SS2     14
#define FPD_XX      15
#define FPD_VAR     16
#define FPD_DRCP    17
#define FPD_ENC     18
#define FPD_NCHOICES  19

#define FPDCHOICES { "TB" , "EP1", "EP2", "EP3", "PP" , "PV" , \
                     "EV1", "EV2", "CMD", "RTS", "HRP", "LL" , \
                     "TM" , "SS1", "SS2", "XX" , "VAR", "DRCP",\
                     "Enc", NULL }

#define FPDSTATUS(IVAL) (((IVAL) == FPD_SS1) || ((IVAL) == FPD_SS2))

  UINT2 ifpd_template[2] ;      /* Choice of template for each display line */
  UINT4 ifpd_redrawms ;         /* Desired redraw time (ms) */

  UINT1 lfpd_azp100 ;           /* Display hundredths for AZ position */
  UINT1 lfpd_elp100 ;           /* Display hundredths for EL position */
  UINT1 lfpd_azv100 ;           /* Display hundredths for AZ velocity */
  UINT1 lfpd_elv100 ;           /* Display hundredths for EL velocity */

  /* Optional WSR-88D DCU data stream (antenna/pedestal data)
   */
  UINT4 ldcu_inuse ;            /* Data stream in use */
  SINT4 idcu_devType ;          /* Type of DCU I/O device */
  SINT4 idcu_position_bits;     /* Number of bits in binary angles (13 or 14) */
  SINT4 idcu_biteid ;           /* ID for standard DCU BITE packets */
  SINT4 idcu_biteid_st[2] ;     /* IDs for SelfTest #1 and #2 BITE packets */
  SINT4 idcu_baudrate ;         /* Speed of the interface */
  SINT4 idcu_parity ;           /* Parity choice */
  SINT4 idcu_finallimitdelay;   /* Final Limit Delay (milliseconds) */
  SINT4 idcu_radomehatchdelay;  /* Radome Hatch Delay (seconds) */
  FLT4  fdcu_azposmpy ;         /* Azimuth position multipler */
  FLT4  fdcu_elposmpy ;         /* Elevation position multipler */
  FLT4  fdcu_azvelmpy ;         /* Azimuth velocity multipler */
  FLT4  fdcu_elvelmpy ;         /* Elevation velocity multipler */
  FLT4  fdcu_angleLagMS ;       /* Fixed time lag (miliseconds) of angles */
  char   dcu_device[80] ;       /* Device name of serial port */
  char   dcu_deviceSim[80] ;    /*   and optional simulator port */

  /* Optional WSR-88D DAU data stream (BITE/Status data)
   */
  UINT4 ldau_inuse ;            /* Data stream in use */
  SINT4 idau_devType ;          /* Type of DAU I/O device */
  SINT4 idau_biteid ;           /* ID for standard BITE packets */
  SINT4 idau_Qbiteid ;          /* ID for quantitative BITE packets */
  SINT4 idau_baudrate ;         /* Speed of the interface */
  SINT4 idau_parity ;           /* Parity choice */
  FLT4  fdau_powermeterV;       /* Power meter head offset voltage (volts) */
  UINT4 ldau_override;          /* Override connector based channel type */
#define DAU_SINGLE       0      /* Override as single channel */
#define DAU_REDUNDANT    1      /* Override as redundant channel */
  SINT4 idau_redundantUse;      /* Single or redundant channel for override */
  SINT4 idau_channelNumber;     /* Channel number for override */
  char  dau_siteID[80];         /* DAU site id (4 charactors) */
  char  dau_device[80] ;        /* Device name of serial port */
  char  dau_deviceSim[80] ;     /*   and optional simulator port */
  
  /* Optional Kavouras TCU data stream (Radiate/BITE data)
   */
  UINT4 lkavtcu_inuse ;         /* Data stream in use */
  SINT4 ikavtcu_biteid ;        /* ID for standard BITE packets */
  SINT4 ikavtcu_Qbiteid ;       /* ID for quantitative BITE packets */
  char   kavtcu_device[80] ;    /* Device name of serial port */
  char   kavtcu_deviceSim[80] ; /*   and optional simulator port */

  /* Optional Andrew-Kintec pedestal interface.
   */
  UINT4 landrew_inuse ;         /* Use Andrew interface, not RCP02 servos */
  UINT4 iandrew_biteid ;        /* ID for pedestal BITE packets */
  UINT4 landrew_mapstatus ;     /* Map ACU status --> numbered variables */
  UINT4 landrew_useoffsets ;    /* Read and apply angle offsets from ACU */
  UINT4 landrew_suboffsets ;    /* Subtract those offsets (else add) */
  char   andrew_device[80] ;    /* Device name of serial port */
  char   andrew_deviceSim[80] ; /*   and optional simulator port */

  /* Optional Applied Systems Transmitter interface.
   */
  UINT4 lappsys_inuse ;         /* Use the transmitter interface */
  UINT4 iappsys_model ;         /* Model number (177, 377, etc) */
  SINT4 iappsys_biteid ;        /* ID for standard BITE packets */
  SINT4 iappsys_Qbiteid ;       /* ID for quantitative BITE packets */
  SINT4 iappsys_mapSts ;        /* Starting number of Status and Control */
  SINT4 iappsys_mapCnt ;        /*   bits that are mapped to the transmitter. */
  char   appsys_device[80] ;    /* Device name of serial port */
  char   appsys_deviceSim[80] ; /*   and optional simulator port */

  /* Optional Orbit pedestal interface
   */
  UINT4 lorbit_inuse ;          /* Use the transmitter interface */
  SINT4 iorbit_biteid ;         /* ID for standard BITE packets */
  SINT4 iorbit_mapSts ;         /* Starting number of Status and Control */
  FLT4  forbit_angleLagMS ;     /* Fixed time lag (milliseconds) of angles */
  char   orbit_device[80] ;     /* Device name of serial port */
  char  sorbit_device_sim[80] ; /* Device name of simulator */

  /* Optional dual GigaCom transmitter interface.
   */
  uint32_t lgigatx_inuse ;        /* Use Gigatx modulator interface */
  uint32_t igigatx_biteids[2] ;	  /* ID for BITE packets from each unit */
  uint32_t igigatx_Qbiteids[2] ;  /*   and for each QBITE unit. */
  uint32_t igigatx_faults[2] ;    /* Hi/Lo mask of fault bits */
  float    fgigatx_transtime ;    /* Transition time (sec) after switchover */
  uint32_t igigatx_baudrate ;     /* Speed of the interface */
  uint32_t igigatx_debounce ;     /* Wait time (ms) to debounce errors */
  uint32_t lgigatx_resetactive ;  /* gtx_reset also resets active system */
  char     gigatx_port_A[80] ;    /* Device name of serial port for TX-A */
  char     gigatx_port_B[80] ;    /* Device name of serial port for TX-B */
  uint32_t igtx_auto;
  uint32_t igtx_reqb;
  uint32_t igtx_hold;
  uint32_t igtx_reset;
  uint32_t igtx_trans;
  uint32_t igtx_chanb;
  uint32_t igtx_fault;

  /* Optional second antenna on the same pedestal
   */
  UINT4 lAuxAnt_inuse ;         /* Use a secondary antenna */
  FLT4  fAuxAnt_offsetAZ ;      /* Add these angles to the primary antenna */
  FLT4  fAuxAnt_offsetEL ;      /*   position to get the secondary position. */
  SINT4 iAuxAnt_irisMode ;      /* Use second antenna beginning w/this IRIS mode */
  UINT1 lAuxAnt_axisRev ;       /* "Reverse" AZ/EL angles for secondary antenna */

  UINT1 lErrorsToChat;          /* Send error signals to chat terminal as well as stderr */
  char pad19058x2[2] ;

  /* Optional shaft encoder configuration
   */
  UINT1 lShaftEncoderSimulator; /* Simulate the shaft encoder */
  UINT1 lShaftAutoCal ;         /* Enable automatic calibration */
  char pad19062x2[2];

  /* Optional CAN bus configuration
   */
  UINT4 lcanbus_inuse ;         /* Enable the CAN-Bus interface thread */
  UINT4 lcanbus_control_enabled ; /* Control radar through CAN-bus */
  UINT4 lcanbus_unrespantenna ; /* Force shutdown for unresponsive antenna */
  SINT4 icanbus_biteid ;        /* ID for standard BITE packets */
  SINT4 icanbus_Qbiteid ;       /* ID for quantitative BITE packets */

  /* Optional ADH-2A COM dehydrator configuration
   */
  UINT4 ldehydrator_inuse ;     /* Enable the dehydrator thread */
  SINT4 idehydrator_biteid ;    /* ID for standard BITE packets */
  SINT4 idehydrator_Qbiteid ;   /* ID for quantitative BITE packets */
  char  dehydrator_port[80] ;   /* Dehydrator's serial port device name */

  /* Optional Klystron transmitter configuration
   */
  UINT4 lklystron_inuse ;       /* Enable the klystron thread */
  SINT4 iklystron_biteid ;      /* ID for standard BITE packets */
  SINT4 iklystron_Qbiteid ;     /* ID for quantitative BITE packets */
  SINT4 iklystron_log_print ;   /* Print fault log to file if this bit goes 0 to 1 */
  char  klystron_port[80] ;     /* Klystron's serial port device name */

  /* Optional Power Monitoring configuration
   */
  uint32_t lpowermon_inuse ;         /* Enable the Power Monitoring */
  int32_t  ipowermon_biteid ;        /* ID for standard BITE packets */
  int32_t  ipowermon_Qbiteid ;       /* ID for quantitative BITE packets */
  int32_t  ipowermon_sensor_count ;  /* Number of power sensors in use. */
  int32_t  ipowermon_freq ;          /* Signal frequency for power measurement. */
  int32_t  ipowermon_SNHorTX ;       /* Serial number of the horinzontal transmitted power sensor */
  int32_t  ipowermon_SNHorRX ;       /* Serial number of the horinzontal received power sensor */
  int32_t  ipowermon_SNVerTX ;       /* Serial number of the vertical transmitted power sensor */
  int32_t  ipowermon_SNVerRX ;       /* Serial number of the vertical received power sensor */
  float    fpowermon_AttenuationHorTX ; /* Total attenuation in horizontal transmission power measurement */
  float    fpowermon_AttenuationHorRX ; /* Total attenuation in horizontal reflected power measurement */
  float    fpowermon_AttenuationVerTX ; /* Total attenuation in vertical transmission power measurement */
  float    fpowermon_AttenuationVerRX ; /* Total attenuation in vertical reflected power measurement */
  int32_t  ipowermon_status_offset ; /* Place 2 status bits in this offset in aux status */
  int32_t  ipowermon_zero ;          /* The number of control bit for sensor zeroing */
  int32_t  ipowermon_reset ;         /* The number of control bit for reset */

  /* Optional ARA ACU-3 Antenna Controller (antenna/pedestal data)
   */
  UINT4 lara_acu_inuse ;        /* Data stream in use */
  SINT4 iara_acu_biteid ;       /* ID for standard DCU BITE packets */
  SINT4 iara_acu_status_offset; /* Place 15 status bits in these status registers */
  SINT4 iara_acu_control_reset; /* Reset if this bit goes 0 to 1 */
  SINT4 iara_acu_baudrate ;     /* Speed of the interface */
  SINT4 iara_acu_parity ;       /* Parity choice */
  FLT4  fara_acu_angleLagMS ;   /* Fixed time lag (milliseconds) of angles */
  SINT4 iara_acu_pospollMS;     /* Position polling rate in milliseconds */
  char  sara_acu_device[80] ;   /* Device name of serial port */
  char  sara_acu_device_sim[80] ; /* Device name of serial port simulator */

  /* Optional TSC TWT (Transmitter data)
   */
  UINT4 btsc_twt_inuse;           /* Data stream in use */
  SINT4 itsc_twt_biteid;          /* ID for standard status BITE packets */
  SINT4 itsc_twt_qbiteid;         /* ID for Q-bite status BITE packets */
  SINT4 itsc_twt_status_offset;   /* Place 23 status bits in these status registers */
  SINT4 itsc_twt_control_offset;  /* Read 10 control bits from these control registers */
  char  stsc_twt_mod_device[80];  /* Device name of TWTA/Modulator serial port */
  char  stsc_twt_mod_device_sim[80];  /* Device name of TWTA/Modulator serial port simulator */
  char  stsc_twt_tr_device_sim[80];   /* Device name of TWTA/Transmitter serial port simulator */
  char  stsc_twt_tr_ipAddr[80] ;  /* IP address of the DIU Receiver Synthesizer */
  uint32_t itsc_twt_tr_ipPort ;	  /* UDP port of the DIU in the Receiver/Synthesizer */

  /* Optional TDRS Pedestal Receiver (antenna angle data)
   */
  uint32_t btdrs_ped_rcv_inuse ;      /* Data stream in use */
  char     stdrs_ped_rcv_device[80] ; /* Device name of serial port */

  /* Optional TDRS Pedestal Transmitter (antenna control data)
   */
  uint32_t btdrs_ped_xmt_inuse ;      /* Data stream in use */
  char     stdrs_ped_xmt_ipAddr[80] ; /* IP address of network output */
  uint32_t itdrs_ped_xmt_ipPort ;     /* Port number for network I/O */

  /* Optional Melco TKY-01 serial configuration
   */
  UINT4 lmelco_tky01_inuse ;    /* Enable the Melco Serial Turkey-01 thread */
  SINT4 imelco_tky01_Qbiteid ;  /* ID for quantitative BITE packets */
  SINT4 imelco_tky01_baudrate ; /* Speed of the interface */
  char  smelco_tky01_port[80] ; /* Serial port device name */
  char  smelco_tky01_portSim[80] ; /* Serial port simulator name */

  /* Optional Pulse Systems TR-1163 transmitter ethernet interface configuration
   */
  uint32_t bps_tr1163_inuse ; /* Enable Pulse Systems TR-1163 ethernet interface */
  char sps_tr1163_ipAddr[80] ; /* IP Address of the TCP interface */
  uint32_t ips_tr1163_ipPort ;
  int32_t ips_tr1163_biteid ;
  int32_t ips_tr1163_qbiteid ;
  int32_t ips_tr1163_status_offset ;
  int32_t ips_tr1163_control_reset ;

  /* Optional EEC DDC Antenna Controller interface
   */
  uint32_t beec_ddc_inuse ;      /* Data stream in use */
  char     seec_ddc_ipAddr[80] ; /* IP address of network output */
  uint32_t ieec_ddc_ipPort ;     /* Port number for network I/O */
  int32_t  ieec_ddc_biteid ;     /* ID for regular BITE packets */
  int32_t  ieec_ddc_Qbiteid ;    /* ID for quantitative BITE packets */
  uint32_t beec_ddc_simEnable ;  /* enable DDC simulator */

  /* Optional RPM PED Antenna Controller interface
   */
  uint32_t brpm_ped_inuse ;      /* Data stream in use */
  char     srpm_ped_ipAddr[80] ; /* IP address of network output */
  uint32_t irpm_ped_ipPort1 ;    /* Port number for network I/O */
  uint32_t irpm_ped_ipPort2 ;    /* Port number for network I/O */
  int32_t  irpm_ped_biteid ;     /* ID for regular BITE packets */
  int32_t  irpm_ped_mapSts ;     /* sAux Base */

  /* Optional signal generator control through ethernet
   */
  uint32_t lsiggen_control_inuse ; /* siggen control enabled */
  uint32_t isiggen_interface;      /* Type of the siggen interface */
  uint32_t lsiggen_eth_inuse ;     /* siggen eth interface enabled */
  char     ssiggen_ipAddr[80] ;    /* siggen eth address */
  uint32_t isiggen_ipPort ;        /* siggen eth port */

  /* Optional parallel I/O bits on RVP9/IFD.
   */
  UINT4 lrvp9io_inuse ;         /* Enable RPC socket to RVP9/IFD */

 } ;
#endif /* #ifndef SIGMET_RCP8_H */
