##// END OF EJS Templates
Many corrections, mainly related to 807 Don_Enumeration
paul -
r56:6bab694410c6 default
parent child
Show More
@@ -1,807 +1,893
1 1 #ifndef CCSDS_TYPES_H_INCLUDED
2 2 #define CCSDS_TYPES_H_INCLUDED
3 3
4 #define TXBDCNT 50
5 #define RXBDCNT 10
6 #define TXDATASIZE 4096
7 #define TXHDRSIZE 34
8 #define RXPKTSIZE 200
9
10 #define SPW_RXSIZE 228
11 #define SPW_TXDSIZE 4096
12 #define SPW_TXHSIZE 34
13
14 #define BITS_PID_0 0x07
15 #define BITS_PID_1 0x0f
16 #define BITS_CAT 0x0f
17
4 18 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
5 #define CCSDS_TC_TM_PACKET_OFFSET 7
19 #define CCSDS_TC_TM_PACKET_OFFSET 7
20 #define PROTID_RES_APP 3
6 21 #define CCSDS_TELEMETRY_HEADER_LENGTH (16+4)
7 22 #define CCSDS_TM_PKT_MAX_SIZE 4412
8 23 #define CCSDS_TELECOMMAND_HEADER_LENGTH (10+4)
9 24 #define CCSDS_TC_PKT_MAX_SIZE (228+3) // => 3 is for Prot ID, Reserved and User App bytes
10 25 #define CCSDS_TC_PKT_MIN_SIZE 16
11 26 #define CCSDS_PROCESS_ID 76
12 27 #define CCSDS_PACKET_CATEGORY 12
13 28 #define CCSDS_NODE_ADDRESS 0xfe
14 29 #define CCSDS_USER_APP 0x00
15 30
16 31 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
17 32 #define DEFAULT_RESERVED 0x00
18 33 #define DEFAULT_HKBIA 0x1e // 0001 1110
19 34
20 35 // PACKET ID
21 36 #define TM_PACKET_PID_DEFAULT 76
22 37 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
23 38 #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1
24 39 #define APID_TM_HK 0x0cc4 // PID 76 CAT 4
25 40 #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
26 41 #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
27 42 #define APID_TM_PARAMETER_DUMP 0x0cc6 // PID 76 CAT 6
28 43 #define APID_TM_KCOEFFICIENTS_DUMP 0x0cc6 // PID 76 CAT 6
44
29 45 // PACKET CAT
30 46 #define TM_PACKET_CAT_TC_EXE 1
31 47 #define TM_PACKET_CAT_HK 4
32 48 #define TM_PACKET_CAT_SCIENCE 12
33 49 #define TM_PACKET_CAT_DUMP 6
34 50
35 51 // PACKET SEQUENCE CONTROL
36 52 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
37 53 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
38 54 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
39 55 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
40 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
56 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
57 #define TM_PACKET_SEQ_SHIFT 8
58 #define SEQ_CNT_MAX 16383
59 #define SEQ_CNT_NB_DEST_ID 12
60 #define SEQ_CNT_MASK 0x3fff // [0011 1111 1111 1111]
41 61
42 62 // DESTINATION ID
43 63 #define TM_DESTINATION_ID_GROUND 0
44 64 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
45 65 #define TM_DESTINATION_ID_TC_SEQUENCES 111
46 66 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
47 67 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
48 68 #define TM_DESTINATION_ID_DIRECT_CMD 120
49 69 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
50 70 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
51 71 #define TM_DESTINATION_ID_OBCP 15
52 72 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
53 73 #define TM_DESTINATION_ID_AOCS 11
54 74
55 75 //*********************************************************
56 76 //*** /!\ change CCSDS_DESTINATION_ID before flight /!\ ***
57 77 //*********************************************************
58 78 #ifdef LPP_DPU_DESTID
59 79 #define CCSDS_DESTINATION_ID 32
60 80 #else
61 81 #define CCSDS_DESTINATION_ID 0x01
62 82 #endif
63 83 #define CCSDS_PROTOCOLE_ID 0x02
64 84 #define CCSDS_RESERVED 0x00
65 85 #define CCSDS_USER_APP 0x00
66 86
67 87 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
68 88 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
69 89 #define SIZE_HK_PARAMETERS 112
70 90
71 91 // TC TYPES
72 92 #define TC_TYPE_GEN 181
73 93 #define TC_TYPE_TIME 9
74 94
75 95 // TC SUBTYPES
76 96 #define TC_SUBTYPE_RESET 1
77 97 #define TC_SUBTYPE_LOAD_COMM 11
78 98 #define TC_SUBTYPE_LOAD_NORM 13
79 99 #define TC_SUBTYPE_LOAD_BURST 19
80 100 #define TC_SUBTYPE_LOAD_SBM1 25
81 101 #define TC_SUBTYPE_LOAD_SBM2 27
82 102 #define TC_SUBTYPE_DUMP 31
83 103 #define TC_SUBTYPE_ENTER 41
84 104 #define TC_SUBTYPE_UPDT_INFO 51
85 105 #define TC_SUBTYPE_EN_CAL 61
86 106 #define TC_SUBTYPE_DIS_CAL 63
87 107 #define TC_SUBTYPE_LOAD_K 93
88 108 #define TC_SUBTYPE_DUMP_K 95
89 109 #define TC_SUBTYPE_LOAD_FBINS 91
90 110 #define TC_SUBTYPE_LOAD_FILTER_PAR 97
91 111 #define TC_SUBTYPE_UPDT_TIME 129
92 112
93 113 // TC LEN
94 114 #define TC_LEN_RESET 12
95 115 #define TC_LEN_LOAD_COMM 14
96 116 #define TC_LEN_LOAD_NORM 22
97 117 #define TC_LEN_LOAD_BURST 14
98 118 #define TC_LEN_LOAD_SBM1 14
99 119 #define TC_LEN_LOAD_SBM2 14
100 120 #define TC_LEN_DUMP 12
101 121 #define TC_LEN_ENTER 20
102 122 #define TC_LEN_UPDT_INFO 110
103 123 #define TC_LEN_EN_CAL 12
104 124 #define TC_LEN_DIS_CAL 12
105 125 #define TC_LEN_LOAD_K 142
106 126 #define TC_LEN_DUMP_K 12
107 127 #define TC_LEN_LOAD_FBINS 60
108 128 #define TC_LEN_LOAD_FILTER_PAR 28
109 129 #define TC_LEN_UPDT_TIME 18
110 130
111 131 // PACKET CODES
112 132 #define TM_CODE_K_DUMP 0xb5600b00 // 181 (0xb5) ** 96 (0x60) ** 11 (0x0b) ** 0 (0x00)
113 133
114 134 // TM TYPES
115 135 #define TM_TYPE_TC_EXE 1
116 136 #define TM_TYPE_HK 3
117 137 #define TM_TYPE_LFR_SCIENCE 21
118 138 #define TM_TYPE_PARAMETER_DUMP 181
119 139 #define TM_TYPE_K_DUMP 181
120 140
121 141 // TM SUBTYPES
122 142 #define TM_SUBTYPE_EXE_OK 7
123 143 #define TM_SUBTYPE_EXE_NOK 8
124 144 #define TM_SUBTYPE_HK 25
125 145 #define TM_SUBTYPE_LFR_SCIENCE_3 3 // TM packets with fixed size
126 146 #define TM_SUBTYPE_LFR_SCIENCE_6 6 // TM packets with variable size
127 147 #define TM_SUBTYPE_PARAMETER_DUMP 32
128 148 #define TM_SUBTYPE_K_DUMP 96
129 149
130 150 // FAILURE CODES
131 151 #define ILLEGAL_APID 0
132 152 #define WRONG_LEN_PKT 1
133 153 #define INCOR_CHECKSUM 2
134 154 #define ILL_TYPE 3
135 155 #define ILL_SUBTYPE 4
136 156 #define WRONG_APP_DATA 5 // 0x00 0x05
137 157 #define TC_NOT_EXE 42000 // 0xa4 0x10
138 158 #define WRONG_SRC_ID 42001 // 0xa4 0x11
139 159 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
140 160 #define FAIL_DETECTED 42003 // 0xa4 0x13
141 161 #define NOT_ALLOWED 42004 // 0xa4 0x14
142 162 #define CORRUPTED 42005 // 0xa4 0x15
143 163 #define CCSDS_TM_VALID 7
144 164
145 165 // HK_LFR_LAST_ER_RID
146 166 #define RID_LE_LFR_TIME 42119
147 167 #define RID_LE_LFR_DPU_SPW 42128
148 168 #define RID_LE_LFR_TIMEC 42129
149 169 #define RID_ME_LFR_DPU_SPW 42338
150 170 // HK_LFR_LAST_ER_CODE
151 171 #define CODE_PARITY 1
152 172 #define CODE_DISCONNECT 2
153 173 #define CODE_ESCAPE 3
154 174 #define CODE_CREDIT 4
155 175 #define CODE_WRITE_SYNC 5
156 176 #define CODE_EARLY_EOP_EEP 6
157 177 #define CODE_INVALID_ADDRESS 7
158 178 #define CODE_EEP 8
159 179 #define CODE_RX_TOO_BIG 9
160 180 #define CODE_HEADER_CRC 16
161 181 #define CODE_DATA_CRC 17
162 182 #define CODE_ERRONEOUS 20
163 183 #define CODE_MISSING 21
164 184 #define CODE_INVALID 22
165 185 #define CODE_TIMECODE_IT 24
166 186 #define CODE_NOT_SYNCHRO 25
167 187 #define CODE_TIMECODE_CTR 26
168 188
169 189 // TC SID
170 190 #define SID_TC_GROUND 0
171 191 #define SID_TC_MISSION_TIMELINE 110
172 192 #define SID_TC_TC_SEQUENCES 111
173 193 #define SID_TC_RECOVERY_ACTION_CMD 112
174 194 #define SID_TC_BACKUP_MISSION_TIMELINE 113
175 195 #define SID_TC_DIRECT_CMD 120
176 196 #define SID_TC_SPARE_GRD_SRC1 121
177 197 #define SID_TC_SPARE_GRD_SRC2 122
178 198 #define SID_TC_OBCP 15
179 199 #define SID_TC_SYSTEM_CONTROL 14
180 200 #define SID_TC_AOCS 11
181 201 #define SID_TC_RPW_INTERNAL 254
182 202
183 203 enum apid_destid{
184 204 GROUND,
185 205 MISSION_TIMELINE,
186 206 TC_SEQUENCES,
187 207 RECOVERY_ACTION_CMD,
188 208 BACKUP_MISSION_TIMELINE,
189 209 DIRECT_CMD,
190 210 SPARE_GRD_SRC1,
191 211 SPARE_GRD_SRC2,
192 212 OBCP,
193 213 SYSTEM_CONTROL,
194 214 AOCS,
195 215 RPW_INTERNAL
196 216 };
197 // SEQUENCE COUNTERS
198 #define SEQ_CNT_MAX 16383
199 #define SEQ_CNT_NB_DEST_ID 12
200 217
201 218 // TM SID
202 219 #define SID_HK 1
203 220
204 221 #define SID_NORM_SWF_F0 3
205 222 #define SID_NORM_SWF_F1 4
206 223 #define SID_NORM_SWF_F2 5
207 224 #define SID_NORM_CWF_F3 1
208 225 #define SID_BURST_CWF_F2 2
209 226 #define SID_SBM1_CWF_F1 24
210 227 #define SID_SBM2_CWF_F2 25
211 228 #define SID_NORM_ASM_F0 11
212 229 #define SID_NORM_ASM_F1 12
213 230 #define SID_NORM_ASM_F2 13
214 231 #define SID_NORM_BP1_F0 14
215 232 #define SID_NORM_BP1_F1 15
216 233 #define SID_NORM_BP1_F2 16
217 234 #define SID_NORM_BP2_F0 19
218 235 #define SID_NORM_BP2_F1 20
219 236 #define SID_NORM_BP2_F2 21
220 237 #define SID_BURST_BP1_F0 17
221 238 #define SID_BURST_BP2_F0 22
222 239 #define SID_BURST_BP1_F1 18
223 240 #define SID_BURST_BP2_F1 23
224 241 #define SID_SBM1_BP1_F0 28
225 242 #define SID_SBM1_BP2_F0 31
226 243 #define SID_SBM2_BP1_F0 29
227 244 #define SID_SBM2_BP2_F0 32
228 245 #define SID_SBM2_BP1_F1 30
229 246 #define SID_SBM2_BP2_F1 33
230 247 #define SID_NORM_CWF_LONG_F3 34
231 248
232 249 #define SID_PARAMETER_DUMP 10
233 250 #define SID_K_DUMP 11
234 251
235 252 // HEADER_LENGTH
236 253 //#define TM_HEADER_LEN 16
237 254 #define HEADER_LENGTH_TM_LFR_SCIENCE_CWF 32
238 255 #define HEADER_LENGTH_TM_LFR_SCIENCE_SWF 34
239 256 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 34
240 257 // PACKET_LENGTH
241 258 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
242 259 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
243 260 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
244 261 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
245 262 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
246 263 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
247 264 #define PACKET_LENGTH_HK (136 - CCSDS_TC_TM_PACKET_OFFSET)
248 265 #define PACKET_LENGTH_PARAMETER_DUMP (148 - CCSDS_TC_TM_PACKET_OFFSET)
249 266 #define PACKET_LENGTH_K_DUMP (3920 - CCSDS_TC_TM_PACKET_OFFSET)
250 267 // SCIENCE ASM
251 268 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0_1 (3230 - CCSDS_TC_TM_PACKET_OFFSET) // 32 * 25 * 4 + 30 => 32 bins (32 + 32 + 24 ), 3 packets
252 269 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0_2 (2430 - CCSDS_TC_TM_PACKET_OFFSET) // 24 * 25 * 4 + 30 => 24 bins (32 + 32 + 24 ), 3 packets
253 270 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1_1 (3630 - CCSDS_TC_TM_PACKET_OFFSET) // 36 * 25 * 4 + 30 => 36 bins (36 + 36 + 32 ), 3 packets
254 271 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1_2 (3230 - CCSDS_TC_TM_PACKET_OFFSET) // 32 * 25 * 4 + 30 => 32 bins (36 + 36 + 32 ), 3 packets
255 272 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (3230 - CCSDS_TC_TM_PACKET_OFFSET) // 32 * 25 * 4 + 30 => 96 bins (32 + 32 + 32 ), 3 packets
256 273 // SCIENCE NORM
257 274 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (150 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 11 + 29 (1 spare byte in the header)
258 275 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (172 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 11 + 29 (1 spare byte in the header)
259 276 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 (160 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 11 + 28
260 277 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (358 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 28
261 278 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (418 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 28
262 279 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 (388 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 30 + 28
263 280 // SCIENCE SBM
264 281 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (270 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 11 + 28
265 282 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (688 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 28
266 283 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (314 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 11 + 28
267 284 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (808 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 28
268 285
269 286 #define PACKET_LENGTH_DELTA 11 // 7 + 4
270 287
271 288 #define SPARE1_PUSVERSION_SPARE2 0x10
272 289
273 290 // R3
274 291 // one snapshot = 2048 samples = 6 packets * 304 + 224
275 292 #define TM_LEN_SCI_SWF_304 (3678 - CCSDS_TC_TM_PACKET_OFFSET) // 304 * 12 + 30
276 293 #define TM_LEN_SCI_SWF_224 (2718 - CCSDS_TC_TM_PACKET_OFFSET) // 224 * 12 + 30
277 294 // one continuous buffer = 2688 samples = 8 packets * 336
278 295 #define TM_LEN_SCI_CWF_336 (4060 - CCSDS_TC_TM_PACKET_OFFSET) // 336 * 12 + 28
279 296 #define TM_LEN_SCI_CWF_672 (4060 - CCSDS_TC_TM_PACKET_OFFSET) // 672 * 6 + 28
280 297 //
281 #define DEFAULT_PKTCNT 0x07
298 #define PKTCNT_SWF 0x07
299 #define PKTCNT_ASM 3
282 300 #define BLK_NR_304 0x0130
283 301 #define BLK_NR_224 0x00e0
284 302 #define BLK_NR_CWF 0x0150 // 336
285 303 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
286 304
287 305 enum TM_TYPE{
288 306 TM_LFR_TC_EXE_OK,
289 307 TM_LFR_TC_EXE_ERR,
290 308 TM_LFR_HK,
291 309 TM_LFR_SCI,
292 310 TM_LFR_SCI_SBM,
293 311 TM_LFR_PAR_DUMP
294 312 };
295 313
314 #define BYTES_PER_PACKETID 2
315 #define BYTES_PER_SEQ_CTRL 2
316 #define BYTES_PER_PKT_LEN 2
317 #define BYTES_PER_TIME 6
318 #define BYTES_PER_ERR_CODE 2
319 #define BYTES_PER_STA_WRD 2
320 #define BYTES_PER_CRC 2
321 #define BYTES_PER_BLKNR 2
322 #define BYTES_PER_SW_VER 4
323 #define BYTES_PER_VHD_VER 3
324 #define COUNTER_2_BYTES 2
325 #define BYTES_PER_TYPE 2
326 #define BYTES_PER_SUBTYPE 2
327 #define BYTES_PER_ADDR 4
328 #define BYTES_PER_TEMP 2
329 #define BYTES_PER_V 2
330 #define BYTES_PER_WORD 4
331 #define BYTES_PER_MASK 16
332 #define BYTES_PER_MASKS_SET 48 // 4 * 4 * 3
333
334 #define COUNTER_2_BYTES 2
335 #define PARAM_2_BYTES 2
336 #define PARAM_4_BYTES 4
337
296 338 typedef struct {
297 339 unsigned char targetLogicalAddress;
298 340 unsigned char protocolIdentifier;
299 341 unsigned char reserved;
300 342 unsigned char userApplication;
301 343 // PACKET HEADER
302 unsigned char packetID[2];
303 unsigned char packetSequenceControl[2];
304 unsigned char packetLength[2];
344 unsigned char packetID[BYTES_PER_PACKETID];
345 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
346 unsigned char packetLength[BYTES_PER_PKT_LEN];
305 347 // DATA FIELD HEADER
306 348 unsigned char spare1_pusVersion_spare2;
307 349 unsigned char serviceType;
308 350 unsigned char serviceSubType;
309 351 unsigned char destinationID;
310 unsigned char time[6];
352 unsigned char time[BYTES_PER_TIME];
311 353 //
312 unsigned char telecommand_pkt_id[2];
313 unsigned char pkt_seq_control[2];
354 unsigned char telecommand_pkt_id[BYTES_PER_PACKETID];
355 unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL];
314 356 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
315 357
316 358 typedef struct {
317 359 unsigned char targetLogicalAddress;
318 360 unsigned char protocolIdentifier;
319 361 unsigned char reserved;
320 362 unsigned char userApplication;
321 363 // PACKET HEADER
322 unsigned char packetID[2];
323 unsigned char packetSequenceControl[2];
324 unsigned char packetLength[2];
364 unsigned char packetID[BYTES_PER_PACKETID];
365 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
366 unsigned char packetLength[BYTES_PER_PKT_LEN];
325 367 // DATA FIELD HEADER
326 368 unsigned char spare1_pusVersion_spare2;
327 369 unsigned char serviceType;
328 370 unsigned char serviceSubType;
329 371 unsigned char destinationID;
330 unsigned char time[6];
372 unsigned char time[BYTES_PER_TIME];
331 373 //
332 unsigned char telecommand_pkt_id[2];
333 unsigned char pkt_seq_control[2];
334 unsigned char tc_failure_code[2];
374 unsigned char telecommand_pkt_id[BYTES_PER_PACKETID];
375 unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL];
376 unsigned char tc_failure_code[BYTES_PER_ERR_CODE];
335 377 unsigned char tc_service;
336 378 unsigned char tc_subtype;
337 379 unsigned char byte_position;
338 380 unsigned char rcv_value;
339 381 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
340 382
341 383 typedef struct {
342 384 unsigned char targetLogicalAddress;
343 385 unsigned char protocolIdentifier;
344 386 unsigned char reserved;
345 387 unsigned char userApplication;
346 388 // PACKET HEADER
347 unsigned char packetID[2];
348 unsigned char packetSequenceControl[2];
349 unsigned char packetLength[2];
389 unsigned char packetID[BYTES_PER_PACKETID];
390 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
391 unsigned char packetLength[BYTES_PER_PKT_LEN];
350 392 // DATA FIELD HEADER
351 393 unsigned char spare1_pusVersion_spare2;
352 394 unsigned char serviceType;
353 395 unsigned char serviceSubType;
354 396 unsigned char destinationID;
355 unsigned char time[6];
397 unsigned char time[BYTES_PER_TIME];
356 398 //
357 unsigned char telecommand_pkt_id[2];
358 unsigned char pkt_seq_control[2];
359 unsigned char tc_failure_code[2];
399 unsigned char telecommand_pkt_id[BYTES_PER_PACKETID];
400 unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL];
401 unsigned char tc_failure_code[BYTES_PER_ERR_CODE];
360 402 unsigned char tc_service;
361 403 unsigned char tc_subtype;
362 404 unsigned char lfr_status_word[2];
363 405 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
364 406
365 407 typedef struct {
366 408 unsigned char targetLogicalAddress;
367 409 unsigned char protocolIdentifier;
368 410 unsigned char reserved;
369 411 unsigned char userApplication;
370 412 // PACKET HEADER
371 unsigned char packetID[2];
372 unsigned char packetSequenceControl[2];
373 unsigned char packetLength[2];
413 unsigned char packetID[BYTES_PER_PACKETID];
414 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
415 unsigned char packetLength[BYTES_PER_PKT_LEN];
374 416 // DATA FIELD HEADER
375 417 unsigned char spare1_pusVersion_spare2;
376 418 unsigned char serviceType;
377 419 unsigned char serviceSubType;
378 420 unsigned char destinationID;
379 unsigned char time[6];
421 unsigned char time[BYTES_PER_TIME];
380 422 //
381 unsigned char telecommand_pkt_id[2];
382 unsigned char pkt_seq_control[2];
383 unsigned char tc_failure_code[2];
423 unsigned char telecommand_pkt_id[BYTES_PER_PACKETID];
424 unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL];
425 unsigned char tc_failure_code[BYTES_PER_ERR_CODE];
384 426 unsigned char tc_service;
385 427 unsigned char tc_subtype;
386 428 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
387 429
388 430 typedef struct {
389 431 unsigned char targetLogicalAddress;
390 432 unsigned char protocolIdentifier;
391 433 unsigned char reserved;
392 434 unsigned char userApplication;
393 435 // PACKET HEADER
394 unsigned char packetID[2];
395 unsigned char packetSequenceControl[2];
396 unsigned char packetLength[2];
436 unsigned char packetID[BYTES_PER_PACKETID];
437 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
438 unsigned char packetLength[BYTES_PER_PKT_LEN];
397 439 // DATA FIELD HEADER
398 440 unsigned char spare1_pusVersion_spare2;
399 441 unsigned char serviceType;
400 442 unsigned char serviceSubType;
401 443 unsigned char destinationID;
402 unsigned char time[6];
444 unsigned char time[BYTES_PER_TIME];
403 445 //
404 unsigned char telecommand_pkt_id[2];
405 unsigned char pkt_seq_control[2];
406 unsigned char tc_failure_code[2];
446 unsigned char telecommand_pkt_id[BYTES_PER_PACKETID];
447 unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL];
448 unsigned char tc_failure_code[BYTES_PER_ERR_CODE];
407 449 unsigned char tc_service;
408 450 unsigned char tc_subtype;
409 451 } Packet_TM_LFR_TC_EXE_ERROR_t;
410 452
411 453 typedef struct {
412 454 unsigned char targetLogicalAddress;
413 455 unsigned char protocolIdentifier;
414 456 unsigned char reserved;
415 457 unsigned char userApplication;
416 458 // PACKET HEADER
417 unsigned char packetID[2];
418 unsigned char packetSequenceControl[2];
419 unsigned char packetLength[2];
459 unsigned char packetID[BYTES_PER_PACKETID];
460 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
461 unsigned char packetLength[BYTES_PER_PKT_LEN];
420 462 // DATA FIELD HEADER
421 463 unsigned char spare1_pusVersion_spare2;
422 464 unsigned char serviceType;
423 465 unsigned char serviceSubType;
424 466 unsigned char destinationID;
425 unsigned char time[6];
467 unsigned char time[BYTES_PER_TIME];
426 468 //
427 unsigned char telecommand_pkt_id[2];
428 unsigned char pkt_seq_control[2];
429 unsigned char tc_failure_code[2];
469 unsigned char telecommand_pkt_id[BYTES_PER_PACKETID];
470 unsigned char pkt_seq_control[BYTES_PER_SEQ_CTRL];
471 unsigned char tc_failure_code[BYTES_PER_ERR_CODE];
430 472 unsigned char tc_service;
431 473 unsigned char tc_subtype;
432 unsigned char pkt_len_rcv_value[2];
433 unsigned char pkt_datafieldsize_cnt[2];
434 unsigned char rcv_crc[2];
435 unsigned char computed_crc[2];
474 unsigned char pkt_len_rcv_value[BYTES_PER_PKT_LEN];
475 unsigned char pkt_datafieldsize_cnt[BYTES_PER_PKT_LEN];
476 unsigned char rcv_crc[BYTES_PER_CRC];
477 unsigned char computed_crc[BYTES_PER_CRC];
436 478 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
437 479
438 480 typedef struct {
439 481 unsigned char targetLogicalAddress;
440 482 unsigned char protocolIdentifier;
441 483 unsigned char reserved;
442 484 unsigned char userApplication;
443 unsigned char packetID[2];
444 unsigned char packetSequenceControl[2];
445 unsigned char packetLength[2];
485 unsigned char packetID[BYTES_PER_PACKETID];
486 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
487 unsigned char packetLength[BYTES_PER_PKT_LEN];
446 488 // DATA FIELD HEADER
447 489 unsigned char spare1_pusVersion_spare2;
448 490 unsigned char serviceType;
449 491 unsigned char serviceSubType;
450 492 unsigned char destinationID;
451 unsigned char time[6];
493 unsigned char time[BYTES_PER_TIME];
452 494 // AUXILIARY HEADER
453 495 unsigned char sid;
454 496 unsigned char pa_bia_status_info;
455 497 unsigned char sy_lfr_common_parameters_spare;
456 498 unsigned char sy_lfr_common_parameters;
457 499 unsigned char pktCnt;
458 500 unsigned char pktNr;
459 unsigned char acquisitionTime[6];
460 unsigned char blkNr[2];
501 unsigned char acquisitionTime[BYTES_PER_TIME];
502 unsigned char blkNr[BYTES_PER_BLKNR];
461 503 } Header_TM_LFR_SCIENCE_SWF_t;
462 504
505 //*******************
506 // TM_LFR_SCIENCE_CWF
507
508 #define CWF_BLK_SIZE 6
509
463 510 typedef struct {
464 511 unsigned char targetLogicalAddress;
465 512 unsigned char protocolIdentifier;
466 513 unsigned char reserved;
467 514 unsigned char userApplication;
468 unsigned char packetID[2];
469 unsigned char packetSequenceControl[2];
470 unsigned char packetLength[2];
515 unsigned char packetID[BYTES_PER_PACKETID];
516 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
517 unsigned char packetLength[BYTES_PER_PKT_LEN];
471 518 // DATA FIELD HEADER
472 519 unsigned char spare1_pusVersion_spare2;
473 520 unsigned char serviceType;
474 521 unsigned char serviceSubType;
475 522 unsigned char destinationID;
476 unsigned char time[6];
523 unsigned char time[BYTES_PER_TIME];
477 524 // AUXILIARY DATA HEADER
478 525 unsigned char sid;
479 526 unsigned char pa_bia_status_info;
480 527 unsigned char sy_lfr_common_parameters_spare;
481 528 unsigned char sy_lfr_common_parameters;
482 unsigned char acquisitionTime[6];
483 unsigned char blkNr[2];
529 unsigned char acquisitionTime[BYTES_PER_TIME];
530 unsigned char blkNr[BYTES_PER_BLKNR];
484 531 } Header_TM_LFR_SCIENCE_CWF_t;
485 532
486 533 typedef struct {
487 534 unsigned char targetLogicalAddress;
488 535 unsigned char protocolIdentifier;
489 536 unsigned char reserved;
490 537 unsigned char userApplication;
491 unsigned char packetID[2];
492 unsigned char packetSequenceControl[2];
493 unsigned char packetLength[2];
538 unsigned char packetID[BYTES_PER_PACKETID];
539 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
540 unsigned char packetLength[BYTES_PER_PKT_LEN];
494 541 // DATA FIELD HEADER
495 542 unsigned char spare1_pusVersion_spare2;
496 543 unsigned char serviceType;
497 544 unsigned char serviceSubType;
498 545 unsigned char destinationID;
499 unsigned char time[6];
546 unsigned char time[BYTES_PER_TIME];
500 547 // AUXILIARY HEADER
501 548 unsigned char sid;
502 549 unsigned char pa_bia_status_info;
503 550 unsigned char sy_lfr_common_parameters_spare;
504 551 unsigned char sy_lfr_common_parameters;
505 552 unsigned char pa_lfr_pkt_cnt_asm;
506 553 unsigned char pa_lfr_pkt_nr_asm;
507 unsigned char acquisitionTime[6];
508 unsigned char pa_lfr_asm_blk_nr[2];
554 unsigned char acquisitionTime[BYTES_PER_TIME];
555 unsigned char pa_lfr_asm_blk_nr[BYTES_PER_BLKNR];
509 556 } Header_TM_LFR_SCIENCE_ASM_t;
510 557
511 558 typedef struct {
512 559 unsigned char targetLogicalAddress;
513 560 unsigned char protocolIdentifier;
514 561 unsigned char reserved;
515 562 unsigned char userApplication;
516 unsigned char packetID[2];
517 unsigned char packetSequenceControl[2];
518 unsigned char packetLength[2];
563 unsigned char packetID[BYTES_PER_PACKETID];
564 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
565 unsigned char packetLength[BYTES_PER_PKT_LEN];
519 566 // DATA FIELD HEADER
520 567 unsigned char spare1_pusVersion_spare2;
521 568 unsigned char serviceType;
522 569 unsigned char serviceSubType;
523 570 unsigned char destinationID;
524 unsigned char time[6];
571 unsigned char time[BYTES_PER_TIME];
525 572 // AUXILIARY HEADER
526 573 unsigned char sid;
527 574 unsigned char pa_bia_status_info;
528 575 unsigned char sy_lfr_common_parameters_spare;
529 576 unsigned char sy_lfr_common_parameters;
530 unsigned char acquisitionTime[6];
577 unsigned char acquisitionTime[BYTES_PER_TIME];
531 578 unsigned char source_data_spare;
532 unsigned char pa_lfr_bp_blk_nr[2];
579 unsigned char pa_lfr_bp_blk_nr[BYTES_PER_BLKNR];
533 580 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
534 581
535 582 typedef struct {
536 583 unsigned char targetLogicalAddress;
537 584 unsigned char protocolIdentifier;
538 585 unsigned char reserved;
539 586 unsigned char userApplication;
540 unsigned char packetID[2];
541 unsigned char packetSequenceControl[2];
542 unsigned char packetLength[2];
587 unsigned char packetID[BYTES_PER_PACKETID];
588 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
589 unsigned char packetLength[BYTES_PER_PKT_LEN];
543 590 // DATA FIELD HEADER
544 591 unsigned char spare1_pusVersion_spare2;
545 592 unsigned char serviceType;
546 593 unsigned char serviceSubType;
547 594 unsigned char destinationID;
548 unsigned char time[6];
595 unsigned char time[BYTES_PER_TIME];
549 596 // AUXILIARY HEADER
550 597 unsigned char sid;
551 598 unsigned char pa_bia_status_info;
552 599 unsigned char sy_lfr_common_parameters_spare;
553 600 unsigned char sy_lfr_common_parameters;
554 unsigned char acquisitionTime[6];
555 unsigned char pa_lfr_bp_blk_nr[2];
601 unsigned char acquisitionTime[BYTES_PER_TIME];
602 unsigned char pa_lfr_bp_blk_nr[BYTES_PER_BLKNR];
556 603 } Header_TM_LFR_SCIENCE_BP_t;
557 604
558 605 typedef struct {
559 606 // TARGET LOGICAL ADDRESS (targetLogicalAddress) IS REMOVED BY THE GRSPW MODULE
560 607 unsigned char protocolIdentifier;
561 608 unsigned char reserved;
562 609 unsigned char userApplication;
563 unsigned char packetID[2];
564 unsigned char packetSequenceControl[2];
565 unsigned char packetLength[2];
610 unsigned char packetID[BYTES_PER_PACKETID];
611 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
612 unsigned char packetLength[BYTES_PER_PKT_LEN];
566 613 // DATA FIELD HEADER
567 614 unsigned char headerFlag_pusVersion_Ack;
568 615 unsigned char serviceType;
569 616 unsigned char serviceSubType;
570 617 unsigned char sourceID;
571 618 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
572 619 } ccsdsTelecommandPacket_t;
573 620
621 //**********
622 //**********
623 // TM_LFR_HK
624
625 #define STATUS_WORD_SC_POTENTIAL_FLAG_BIT 0x40 // [0100 0000]
626 #define STATUS_WORD_SC_POTENTIAL_FLAG_MASK 0xbf // [1011 1111]
627 #define STATUS_WORD_PAS_FILTER_ENABLED_BIT 0x20 // [0010 0000]
628 #define STATUS_WORD_PAS_FILTER_ENABLED_MASK 0xdf // [1101 1111]
629 #define STATUS_WORD_WATCHDOG_BIT 0x10 // [0001 0000]
630 #define STATUS_WORD_WATCHDOG_MASK 0xef // [1110 1111]
631 #define STATUS_WORD_CALIB_BIT 0x08 // [0000 1000]
632 #define STATUS_WORD_CALIB_MASK 0xf7 // [1111 0111]
633 #define STATUS_WORD_RESET_CAUSE_BITS 0x07 // [0000 0111]
634 #define STATUS_WORD_RESET_CAUSE_MASK 0xf8 // [1111 1000]
635 #define STATUS_WORD_LINK_STATE_BITS 0x03 // [0000 0111]
636 #define STATUS_WORD_LINK_STATE_MASK 0xf8 // [1111 1000]
637 #define STATUS_WORD_LFR_MODE_SHIFT 4
638 #define STATUS_WORD_LFR_MODE_BITS 0xf0 // [1111 0000]
639 #define STATUS_WORD_LFR_MODE_MASK 0x0f // [0000 1111]
640 #define STATUS_WORD_0_DEFAULT 0x0d // [0000 1101]
641
574 642 typedef struct {
575 643 unsigned char targetLogicalAddress;
576 644 unsigned char protocolIdentifier;
577 645 unsigned char reserved;
578 646 unsigned char userApplication;
579 unsigned char packetID[2];
580 unsigned char packetSequenceControl[2];
581 unsigned char packetLength[2];
647 unsigned char packetID[BYTES_PER_PACKETID];
648 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
649 unsigned char packetLength[BYTES_PER_PKT_LEN];
582 650 unsigned char spare1_pusVersion_spare2;
583 651 unsigned char serviceType;
584 652 unsigned char serviceSubType;
585 653 unsigned char destinationID;
586 unsigned char time[6];
654 unsigned char time[BYTES_PER_TIME];
587 655 unsigned char sid;
588 656
589 657 //**************
590 658 // HK PARAMETERS
591 unsigned char lfr_status_word[2];
592 unsigned char lfr_sw_version[4];
593 unsigned char lfr_fpga_version[3];
659 unsigned char lfr_status_word[BYTES_PER_STA_WRD];
660 unsigned char lfr_sw_version[BYTES_PER_SW_VER];
661 unsigned char lfr_fpga_version[BYTES_PER_VHD_VER];
594 662 // ressource statistics
595 663 unsigned char hk_lfr_cpu_load;
596 664 unsigned char hk_lfr_cpu_load_max;
597 665 unsigned char hk_lfr_cpu_load_aver;
598 666 unsigned char hk_lfr_q_sd_fifo_size_max;
599 667 unsigned char hk_lfr_q_sd_fifo_size;
600 668 unsigned char hk_lfr_q_rv_fifo_size_max;
601 669 unsigned char hk_lfr_q_rv_fifo_size;
602 670 unsigned char hk_lfr_q_p0_fifo_size_max;
603 671 unsigned char hk_lfr_q_p0_fifo_size;
604 672 unsigned char hk_lfr_q_p1_fifo_size_max;
605 673 unsigned char hk_lfr_q_p1_fifo_size;
606 674 unsigned char hk_lfr_q_p2_fifo_size_max;
607 675 unsigned char hk_lfr_q_p2_fifo_size;
608 676 // tc statistics
609 unsigned char hk_lfr_update_info_tc_cnt[2];
610 unsigned char hk_lfr_update_time_tc_cnt[2];
611 unsigned char hk_lfr_exe_tc_cnt[2];
612 unsigned char hk_lfr_rej_tc_cnt[2];
613 unsigned char hk_lfr_last_exe_tc_id[2];
614 unsigned char hk_lfr_last_exe_tc_type[2];
615 unsigned char hk_lfr_last_exe_tc_subtype[2];
616 unsigned char hk_lfr_last_exe_tc_time[6];
617 unsigned char hk_lfr_last_rej_tc_id[2];
618 unsigned char hk_lfr_last_rej_tc_type[2];
619 unsigned char hk_lfr_last_rej_tc_subtype[2];
620 unsigned char hk_lfr_last_rej_tc_time[6];
677 unsigned char hk_lfr_update_info_tc_cnt[COUNTER_2_BYTES];
678 unsigned char hk_lfr_update_time_tc_cnt[COUNTER_2_BYTES];
679 unsigned char hk_lfr_exe_tc_cnt[COUNTER_2_BYTES];
680 unsigned char hk_lfr_rej_tc_cnt[COUNTER_2_BYTES];
681 unsigned char hk_lfr_last_exe_tc_id[BYTES_PER_PACKETID];
682 unsigned char hk_lfr_last_exe_tc_type[BYTES_PER_TYPE];
683 unsigned char hk_lfr_last_exe_tc_subtype[BYTES_PER_SUBTYPE];
684 unsigned char hk_lfr_last_exe_tc_time[BYTES_PER_TIME];
685 unsigned char hk_lfr_last_rej_tc_id[BYTES_PER_PACKETID];
686 unsigned char hk_lfr_last_rej_tc_type[BYTES_PER_TYPE];
687 unsigned char hk_lfr_last_rej_tc_subtype[BYTES_PER_SUBTYPE];
688 unsigned char hk_lfr_last_rej_tc_time[BYTES_PER_TIME];
621 689 // anomaly statistics
622 unsigned char hk_lfr_le_cnt[2];
623 unsigned char hk_lfr_me_cnt[2];
624 unsigned char hk_lfr_he_cnt[2];
625 unsigned char hk_lfr_last_er_rid[2];
690 unsigned char hk_lfr_le_cnt[COUNTER_2_BYTES];
691 unsigned char hk_lfr_me_cnt[COUNTER_2_BYTES];
692 unsigned char hk_lfr_he_cnt[COUNTER_2_BYTES];
693 unsigned char hk_lfr_last_er_rid[COUNTER_2_BYTES];
626 694 unsigned char hk_lfr_last_er_code;
627 unsigned char hk_lfr_last_er_time[6];
695 unsigned char hk_lfr_last_er_time[BYTES_PER_TIME];
628 696 // vhdl_blk_status
629 697 unsigned char hk_lfr_vhdl_aa_sm;
630 698 unsigned char hk_lfr_vhdl_fft_sr;
631 699 unsigned char hk_lfr_vhdl_cic_hk;
632 700 unsigned char hk_lfr_vhdl_iir_cal;
633 701 // spacewire_if_statistics
634 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
635 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
702 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[COUNTER_2_BYTES];
703 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[COUNTER_2_BYTES];
636 704 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
637 705 unsigned char hk_lfr_dpu_spw_last_timc;
638 706 // ahb error statistics
639 unsigned char hk_lfr_last_fail_addr[4];
707 unsigned char hk_lfr_last_fail_addr[BYTES_PER_ADDR];
640 708 // temperatures
641 unsigned char hk_lfr_temp_scm[2];
642 unsigned char hk_lfr_temp_pcb[2];
643 unsigned char hk_lfr_temp_fpga[2];
709 unsigned char hk_lfr_temp_scm[BYTES_PER_TEMP];
710 unsigned char hk_lfr_temp_pcb[BYTES_PER_TEMP];
711 unsigned char hk_lfr_temp_fpga[BYTES_PER_TEMP];
644 712 // spacecraft potential
645 unsigned char hk_lfr_sc_v_f3[2];
646 unsigned char hk_lfr_sc_e1_f3[2];
647 unsigned char hk_lfr_sc_e2_f3[2];
713 unsigned char hk_lfr_sc_v_f3[BYTES_PER_V];
714 unsigned char hk_lfr_sc_e1_f3[BYTES_PER_V];
715 unsigned char hk_lfr_sc_e2_f3[BYTES_PER_V];
648 716 // lfr common parameters
649 717 unsigned char sy_lfr_common_parameters_spare;
650 718 unsigned char sy_lfr_common_parameters;
651 719 // error counters
652 720 unsigned char hk_lfr_dpu_spw_parity;
653 721 unsigned char hk_lfr_dpu_spw_disconnect;
654 722 unsigned char hk_lfr_dpu_spw_escape;
655 723 unsigned char hk_lfr_dpu_spw_credit;
656 724 unsigned char hk_lfr_dpu_spw_write_sync;
657 725 unsigned char hk_lfr_dpu_spw_rx_ahb;
658 726 unsigned char hk_lfr_dpu_spw_tx_ahb;
659 727 unsigned char hk_lfr_dpu_spw_early_eop;
660 728 unsigned char hk_lfr_dpu_spw_invalid_addr;
661 729 unsigned char hk_lfr_dpu_spw_eep;
662 730 unsigned char hk_lfr_dpu_spw_rx_too_big;
663 731 // timecode
664 732 unsigned char hk_lfr_timecode_erroneous;
665 733 unsigned char hk_lfr_timecode_missing;
666 734 unsigned char hk_lfr_timecode_invalid;
667 735 // time
668 736 unsigned char hk_lfr_time_timecode_it;
669 737 unsigned char hk_lfr_time_not_synchro;
670 738 unsigned char hk_lfr_time_timecode_ctr;
671 739 // hk_lfr_buffer_dpu_
672 740 unsigned char hk_lfr_buffer_dpu_tc_fifo;
673 741 unsigned char hk_lfr_buffer_dpu_tm_fifo;
674 742 // hk_lfr_ahb_
675 743 unsigned char hk_lfr_ahb_correctable;
676 744 unsigned char hk_lfr_ahb_uncorrectable;
677 745 // reaction wheel frequency
678 746 unsigned char hk_lfr_sc_rw_f_flags;
679 747 } Packet_TM_LFR_HK_t;
680 748
749 //***************
750 //***************
751 // PARAMETER_DUMP
752
753 #define BIT_PAS_FILTER_ENABLED 0x01
754 #define BIT_CWF_LONG_F3 0x01
755
681 756 typedef struct {
682 757 unsigned char targetLogicalAddress;
683 758 unsigned char protocolIdentifier;
684 759 unsigned char reserved;
685 760 unsigned char userApplication;
686 unsigned char packetID[2];
687 unsigned char packetSequenceControl[2];
688 unsigned char packetLength[2];
761 unsigned char packetID[BYTES_PER_PACKETID];
762 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
763 unsigned char packetLength[BYTES_PER_PKT_LEN];
689 764 // DATA FIELD HEADER
690 765 unsigned char spare1_pusVersion_spare2;
691 766 unsigned char serviceType;
692 767 unsigned char serviceSubType;
693 768 unsigned char destinationID;
694 unsigned char time[6];
769 unsigned char time[BYTES_PER_TIME];
695 770 unsigned char sid;
696 771
697 772 //******************
698 773 // COMMON PARAMETERS
699 774 unsigned char sy_lfr_common_parameters_spare;
700 775 unsigned char sy_lfr_common_parameters;
701 776
702 777 //******************
703 778 // NORMAL PARAMETERS
704 unsigned char sy_lfr_n_swf_l[2];
705 unsigned char sy_lfr_n_swf_p[2];
706 unsigned char sy_lfr_n_asm_p[2];
779 unsigned char sy_lfr_n_swf_l[PARAM_2_BYTES];
780 unsigned char sy_lfr_n_swf_p[PARAM_2_BYTES];
781 unsigned char sy_lfr_n_asm_p[PARAM_2_BYTES];
707 782 unsigned char sy_lfr_n_bp_p0;
708 783 unsigned char sy_lfr_n_bp_p1;
709 784 unsigned char sy_lfr_n_cwf_long_f3;
710 785 unsigned char pa_rpw_spare8_1;
711 786
712 787 //*****************
713 788 // BURST PARAMETERS
714 789 unsigned char sy_lfr_b_bp_p0;
715 790 unsigned char sy_lfr_b_bp_p1;
716 791
717 792 //****************
718 793 // SBM1 PARAMETERS
719 794 unsigned char sy_lfr_s1_bp_p0;
720 795 unsigned char sy_lfr_s1_bp_p1;
721 796
722 797 //****************
723 798 // SBM2 PARAMETERS
724 799 unsigned char sy_lfr_s2_bp_p0;
725 800 unsigned char sy_lfr_s2_bp_p1;
726 801
727 802 // mask F0
728 803 union{
729 804 struct{
730 unsigned char f0_word1[4];
731 unsigned char f0_word2[4];
732 unsigned char f0_word3[4];
733 unsigned char f0_word4[4];
805 unsigned char f0_word1[BYTES_PER_WORD];
806 unsigned char f0_word2[BYTES_PER_WORD];
807 unsigned char f0_word3[BYTES_PER_WORD];
808 unsigned char f0_word4[BYTES_PER_WORD];
734 809 // mask F1
735 unsigned char f1_word1[4];
736 unsigned char f1_word2[4];
737 unsigned char f1_word3[4];
738 unsigned char f1_word4[4];
810 unsigned char f1_word1[BYTES_PER_WORD];
811 unsigned char f1_word2[BYTES_PER_WORD];
812 unsigned char f1_word3[BYTES_PER_WORD];
813 unsigned char f1_word4[BYTES_PER_WORD];
739 814 // mask F2
740 unsigned char f2_word1[4];
741 unsigned char f2_word2[4];
742 unsigned char f2_word3[4];
743 unsigned char f2_word4[4];
815 unsigned char f2_word1[BYTES_PER_WORD];
816 unsigned char f2_word2[BYTES_PER_WORD];
817 unsigned char f2_word3[BYTES_PER_WORD];
818 unsigned char f2_word4[BYTES_PER_WORD];
744 819 } fx;
745 unsigned char raw[ 4 * 4 * 3 ];
820 unsigned char raw[ BYTES_PER_MASKS_SET ];
746 821 } sy_lfr_fbins;
747 822
748 823 // PAS FILTER PARAMETERS
749 824 unsigned char pa_rpw_spare8_2;
750 825 unsigned char spare_sy_lfr_pas_filter_enabled;
751 826 unsigned char sy_lfr_pas_filter_modulus;
752 unsigned char sy_lfr_pas_filter_tbad[4];
827 unsigned char sy_lfr_pas_filter_tbad[PARAM_4_BYTES];
753 828 unsigned char sy_lfr_pas_filter_offset;
754 unsigned char sy_lfr_pas_filter_shift[4];
755 unsigned char sy_lfr_sc_rw_delta_f[4];
829 unsigned char sy_lfr_pas_filter_shift[PARAM_4_BYTES];
830 unsigned char sy_lfr_sc_rw_delta_f[PARAM_4_BYTES];
756 831
757 832 // LFR_RW_MASK
758 833 union{
759 834 struct{
760 unsigned char f0_word1[4];
761 unsigned char f0_word2[4];
762 unsigned char f0_word3[4];
763 unsigned char f0_word4[4];
835 unsigned char f0_word1[BYTES_PER_WORD];
836 unsigned char f0_word2[BYTES_PER_WORD];
837 unsigned char f0_word3[BYTES_PER_WORD];
838 unsigned char f0_word4[BYTES_PER_WORD];
764 839 // mask F1
765 unsigned char f1_word1[4];
766 unsigned char f1_word2[4];
767 unsigned char f1_word3[4];
768 unsigned char f1_word4[4];
840 unsigned char f1_word1[BYTES_PER_WORD];
841 unsigned char f1_word2[BYTES_PER_WORD];
842 unsigned char f1_word3[BYTES_PER_WORD];
843 unsigned char f1_word4[BYTES_PER_WORD];
769 844 // mask F2
770 unsigned char f2_word1[4];
771 unsigned char f2_word2[4];
772 unsigned char f2_word3[4];
773 unsigned char f2_word4[4];
845 unsigned char f2_word1[BYTES_PER_WORD];
846 unsigned char f2_word2[BYTES_PER_WORD];
847 unsigned char f2_word3[BYTES_PER_WORD];
848 unsigned char f2_word4[BYTES_PER_WORD];
774 849 } fx;
775 unsigned char raw[ 4 * 4 * 3 ];
850 unsigned char raw[ BYTES_PER_MASKS_SET ];
776 851 } sy_lfr_rw_mask;
777 852
778 853 // SPARE
779 854 unsigned char pa_rpw_spare8_3;
780 855 } Packet_TM_LFR_PARAMETER_DUMP_t;
781 856
857 //**************************
858 //**************************
859 // TM_LFR_KCOEFFICIENTS_DUMP
860
861 #define KCOEFF_BLK_NR_PKT1 30
862 #define KCOEFF_BLK_NR_PKT2 6
863 #define KCOEFF_BLK_SIZE 130
864 #define KCOEFF_PKTCNT 2
865 #define PKTNR_1 1
866 #define PKTNR_2 2
867
782 868 typedef struct {
783 869 unsigned char targetLogicalAddress;
784 870 unsigned char protocolIdentifier;
785 871 unsigned char reserved;
786 872 unsigned char userApplication;
787 unsigned char packetID[2];
788 unsigned char packetSequenceControl[2];
789 unsigned char packetLength[2];
873 unsigned char packetID[BYTES_PER_PACKETID];
874 unsigned char packetSequenceControl[BYTES_PER_SEQ_CTRL];
875 unsigned char packetLength[BYTES_PER_PKT_LEN];
790 876 // DATA FIELD HEADER
791 877 unsigned char spare1_pusVersion_spare2;
792 878 unsigned char serviceType;
793 879 unsigned char serviceSubType;
794 880 unsigned char destinationID;
795 unsigned char time[6];
881 unsigned char time[BYTES_PER_TIME];
796 882 unsigned char sid;
797 883 unsigned char pkt_cnt;
798 884 unsigned char pkt_nr;
799 885 unsigned char blk_nr;
800 886
801 887 //******************
802 888 // SOURCE DATA repeated N times with N in [0 .. PA_LFR_KCOEFF_BLK_NR]
803 889 unsigned char kcoeff_blks[3900]; // one blk is 2 + 4 * 32 = 130 bytes, 30 blks max in one packet (30 * 130 = 3900)
804 890
805 891 } Packet_TM_LFR_KCOEFFICIENTS_DUMP_t;
806 892
807 893 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,304 +1,374
1 1 #ifndef FSW_PARAMS_H_INCLUDED
2 2 #define FSW_PARAMS_H_INCLUDED
3 3
4 4 #include "fsw_params_processing.h"
5 5 #include "fsw_params_nb_bytes.h"
6 6 #include "tm_byte_positions.h"
7 7 #include "ccsds_types.h"
8 8
9 9 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 10 #define UART_DEVICE_NAME "/dev/console"
11 11
12 //*******
13 // MACROS
14 #ifdef PRINT_MESSAGES_ON_CONSOLE
15 #define PRINTF(x) printf(x);
16 #define PRINTF1(x,y) printf(x,y);
17 #define PRINTF2(x,y,z) printf(x,y,z);
18 #else
19 #define PRINTF(x) ;
20 #define PRINTF1(x,y) ;
21 #define PRINTF2(x,y,z) ;
22 #endif
23
24 #ifdef BOOT_MESSAGES
25 #define BOOT_PRINTF(x) printf(x);
26 #define BOOT_PRINTF1(x,y) printf(x,y);
27 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
28 #else
29 #define BOOT_PRINTF(x) ;
30 #define BOOT_PRINTF1(x,y) ;
31 #define BOOT_PRINTF2(x,y,z) ;
32 #endif
33
34 #ifdef DEBUG_MESSAGES
35 #define DEBUG_PRINTF(x) printf(x);
36 #define DEBUG_PRINTF1(x,y) printf(x,y);
37 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
38 #else
39 #define DEBUG_PRINTF(x) ;
40 #define DEBUG_PRINTF1(x,y) ;
41 #define DEBUG_PRINTF2(x,y,z) ;
42 #endif
43
44 #define CONST_65536 65536 // 2^16
45 #define CONST_2048 2048 // 2^11
46 #define CONST_512 512 // 2^9
47 #define CONST_256 256 // 2^8
48 #define CONST_128 128 // 2^7
49 #define UINT8_MAX 255
50
51 #define FLOAT_MSBYTE 0
52 #define FLOAT_LSBYTE 3
53 #define BITS_PER_BYTE 8
54 #define INIT_FLOAT 0.
55 #define INIT_CHAR 0x00
56 #define INT8_ALL_F 0xff
57 #define INT16_ALL_F 0xffff
58 #define INT32_ALL_F 0xffffffff
59 #define INT32_ALL_0 0x00000000
60 #define SHIFT_1_BYTE 8
61 #define SHIFT_2_BYTES 16
62 #define SHIFT_3_BYTES 24
63 #define SHIFT_4_BYTES 32
64 #define SHIFT_5_BYTES 40
65 #define SHIFT_2_BITS 2
66 #define SHIFT_3_BITS 3
67 #define SHIFT_4_BITS 4
68 #define SHIFT_5_BITS 5
69 #define SHIFT_6_BITS 6
70 #define SHIFT_7_BITS 7
71 #define BYTE_0 0
72 #define BYTE_1 1
73 #define BYTE_2 2
74 #define BYTE_3 3
75 #define BYTE_4 4
76 #define BYTE_5 5
77 #define BYTE_6 6
78 #define BYTE_7 7
79 #define BYTE0_MASK 0xff00
80 #define BYTE1_MASK 0x00ff
81
12 82 enum lfr_transition_type_t{
13 83 TRANSITION_NOT_SPECIFIC,
14 84 TRANSITION_NORM_TO_S1,
15 85 TRANSITION_NORM_TO_S2,
16 86 TRANSITION_S1_TO_NORM,
17 87 TRANSITION_S2_TO_NORM,
18 88 TRANSITION_S1_TO_S2,
19 89 TRANSITION_S2_TO_S1
20 90 };
21 91
22 92 typedef struct ring_node
23 93 {
24 94 struct ring_node *previous;
25 95 struct ring_node *next;
26 96 unsigned int sid;
27 97 unsigned int coarseTime;
28 98 unsigned int fineTime;
29 99 int buffer_address;
30 100 unsigned int status;
31 101 } ring_node;
32 102
33 103 //************************
34 104 // flight software version
35 105 // this parameters is handled by the Qt project options
36 106
37 107 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
38 108 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
39 109 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
40 110 #define TIME_OFFSET 2
41 111 #define TIME_OFFSET_IN_BYTES 8
42 112 //#define WAVEFORM_EXTENDED_HEADER_OFFSET 22
43 113 #define NB_BYTES_SWF_BLK (2 * 6)
44 114 #define NB_WORDS_SWF_BLK 3
45 115 #define NB_BYTES_CWF3_LIGHT_BLK 6
46 116 //#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
47 117 #define NB_RING_NODES_F0 3 // AT LEAST 3
48 118 #define NB_RING_NODES_F1 5 // AT LEAST 3
49 119 #define NB_RING_NODES_F2 5 // AT LEAST 3
50 120 #define NB_RING_NODES_F3 3 // AT LEAST 3
51 121
52 122 //**********
53 123 // LFR MODES
54 124 #define LFR_MODE_STANDBY 0
55 125 #define LFR_MODE_NORMAL 1
56 126 #define LFR_MODE_BURST 2
57 127 #define LFR_MODE_SBM1 3
58 128 #define LFR_MODE_SBM2 4
59 129
60 130 #define TDS_MODE_LFM 5
61 131 #define TDS_MODE_STANDBY 0
62 132 #define TDS_MODE_NORMAL 1
63 133 #define TDS_MODE_BURST 2
64 134 #define TDS_MODE_SBM1 3
65 135 #define TDS_MODE_SBM2 4
66 136
67 137 #define THR_MODE_STANDBY 0
68 138 #define THR_MODE_NORMAL 1
69 139 #define THR_MODE_BURST 2
70 140
71 141 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
72 142 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
73 143 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
74 144 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
75 145 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
76 146 #define RTEMS_EVENT_MODE_NORM_S1_S2 RTEMS_EVENT_5
77 147 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
78 148 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
79 149 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
80 150 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
81 151 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
82 152 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
83 153 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
84 154 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
85 155 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
86 156 #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15
87 157 #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16
88 158 #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17
89 159 #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18
90 160 #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19
91 161 #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20
92 162 #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21
93 163 #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22
94 164 #define RTEMS_EVENT_SWF_RESYNCH RTEMS_EVENT_23
95 165
96 //****************************
97 // LFR DEFAULT MODE PARAMETERS
166 //********************************************
167 //********************************************
168 // LFR PARAMETERS: DEFAULT, MIN AND MAX VALUES
169
98 170 #define DEFAULT_LAST_VALID_TRANSITION_DATE 0xffffffff
171
99 172 // COMMON
100 173 #define DEFAULT_SY_LFR_COMMON0 0x00
101 174 #define DEFAULT_SY_LFR_COMMON1 0x20 // default value bw sp0 sp1 r0 r1 r2 = 1 0 0 0 0 0
175
102 176 // NORM
103 177 #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample
104 178 #define DFLT_SY_LFR_N_SWF_P 300 // sec
179 #define MIN_SY_LFR_N_SWF_P 22 // sec
105 180 #define DFLT_SY_LFR_N_ASM_P 3600 // sec
106 181 #define DFLT_SY_LFR_N_BP_P0 4 // sec
107 182 #define DFLT_SY_LFR_N_BP_P1 20 // sec
108 183 #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
109 184 #define MIN_DELTA_SNAPSHOT 16 // sec
185
110 186 // BURST
111 187 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
112 188 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
189
113 190 // SBM1
114 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
191 #define S1_BP_P0_SCALE 0.25
192 #define DEFAULT_SY_LFR_S1_BP_P0 1 // 0.25 sec
115 193 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
194
116 195 // SBM2
117 196 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
118 197 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
198
119 199 // ADDITIONAL PARAMETERS
120 200 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
121 201 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
202
122 203 // STATUS WORD
123 204 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
205
124 206 #define DEFAULT_STATUS_WORD_BYTE1 0x00
207 // TC_LFR_LOAD_FILTER_PAR
208 #define MIN_PAS_FILTER_MODULUS 4
209 #define MAX_PAS_FILTER_MODULUS 8
210 #define MIN_PAS_FILTER_TBAD 0.0
211 #define MAX_PAS_FILTER_TBAD 4.0
212 #define MIN_PAS_FILTER_OFFSET 0
213 #define MAX_PAS_FILTER_OFFSET 7
214 #define MIN_PAS_FILTER_SHIFT 0.0
215 #define MAX_PAS_FILTER_SHIFT 1.0
125 216 //
126 217 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
127 218 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
128 219 //****************************
129 220
130 221 //*****************************
131 222 // APB REGISTERS BASE ADDRESSES
132 223 #define REGS_ADDR_APBUART 0x80000100
133 224 #define REGS_ADDR_GPTIMER 0x80000300
134 225 #define REGS_ADDR_GRSPW 0x80000500
135 226 #define APB_OFFSET_GRSPW_STATUS_REGISTER 0x04
136 227 #define APB_OFFSET_GRSPW_TIME_REGISTER 0x14
137 228 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
138 229 #define REGS_ADDR_GRGPIO 0x80000b00
139 230
140 231 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
141 232 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f54 // PDB >= 0.1.28
233 #define APB_OFFSET_VHDL_REV 0xb0
142 234 #define REGS_ADDR_VHDL_VERSION 0x80000ff0
143 235
144 236 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
145 237 #define APBUART_CTRL_REG_MASK_TE 0x00000002
146 238 // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1
147 239 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400
148 240
149 241 //**********
150 242 // IRQ LINES
151 243 #define IRQ_GPTIMER_WATCHDOG 9
152 244 #define IRQ_SPARC_GPTIMER_WATCHDOG 0x19 // see sparcv8.pdf p.76 for interrupt levels
153 245 #define IRQ_WAVEFORM_PICKER 14
154 246 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
155 247 #define IRQ_SPECTRAL_MATRIX 6
156 248 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
157 249
158 250 //*****
159 251 // TIME
160 252 #define CLKDIV_WATCHDOG (10000000 - 1) // 10.0s => 10 000 000
161 253 #define TIMER_WATCHDOG 1
162 254 #define WATCHDOG_PERIOD 100 // 1s
163 255 #define HK_PERIOD 100 // 100 * 10ms => 1s
164 256 #define AVGV_PERIOD 6 // 6 * 10ms => 60ms (1 / 16 = 62.5ms)
165 257 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
258 #define HK_SYNC_WAIT 10 // 10 * 10 ms = 100 ms
259 #define SPW_LINK_WAIT 10 // 10 * 10 ms = 100 ms
166 260 #define TIMECODE_TIMER_TIMEOUT 120 // 120 * 10 ms = 1.2 s
167 261 #define TIMECODE_TIMER_TIMEOUT_INIT 200 // 200 * 10 ms = 2.0 s
168 262 #define TIMECODE_MASK 0x3f // 0011 1111
169 263
170 264 //**********
171 265 // LPP CODES
172 266 #define LFR_SUCCESSFUL 0
173 267 #define LFR_DEFAULT 1
174 268 #define LFR_EXE_ERROR 2
175 269
176 270 //******
177 271 // RTEMS
272 #define STACK_SIZE_MULT 2
273
178 274 #define TASKID_AVGV 0
179 275 #define TASKID_RECV 1
180 276 #define TASKID_ACTN 2
181 277 #define TASKID_SPIQ 3
182 278 #define TASKID_LOAD 4
183 279 #define TASKID_AVF0 5
184 280 #define TASKID_SWBD 6
185 281 #define TASKID_WFRM 7
186 282 #define TASKID_DUMB 8
187 283 #define TASKID_HOUS 9
188 284 #define TASKID_PRC0 10
189 285 #define TASKID_CWF3 11
190 286 #define TASKID_CWF2 12
191 287 #define TASKID_CWF1 13
192 288 #define TASKID_SEND 14
193 289 #define TASKID_LINK 15
194 290 #define TASKID_AVF1 16
195 291 #define TASKID_PRC1 17
196 292 #define TASKID_AVF2 18
197 293 #define TASKID_PRC2 19
198 294
199 295 #define TASK_PRIORITY_SPIQ 5
200 296 #define TASK_PRIORITY_LINK 20
201 297 #define TASK_PRIORITY_AVGV 25
202 298 #define TASK_PRIORITY_HOUS 30
203 299 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
204 300 #define TASK_PRIORITY_CWF2 35 //
205 301 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
206 302 #define TASK_PRIORITY_WFRM 40
207 303 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
208 304 #define TASK_PRIORITY_SEND 45
209 305 #define TASK_PRIORITY_RECV 50
210 306 #define TASK_PRIORITY_ACTN 50
211 307 #define TASK_PRIORITY_AVF0 60
212 308 #define TASK_PRIORITY_AVF1 70
213 309 #define TASK_PRIORITY_PRC0 100
214 310 #define TASK_PRIORITY_PRC1 100
215 311 #define TASK_PRIORITY_AVF2 110
216 312 #define TASK_PRIORITY_PRC2 110
217 313 #define TASK_PRIORITY_LOAD 190
218 314 #define TASK_PRIORITY_DUMB 200
219 315
220 316 #define MSG_QUEUE_COUNT_RECV 10
221 317 #define MSG_QUEUE_COUNT_SEND 50
222 318 #define MSG_QUEUE_COUNT_PRC0 10
223 319 #define MSG_QUEUE_COUNT_PRC1 10
224 320 #define MSG_QUEUE_COUNT_PRC2 5
225 321 #define MSG_QUEUE_SIZE_SEND 812 // 808 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
226 322 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
227 323 #define MSG_QUEUE_SIZE_PRC0 36 // two pointers, one rtems_event + 6 integers
228 324 #define MSG_QUEUE_SIZE_PRC1 36 // two pointers, one rtems_event + 6 integers
229 325 #define MSG_QUEUE_SIZE_PRC2 36 // two pointers, one rtems_event + 6 integers
230 326
231 327 #define QUEUE_RECV 0
232 328 #define QUEUE_SEND 1
233 329 #define QUEUE_PRC0 2
234 330 #define QUEUE_PRC1 3
235 331 #define QUEUE_PRC2 4
236 332
237 //*******
238 // MACROS
239 #ifdef PRINT_MESSAGES_ON_CONSOLE
240 #define PRINTF(x) printf(x);
241 #define PRINTF1(x,y) printf(x,y);
242 #define PRINTF2(x,y,z) printf(x,y,z);
243 #else
244 #define PRINTF(x) ;
245 #define PRINTF1(x,y) ;
246 #define PRINTF2(x,y,z) ;
247 #endif
248
249 #ifdef BOOT_MESSAGES
250 #define BOOT_PRINTF(x) printf(x);
251 #define BOOT_PRINTF1(x,y) printf(x,y);
252 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
253 #else
254 #define BOOT_PRINTF(x) ;
255 #define BOOT_PRINTF1(x,y) ;
256 #define BOOT_PRINTF2(x,y,z) ;
257 #endif
258
259 #ifdef DEBUG_MESSAGES
260 #define DEBUG_PRINTF(x) printf(x);
261 #define DEBUG_PRINTF1(x,y) printf(x,y);
262 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
263 #else
264 #define DEBUG_PRINTF(x) ;
265 #define DEBUG_PRINTF1(x,y) ;
266 #define DEBUG_PRINTF2(x,y,z) ;
267 #endif
268
269 333 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
270 334
271 335 struct param_local_str{
272 336 unsigned int local_sbm1_nb_cwf_sent;
273 337 unsigned int local_sbm1_nb_cwf_max;
274 338 unsigned int local_sbm2_nb_cwf_sent;
275 339 unsigned int local_sbm2_nb_cwf_max;
276 340 };
277 341
342 //************
343 // FBINS MASKS
344
345 #define BYTES_PER_FBINS_MASK 16
346
278 347 typedef struct {
279 unsigned char merged_fbins_mask_f0[16];
280 unsigned char merged_fbins_mask_f1[16];
281 unsigned char merged_fbins_mask_f2[16];
348 unsigned char merged_fbins_mask_f0[BYTES_PER_FBINS_MASK];
349 unsigned char merged_fbins_mask_f1[BYTES_PER_FBINS_MASK];
350 unsigned char merged_fbins_mask_f2[BYTES_PER_FBINS_MASK];
282 351 } fbins_masks_t;
283 352
284 353 #define DEFAULT_SY_LFR_PAS_FILTER_ENABLED 0
285 354 #define DEFAULT_SY_LFR_PAS_FILTER_MODULUS 4
286 355 #define DEFAULT_SY_LFR_PAS_FILTER_TBAD 1.0
287 356 #define DEFAULT_SY_LFR_PAS_FILTER_OFFSET 0
288 357 #define DEFAULT_SY_LFR_PAS_FILTER_SHIFT 0.5
289 358 #define DEFAULT_SY_LFR_SC_RW_DELTA_F 0.025
290 359
291 360 typedef struct{
292 361 unsigned char spare_sy_lfr_pas_filter_enabled;
293 362 unsigned char sy_lfr_pas_filter_modulus;
294 363 float sy_lfr_pas_filter_tbad;
295 364 unsigned char sy_lfr_pas_filter_offset;
296 365 float sy_lfr_pas_filter_shift;
297 366 float sy_lfr_sc_rw_delta_f;
298 367 } filterPar_t;
299 368
369 #define NB_ACQUISITION_DURATION 3
300 370 #define ACQUISITION_DURATION_F0 683 // 256 / 24576 * 65536
301 371 #define ACQUISITION_DURATION_F1 4096 // 256 / 4096 * 65536
302 372 #define ACQUISITION_DURATION_F2 65536 // 256 / 256 * 65536
303 373
304 374 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,68 +1,77
1 #ifndef TM_BYTE_POSITIONS_H
2 #define TM_BYTE_POSITIONS_H
1 #ifndef FSW_PARAMS_NB_BYTES_H
2 #define FSW_PARAMS_NB_BYTES_H
3 3
4 4 #define PACKET_POS_SEQUENCE_CNT 6 // 4 + 2
5 5 #define PACKET_POS_PA_LFR_SID_PKT 20 // 4 + 16
6 6 #define PACKET_POS_SERVICE_TYPE 11 // 4 + 7
7 7
8 #define DATAFIELD_OFFSET 10
9
8 10 // TC_LFR_LOAD_COMMON_PAR
9 11
10 12 // TC_LFR_LOAD_NORMAL_PAR
11 13 #define DATAFIELD_POS_SY_LFR_N_SWF_L 0
12 14 #define DATAFIELD_POS_SY_LFR_N_SWF_P 2
13 15 #define DATAFIELD_POS_SY_LFR_N_ASM_P 4
14 16 #define DATAFIELD_POS_SY_LFR_N_BP_P0 6
15 17 #define DATAFIELD_POS_SY_LFR_N_BP_P1 7
16 18 #define DATAFIELD_POS_SY_LFR_N_CWF_LONG_F3 8
17 19
18 20 // TC_LFR_LOAD_BURST_PAR
19 21 #define DATAFIELD_POS_SY_LFR_B_BP_P0 0
20 22 #define DATAFIELD_POS_SY_LFR_B_BP_P1 1
21 23
22 24 // TC_LFR_LOAD_SBM1_PAR
23 25 #define DATAFIELD_POS_SY_LFR_S1_BP_P0 0
24 26 #define DATAFIELD_POS_SY_LFR_S1_BP_P1 1
25 27
26 28 // TC_LFR_LOAD_SBM2_PAR
27 29 #define DATAFIELD_POS_SY_LFR_S2_BP_P0 0
28 30 #define DATAFIELD_POS_SY_LFR_S2_BP_P1 1
29 31
30 32 // TC_LFR_UPDATE_INFO
31 33 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET1 10
32 34 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET2 11
33 35 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 34
34 36 #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 35
35 37 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F1 44
36 38 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW1_F2 48
37 39 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F1 52
38 40 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW2_F2 56
39 41 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F1 60
40 42 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW3_F2 64
41 43 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F1 68
42 44 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW4_F2 72
43 45 #define BYTE_POS_UPDATE_INFO_CP_RPW_SC_RW_F_FLAGS 77
44 46
47 #define BITS_LFR_MODE 0x1e
48 #define SHIFT_LFR_MODE 1
49 #define BITS_TDS_MODE 0xf0
50 #define SHIFT_TDS_MODE 4
51 #define BITS_THR_MODE 0x0f
52 #define BITS_BIA 0xfe
53
45 54 // TC_LFR_ENTER_MODE
46 55 #define BYTE_POS_CP_MODE_LFR_SET 11
47 56 #define BYTE_POS_CP_LFR_ENTER_MODE_TIME 12
48 57
49 58 //TC_LFR_LOAD_FBINS_MASK
50 #define NB_FBINS_MASKS 12
51 #define NB_BYTES_PER_FREQ_MASK 16
52 #define NB_BYTES_PER_FBINS_MASK 4
53 59
54 60 // TC_LFR_LOAD_FILTER_PAR
55 61 #define DATAFIELD_POS_PA_RPW_SPARE8_2 0 // 8 bits
56 62 #define DATAFIELD_POS_SY_LFR_PAS_FILTER_ENABLED 1 // 8 bits
57 63 #define DATAFIELD_POS_SY_LFR_PAS_FILTER_MODULUS 2 // 8 bits
58 64 #define DATAFIELD_POS_SY_LFR_PAS_FILTER_TBAD 3 // 32 bits
59 65 #define DATAFIELD_POS_SY_LFR_PAS_FILTER_OFFSET 7 // 8 bits
60 66 #define DATAFIELD_POS_SY_LFR_PAS_FILTER_SHIFT 8 // 32 bits
61 67 #define DATAFIELD_POS_SY_LFR_SC_RW_DELTA_F 12 // 32 bits
62 68
63 69 // TC_LFR_LOAD_KCOEFFICIENTS
64 70 #define NB_BYTES_PER_FLOAT 4
65 #define DATAFIELD_POS_SY_LFR_KCOEFF_FREQUENCY 0 // 10 - 10
66 #define DATAFIELD_POS_SY_LFR_KCOEFF_1 2 // 12 - 10
71 #define DATAFIELD_POS_SY_LFR_KCOEFF_FREQUENCY 0 // 10 - 10
72 #define DATAFIELD_POS_SY_LFR_KCOEFF_1 2 // 12 - 10
67 73
68 #endif // TM_BYTE_POSITIONS_H
74 // TM_LFR_KCOEFFICIENTS_DUMP
75 #define BYTE_POS_KCOEFFICIENTS_PARAMETES 20
76
77 #endif // FSW_PARAMS_NB_BYTES_H
@@ -1,85 +1,108
1 1 #ifndef FSW_PARAMS_PROCESSING_H
2 2 #define FSW_PARAMS_PROCESSING_H
3 3
4 4 #define CHANNELF0 0
5 5 #define CHANNELF1 1
6 6 #define CHANNELF2 2
7 #define CHANNELF3 3
7 8
9 #define NB_SM_PER_S_F0 96
10 #define NB_SM_PER_S_F1 16
11 #define NB_SM_PER_S_F2 1
12 #define NB_SM_PER_S1_BP_P0 24
13
14 #define ASM_COMP_B1B2 1
15 #define ASM_COMP_B1B3 3
16 #define ASM_COMP_B1E1 5
17 #define ASM_COMP_B1E2 7
18 #define ASM_COMP_B2B3 10
19 #define ASM_COMP_B2E1 12
20 #define ASM_COMP_B2E2 14
21 #define ASM_COMP_B3E1 17
22 #define ASM_COMP_B3E2 19
23 #define ASM_COMP_E1E2 22
24 #define ASM_COMP_B1B1 0
25 #define ASM_COMP_B2B2 9
26 #define ASM_COMP_B3B3 16
27 #define ASM_COMP_E1E1 21
28 #define ASM_COMP_E2E2 24
29
30 #define SM_BYTES_PER_VAL 2
8 31 #define NB_BINS_PER_SM 128
9 32 #define NB_VALUES_PER_SM 25
10 33 #define TOTAL_SIZE_SM 3200 // 25 * 128 = 0xC80
11 34 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
12 35 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
13 36 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
14 37 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
15 38 // F0
16 39 #define NB_RING_NODES_SM_F0 20 // AT LEAST 8 due to the way the averaging is done
17 40 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
18 41 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
19 42 #define NB_RING_NODES_ASM_F0 3 // AT LEAST 3
20 43 // F1
21 44 #define NB_RING_NODES_SM_F1 12 // AT LEAST 8 due to the way the averaging is done
22 45 #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3
23 46 #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3
24 47 #define NB_RING_NODES_ASM_F1 3 // AT LEAST 3
25 48 // F2
26 49 #define NB_RING_NODES_SM_F2 5 // AT LEAST 3
27 50 #define NB_RING_NODES_ASM_NORM_F2 3 // AT LEAST 3
28 51 #define NB_RING_NODES_ASM_F2 3 // AT LEAST 3
29 52 //
30 53 #define NB_BINS_PER_ASM_F0 88
31 54 #define NB_BINS_PER_PKT_ASM_F0_1 32
32 55 #define NB_BINS_PER_PKT_ASM_F0_2 24
33 56 #define DLEN_ASM_F0_PKT_1 3200 // 32 * 25 * 4, 25 components per matrix, 4 bytes per float
34 57 #define DLEN_ASM_F0_PKT_2 2400 // 24 * 25 * 4, 25 components per matrix, 4 bytes per float
35 58 #define ASM_F0_INDICE_START 16 // 17 - 1, (-1) due to the VHDL behaviour
36 59 #define ASM_F0_INDICE_STOP 103 // 104 - 1, 2 packets of 44 bins
37 60 //
38 61 #define NB_BINS_PER_ASM_F1 104
39 62 #define NB_BINS_PER_PKT_ASM_F1_1 36
40 63 #define NB_BINS_PER_PKT_ASM_F1_2 32
41 64 #define DLEN_ASM_F1_PKT_1 3600 // 36 * 25 * 4, 25 components per matrix, 4 bytes per float
42 65 #define DLEN_ASM_F1_PKT_2 3200 // 32 * 25 * 4, 25 components per matrix, 4 bytes per float
43 66 #define ASM_F1_INDICE_START 5 // 6 - 1, (-1) due to the VHDL behaviour
44 67 #define ASM_F1_INDICE_STOP 108 // 109 - 1, 2 packets of 52 bins
45 68 //
46 69 #define NB_BINS_PER_ASM_F2 96
47 70 #define NB_BINS_PER_PKT_ASM_F2 32
48 71 #define DLEN_ASM_F2_PKT 3200 // 32 * 25 * 4, 25 components per matrix, 4 bytes per float
49 72 #define ASM_F2_INDICE_START 6 // 7 - 1, (-1) due to the VHDL behaviour
50 73 #define ASM_F2_INDICE_STOP 101 // 102 - 1, 2 packets of 48 bins
51 74 //
52 75 #define KCOEFF_BLK_SIZE 130
76 #define KCOEFF_FREQ 2
53 77 #define NB_BINS_COMPRESSED_SM_F0 11
54 78 #define NB_BINS_COMPRESSED_SM_F1 13
55 79 #define NB_BINS_COMPRESSED_SM_F2 12
56 80 #define NB_BINS_COMPRESSED_SM 36 // 11 + 12 + 13
57 81 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
58 82 #define NB_BINS_COMPRESSED_SM_SBM_F1 26
59 83 #define NB_BINS_COMPRESSED_SM_SBM_F2 24
60 84 //
61 85 #define NB_BYTES_PER_BP1 9
62 86 #define NB_BYTES_PER_BP2 30
63 87 //
64 88 #define NB_BINS_TO_AVERAGE_ASM_F0 8
65 89 #define NB_BINS_TO_AVERAGE_ASM_F1 8
66 90 #define NB_BINS_TO_AVERAGE_ASM_F2 8
67 91 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
68 92 #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4
69 93 #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4
70 94 //
71 95 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS
72 96 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS
73 97 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F2 300 // 12 * 25 WORDS
74 98 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS
75 99 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS
76 100 #define TOTAL_SIZE_BP1_NORM_F0 99 // 9 * 11 UNSIGNED CHAR
77 101 #define TOTAL_SIZE_BP2_NORM_F0 330 // 30 * 11 UNSIGNED CHAR
78 102 #define TOTAL_SIZE_BP1_SBM_F0 198 // 9 * 22 UNSIGNED CHAR
79 103 // GENERAL
80 #define NB_SM_BEFORE_AVF0 8 // must be 8 due to the SM_average() function
81 #define NB_SM_BEFORE_AVF1 8 // must be 8 due to the SM_average() function
104 #define NB_SM_BEFORE_AVF0_F1 8 // must be 8 due to the SM_average() function
82 105 #define NB_SM_BEFORE_AVF2 1 // must be 1 due to the SM_average_f2() function
83 106
84 107 #endif // FSW_PARAMS_PROCESSING_H
85 108
@@ -1,14 +1,18
1 1 #ifndef TM_BYTE_POSITIONS_H
2 2 #define TM_BYTE_POSITIONS_H
3 3
4 4 #define BYTE_POS_CP_LFR_MODE 11
5 5
6 6 // TC_LFR_LOAD_NORMAL_PAR
7 7 #define BYTE_POS_SY_LFR_N_SWF_L 0
8 8 #define BYTE_POS_SY_LFR_N_SWF_P 2
9 9 #define BYTE_POS_SY_LFR_N_ASM_P 4
10 10 #define BYTE_POS_SY_LFR_N_BP_P0 6
11 11 #define BYTE_POS_SY_LFR_N_BP_P1 7
12 12 #define BYTE_POS_SY_LFR_N_CWF_LONG_F3 8
13 13
14 // TM_LFR_HK
15 #define BYTE_POS_HK_LFR_CPU_LOAD 26
16 #define BYTE_POS_HK_REACTION_WHEELS_FREQUENCY 135
17
14 18 #endif // TM_BYTE_POSITIONS_H
General Comments 0
You need to be logged in to leave comments. Login now