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