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