OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
PH_pkt_hdr.h
Go to the documentation of this file.
1 #ifndef PH_PKT_HDR_H
2 #define PH_PKT_HDR_H
3 
4 /*
5 !C-INC************************************************************************
6 
7 !Description: This include file contains the definitions of values and byte
8  and bit locations for the primary, secondary and MODIS headers.
9 
10  All definitions in this file will begin with "PH_".
11  Definitions for the primary header will begin with "PH_PRI".
12  Definitions for the secondary header will begin with "PH_SEC".
13  Definitions for the MODIS header will begin with "PH_MOD".
14 
15 !Input Parameters:
16  N/A
17 
18 !Output Parameters:
19  N/A
20 
21 Return Values:
22  N/A
23 
24 Externally Defined:
25  PGSt_scTime (PGS_TD.h)
26  PGSt_double (PGS_TD.h)
27  int8 (hdfi.h)
28  int16 (hdfi.h)
29 
30 Called By:
31  N/A
32 
33 Routines Called:
34  N/A
35 
36 !Revision History:
37  Revision 2.1 1999/08/20 10:25
38  John Seaton/SAIC/GSC (seaton@ltpmail.gsfc.nasa.gov)
39  Added #define PH_SEC_PKT_TYPE_SPARE 3 so all the packet header,
40  packet type spare values will be checked.
41 
42  Revision 2.0 1997/07/10 11:00
43  Tom Johnson/SAIC/GSC (johnson@ltpmail.gsfc.nasa.gov)
44  Created include file from Version 1 include files
45  modis_pkt_hdr_pos.h and modis_pkt_hdr_vals.h
46 
47  Revision 1.0 1996/06/21 13:00 EDT
48  Keith Degnan/SAIC/GSC (keith.degnan@gsfc.nasa.gov)
49  Created the PDL for module
50 
51 !Team-unique Header:
52  This software is developed by the MODIS Science
53  Data Support Team (SDST) for the National Aeronautics
54  and Space Administration (NASA), Goddard Space Flight
55  Center (GSFC), under contract NAS5-32373.
56 
57 !References and Credits:
58  HDF portions developed at the National Center for
59  Supercomputing Applications at the University of Illinois
60  at Urbana-Champaign.
61 
62 !Design Notes:
63  The ".h" file below was specifically written for development
64  in C. Any other language choice may require reworking of the
65  ".h" file before coding can begin.
66 
67 !END**********************************************************************
68 */
69 
70 #include "PGS_TD.h"
71 #include "hdfi.h"
72 
73 /*********************************************************/
74 /* The following general information applies to the */
75 /* primary, secondary, and MODIS header. */
76 /*********************************************************/
77 
78 #define PH_NUM_12BIT_WORDS_IN_HEADER 12
79 
80 
81 #define PH_REALISTIC_NUM_SD_PACKETS 100
82 #define PH_REALISTIC_NUM_SRCA_PACKETS 20
83 #define PH_REALISTIC_NUM_BB_PACKETS 100
84 #define PH_REALISTIC_NUM_SV_PACKETS 100
85 #define PH_REALISTIC_NUM_EV_DAY_PACKETS 2708
86 #define PH_REALISTIC_NUM_EV_NIGHT_PACKETS 1354
87 #define PH_REALISTIC_NUM_ENG_PACKETS 4
88 
89 
90 #define PH_REALISTIC_NUM_SD_FRAMES 50
91 #define PH_REALISTIC_NUM_SRCA_FRAMES 10
92 #define PH_REALISTIC_NUM_BB_FRAMES 50
93 #define PH_REALISTIC_NUM_SV_FRAMES 50
94 #define PH_REALISTIC_NUM_EV_FRAMES 1354
95 
96 
97 /*********************************************************/
98 /* The following byte/bit offset and value information */
99 /* is for the primary header. */
100 /*********************************************************/
101 
102 #define PH_PRI_VERSION_BYTE_OFFSET 0
103 #define PH_PRI_VERSION_BIT_OFFSET 0
104 #define PH_PRI_VERSION_NUM_BITS 3
105 #define PH_PRI_VERSION_VALUE 0
106 
107 #define PH_PRI_TYPE_BYTE_OFFSET 0
108 #define PH_PRI_TYPE_BIT_OFFSET 3
109 #define PH_PRI_TYPE_NUM_BITS 1
110 #define PH_PRI_TYPE_VALUE 0
111 
112 #define PH_PRI_SEC_HDR_FLAG_BYTE_OFFSET 0
113 #define PH_PRI_SEC_HDR_FLAG_BIT_OFFSET 4
114 #define PH_PRI_SEC_HDR_FLAG_NUM_BITS 1
115 #define PH_PRI_SEC_HDR_PRESENT 1
116 
117 #define PH_PRI_APID_BYTE_OFFSET 0
118 #define PH_PRI_APID_BIT_OFFSET 5
119 #define PH_PRI_APID_NUM_BITS 11
120 #define PH_PRI_MIN_MODIS_APID_AM1 64
121 #define PH_PRI_MAX_MODIS_APID_AM1 127
122 #define PH_PRI_APID_TEST_PACKET 127
123 
124 #define PH_PRI_SEQUENCE_FLAG_BYTE_OFFSET 2
125 #define PH_PRI_SEQUENCE_FLAG_BIT_OFFSET 0
126 #define PH_PRI_SEQUENCE_FLAG_NUM_BITS 2
127 #define PH_PRI_SEQUENCE_FIRST_PKT_IN_GROUP 1
128 #define PH_PRI_SEQUENCE_SECOND_PKT_IN_GROUP 2
129 #define PH_PRI_SEQUENCE_ONLY_PKT_IN_GROUP 3
130 #define PH_PRI_SEQUENCE_NOT_USED 0
131 
132 #define PH_PRI_SOURCE_SEQ_CNT_BYTE_OFFSET 2
133 #define PH_PRI_SOURCE_SEQ_CNT_BIT_OFFSET 2
134 #define PH_PRI_SOURCE_SEQ_CNT_NUM_BITS 14
135 #define PH_PRI_MAX_CCSDS_PKT_SEQ_COUNT 16383
136 
137 #define PH_PRI_PKT_LENGTH_BYTE_OFFSET 4
138 #define PH_PRI_PKT_LENGTH_BIT_OFFSET 0
139 #define PH_PRI_PKT_LENGTH_NUM_BITS 16
140 #define PH_PRI_LONG_PKT_LENGTH 635
141 #define PH_PRI_SHORT_PKT_LENGTH 269
142 
143 
144 /*********************************************************/
145 /* The following byte/bit offset and value information */
146 /* is for the secondary header. */
147 /*********************************************************/
148 
149 #define PH_SEC_TIME_TAG_BYTE_OFFSET 6
150 #define PH_SEC_TIME_TAG_NUM_BYTES 8
151 
152 #define PH_SEC_QUICK_LOOK_FLAG_BYTE_OFFSET 14
153 #define PH_SEC_QUICK_LOOK_FLAG_BIT_OFFSET 0
154 #define PH_SEC_QUICK_LOOK_FLAG_NUM_BITS 1
155 #define PH_SEC_QUICK_LOOK_FLAG_SET 1
156 #define PH_SEC_QUICK_LOOK_FLAG_NOT_SET 0
157 
158 #define PH_SEC_PKT_TYPE_BYTE_OFFSET 14
159 #define PH_SEC_PKT_TYPE_BIT_OFFSET 1
160 #define PH_SEC_PKT_TYPE_NUM_BITS 3
161 #define PH_SEC_PKT_TYPE_DAY_GROUP 0
162 #define PH_SEC_PKT_TYPE_NIGHT_GROUP 1
163 #define PH_SEC_PKT_TYPE_ENG1_GROUP 2
164 #define PH_SEC_PKT_TYPE_ENG2_GROUP 4
165 #define PH_SEC_PKT_TYPE_SPARE 3
166 #define PH_SEC_PKT_TYPE_MAX_PKTS_IN_GROUP 2
167 
168 #define PH_SEC_SCAN_CNT_BYTE_OFFSET 14
169 #define PH_SEC_SCAN_CNT_BIT_OFFSET 4
170 #define PH_SEC_SCAN_CNT_NUM_BITS 3
171 #define PH_SEC_SCAN_CNT_MAX 7
172 
173 #define PH_SEC_MIRROR_SIDE_BYTE_OFFSET 14
174 #define PH_SEC_MIRROR_SIDE_BIT_OFFSET 7
175 #define PH_SEC_MIRROR_SIDE_NUM_BITS 1
176 #define PH_SEC_MIRROR_SIDE_1 0
177 #define PH_SEC_MIRROR_SIDE_2 1
178 
179 
180 /*********************************************************/
181 /* The following byte/bit offset and value information */
182 /* is for the MODIS header. */
183 /*********************************************************/
184 
185 #define PH_MOD_SOURCE_ID_TYPE_FLAG_BYTE_OFFSET 15
186 #define PH_MOD_SOURCE_ID_TYPE_FLAG_BIT_OFFSET 0
187 #define PH_MOD_SOURCE_ID_TYPE_FLAG_NUM_BITS 1
188 #define PH_MOD_SOURCE_ID_TYPE_FLAG_EARTH 0
189 #define PH_MOD_SOURCE_ID_TYPE_FLAG_CAL 1
190 
191 #define PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_BYTE_OFFSET 15
192 #define PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_BIT_OFFSET 1
193 #define PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_NUM_BITS 11
194 #define PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_MAX 2048
195 #define PH_MOD_SOURCE_ID_EARTH_FRAME_CNT_LIMIT 1400
196 
197 #define PH_MOD_SOURCE_ID_CAL_TYPE_BYTE_OFFSET 15
198 #define PH_MOD_SOURCE_ID_CAL_TYPE_BIT_OFFSET 1
199 #define PH_MOD_SOURCE_ID_CAL_TYPE_NUM_BITS 2
200 #define PH_MOD_SOURCE_ID_CAL_TYPE_SOLAR_DIFFUSER_SOURCE 0
201 #define PH_MOD_SOURCE_ID_CAL_TYPE_SRCA_CAL_SOURCE 1
202 #define PH_MOD_SOURCE_ID_CAL_TYPE_BLACKBODY_SOURCE 2
203 #define PH_MOD_SOURCE_ID_CAL_TYPE_SPACE_SOURCE 3
204 
205 #define PH_MOD_SOURCE_ID_CAL_MODE_BYTE_OFFSET 15
206 #define PH_MOD_SOURCE_ID_CAL_MODE_BIT_OFFSET 3
207 #define PH_MOD_SOURCE_ID_CAL_MODE_NUM_BITS 2
208 #define PH_MOD_SOURCE_ID_CAL_MODE_RADIOMETRIC_CAL_MODE 0
209 #define PH_MOD_SOURCE_ID_CAL_MODE_SPATIAL_CAL_MODE 1
210 #define PH_MOD_SOURCE_ID_CAL_MODE_SPECTRAL_CAL_MODE 2
211 #define PH_MOD_SOURCE_ID_CAL_MODE_NON_CAL_MODE 3
212 
213 #define PH_MOD_SOURCE_ID_CAL_FRAME_CNT_BYTE_OFFSET 15
214 #define PH_MOD_SOURCE_ID_CAL_FRAME_CNT_BIT_OFFSET 6
215 #define PH_MOD_SOURCE_ID_CAL_FRAME_CNT_NUM_BITS 6
216 #define PH_MOD_SOURCE_ID_CAL_FRAME_CNT_MAX 64
217 
218 #define PH_MOD_FPA_AEM_CONFIG_BYTE_OFFSET 16
219 #define PH_MOD_FPA_AEM_CONFIG_BIT_OFFSET 4
220 #define PH_MOD_FPA_AEM_CONFIG_NUM_BITS 1
221 #define PH_MOD_FPA_AEM_CONFIG_NUM_ELEMENTS 10
222 
223 #define PH_MOD_SCI_STATE_BYTE_OFFSET 17
224 #define PH_MOD_SCI_STATE_BIT_OFFSET 6
225 #define PH_MOD_SCI_STATE_NUM_BITS 1
226 #define PH_MOD_SCI_STATE_TEST 0
227 #define PH_MOD_SCI_STATE_NORMAL 1
228 
229 #define PH_MOD_SCI_ABNORM_BYTE_OFFSET 17
230 #define PH_MOD_SCI_ABNORM_BIT_OFFSET 7
231 #define PH_MOD_SCI_ABNORM_NUM_BITS 1
232 #define PH_MOD_SCI_ABNORM_TEST 0
233 #define PH_MOD_SCI_ABNORM_NORMAL 1
234 
235 
236 /*********************************************************/
237 /* The following structure defines the entire packet */
238 /* header. */
239 /*********************************************************/
240 
241 typedef struct
242  {
243  int8 version;
244  int8 type;
250  PGSt_scTime pkt_time_code[8];
251  PGSt_double pkt_TAI_time;
252  int8 QL_flag;
253  int8 pkt_type;
254  int8 scan_cnt;
258  int8 cal_type;
259  int8 cal_mode;
262  int8 sci_state;
264 
266 
267 
268 #endif /* PH_PKT_HDR_H */
integer, parameter int16
Definition: cubeio.f90:3
PGSt_double pkt_TAI_time
Definition: PH_pkt_hdr.h:251
#define PH_MOD_FPA_AEM_CONFIG_NUM_ELEMENTS
Definition: PH_pkt_hdr.h:221