ocssw  1.0
/disk01/web/ocssw/build/src/l1agen_modis/PH_pkt_hdr.h (r8106/r3)
Go to the documentation of this file.
00001 #ifndef PH_PKT_HDR_H
00002 #define PH_PKT_HDR_H
00003 
00004 /*
00005 !C-INC************************************************************************
00006 
00007 !Description:  This include file contains the definitions of values and byte
00008                and bit locations for the primary, secondary and MODIS headers.
00009 
00010                All definitions in this file will begin with "PH_".  
00011                Definitions for the primary header will begin with "PH_PRI".  
00012                Definitions for the secondary header will begin with "PH_SEC".  
00013                Definitions for the MODIS header will begin with "PH_MOD".  
00014 
00015 !Input Parameters:
00016                N/A
00017 
00018 !Output Parameters:
00019                N/A
00020 
00021 Return Values: 
00022                N/A
00023 
00024 Externally Defined:  
00025                PGSt_scTime             (PGS_TD.h)
00026                PGSt_double             (PGS_TD.h)
00027                int8                    (hdfi.h)
00028                int16                   (hdfi.h)
00029 
00030 Called By:
00031                N/A
00032 
00033 Routines Called:
00034                N/A
00035 
00036 !Revision History:
00037                Revision 2.1  1999/08/20  10:25
00038                John Seaton/SAIC/GSC (seaton@ltpmail.gsfc.nasa.gov)
00039                Added #define PH_SEC_PKT_TYPE_SPARE 3 so all the packet header,
00040                packet type spare values will be checked.
00041 
00042                Revision 2.0  1997/07/10  11:00
00043                Tom Johnson/SAIC/GSC (johnson@ltpmail.gsfc.nasa.gov)
00044                Created include file from Version 1 include files 
00045                modis_pkt_hdr_pos.h and modis_pkt_hdr_vals.h
00046 
00047                Revision 1.0  1996/06/21  13:00 EDT
00048                Keith Degnan/SAIC/GSC (keith.degnan@gsfc.nasa.gov)
00049                Created the PDL for module
00050 
00051 !Team-unique Header:
00052                This software is developed by the MODIS Science
00053                Data Support Team (SDST) for the National Aeronautics
00054                and Space Administration (NASA), Goddard Space Flight
00055                Center (GSFC), under contract NAS5-32373.
00056 
00057 !References and Credits:
00058            HDF portions developed at the National Center for 
00059                Supercomputing Applications at the University of Illinois 
00060                at Urbana-Champaign.
00061 
00062 !Design Notes: 
00063                The ".h" file below was specifically written for development
00064                in C. Any other language choice may require reworking of the
00065                ".h" file before coding can begin.
00066 
00067 !END**********************************************************************
00068 */
00069 
00070 #include "PGS_TD.h"
00071 #include "hdfi.h"
00072 
00073 /*********************************************************/
00074 /*  The following general information applies to the     */
00075 /*  primary, secondary, and MODIS header.                */
00076 /*********************************************************/
00077 
00078 #define  PH_NUM_12BIT_WORDS_IN_HEADER         12
00079 
00080 
00081 #define  PH_REALISTIC_NUM_SD_PACKETS         100       
00082 #define  PH_REALISTIC_NUM_SRCA_PACKETS        20       
00083 #define  PH_REALISTIC_NUM_BB_PACKETS         100       
00084 #define  PH_REALISTIC_NUM_SV_PACKETS         100       
00085 #define  PH_REALISTIC_NUM_EV_DAY_PACKETS    2708
00086 #define  PH_REALISTIC_NUM_EV_NIGHT_PACKETS  1354
00087 #define  PH_REALISTIC_NUM_ENG_PACKETS          4       
00088 
00089 
00090 #define  PH_REALISTIC_NUM_SD_FRAMES           50       
00091 #define  PH_REALISTIC_NUM_SRCA_FRAMES         10       
00092 #define  PH_REALISTIC_NUM_BB_FRAMES           50       
00093 #define  PH_REALISTIC_NUM_SV_FRAMES           50       
00094 #define  PH_REALISTIC_NUM_EV_FRAMES         1354
00095 
00096 
00097 /*********************************************************/
00098 /*  The following byte/bit offset and value information  */
00099 /*  is for the primary header.                           */
00100 /*********************************************************/
00101 
00102 #define  PH_PRI_VERSION_BYTE_OFFSET            0
00103 #define  PH_PRI_VERSION_BIT_OFFSET             0
00104 #define  PH_PRI_VERSION_NUM_BITS               3
00105 #define  PH_PRI_VERSION_VALUE                  0   
00106 
00107 #define  PH_PRI_TYPE_BYTE_OFFSET               0
00108 #define  PH_PRI_TYPE_BIT_OFFSET                3
00109 #define  PH_PRI_TYPE_NUM_BITS                  1
00110 #define  PH_PRI_TYPE_VALUE                     0
00111   
00112 #define  PH_PRI_SEC_HDR_FLAG_BYTE_OFFSET       0
00113 #define  PH_PRI_SEC_HDR_FLAG_BIT_OFFSET        4
00114 #define  PH_PRI_SEC_HDR_FLAG_NUM_BITS          1
00115 #define  PH_PRI_SEC_HDR_PRESENT                1
00116 
00117 #define  PH_PRI_APID_BYTE_OFFSET               0
00118 #define  PH_PRI_APID_BIT_OFFSET                5
00119 #define  PH_PRI_APID_NUM_BITS                 11
00120 #define  PH_PRI_MIN_MODIS_APID_AM1            64 
00121 #define  PH_PRI_MAX_MODIS_APID_AM1           127
00122 #define  PH_PRI_APID_TEST_PACKET             127
00123 
00124 #define  PH_PRI_SEQUENCE_FLAG_BYTE_OFFSET      2
00125 #define  PH_PRI_SEQUENCE_FLAG_BIT_OFFSET       0
00126 #define  PH_PRI_SEQUENCE_FLAG_NUM_BITS         2
00127 #define  PH_PRI_SEQUENCE_FIRST_PKT_IN_GROUP    1
00128 #define  PH_PRI_SEQUENCE_SECOND_PKT_IN_GROUP   2
00129 #define  PH_PRI_SEQUENCE_ONLY_PKT_IN_GROUP     3
00130 #define  PH_PRI_SEQUENCE_NOT_USED              0
00131 
00132 #define  PH_PRI_SOURCE_SEQ_CNT_BYTE_OFFSET     2
00133 #define  PH_PRI_SOURCE_SEQ_CNT_BIT_OFFSET      2
00134 #define  PH_PRI_SOURCE_SEQ_CNT_NUM_BITS       14
00135 #define  PH_PRI_MAX_CCSDS_PKT_SEQ_COUNT    16383
00136 
00137 #define  PH_PRI_PKT_LENGTH_BYTE_OFFSET         4
00138 #define  PH_PRI_PKT_LENGTH_BIT_OFFSET          0
00139 #define  PH_PRI_PKT_LENGTH_NUM_BITS           16
00140 #define  PH_PRI_LONG_PKT_LENGTH              635
00141 #define  PH_PRI_SHORT_PKT_LENGTH             269
00142 
00143 
00144 /*********************************************************/
00145 /*  The following byte/bit offset and value information  */
00146 /*  is for the secondary header.                         */
00147 /*********************************************************/
00148 
00149 #define  PH_SEC_TIME_TAG_BYTE_OFFSET           6
00150 #define  PH_SEC_TIME_TAG_NUM_BYTES             8
00151 
00152 #define  PH_SEC_QUICK_LOOK_FLAG_BYTE_OFFSET   14
00153 #define  PH_SEC_QUICK_LOOK_FLAG_BIT_OFFSET     0
00154 #define  PH_SEC_QUICK_LOOK_FLAG_NUM_BITS       1
00155 #define  PH_SEC_QUICK_LOOK_FLAG_SET            1
00156 #define  PH_SEC_QUICK_LOOK_FLAG_NOT_SET        0
00157 
00158 #define  PH_SEC_PKT_TYPE_BYTE_OFFSET          14
00159 #define  PH_SEC_PKT_TYPE_BIT_OFFSET            1
00160 #define  PH_SEC_PKT_TYPE_NUM_BITS              3
00161 #define  PH_SEC_PKT_TYPE_DAY_GROUP             0
00162 #define  PH_SEC_PKT_TYPE_NIGHT_GROUP           1
00163 #define  PH_SEC_PKT_TYPE_ENG1_GROUP            2
00164 #define  PH_SEC_PKT_TYPE_ENG2_GROUP            4
00165 #define  PH_SEC_PKT_TYPE_SPARE                 3
00166 #define  PH_SEC_PKT_TYPE_MAX_PKTS_IN_GROUP     2
00167 
00168 #define  PH_SEC_SCAN_CNT_BYTE_OFFSET          14
00169 #define  PH_SEC_SCAN_CNT_BIT_OFFSET            4
00170 #define  PH_SEC_SCAN_CNT_NUM_BITS              3
00171 #define  PH_SEC_SCAN_CNT_MAX                   7
00172 
00173 #define  PH_SEC_MIRROR_SIDE_BYTE_OFFSET       14
00174 #define  PH_SEC_MIRROR_SIDE_BIT_OFFSET         7
00175 #define  PH_SEC_MIRROR_SIDE_NUM_BITS           1
00176 #define  PH_SEC_MIRROR_SIDE_1                  0
00177 #define  PH_SEC_MIRROR_SIDE_2                  1
00178 
00179 
00180 /*********************************************************/
00181 /*  The following byte/bit offset and value information  */
00182 /*  is for the MODIS header.                             */
00183 /*********************************************************/
00184 
00185 #define  PH_MOD_SOURCE_ID_TYPE_FLAG_BYTE_OFFSET          15
00186 #define  PH_MOD_SOURCE_ID_TYPE_FLAG_BIT_OFFSET            0
00187 #define  PH_MOD_SOURCE_ID_TYPE_FLAG_NUM_BITS              1
00188 #define  PH_MOD_SOURCE_ID_TYPE_FLAG_EARTH                 0
00189 #define  PH_MOD_SOURCE_ID_TYPE_FLAG_CAL                   1
00190 
00191 #define  PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_BYTE_OFFSET    15
00192 #define  PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_BIT_OFFSET      1
00193 #define  PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_NUM_BITS       11
00194 #define  PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_MAX          2048
00195 #define  PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT        1400
00196 
00197 #define  PH_MOD_SOURCE_ID_CAL_TYPE_BYTE_OFFSET           15
00198 #define  PH_MOD_SOURCE_ID_CAL_TYPE_BIT_OFFSET             1
00199 #define  PH_MOD_SOURCE_ID_CAL_TYPE_NUM_BITS               2
00200 #define  PH_MOD_SOURCE_ID_CAL_TYPE_SOLAR_DIFFUSER_SOURCE  0
00201 #define  PH_MOD_SOURCE_ID_CAL_TYPE_SRCA_CAL_SOURCE        1
00202 #define  PH_MOD_SOURCE_ID_CAL_TYPE_BLACKBODY_SOURCE       2
00203 #define  PH_MOD_SOURCE_ID_CAL_TYPE_SPACE_SOURCE           3
00204 
00205 #define  PH_MOD_SOURCE_ID_CAL_MODE_BYTE_OFFSET           15
00206 #define  PH_MOD_SOURCE_ID_CAL_MODE_BIT_OFFSET             3
00207 #define  PH_MOD_SOURCE_ID_CAL_MODE_NUM_BITS               2
00208 #define  PH_MOD_SOURCE_ID_CAL_MODE_RADIOMETRIC_CAL_MODE   0
00209 #define  PH_MOD_SOURCE_ID_CAL_MODE_SPATIAL_CAL_MODE       1
00210 #define  PH_MOD_SOURCE_ID_CAL_MODE_SPECTRAL_CAL_MODE      2
00211 #define  PH_MOD_SOURCE_ID_CAL_MODE_NON_CAL_MODE           3
00212 
00213 #define  PH_MOD_SOURCE_ID_CAL_FRAME_CNT_BYTE_OFFSET      15
00214 #define  PH_MOD_SOURCE_ID_CAL_FRAME_CNT_BIT_OFFSET        6
00215 #define  PH_MOD_SOURCE_ID_CAL_FRAME_CNT_NUM_BITS          6
00216 #define  PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX              64
00217 
00218 #define  PH_MOD_FPA_AEM_CONFIG_BYTE_OFFSET               16
00219 #define  PH_MOD_FPA_AEM_CONFIG_BIT_OFFSET                 4
00220 #define  PH_MOD_FPA_AEM_CONFIG_NUM_BITS                   1
00221 #define  PH_MOD_FPA_AEM_CONFIG_NUM_ELEMENTS              10
00222 
00223 #define  PH_MOD_SCI_STATE_BYTE_OFFSET                    17
00224 #define  PH_MOD_SCI_STATE_BIT_OFFSET                      6
00225 #define  PH_MOD_SCI_STATE_NUM_BITS                        1
00226 #define  PH_MOD_SCI_STATE_TEST                            0
00227 #define  PH_MOD_SCI_STATE_NORMAL                          1
00228 
00229 #define  PH_MOD_SCI_ABNORM_BYTE_OFFSET                   17
00230 #define  PH_MOD_SCI_ABNORM_BIT_OFFSET                     7
00231 #define  PH_MOD_SCI_ABNORM_NUM_BITS                       1
00232 #define  PH_MOD_SCI_ABNORM_TEST                           0
00233 #define  PH_MOD_SCI_ABNORM_NORMAL                         1
00234 
00235 
00236 /*********************************************************/
00237 /*  The following structure defines the entire packet    */
00238 /*  header.                                              */
00239 /*********************************************************/
00240 
00241 typedef struct 
00242    {
00243    int8         version;
00244    int8         type;
00245    int8         sec_hdr_flag;
00246    int16        apid;
00247    int8         sequence_flag;
00248    int16        pkt_seq_cnt;
00249    int16        pkt_length;
00250    PGSt_scTime  pkt_time_code[8];
00251    PGSt_double  pkt_TAI_time;
00252    int8         QL_flag;
00253    int8         pkt_type;
00254    int8         scan_cnt;
00255    int8         mirror_side;
00256    int8         source_ID_type_flag;
00257    int16        earth_frame_cnt;
00258    int8         cal_type;
00259    int8         cal_mode;
00260    int8         cal_frame_cnt;
00261    int8         fpa_aem_config[PH_MOD_FPA_AEM_CONFIG_NUM_ELEMENTS];
00262    int8         sci_state;
00263    int8         sci_abnorm;
00264 
00265    } PH_PACKET_HEADER_t;
00266 
00267 
00268 #endif /* PH_PKT_HDR_H */