@@ -1,1 +1,1 | |||||
1 |
src/basic_parameters = https:// |
|
1 | src/basic_parameters = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/SOLO_LFR/LFR_basic-parameters |
@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar 4 09:15:37 2014 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
@@ -10,7 +10,7 | |||||
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE |
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=2 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters |
@@ -1,7 +1,7 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report |
|
3 | # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose debug_messages | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
@@ -69,7 +69,6 HEADERS += \ | |||||
69 | ../header/ccsds_types.h \ |
|
69 | ../header/ccsds_types.h \ | |
70 | ../header/fsw_params_processing.h \ |
|
70 | ../header/fsw_params_processing.h \ | |
71 | ../header/fsw_spacewire.h \ |
|
71 | ../header/fsw_spacewire.h \ | |
72 | ../header/tm_byte_positions.h \ |
|
|||
73 | ../header/tc_load_dump_parameters.h \ |
|
72 | ../header/tc_load_dump_parameters.h \ | |
74 | ../header/tm_lfr_tc_exe.h \ |
|
73 | ../header/tm_lfr_tc_exe.h \ | |
75 | ../header/tc_acceptance.h \ |
|
74 | ../header/tc_acceptance.h \ |
@@ -1,6 +1,6 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3.0.0, 2014-03-0 |
|
3 | <!-- Written by QtCreator 3.0.0, 2014-03-04T07:03:18. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -123,7 +123,7 | |||||
123 | #define CCSDS_TM_VALID 7 |
|
123 | #define CCSDS_TM_VALID 7 | |
124 |
|
124 | |||
125 | // TC SID |
|
125 | // TC SID | |
126 | #define SID_TC_GROUND 0 |
|
126 | #define SID_TC_GROUND 0 | |
127 | #define SID_TC_MISSION_TIMELINE 110 |
|
127 | #define SID_TC_MISSION_TIMELINE 110 | |
128 | #define SID_TC_TC_SEQUENCES 111 |
|
128 | #define SID_TC_TC_SEQUENCES 111 | |
129 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
|
129 | #define SID_TC_RECOVERY_ACTION_CMD 112 |
@@ -30,6 +30,7 rtems_status_code get_message_queue_id_r | |||||
30 | int start_recv_send_tasks( void ); |
|
30 | int start_recv_send_tasks( void ); | |
31 | // |
|
31 | // | |
32 | void init_local_mode_parameters( void ); |
|
32 | void init_local_mode_parameters( void ); | |
|
33 | void reset_local_time( void ); | |||
33 |
|
34 | |||
34 | extern int rtems_cpu_usage_report( void ); |
|
35 | extern int rtems_cpu_usage_report( void ); | |
35 | extern int rtems_cpu_usage_reset( void ); |
|
36 | extern int rtems_cpu_usage_reset( void ); |
@@ -3,6 +3,7 | |||||
3 |
|
3 | |||
4 | #include "grlib_regs.h" |
|
4 | #include "grlib_regs.h" | |
5 | #include "fsw_params_processing.h" |
|
5 | #include "fsw_params_processing.h" | |
|
6 | #include "fsw_params_nb_bytes.h" | |||
6 | #include "tm_byte_positions.h" |
|
7 | #include "tm_byte_positions.h" | |
7 | #include "ccsds_types.h" |
|
8 | #include "ccsds_types.h" | |
8 |
|
9 | |||
@@ -40,12 +41,22 typedef struct ring_node | |||||
40 |
|
41 | |||
41 | //********** |
|
42 | //********** | |
42 | // LFR MODES |
|
43 | // LFR MODES | |
43 | #define LFR_MODE_STANDBY 0 |
|
44 | #define LFR_MODE_STANDBY 0 | |
44 | #define LFR_MODE_NORMAL 1 |
|
45 | #define LFR_MODE_NORMAL 1 | |
45 | #define LFR_MODE_BURST 2 |
|
46 | #define LFR_MODE_BURST 2 | |
46 | #define LFR_MODE_SBM1 3 |
|
47 | #define LFR_MODE_SBM1 3 | |
47 | #define LFR_MODE_SBM2 4 |
|
48 | #define LFR_MODE_SBM2 4 | |
48 | #define LFR_MODE_NORMAL_CWF_F3 5 |
|
49 | ||
|
50 | #define TDS_MODE_LFM 5 | |||
|
51 | #define TDS_MODE_STANDBY 0 | |||
|
52 | #define TDS_MODE_NORMAL 1 | |||
|
53 | #define TDS_MODE_BURST 2 | |||
|
54 | #define TDS_MODE_SBM1 3 | |||
|
55 | #define TDS_MODE_SBM2 4 | |||
|
56 | ||||
|
57 | #define THR_MODE_STANDBY 0 | |||
|
58 | #define THR_MODE_NORMAL 1 | |||
|
59 | #define THR_MODE_BURST 2 | |||
49 |
|
60 | |||
50 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 |
|
61 | #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0 | |
51 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 |
|
62 | #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1 | |
@@ -116,7 +127,9 typedef struct ring_node | |||||
116 | // TIME |
|
127 | // TIME | |
117 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms |
|
128 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms | |
118 | #define TIMER_SM_SIMULATOR 1 |
|
129 | #define TIMER_SM_SIMULATOR 1 | |
119 |
#define HK_PERIOD 100 // 100 * 10ms => 1s |
|
130 | #define HK_PERIOD 100 // 100 * 10ms => 1s | |
|
131 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ms 2000 | |||
|
132 | #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s | |||
120 |
|
133 | |||
121 | //********** |
|
134 | //********** | |
122 | // LPP CODES |
|
135 | // LPP CODES |
@@ -11,6 +11,7 | |||||
11 | #define BYTE_POS_SY_LFR_N_ASM_P 4 |
|
11 | #define BYTE_POS_SY_LFR_N_ASM_P 4 | |
12 | #define BYTE_POS_SY_LFR_N_BP_P0 6 |
|
12 | #define BYTE_POS_SY_LFR_N_BP_P0 6 | |
13 | #define BYTE_POS_SY_LFR_N_BP_P1 7 |
|
13 | #define BYTE_POS_SY_LFR_N_BP_P1 7 | |
|
14 | #define BYTE_POS_SY_LFR_N_CWF_LONG_F3 8 | |||
14 |
|
15 | |||
15 | // TC_LFR_LOAD_BURST_PAR |
|
16 | // TC_LFR_LOAD_BURST_PAR | |
16 |
|
17 | |||
@@ -18,5 +19,8 | |||||
18 |
|
19 | |||
19 | // TC_LFR_LOAD_SBM2_PAR |
|
20 | // TC_LFR_LOAD_SBM2_PAR | |
20 |
|
21 | |||
|
22 | // TC_LFR_UPDATE_INFO | |||
|
23 | #define BYTE_POS_HK_UPDATE_INFO_PAR_SET5 24 // 34 - 10 | |||
|
24 | #define BYTE_POS_HK_UPDATE_INFO_PAR_SET6 25 // 35 - 10 | |||
21 |
|
25 | |||
22 | #endif // TM_BYTE_POSITIONS_H |
|
26 | #endif // TM_BYTE_POSITIONS_H |
@@ -14,7 +14,7 void GetCRCAsTwoBytes(unsigned char* dat | |||||
14 | // ACCEPTANCE FUNCTIONS |
|
14 | // ACCEPTANCE FUNCTIONS | |
15 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC); |
|
15 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC); | |
16 | int tc_check_type( unsigned char packetType ); |
|
16 | int tc_check_type( unsigned char packetType ); | |
17 | int tc_check_subtype( unsigned char packetType ); |
|
17 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ); | |
18 | int tc_check_sid( unsigned char sid ); |
|
18 | int tc_check_sid( unsigned char sid ); | |
19 | int tc_check_length( unsigned char packetType, unsigned int length ); |
|
19 | int tc_check_length( unsigned char packetType, unsigned int length ); | |
20 | int tc_check_crc(ccsdsTelecommandPacket_t * TCPacket, unsigned int length , unsigned char *computed_CRC); |
|
20 | int tc_check_crc(ccsdsTelecommandPacket_t * TCPacket, unsigned int length , unsigned char *computed_CRC); |
@@ -45,9 +45,9 void launch_spectral_matrix_simu( unsign | |||||
45 |
|
45 | |||
46 | // other functions |
|
46 | // other functions | |
47 | void updateLFRCurrentMode(); |
|
47 | void updateLFRCurrentMode(); | |
48 |
void update_last_TC_exe(ccsdsTelecommandPacket_t *TC |
|
48 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC ); | |
49 |
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC |
|
49 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ); | |
50 |
void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id |
|
50 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ); | |
51 |
|
51 | |||
52 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
52 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); | |
53 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
53 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
@@ -23,6 +23,11 int set_sy_lfr_n_bp_p0( ccsdsTelecommand | |||||
23 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
23 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
24 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
24 | int set_sy_lfr_n_cwf_long_f3(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
25 |
|
25 | |||
|
26 | // TC_LFR_UPDATE_INFO | |||
|
27 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ); | |||
|
28 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ); | |||
|
29 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ); | |||
|
30 | ||||
26 | void init_parameter_dump( void ); |
|
31 | void init_parameter_dump( void ); | |
27 |
|
32 | |||
28 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
|
33 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -9,14 +9,14 | |||||
9 |
|
9 | |||
10 | extern unsigned short sequenceCounters_TC_EXE[]; |
|
10 | extern unsigned short sequenceCounters_TC_EXE[]; | |
11 |
|
11 | |||
12 |
int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
12 | int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
13 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
13 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
14 |
unsigned char byte_position, unsigned char rcv_value |
|
14 | unsigned char byte_position, unsigned char rcv_value ); | |
15 |
int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
15 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
16 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
16 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
17 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
17 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
18 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
18 | int send_tm_lfr_tc_exe_corrupted( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
19 |
unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID |
|
19 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID ); | |
20 |
|
20 | |||
21 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ); |
|
21 | void increment_seq_counter_destination_id( unsigned char *packet_sequence_control, unsigned char destination_id ); | |
22 |
|
22 |
@@ -70,6 +70,7 rtems_task Init( rtems_task_argument ign | |||||
70 | * |
|
70 | * | |
71 | */ |
|
71 | */ | |
72 |
|
72 | |||
|
73 | reset_local_time(); | |||
73 |
|
74 | |||
74 | rtems_status_code status; |
|
75 | rtems_status_code status; | |
75 | rtems_status_code status_spw; |
|
76 | rtems_status_code status_spw; | |
@@ -224,6 +225,11 void init_local_mode_parameters( void ) | |||||
224 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
225 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
225 | } |
|
226 | } | |
226 |
|
227 | |||
|
228 | void reset_local_time( void ) | |||
|
229 | { | |||
|
230 | ||||
|
231 | } | |||
|
232 | ||||
227 | void create_names( void ) // create all names for tasks and queues |
|
233 | void create_names( void ) // create all names for tasks and queues | |
228 | { |
|
234 | { | |
229 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
235 | /** This function creates all RTEMS names used in the software for tasks and queues. |
@@ -143,6 +143,7 rtems_task hous_task(rtems_task_argument | |||||
143 | { |
|
143 | { | |
144 | rtems_status_code status; |
|
144 | rtems_status_code status; | |
145 | rtems_id queue_id; |
|
145 | rtems_id queue_id; | |
|
146 | rtems_rate_monotonic_period_status period_status; | |||
146 |
|
147 | |||
147 | status = get_message_queue_id_send( &queue_id ); |
|
148 | status = get_message_queue_id_send( &queue_id ); | |
148 | if (status != RTEMS_SUCCESSFUL) |
|
149 | if (status != RTEMS_SUCCESSFUL) | |
@@ -183,6 +184,25 rtems_task hous_task(rtems_task_argument | |||||
183 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") |
|
184 | DEBUG_PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n") | |
184 | } |
|
185 | } | |
185 |
|
186 | |||
|
187 | // startup phase | |||
|
188 | status = rtems_rate_monotonic_period( HK_id, SY_LFR_TIME_SYN_TIMEOUT_in_ticks ); | |||
|
189 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |||
|
190 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |||
|
191 | while(period_status.state != RATE_MONOTONIC_EXPIRED ) // after SY_LFR_TIME_SYN_TIMEOUT ms, starts HK anyway | |||
|
192 | { | |||
|
193 | if ((time_management_regs->coarse_time & 0x80000000) == 0x00000000) // check time synchronization | |||
|
194 | { | |||
|
195 | break; // break if LFR is synchronized | |||
|
196 | } | |||
|
197 | else | |||
|
198 | { | |||
|
199 | status = rtems_rate_monotonic_get_status( HK_id, &period_status ); | |||
|
200 | sched_yield(); | |||
|
201 | } | |||
|
202 | } | |||
|
203 | status = rtems_rate_monotonic_cancel(HK_id); | |||
|
204 | DEBUG_PRINTF1("startup HK, HK_id status = %d\n", period_status.state) | |||
|
205 | ||||
186 | while(1){ // launch the rate monotonic task |
|
206 | while(1){ // launch the rate monotonic task | |
187 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); |
|
207 | status = rtems_rate_monotonic_period( HK_id, HK_PERIOD ); | |
188 | if ( status != RTEMS_SUCCESSFUL ) { |
|
208 | if ( status != RTEMS_SUCCESSFUL ) { |
@@ -186,6 +186,9 rtems_task avf0_task(rtems_task_argument | |||||
186 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; |
|
186 | ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous; | |
187 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; |
|
187 | ring_node_tab[NB_SM_TO_RECEIVE_BEFORE_AVF0-i] = ring_node_for_averaging_sm_f0; | |
188 | } |
|
188 | } | |
|
189 | ||||
|
190 | averaged_sm_f0[0] = ( (int *) (ring_node_tab[7]->buffer_address) ) [0]; | |||
|
191 | averaged_sm_f0[1] = ( (int *) (ring_node_tab[7]->buffer_address) ) [1]; | |||
189 | for(i=0; i<TOTAL_SIZE_SM; i++) |
|
192 | for(i=0; i<TOTAL_SIZE_SM; i++) | |
190 | { |
|
193 | { | |
191 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET] |
|
194 | averaged_sm_f0[i] = ( (int *) (ring_node_tab[0]->buffer_address) ) [i + TIME_OFFSET] |
@@ -174,10 +174,10 rtems_task recv_task( rtems_task_argumen | |||||
174 | destinationID = currentTC.sourceID; |
|
174 | destinationID = currentTC.sourceID; | |
175 | } |
|
175 | } | |
176 | getTime( time ); |
|
176 | getTime( time ); | |
177 |
close_action( ¤tTC, LFR_DEFAULT, queue_send_id |
|
177 | close_action( ¤tTC, LFR_DEFAULT, queue_send_id ); | |
178 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, |
|
178 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, | |
179 | computed_CRC, currentTC_LEN_RCV, |
|
179 | computed_CRC, currentTC_LEN_RCV, | |
180 |
destinationID |
|
180 | destinationID ); | |
181 | } |
|
181 | } | |
182 | } |
|
182 | } | |
183 | else |
|
183 | else |
@@ -160,7 +160,7 int tc_parser(ccsdsTelecommandPacket_t * | |||||
160 | } |
|
160 | } | |
161 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE |
|
161 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE | |
162 | { |
|
162 | { | |
163 | status = tc_check_subtype( packetSubtype ); |
|
163 | status = tc_check_type_subtype( packetType, packetSubtype ); | |
164 | } |
|
164 | } | |
165 | if (status == CCSDS_TM_VALID) // CHECK THE SID |
|
165 | if (status == CCSDS_TM_VALID) // CHECK THE SID | |
166 | { |
|
166 | { | |
@@ -203,10 +203,11 int tc_check_type( unsigned char packetT | |||||
203 | return status; |
|
203 | return status; | |
204 | } |
|
204 | } | |
205 |
|
205 | |||
206 | int tc_check_subtype( unsigned char packetSubType ) |
|
206 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ) | |
207 | { |
|
207 | { | |
208 | /** This function checks that the subtype of a TeleCommand is valid. |
|
208 | /** This function checks that the subtype of a TeleCommand is valid and coherent with the type. | |
209 | * |
|
209 | * | |
|
210 | * @param packetType is the type of the TC. | |||
210 | * @param packetSubType is the subtype to check. |
|
211 | * @param packetSubType is the subtype to check. | |
211 | * |
|
212 | * | |
212 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. |
|
213 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. | |
@@ -215,20 +216,40 int tc_check_subtype( unsigned char pack | |||||
215 |
|
216 | |||
216 | int status; |
|
217 | int status; | |
217 |
|
218 | |||
218 | if ( (packetSubType == TC_SUBTYPE_RESET) |
|
219 | switch(packetType) | |
219 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) |
|
|||
220 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) |
|
|||
221 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) |
|
|||
222 | || (packetSubType == TC_SUBTYPE_DUMP) |
|
|||
223 | || (packetSubType == TC_SUBTYPE_ENTER) |
|
|||
224 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) || (packetSubType == TC_SUBTYPE_UPDT_TIME) |
|
|||
225 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) ) |
|
|||
226 | { |
|
220 | { | |
227 | status = CCSDS_TM_VALID; |
|
221 | case TC_TYPE_GEN: | |
228 | } |
|
222 | if ( (packetSubType == TC_SUBTYPE_RESET) | |
229 | else |
|
223 | || (packetSubType == TC_SUBTYPE_LOAD_COMM) | |
230 | { |
|
224 | || (packetSubType == TC_SUBTYPE_LOAD_NORM) || (packetSubType == TC_SUBTYPE_LOAD_BURST) | |
|
225 | || (packetSubType == TC_SUBTYPE_LOAD_SBM1) || (packetSubType == TC_SUBTYPE_LOAD_SBM2) | |||
|
226 | || (packetSubType == TC_SUBTYPE_DUMP) | |||
|
227 | || (packetSubType == TC_SUBTYPE_ENTER) | |||
|
228 | || (packetSubType == TC_SUBTYPE_UPDT_INFO) | |||
|
229 | || (packetSubType == TC_SUBTYPE_EN_CAL) || (packetSubType == TC_SUBTYPE_DIS_CAL) ) | |||
|
230 | { | |||
|
231 | status = CCSDS_TM_VALID; | |||
|
232 | } | |||
|
233 | else | |||
|
234 | { | |||
|
235 | status = ILL_SUBTYPE; | |||
|
236 | } | |||
|
237 | break; | |||
|
238 | ||||
|
239 | case TC_TYPE_TIME: | |||
|
240 | if (packetSubType == TC_SUBTYPE_UPDT_TIME) | |||
|
241 | { | |||
|
242 | status = CCSDS_TM_VALID; | |||
|
243 | } | |||
|
244 | else | |||
|
245 | { | |||
|
246 | status = ILL_SUBTYPE; | |||
|
247 | } | |||
|
248 | break; | |||
|
249 | ||||
|
250 | default: | |||
231 | status = ILL_SUBTYPE; |
|
251 | status = ILL_SUBTYPE; | |
|
252 | break; | |||
232 | } |
|
253 | } | |
233 |
|
254 | |||
234 | return status; |
|
255 | return status; | |
@@ -246,8 +267,7 int tc_check_sid( unsigned char sid ) | |||||
246 |
|
267 | |||
247 | int status; |
|
268 | int status; | |
248 |
|
269 | |||
249 | if ( (sid == SID_TC_GROUND) |
|
270 | if ( (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) | |
250 | || (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) |
|
|||
251 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) |
|
271 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) | |
252 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) |
|
272 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) | |
253 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) |
|
273 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) |
@@ -68,62 +68,62 rtems_task actn_task( rtems_task_argumen | |||||
68 | { |
|
68 | { | |
69 | case TC_SUBTYPE_RESET: |
|
69 | case TC_SUBTYPE_RESET: | |
70 | result = action_reset( &TC, queue_snd_id, time ); |
|
70 | result = action_reset( &TC, queue_snd_id, time ); | |
71 |
close_action( &TC, result, queue_snd_id |
|
71 | close_action( &TC, result, queue_snd_id ); | |
72 | break; |
|
72 | break; | |
73 | // |
|
73 | // | |
74 | case TC_SUBTYPE_LOAD_COMM: |
|
74 | case TC_SUBTYPE_LOAD_COMM: | |
75 | result = action_load_common_par( &TC ); |
|
75 | result = action_load_common_par( &TC ); | |
76 |
close_action( &TC, result, queue_snd_id |
|
76 | close_action( &TC, result, queue_snd_id ); | |
77 | break; |
|
77 | break; | |
78 | // |
|
78 | // | |
79 | case TC_SUBTYPE_LOAD_NORM: |
|
79 | case TC_SUBTYPE_LOAD_NORM: | |
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); |
|
80 | result = action_load_normal_par( &TC, queue_snd_id, time ); | |
81 |
close_action( &TC, result, queue_snd_id |
|
81 | close_action( &TC, result, queue_snd_id ); | |
82 | break; |
|
82 | break; | |
83 | // |
|
83 | // | |
84 | case TC_SUBTYPE_LOAD_BURST: |
|
84 | case TC_SUBTYPE_LOAD_BURST: | |
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); |
|
85 | result = action_load_burst_par( &TC, queue_snd_id, time ); | |
86 |
close_action( &TC, result, queue_snd_id |
|
86 | close_action( &TC, result, queue_snd_id ); | |
87 | break; |
|
87 | break; | |
88 | // |
|
88 | // | |
89 | case TC_SUBTYPE_LOAD_SBM1: |
|
89 | case TC_SUBTYPE_LOAD_SBM1: | |
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); |
|
90 | result = action_load_sbm1_par( &TC, queue_snd_id, time ); | |
91 |
close_action( &TC, result, queue_snd_id |
|
91 | close_action( &TC, result, queue_snd_id ); | |
92 | break; |
|
92 | break; | |
93 | // |
|
93 | // | |
94 | case TC_SUBTYPE_LOAD_SBM2: |
|
94 | case TC_SUBTYPE_LOAD_SBM2: | |
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); |
|
95 | result = action_load_sbm2_par( &TC, queue_snd_id, time ); | |
96 |
close_action( &TC, result, queue_snd_id |
|
96 | close_action( &TC, result, queue_snd_id ); | |
97 | break; |
|
97 | break; | |
98 | // |
|
98 | // | |
99 | case TC_SUBTYPE_DUMP: |
|
99 | case TC_SUBTYPE_DUMP: | |
100 | result = action_dump_par( queue_snd_id ); |
|
100 | result = action_dump_par( queue_snd_id ); | |
101 |
close_action( &TC, result, queue_snd_id |
|
101 | close_action( &TC, result, queue_snd_id ); | |
102 | break; |
|
102 | break; | |
103 | // |
|
103 | // | |
104 | case TC_SUBTYPE_ENTER: |
|
104 | case TC_SUBTYPE_ENTER: | |
105 | result = action_enter_mode( &TC, queue_snd_id, time ); |
|
105 | result = action_enter_mode( &TC, queue_snd_id, time ); | |
106 |
close_action( &TC, result, queue_snd_id |
|
106 | close_action( &TC, result, queue_snd_id ); | |
107 | break; |
|
107 | break; | |
108 | // |
|
108 | // | |
109 | case TC_SUBTYPE_UPDT_INFO: |
|
109 | case TC_SUBTYPE_UPDT_INFO: | |
110 | result = action_update_info( &TC, queue_snd_id ); |
|
110 | result = action_update_info( &TC, queue_snd_id ); | |
111 |
close_action( &TC, result, queue_snd_id |
|
111 | close_action( &TC, result, queue_snd_id ); | |
112 | break; |
|
112 | break; | |
113 | // |
|
113 | // | |
114 | case TC_SUBTYPE_EN_CAL: |
|
114 | case TC_SUBTYPE_EN_CAL: | |
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); |
|
115 | result = action_enable_calibration( &TC, queue_snd_id, time ); | |
116 |
close_action( &TC, result, queue_snd_id |
|
116 | close_action( &TC, result, queue_snd_id ); | |
117 | break; |
|
117 | break; | |
118 | // |
|
118 | // | |
119 | case TC_SUBTYPE_DIS_CAL: |
|
119 | case TC_SUBTYPE_DIS_CAL: | |
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); |
|
120 | result = action_disable_calibration( &TC, queue_snd_id, time ); | |
121 |
close_action( &TC, result, queue_snd_id |
|
121 | close_action( &TC, result, queue_snd_id ); | |
122 | break; |
|
122 | break; | |
123 | // |
|
123 | // | |
124 | case TC_SUBTYPE_UPDT_TIME: |
|
124 | case TC_SUBTYPE_UPDT_TIME: | |
125 | result = action_update_time( &TC ); |
|
125 | result = action_update_time( &TC ); | |
126 |
close_action( &TC, result, queue_snd_id |
|
126 | close_action( &TC, result, queue_snd_id ); | |
127 | break; |
|
127 | break; | |
128 | // |
|
128 | // | |
129 | default: |
|
129 | default: | |
@@ -168,7 +168,7 int action_enter_mode(ccsdsTelecommandPa | |||||
168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) |
|
168 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |
169 | { |
|
169 | { | |
170 | status = RTEMS_UNSATISFIED; |
|
170 | status = RTEMS_UNSATISFIED; | |
171 |
send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode |
|
171 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); | |
172 | } |
|
172 | } | |
173 | else |
|
173 | else | |
174 | { |
|
174 | { | |
@@ -190,7 +190,7 int action_enter_mode(ccsdsTelecommandPa | |||||
190 | else |
|
190 | else | |
191 | { |
|
191 | { | |
192 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
192 | PRINTF("ERR *** in action_enter *** transition rejected\n") | |
193 |
send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
193 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
194 | } |
|
194 | } | |
195 | } |
|
195 | } | |
196 |
|
196 | |||
@@ -212,14 +212,32 int action_update_info(ccsdsTelecommandP | |||||
212 |
|
212 | |||
213 | unsigned int val; |
|
213 | unsigned int val; | |
214 | int result; |
|
214 | int result; | |
215 |
|
215 | unsigned int status; | ||
216 | result = LFR_SUCCESSFUL; |
|
216 | unsigned char mode; | |
217 |
|
217 | |||
218 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 |
|
218 | // check LFR MODE | |
219 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; |
|
219 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET5 ] & 0x1e) >> 1; | |
220 | val++; |
|
220 | status = check_update_info_hk_lfr_mode( mode ); | |
221 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); |
|
221 | if (status != LFR_DEFAULT) // check TDS mode | |
222 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); |
|
222 | { | |
|
223 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0xf0) >> 4; | |||
|
224 | status = check_update_info_hk_tds_mode( mode ); | |||
|
225 | } | |||
|
226 | if (status != LFR_DEFAULT) // check THR mode | |||
|
227 | { | |||
|
228 | mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET6 ] & 0x0f); | |||
|
229 | status = check_update_info_hk_thr_mode( mode ); | |||
|
230 | } | |||
|
231 | if (status != LFR_DEFAULT) // if the parameter check is successful | |||
|
232 | { | |||
|
233 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |||
|
234 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |||
|
235 | val++; | |||
|
236 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |||
|
237 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |||
|
238 | } | |||
|
239 | ||||
|
240 | result = status; | |||
223 |
|
241 | |||
224 | return result; |
|
242 | return result; | |
225 | } |
|
243 | } | |
@@ -239,14 +257,9 int action_enable_calibration(ccsdsTelec | |||||
239 | result = LFR_DEFAULT; |
|
257 | result = LFR_DEFAULT; | |
240 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
258 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
241 |
|
259 | |||
242 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
260 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
243 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
261 | result = LFR_DEFAULT; | |
244 | result = LFR_DEFAULT; |
|
262 | ||
245 | } |
|
|||
246 | else { |
|
|||
247 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
|||
248 | result = LFR_DEFAULT; |
|
|||
249 | } |
|
|||
250 | return result; |
|
263 | return result; | |
251 | } |
|
264 | } | |
252 |
|
265 | |||
@@ -265,14 +278,9 int action_disable_calibration(ccsdsTele | |||||
265 | result = LFR_DEFAULT; |
|
278 | result = LFR_DEFAULT; | |
266 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
279 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
267 |
|
280 | |||
268 | if ( (lfrMode == LFR_MODE_STANDBY) || (lfrMode == LFR_MODE_BURST) || (lfrMode == LFR_MODE_SBM2) ) { |
|
281 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
269 | send_tm_lfr_tc_exe_not_executable( TC, queue_id, time ); |
|
282 | result = LFR_DEFAULT; | |
270 | result = LFR_DEFAULT; |
|
283 | ||
271 | } |
|
|||
272 | else { |
|
|||
273 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
|||
274 | result = LFR_DEFAULT; |
|
|||
275 | } |
|
|||
276 | return result; |
|
284 | return result; | |
277 | } |
|
285 | } | |
278 |
|
286 | |||
@@ -642,7 +650,7 void launch_spectral_matrix_simu( unsign | |||||
642 |
|
650 | |||
643 | //**************** |
|
651 | //**************** | |
644 | // CLOSING ACTIONS |
|
652 | // CLOSING ACTIONS | |
645 |
void update_last_TC_exe(ccsdsTelecommandPacket_t *TC |
|
653 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC) | |
646 | { |
|
654 | { | |
647 | /** This function is used to update the HK packets statistics after a successful TC execution. |
|
655 | /** This function is used to update the HK packets statistics after a successful TC execution. | |
648 | * |
|
656 | * | |
@@ -657,15 +665,15 void update_last_TC_exe(ccsdsTelecommand | |||||
657 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; |
|
665 | housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType; | |
658 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; |
|
666 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00; | |
659 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; |
|
667 | housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType; | |
660 |
housekeeping_packet.hk_lfr_last_exe_tc_time[0] = |
|
668 | housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
661 |
housekeeping_packet.hk_lfr_last_exe_tc_time[1] = |
|
669 | housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
662 |
housekeeping_packet.hk_lfr_last_exe_tc_time[2] = |
|
670 | housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
663 |
housekeeping_packet.hk_lfr_last_exe_tc_time[3] = |
|
671 | housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
664 |
housekeeping_packet.hk_lfr_last_exe_tc_time[4] = |
|
672 | housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
665 |
housekeeping_packet.hk_lfr_last_exe_tc_time[5] = |
|
673 | housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
666 | } |
|
674 | } | |
667 |
|
675 | |||
668 |
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC |
|
676 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ) | |
669 | { |
|
677 | { | |
670 | /** This function is used to update the HK packets statistics after a TC rejection. |
|
678 | /** This function is used to update the HK packets statistics after a TC rejection. | |
671 | * |
|
679 | * | |
@@ -680,15 +688,15 void update_last_TC_rej(ccsdsTelecommand | |||||
680 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; |
|
688 | housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType; | |
681 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; |
|
689 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00; | |
682 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; |
|
690 | housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType; | |
683 |
housekeeping_packet.hk_lfr_last_rej_tc_time[0] = |
|
691 | housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
684 |
housekeeping_packet.hk_lfr_last_rej_tc_time[1] = |
|
692 | housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
685 |
housekeeping_packet.hk_lfr_last_rej_tc_time[2] = |
|
693 | housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
686 |
housekeeping_packet.hk_lfr_last_rej_tc_time[3] = |
|
694 | housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time); | |
687 |
housekeeping_packet.hk_lfr_last_rej_tc_time[4] = |
|
695 | housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
688 |
housekeeping_packet.hk_lfr_last_rej_tc_time[5] = |
|
696 | housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time); | |
689 | } |
|
697 | } | |
690 |
|
698 | |||
691 |
void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id |
|
699 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ) | |
692 | { |
|
700 | { | |
693 | /** This function is the last step of the TC execution workflow. |
|
701 | /** This function is the last step of the TC execution workflow. | |
694 | * |
|
702 | * | |
@@ -708,9 +716,9 void close_action(ccsdsTelecommandPacket | |||||
708 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
716 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
709 | ) |
|
717 | ) | |
710 | { |
|
718 | { | |
711 |
send_tm_lfr_tc_exe_success( TC, queue_id |
|
719 | send_tm_lfr_tc_exe_success( TC, queue_id ); | |
712 | } |
|
720 | } | |
713 |
update_last_TC_exe( TC |
|
721 | update_last_TC_exe( TC ); | |
714 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; |
|
722 | val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1]; | |
715 | val++; |
|
723 | val++; | |
716 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); |
|
724 | housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8); | |
@@ -718,7 +726,7 void close_action(ccsdsTelecommandPacket | |||||
718 | } |
|
726 | } | |
719 | else |
|
727 | else | |
720 | { |
|
728 | { | |
721 |
update_last_TC_rej( TC |
|
729 | update_last_TC_rej( TC ); | |
722 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; |
|
730 | val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1]; | |
723 | val++; |
|
731 | val++; | |
724 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
|
732 | housekeeping_packet.hk_lfr_rej_tc_cnt[0] = (unsigned char) (val >> 8); |
@@ -46,7 +46,7 int action_load_normal_par(ccsdsTelecomm | |||||
46 |
|
46 | |||
47 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || |
|
47 | if ( (lfrCurrentMode == LFR_MODE_NORMAL) || | |
48 | (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { |
|
48 | (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) { | |
49 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
49 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
50 | flag = LFR_DEFAULT; |
|
50 | flag = LFR_DEFAULT; | |
51 | } |
|
51 | } | |
52 |
|
52 | |||
@@ -136,7 +136,7 int action_load_burst_par(ccsdsTelecomma | |||||
136 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
136 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
137 |
|
137 | |||
138 | if ( lfrMode == LFR_MODE_BURST ) { |
|
138 | if ( lfrMode == LFR_MODE_BURST ) { | |
139 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
139 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
140 | result = LFR_DEFAULT; |
|
140 | result = LFR_DEFAULT; | |
141 | } |
|
141 | } | |
142 | else { |
|
142 | else { | |
@@ -165,7 +165,7 int action_load_sbm1_par(ccsdsTelecomman | |||||
165 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
165 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
166 |
|
166 | |||
167 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { |
|
167 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { | |
168 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
168 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
169 | result = LFR_DEFAULT; |
|
169 | result = LFR_DEFAULT; | |
170 | } |
|
170 | } | |
171 | else { |
|
171 | else { | |
@@ -194,8 +194,8 int action_load_sbm2_par(ccsdsTelecomman | |||||
194 | result = LFR_DEFAULT; |
|
194 | result = LFR_DEFAULT; | |
195 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
195 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
196 |
|
196 | |||
197 |
if ( (lfrMode == LFR_MODE_SBM |
|
197 | if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) { | |
198 |
status = send_tm_lfr_tc_exe_not_executable( TC, queue_id |
|
198 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
199 | result = LFR_DEFAULT; |
|
199 | result = LFR_DEFAULT; | |
200 | } |
|
200 | } | |
201 | else { |
|
201 | else { | |
@@ -271,7 +271,7 int set_sy_lfr_n_swf_l( ccsdsTelecommand | |||||
271 |
|
271 | |||
272 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 |
|
272 | if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16 | |
273 | { // 2048 is the maximum limit due to the size of the buffers |
|
273 | { // 2048 is the maximum limit due to the size of the buffers | |
274 |
status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb |
|
274 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb ); | |
275 | result = WRONG_APP_DATA; |
|
275 | result = WRONG_APP_DATA; | |
276 | } |
|
276 | } | |
277 | else if (tmp != 2048) |
|
277 | else if (tmp != 2048) | |
@@ -311,7 +311,7 int set_sy_lfr_n_swf_p(ccsdsTelecommandP | |||||
311 |
|
311 | |||
312 | if ( tmp < 16 ) |
|
312 | if ( tmp < 16 ) | |
313 | { |
|
313 | { | |
314 |
status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb |
|
314 | status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb ); | |
315 | result = WRONG_APP_DATA; |
|
315 | result = WRONG_APP_DATA; | |
316 | } |
|
316 | } | |
317 | else |
|
317 | else | |
@@ -410,6 +410,62 int set_sy_lfr_n_cwf_long_f3(ccsdsTeleco | |||||
410 | //********************* |
|
410 | //********************* | |
411 | // SBM2 MODE PARAMETERS |
|
411 | // SBM2 MODE PARAMETERS | |
412 |
|
412 | |||
|
413 | //******************* | |||
|
414 | // TC_LFR_UPDATE_INFO | |||
|
415 | unsigned int check_update_info_hk_lfr_mode( unsigned char mode ) | |||
|
416 | { | |||
|
417 | unsigned int status; | |||
|
418 | ||||
|
419 | if ( (mode == LFR_MODE_STANDBY) || (mode == LFR_MODE_NORMAL) | |||
|
420 | || (mode = LFR_MODE_BURST) | |||
|
421 | || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2)) | |||
|
422 | { | |||
|
423 | status = LFR_SUCCESSFUL; | |||
|
424 | } | |||
|
425 | else | |||
|
426 | { | |||
|
427 | status = LFR_DEFAULT; | |||
|
428 | } | |||
|
429 | ||||
|
430 | return status; | |||
|
431 | } | |||
|
432 | ||||
|
433 | unsigned int check_update_info_hk_tds_mode( unsigned char mode ) | |||
|
434 | { | |||
|
435 | unsigned int status; | |||
|
436 | ||||
|
437 | if ( (mode == TDS_MODE_STANDBY) || (mode == TDS_MODE_NORMAL) | |||
|
438 | || (mode = TDS_MODE_BURST) | |||
|
439 | || (mode == TDS_MODE_SBM1) || (mode == TDS_MODE_SBM2) | |||
|
440 | || (mode == TDS_MODE_LFM)) | |||
|
441 | { | |||
|
442 | status = LFR_SUCCESSFUL; | |||
|
443 | } | |||
|
444 | else | |||
|
445 | { | |||
|
446 | status = LFR_DEFAULT; | |||
|
447 | } | |||
|
448 | ||||
|
449 | return status; | |||
|
450 | } | |||
|
451 | ||||
|
452 | unsigned int check_update_info_hk_thr_mode( unsigned char mode ) | |||
|
453 | { | |||
|
454 | unsigned int status; | |||
|
455 | ||||
|
456 | if ( (mode == THR_MODE_STANDBY) || (mode == THR_MODE_NORMAL) | |||
|
457 | || (mode = THR_MODE_BURST)) | |||
|
458 | { | |||
|
459 | status = LFR_SUCCESSFUL; | |||
|
460 | } | |||
|
461 | else | |||
|
462 | { | |||
|
463 | status = LFR_DEFAULT; | |||
|
464 | } | |||
|
465 | ||||
|
466 | return status; | |||
|
467 | } | |||
|
468 | ||||
413 | //********** |
|
469 | //********** | |
414 | // init dump |
|
470 | // init dump | |
415 |
|
471 |
@@ -15,7 +15,7 | |||||
15 |
|
15 | |||
16 | #include "tm_lfr_tc_exe.h" |
|
16 | #include "tm_lfr_tc_exe.h" | |
17 |
|
17 | |||
18 |
int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
18 | int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
19 | { |
|
19 | { | |
20 | /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue. |
|
20 | /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue. | |
21 | * |
|
21 | * | |
@@ -51,12 +51,12 int send_tm_lfr_tc_exe_success( ccsdsTel | |||||
51 | TM.serviceType = TM_TYPE_TC_EXE; |
|
51 | TM.serviceType = TM_TYPE_TC_EXE; | |
52 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; |
|
52 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; | |
53 | TM.destinationID = TC->sourceID; |
|
53 | TM.destinationID = TC->sourceID; | |
54 | TM.time[0] = time[0]; |
|
54 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
55 | TM.time[1] = time[1]; |
|
55 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
56 | TM.time[2] = time[2]; |
|
56 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
57 | TM.time[3] = time[3]; |
|
57 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
58 | TM.time[4] = time[4]; |
|
58 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
59 | TM.time[5] = time[5]; |
|
59 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |
60 | // |
|
60 | // | |
61 | TM.telecommand_pkt_id[0] = TC->packetID[0]; |
|
61 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |
62 | TM.telecommand_pkt_id[1] = TC->packetID[1]; |
|
62 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |
@@ -75,8 +75,7 int send_tm_lfr_tc_exe_success( ccsdsTel | |||||
75 | } |
|
75 | } | |
76 |
|
76 | |||
77 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
77 | int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
78 |
unsigned char byte_position, unsigned char rcv_value |
|
78 | unsigned char byte_position, unsigned char rcv_value ) | |
79 | unsigned char *time) |
|
|||
80 | { |
|
79 | { | |
81 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. |
|
80 | /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue. | |
82 | * |
|
81 | * | |
@@ -143,7 +142,7 int send_tm_lfr_tc_exe_inconsistent( ccs | |||||
143 | return status; |
|
142 | return status; | |
144 | } |
|
143 | } | |
145 |
|
144 | |||
146 |
int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
145 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
147 | { |
|
146 | { | |
148 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. |
|
147 | /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue. | |
149 | * |
|
148 | * | |
@@ -336,7 +335,7 int send_tm_lfr_tc_exe_error( ccsdsTelec | |||||
336 |
|
335 | |||
337 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
336 | int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
338 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, |
|
337 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, | |
339 |
unsigned char destinationID |
|
338 | unsigned char destinationID ) | |
340 | { |
|
339 | { | |
341 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. |
|
340 | /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue. | |
342 | * |
|
341 | * | |
@@ -473,6 +472,16 void increment_seq_counter_destination_i | |||||
473 | break; |
|
472 | break; | |
474 | } |
|
473 | } | |
475 |
|
474 | |||
|
475 | // increment the sequence counter | |||
|
476 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX ) | |||
|
477 | { | |||
|
478 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; | |||
|
479 | } | |||
|
480 | else | |||
|
481 | { | |||
|
482 | sequenceCounters_TC_EXE[ i ] = 0; | |||
|
483 | } | |||
|
484 | ||||
476 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; |
|
485 | segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8; | |
477 | sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff; |
|
486 | sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff; | |
478 |
|
487 | |||
@@ -481,14 +490,4 void increment_seq_counter_destination_i | |||||
481 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); |
|
490 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
482 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); |
|
491 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
483 |
|
492 | |||
484 | // increment the sequence counter for the next packet |
|
|||
485 | if ( sequenceCounters_TC_EXE[ i ] < SEQ_CNT_MAX) |
|
|||
486 | { |
|
|||
487 | sequenceCounters_TC_EXE[ i ] = sequenceCounters_TC_EXE[ i ] + 1; |
|
|||
488 | } |
|
|||
489 | else |
|
|||
490 | { |
|
|||
491 | sequenceCounters_TC_EXE[ i ] = 0; |
|
|||
492 | } |
|
|||
493 |
|
||||
494 | } |
|
493 | } |
General Comments 0
You need to be logged in to leave comments.
Login now