pro gen_old_struct, GEN_2101_Index = GEN_2101_Index
   
   
;+
;       NAME:
;               GEN_OLD_STRUCT
;       PURPOSE:
;               Define the following general database structures
;                       * GEN_2101_Index_Rec            
;
;       CALLING SEQUENCE:
;               GEN_OLD_STRUCT
;       HISTORY:
;               written by Mons Morrison, Fall 90.
;
;-
   
   
GEN_2101_Index = { GEN_2101_Index_Rec,              $
      index_version : FIX('2101'x),  $       ;
                                             ; 00- Index structure version                                   Ground 
                                             ;       AAAABBBB CCCCDDDD
                                             ;       AAAA =  1= S/C Telemetry Data - Test/Sample
                                             ;               2= Ground Data (which means that
                                             ;                 there are fields that are not
                                             ;                 filled in)
                                             ;               7= True S/C telemetry data
                                             ;       BBBB = Instrument
                                             ;               1= General
                                             ;               2= BCS
                                             ;               3= SXT
                                             ;               4= HXT
                                             ;               5= WBS
                                             ;               6= Other
                                             ;       CCCC = Version primary number
                                             ;       DDDD = Version secondary number
                                             ;
      time: LONG(0),  $                      ; 02- Time (millisec of day)                                    Derived
      day: FIX(0),  $                        ; 06- Day (since 1-Jan-79)                                      Derived
                                             ;     For BCS: This is the time that the data is
                                             ;               taken (not when it is read out of
                                             ;               the queue).  It uses the DP_Time
                                             ;               and the BCS clock value.
                                             ;     For HXT: This is major frame time
                                             ;     For SXT: This is major frame time when the 
                                             ;               image was taken
                                             ;     For SXT/Gnd: This is the time when the file
                                             ;               was created
                                             ;     For WBS: This is major frame time
                                             ;
      dp_time: BYTARR(4),  $                 ; 08- DP time for the major frame
                                             ;     For BCS: This value is empty (see BCS_DP_Sync_Rec)
                                             ;               (0) = TIMER1                                    W50 F1
                                             ;                       LSB = "SFK" = 2048 sec
                                             ;                       (period of SFK clock = 4096)
                                             ;               (1) = TIMER2                                    W50 F0
                                             ;                       LSB = "SFC" = 8 sec
                                             ;                       (period of SFC clock = 16)
                                             ;               (2) = TIMER3                                    W51 F0
                                             ;                       LSB = "FA" = 0.03125 sec
                                             ;               (3) = FI (Frame Indicator)                      W03 F0
      DP_mode: BYTE(0),  $                   ; 12- DP Mode                                                   W50 F2
                                             ;     For BCS: This value is empty (see BCS_DP_Sync_Rec)
                                             ;       3-7:    xxx01001 (= 9) Flare mode
                                             ;               xxx01011 (=11) BCS-Out mode
                                             ;               xxx01100 (=12) Night mode
                                             ;               xxx01101 (=13) Quiet mode
      DP_rate: BYTE(0),  $                   ; 13- DP Rate                                                   W48 F15
                                             ;     For BCS: This value is empty (see BCS_DP_Sync_Rec)
                                             ;       0-2:    100xxxxx (=4) High rate
                                             ;               010xxxxx (=2) Medium rate
                                             ;               001xxxxx (=1) Low rate
                                             ;       NOTE: There is a similar copy in W51 F53) Why TODO?
      Flare_Control: BYTE(0),  $             ; 14- Flare flag control (active triggers)                      W50 F60
                                             ;     For BCS: This value is empty (see BCS_DP_Sync_Rec)
                                             ;       b3: BCS triggering enabled
                                             ;       b4: HXS-PC1 triggering enabled
                                             ;       b5: SXS-PC triggering enabled
                                             ;       b6:7 SXS sensors to allow triggering enabled
                                             ;               00 = SXS-PC11
                                             ;               01 = SXS-PC12 (default)
                                             ;               10 = SXS-PC21
                                             ;               11 = SXS-PC22
      Flare_Status: BYTARR(4),  $            ; 15- Flare flag status                                         W50 F16
                                             ;     For BCS: This value is empty (see BCS_DP_Sync_Rec)
                                             ;         b0: Flare/RBM flag control (set = Auto)
                                             ;               Controls flare and RBM flags (auto/manual)
                                             ;         b1: SXS detects a flare
                                             ;         b2: HXS detects a flare
                                             ;         b3: BCS detects a flare
                                             ;         b4: RBM flag status (used for judging 
                                             ;             false or true Gamma burst (GBD))
                                             ;             (set= should cancel GBD flag)
                                             ;         b5: RBM flag status for false or true flares
                                             ;             (set= should cancel flare flag)
                                             ;       b6-7: Flare status
                                             ;               00: No flare
                                             ;               10: Normal flare
                                             ;               11: Great flare
                                             ;               01: Control BCS ... TODO??
      RBM_Status: BYTE(0),  $                ; 19- Radiation Belt Montitor Status                            W50 F61
                                             ;       b0 = RBM status (set = on)
                                             ;               (RBM flag on allows for canceling flares)
                                             ;       b2:3 = Flare mode
                                             ;         11: Great Flare
                                             ;         10: Normal Flare
                                             ;         00: Quiet
                                             ;         01: BCS Memory mode out
      Telemetry_mode: BYTE(0),  $            ; 20- Telemetry mode                                            W51 F06
                                             ;       b4:7    = 0000 - Real time link
                                             ;               = 0001 - Recording playback
                                             ;               = 0101 - TMX Reproduce High
                                             ;               = 0110 - TMX Reproduce Low
                                             ;               = 0111 - TMS Reproduce High (no convolution)
                                             ;               = 1000 - TMS Reproduce low
                                             ;               = 1001 - TMS Reproduce High (Convolution)
      cal_status: BYTE(0),  $                ; 21- CAL status                                                W51 F55
                                             ;       b1: HXT-CAL enable/disable (DP editing status)
                                             ;       b2: HXT-CAL-DATA (overrides columns 6 and 7)
                                             ;       b3: HXS-PH enable/disable
                                             ;       b4: HXS-PH-CAL-DATA
                                             ;       b5: GRS-CAL enable/diable
                                             ;       b6: GRS-CAL-DATA
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
                                             ;
      pitch: FIX(0),  $                      ; 22- Pitch (milli arcsec?)                                     Derived
      yaw: FIX(0),  $                        ; 24- Yaw (milli arcsec?)                                       Derived
      roll: LONG(0),  $                      ; 26- Roll (milli deg?)                                         Derived
      pntg_Trace: BYTE(0),  $                ; 30- Information on how pointing was derived                   Ground 
                                             ;       1 = Original Technique used 1-Aug to ???
      pntg_dpf: BYTE(0),  $                  ; 31- Data presence flag (since derived on                      Ground 
                                             ;       the ground)
      pntg_Dev: BYTE(0),  $                  ; 32- Magnitude of pointing change over ??sec                   Derived
                                             ;       in ??
      pntg_consist: BYTE(0),  $              ; 33- Pointing consistence flag??
                                             ;
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
      telemetry: BYTE(0),  $                 ; 34- Telemetry information                                     Ground 
                                             ;         0: BDR/Real Time (set = Real time data)
                                             ;       1-3: Ground Station 
                                             ;               (=0) = KSC      ??
                                             ;               (=1) = DSN - Canberra
                                             ;               (=2) = DSN - Madrid
                                             ;               (=3) = DSN - Goldstone
                                             ;               (=5) = DSN - 
                                             ;               (=8) = Ground based (test data)
      sirius: BYTARR(5),  $                  ; 35- Sirius data base information ??                           Ground 
                                             ;       TODO ?? - What info here?
                                             ;
                                             ;
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
      data_quality: BYTE(0),  $              ; 40- Data quality [as defined by??]                            Ground 
                                             ;               1 = good
      nmissSamps: LONG(0),  $                ; 41- Number of missing bytes (due to telemetry                 Ground 
                                             ;     drop outs - minor or major frames)
      StartSamp: LONG(0),  $                 ; 45- Starting sample number of good data                       Ground 
                                             ;       (zero if there are no dropouts)
                                             ;
                                             ;     _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
      data_word_type: BYTE(0),  $            ; 49- Data word type (byte, integer*2, real...)                 Ground 
                                             ;       0-3: Data word type
                                             ;               0 = byte
                                             ;               1 = integer*2
                                             ;               2 = integer*4
                                             ;               3 = real*4
                                             ;         4: Set if data is compressed 
      nIndexStruct: FIX(0),  $               ; 50- Number of "extra" index structures following
                                             ;     the general index structure
                                             ;     (for additional "ground" structures,
                                             ;     processing information structures, ...)
      nIndexByte: FIX(0),  $                 ; 52- Number of bytes in the index records
      nDataByte: LONG(0),  $                 ; 54- Number of byte in the data section
                                             ;
      SXT_Pow_stat: BYTE(0),  $              ; 58- Power Status (0=off, 1=on)                                W48  F2
                                             ;       0: 5 Volts
                                             ;       1: 28 Volts
                                             ;       2: Filter Wheel
                                             ;       3: Shutter / Aspect Controller
                                             ;       4: Micro A Select
                                             ;       5: Micro B Select
                                             ;       6: Camera
                                             ;       7: Thermoelectric Cooler (TEC)
      bcs_pow_stat: BYTE(0),  $              ; 59- BCS Power status                                          W112 F3
                                             ;       LSB = b0
                                             ;       b0: Calibibration-B (set=enabled)
                                             ;       b1: HVB logical flag (set=enabled)
                                             ;       b2: HVB power (set=on)
                                             ;       b3: Spectrometer B (set=on)
                                             ;       b4: Calibibration-A (set=enabled)
                                             ;       b5: HVA logical flag (set=enabled)
                                             ;       b6: HVA power (set=on)
                                             ;       b7: Spectrometer A (set=on)
      hxt_Pow_stat: BYTE(0),  $              ; 60- HXT Power status                                          W48 F32
                                             ;       b0 = HXT1 (electronics for 00 to 31)
                                             ;       b1 = HXT2 (electronics for 32 to 63)
                                             ;       b2 = OS memory status 
                                             ;       b3 = HXA on/off
                                             ;       b4 = HXA cal
                                             ;       b5 = HXT cal
                                             ;       b6 = HV reduction fuction on/off (enable SAA HV on/off)
                                             ;            Usually HV is 900 V, reduced to ~0 V when on
                                             ;       b7 - HV enable (double command safety)
                                             ;            HV cannot go on until this is enabled
      wbs_pow_stat: BYTE(0),  $              ; 61- Power status                                              W48 F32
                                             ;       b0: WBS HV enable/disable
                                             ;       b1: WBS on/off (set=on)
                                             ;       b2: WBS-A on/off (set=on)
                                             ;       b3: SXS-HV on/off (set=on)
                                             ;       b4: HXS-HV on/off (set=on)
                                             ;       b5: GRS-HV1 on/off (set=on)
                                             ;       b6: GRS-HV2 on/off (set=on)
                                             ;       b7: RBM-HV on/off (set=on)
      SXT_Control: BYTE(0),  $               ; 62- SXT Control Status                                        W114 F3
                                             ;         0: Power control mode (1=auto, 0=manual)
                                             ;         1: SXT control mode (1=auto, 0=manual)
                                             ;       4-5: SXT day/night mode
                                             ;               00 = SXT day mode
                                             ;               01 = SXT evening mode
                                             ;               10 = SXT night mode
                                             ;               11 = SXT morning mode
                                             ;         6: SXTE-U hard reset (1=executed)
                                             ;         7: SXTE-U soft reset (1=executed)
      spare1: BYTARR(1) }                    ; 63- Spare Bytes
   
   
   
  
  
end
