##// END OF EJS Templates
Merge
paul -
r308:0724e26d58fe merge 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,14
1 cmake_minimum_required (VERSION 2.6)
2 project (LFR_FSW)
3
4 if(NOT CMAKE_BUILD_TYPE)
5 set(CMAKE_BUILD_TYPE "Release" CACHE STRING
6 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
7 endif(NOT CMAKE_BUILD_TYPE)
8
9 set(LFR_BP_SRC ${CMAKE_CURRENT_SOURCE_DIR}/LFR_basic-parameters/basic_parameters.c)
10
11 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/sparc/")
12
13 add_subdirectory(src)
14 add_subdirectory(timegen)
@@ -0,0 +1,13
1 # LOAD FSW USING LINK 1
2 SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
3
4 dsu3plugin0.openFile("/opt/LFR/LFR-FSW/3.0.0.10/fsw")
5 dsu3plugin0.loadFile()
6
7 dsu3plugin0.run()
8
9 # START SENDING TIMECODES AT 1 Hz
10 SpwPlugin0.StarDundeeStartTimecodes( 1 )
11
12 # it is possible to change the time code frequency
13 #RMAPPlugin0.changeTimecodeFrequency(2)
@@ -0,0 +1,8
1 set(CMAKE_SYSTEM_NAME rtems)
2
3 set(CMAKE_C_COMPILER /opt/rtems-4.10/bin/sparc-rtems-gcc)
4 set(CMAKE_CXX_COMPILER /opt/rtems-4.10/bin/sparc-rtems-g++)
5 set(CMAKE_LINKER /opt/rtems-4.10/bin/sparc-rtems-g++)
6 SET(CMAKE_EXE_LINKER_FLAGS "-static")
7 set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
8 include_directories("/opt/rtems-4.10/sparc-rtems/leon3/lib/include")
@@ -0,0 +1,105
1 cmake_minimum_required (VERSION 2.6)
2 project (FSW)
3
4 include(sparc-rtems)
5
6 include_directories("../header"
7 "../header/lfr_common_headers"
8 "../header/processing"
9 "../LFR_basic-parameters"
10 "../src")
11
12 set(SOURCES wf_handler.c
13 tc_handler.c
14 fsw_misc.c
15 fsw_init.c
16 fsw_globals.c
17 fsw_spacewire.c
18 tc_load_dump_parameters.c
19 tm_lfr_tc_exe.c
20 tc_acceptance.c
21 processing/fsw_processing.c
22 processing/avf0_prc0.c
23 processing/avf1_prc1.c
24 processing/avf2_prc2.c
25 lfr_cpu_usage_report.c
26 ${LFR_BP_SRC}
27 ../header/wf_handler.h
28 ../header/tc_handler.h
29 ../header/grlib_regs.h
30 ../header/fsw_misc.h
31 ../header/fsw_init.h
32 ../header/fsw_spacewire.h
33 ../header/tc_load_dump_parameters.h
34 ../header/tm_lfr_tc_exe.h
35 ../header/tc_acceptance.h
36 ../header/processing/fsw_processing.h
37 ../header/processing/avf0_prc0.h
38 ../header/processing/avf1_prc1.h
39 ../header/processing/avf2_prc2.h
40 ../header/fsw_params_wf_handler.h
41 ../header/lfr_cpu_usage_report.h
42 ../header/lfr_common_headers/ccsds_types.h
43 ../header/lfr_common_headers/fsw_params.h
44 ../header/lfr_common_headers/fsw_params_nb_bytes.h
45 ../header/lfr_common_headers/fsw_params_processing.h
46 ../header/lfr_common_headers/tm_byte_positions.h
47 ../LFR_basic-parameters/basic_parameters.h
48 ../LFR_basic-parameters/basic_parameters_params.h
49 ../header/GscMemoryLPP.hpp
50 )
51
52
53 option(FSW_verbose "Enable verbose LFR" ON)
54 option(FSW_boot_messages "Enable LFR boot messages" ON)
55 option(FSW_debug_messages "Enable LFR debug messages" ON)
56 option(FSW_cpu_usage_report "Enable LFR cpu usage report" OFF)
57 option(FSW_stack_report "Enable LFR stack report" OFF)
58 option(FSW_vhdl_dev "?" OFF)
59 option(FSW_lpp_dpu_destid "Set to debug at LPP" ON)
60 option(FSW_debug_watchdog "Enable debug watchdog" OFF)
61 option(FSW_debug_tch "?" OFF)
62
63 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
64 set(SW_VERSION_N2 "1" CACHE STRING "Choose N2 FSW Version." FORCE)
65 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
66 set(SW_VERSION_N4 "4" CACHE STRING "Choose N4 FSW Version." FORCE)
67
68
69 if(FSW_verbose)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
71 endif()
72 if(FSW_boot_messages)
73 add_definitions(-DBOOT_MESSAGES)
74 endif()
75 if(FSW_debug_messages)
76 add_definitions(-DDEBUG_MESSAGES)
77 endif()
78 if(FSW_cpu_usage_report)
79 add_definitions(-DPRINT_TASK_STATISTICS)
80 endif()
81 if(FSW_stack_report)
82 add_definitions(-DPRINT_STACK_REPORT)
83 endif()
84 if(FSW_vhdl_dev)
85 add_definitions(-DVHDL_DEV)
86 endif()
87 if(FSW_lpp_dpu_destid)
88 add_definitions(-DLPP_DPU_DESTID)
89 endif()
90 if(FSW_debug_watchdog)
91 add_definitions(-DDEBUG_WATCHDOG)
92 endif()
93 if(FSW_debug_tch)
94 add_definitions(-DDEBUG_TCH)
95 endif()
96
97 add_definitions(-DMSB_FIRST_TCH)
98
99 add_definitions(-DSWVERSION=-1-0)
100 add_definitions(-DSW_VERSION_N1=${SW_VERSION_N1})
101 add_definitions(-DSW_VERSION_N2=${SW_VERSION_N2})
102 add_definitions(-DSW_VERSION_N3=${SW_VERSION_N3})
103 add_definitions(-DSW_VERSION_N4=${SW_VERSION_N4})
104
105 add_executable(FSW ${SOURCES})
@@ -0,0 +1,88
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 header/tc_handler.h
19 header/grlib_regs.h
20 header/fsw_params.h
21 header/fsw_misc.h
22 header/fsw_init.h
23 header/ccsds_types.h
24 header/fsw_spacewire.h
25 header/tc_acceptance.h
26 header/fsw_params_nb_bytes.h
27 header/fsw_params_processing.h
28 header/fsw_params_wf_handler.h
29 header/lfr_cpu_usage_report.h
30 ../LFR_basic-parameters/basic_parameters.h
31 ../LFR_basic-parameters/basic_parameters_params.h
32 header/TC_types.h
33 )
34
35
36 option(timegen_verbose "Enable verbose Timegen" ON)
37 option(timegen_boot_messages "Enable Timegen boot messages" ON)
38 option(timegen_debug_messages "Enable Timegen debug messages" ON)
39 option(timegen_cpu_usage_report "Enable Timegen cpu usage report" OFF)
40 option(timegen_stack_report "Enable Timegen stack report" OFF)
41 option(timegen_vhdl_dev "?" OFF)
42 option(timegen_lpp_dpu_destid "Set to debug at LPP" ON)
43 option(timegen_debug_watchdog "Enable debug watchdog" OFF)
44 option(timegen_debug_tch "?" OFF)
45
46 set(TIMEGEN_SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
47 set(TIMEGEN_SW_VERSION_N2 "1" CACHE STRING "Choose N2 FSW Version." FORCE)
48 set(TIMEGEN_SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
49 set(TIMEGEN_SW_VERSION_N4 "4" CACHE STRING "Choose N4 FSW Version." FORCE)
50
51
52 if (timegen_verbose)
53 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
54 endif()
55 if (timegen_boot_messages)
56 add_definitions(-DBOOT_MESSAGES)
57 endif()
58 if (timegen_debug_messages)
59 add_definitions(-DDEBUG_MESSAGES)
60 endif()
61 if (timegen_cpu_usage_report)
62 add_definitions(-DPRINT_TASK_STATISTICS)
63 endif()
64 if (timegen_stack_report)
65 add_definitions(-DPRINT_STACK_REPORT)
66 endif()
67 if (timegen_vhdl_dev)
68 add_definitions(-DVHDL_DEV)
69 endif()
70 if (timegen_lpp_dpu_destid)
71 add_definitions(-DLPP_DPU_DESTID)
72 endif()
73 if (timegen_debug_watchdog)
74 add_definitions(-DDEBUG_WATCHDOG)
75 endif()
76 if (timegen_debug_tch)
77 add_definitions(-DDEBUG_TCH)
78 endif()
79
80 add_definitions(-DMSB_FIRST_TCH)
81
82 add_definitions(-DSWVERSION=-1-0)
83 add_definitions(-DSW_VERSION_N1=${TIMEGEN_SW_VERSION_N1})
84 add_definitions(-DSW_VERSION_N2=${TIMEGEN_SW_VERSION_N2})
85 add_definitions(-DSW_VERSION_N3=${TIMEGEN_SW_VERSION_N3})
86 add_definitions(-DSW_VERSION_N4=${TIMEGEN_SW_VERSION_N4})
87
88 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;