##// END OF EJS Templates
Converted timegen to cmake.
jeandet -
r302:94c9c25ace49 R3_plus draft
parent child
Show More
@@ -0,0 +1,8
1 [default]
2 name=Défaut
3 device=local
4 runtime=host
5 config-opts=
6 prefix=/home/jeandet/.cache/gnome-builder/install/DEV_PLE/host
7 app-id=
8 default=true
@@ -0,0 +1,67
1 cmake_minimum_required (VERSION 2.6)
2 project (timegen)
3
4 include(sparc-rtems)
5
6 include_directories("./src"
7 "./header"
8 "./header/processing"
9 "./src/LFR_basic-parameters")
10
11 set(SOURCES src/tc_handler.c
12 src/fsw_misc.c
13 src/fsw_init.c
14 src/fsw_globals.c
15 src/fsw_spacewire.c
16 src/tc_acceptance.c
17 ../LFR_basic-parameters/basic_parameters.c)
18
19
20 option(verbose "Enable verbose LFR" ON)
21 option(boot_messages "Enable LFR boot messages" ON)
22 option(debug_messages "Enable LFR debug messages" ON)
23 option(cpu_usage_report "Enable LFR cpu usage report" OFF)
24 option(stack_report "Enable LFR stack report" OFF)
25 option(vhdl_dev "?" OFF)
26 option(lpp_dpu_destid "Set to debug at LPP" ON)
27 option(debug_watchdog "Enable debug watchdog" OFF)
28 option(debug_tch "?" OFF)
29
30
31 if (verbose)
32 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
33 endif()
34 if (boot_messages)
35 add_definitions(-DBOOT_MESSAGES)
36 endif()
37 if (debug_messages)
38 add_definitions(-DDEBUG_MESSAGES)
39 endif()
40 if (cpu_usage_report)
41 add_definitions(-DPRINT_TASK_STATISTICS)
42 endif()
43 if (stack_report)
44 add_definitions(-DPRINT_STACK_REPORT)
45 endif()
46 if (vhdl_dev)
47 add_definitions(-DVHDL_DEV)
48 endif()
49 if (lpp_dpu_destid)
50 add_definitions(-DLPP_DPU_DESTID)
51 endif()
52 if (debug_watchdog)
53 add_definitions(-DDEBUG_WATCHDOG)
54 endif()
55 if (debug_tch)
56 add_definitions(-DDEBUG_TCH)
57 endif()
58
59 add_definitions(-DMSB_FIRST_TCH)
60
61 add_definitions(-DSWVERSION=-1-0)
62 add_definitions(-DSW_VERSION_N1=3)
63 add_definitions(-DSW_VERSION_N2=1)
64 add_definitions(-DSW_VERSION_N3=0)
65 add_definitions(-DSW_VERSION_N4=4)
66
67 add_executable(timegen ${SOURCES})
1 NO CONTENT: new file 100644, binary diff hidden
NO CONTENT: new file 100644, binary diff hidden
@@ -0,0 +1,219
1 #ifndef TC_TYPES_H
2 #define TC_TYPES_H
3
4 #include <ccsds_types.h>
5
6 #define PROTOCOLE_IDENTIFIER 0x02
7
8 // PACKET ID
9 #define TC_LFR_PACKET_ID 0x1ccc // PID 76 CAT 12
10
11 #define PACKET_LENGTH_TC_LFR_RESET (12 - CCSDS_TC_TM_PACKET_OFFSET)
12 #define PACKET_LENGTH_TC_LFR_LOAD_COMMON_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
13 #define PACKET_LENGTH_TC_LFR_LOAD_NORMAL_PAR (22 - CCSDS_TC_TM_PACKET_OFFSET)
14 #define PACKET_LENGTH_TC_LFR_LOAD_BURST_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
15 #define PACKET_LENGTH_TC_LFR_LOAD_SBM1_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
16 #define PACKET_LENGTH_TC_LFR_LOAD_SBM2_PAR (14 - CCSDS_TC_TM_PACKET_OFFSET)
17 #define PACKET_LENGTH_TC_LFR_DUMP_PAR (12 - CCSDS_TC_TM_PACKET_OFFSET)
18 #define PACKET_LENGTH_TC_LFR_ENTER_MODE (20 - CCSDS_TC_TM_PACKET_OFFSET)
19 #define PACKET_LENGTH_TC_LFR_UPDATE_INFO (46 - CCSDS_TC_TM_PACKET_OFFSET)
20 #define PACKET_LENGTH_TC_LFR_ENABLE_CALIBRATION (12 - CCSDS_TC_TM_PACKET_OFFSET)
21 #define PACKET_LENGTH_TC_LFR_DISABLE_CALIBRATION (12 - CCSDS_TC_TM_PACKET_OFFSET)
22 #define PACKET_LENGTH_TC_LFR_UPDATE_TIME (18 - CCSDS_TC_TM_PACKET_OFFSET)
23
24 // TC TYPES
25 #define TC_TYPE_DEFAULT 181
26 #define TC_TYPE_LFR_UPDATE_TIME 9
27
28 // TC SUBTYPES
29 #define TC_SUBTYPE_RESET 1
30 #define TC_SUBTYPE_LOAD_COMMON_PAR 11
31 #define TC_SUBTYPE_LOAD_NORMAL_PAR 13
32 #define TC_SUBTYPE_LOAD_BURST_PAR 19
33 #define TC_SUBTYPE_LOAD_SBM1_PAR 25
34 #define TC_SUBTYPE_LOAD_SBM2_PAR 27
35 #define TC_SUBTYPE_DUMP_PAR 31
36 #define TC_SUBTYPE_ENTER_MODE 41
37 #define TC_SUBTYPE_UPDATE_INFO 51
38 #define TC_SUBTYPE_ENABLE_CALIBRATION 61
39 #define TC_SUBTYPE_DISABLE_CALIBRATION 63
40 #define TC_SUBTYPE_UPDATE_TIME 129
41
42 // OTHER CONSTANTS
43 #define TC_LFR_PACKET_SEQUENCE_CONTROL 0xc000 // PID 76 CAT 12
44 #define TC_LFR_DATA_FIELD_HEADER0 0x19
45 #define TC_LFR_LOAD_COMMON_PAR_SPARE 0x00
46
47 struct Packet_TC_LFR_RESET_str
48 { // the CCSDS header is added by LPPMON
49 unsigned char packetID[2];
50 unsigned char packetSequenceControl[2];
51 unsigned char packetLength[2];
52 // DATA FIELD HEADER
53 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
54 unsigned char serviceType;
55 unsigned char serviceSubType;
56 unsigned char sourceID;
57 unsigned char crc[2];
58 };
59 typedef struct Packet_TC_LFR_RESET_str Packet_TC_LFR_RESET_t;
60
61 struct Packet_TC_LFR_ENTER_MODE_str
62 { // the CCSDS header is added by LPPMON
63 unsigned char packetID[2];
64 unsigned char packetSequenceControl[2];
65 unsigned char packetLength[2];
66 // DATA FIELD HEADER
67 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
68 unsigned char serviceType;
69 unsigned char serviceSubType;
70 unsigned char sourceID;
71 unsigned char spare;
72 unsigned char mode;
73 unsigned char enterModeTime[6];
74 unsigned char crc[2];
75 };
76 typedef struct Packet_TC_LFR_ENTER_MODE_str Packet_TC_LFR_ENTER_MODE_t;
77
78 struct Packet_TC_LFR_UPDATE_INFO_str
79 { // the CCSDS header is added by LPPMON
80 unsigned char packetID[2];
81 unsigned char packetSequenceControl[2];
82 unsigned char packetLength[2];
83 // DATA FIELD HEADER
84 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
85 unsigned char serviceType;
86 unsigned char serviceSubType;
87 unsigned char sourceID;
88 unsigned char set1;
89 unsigned char set2;
90 unsigned char set3_bias_setting_set1[6];
91 unsigned char set3_bias_setting_set2[6];
92 unsigned char set3_bias_voltage[4];
93 unsigned char set4[8];
94 unsigned char set5;
95 unsigned char set6;
96 unsigned char set7[8];
97 unsigned char crc[2];
98 };
99 typedef struct Packet_TC_LFR_UPDATE_INFO_str Packet_TC_LFR_UPDATE_INFO_t;
100
101 struct Packet_TC_LFR_DUMP_PAR_str
102 { // the CCSDS header is added by LPPMON
103 unsigned char packetID[2];
104 unsigned char packetSequenceControl[2];
105 unsigned char packetLength[2];
106 // DATA FIELD HEADER
107 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
108 unsigned char serviceType;
109 unsigned char serviceSubType;
110 unsigned char sourceID;
111 unsigned char crc[2];
112
113 };
114 typedef struct Packet_TC_LFR_DUMP_PAR_str Packet_TC_LFR_DUMP_PAR_t;
115
116 struct Packet_TC_LFR_LOAD_COMMON_PAR_str
117 { // the CCSDS header is added by LPPMON
118 unsigned char packetID[2];
119 unsigned char packetSequenceControl[2];
120 unsigned char packetLength[2];
121 // DATA FIELD HEADER
122 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
123 unsigned char serviceType;
124 unsigned char serviceSubType;
125 unsigned char sourceID;
126 unsigned char spare;
127 unsigned char bw_sp0_sp1_r0_r1;
128 unsigned char crc[2];
129
130 };
131 typedef struct Packet_TC_LFR_LOAD_COMMON_PAR_str Packet_TC_LFR_LOAD_COMMON_PAR_t;
132
133 struct Packet_TC_LFR_LOAD_NORMAL_PAR_str
134 { // the CCSDS header is added by LPPMON
135 unsigned char packetID[2];
136 unsigned char packetSequenceControl[2];
137 unsigned char packetLength[2];
138 // DATA FIELD HEADER
139 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
140 unsigned char serviceType;
141 unsigned char serviceSubType;
142 unsigned char sourceID;
143 unsigned char sy_lfr_n_swf_l[2];
144 unsigned char sy_lfr_n_swf_p[2];
145 unsigned char sy_lfr_n_asm_p[2];
146 unsigned char sy_lfr_n_bp_p0;
147 unsigned char sy_lfr_n_bp_p1;
148 unsigned char sy_lfr_n_cwf_long_f3;
149 unsigned char lfr_normal_parameters_spare;
150 unsigned char crc[2];
151 };
152 typedef struct Packet_TC_LFR_LOAD_NORMAL_PAR_str Packet_TC_LFR_LOAD_NORMAL_PAR_t;
153
154 struct Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_str
155 { // the CCSDS header is added by LPPMON
156 unsigned char packetID[2];
157 unsigned char packetSequenceControl[2];
158 unsigned char packetLength[2];
159 // DATA FIELD HEADER
160 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
161 unsigned char serviceType;
162 unsigned char serviceSubType;
163 unsigned char sourceID;
164 unsigned char sy_lfr_bp_p0;
165 unsigned char sy_lfr_bp_p1;
166 unsigned char crc[2];
167 };
168 typedef struct Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_str Packet_TC_LFR_LOAD_BURST_SBM1_SBM2_PAR_t;
169
170 struct Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_str
171 { // the CCSDS header is added by LPPMON
172 unsigned char packetID[2];
173 unsigned char packetSequenceControl[2];
174 unsigned char packetLength[2];
175 // DATA FIELD HEADER
176 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
177 unsigned char serviceType;
178 unsigned char serviceSubType;
179 unsigned char sourceID;
180 unsigned char crc[2];
181 };
182 typedef struct Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_str Packet_TC_LFR_ENABLE_DISABLE_CALIBRATION_t;
183
184 struct Packet_TC_LFR_UPDATE_TIME_str
185 { // the CCSDS header is added by LPPMON
186 unsigned char packetID[2];
187 unsigned char packetSequenceControl[2];
188 unsigned char packetLength[2];
189 // DATA FIELD HEADER
190 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
191 unsigned char serviceType;
192 unsigned char serviceSubType;
193 unsigned char sourceID;
194 unsigned char cp_rpw_time[6];
195 unsigned char crc[2];
196 };
197 typedef struct Packet_TC_LFR_UPDATE_TIME_str Packet_TC_LFR_UPDATE_TIME_t;
198
199 struct Packet_TC_LFR_UPDATE_TIME_WITH_HEADER_str
200 {
201 unsigned char targetLogicalAddress;
202 unsigned char protocolIdentifier;
203 unsigned char reserved;
204 unsigned char userApplication;
205 //
206 unsigned char packetID[2];
207 unsigned char packetSequenceControl[2];
208 unsigned char packetLength[2];
209 // DATA FIELD HEADER
210 unsigned char ccsdsSecHeaderFlag_pusVersion_ack;
211 unsigned char serviceType;
212 unsigned char serviceSubType;
213 unsigned char sourceID;
214 unsigned char cp_rpw_time[6];
215 unsigned char crc[2];
216 };
217 typedef struct Packet_TC_LFR_UPDATE_TIME_WITH_HEADER_str Packet_TC_LFR_UPDATE_TIME_WITH_HEADER_t;
218
219 #endif // TC_TYPES_H
This diff has been collapsed as it changes many lines, (665 lines changed) Show them Hide them
@@ -0,0 +1,665
1 #ifndef CCSDS_TYPES_H_INCLUDED
2 #define CCSDS_TYPES_H_INCLUDED
3
4 #include "fsw_params_processing.h"
5
6 #define CCSDS_PROTOCOLE_EXTRA_BYTES 4
7 #define CCSDS_TC_TM_PACKET_OFFSET 7
8 #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4
9 #define CCSDS_TM_PKT_MAX_SIZE 4412
10 #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4
11 #define CCSDS_TC_PKT_MAX_SIZE 256
12 #define CCSDS_TC_PKT_MIN_SIZE 16
13 #define CCSDS_PROCESS_ID 76
14 #define CCSDS_PACKET_CATEGORY 12
15 #define CCSDS_NODE_ADDRESS 0xfe
16 #define CCSDS_USER_APP 0x00
17
18 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
19 #define DEFAULT_RESERVED 0x00
20 #define DEFAULT_HKBIA 0x1e // 0001 1110
21
22 // PACKET ID
23 #define APID_TM_TC_EXE 0x0cc1 // PID 76 CAT 1
24 #define APID_TM_HK 0x0cc4 // PID 76 CAT 4
25 #define APID_TM_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
26 #define APID_TM_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
27 #define APID_TM_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
28 #define TM_PACKET_PID_DEFAULT 76
29 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
30 #define TM_PACKET_CAT_TC_EXE 1
31 #define TM_PACKET_CAT_HK 4
32 #define TM_PACKET_CAT_PARAMETER_DUMP 9
33 #define TM_PACKET_CAT_SCIENCE 12
34 #define TC_PACKET_CAT 12
35
36 // PACKET SEQUENCE CONTROL
37 #define TM_PACKET_SEQ_CTRL_CONTINUATION 0x00 // [0000 0000]
38 #define TM_PACKET_SEQ_CTRL_FIRST 0x40 // [0100 0000]
39 #define TM_PACKET_SEQ_CTRL_LAST 0x80 // [1000 0000]
40 #define TM_PACKET_SEQ_CTRL_STANDALONE 0xc0 // [1100 0000]
41 #define TM_PACKET_SEQ_CNT_DEFAULT 0x00 // [0000 0000]
42
43 // DESTINATION ID
44 #define TM_DESTINATION_ID_GROUND 0
45 #define TM_DESTINATION_ID_MISSION_TIMELINE 110
46 #define TM_DESTINATION_ID_TC_SEQUENCES 111
47 #define TM_DESTINATION_ID_RECOVERY_ACTION_COMMAND 112
48 #define TM_DESTINATION_ID_BACKUP_MISSION_TIMELINE 113
49 #define TM_DESTINATION_ID_DIRECT_CMD 120
50 #define TM_DESTINATION_ID_SPARE_GRD_SRC1 121
51 #define TM_DESTINATION_ID_SPARE_GRD_SRC2 122
52 #define TM_DESTINATION_ID_OBCP 15
53 #define TM_DESTINATION_ID_SYSTEM_CONTROL 14
54 #define TM_DESTINATION_ID_AOCS 11
55
56 #define CCSDS_DESTINATION_ID 0x01
57 #define CCSDS_PROTOCOLE_ID 0x02
58 #define CCSDS_RESERVED 0x00
59 #define CCSDS_USER_APP 0x00
60
61 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
62 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
63 #define SIZE_HK_PARAMETERS 112
64
65 // TC TYPES
66 #define TC_TYPE_GEN 181
67 #define TC_TYPE_TIME 9
68
69 // TC SUBTYPES
70 #define TC_SUBTYPE_RESET 1
71 #define TC_SUBTYPE_LOAD_COMM 11
72 #define TC_SUBTYPE_LOAD_NORM 13
73 #define TC_SUBTYPE_LOAD_BURST 19
74 #define TC_SUBTYPE_LOAD_SBM1 25
75 #define TC_SUBTYPE_LOAD_SBM2 27
76 #define TC_SUBTYPE_DUMP 31
77 #define TC_SUBTYPE_ENTER 41
78 #define TC_SUBTYPE_UPDT_INFO 51
79 #define TC_SUBTYPE_EN_CAL 61
80 #define TC_SUBTYPE_DIS_CAL 63
81 #define TC_SUBTYPE_UPDT_TIME 129
82
83 // TC LEN
84 #define TC_LEN_RESET 12
85 #define TC_LEN_LOAD_COMM 14
86 #define TC_LEN_LOAD_NORM 22
87 #define TC_LEN_LOAD_BURST 14
88 #define TC_LEN_LOAD_SBM1 14
89 #define TC_LEN_LOAD_SBM2 14
90 #define TC_LEN_DUMP 12
91 #define TC_LEN_ENTER 20
92 #define TC_LEN_UPDT_INFO 46
93 #define TC_LEN_EN_CAL 12
94 #define TC_LEN_DIS_CAL 12
95 #define TC_LEN_UPDT_TIME 18
96
97 // TM TYPES
98 #define TM_TYPE_TC_EXE 1
99 #define TM_TYPE_HK 3
100 #define TM_TYPE_PARAMETER_DUMP 3
101 #define TM_TYPE_LFR_SCIENCE 21
102
103 // TM SUBTYPES
104 #define TM_SUBTYPE_EXE_OK 7
105 #define TM_SUBTYPE_EXE_NOK 8
106 #define TM_SUBTYPE_HK 25
107 #define TM_SUBTYPE_PARAMETER_DUMP 25
108 #define TM_SUBTYPE_SCIENCE 3
109 #define TM_SUBTYPE_LFR_SCIENCE 3
110
111 // FAILURE CODES
112 #define ILLEGAL_APID 0
113 #define WRONG_LEN_PKT 1
114 #define INCOR_CHECKSUM 2
115 #define ILL_TYPE 3
116 #define ILL_SUBTYPE 4
117 #define WRONG_APP_DATA 5 // 0x00 0x05
118 #define TC_NOT_EXE 42000 // 0xa4 0x10
119 #define WRONG_SRC_ID 42001 // 0xa4 0x11
120 #define FUNCT_NOT_IMPL 42002 // 0xa4 0x12
121 #define FAIL_DETECTED 42003 // 0xa4 0x13
122 #define NOT_ALLOWED 42004 // 0xa4 0x14
123 #define CORRUPTED 42005 // 0xa4 0x15
124 #define CCSDS_TM_VALID 7
125
126 // TC SID
127 #define SID_TC_GROUND 0
128 #define SID_TC_MISSION_TIMELINE 110
129 #define SID_TC_TC_SEQUENCES 111
130 #define SID_TC_RECOVERY_ACTION_CMD 112
131 #define SID_TC_BACKUP_MISSION_TIMELINE 113
132 #define SID_TC_DIRECT_CMD 120
133 #define SID_TC_SPARE_GRD_SRC1 121
134 #define SID_TC_SPARE_GRD_SRC2 122
135 #define SID_TC_OBCP 15
136 #define SID_TC_SYSTEM_CONTROL 14
137 #define SID_TC_AOCS 11
138 #define SID_TC_RPW_INTERNAL 254
139
140 enum apid_destid{
141 GROUND,
142 MISSION_TIMELINE,
143 TC_SEQUENCES,
144 RECOVERY_ACTION_CMD,
145 BACKUP_MISSION_TIMELINE,
146 DIRECT_CMD,
147 SPARE_GRD_SRC1,
148 SPARE_GRD_SRC2,
149 OBCP,
150 SYSTEM_CONTROL,
151 AOCS,
152 RPW_INTERNAL
153 };
154 // SEQUENCE COUNTERS
155 #define SEQ_CNT_MAX 16383
156 #define SEQ_CNT_NB_DEST_ID 12
157
158 // TM SID
159 #define SID_HK 1
160 #define SID_PARAMETER_DUMP 10
161
162 #define SID_NORM_SWF_F0 3
163 #define SID_NORM_SWF_F1 4
164 #define SID_NORM_SWF_F2 5
165 #define SID_NORM_CWF_F3 1
166 #define SID_BURST_CWF_F2 2
167 #define SID_SBM1_CWF_F1 24
168 #define SID_SBM2_CWF_F2 25
169 #define SID_NORM_ASM_F0 11
170 #define SID_NORM_ASM_F1 12
171 #define SID_NORM_ASM_F2 13
172 #define SID_NORM_BP1_F0 14
173 #define SID_NORM_BP1_F1 15
174 #define SID_NORM_BP1_F2 16
175 #define SID_NORM_BP2_F0 19
176 #define SID_NORM_BP2_F1 20
177 #define SID_NORM_BP2_F2 21
178 #define SID_BURST_BP1_F0 17
179 #define SID_BURST_BP2_F0 22
180 #define SID_BURST_BP1_F1 18
181 #define SID_BURST_BP2_F1 23
182 #define SID_SBM1_BP1_F0 28
183 #define SID_SBM1_BP2_F0 31
184 #define SID_SBM2_BP1_F0 29
185 #define SID_SBM2_BP2_F0 32
186 #define SID_SBM2_BP1_F1 30
187 #define SID_SBM2_BP2_F1 33
188 #define SID_NORM_CWF_LONG_F3 34
189
190 // LENGTH (BYTES)
191 #define LENGTH_TM_LFR_TC_EXE_MAX 32
192 #define LENGTH_TM_LFR_HK 126
193
194 // HEADER_LENGTH
195 #define TM_HEADER_LEN 16
196 #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28
197 // PACKET_LENGTH
198 #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET)
199 #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET)
200 #define PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE (26 - CCSDS_TC_TM_PACKET_OFFSET)
201 #define PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED (24 - CCSDS_TC_TM_PACKET_OFFSET)
202 #define PACKET_LENGTH_TC_EXE_ERROR (24 - CCSDS_TC_TM_PACKET_OFFSET)
203 #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET)
204 #define PACKET_LENGTH_HK (124 - CCSDS_TC_TM_PACKET_OFFSET)
205 #define PACKET_LENGTH_PARAMETER_DUMP (36 - CCSDS_TC_TM_PACKET_OFFSET)
206 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F0 (2228 - CCSDS_TC_TM_PACKET_OFFSET) // 44 * 25 * 2 + 28
207 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F1 (2628 - CCSDS_TC_TM_PACKET_OFFSET) // 52 * 25 * 2 + 28
208 #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM_F2 (2428 - CCSDS_TC_TM_PACKET_OFFSET) // 48 * 25 * 2 + 28
209 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 (126 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 9 + 27 (1 spare bit in the header)
210 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 (356 - CCSDS_TC_TM_PACKET_OFFSET) // 11 * 30 + 26
211 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F1 (144 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 9 + 27 (1 spare bit in the header)
212 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 (416 - CCSDS_TC_TM_PACKET_OFFSET) // 13 * 30 + 26
213 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 (134 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 9 + 26
214 #define PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 (386 - CCSDS_TC_TM_PACKET_OFFSET) // 12 * 30 + 26
215 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 (224 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 9 + 26
216 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 (686 - CCSDS_TC_TM_PACKET_OFFSET) // 22 * 30 + 26
217 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 (260 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 9 + 26
218 #define PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 (806 - CCSDS_TC_TM_PACKET_OFFSET) // 26 * 30 + 26
219
220 #define PACKET_LENGTH_DELTA 11 // 7 + 4
221
222 #define SPARE1_PUSVERSION_SPARE2 0x10
223
224 // R1
225 #define TM_LEN_SCI_SWF_340 4101 // 340 * 12 + 10 + 12 - 1
226 #define TM_LEN_SCI_SWF_8 117 // 8 * 12 + 10 + 12 - 1
227 #define TM_LEN_SCI_CWF_340 4099 // 340 * 12 + 10 + 10 - 1
228 #define TM_LEN_SCI_CWF_8 115 // 8 * 12 + 10 + 10 - 1
229 #define TM_LEN_SCI_CWF3_LIGHT_340 2059 // 340 * 6 + 10 + 10 - 1
230 #define TM_LEN_SCI_CWF3_LIGHT_8 67 // 8 * 6 + 10 + 10 - 1
231 // R2
232 #define TM_LEN_SCI_SWF_304 3669 // 304 * 12 + 10 + 12 - 1
233 #define TM_LEN_SCI_SWF_224 2709 // 224 * 12 + 10 + 12 - 1
234 #define TM_LEN_SCI_CWF_336 4051 // 336 * 12 + 10 + 10 - 1
235 #define TM_LEN_SCI_CWF_672 4051 // 672 * 6 + 10 + 10 - 1
236 //
237 #define DEFAULT_PKTCNT 0x07
238 #define BLK_NR_304 0x0130
239 #define BLK_NR_224 0x00e0
240 #define BLK_NR_CWF 0x0150 // 336
241 #define BLK_NR_CWF_SHORT_F3 0x02a0 // 672
242
243 enum TM_TYPE{
244 TM_LFR_TC_EXE_OK,
245 TM_LFR_TC_EXE_ERR,
246 TM_LFR_HK,
247 TM_LFR_SCI,
248 TM_LFR_SCI_SBM,
249 TM_LFR_PAR_DUMP
250 };
251
252 typedef struct {
253 unsigned char targetLogicalAddress;
254 unsigned char protocolIdentifier;
255 unsigned char reserved;
256 unsigned char userApplication;
257 // PACKET HEADER
258 unsigned char packetID[2];
259 unsigned char packetSequenceControl[2];
260 unsigned char packetLength[2];
261 // DATA FIELD HEADER
262 unsigned char spare1_pusVersion_spare2;
263 unsigned char serviceType;
264 unsigned char serviceSubType;
265 unsigned char destinationID;
266 unsigned char time[6];
267 //
268 unsigned char telecommand_pkt_id[2];
269 unsigned char pkt_seq_control[2];
270 } Packet_TM_LFR_TC_EXE_SUCCESS_t;
271
272 typedef struct {
273 unsigned char targetLogicalAddress;
274 unsigned char protocolIdentifier;
275 unsigned char reserved;
276 unsigned char userApplication;
277 // PACKET HEADER
278 unsigned char packetID[2];
279 unsigned char packetSequenceControl[2];
280 unsigned char packetLength[2];
281 // DATA FIELD HEADER
282 unsigned char spare1_pusVersion_spare2;
283 unsigned char serviceType;
284 unsigned char serviceSubType;
285 unsigned char destinationID;
286 unsigned char time[6];
287 //
288 unsigned char tc_failure_code[2];
289 unsigned char telecommand_pkt_id[2];
290 unsigned char pkt_seq_control[2];
291 unsigned char tc_service;
292 unsigned char tc_subtype;
293 unsigned char byte_position;
294 unsigned char rcv_value;
295 } Packet_TM_LFR_TC_EXE_INCONSISTENT_t;
296
297 typedef struct {
298 unsigned char targetLogicalAddress;
299 unsigned char protocolIdentifier;
300 unsigned char reserved;
301 unsigned char userApplication;
302 // PACKET HEADER
303 unsigned char packetID[2];
304 unsigned char packetSequenceControl[2];
305 unsigned char packetLength[2];
306 // DATA FIELD HEADER
307 unsigned char spare1_pusVersion_spare2;
308 unsigned char serviceType;
309 unsigned char serviceSubType;
310 unsigned char destinationID;
311 unsigned char time[6];
312 //
313 unsigned char tc_failure_code[2];
314 unsigned char telecommand_pkt_id[2];
315 unsigned char pkt_seq_control[2];
316 unsigned char tc_service;
317 unsigned char tc_subtype;
318 unsigned char lfr_status_word[2];
319 } Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t;
320
321 typedef struct {
322 unsigned char targetLogicalAddress;
323 unsigned char protocolIdentifier;
324 unsigned char reserved;
325 unsigned char userApplication;
326 // PACKET HEADER
327 unsigned char packetID[2];
328 unsigned char packetSequenceControl[2];
329 unsigned char packetLength[2];
330 // DATA FIELD HEADER
331 unsigned char spare1_pusVersion_spare2;
332 unsigned char serviceType;
333 unsigned char serviceSubType;
334 unsigned char destinationID;
335 unsigned char time[6];
336 //
337 unsigned char tc_failure_code[2];
338 unsigned char telecommand_pkt_id[2];
339 unsigned char pkt_seq_control[2];
340 unsigned char tc_service;
341 unsigned char tc_subtype;
342 } Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t;
343
344 typedef struct {
345 unsigned char targetLogicalAddress;
346 unsigned char protocolIdentifier;
347 unsigned char reserved;
348 unsigned char userApplication;
349 // PACKET HEADER
350 unsigned char packetID[2];
351 unsigned char packetSequenceControl[2];
352 unsigned char packetLength[2];
353 // DATA FIELD HEADER
354 unsigned char spare1_pusVersion_spare2;
355 unsigned char serviceType;
356 unsigned char serviceSubType;
357 unsigned char destinationID;
358 unsigned char time[6];
359 //
360 unsigned char tc_failure_code[2];
361 unsigned char telecommand_pkt_id[2];
362 unsigned char pkt_seq_control[2];
363 unsigned char tc_service;
364 unsigned char tc_subtype;
365 } Packet_TM_LFR_TC_EXE_ERROR_t;
366
367 typedef struct {
368 unsigned char targetLogicalAddress;
369 unsigned char protocolIdentifier;
370 unsigned char reserved;
371 unsigned char userApplication;
372 // PACKET HEADER
373 unsigned char packetID[2];
374 unsigned char packetSequenceControl[2];
375 unsigned char packetLength[2];
376 // DATA FIELD HEADER
377 unsigned char spare1_pusVersion_spare2;
378 unsigned char serviceType;
379 unsigned char serviceSubType;
380 unsigned char destinationID;
381 unsigned char time[6];
382 //
383 unsigned char tc_failure_code[2];
384 unsigned char telecommand_pkt_id[2];
385 unsigned char pkt_seq_control[2];
386 unsigned char tc_service;
387 unsigned char tc_subtype;
388 unsigned char pkt_len_rcv_value[2];
389 unsigned char pkt_datafieldsize_cnt[2];
390 unsigned char rcv_crc[2];
391 unsigned char computed_crc[2];
392 } Packet_TM_LFR_TC_EXE_CORRUPTED_t;
393
394 typedef struct {
395 unsigned char targetLogicalAddress;
396 unsigned char protocolIdentifier;
397 unsigned char reserved;
398 unsigned char userApplication;
399 unsigned char packetID[2];
400 unsigned char packetSequenceControl[2];
401 unsigned char packetLength[2];
402 // DATA FIELD HEADER
403 unsigned char spare1_pusVersion_spare2;
404 unsigned char serviceType;
405 unsigned char serviceSubType;
406 unsigned char destinationID;
407 unsigned char time[6];
408 // AUXILIARY HEADER
409 unsigned char sid;
410 unsigned char hkBIA;
411 unsigned char pktCnt;
412 unsigned char pktNr;
413 unsigned char acquisitionTime[6];
414 unsigned char blkNr[2];
415 } Header_TM_LFR_SCIENCE_SWF_t;
416
417 typedef struct {
418 unsigned char targetLogicalAddress;
419 unsigned char protocolIdentifier;
420 unsigned char reserved;
421 unsigned char userApplication;
422 unsigned char packetID[2];
423 unsigned char packetSequenceControl[2];
424 unsigned char packetLength[2];
425 // DATA FIELD HEADER
426 unsigned char spare1_pusVersion_spare2;
427 unsigned char serviceType;
428 unsigned char serviceSubType;
429 unsigned char destinationID;
430 unsigned char time[6];
431 // AUXILIARY DATA HEADER
432 unsigned char sid;
433 unsigned char hkBIA;
434 unsigned char acquisitionTime[6];
435 unsigned char blkNr[2];
436 } Header_TM_LFR_SCIENCE_CWF_t;
437
438 typedef struct {
439 unsigned char targetLogicalAddress;
440 unsigned char protocolIdentifier;
441 unsigned char reserved;
442 unsigned char userApplication;
443 unsigned char packetID[2];
444 unsigned char packetSequenceControl[2];
445 unsigned char packetLength[2];
446 // DATA FIELD HEADER
447 unsigned char spare1_pusVersion_spare2;
448 unsigned char serviceType;
449 unsigned char serviceSubType;
450 unsigned char destinationID;
451 unsigned char time[6];
452 // AUXILIARY HEADER
453 unsigned char sid;
454 unsigned char biaStatusInfo;
455 unsigned char pa_lfr_pkt_cnt_asm;
456 unsigned char pa_lfr_pkt_nr_asm;
457 unsigned char acquisitionTime[6];
458 unsigned char pa_lfr_asm_blk_nr[2];
459 } Header_TM_LFR_SCIENCE_ASM_t;
460
461 typedef struct {
462 unsigned char targetLogicalAddress;
463 unsigned char protocolIdentifier;
464 unsigned char reserved;
465 unsigned char userApplication;
466 unsigned char packetID[2];
467 unsigned char packetSequenceControl[2];
468 unsigned char packetLength[2];
469 // DATA FIELD HEADER
470 unsigned char spare1_pusVersion_spare2;
471 unsigned char serviceType;
472 unsigned char serviceSubType;
473 unsigned char destinationID;
474 unsigned char time[6];
475 // AUXILIARY HEADER
476 unsigned char sid;
477 unsigned char biaStatusInfo;
478 unsigned char acquisitionTime[6];
479 unsigned char source_data_spare;
480 unsigned char pa_lfr_bp_blk_nr[2];
481 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
482
483 typedef struct {
484 unsigned char targetLogicalAddress;
485 unsigned char protocolIdentifier;