/***************************************************************************
                           FILE INFORMATION HEADER
                           -----------------------
                                                                         
    a.  PROJECT NAME:       GRIFO_S7  P2813         
    b.  ITEM TYPE               header
    c.  ITEM NAME:              bit_types.h
    d.  ITEM REFERENCE:          
    e.  CURRENT VERSION:        1.2
    f.  DATE:                   4/22/97
    g.  SOURCE FILE LOCATION:   /sparc-2/library/sr3b_end/dati/common/cmn_dt/s.bit_types.h
    h.  'C' RELEASE:            
    i.  ITEM DESCRIPTION:       
	include files for bit types.
    j.  DOCUMENTATION REFERENCES:     
    k.  PROGRAMMER NAME(S):     F.Rodighiero
				S.Lovati
    l.  COPYRIGHT:              FIAR    
    m.  REVISION HISTORY:       07-11-01 - Baseline copied from 3B.86 R3K Metis radar version 
  
 ***************************************************************************/

#ifndef bit_types_defined
//## attribute ::types_reverse::TopLevel.bit_types_defined
const RhpString bit_types_defined(0);

//## dependency base_types
#include "base_types.h"
//## attribute ::types_reverse::TopLevel.FPU_TIMEOUT
const RhpString FPU_TIMEOUT(10);

namespace legacy
{
    // randevouz status 
    //#[ type randevouz_status_t
    typedef enum { r_in_progress, r_completed, r_timeout }  randevouz_status_t;
    //#]
    
    // calibration type 
    //#[ type calibration_type_t
    typedef enum { cal_powerup, cal_runtime }  calibration_type_t;
    //#]
    
    // ibit class, normal means no WOW 
    //#[ type bit_class_t
    typedef enum { normal_bit, ground_bit, diagnostic_bit }  bit_class_t;
    //#]
    
    // bit_phase 
    //#[ type bit_phase_t
    typedef enum { phase_2_bit, 
                   phase_3_bit, 
                   phase_3_1_bit, 
                   phase_3_2_bit, 
                   phase_4_bit, 
    }  bit_phase_t;
    //#]
    
    // status of bit phase 
    //#[ type bit_phase_status_t
    typedef enum { 
    	fpu_in_progress = 1,
    	fpu_completed,
    	ph_2_in_progress, 
    	ph_2_completed, 
    	ph_3_in_progress, 
    	ph_3_completed, 
    	ph_3_1_in_progress, 
    	ph_3_1_completed, 
    	ph_3_2_in_progress, 
    	ph_3_2_completed, 
    	ph_4_in_progress, 
    	ph_4_completed,
    	fpu_timeout,
    	bit_phase_timeout
    }  bit_phase_status_t;
    //#]
    
    // bit_code, identifies one periodic system test 
    //#[ type bit_code_t
    typedef enum { is_5, is_6, is_7, is_8, is_9, is_10, is_11, is_12,
    		is_13, is_14, is_15 }  bit_code_t;
    //#]
    
    // Bit types 
    //#[ type int_tgt_t
    typedef struct {
    	unsigned short		int_tgt_range;
    	unsigned short		int_tgt_amplitude;
    	unsigned short		int_tgt_doppler;
    	short			int_tgt_ph_off_del;
    } int_tgt_t;
    //#]
    
    //#[ type int_tgt_data_t
    typedef struct {
      dis_en_t   int_tgt_request;
      int_tgt_t  int_tgt;
      } int_tgt_data_t;
    //#]
    
    //#[ type slc_bitmap_status_t
    typedef volatile struct {
      volatile unsigned short       timer1 :  1;
      volatile unsigned short       tx     :  1;
      volatile unsigned short       ampex  :  1;
      volatile unsigned short       dbs    :  1;
      volatile unsigned short       spare  : 12;
    } slc_bitmap_status_t;
    //#]
    
    //#[ type slc_comm_status_t
    typedef union {
      slc_bitmap_status_t slc_bitmap_status;
      unsigned short      slc_word;
      } slc_comm_status_t;
    //#]
    
    // from scheduler to IBIT 
    //#[ type ibit_parameters_t
    typedef struct { 
      bit_phase_t        bit_phase;
      bit_class_t	     bit_class;
    } ibit_parameters_t;
    //#]
    
    // from scheduler to Periodic BIT 
    //#[ type periodic_bit_parameters_t
    typedef struct { 
      bit_code_t         bit_code;
      bit_class_t	     bit_class;
    } periodic_bit_parameters_t;
    //#]
    
    // from DSP to bit 
    //#[ type dsp_sem_status_t
    typedef struct {
      boolean     pp_sem_status;
      boolean     agc_sem_status;
      boolean     slc_sem_status;
      slc_comm_status_t slc_comm_status;
     } dsp_sem_status_t;
    //#]
    
