@@ -1,2 +1,2 | |||||
1 | 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters |
|
1 | 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters | |
2 | 1f3d7ce688e982a378d739596c8e3f8972f40b9d header/lfr_common_headers |
|
2 | c3197ff831df5057bdd145a4efd94ded0618661f header/lfr_common_headers |
@@ -1,124 +1,124 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = |
|
3 | # CONFIG options = | |
4 | # verbose |
|
4 | # verbose | |
5 | # boot_messages |
|
5 | # boot_messages | |
6 | # debug_messages |
|
6 | # debug_messages | |
7 | # cpu_usage_report |
|
7 | # cpu_usage_report | |
8 | # stack_report |
|
8 | # stack_report | |
9 | # vhdl_dev |
|
9 | # vhdl_dev | |
10 | # debug_tch |
|
10 | # debug_tch | |
11 | # lpp_dpu_destid /!\ REMOVE BEFORE DELIVERY TO LESIA /!\ |
|
11 | # lpp_dpu_destid /!\ REMOVE BEFORE DELIVERY TO LESIA /!\ | |
12 | # debug_watchdog |
|
12 | # debug_watchdog | |
13 | CONFIG += console verbose lpp_dpu_destid |
|
13 | CONFIG += console verbose lpp_dpu_destid | |
14 | CONFIG -= qt |
|
14 | CONFIG -= qt | |
15 |
|
15 | |||
16 | include(./sparc.pri) |
|
16 | include(./sparc.pri) | |
17 |
|
17 | |||
18 | # flight software version |
|
18 | # flight software version | |
19 | SWVERSION=-1-0 |
|
19 | SWVERSION=-1-0 | |
20 | DEFINES += SW_VERSION_N1=3 # major |
|
20 | DEFINES += SW_VERSION_N1=3 # major | |
21 |
DEFINES += SW_VERSION_N2= |
|
21 | DEFINES += SW_VERSION_N2=1 # minor | |
22 | DEFINES += SW_VERSION_N3=0 # patch |
|
22 | DEFINES += SW_VERSION_N3=0 # patch | |
23 |
DEFINES += SW_VERSION_N4= |
|
23 | DEFINES += SW_VERSION_N4=0 # internal | |
24 |
|
24 | |||
25 | # <GCOV> |
|
25 | # <GCOV> | |
26 | #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage |
|
26 | #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage | |
27 | #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc |
|
27 | #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc | |
28 | # </GCOV> |
|
28 | # </GCOV> | |
29 |
|
29 | |||
30 | # <CHANGE BEFORE FLIGHT> |
|
30 | # <CHANGE BEFORE FLIGHT> | |
31 | contains( CONFIG, lpp_dpu_destid ) { |
|
31 | contains( CONFIG, lpp_dpu_destid ) { | |
32 | DEFINES += LPP_DPU_DESTID |
|
32 | DEFINES += LPP_DPU_DESTID | |
33 | } |
|
33 | } | |
34 | # </CHANGE BEFORE FLIGHT> |
|
34 | # </CHANGE BEFORE FLIGHT> | |
35 |
|
35 | |||
36 | contains( CONFIG, debug_tch ) { |
|
36 | contains( CONFIG, debug_tch ) { | |
37 | DEFINES += DEBUG_TCH |
|
37 | DEFINES += DEBUG_TCH | |
38 | } |
|
38 | } | |
39 | DEFINES += MSB_FIRST_TCH |
|
39 | DEFINES += MSB_FIRST_TCH | |
40 |
|
40 | |||
41 | contains( CONFIG, vhdl_dev ) { |
|
41 | contains( CONFIG, vhdl_dev ) { | |
42 | DEFINES += VHDL_DEV |
|
42 | DEFINES += VHDL_DEV | |
43 | } |
|
43 | } | |
44 |
|
44 | |||
45 | contains( CONFIG, verbose ) { |
|
45 | contains( CONFIG, verbose ) { | |
46 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
46 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
47 | } |
|
47 | } | |
48 |
|
48 | |||
49 | contains( CONFIG, debug_messages ) { |
|
49 | contains( CONFIG, debug_messages ) { | |
50 | DEFINES += DEBUG_MESSAGES |
|
50 | DEFINES += DEBUG_MESSAGES | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
53 | contains( CONFIG, cpu_usage_report ) { |
|
53 | contains( CONFIG, cpu_usage_report ) { | |
54 | DEFINES += PRINT_TASK_STATISTICS |
|
54 | DEFINES += PRINT_TASK_STATISTICS | |
55 | } |
|
55 | } | |
56 |
|
56 | |||
57 | contains( CONFIG, stack_report ) { |
|
57 | contains( CONFIG, stack_report ) { | |
58 | DEFINES += PRINT_STACK_REPORT |
|
58 | DEFINES += PRINT_STACK_REPORT | |
59 | } |
|
59 | } | |
60 |
|
60 | |||
61 | contains( CONFIG, boot_messages ) { |
|
61 | contains( CONFIG, boot_messages ) { | |
62 | DEFINES += BOOT_MESSAGES |
|
62 | DEFINES += BOOT_MESSAGES | |
63 | } |
|
63 | } | |
64 |
|
64 | |||
65 | contains( CONFIG, debug_watchdog ) { |
|
65 | contains( CONFIG, debug_watchdog ) { | |
66 | DEFINES += DEBUG_WATCHDOG |
|
66 | DEFINES += DEBUG_WATCHDOG | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | #doxygen.target = doxygen |
|
69 | #doxygen.target = doxygen | |
70 | #doxygen.commands = doxygen ../doc/Doxyfile |
|
70 | #doxygen.commands = doxygen ../doc/Doxyfile | |
71 | #QMAKE_EXTRA_TARGETS += doxygen |
|
71 | #QMAKE_EXTRA_TARGETS += doxygen | |
72 |
|
72 | |||
73 | TARGET = fsw |
|
73 | TARGET = fsw | |
74 |
|
74 | |||
75 | INCLUDEPATH += \ |
|
75 | INCLUDEPATH += \ | |
76 | $${PWD}/../src \ |
|
76 | $${PWD}/../src \ | |
77 | $${PWD}/../header \ |
|
77 | $${PWD}/../header \ | |
78 | $${PWD}/../header/lfr_common_headers \ |
|
78 | $${PWD}/../header/lfr_common_headers \ | |
79 | $${PWD}/../header/processing \ |
|
79 | $${PWD}/../header/processing \ | |
80 | $${PWD}/../LFR_basic-parameters |
|
80 | $${PWD}/../LFR_basic-parameters | |
81 |
|
81 | |||
82 | SOURCES += \ |
|
82 | SOURCES += \ | |
83 | ../src/wf_handler.c \ |
|
83 | ../src/wf_handler.c \ | |
84 | ../src/tc_handler.c \ |
|
84 | ../src/tc_handler.c \ | |
85 | ../src/fsw_misc.c \ |
|
85 | ../src/fsw_misc.c \ | |
86 | ../src/fsw_init.c \ |
|
86 | ../src/fsw_init.c \ | |
87 | ../src/fsw_globals.c \ |
|
87 | ../src/fsw_globals.c \ | |
88 | ../src/fsw_spacewire.c \ |
|
88 | ../src/fsw_spacewire.c \ | |
89 | ../src/tc_load_dump_parameters.c \ |
|
89 | ../src/tc_load_dump_parameters.c \ | |
90 | ../src/tm_lfr_tc_exe.c \ |
|
90 | ../src/tm_lfr_tc_exe.c \ | |
91 | ../src/tc_acceptance.c \ |
|
91 | ../src/tc_acceptance.c \ | |
92 | ../src/processing/fsw_processing.c \ |
|
92 | ../src/processing/fsw_processing.c \ | |
93 | ../src/processing/avf0_prc0.c \ |
|
93 | ../src/processing/avf0_prc0.c \ | |
94 | ../src/processing/avf1_prc1.c \ |
|
94 | ../src/processing/avf1_prc1.c \ | |
95 | ../src/processing/avf2_prc2.c \ |
|
95 | ../src/processing/avf2_prc2.c \ | |
96 | ../src/lfr_cpu_usage_report.c \ |
|
96 | ../src/lfr_cpu_usage_report.c \ | |
97 | ../LFR_basic-parameters/basic_parameters.c |
|
97 | ../LFR_basic-parameters/basic_parameters.c | |
98 |
|
98 | |||
99 | HEADERS += \ |
|
99 | HEADERS += \ | |
100 | ../header/wf_handler.h \ |
|
100 | ../header/wf_handler.h \ | |
101 | ../header/tc_handler.h \ |
|
101 | ../header/tc_handler.h \ | |
102 | ../header/grlib_regs.h \ |
|
102 | ../header/grlib_regs.h \ | |
103 | ../header/fsw_misc.h \ |
|
103 | ../header/fsw_misc.h \ | |
104 | ../header/fsw_init.h \ |
|
104 | ../header/fsw_init.h \ | |
105 | ../header/fsw_spacewire.h \ |
|
105 | ../header/fsw_spacewire.h \ | |
106 | ../header/tc_load_dump_parameters.h \ |
|
106 | ../header/tc_load_dump_parameters.h \ | |
107 | ../header/tm_lfr_tc_exe.h \ |
|
107 | ../header/tm_lfr_tc_exe.h \ | |
108 | ../header/tc_acceptance.h \ |
|
108 | ../header/tc_acceptance.h \ | |
109 | ../header/processing/fsw_processing.h \ |
|
109 | ../header/processing/fsw_processing.h \ | |
110 | ../header/processing/avf0_prc0.h \ |
|
110 | ../header/processing/avf0_prc0.h \ | |
111 | ../header/processing/avf1_prc1.h \ |
|
111 | ../header/processing/avf1_prc1.h \ | |
112 | ../header/processing/avf2_prc2.h \ |
|
112 | ../header/processing/avf2_prc2.h \ | |
113 | ../header/fsw_params_wf_handler.h \ |
|
113 | ../header/fsw_params_wf_handler.h \ | |
114 | ../header/lfr_cpu_usage_report.h \ |
|
114 | ../header/lfr_cpu_usage_report.h \ | |
115 | ../header/lfr_common_headers/ccsds_types.h \ |
|
115 | ../header/lfr_common_headers/ccsds_types.h \ | |
116 | ../header/lfr_common_headers/fsw_params.h \ |
|
116 | ../header/lfr_common_headers/fsw_params.h \ | |
117 | ../header/lfr_common_headers/fsw_params_nb_bytes.h \ |
|
117 | ../header/lfr_common_headers/fsw_params_nb_bytes.h \ | |
118 | ../header/lfr_common_headers/fsw_params_processing.h \ |
|
118 | ../header/lfr_common_headers/fsw_params_processing.h \ | |
119 | ../header/lfr_common_headers/TC_types.h \ |
|
119 | ../header/lfr_common_headers/TC_types.h \ | |
120 | ../header/lfr_common_headers/tm_byte_positions.h \ |
|
120 | ../header/lfr_common_headers/tm_byte_positions.h \ | |
121 | ../LFR_basic-parameters/basic_parameters.h \ |
|
121 | ../LFR_basic-parameters/basic_parameters.h \ | |
122 | ../LFR_basic-parameters/basic_parameters_params.h \ |
|
122 | ../LFR_basic-parameters/basic_parameters_params.h \ | |
123 | ../header/GscMemoryLPP.hpp |
|
123 | ../header/GscMemoryLPP.hpp | |
124 |
|
124 |
@@ -1,72 +1,76 | |||||
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H |
|
1 | #ifndef TC_LOAD_DUMP_PARAMETERS_H | |
2 | #define TC_LOAD_DUMP_PARAMETERS_H |
|
2 | #define TC_LOAD_DUMP_PARAMETERS_H | |
3 |
|
3 | |||
4 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
5 | #include <stdio.h> |
|
5 | #include <stdio.h> | |
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "wf_handler.h" |
|
8 | #include "wf_handler.h" | |
9 | #include "tm_lfr_tc_exe.h" |
|
9 | #include "tm_lfr_tc_exe.h" | |
10 | #include "fsw_misc.h" |
|
10 | #include "fsw_misc.h" | |
11 | #include "basic_parameters_params.h" |
|
11 | #include "basic_parameters_params.h" | |
12 | #include "avf0_prc0.h" |
|
12 | #include "avf0_prc0.h" | |
13 |
|
13 | |||
14 | #define FLOAT_EQUAL_ZERO 0.001 |
|
14 | #define FLOAT_EQUAL_ZERO 0.001 | |
15 |
|
15 | |||
16 | extern unsigned short sequenceCounterParameterDump; |
|
16 | extern unsigned short sequenceCounterParameterDump; | |
17 | extern unsigned short sequenceCounters_TM_DUMP[]; |
|
17 | extern unsigned short sequenceCounters_TM_DUMP[]; | |
18 | extern float k_coeff_intercalib_f0_norm[ ]; |
|
18 | extern float k_coeff_intercalib_f0_norm[ ]; | |
19 | extern float k_coeff_intercalib_f0_sbm[ ]; |
|
19 | extern float k_coeff_intercalib_f0_sbm[ ]; | |
20 | extern float k_coeff_intercalib_f1_norm[ ]; |
|
20 | extern float k_coeff_intercalib_f1_norm[ ]; | |
21 | extern float k_coeff_intercalib_f1_sbm[ ]; |
|
21 | extern float k_coeff_intercalib_f1_sbm[ ]; | |
22 | extern float k_coeff_intercalib_f2[ ]; |
|
22 | extern float k_coeff_intercalib_f2[ ]; | |
23 |
|
23 | |||
24 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); |
|
24 | int action_load_common_par( ccsdsTelecommandPacket_t *TC ); | |
25 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
25 | int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
26 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
26 | int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
27 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
27 | int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
28 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); |
|
28 | int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time); | |
29 | int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
29 | int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
30 | int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
30 | int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
|
31 | int action_load_pas_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |||
31 | int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
32 | int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
32 | int action_dump_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
33 | int action_dump_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
33 |
|
34 | |||
34 | // NORMAL |
|
35 | // NORMAL | |
35 | int check_normal_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
36 | int check_normal_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
36 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC ); |
|
37 | int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC ); | |
37 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC ); |
|
38 | int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC ); | |
38 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC ); |
|
39 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC ); | |
39 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC ); |
|
40 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC ); | |
40 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC ); |
|
41 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC ); | |
41 | int set_sy_lfr_n_cwf_long_f3( ccsdsTelecommandPacket_t *TC ); |
|
42 | int set_sy_lfr_n_cwf_long_f3( ccsdsTelecommandPacket_t *TC ); | |
42 |
|
43 | |||
43 | // BURST |
|
44 | // BURST | |
44 | int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC ); |
|
45 | int set_sy_lfr_b_bp_p0( ccsdsTelecommandPacket_t *TC ); | |
45 | int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC ); |
|
46 | int set_sy_lfr_b_bp_p1( ccsdsTelecommandPacket_t *TC ); | |
46 |
|
47 | |||
47 | // SBM1 |
|
48 | // SBM1 | |
48 | int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC ); |
|
49 | int set_sy_lfr_s1_bp_p0( ccsdsTelecommandPacket_t *TC ); | |
49 | int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC ); |
|
50 | int set_sy_lfr_s1_bp_p1( ccsdsTelecommandPacket_t *TC ); | |
50 |
|
51 | |||
51 | // SBM2 |
|
52 | // SBM2 | |
52 | int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC ); |
|
53 | int set_sy_lfr_s2_bp_p0( ccsdsTelecommandPacket_t *TC ); | |
53 | int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC ); |
|
54 | int set_sy_lfr_s2_bp_p1( ccsdsTelecommandPacket_t *TC ); | |
54 |
|
55 | |||
55 | // TC_LFR_UPDATE_INFO |
|
56 | // TC_LFR_UPDATE_INFO | |
56 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ); |
|
57 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ); | |
57 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ); |
|
58 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ); | |
58 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ); |
|
59 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ); | |
59 |
|
60 | |||
60 | // FBINS_MASK |
|
61 | // FBINS_MASK | |
61 | int set_sy_lfr_fbins( ccsdsTelecommandPacket_t *TC ); |
|
62 | int set_sy_lfr_fbins( ccsdsTelecommandPacket_t *TC ); | |
62 |
|
63 | |||
|
64 | // TC_LFR_LOAD_PARS_FILTER_PAR | |||
|
65 | int check_sy_lfr_pas_filter_parameters( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |||
|
66 | ||||
63 | // KCOEFFICIENTS |
|
67 | // KCOEFFICIENTS | |
64 | int set_sy_lfr_kcoeff(ccsdsTelecommandPacket_t *TC , rtems_id queue_id); |
|
68 | int set_sy_lfr_kcoeff(ccsdsTelecommandPacket_t *TC , rtems_id queue_id); | |
65 | void copyFloatByChar( unsigned char *destination, unsigned char *source ); |
|
69 | void copyFloatByChar( unsigned char *destination, unsigned char *source ); | |
66 |
|
70 | |||
67 | void init_parameter_dump( void ); |
|
71 | void init_parameter_dump( void ); | |
68 | void init_kcoefficients_dump( void ); |
|
72 | void init_kcoefficients_dump( void ); | |
69 | void init_kcoefficients_dump_packet( Packet_TM_LFR_KCOEFFICIENTS_DUMP_t *kcoefficients_dump, unsigned char pkt_nr, unsigned char blk_nr ); |
|
73 | void init_kcoefficients_dump_packet( Packet_TM_LFR_KCOEFFICIENTS_DUMP_t *kcoefficients_dump, unsigned char pkt_nr, unsigned char blk_nr ); | |
70 | void increment_seq_counter_destination_id_dump( unsigned char *packet_sequence_control, unsigned char destination_id ); |
|
74 | void increment_seq_counter_destination_id_dump( unsigned char *packet_sequence_control, unsigned char destination_id ); | |
71 |
|
75 | |||
72 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
|
76 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -1,465 +1,474 | |||||
1 | /** Functions related to TeleCommand acceptance. |
|
1 | /** Functions related to TeleCommand acceptance. | |
2 | * |
|
2 | * | |
3 | * @file |
|
3 | * @file | |
4 | * @author P. LEROY |
|
4 | * @author P. LEROY | |
5 | * |
|
5 | * | |
6 | * A group of functions to handle TeleCommands parsing.\n |
|
6 | * A group of functions to handle TeleCommands parsing.\n | |
7 | * |
|
7 | * | |
8 | */ |
|
8 | */ | |
9 |
|
9 | |||
10 | #include "tc_acceptance.h" |
|
10 | #include "tc_acceptance.h" | |
11 | #include <stdio.h> |
|
11 | #include <stdio.h> | |
12 |
|
12 | |||
13 | unsigned int lookUpTableForCRC[256]; |
|
13 | unsigned int lookUpTableForCRC[256]; | |
14 |
|
14 | |||
15 | //********************** |
|
15 | //********************** | |
16 | // GENERAL USE FUNCTIONS |
|
16 | // GENERAL USE FUNCTIONS | |
17 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) |
|
17 | unsigned int Crc_opt( unsigned char D, unsigned int Chk) | |
18 | { |
|
18 | { | |
19 | /** This function generate the CRC for one byte and returns the value of the new syndrome. |
|
19 | /** This function generate the CRC for one byte and returns the value of the new syndrome. | |
20 | * |
|
20 | * | |
21 | * @param D is the current byte of data. |
|
21 | * @param D is the current byte of data. | |
22 | * @param Chk is the current syndrom value. |
|
22 | * @param Chk is the current syndrom value. | |
23 | * |
|
23 | * | |
24 | * @return the value of the new syndrome on two bytes. |
|
24 | * @return the value of the new syndrome on two bytes. | |
25 | * |
|
25 | * | |
26 | */ |
|
26 | */ | |
27 |
|
27 | |||
28 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); |
|
28 | return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]); | |
29 | } |
|
29 | } | |
30 |
|
30 | |||
31 | void initLookUpTableForCRC( void ) |
|
31 | void initLookUpTableForCRC( void ) | |
32 | { |
|
32 | { | |
33 | /** This function is used to initiates the look-up table for fast CRC computation. |
|
33 | /** This function is used to initiates the look-up table for fast CRC computation. | |
34 | * |
|
34 | * | |
35 | * The global table lookUpTableForCRC[256] is initiated. |
|
35 | * The global table lookUpTableForCRC[256] is initiated. | |
36 | * |
|
36 | * | |
37 | */ |
|
37 | */ | |
38 |
|
38 | |||
39 | unsigned int i; |
|
39 | unsigned int i; | |
40 | unsigned int tmp; |
|
40 | unsigned int tmp; | |
41 |
|
41 | |||
42 | for (i=0; i<256; i++) |
|
42 | for (i=0; i<256; i++) | |
43 | { |
|
43 | { | |
44 | tmp = 0; |
|
44 | tmp = 0; | |
45 | if((i & 1) != 0) { |
|
45 | if((i & 1) != 0) { | |
46 | tmp = tmp ^ 0x1021; |
|
46 | tmp = tmp ^ 0x1021; | |
47 | } |
|
47 | } | |
48 | if((i & 2) != 0) { |
|
48 | if((i & 2) != 0) { | |
49 | tmp = tmp ^ 0x2042; |
|
49 | tmp = tmp ^ 0x2042; | |
50 | } |
|
50 | } | |
51 | if((i & 4) != 0) { |
|
51 | if((i & 4) != 0) { | |
52 | tmp = tmp ^ 0x4084; |
|
52 | tmp = tmp ^ 0x4084; | |
53 | } |
|
53 | } | |
54 | if((i & 8) != 0) { |
|
54 | if((i & 8) != 0) { | |
55 | tmp = tmp ^ 0x8108; |
|
55 | tmp = tmp ^ 0x8108; | |
56 | } |
|
56 | } | |
57 | if((i & 16) != 0) { |
|
57 | if((i & 16) != 0) { | |
58 | tmp = tmp ^ 0x1231; |
|
58 | tmp = tmp ^ 0x1231; | |
59 | } |
|
59 | } | |
60 | if((i & 32) != 0) { |
|
60 | if((i & 32) != 0) { | |
61 | tmp = tmp ^ 0x2462; |
|
61 | tmp = tmp ^ 0x2462; | |
62 | } |
|
62 | } | |
63 | if((i & 64) != 0) { |
|
63 | if((i & 64) != 0) { | |
64 | tmp = tmp ^ 0x48c4; |
|
64 | tmp = tmp ^ 0x48c4; | |
65 | } |
|
65 | } | |
66 | if((i & 128) != 0) { |
|
66 | if((i & 128) != 0) { | |
67 | tmp = tmp ^ 0x9188; |
|
67 | tmp = tmp ^ 0x9188; | |
68 | } |
|
68 | } | |
69 | lookUpTableForCRC[i] = tmp; |
|
69 | lookUpTableForCRC[i] = tmp; | |
70 | } |
|
70 | } | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) |
|
73 | void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData) | |
74 | { |
|
74 | { | |
75 | /** This function calculates a two bytes Cyclic Redundancy Code. |
|
75 | /** This function calculates a two bytes Cyclic Redundancy Code. | |
76 | * |
|
76 | * | |
77 | * @param data points to a buffer containing the data on which to compute the CRC. |
|
77 | * @param data points to a buffer containing the data on which to compute the CRC. | |
78 | * @param crcAsTwoBytes points points to a two bytes buffer in which the CRC is stored. |
|
78 | * @param crcAsTwoBytes points points to a two bytes buffer in which the CRC is stored. | |
79 | * @param sizeOfData is the number of bytes of *data* used to compute the CRC. |
|
79 | * @param sizeOfData is the number of bytes of *data* used to compute the CRC. | |
80 | * |
|
80 | * | |
81 | * The specification of the Cyclic Redundancy Code is described in the following document: ECSS-E-70-41-A. |
|
81 | * The specification of the Cyclic Redundancy Code is described in the following document: ECSS-E-70-41-A. | |
82 | * |
|
82 | * | |
83 | */ |
|
83 | */ | |
84 |
|
84 | |||
85 | unsigned int Chk; |
|
85 | unsigned int Chk; | |
86 | int j; |
|
86 | int j; | |
87 | Chk = 0xffff; // reset the syndrom to all ones |
|
87 | Chk = 0xffff; // reset the syndrom to all ones | |
88 | for (j=0; j<sizeOfData; j++) { |
|
88 | for (j=0; j<sizeOfData; j++) { | |
89 | Chk = Crc_opt(data[j], Chk); |
|
89 | Chk = Crc_opt(data[j], Chk); | |
90 | } |
|
90 | } | |
91 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); |
|
91 | crcAsTwoBytes[0] = (unsigned char) (Chk >> 8); | |
92 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); |
|
92 | crcAsTwoBytes[1] = (unsigned char) (Chk & 0x00ff); | |
93 | } |
|
93 | } | |
94 |
|
94 | |||
95 | //********************* |
|
95 | //********************* | |
96 | // ACCEPTANCE FUNCTIONS |
|
96 | // ACCEPTANCE FUNCTIONS | |
97 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int estimatedPacketLength, unsigned char *computed_CRC) |
|
97 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int estimatedPacketLength, unsigned char *computed_CRC) | |
98 | { |
|
98 | { | |
99 | /** This function parses TeleCommands. |
|
99 | /** This function parses TeleCommands. | |
100 | * |
|
100 | * | |
101 | * @param TC points to the TeleCommand that will be parsed. |
|
101 | * @param TC points to the TeleCommand that will be parsed. | |
102 | * @param estimatedPacketLength is the PACKET_LENGTH field calculated from the effective length of the received packet. |
|
102 | * @param estimatedPacketLength is the PACKET_LENGTH field calculated from the effective length of the received packet. | |
103 | * |
|
103 | * | |
104 | * @return Status code of the parsing. |
|
104 | * @return Status code of the parsing. | |
105 | * |
|
105 | * | |
106 | * The parsing checks: |
|
106 | * The parsing checks: | |
107 | * - process id |
|
107 | * - process id | |
108 | * - category |
|
108 | * - category | |
109 | * - length: a global check is performed and a per subtype check also |
|
109 | * - length: a global check is performed and a per subtype check also | |
110 | * - type |
|
110 | * - type | |
111 | * - subtype |
|
111 | * - subtype | |
112 | * - crc |
|
112 | * - crc | |
113 | * |
|
113 | * | |
114 | */ |
|
114 | */ | |
115 |
|
115 | |||
116 | int status; |
|
116 | int status; | |
117 | int status_crc; |
|
117 | int status_crc; | |
118 | unsigned char pid; |
|
118 | unsigned char pid; | |
119 | unsigned char category; |
|
119 | unsigned char category; | |
120 | unsigned int packetLength; |
|
120 | unsigned int packetLength; | |
121 | unsigned char packetType; |
|
121 | unsigned char packetType; | |
122 | unsigned char packetSubtype; |
|
122 | unsigned char packetSubtype; | |
123 | unsigned char sid; |
|
123 | unsigned char sid; | |
124 |
|
124 | |||
125 | status = CCSDS_TM_VALID; |
|
125 | status = CCSDS_TM_VALID; | |
126 |
|
126 | |||
127 | // APID check *** APID on 2 bytes |
|
127 | // APID check *** APID on 2 bytes | |
128 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx |
|
128 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx | |
129 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 |
|
129 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 | |
130 | packetLength = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; |
|
130 | packetLength = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; | |
131 | packetType = TCPacket->serviceType; |
|
131 | packetType = TCPacket->serviceType; | |
132 | packetSubtype = TCPacket->serviceSubType; |
|
132 | packetSubtype = TCPacket->serviceSubType; | |
133 | sid = TCPacket->sourceID; |
|
133 | sid = TCPacket->sourceID; | |
134 |
|
134 | |||
135 | if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID |
|
135 | if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID | |
136 | { |
|
136 | { | |
137 | status = ILLEGAL_APID; |
|
137 | status = ILLEGAL_APID; | |
138 | } |
|
138 | } | |
139 | if (status == CCSDS_TM_VALID) // CHECK THE CATEGORY |
|
139 | if (status == CCSDS_TM_VALID) // CHECK THE CATEGORY | |
140 | { |
|
140 | { | |
141 | if ( category != CCSDS_PACKET_CATEGORY ) |
|
141 | if ( category != CCSDS_PACKET_CATEGORY ) | |
142 | { |
|
142 | { | |
143 | status = ILLEGAL_APID; |
|
143 | status = ILLEGAL_APID; | |
144 | } |
|
144 | } | |
145 | } |
|
145 | } | |
146 | if (status == CCSDS_TM_VALID) // CHECK THE PACKET_LENGTH FIELD AND THE ESTIMATED PACKET_LENGTH COMPLIANCE |
|
146 | if (status == CCSDS_TM_VALID) // CHECK THE PACKET_LENGTH FIELD AND THE ESTIMATED PACKET_LENGTH COMPLIANCE | |
147 | { |
|
147 | { | |
148 | if (packetLength != estimatedPacketLength ) { |
|
148 | if (packetLength != estimatedPacketLength ) { | |
149 | status = WRONG_LEN_PKT; |
|
149 | status = WRONG_LEN_PKT; | |
150 | } |
|
150 | } | |
151 | } |
|
151 | } | |
152 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE |
|
152 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE | |
153 | { |
|
153 | { | |
154 | if ( packetLength >= CCSDS_TC_PKT_MAX_SIZE ) { |
|
154 | if ( packetLength >= CCSDS_TC_PKT_MAX_SIZE ) { | |
155 | status = WRONG_LEN_PKT; |
|
155 | status = WRONG_LEN_PKT; | |
156 | } |
|
156 | } | |
157 | } |
|
157 | } | |
158 | if (status == CCSDS_TM_VALID) // CHECK THE TYPE |
|
158 | if (status == CCSDS_TM_VALID) // CHECK THE TYPE | |
159 | { |
|
159 | { | |
160 | status = tc_check_type( packetType ); |
|
160 | status = tc_check_type( packetType ); | |
161 | } |
|
161 | } | |
162 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE |
|
162 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE | |
163 | { |
|
163 | { | |
164 | status = tc_check_type_subtype( packetType, packetSubtype ); |
|
164 | status = tc_check_type_subtype( packetType, packetSubtype ); | |
165 | } |
|
165 | } | |
166 | if (status == CCSDS_TM_VALID) // CHECK THE SID |
|
166 | if (status == CCSDS_TM_VALID) // CHECK THE SID | |
167 | { |
|
167 | { | |
168 | status = tc_check_sid( sid ); |
|
168 | status = tc_check_sid( sid ); | |
169 | } |
|
169 | } | |
170 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE |
|
170 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE | |
171 | { |
|
171 | { | |
172 | status = tc_check_length( packetSubtype, packetLength ); |
|
172 | status = tc_check_length( packetSubtype, packetLength ); | |
173 | } |
|
173 | } | |
174 | status_crc = tc_check_crc( TCPacket, estimatedPacketLength, computed_CRC ); |
|
174 | status_crc = tc_check_crc( TCPacket, estimatedPacketLength, computed_CRC ); | |
175 | if (status == CCSDS_TM_VALID ) // CHECK CRC |
|
175 | if (status == CCSDS_TM_VALID ) // CHECK CRC | |
176 | { |
|
176 | { | |
177 | status = status_crc; |
|
177 | status = status_crc; | |
178 | } |
|
178 | } | |
179 |
|
179 | |||
180 | return status; |
|
180 | return status; | |
181 | } |
|
181 | } | |
182 |
|
182 | |||
183 | int tc_check_type( unsigned char packetType ) |
|
183 | int tc_check_type( unsigned char packetType ) | |
184 | { |
|
184 | { | |
185 | /** This function checks that the type of a TeleCommand is valid. |
|
185 | /** This function checks that the type of a TeleCommand is valid. | |
186 | * |
|
186 | * | |
187 | * @param packetType is the type to check. |
|
187 | * @param packetType is the type to check. | |
188 | * |
|
188 | * | |
189 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
189 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. | |
190 | * |
|
190 | * | |
191 | */ |
|
191 | */ | |
192 |
|
192 | |||
193 | int status; |
|
193 | int status; | |
194 |
|
194 | |||
195 | if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME)) |
|
195 | if ( (packetType == TC_TYPE_GEN) || (packetType == TC_TYPE_TIME)) | |
196 | { |
|
196 | { | |
197 | status = CCSDS_TM_VALID; |
|
197 | status = CCSDS_TM_VALID; | |
198 | } |
|
198 | } | |
199 | else |
|
199 | else | |
200 | { |
|
200 | { | |
201 | status = ILL_TYPE; |
|
201 | status = ILL_TYPE; | |
202 | } |
|
202 | } | |
203 |
|
203 | |||
204 | return status; |
|
204 | return status; | |
205 | } |
|
205 | } | |
206 |
|
206 | |||
207 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ) |
|
207 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ) | |
208 | { |
|
208 | { | |
209 | /** This function checks that the subtype of a TeleCommand is valid and coherent with the type. |
|
209 | /** This function checks that the subtype of a TeleCommand is valid and coherent with the type. | |
210 | * |
|
210 | * | |
211 | * @param packetType is the type of the TC. |
|
211 | * @param packetType is the type of the TC. | |
212 | * @param packetSubType is the subtype to check. |
|
212 | * @param packetSubType is the subtype to check. | |
213 | * |
|
213 | * | |
214 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. |
|
214 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. | |
215 | * |
|
215 | * | |
216 | */ |
|
216 | */ | |
217 |
|
217 | |||
218 | int status; |
|
218 | int status; | |
219 |
|
219 | |||
220 | switch(packetType) |
|
220 | switch(packetType) | |
221 | { |
|
221 | { | |
222 | case TC_TYPE_GEN: |
|
222 | case TC_TYPE_GEN: | |
223 | if ( (packetSubType == TC_SUBTYPE_RESET) |
|
223 | if ( (packetSubType == TC_SUBTYPE_RESET) | |
224 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) |
|
224 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) | |
225 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) |
|
225 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) | |
226 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) |
|
226 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) | |
227 | || (packetSubType == TC_SUBTYPE_DUMP) |
|
227 | || (packetSubType == TC_SUBTYPE_DUMP) | |
228 | || (packetSubType == TC_SUBTYPE_ENTER) |
|
228 | || (packetSubType == TC_SUBTYPE_ENTER) | |
229 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) |
|
229 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) | |
230 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) |
|
230 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) | |
231 | || (packetSubType == TC_SUBTYPE_LOAD_K) || (packetSubType == TC_SUBTYPE_DUMP_K) |
|
231 | || (packetSubType == TC_SUBTYPE_LOAD_K) || (packetSubType == TC_SUBTYPE_DUMP_K) | |
232 |
|| (packetSubType == TC_SUBTYPE_LOAD_FBINS) |
|
232 | || (packetSubType == TC_SUBTYPE_LOAD_FBINS) | |
|
233 | || (packetSubType == TC_SUBTYPE_LOAD_PAS_FILTER_PAR)) | |||
233 | { |
|
234 | { | |
234 | status = CCSDS_TM_VALID; |
|
235 | status = CCSDS_TM_VALID; | |
235 | } |
|
236 | } | |
236 | else |
|
237 | else | |
237 | { |
|
238 | { | |
238 | status = ILL_SUBTYPE; |
|
239 | status = ILL_SUBTYPE; | |
239 | } |
|
240 | } | |
240 | break; |
|
241 | break; | |
241 |
|
242 | |||
242 | case TC_TYPE_TIME: |
|
243 | case TC_TYPE_TIME: | |
243 | if (packetSubType == TC_SUBTYPE_UPDT_TIME) |
|
244 | if (packetSubType == TC_SUBTYPE_UPDT_TIME) | |
244 | { |
|
245 | { | |
245 | status = CCSDS_TM_VALID; |
|
246 | status = CCSDS_TM_VALID; | |
246 | } |
|
247 | } | |
247 | else |
|
248 | else | |
248 | { |
|
249 | { | |
249 | status = ILL_SUBTYPE; |
|
250 | status = ILL_SUBTYPE; | |
250 | } |
|
251 | } | |
251 | break; |
|
252 | break; | |
252 |
|
253 | |||
253 | default: |
|
254 | default: | |
254 | status = ILL_SUBTYPE; |
|
255 | status = ILL_SUBTYPE; | |
255 | break; |
|
256 | break; | |
256 | } |
|
257 | } | |
257 |
|
258 | |||
258 | return status; |
|
259 | return status; | |
259 | } |
|
260 | } | |
260 |
|
261 | |||
261 | int tc_check_sid( unsigned char sid ) |
|
262 | int tc_check_sid( unsigned char sid ) | |
262 | { |
|
263 | { | |
263 | /** This function checks that the sid of a TeleCommand is valid. |
|
264 | /** This function checks that the sid of a TeleCommand is valid. | |
264 | * |
|
265 | * | |
265 | * @param sid is the sid to check. |
|
266 | * @param sid is the sid to check. | |
266 | * |
|
267 | * | |
267 | * @return Status code CCSDS_TM_VALID or CORRUPTED. |
|
268 | * @return Status code CCSDS_TM_VALID or CORRUPTED. | |
268 | * |
|
269 | * | |
269 | */ |
|
270 | */ | |
270 |
|
271 | |||
271 | int status; |
|
272 | int status; | |
272 |
|
273 | |||
273 | if ( (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) |
|
274 | if ( (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) | |
274 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) |
|
275 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) | |
275 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) |
|
276 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) | |
276 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) |
|
277 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) | |
277 | || (sid == SID_TC_RPW_INTERNAL)) |
|
278 | || (sid == SID_TC_RPW_INTERNAL)) | |
278 | { |
|
279 | { | |
279 | status = CCSDS_TM_VALID; |
|
280 | status = CCSDS_TM_VALID; | |
280 | } |
|
281 | } | |
281 | else |
|
282 | else | |
282 | { |
|
283 | { | |
283 | status = WRONG_SRC_ID; |
|
284 | status = WRONG_SRC_ID; | |
284 | } |
|
285 | } | |
285 |
|
286 | |||
286 | return status; |
|
287 | return status; | |
287 | } |
|
288 | } | |
288 |
|
289 | |||
289 | int tc_check_length( unsigned char packetSubType, unsigned int length ) |
|
290 | int tc_check_length( unsigned char packetSubType, unsigned int length ) | |
290 | { |
|
291 | { | |
291 | /** This function checks that the subtype and the length are compliant. |
|
292 | /** This function checks that the subtype and the length are compliant. | |
292 | * |
|
293 | * | |
293 | * @param packetSubType is the subtype to check. |
|
294 | * @param packetSubType is the subtype to check. | |
294 | * @param length is the length to check. |
|
295 | * @param length is the length to check. | |
295 | * |
|
296 | * | |
296 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
297 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. | |
297 | * |
|
298 | * | |
298 | */ |
|
299 | */ | |
299 |
|
300 | |||
300 | int status; |
|
301 | int status; | |
301 |
|
302 | |||
302 | status = LFR_SUCCESSFUL; |
|
303 | status = LFR_SUCCESSFUL; | |
303 |
|
304 | |||
304 | switch(packetSubType) |
|
305 | switch(packetSubType) | |
305 | { |
|
306 | { | |
306 | case TC_SUBTYPE_RESET: |
|
307 | case TC_SUBTYPE_RESET: | |
307 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
308 | if (length!=(TC_LEN_RESET-CCSDS_TC_TM_PACKET_OFFSET)) { | |
308 | status = WRONG_LEN_PKT; |
|
309 | status = WRONG_LEN_PKT; | |
309 | } |
|
310 | } | |
310 | else { |
|
311 | else { | |
311 | status = CCSDS_TM_VALID; |
|
312 | status = CCSDS_TM_VALID; | |
312 | } |
|
313 | } | |
313 | break; |
|
314 | break; | |
314 | case TC_SUBTYPE_LOAD_COMM: |
|
315 | case TC_SUBTYPE_LOAD_COMM: | |
315 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
316 | if (length!=(TC_LEN_LOAD_COMM-CCSDS_TC_TM_PACKET_OFFSET)) { | |
316 | status = WRONG_LEN_PKT; |
|
317 | status = WRONG_LEN_PKT; | |
317 | } |
|
318 | } | |
318 | else { |
|
319 | else { | |
319 | status = CCSDS_TM_VALID; |
|
320 | status = CCSDS_TM_VALID; | |
320 | } |
|
321 | } | |
321 | break; |
|
322 | break; | |
322 | case TC_SUBTYPE_LOAD_NORM: |
|
323 | case TC_SUBTYPE_LOAD_NORM: | |
323 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
324 | if (length!=(TC_LEN_LOAD_NORM-CCSDS_TC_TM_PACKET_OFFSET)) { | |
324 | status = WRONG_LEN_PKT; |
|
325 | status = WRONG_LEN_PKT; | |
325 | } |
|
326 | } | |
326 | else { |
|
327 | else { | |
327 | status = CCSDS_TM_VALID; |
|
328 | status = CCSDS_TM_VALID; | |
328 | } |
|
329 | } | |
329 | break; |
|
330 | break; | |
330 | case TC_SUBTYPE_LOAD_BURST: |
|
331 | case TC_SUBTYPE_LOAD_BURST: | |
331 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
332 | if (length!=(TC_LEN_LOAD_BURST-CCSDS_TC_TM_PACKET_OFFSET)) { | |
332 | status = WRONG_LEN_PKT; |
|
333 | status = WRONG_LEN_PKT; | |
333 | } |
|
334 | } | |
334 | else { |
|
335 | else { | |
335 | status = CCSDS_TM_VALID; |
|
336 | status = CCSDS_TM_VALID; | |
336 | } |
|
337 | } | |
337 | break; |
|
338 | break; | |
338 | case TC_SUBTYPE_LOAD_SBM1: |
|
339 | case TC_SUBTYPE_LOAD_SBM1: | |
339 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
340 | if (length!=(TC_LEN_LOAD_SBM1-CCSDS_TC_TM_PACKET_OFFSET)) { | |
340 | status = WRONG_LEN_PKT; |
|
341 | status = WRONG_LEN_PKT; | |
341 | } |
|
342 | } | |
342 | else { |
|
343 | else { | |
343 | status = CCSDS_TM_VALID; |
|
344 | status = CCSDS_TM_VALID; | |
344 | } |
|
345 | } | |
345 | break; |
|
346 | break; | |
346 | case TC_SUBTYPE_LOAD_SBM2: |
|
347 | case TC_SUBTYPE_LOAD_SBM2: | |
347 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
348 | if (length!=(TC_LEN_LOAD_SBM2-CCSDS_TC_TM_PACKET_OFFSET)) { | |
348 | status = WRONG_LEN_PKT; |
|
349 | status = WRONG_LEN_PKT; | |
349 | } |
|
350 | } | |
350 | else { |
|
351 | else { | |
351 | status = CCSDS_TM_VALID; |
|
352 | status = CCSDS_TM_VALID; | |
352 | } |
|
353 | } | |
353 | break; |
|
354 | break; | |
354 | case TC_SUBTYPE_DUMP: |
|
355 | case TC_SUBTYPE_DUMP: | |
355 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
356 | if (length!=(TC_LEN_DUMP-CCSDS_TC_TM_PACKET_OFFSET)) { | |
356 | status = WRONG_LEN_PKT; |
|
357 | status = WRONG_LEN_PKT; | |
357 | } |
|
358 | } | |
358 | else { |
|
359 | else { | |
359 | status = CCSDS_TM_VALID; |
|
360 | status = CCSDS_TM_VALID; | |
360 | } |
|
361 | } | |
361 | break; |
|
362 | break; | |
362 | case TC_SUBTYPE_ENTER: |
|
363 | case TC_SUBTYPE_ENTER: | |
363 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
364 | if (length!=(TC_LEN_ENTER-CCSDS_TC_TM_PACKET_OFFSET)) { | |
364 | status = WRONG_LEN_PKT; |
|
365 | status = WRONG_LEN_PKT; | |
365 | } |
|
366 | } | |
366 | else { |
|
367 | else { | |
367 | status = CCSDS_TM_VALID; |
|
368 | status = CCSDS_TM_VALID; | |
368 | } |
|
369 | } | |
369 | break; |
|
370 | break; | |
370 | case TC_SUBTYPE_UPDT_INFO: |
|
371 | case TC_SUBTYPE_UPDT_INFO: | |
371 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
372 | if (length!=(TC_LEN_UPDT_INFO-CCSDS_TC_TM_PACKET_OFFSET)) { | |
372 | status = WRONG_LEN_PKT; |
|
373 | status = WRONG_LEN_PKT; | |
373 | } |
|
374 | } | |
374 | else { |
|
375 | else { | |
375 | status = CCSDS_TM_VALID; |
|
376 | status = CCSDS_TM_VALID; | |
376 | } |
|
377 | } | |
377 | break; |
|
378 | break; | |
378 | case TC_SUBTYPE_EN_CAL: |
|
379 | case TC_SUBTYPE_EN_CAL: | |
379 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
380 | if (length!=(TC_LEN_EN_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { | |
380 | status = WRONG_LEN_PKT; |
|
381 | status = WRONG_LEN_PKT; | |
381 | } |
|
382 | } | |
382 | else { |
|
383 | else { | |
383 | status = CCSDS_TM_VALID; |
|
384 | status = CCSDS_TM_VALID; | |
384 | } |
|
385 | } | |
385 | break; |
|
386 | break; | |
386 | case TC_SUBTYPE_DIS_CAL: |
|
387 | case TC_SUBTYPE_DIS_CAL: | |
387 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { |
|
388 | if (length!=(TC_LEN_DIS_CAL-CCSDS_TC_TM_PACKET_OFFSET)) { | |
388 | status = WRONG_LEN_PKT; |
|
389 | status = WRONG_LEN_PKT; | |
389 | } |
|
390 | } | |
390 | else { |
|
391 | else { | |
391 | status = CCSDS_TM_VALID; |
|
392 | status = CCSDS_TM_VALID; | |
392 | } |
|
393 | } | |
393 | break; |
|
394 | break; | |