##// END OF EJS Templates
rev 1.0.0.2...
paul -
r104:e5b7ab03049c VHDLib206
parent child
Show More
@@ -1,1 +1,1
1 src/basic_parameters = https://leroy@hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/SOLO_LFR/LFR_basic-parameters
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 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Feb 21 15:32:25 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Tue Mar 4 09:15:37 2014
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 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 11 CC = sparc-rtems-gcc
12 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 14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters
@@ -1,7 +1,7
1 1 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report
4 CONFIG += console verbose
4 CONFIG += console verbose debug_messages
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
@@ -69,7 +69,6 HEADERS += \
69 69 ../header/ccsds_types.h \
70 70 ../header/fsw_params_processing.h \
71 71 ../header/fsw_spacewire.h \
72 ../header/tm_byte_positions.h \
73 72 ../header/tc_load_dump_parameters.h \
74 73 ../header/tm_lfr_tc_exe.h \
75 74 ../header/tc_acceptance.h \
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.0, 2014-03-03T07:03:32. -->
3 <!-- Written by QtCreator 3.0.0, 2014-03-04T07:03:18. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -123,7 +123,7
123 123 #define CCSDS_TM_VALID 7
124 124
125 125 // TC SID
126 #define SID_TC_GROUND 0
126 #define SID_TC_GROUND 0
127 127 #define SID_TC_MISSION_TIMELINE 110
128 128 #define SID_TC_TC_SEQUENCES 111
129 129 #define SID_TC_RECOVERY_ACTION_CMD 112
@@ -30,6 +30,7 rtems_status_code get_message_queue_id_r
30 30 int start_recv_send_tasks( void );
31 31 //
32 32 void init_local_mode_parameters( void );
33 void reset_local_time( void );
33 34
34 35 extern int rtems_cpu_usage_report( void );
35 36 extern int rtems_cpu_usage_reset( void );
@@ -3,6 +3,7
3 3
4 4 #include "grlib_regs.h"
5 5 #include "fsw_params_processing.h"
6 #include "fsw_params_nb_bytes.h"
6 7 #include "tm_byte_positions.h"
7 8 #include "ccsds_types.h"
8 9
@@ -40,12 +41,22 typedef struct ring_node
40 41
41 42 //**********
42 43 // LFR MODES
43 #define LFR_MODE_STANDBY 0
44 #define LFR_MODE_NORMAL 1
45 #define LFR_MODE_BURST 2
46 #define LFR_MODE_SBM1 3
47 #define LFR_MODE_SBM2 4
48 #define LFR_MODE_NORMAL_CWF_F3 5
44 #define LFR_MODE_STANDBY 0
45 #define LFR_MODE_NORMAL 1
46 #define LFR_MODE_BURST 2
47 #define LFR_MODE_SBM1 3
48 #define LFR_MODE_SBM2 4
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 61 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
51 62 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
@@ -116,7 +127,9 typedef struct ring_node
116 127 // TIME
117 128 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
118 129 #define TIMER_SM_SIMULATOR 1
119 #define HK_PERIOD 100 // 100 * 10ms => 1sec
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 135 // LPP CODES
@@ -11,6 +11,7
11 11 #define BYTE_POS_SY_LFR_N_ASM_P 4
12 12 #define BYTE_POS_SY_LFR_N_BP_P0 6
13 13 #define BYTE_POS_SY_LFR_N_BP_P1 7
14 #define BYTE_POS_SY_LFR_N_CWF_LONG_F3 8
14 15
15 16 // TC_LFR_LOAD_BURST_PAR
16 17
@@ -18,5 +19,8
18 19
19 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 26 #endif // TM_BYTE_POSITIONS_H
@@ -14,7 +14,7 void GetCRCAsTwoBytes(unsigned char* dat
14 14 // ACCEPTANCE FUNCTIONS
15 15 int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int TC_LEN_RCV, unsigned char *computed_CRC);
16 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 18 int tc_check_sid( unsigned char sid );
19 19 int tc_check_length( unsigned char packetType, unsigned int length );
20 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 46 // other functions
47 47 void updateLFRCurrentMode();
48 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time);
49 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC, unsigned char *time);
50 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id, unsigned char *time);
48 void update_last_TC_exe(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 );
51 51
52 52 extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
53 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 23 int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
24 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 31 void init_parameter_dump( void );
27 32
28 33 #endif // TC_LOAD_DUMP_PARAMETERS_H
@@ -9,14 +9,14
9 9
10 10 extern unsigned short sequenceCounters_TC_EXE[];
11 11
12 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
13 int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
14 unsigned char byte_position, unsigned char rcv_value, unsigned char *time);
15 int send_tm_lfr_tc_exe_not_executable(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);
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, unsigned char *time);
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,
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 );
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 );
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 );
20 20
21 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 75 rtems_status_code status;
75 76 rtems_status_code status_spw;
@@ -224,6 +225,11 void init_local_mode_parameters( void )
224 225 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
225 226 }
226 227
228 void reset_local_time( void )
229 {
230
231 }
232
227 233 void create_names( void ) // create all names for tasks and queues
228 234 {
229 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 144 rtems_status_code status;
145 145 rtems_id queue_id;
146 rtems_rate_monotonic_period_status period_status;
146 147
147 148 status = get_message_queue_id_send( &queue_id );
148 149 if (status != RTEMS_SUCCESSFUL)
@@ -183,6 +184,25 rtems_task hous_task(rtems_task_argument
183 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 206 while(1){ // launch the rate monotonic task
187 207 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
188 208 if ( status != RTEMS_SUCCESSFUL ) {
@@ -186,6 +186,9 rtems_task avf0_task(rtems_task_argument
186 186 ring_node_for_averaging_sm_f0 = ring_node_for_averaging_sm_f0->previous;
187 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 192 for(i=0; i<TOTAL_SIZE_SM; i++)
190 193 {
191 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 174 destinationID = currentTC.sourceID;
175 175 }
176 176 getTime( time );
177 close_action( &currentTC, LFR_DEFAULT, queue_send_id, time);
177 close_action( &currentTC, LFR_DEFAULT, queue_send_id );
178 178 send_tm_lfr_tc_exe_corrupted( &currentTC, queue_send_id,
179 179 computed_CRC, currentTC_LEN_RCV,
180 destinationID, time );
180 destinationID );
181 181 }
182 182 }
183 183 else
@@ -160,7 +160,7 int tc_parser(ccsdsTelecommandPacket_t *
160 160 }
161 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 165 if (status == CCSDS_TM_VALID) // CHECK THE SID
166 166 {
@@ -203,10 +203,11 int tc_check_type( unsigned char packetT
203 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 211 * @param packetSubType is the subtype to check.
211 212 *
212 213 * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE.
@@ -215,20 +216,40 int tc_check_subtype( unsigned char pack
215 216
216 217 int status;
217 218
218 if ( (packetSubType == TC_SUBTYPE_RESET)
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) )
219 switch(packetType)
226 220 {
227 status = CCSDS_TM_VALID;
228 }
229 else
230 {
221 case TC_TYPE_GEN:
222 if ( (packetSubType == TC_SUBTYPE_RESET)
223 || (packetSubType == TC_SUBTYPE_LOAD_COMM)
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 251 status = ILL_SUBTYPE;
252 break;
232 253 }
233 254
234 255 return status;
@@ -246,8 +267,7 int tc_check_sid( unsigned char sid )
246 267
247 268 int status;
248 269
249 if ( (sid == SID_TC_GROUND)
250 || (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD)
270 if ( (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD)
251 271 || (sid == SID_TC_BACKUP_MISSION_TIMELINE)
252 272 || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2)
253 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 69 case TC_SUBTYPE_RESET:
70 70 result = action_reset( &TC, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id, time );
71 close_action( &TC, result, queue_snd_id );
72 72 break;
73 73 //
74 74 case TC_SUBTYPE_LOAD_COMM:
75 75 result = action_load_common_par( &TC );
76 close_action( &TC, result, queue_snd_id, time );
76 close_action( &TC, result, queue_snd_id );
77 77 break;
78 78 //
79 79 case TC_SUBTYPE_LOAD_NORM:
80 80 result = action_load_normal_par( &TC, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id, time );
81 close_action( &TC, result, queue_snd_id );
82 82 break;
83 83 //
84 84 case TC_SUBTYPE_LOAD_BURST:
85 85 result = action_load_burst_par( &TC, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id, time );
86 close_action( &TC, result, queue_snd_id );
87 87 break;
88 88 //
89 89 case TC_SUBTYPE_LOAD_SBM1:
90 90 result = action_load_sbm1_par( &TC, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id, time );
91 close_action( &TC, result, queue_snd_id );
92 92 break;
93 93 //
94 94 case TC_SUBTYPE_LOAD_SBM2:
95 95 result = action_load_sbm2_par( &TC, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id, time );
96 close_action( &TC, result, queue_snd_id );
97 97 break;
98 98 //
99 99 case TC_SUBTYPE_DUMP:
100 100 result = action_dump_par( queue_snd_id );
101 close_action( &TC, result, queue_snd_id, time );
101 close_action( &TC, result, queue_snd_id );
102 102 break;
103 103 //
104 104 case TC_SUBTYPE_ENTER:
105 105 result = action_enter_mode( &TC, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id, time );
106 close_action( &TC, result, queue_snd_id );
107 107 break;
108 108 //
109 109 case TC_SUBTYPE_UPDT_INFO:
110 110 result = action_update_info( &TC, queue_snd_id );
111 close_action( &TC, result, queue_snd_id, time );
111 close_action( &TC, result, queue_snd_id );
112 112 break;
113 113 //
114 114 case TC_SUBTYPE_EN_CAL:
115 115 result = action_enable_calibration( &TC, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id, time );
116 close_action( &TC, result, queue_snd_id );
117 117 break;
118 118 //
119 119 case TC_SUBTYPE_DIS_CAL:
120 120 result = action_disable_calibration( &TC, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id, time );
121 close_action( &TC, result, queue_snd_id );
122 122 break;
123 123 //
124 124 case TC_SUBTYPE_UPDT_TIME:
125 125 result = action_update_time( &TC );
126 close_action( &TC, result, queue_snd_id, time );
126 close_action( &TC, result, queue_snd_id );
127 127 break;
128 128 //
129 129 default:
@@ -168,7 +168,7 int action_enter_mode(ccsdsTelecommandPa
168 168 && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) )
169 169 {
170 170 status = RTEMS_UNSATISFIED;
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode, time );
171 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
172 172 }
173 173 else
174 174 {
@@ -190,7 +190,7 int action_enter_mode(ccsdsTelecommandPa
190 190 else
191 191 {
192 192 PRINTF("ERR *** in action_enter *** transition rejected\n")
193 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
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 213 unsigned int val;
214 214 int result;
215
216 result = LFR_SUCCESSFUL;
215 unsigned int status;
216 unsigned char mode;
217 217
218 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
219 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];
220 val++;
221 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
222 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
218 // check LFR MODE
219 mode = (TC->dataAndCRC[ BYTE_POS_HK_UPDATE_INFO_PAR_SET5 ] & 0x1e) >> 1;
220 status = check_update_info_hk_lfr_mode( mode );
221 if (status != LFR_DEFAULT) // check TDS mode
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 242 return result;
225 243 }
@@ -239,14 +257,9 int action_enable_calibration(ccsdsTelec
239 257 result = LFR_DEFAULT;
240 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) ) {
243 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
244 result = LFR_DEFAULT;
245 }
246 else {
247 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
248 result = LFR_DEFAULT;
249 }
260 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
261 result = LFR_DEFAULT;
262
250 263 return result;
251 264 }
252 265
@@ -265,14 +278,9 int action_disable_calibration(ccsdsTele
265 278 result = LFR_DEFAULT;
266 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) ) {
269 send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
270 result = LFR_DEFAULT;
271 }
272 else {
273 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
274 result = LFR_DEFAULT;
275 }
281 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
282 result = LFR_DEFAULT;
283
276 284 return result;
277 285 }
278 286
@@ -642,7 +650,7 void launch_spectral_matrix_simu( unsign
642 650
643 651 //****************
644 652 // CLOSING ACTIONS
645 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC, unsigned char *time)
653 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
646 654 {
647 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 665 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->serviceType;
658 666 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
659 667 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->serviceSubType;
660 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = time[0];
661 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = time[1];
662 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = time[2];
663 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = time[3];
664 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = time[4];
665 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = time[5];
668 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
669 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
670 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
671 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
672 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
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, unsigned char *time)
676 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC )
669 677 {
670 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 688 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->serviceType;
681 689 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
682 690 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->serviceSubType;
683 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = time[0];
684 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = time[1];
685 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = time[2];
686 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = time[3];
687 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = time[4];
688 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = time[5];
691 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
692 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
693 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
694 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
695 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
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, unsigned char *time)
699 void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id )
692 700 {
693 701 /** This function is the last step of the TC execution workflow.
694 702 *
@@ -708,9 +716,9 void close_action(ccsdsTelecommandPacket
708 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, time );
719 send_tm_lfr_tc_exe_success( TC, queue_id );
712 720 }
713 update_last_TC_exe( TC, time );
721 update_last_TC_exe( TC );
714 722 val = housekeeping_packet.hk_lfr_exe_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_exe_tc_cnt[1];
715 723 val++;
716 724 housekeeping_packet.hk_lfr_exe_tc_cnt[0] = (unsigned char) (val >> 8);
@@ -718,7 +726,7 void close_action(ccsdsTelecommandPacket
718 726 }
719 727 else
720 728 {
721 update_last_TC_rej( TC, time );
729 update_last_TC_rej( TC );
722 730 val = housekeeping_packet.hk_lfr_rej_tc_cnt[0] * 256 + housekeeping_packet.hk_lfr_rej_tc_cnt[1];
723 731 val++;
724 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 47 if ( (lfrCurrentMode == LFR_MODE_NORMAL) ||
48 48 (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) ) {
49 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
49 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
50 50 flag = LFR_DEFAULT;
51 51 }
52 52
@@ -136,7 +136,7 int action_load_burst_par(ccsdsTelecomma
136 136 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
137 137
138 138 if ( lfrMode == LFR_MODE_BURST ) {
139 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
139 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
140 140 result = LFR_DEFAULT;
141 141 }
142 142 else {
@@ -165,7 +165,7 int action_load_sbm1_par(ccsdsTelecomman
165 165 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
166 166
167 167 if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) {
168 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
168 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
169 169 result = LFR_DEFAULT;
170 170 }
171 171 else {
@@ -194,8 +194,8 int action_load_sbm2_par(ccsdsTelecomman
194 194 result = LFR_DEFAULT;
195 195 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
196 196
197 if ( (lfrMode == LFR_MODE_SBM2) || (lfrMode == LFR_MODE_SBM2) ) {
198 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id, time );
197 if ( (lfrMode == LFR_MODE_SBM1) || (lfrMode == LFR_MODE_SBM2) ) {
198 status = send_tm_lfr_tc_exe_not_executable( TC, queue_id );
199 199 result = LFR_DEFAULT;
200 200 }
201 201 else {
@@ -271,7 +271,7 int set_sy_lfr_n_swf_l( ccsdsTelecommand
271 271
272 272 if ( (tmp < 16) || (tmp > 2048) ) // the snapshot period is a multiple of 16
273 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, time );
274 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_L+10, lsb );
275 275 result = WRONG_APP_DATA;
276 276 }
277 277 else if (tmp != 2048)
@@ -311,7 +311,7 int set_sy_lfr_n_swf_p(ccsdsTelecommandP
311 311
312 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, time );
314 status = send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_SY_LFR_N_SWF_P+10, lsb );
315 315 result = WRONG_APP_DATA;
316 316 }
317 317 else
@@ -410,6 +410,62 int set_sy_lfr_n_cwf_long_f3(ccsdsTeleco
410 410 //*********************
411 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 470 // init dump
415 471
@@ -15,7 +15,7
15 15
16 16 #include "tm_lfr_tc_exe.h"
17 17
18 int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
18 int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
19 19 {
20 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 51 TM.serviceType = TM_TYPE_TC_EXE;
52 52 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
53 53 TM.destinationID = TC->sourceID;
54 TM.time[0] = time[0];
55 TM.time[1] = time[1];
56 TM.time[2] = time[2];
57 TM.time[3] = time[3];
58 TM.time[4] = time[4];
59 TM.time[5] = time[5];
54 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
55 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
56 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
57 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
58 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
59 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
60 60 //
61 61 TM.telecommand_pkt_id[0] = TC->packetID[0];
62 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 77 int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
78 unsigned char byte_position, unsigned char rcv_value,
79 unsigned char *time)
78 unsigned char byte_position, unsigned char rcv_value )
80 79 {
81 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 142 return status;
144 143 }
145 144
146 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
145 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
147 146 {
148 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 336 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
338 337 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV,
339 unsigned char destinationID, unsigned char *time)
338 unsigned char destinationID )
340 339 {
341 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 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 485 segmentation_grouping_flag = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
477 486 sequence_cnt = sequenceCounters_TC_EXE[ i ] & 0x3fff;
478 487
@@ -481,14 +490,4 void increment_seq_counter_destination_i
481 490 packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8);
482 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