##// END OF EJS Templates
sync
paul -
r23:72c4d5eb0bb9 default
parent child
Show More
@@ -1,742 +1,746
1 1 #ifndef CCSDS_TYPES_H_INCLUDED
2 2 #define CCSDS_TYPES_H_INCLUDED
3 3
4 4 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
5 5 #define CCSDS_TC_TM_PACKET_OFFSET 7
6 6 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
7 7 #define CCSDS_TM_PKT_MAX_SIZE 4412
8 8 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
9 9 #define CCSDS_TC_PKT_MAX_SIZE 256
10 10 #define CCSDS_TC_PKT_MIN_SIZE 16
11 11 #define CCSDS_PROCESS_ID 76
12 12 #define CCSDS_PACKET_CATEGORY 12
13 13 #define CCSDS_NODE_ADDRESS 0xfe
14 14 #define CCSDS_USER_APP 0x00
15 15
16 16 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
17 17 #define DEFAULT_RESERVED 0x00
18 18 #define DEFAULT_HKBIA 0x1e // 0001 1110
19 19
20 20 // PACKET ID
21 21 #define TM_PACKET_PID_DEFAULT 76
22 22 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
23 23 #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1
24 24 #define APID_TM_HK 0x0cc4 // PID 76 CAT 4
25 25 #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
26 26 #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
27 27 #define APID_TM_PARAMETER_DUMP 0x0cc6 // PID 76 CAT 6
28 28 #define APID_TM_KCOEFFICIENTS_DUMP 0x0cc6 // PID 76 CAT 6
29 29 // PACKET CAT
30 30 #define TM_PACKET_CAT_TC_EXE 1
31 31 #define TM_PACKET_CAT_HK 4
32 32 #define TM_PACKET_CAT_SCIENCE 12
33 33 #define TM_PACKET_CAT_DUMP 6
34 34
35 35 // PACKET SEQUENCE CONTROL
36 36 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
37 37 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
38 38 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
39 39 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
40 40 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
41 41
42 42 // DESTINATION ID
43 43 #define TM_DESTINATION_ID_GROUND 0
44 44 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
45 45 #define TM_DESTINATION_ID_TC_SEQUENCES 111
46 46 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
47 47 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
48 48 #define TM_DESTINATION_ID_DIRECT_CMD 120
49 49 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
50 50 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
51 51 #define TM_DESTINATION_ID_OBCP 15
52 52 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
53 53 #define TM_DESTINATION_ID_AOCS 11
54 54
55 55 //*********************************************************
56 56 //*** /!\ change CCSDS_DESTINATION_ID before flight /!\ ***
57 57 //*********************************************************
58 58 #ifdef LPP_DPU_DESTID
59 59 #define CCSDS_DESTINATION_ID 32
60 60 #else
61 61 #define CCSDS_DESTINATION_ID 0x01
62 62 #endif
63 63 #define CCSDS_PROTOCOLE_ID 0x02
64 64 #define CCSDS_RESERVED 0x00
65 65 #define CCSDS_USER_APP 0x00
66 66
67 67 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
68 68 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
69 69 #define SIZE_HK_PARAMETERS 112
70 70
71 71 // TC TYPES
72 72 #define TC_TYPE_GEN 181
73 73 #define TC_TYPE_TIME 9
74 74
75 75 // TC SUBTYPES
76 76 #define TC_SUBTYPE_RESET 1
77 77 #define TC_SUBTYPE_LOAD_COMM 11
78 78 #define TC_SUBTYPE_LOAD_NORM 13
79 79 #define TC_SUBTYPE_LOAD_BURST 19
80 80 #define TC_SUBTYPE_LOAD_SBM1 25
81 81 #define TC_SUBTYPE_LOAD_SBM2 27
82 82 #define TC_SUBTYPE_DUMP 31
83 83 #define TC_SUBTYPE_ENTER 41
84 84 #define TC_SUBTYPE_UPDT_INFO 51
85 85 #define TC_SUBTYPE_EN_CAL 61
86 86 #define TC_SUBTYPE_DIS_CAL 63
87 87 #define TC_SUBTYPE_LOAD_K 93
88 88 #define TC_SUBTYPE_DUMP_K 95
89 89 #define TC_SUBTYPE_LOAD_FBINS 91
90 90 #define TC_SUBTYPE_UPDT_TIME 129
91 91
92 92 // TC LEN
93 93 #define TC_LEN_RESET 12
94 94 #define TC_LEN_LOAD_COMM 14
95 95 #define TC_LEN_LOAD_NORM 22
96 96 #define TC_LEN_LOAD_BURST 14
97 97 #define TC_LEN_LOAD_SBM1 14
98 98 #define TC_LEN_LOAD_SBM2 14
99 99 #define TC_LEN_DUMP 12
100 100 #define TC_LEN_ENTER 20
101 101 #define TC_LEN_UPDT_INFO 46
102 102 #define TC_LEN_EN_CAL 12
103 103 #define TC_LEN_DIS_CAL 12
104 104 #define TC_LEN_LOAD_K 142
105 105 #define TC_LEN_DUMP_K 12
106 106 #define TC_LEN_LOAD_FBINS 60
107 107 #define TC_LEN_UPDT_TIME 18
108 108
109 109 // PACKET CODES
110 110 #define TM_CODE_K_DUMP 0xb5600b00 // 181 (0xb5) ** 96 (0x60) ** 11 (0x0b) ** 0 (0x00)
111 111
112 112 // TM TYPES
113 113 #define TM_TYPE_TC_EXE 1
114 114 #define TM_TYPE_HK 3
115 115 #define TM_TYPE_LFR_SCIENCE 21
116 116 #define TM_TYPE_PARAMETER_DUMP 181
117 117 #define TM_TYPE_K_DUMP 181
118 118
119 119 // TM SUBTYPES
120 120 #define TM_SUBTYPE_EXE_OK 7
121 121 #define TM_SUBTYPE_EXE_NOK 8
122 122 #define TM_SUBTYPE_HK 25
123 123 #define TM_SUBTYPE_LFR_SCIENCE_3 3 // TM packets with fixed size
124 124 #define TM_SUBTYPE_LFR_SCIENCE_6 6 // TM packets with variable size
125 125 #define TM_SUBTYPE_PARAMETER_DUMP 32
126 126 #define TM_SUBTYPE_K_DUMP 96
127 127
128 128 // FAILURE CODES
129 129 #define ILLEGAL_APID 0
130 130 #define WRONG_LEN_PKT 1
131 131 #define INCOR_CHECKSUM 2
132 132 #define ILL_TYPE 3
133 133 #define ILL_SUBTYPE 4
134 134 #define WRONG_APP_DATA 5 // 0x00 0x05
135 135 #define TC_NOT_EXE 42000 // 0xa4 0x10
136 136 #define WRONG_SRC_ID 42001 // 0xa4 0x11
137 137 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
138 138 #define FAIL_DETECTED 42003 // 0xa4 0x13
139 139 #define NOT_ALLOWED 42004 // 0xa4 0x14
140 140 #define CORRUPTED 42005 // 0xa4 0x15
141 141 #define CCSDS_TM_VALID 7
142 142
143 143 // TC SID
144 144 #define SID_TC_GROUND 0
145 145 #define SID_TC_MISSION_TIMELINE 110
146 146 #define SID_TC_TC_SEQUENCES 111
147 147 #define SID_TC_RECOVERY_ACTION_CMD 112
148 148 #define SID_TC_BACKUP_MISSION_TIMELINE 113
149 149 #define SID_TC_DIRECT_CMD 120
150 150 #define SID_TC_SPARE_GRD_SRC1 121
151 151 #define SID_TC_SPARE_GRD_SRC2 122
152 152 #define SID_TC_OBCP 15
153 153 #define SID_TC_SYSTEM_CONTROL 14
154 154 #define SID_TC_AOCS 11
155 155 #define SID_TC_RPW_INTERNAL 254
156 156
157 157 enum apid_destid{
158 158 GROUND,
159 159 MISSION_TIMELINE,
160 160 TC_SEQUENCES,
161 161 RECOVERY_ACTION_CMD,
162 162 BACKUP_MISSION_TIMELINE,
163 163 DIRECT_CMD,
164 164 SPARE_GRD_SRC1,
165 165 SPARE_GRD_SRC2,
166 166 OBCP,
167 167 SYSTEM_CONTROL,
168 168 AOCS,
169 169 RPW_INTERNAL
170 170 };
171 171 // SEQUENCE COUNTERS
172 172 #define SEQ_CNT_MAX 16383
173 173 #define SEQ_CNT_NB_DEST_ID 12
174 174
175 175 // TM SID
176 176 #define SID_HK 1
177 177
178 178 #define SID_NORM_SWF_F0 3
179 179 #define SID_NORM_SWF_F1 4
180 180 #define SID_NORM_SWF_F2 5
181 181 #define SID_NORM_CWF_F3 1
182 182 #define SID_BURST_CWF_F2 2
183 183 #define SID_SBM1_CWF_F1 24
184 184 #define SID_SBM2_CWF_F2 25
185 185 #define SID_NORM_ASM_F0 11
186 186 #define SID_NORM_ASM_F1 12
187 187 #define SID_NORM_ASM_F2 13
188 188 #define SID_NORM_BP1_F0 14
189 189 #define SID_NORM_BP1_F1 15
190 190 #define SID_NORM_BP1_F2 16
191 191 #define SID_NORM_BP2_F0 19
192 192 #define SID_NORM_BP2_F1 20
193 193 #define SID_NORM_BP2_F2 21
194 194 #define SID_BURST_BP1_F0 17
195 195 #define SID_BURST_BP2_F0 22
196 196 #define SID_BURST_BP1_F1 18
197 197 #define SID_BURST_BP2_F1 23
198 198 #define SID_SBM1_BP1_F0 28
199 199 #define SID_SBM1_BP2_F0 31
200 200 #define SID_SBM2_BP1_F0 29
201 201 #define SID_SBM2_BP2_F0 32
202 202 #define SID_SBM2_BP1_F1 30
203 203 #define SID_SBM2_BP2_F1 33
204 204 #define SID_NORM_CWF_LONG_F3 34
205 205
206 206 #define SID_PARAMETER_DUMP 10
207 207 #define SID_K_DUMP 11
208 208
209 209 // HEADER_LENGTH
210 #define TM_HEADER_LEN 16
211 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
210 //#define TM_HEADER_LEN 16
211 #define HEADER_LENGTH_TM_LFR_SCIENCE_CWF 32
212 #define HEADER_LENGTH_TM_LFR_SCIENCE_SWF 34
213 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 34
212 214 // PACKET_LENGTH
213 215 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
214 216 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
215 217 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
216 218 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
217 219 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
218 220 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
219 221 #define PACKET_LENGTH_HK (136 - CCSDS_TC_TM_PACKET_OFFSET)
220 222 #define PACKET_LENGTH_PARAMETER_DUMP (84 - CCSDS_TC_TM_PACKET_OFFSET)
221 223 #define PACKET_LENGTH_K_DUMP (3920 - CCSDS_TC_TM_PACKET_OFFSET)
222 224 // SCIENCE ASM
223 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (3230 - CCSDS_TC_TM_PACKET_OFFSET) // 32 * 25 * 4 + 30 => 88 bins (32 + 32 + 24 ), 3 packets
224 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (3630 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 30 => 104 bins (36 + 36 + 32 ), 3 packets
225 #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
226 #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
227 #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
228 #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
225 229 #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
226 230 // SCIENCE NORM
227 231 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (150 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 11 + 29 (1 spare byte in the header)
228 232 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (172 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 11 + 29 (1 spare byte in the header)
229 233 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 (160 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 11 + 28
230 234 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (358 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 28
231 235 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (418 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 28
232 236 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 (388 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 30 + 28
233 237 // SCIENCE SBM
234 238 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (270 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 11 + 28
235 239 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (688 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 28
236 240 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (314 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 11 + 28
237 241 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (808 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 28
238 242
239 243 #define PACKET_LENGTH_DELTA 11 // 7 + 4
240 244
241 245 #define SPARE1_PUSVERSION_SPARE2 0x10
242 246
243 247 // R3
244 248 // one snapshot = 2048 samples = 6 packets * 304 + 224
245 249 #define TM_LEN_SCI_SWF_304 (3678 - CCSDS_TC_TM_PACKET_OFFSET) // 304 * 12 + 30
246 250 #define TM_LEN_SCI_SWF_224 (2718 - CCSDS_TC_TM_PACKET_OFFSET) // 224 * 12 + 30
247 251 // one continuous buffer = 2688 samples = 8 packets * 336
248 252 #define TM_LEN_SCI_CWF_336 (4060 - CCSDS_TC_TM_PACKET_OFFSET) // 336 * 12 + 28
249 253 #define TM_LEN_SCI_CWF_672 (4060 - CCSDS_TC_TM_PACKET_OFFSET) // 672 * 6 + 28
250 254 //
251 255 #define DEFAULT_PKTCNT 0x07
252 256 #define BLK_NR_304 0x0130
253 257 #define BLK_NR_224 0x00e0
254 258 #define BLK_NR_CWF 0x0150 // 336
255 259 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
256 260
257 261 enum TM_TYPE{
258 262 TM_LFR_TC_EXE_OK,
259 263 TM_LFR_TC_EXE_ERR,
260 264 TM_LFR_HK,
261 265 TM_LFR_SCI,
262 266 TM_LFR_SCI_SBM,
263 267 TM_LFR_PAR_DUMP
264 268 };
265 269
266 270 typedef struct {
267 271 unsigned char targetLogicalAddress;
268 272 unsigned char protocolIdentifier;
269 273 unsigned char reserved;
270 274 unsigned char userApplication;
271 275 // PACKET HEADER
272 276 unsigned char packetID[2];
273 277 unsigned char packetSequenceControl[2];
274 278 unsigned char packetLength[2];
275 279 // DATA FIELD HEADER
276 280 unsigned char spare1_pusVersion_spare2;
277 281 unsigned char serviceType;
278 282 unsigned char serviceSubType;
279 283 unsigned char destinationID;
280 284 unsigned char time[6];
281 285 //
282 286 unsigned char telecommand_pkt_id[2];
283 287 unsigned char pkt_seq_control[2];
284 288 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
285 289
286 290 typedef struct {
287 291 unsigned char targetLogicalAddress;
288 292 unsigned char protocolIdentifier;
289 293 unsigned char reserved;
290 294 unsigned char userApplication;
291 295 // PACKET HEADER
292 296 unsigned char packetID[2];
293 297 unsigned char packetSequenceControl[2];
294 298 unsigned char packetLength[2];
295 299 // DATA FIELD HEADER
296 300 unsigned char spare1_pusVersion_spare2;
297 301 unsigned char serviceType;
298 302 unsigned char serviceSubType;
299 303 unsigned char destinationID;
300 304 unsigned char time[6];
301 305 //
302 306 unsigned char tc_failure_code[2];
303 307 unsigned char telecommand_pkt_id[2];
304 308 unsigned char pkt_seq_control[2];
305 309 unsigned char tc_service;
306 310 unsigned char tc_subtype;
307 311 unsigned char byte_position;
308 312 unsigned char rcv_value;
309 313 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
310 314
311 315 typedef struct {
312 316 unsigned char targetLogicalAddress;
313 317 unsigned char protocolIdentifier;
314 318 unsigned char reserved;
315 319 unsigned char userApplication;
316 320 // PACKET HEADER
317 321 unsigned char packetID[2];
318 322 unsigned char packetSequenceControl[2];
319 323 unsigned char packetLength[2];
320 324 // DATA FIELD HEADER
321 325 unsigned char spare1_pusVersion_spare2;
322 326 unsigned char serviceType;
323 327 unsigned char serviceSubType;
324 328 unsigned char destinationID;
325 329 unsigned char time[6];
326 330 //
327 331 unsigned char tc_failure_code[2];
328 332 unsigned char telecommand_pkt_id[2];
329 333 unsigned char pkt_seq_control[2];
330 334 unsigned char tc_service;
331 335 unsigned char tc_subtype;
332 336 unsigned char lfr_status_word[2];
333 337 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
334 338
335 339 typedef struct {
336 340 unsigned char targetLogicalAddress;
337 341 unsigned char protocolIdentifier;
338 342 unsigned char reserved;
339 343 unsigned char userApplication;
340 344 // PACKET HEADER
341 345 unsigned char packetID[2];
342 346 unsigned char packetSequenceControl[2];
343 347 unsigned char packetLength[2];
344 348 // DATA FIELD HEADER
345 349 unsigned char spare1_pusVersion_spare2;
346 350 unsigned char serviceType;
347 351 unsigned char serviceSubType;
348 352 unsigned char destinationID;
349 353 unsigned char time[6];
350 354 //
351 355 unsigned char tc_failure_code[2];
352 356 unsigned char telecommand_pkt_id[2];
353 357 unsigned char pkt_seq_control[2];
354 358 unsigned char tc_service;
355 359 unsigned char tc_subtype;
356 360 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
357 361
358 362 typedef struct {
359 363 unsigned char targetLogicalAddress;
360 364 unsigned char protocolIdentifier;
361 365 unsigned char reserved;
362 366 unsigned char userApplication;
363 367 // PACKET HEADER
364 368 unsigned char packetID[2];
365 369 unsigned char packetSequenceControl[2];
366 370 unsigned char packetLength[2];
367 371 // DATA FIELD HEADER
368 372 unsigned char spare1_pusVersion_spare2;
369 373 unsigned char serviceType;
370 374 unsigned char serviceSubType;
371 375 unsigned char destinationID;
372 376 unsigned char time[6];
373 377 //
374 378 unsigned char tc_failure_code[2];
375 379 unsigned char telecommand_pkt_id[2];
376 380 unsigned char pkt_seq_control[2];
377 381 unsigned char tc_service;
378 382 unsigned char tc_subtype;
379 383 } Packet_TM_LFR_TC_EXE_ERROR_t;
380 384
381 385 typedef struct {
382 386 unsigned char targetLogicalAddress;
383 387 unsigned char protocolIdentifier;
384 388 unsigned char reserved;
385 389 unsigned char userApplication;
386 390 // PACKET HEADER
387 391 unsigned char packetID[2];
388 392 unsigned char packetSequenceControl[2];
389 393 unsigned char packetLength[2];
390 394 // DATA FIELD HEADER
391 395 unsigned char spare1_pusVersion_spare2;
392 396 unsigned char serviceType;
393 397 unsigned char serviceSubType;
394 398 unsigned char destinationID;
395 399 unsigned char time[6];
396 400 //
397 401 unsigned char tc_failure_code[2];
398 402 unsigned char telecommand_pkt_id[2];
399 403 unsigned char pkt_seq_control[2];
400 404 unsigned char tc_service;
401 405 unsigned char tc_subtype;
402 406 unsigned char pkt_len_rcv_value[2];
403 407 unsigned char pkt_datafieldsize_cnt[2];
404 408 unsigned char rcv_crc[2];
405 409 unsigned char computed_crc[2];
406 410 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
407 411
408 412 typedef struct {
409 413 unsigned char targetLogicalAddress;
410 414 unsigned char protocolIdentifier;
411 415 unsigned char reserved;
412 416 unsigned char userApplication;
413 417 unsigned char packetID[2];
414 418 unsigned char packetSequenceControl[2];
415 419 unsigned char packetLength[2];
416 420 // DATA FIELD HEADER
417 421 unsigned char spare1_pusVersion_spare2;
418 422 unsigned char serviceType;
419 423 unsigned char serviceSubType;
420 424 unsigned char destinationID;
421 425 unsigned char time[6];
422 426 // AUXILIARY HEADER
423 427 unsigned char sid;
424 428 unsigned char hkBIA;
425 429 unsigned char sy_lfr_common_parameters_spare;
426 430 unsigned char sy_lfr_common_parameters;
427 431 unsigned char pktCnt;
428 432 unsigned char pktNr;
429 433 unsigned char acquisitionTime[6];
430 434 unsigned char blkNr[2];
431 435 } Header_TM_LFR_SCIENCE_SWF_t;
432 436
433 437 typedef struct {
434 438 unsigned char targetLogicalAddress;
435 439 unsigned char protocolIdentifier;
436 440 unsigned char reserved;
437 441 unsigned char userApplication;
438 442 unsigned char packetID[2];
439 443 unsigned char packetSequenceControl[2];
440 444 unsigned char packetLength[2];
441 445 // DATA FIELD HEADER
442 446 unsigned char spare1_pusVersion_spare2;
443 447 unsigned char serviceType;
444 448 unsigned char serviceSubType;
445 449 unsigned char destinationID;
446 450 unsigned char time[6];
447 451 // AUXILIARY DATA HEADER
448 452 unsigned char sid;
449 453 unsigned char hkBIA;
450 454 unsigned char sy_lfr_common_parameters_spare;
451 455 unsigned char sy_lfr_common_parameters;
452 456 unsigned char acquisitionTime[6];
453 457 unsigned char blkNr[2];
454 458 } Header_TM_LFR_SCIENCE_CWF_t;
455 459
456 460 typedef struct {
457 461 unsigned char targetLogicalAddress;
458 462 unsigned char protocolIdentifier;
459 463 unsigned char reserved;
460 464 unsigned char userApplication;
461 465 unsigned char packetID[2];
462 466 unsigned char packetSequenceControl[2];
463 467 unsigned char packetLength[2];
464 468 // DATA FIELD HEADER
465 469 unsigned char spare1_pusVersion_spare2;
466 470 unsigned char serviceType;
467 471 unsigned char serviceSubType;
468 472 unsigned char destinationID;
469 473 unsigned char time[6];
470 474 // AUXILIARY HEADER
471 475 unsigned char sid;
472 476 unsigned char biaStatusInfo;
473 477 unsigned char sy_lfr_common_parameters_spare;
474 478 unsigned char sy_lfr_common_parameters;
475 479 unsigned char pa_lfr_pkt_cnt_asm;
476 480 unsigned char pa_lfr_pkt_nr_asm;
477 481 unsigned char acquisitionTime[6];
478 482 unsigned char pa_lfr_asm_blk_nr[2];
479 483 } Header_TM_LFR_SCIENCE_ASM_t;
480 484
481 485 typedef struct {
482 486 unsigned char targetLogicalAddress;
483 487 unsigned char protocolIdentifier;
484 488 unsigned char reserved;
485 489 unsigned char userApplication;
486 490 unsigned char packetID[2];
487 491 unsigned char packetSequenceControl[2];
488 492 unsigned char packetLength[2];
489 493 // DATA FIELD HEADER
490 494 unsigned char spare1_pusVersion_spare2;
491 495 unsigned char serviceType;
492 496 unsigned char serviceSubType;
493 497 unsigned char destinationID;
494 498 unsigned char time[6];
495 499 // AUXILIARY HEADER
496 500 unsigned char sid;
497 501 unsigned char biaStatusInfo;
498 502 unsigned char sy_lfr_common_parameters_spare;
499 503 unsigned char sy_lfr_common_parameters;
500 504 unsigned char acquisitionTime[6];
501 505 unsigned char source_data_spare;
502 506 unsigned char pa_lfr_bp_blk_nr[2];
503 507 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
504 508
505 509 typedef struct {
506 510 unsigned char targetLogicalAddress;
507 511 unsigned char protocolIdentifier;
508 512 unsigned char reserved;
509 513 unsigned char userApplication;
510 514 unsigned char packetID[2];
511 515 unsigned char packetSequenceControl[2];
512 516 unsigned char packetLength[2];
513 517 // DATA FIELD HEADER
514 518 unsigned char spare1_pusVersion_spare2;
515 519 unsigned char serviceType;
516 520 unsigned char serviceSubType;
517 521 unsigned char destinationID;
518 522 unsigned char time[6];
519 523 // AUXILIARY HEADER
520 524 unsigned char sid;
521 525 unsigned char biaStatusInfo;
522 526 unsigned char sy_lfr_common_parameters_spare;
523 527 unsigned char sy_lfr_common_parameters;
524 528 unsigned char acquisitionTime[6];
525 529 unsigned char pa_lfr_bp_blk_nr[2];
526 530 } Header_TM_LFR_SCIENCE_BP_t;
527 531
528 532 typedef struct {
529 533 //targetLogicalAddress is removed by the grspw module
530 534 unsigned char protocolIdentifier;
531 535 unsigned char reserved;
532 536 unsigned char userApplication;
533 537 unsigned char packetID[2];
534 538 unsigned char packetSequenceControl[2];
535 539 unsigned char packetLength[2];
536 540 // DATA FIELD HEADER
537 541 unsigned char headerFlag_pusVersion_Ack;
538 542 unsigned char serviceType;
539 543 unsigned char serviceSubType;
540 544 unsigned char sourceID;
541 545 unsigned char dataAndCRC[CCSDS_TC_PKT_MAX_SIZE-10];
542 546 } ccsdsTelecommandPacket_t;
543 547
544 548 typedef struct {
545 549 unsigned char targetLogicalAddress;
546 550 unsigned char protocolIdentifier;
547 551 unsigned char reserved;
548 552 unsigned char userApplication;
549 553 unsigned char packetID[2];
550 554 unsigned char packetSequenceControl[2];
551 555 unsigned char packetLength[2];
552 556 unsigned char spare1_pusVersion_spare2;
553 557 unsigned char serviceType;
554 558 unsigned char serviceSubType;
555 559 unsigned char destinationID;
556 560 unsigned char time[6];
557 561 unsigned char sid;
558 562
559 563 //**************
560 564 // HK PARAMETERS
561 565 unsigned char lfr_status_word[2];
562 566 unsigned char lfr_sw_version[4];
563 567 unsigned char lfr_fpga_version[3];
564 568 // ressource statistics
565 569 unsigned char hk_lfr_cpu_load;
566 570 unsigned char hk_lfr_cpu_load_max;
567 571 unsigned char hk_lfr_cpu_load_aver;
568 572 unsigned char hk_lfr_q_sd_fifo_size_max;
569 573 unsigned char hk_lfr_q_sd_fifo_size;
570 574 unsigned char hk_lfr_q_rv_fifo_size_max;
571 575 unsigned char hk_lfr_q_rv_fifo_size;
572 576 unsigned char hk_lfr_q_p0_fifo_size_max;
573 577 unsigned char hk_lfr_q_p0_fifo_size;
574 578 unsigned char hk_lfr_q_p1_fifo_size_max;
575 579 unsigned char hk_lfr_q_p1_fifo_size;
576 580 unsigned char hk_lfr_q_p2_fifo_size_max;
577 581 unsigned char hk_lfr_q_p2_fifo_size;
578 582 // tc statistics
579 583 unsigned char hk_lfr_update_info_tc_cnt[2];
580 584 unsigned char hk_lfr_update_time_tc_cnt[2];
581 585 unsigned char hk_lfr_exe_tc_cnt[2];
582 586 unsigned char hk_lfr_rej_tc_cnt[2];
583 587 unsigned char hk_lfr_last_exe_tc_id[2];
584 588 unsigned char hk_lfr_last_exe_tc_type[2];
585 589 unsigned char hk_lfr_last_exe_tc_subtype[2];
586 590 unsigned char hk_lfr_last_exe_tc_time[6];
587 591 unsigned char hk_lfr_last_rej_tc_id[2];
588 592 unsigned char hk_lfr_last_rej_tc_type[2];
589 593 unsigned char hk_lfr_last_rej_tc_subtype[2];
590 594 unsigned char hk_lfr_last_rej_tc_time[6];
591 595 // anomaly statistics
592 596 unsigned char hk_lfr_le_cnt[2];
593 597 unsigned char hk_lfr_me_cnt[2];
594 598 unsigned char hk_lfr_he_cnt[2];
595 599 unsigned char hk_lfr_last_er_rid[2];
596 600 unsigned char hk_lfr_last_er_code;
597 601 unsigned char hk_lfr_last_er_time[6];
598 602 // vhdl_blk_status
599 603 unsigned char hk_lfr_vhdl_aa_sm;
600 604 unsigned char hk_lfr_vhdl_fft_sr;
601 605 unsigned char hk_lfr_vhdl_cic_hk;
602 606 unsigned char hk_lfr_vhdl_iir_cal;
603 607 // spacewire_if_statistics
604 608 unsigned char hk_lfr_dpu_spw_pkt_rcv_cnt[2];
605 609 unsigned char hk_lfr_dpu_spw_pkt_sent_cnt[2];
606 610 unsigned char hk_lfr_dpu_spw_tick_out_cnt;
607 611 unsigned char hk_lfr_dpu_spw_last_timc;
608 612 // ahb error statistics
609 613 unsigned char hk_lfr_last_fail_addr[4];
610 614 // temperatures
611 615 unsigned char hk_lfr_temp_scm[2];
612 616 unsigned char hk_lfr_temp_pcb[2];
613 617 unsigned char hk_lfr_temp_fpga[2];
614 618 // spacecraft potential
615 619 unsigned char hk_lfr_sc_v_f3[2];
616 620 unsigned char hk_lfr_sc_e1_f3[2];
617 621 unsigned char hk_lfr_sc_e2_f3[2];
618 622 // lfr common parameters
619 623 unsigned char sy_lfr_common_parameters_spare;
620 624 unsigned char sy_lfr_common_parameters;
621 625 // error counters
622 626 unsigned char hk_lfr_dpu_spw_parity;
623 627 unsigned char hk_lfr_dpu_spw_disconnect;
624 628 unsigned char hk_lfr_dpu_spw_escape;
625 629 unsigned char hk_lfr_dpu_spw_credit;
626 630 unsigned char hk_lfr_dpu_spw_write_sync;
627 631 unsigned char hk_lfr_dpu_spw_rx_ahb;
628 632 unsigned char hk_lfr_dpu_spw_tx_ahb;
629 633 unsigned char hk_lfr_dpu_spw_early_eop;
630 634 unsigned char hk_lfr_dpu_spw_invalid_addr;
631 635 unsigned char hk_lfr_dpu_spw_eep;
632 636 unsigned char hk_lfr_dpu_spw_rx_too_big;
633 637 // timecode
634 638 unsigned char hk_lfr_timecode_erroneous;
635 639 unsigned char hk_lfr_timecode_missing;
636 640 unsigned char hk_lfr_timecode_invalid;
637 641 // time
638 642 unsigned char hk_lfr_time_timecode_it;
639 643 unsigned char hk_lfr_time_not_synchro;
640 644 unsigned char hk_lfr_time_timecode_ctr;
641 645 // hk_lfr_buffer_dpu_
642 646 unsigned char hk_lfr_buffer_dpu_tc_fifo;
643 647 unsigned char hk_lfr_buffer_dpu_tm_fifo;
644 648 // hk_lfr_ahb_
645 649 unsigned char hk_lfr_ahb_correctable;
646 650 unsigned char hk_lfr_ahb_uncorrectable;
647 651 // spare
648 652 unsigned char parameters_spare;
649 653 } Packet_TM_LFR_HK_t;
650 654
651 655 typedef struct {
652 656 unsigned char targetLogicalAddress;
653 657 unsigned char protocolIdentifier;
654 658 unsigned char reserved;
655 659 unsigned char userApplication;
656 660 unsigned char packetID[2];
657 661 unsigned char packetSequenceControl[2];
658 662 unsigned char packetLength[2];
659 663 // DATA FIELD HEADER
660 664 unsigned char spare1_pusVersion_spare2;
661 665 unsigned char serviceType;
662 666 unsigned char serviceSubType;
663 667 unsigned char destinationID;
664 668 unsigned char time[6];
665 669 unsigned char sid;
666 670
667 671 //******************
668 672 // COMMON PARAMETERS
669 673 unsigned char sy_lfr_common_parameters_spare;
670 674 unsigned char sy_lfr_common_parameters;
671 675
672 676 //******************
673 677 // NORMAL PARAMETERS
674 678 unsigned char sy_lfr_n_swf_l[2];
675 679 unsigned char sy_lfr_n_swf_p[2];
676 680 unsigned char sy_lfr_n_asm_p[2];
677 681 unsigned char sy_lfr_n_bp_p0;
678 682 unsigned char sy_lfr_n_bp_p1;
679 683 unsigned char sy_lfr_n_cwf_long_f3;
680 684 unsigned char lfr_normal_parameters_spare;
681 685
682 686 //*****************
683 687 // BURST PARAMETERS
684 688 unsigned char sy_lfr_b_bp_p0;
685 689 unsigned char sy_lfr_b_bp_p1;
686 690
687 691 //****************
688 692 // SBM1 PARAMETERS
689 693 unsigned char sy_lfr_s1_bp_p0;
690 694 unsigned char sy_lfr_s1_bp_p1;
691 695
692 696 //****************
693 697 // SBM2 PARAMETERS
694 698 unsigned char sy_lfr_s2_bp_p0;
695 699 unsigned char sy_lfr_s2_bp_p1;
696 700
697 701 // mask F0
698 702 unsigned char sy_lfr_fbins_f0_word1[4];
699 703 unsigned char sy_lfr_fbins_f0_word2[4];
700 704 unsigned char sy_lfr_fbins_f0_word3[4];
701 705 unsigned char sy_lfr_fbins_f0_word4[4];
702 706 // mask F1
703 707 unsigned char sy_lfr_fbins_f1_word1[4];
704 708 unsigned char sy_lfr_fbins_f1_word2[4];
705 709 unsigned char sy_lfr_fbins_f1_word3[4];
706 710 unsigned char sy_lfr_fbins_f1_word4[4];
707 711 // mask F2
708 712 unsigned char sy_lfr_fbins_f2_word1[4];
709 713 unsigned char sy_lfr_fbins_f2_word2[4];
710 714 unsigned char sy_lfr_fbins_f2_word3[4];
711 715 unsigned char sy_lfr_fbins_f2_word4[4];
712 716
713 717 // SPARE
714 718 unsigned char source_data_spare;
715 719 } Packet_TM_LFR_PARAMETER_DUMP_t;
716 720
717 721 typedef struct {
718 722 unsigned char targetLogicalAddress;
719 723 unsigned char protocolIdentifier;
720 724 unsigned char reserved;
721 725 unsigned char userApplication;
722 726 unsigned char packetID[2];
723 727 unsigned char packetSequenceControl[2];
724 728 unsigned char packetLength[2];
725 729 // DATA FIELD HEADER
726 730 unsigned char spare1_pusVersion_spare2;
727 731 unsigned char serviceType;
728 732 unsigned char serviceSubType;
729 733 unsigned char destinationID;
730 734 unsigned char time[6];
731 735 unsigned char sid;
732 736 unsigned char pkt_cnt;
733 737 unsigned char pkt_nr;
734 738 unsigned char blk_nr;
735 739
736 740 //******************
737 741 // SOURCE DATA repeated N times with N in [0 .. PA_LFR_KCOEFF_BLK_NR]
738 742 unsigned char kcoeff_blks[3900]; // one blk is 2 + 4 * 32 = 130 bytes, 30 blks max in one packet (30 * 130 = 3900)
739 743
740 744 } Packet_TM_LFR_KCOEFFICIENTS_DUMP_t;
741 745
742 746 #endif // CCSDS_TYPES_H_INCLUDED
@@ -1,280 +1,280
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 12 typedef struct ring_node
13 13 {
14 14 struct ring_node *previous;
15 15 struct ring_node *next;
16 16 unsigned int sid;
17 17 unsigned int coarseTime;
18 18 unsigned int fineTime;
19 19 int buffer_address;
20 20 unsigned int status;
21 21 } ring_node;
22 22
23 23 //************************
24 24 // flight software version
25 25 // this parameters is handled by the Qt project options
26 26
27 27 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
28 28 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
29 29 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
30 30 #define TIME_OFFSET 2
31 31 #define TIME_OFFSET_IN_BYTES 8
32 32 //#define WAVEFORM_EXTENDED_HEADER_OFFSET 22
33 33 #define NB_BYTES_SWF_BLK (2 * 6)
34 34 #define NB_WORDS_SWF_BLK 3
35 35 #define NB_BYTES_CWF3_LIGHT_BLK 6
36 36 //#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
37 37 #define NB_RING_NODES_F0 3 // AT LEAST 3
38 38 #define NB_RING_NODES_F1 5 // AT LEAST 3
39 39 #define NB_RING_NODES_F2 5 // AT LEAST 3
40 40 #define NB_RING_NODES_F3 3 // AT LEAST 3
41 41
42 42 //**********
43 43 // LFR MODES
44 44 #define LFR_MODE_STANDBY 0
45 45 #define LFR_MODE_NORMAL 1
46 46 #define LFR_MODE_BURST 2
47 47 #define LFR_MODE_SBM1 3
48 48 #define LFR_MODE_SBM2 4
49 49
50 50 #define TDS_MODE_LFM 5
51 51 #define TDS_MODE_STANDBY 0
52 52 #define TDS_MODE_NORMAL 1
53 53 #define TDS_MODE_BURST 2
54 54 #define TDS_MODE_SBM1 3
55 55 #define TDS_MODE_SBM2 4
56 56
57 57 #define THR_MODE_STANDBY 0
58 58 #define THR_MODE_NORMAL 1
59 59 #define THR_MODE_BURST 2
60 60
61 61 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
62 62 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
63 63 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
64 64 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
65 65 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
66 66 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
67 67 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
68 68 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
69 69 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
70 70 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
71 71 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
72 72 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
73 73 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
74 74 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
75 75 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
76 76 #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15
77 77 #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16
78 78 #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17
79 79 #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18
80 80 #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19
81 81 #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20
82 82 #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21
83 83 #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22
84 84
85 85 //****************************
86 86 // LFR DEFAULT MODE PARAMETERS
87 87 // COMMON
88 88 #define DEFAULT_SY_LFR_COMMON0 0x00
89 89 #define DEFAULT_SY_LFR_COMMON1 0x20 // default value bw sp0 sp1 r0 r1 r2 = 1 0 0 0 0 0
90 90 // NORM
91 91 #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample
92 92 #define DFLT_SY_LFR_N_SWF_P 300 // sec
93 93 #define DFLT_SY_LFR_N_ASM_P 3600 // sec
94 94 #define DFLT_SY_LFR_N_BP_P0 4 // sec
95 95 #define DFLT_SY_LFR_N_BP_P1 20 // sec
96 96 #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
97 97 #define MIN_DELTA_SNAPSHOT 16 // sec
98 98 // BURST
99 99 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
100 100 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
101 101 // SBM1
102 102 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
103 103 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
104 104 // SBM2
105 105 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
106 106 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
107 107 // ADDITIONAL PARAMETERS
108 108 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
109 109 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
110 110 // STATUS WORD
111 111 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
112 112 #define DEFAULT_STATUS_WORD_BYTE1 0x00
113 113 //
114 114 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
115 115 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
116 116 //****************************
117 117
118 118 //*****************************
119 119 // APB REGISTERS BASE ADDRESSES
120 120 #define REGS_ADDR_APBUART 0x80000100
121 121 #define REGS_ADDR_GPTIMER 0x80000300
122 122 #define REGS_ADDR_GRSPW 0x80000500
123 123 #define APB_OFFSET_GRSPW_TIME_REGISTER 0x14
124 124 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
125 125 #define REGS_ADDR_GRGPIO 0x80000b00
126 126
127 127 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
128 128 //#define REGS_ADDR_WAVEFORM_PICKER 0x80000f50
129 129 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f54 // PDB >= 0.1.28
130 130 #define REGS_ADDR_VHDL_VERSION 0x80000ff0
131 131
132 132 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
133 133 #define APBUART_CTRL_REG_MASK_TE 0x00000002
134 134 // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1
135 135 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400
136 136
137 137 //**********
138 138 // IRQ LINES
139 139 #define IRQ_SM_SIMULATOR 9
140 140 #define IRQ_SPARC_SM_SIMULATOR 0x19 // see sparcv8.pdf p.76 for interrupt levels
141 141 #define IRQ_WAVEFORM_PICKER 14
142 142 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
143 143 #define IRQ_SPECTRAL_MATRIX 6
144 144 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
145 145
146 146 //*****
147 147 // TIME
148 148 #define CLKDIV_SM_SIMULATOR (10416 - 1) // 10 ms => nominal is 1/96 = 0.010416667, 10417 - 1 = 10416
149 149 #define TIMER_SM_SIMULATOR 1
150 150 #define HK_PERIOD 100 // 100 * 10ms => 1s
151 151 #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000
152 152 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
153 153
154 154 //**********
155 155 // LPP CODES
156 156 #define LFR_SUCCESSFUL 0
157 157 #define LFR_DEFAULT 1
158 158 #define LFR_EXE_ERROR 2
159 159
160 160 //******
161 161 // RTEMS
162 162 #define TASKID_RECV 1
163 163 #define TASKID_ACTN 2
164 164 #define TASKID_SPIQ 3
165 165 #define TASKID_STAT 4
166 166 #define TASKID_AVF0 5
167 167 #define TASKID_SWBD 6
168 168 #define TASKID_WFRM 7
169 169 #define TASKID_DUMB 8
170 170 #define TASKID_HOUS 9
171 171 #define TASKID_PRC0 10
172 172 #define TASKID_CWF3 11
173 173 #define TASKID_CWF2 12
174 174 #define TASKID_CWF1 13
175 175 #define TASKID_SEND 14
176 176 #define TASKID_WTDG 15
177 177 #define TASKID_AVF1 16
178 178 #define TASKID_PRC1 17
179 179 #define TASKID_AVF2 18
180 180 #define TASKID_PRC2 19
181 181
182 182 //#define TASK_PRIORITY_SPIQ 5
183 183 //#define TASK_PRIORITY_WTDG 10
184 184 //#define TASK_PRIORITY_HOUS 20
185 185 //#define TASK_PRIORITY_AVF0 25
186 186 //#define TASK_PRIORITY_AVF1 30
187 187 //#define TASK_PRIORITY_AVF2 33
188 188 //#define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
189 189 //#define TASK_PRIORITY_CWF2 35 //
190 190 //#define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
191 191 //#define TASK_PRIORITY_WFRM 40
192 192 //#define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
193 193 //#define TASK_PRIORITY_RECV 45
194 194 //#define TASK_PRIORITY_SEND 50
195 195 //#define TASK_PRIORITY_ACTN 50
196 196 //#define TASK_PRIORITY_PRC2 90
197 197 //#define TASK_PRIORITY_PRC0 100
198 198 //#define TASK_PRIORITY_PRC1 105
199 199 //#define TASK_PRIORITY_STAT 200
200 200 //#define TASK_PRIORITY_DUMB 200
201 201
202 202 #define TASK_PRIORITY_SPIQ 5
203 203 #define TASK_PRIORITY_WTDG 20
204 204 #define TASK_PRIORITY_HOUS 30
205 205 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
206 206 #define TASK_PRIORITY_CWF2 35 //
207 207 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
208 208 #define TASK_PRIORITY_WFRM 40
209 209 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
210 210 #define TASK_PRIORITY_SEND 45
211 211 #define TASK_PRIORITY_RECV 50
212 212 #define TASK_PRIORITY_ACTN 50
213 213 #define TASK_PRIORITY_AVF0 60
214 214 #define TASK_PRIORITY_AVF1 70
215 215 #define TASK_PRIORITY_PRC0 100
216 216 #define TASK_PRIORITY_PRC1 100
217 217 #define TASK_PRIORITY_AVF2 110
218 218 #define TASK_PRIORITY_PRC2 110
219 219 #define TASK_PRIORITY_STAT 200
220 220 #define TASK_PRIORITY_DUMB 200
221 221
222 222 #define MSG_QUEUE_COUNT_RECV 10
223 223 #define MSG_QUEUE_COUNT_SEND 50
224 224 #define MSG_QUEUE_COUNT_PRC0 10
225 225 #define MSG_QUEUE_COUNT_PRC1 10
226 226 #define MSG_QUEUE_COUNT_PRC2 5
227 #define MSG_QUEUE_SIZE_SEND 810 // 806 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
227 #define MSG_QUEUE_SIZE_SEND 812 // 808 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
228 228 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
229 229 #define MSG_QUEUE_SIZE_PRC0 28 // two pointers, one rtems_event + 4 integers
230 230 #define MSG_QUEUE_SIZE_PRC1 28 // two pointers, one rtems_event + 4 integers
231 231 #define MSG_QUEUE_SIZE_PRC2 28 // two pointers, one rtems_event + 4 integers
232 232
233 233 #define QUEUE_RECV 0
234 234 #define QUEUE_SEND 1
235 235 #define QUEUE_PRC0 2
236 236 #define QUEUE_PRC1 3
237 237 #define QUEUE_PRC2 4
238 238
239 239 //*******
240 240 // MACROS
241 241 #ifdef PRINT_MESSAGES_ON_CONSOLE
242 242 #define PRINTF(x) printf(x);
243 243 #define PRINTF1(x,y) printf(x,y);
244 244 #define PRINTF2(x,y,z) printf(x,y,z);
245 245 #else
246 246 #define PRINTF(x) ;
247 247 #define PRINTF1(x,y) ;
248 248 #define PRINTF2(x,y,z) ;
249 249 #endif
250 250
251 251 #ifdef BOOT_MESSAGES
252 252 #define BOOT_PRINTF(x) printf(x);
253 253 #define BOOT_PRINTF1(x,y) printf(x,y);
254 254 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
255 255 #else
256 256 #define BOOT_PRINTF(x) ;
257 257 #define BOOT_PRINTF1(x,y) ;
258 258 #define BOOT_PRINTF2(x,y,z) ;
259 259 #endif
260 260
261 261 #ifdef DEBUG_MESSAGES
262 262 #define DEBUG_PRINTF(x) printf(x);
263 263 #define DEBUG_PRINTF1(x,y) printf(x,y);
264 264 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
265 265 #else
266 266 #define DEBUG_PRINTF(x) ;
267 267 #define DEBUG_PRINTF1(x,y) ;
268 268 #define DEBUG_PRINTF2(x,y,z) ;
269 269 #endif
270 270
271 271 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
272 272
273 273 struct param_local_str{
274 274 unsigned int local_sbm1_nb_cwf_sent;
275 275 unsigned int local_sbm1_nb_cwf_max;
276 276 unsigned int local_sbm2_nb_cwf_sent;
277 277 unsigned int local_sbm2_nb_cwf_max;
278 278 };
279 279
280 280 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,77 +1,81
1 1 #ifndef FSW_PARAMS_PROCESSING_H
2 2 #define FSW_PARAMS_PROCESSING_H
3 3
4 4 #define NB_BINS_PER_SM 128
5 5 #define NB_VALUES_PER_SM 25
6 6 #define TOTAL_SIZE_SM 3200 // 25 * 128 = 0xC80
7 7 #define TOTAL_SIZE_NORM_BP1_F0 99 // 11 * 9 = 99
8 8 #define TOTAL_SIZE_NORM_BP1_F1 117 // 13 * 9 = 117
9 9 #define TOTAL_SIZE_NORM_BP1_F2 108 // 12 * 9 = 108
10 10 #define TOTAL_SIZE_SBM1_BP1_F0 198 // 22 * 9 = 198
11 11 // F0
12 12 #define NB_RING_NODES_SM_F0 20 // AT LEAST 8 due to the way the averaging is done
13 13 #define NB_RING_NODES_ASM_BURST_SBM_F0 10 // AT LEAST 3
14 14 #define NB_RING_NODES_ASM_NORM_F0 10 // AT LEAST 3
15 15 #define NB_RING_NODES_ASM_F0 3 // AT LEAST 3
16 16 // F1
17 17 #define NB_RING_NODES_SM_F1 12 // AT LEAST 8 due to the way the averaging is done
18 18 #define NB_RING_NODES_ASM_BURST_SBM_F1 5 // AT LEAST 3
19 19 #define NB_RING_NODES_ASM_NORM_F1 5 // AT LEAST 3
20 20 #define NB_RING_NODES_ASM_F1 3 // AT LEAST 3
21 21 // F2
22 22 #define NB_RING_NODES_SM_F2 5 // AT LEAST 3
23 23 #define NB_RING_NODES_ASM_NORM_F2 3 // AT LEAST 3
24 24 #define NB_RING_NODES_ASM_F2 3 // AT LEAST 3
25 25 //
26 26 #define NB_BINS_PER_ASM_F0 88
27 #define NB_BINS_PER_PKT_ASM_F0 44
28 #define TOTAL_SIZE_ASM_F0_IN_BYTES 4400 // 25 * 88 * 2
27 #define NB_BINS_PER_PKT_ASM_F0_1 32
28 #define NB_BINS_PER_PKT_ASM_F0_2 24
29 #define DLEN_ASM_F0_PKT_1 3200 // 32 * 25 * 4, 25 components per matrix, 4 bytes per float
30 #define DLEN_ASM_F0_PKT_2 2400 // 24 * 25 * 4, 25 components per matrix, 4 bytes per float
29 31 #define ASM_F0_INDICE_START 16 // 17 - 1, (-1) due to the VHDL behaviour
30 32 #define ASM_F0_INDICE_STOP 103 // 104 - 1, 2 packets of 44 bins
31 33 //
32 34 #define NB_BINS_PER_ASM_F1 104
33 #define NB_BINS_PER_PKT_ASM_F1 52
34 #define TOTAL_SIZE_ASM_F1_IN_BYTES 5200 // 25 * 104 * 2
35 #define NB_BINS_PER_PKT_ASM_F1_1 36
36 #define NB_BINS_PER_PKT_ASM_F1_2 32
37 #define DLEN_ASM_F1_PKT_1 3600 // 36 * 25 * 4, 25 components per matrix, 4 bytes per float
38 #define DLEN_ASM_F1_PKT_2 3200 // 32 * 25 * 4, 25 components per matrix, 4 bytes per float
35 39 #define ASM_F1_INDICE_START 5 // 6 - 1, (-1) due to the VHDL behaviour
36 40 #define ASM_F1_INDICE_STOP 108 // 109 - 1, 2 packets of 52 bins
37 41 //
38 42 #define NB_BINS_PER_ASM_F2 96
39 #define NB_BINS_PER_PKT_ASM_F2 48
40 #define TOTAL_SIZE_ASM_F2_IN_BYTES 4800 // 25 * 96 * 2
43 #define NB_BINS_PER_PKT_ASM_F2 32
44 #define DLEN_ASM_F2_PKT 3200 // 32 * 25 * 4, 25 components per matrix, 4 bytes per float
41 45 #define ASM_F2_INDICE_START 6 // 7 - 1, (-1) due to the VHDL behaviour
42 46 #define ASM_F2_INDICE_STOP 101 // 102 - 1, 2 packets of 48 bins
43 47 //
44 48 #define KCOEFF_BLK_SIZE 130
45 49 #define NB_BINS_COMPRESSED_SM_F0 11
46 50 #define NB_BINS_COMPRESSED_SM_F1 13
47 51 #define NB_BINS_COMPRESSED_SM_F2 12
48 52 #define NB_BINS_COMPRESSED_SM 36 // 11 + 12 + 13
49 53 #define NB_BINS_COMPRESSED_SM_SBM_F0 22
50 54 #define NB_BINS_COMPRESSED_SM_SBM_F1 26
51 55 #define NB_BINS_COMPRESSED_SM_SBM_F2 24
52 56 //
53 57 #define NB_BYTES_PER_BP1 9
54 58 #define NB_BYTES_PER_BP2 30
55 59 //
56 60 #define NB_BINS_TO_AVERAGE_ASM_F0 8
57 61 #define NB_BINS_TO_AVERAGE_ASM_F1 8
58 62 #define NB_BINS_TO_AVERAGE_ASM_F2 8
59 63 #define NB_BINS_TO_AVERAGE_ASM_SBM_F0 4
60 64 #define NB_BINS_TO_AVERAGE_ASM_SBM_F1 4
61 65 #define NB_BINS_TO_AVERAGE_ASM_SBM_F2 4
62 66 //
63 67 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F0 275 // 11 * 25 WORDS
64 68 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F1 325 // 13 * 25 WORDS
65 69 #define TOTAL_SIZE_COMPRESSED_ASM_NORM_F2 300 // 12 * 25 WORDS
66 70 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F0 550 // 22 * 25 WORDS
67 71 #define TOTAL_SIZE_COMPRESSED_ASM_SBM_F1 650 // 26 * 25 WORDS
68 72 #define TOTAL_SIZE_BP1_NORM_F0 99 // 9 * 11 UNSIGNED CHAR
69 73 #define TOTAL_SIZE_BP2_NORM_F0 330 // 30 * 11 UNSIGNED CHAR
70 74 #define TOTAL_SIZE_BP1_SBM_F0 198 // 9 * 22 UNSIGNED CHAR
71 75 // GENERAL
72 76 #define NB_SM_BEFORE_AVF0 8 // must be 8 due to the SM_average() function
73 77 #define NB_SM_BEFORE_AVF1 8 // must be 8 due to the SM_average() function
74 78 #define NB_SM_BEFORE_AVF2 1 // must be 1 due to the SM_average_f2() function
75 79
76 80 #endif // FSW_PARAMS_PROCESSING_H
77 81
General Comments 0
You need to be logged in to leave comments. Login now