    //#[ type dsp_bit_status_t
    typedef struct {
      bit_status_t     pp_bit_status;
      bit_status_t     agc_bit_status;
      bit_status_t     timer_bit_status;
     } dsp_bit_status_t;
    //#]
    
    //#[ type dsp_cal_status_t
    typedef struct {
      bit_status_t     timer_cal_status;
     } dsp_cal_status_t;
    //#]
    
    //#[ type pp_agc_diag_t
    typedef struct {
      unsigned short	int_fo;
      unsigned short 	fail_mode_wd1;
      unsigned short	fail_mode_wd2;
      unsigned short	test_rep_wd1;
      unsigned short	test_rep_wd2;
      unsigned short	sru_fl_wd1;
      } pp_agc_diag_t;
    //#]
    
    //#[ type timer_diag_t
    typedef struct {
      unsigned short       	int_fo;
      unsigned short        fail_mode_wd1;
      unsigned short        fail_mode_wd2;
      unsigned short        test_rep_wd1;
      unsigned short        test_rep_wd2;
      unsigned short        test_rep_wd3;
      unsigned short        test_rep_wd4; 
      unsigned short        sru_fl_wd1;
      unsigned short        sru_fl_wd2;
      unsigned short        sru_fl_wd3;
      unsigned short        sru_fl_wd4;
      } timer_diag_t;
    //#]
}

/* messages definitions */

namespace legacy
{
    // DSP -> FPU 
    //#[ type dsp_fpu_bit_t
    typedef struct {
      dsp_sem_status_t     sem;
      dsp_bit_status_t     bit;
     } dsp_fpu_bit_t;
    //#]
    
    // DSP -> ONL 
    //#[ type dsp_onl_bit_t
    typedef struct {
      dsp_sem_status_t     sem;
      pp_agc_diag_t	       pp;
      pp_agc_diag_t        agc;
      timer_diag_t         timer;   
     } dsp_onl_bit_t;
    //#]
    
    // DSP -> CAL 
    //#[ type dsp_cal_t
    typedef struct {
      dsp_cal_status_t     cal;
     } dsp_cal_t;
    //#]
    
    // DSP -> IBIT 
    //#[ type dsp_ibit_t
    typedef struct {
      dsp_sem_status_t     sem;
      dsp_bit_status_t     bit;
      pp_agc_diag_t	       pp;
      pp_agc_diag_t        agc;
      timer_diag_t         timer;   
      dis_en_t             int_tgt_status;
    
    /* Added the Target values */
      unsigned int         num_det_target;
      validity_t           range_val_flag;
      metres_t             range_det;
      pure_number_t        amplitude;
      validity_t           rrate_val_flag;
      metres_per_sec_t     rrate_det;
      float                monop_det;
      float                zero_crossing_range; /* = range_meas (PP interface) */
     } dsp_ibit_t;
    //#]
    
    // from bit to 286 
    //#[ type if_fail_t
    typedef struct {
      fail_t      pp_if_fail;
      fail_t      agc_if_fail;
      fail_t      slc_if_fail;
      fail_t      timer_if_fail;
      fail_t      tx_if_fail;
     } if_fail_t;
    //#]
    
    //#[ type sru_fail_t
    typedef struct {
      fail_t      pp_sru_fail;
      fail_t      agc_sru_fail;
      fail_t      timer_sru_fail;
     } sru_fail_t;
    //#]
    
    //#[ type R3000_fail_t
    typedef struct {
      fail_t      DP5_fail;
      fail_t      DP6_fail;
     } R3000_fail_t;
    //#]
}

/* MESSAGES TO 286 */

namespace legacy
{
    // FPU -> 286 
    //#[ type fpu_diag_data_t
    typedef struct {
      if_fail_t             if_fail;
      sru_fail_t            sru_fail;
      R3000_fail_t          R3000;  
      } fpu_diag_data_t;
    //#]
    
    // IBIT -> 286 
    //#[ type ibit_diag_data_ph3_t
    typedef struct {
      pp_agc_diag_t         pp_diag;
      pp_agc_diag_t         agc_diag;
      timer_diag_t          timer_diag;
      } ibit_diag_data_ph3_t;
    //#]
    
    // ONL -> 286 
    //#[ type on_line_diag_data_t
    typedef struct {
      if_fail_t             if_fail;
      R3000_fail_t          R3000;  
      ibit_diag_data_ph3_t  diag_data_onl;
      } on_line_diag_data_t;
    //#]
    
    // IBIT -> 286 
    //#[ type ibit_diag_data_t
    typedef struct {
      if_fail_t             if_fail;
      sru_fail_t		sru_fail;
      R3000_fail_t          R3000;  
      ibit_diag_data_ph3_t  diag_data_ph2;
      } ibit_diag_data_t;
    //#]
}

#endif
