##// END OF EJS Templates
tm_lfr_tc_exe.c and .h added to the repository
paul -
r41:d284d0ac13ca default
parent child
Show More
@@ -0,0 +1,24
1 #ifndef TM_LFR_TC_EXE_H_INCLUDED
2 #define TM_LFR_TC_EXE_H_INCLUDED
3
4 #include <rtems.h>
5 #include <stdio.h>
6
7 #include "fsw_params.h"
8
9 extern time_management_regs_t *time_management_regs;
10 extern Packet_TM_LFR_HK_t housekeeping_packet;
11
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);
17 int send_tm_lfr_tc_exe_error(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);
20
21 #endif // TM_LFR_TC_EXE_H_INCLUDED
22
23
24
@@ -0,0 +1,419
1 /** Functions to send TM packets related to TC parsing and execution.
2 *
3 * @file
4 * @author P. LEROY
5 *
6 * A group of functions to send appropriate TM packets after parsing and execution:
7 * - TM_LFR_TC_EXE_SUCCESS
8 * - TM_LFR_TC_EXE_INCONSISTENT
9 * - TM_LFR_TC_EXE_NOT_EXECUTABLE
10 * - TM_LFR_TC_EXE_NOT_IMPLEMENTED
11 * - TM_LFR_TC_EXE_ERROR
12 * - TM_LFR_TC_EXE_CORRUPTED
13 *
14 */
15
16 #include "tm_lfr_tc_exe.h"
17
18 int send_tm_lfr_tc_exe_success( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
19 {
20 /** This function sends a TM_LFR_TC_EXE_SUCCESS packet in the dedicated RTEMS message queue.
21 *
22 * @param TC points to the TeleCommand packet that is being processed
23 * @param queue_id is the id of the queue which handles TM
24 *
25 * @return RTEMS directive status code:
26 * - RTEMS_SUCCESSFUL - message sent successfully
27 * - RTEMS_INVALID_ID - invalid queue id
28 * - RTEMS_INVALID_SIZE - invalid message size
29 * - RTEMS_INVALID_ADDRESS - buffer is NULL
30 * - RTEMS_UNSATISFIED - out of message buffers
31 * - RTEMS_TOO_MANY - queue’s limit has been reached
32 *
33 */
34
35 rtems_status_code status;
36 Packet_TM_LFR_TC_EXE_SUCCESS_t TM;
37 unsigned char messageSize;
38
39 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
40 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
41 TM.reserved = DEFAULT_RESERVED;
42 TM.userApplication = CCSDS_USER_APP;
43 // PACKET HEADER
44 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
45 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
46 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
47 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
48 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8);
49 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS );
50 // DATA FIELD HEADER
51 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
52 TM.serviceType = TM_TYPE_TC_EXE;
53 TM.serviceSubType = TM_SUBTYPE_EXE_OK;
54 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
55 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
56 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
57 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
58 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
59 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
60 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
61 //
62 TM.telecommand_pkt_id[0] = TC->packetID[0];
63 TM.telecommand_pkt_id[1] = TC->packetID[1];
64 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
65 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
66
67 messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
68
69 // SEND DATA
70 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
71 if (status != RTEMS_SUCCESSFUL) {
72 PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n")
73 }
74
75 return status;
76 }
77
78 int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
79 unsigned char byte_position, unsigned char rcv_value )
80 {
81 /** This function sends a TM_LFR_TC_EXE_INCONSISTENT packet in the dedicated RTEMS message queue.
82 *
83 * @param TC points to the TeleCommand packet that is being processed
84 * @param queue_id is the id of the queue which handles TM
85 * @param byte_position is the byte position of the MSB of the parameter that has been seen as inconsistent
86 * @param rcv_value is the value of the LSB of the parameter that has been deteced as inconsistent
87 *
88 * @return RTEMS directive status code:
89 * - RTEMS_SUCCESSFUL - message sent successfully
90 * - RTEMS_INVALID_ID - invalid queue id
91 * - RTEMS_INVALID_SIZE - invalid message size
92 * - RTEMS_INVALID_ADDRESS - buffer is NULL
93 * - RTEMS_UNSATISFIED - out of message buffers
94 * - RTEMS_TOO_MANY - queue’s limit has been reached
95 *
96 */
97
98 rtems_status_code status;
99 Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM;
100 unsigned char messageSize;
101
102 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
103 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
104 TM.reserved = DEFAULT_RESERVED;
105 TM.userApplication = CCSDS_USER_APP;
106 // PACKET HEADER
107 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
108 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
109 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
110 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
111 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8);
112 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT );
113 // DATA FIELD HEADER
114 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
115 TM.serviceType = TM_TYPE_TC_EXE;
116 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
117 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
118 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
119 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
120 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
121 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
122 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
123 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
124 //
125 TM.tc_failure_code[0] = (char) (WRONG_APP_DATA >> 8);
126 TM.tc_failure_code[1] = (char) (WRONG_APP_DATA );
127 TM.telecommand_pkt_id[0] = TC->packetID[0];
128 TM.telecommand_pkt_id[1] = TC->packetID[1];
129 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
130 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
131 TM.tc_service = TC->serviceType; // type of the rejected TC
132 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
133 TM.byte_position = byte_position;
134 TM.rcv_value = rcv_value;
135
136 messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
137
138 // SEND DATA
139 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
140 if (status != RTEMS_SUCCESSFUL) {
141 PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n")
142 }
143
144 return status;
145 }
146
147 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
148 {
149 /** This function sends a TM_LFR_TC_EXE_NOT_EXECUTABLE packet in the dedicated RTEMS message queue.
150 *
151 * @param TC points to the TeleCommand packet that is being processed
152 * @param queue_id is the id of the queue which handles TM
153 *
154 * @return RTEMS directive status code:
155 * - RTEMS_SUCCESSFUL - message sent successfully
156 * - RTEMS_INVALID_ID - invalid queue id
157 * - RTEMS_INVALID_SIZE - invalid message size
158 * - RTEMS_INVALID_ADDRESS - buffer is NULL
159 * - RTEMS_UNSATISFIED - out of message buffers
160 * - RTEMS_TOO_MANY - queue’s limit has been reached
161 *
162 */
163
164 rtems_status_code status;
165 Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM;
166 unsigned char messageSize;
167
168 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
169 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
170 TM.reserved = DEFAULT_RESERVED;
171 TM.userApplication = CCSDS_USER_APP;
172 // PACKET HEADER
173 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
174 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
175 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
176 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
177 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8);
178 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE );
179 // DATA FIELD HEADER
180 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
181 TM.serviceType = TM_TYPE_TC_EXE;
182 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
183 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
184 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
185 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
186 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
187 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
188 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
189 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
190 //
191 TM.tc_failure_code[0] = (char) (TC_NOT_EXE >> 8);
192 TM.tc_failure_code[1] = (char) (TC_NOT_EXE );
193 TM.telecommand_pkt_id[0] = TC->packetID[0];
194 TM.telecommand_pkt_id[1] = TC->packetID[1];
195 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
196 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
197 TM.tc_service = TC->serviceType; // type of the rejected TC
198 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
199 TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0];
200 TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1];
201
202 messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
203
204 // SEND DATA
205 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
206 if (status != RTEMS_SUCCESSFUL) {
207 PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n")
208 }
209
210 return status;
211 }
212
213 int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
214 {
215 /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue.
216 *
217 * @param TC points to the TeleCommand packet that is being processed
218 * @param queue_id is the id of the queue which handles TM
219 *
220 * @return RTEMS directive status code:
221 * - RTEMS_SUCCESSFUL - message sent successfully
222 * - RTEMS_INVALID_ID - invalid queue id
223 * - RTEMS_INVALID_SIZE - invalid message size
224 * - RTEMS_INVALID_ADDRESS - buffer is NULL
225 * - RTEMS_UNSATISFIED - out of message buffers
226 * - RTEMS_TOO_MANY - queue’s limit has been reached
227 *
228 */
229
230 rtems_status_code status;
231 Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM;
232 unsigned char messageSize;
233
234 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
235 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
236 TM.reserved = DEFAULT_RESERVED;
237 TM.userApplication = CCSDS_USER_APP;
238 // PACKET HEADER
239 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
240 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
241 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
242 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
243 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8);
244 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED );
245 // DATA FIELD HEADER
246 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
247 TM.serviceType = TM_TYPE_TC_EXE;
248 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
249 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
250 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
251 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
252 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
253 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
254 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
255 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
256 //
257 TM.tc_failure_code[0] = (char) (FUNCT_NOT_IMPL >> 8);
258 TM.tc_failure_code[1] = (char) (FUNCT_NOT_IMPL );
259 TM.telecommand_pkt_id[0] = TC->packetID[0];
260 TM.telecommand_pkt_id[1] = TC->packetID[1];
261 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
262 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
263 TM.tc_service = TC->serviceType; // type of the rejected TC
264 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
265
266 messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
267
268 // SEND DATA
269 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
270 if (status != RTEMS_SUCCESSFUL) {
271 PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n")
272 }
273
274 return status;
275 }
276
277 int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
278 {
279 /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue.
280 *
281 * @param TC points to the TeleCommand packet that is being processed
282 * @param queue_id is the id of the queue which handles TM
283 *
284 * @return RTEMS directive status code:
285 * - RTEMS_SUCCESSFUL - message sent successfully
286 * - RTEMS_INVALID_ID - invalid queue id
287 * - RTEMS_INVALID_SIZE - invalid message size
288 * - RTEMS_INVALID_ADDRESS - buffer is NULL
289 * - RTEMS_UNSATISFIED - out of message buffers
290 * - RTEMS_TOO_MANY - queue’s limit has been reached
291 *
292 */
293
294 rtems_status_code status;
295 Packet_TM_LFR_TC_EXE_ERROR_t TM;
296 unsigned char messageSize;
297
298 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
299 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
300 TM.reserved = DEFAULT_RESERVED;
301 TM.userApplication = CCSDS_USER_APP;
302 // PACKET HEADER
303 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
304 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
305 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
306 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
307 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8);
308 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR );
309 // DATA FIELD HEADER
310 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
311 TM.serviceType = TM_TYPE_TC_EXE;
312 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
313 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
314 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
315 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
316 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
317 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
318 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
319 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
320 //
321 TM.tc_failure_code[0] = (char) (FAIL_DETECTED >> 8);
322 TM.tc_failure_code[1] = (char) (FAIL_DETECTED );
323 TM.telecommand_pkt_id[0] = TC->packetID[0];
324 TM.telecommand_pkt_id[1] = TC->packetID[1];
325 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
326 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
327 TM.tc_service = TC->serviceType; // type of the rejected TC
328 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
329
330 messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
331
332 // SEND DATA
333 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
334 if (status != RTEMS_SUCCESSFUL) {
335 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
336 }
337
338 return status;
339 }
340
341 int send_tm_lfr_tc_exe_corrupted(ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
342 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV )
343 {
344 /** This function sends a TM_LFR_TC_EXE_CORRUPTED packet in the dedicated RTEMS message queue.
345 *
346 * @param TC points to the TeleCommand packet that is being processed
347 * @param queue_id is the id of the queue which handles TM
348 * @param computed_CRC points to a buffer of two bytes containing the CRC computed during the parsing of the TeleCommand
349 * @param currentTC_LEN_RCV points to a buffer of two bytes containing a packet size field computed on the received data
350 *
351 * @return RTEMS directive status code:
352 * - RTEMS_SUCCESSFUL - message sent successfully
353 * - RTEMS_INVALID_ID - invalid queue id
354 * - RTEMS_INVALID_SIZE - invalid message size
355 * - RTEMS_INVALID_ADDRESS - buffer is NULL
356 * - RTEMS_UNSATISFIED - out of message buffers
357 * - RTEMS_TOO_MANY - queue’s limit has been reached
358 *
359 */
360
361 rtems_status_code status;
362 Packet_TM_LFR_TC_EXE_CORRUPTED_t TM;
363 unsigned char messageSize;
364 unsigned int packetLength;
365 unsigned char *packetDataField;
366
367 packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length
368 packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field
369
370 TM.targetLogicalAddress = CCSDS_DESTINATION_ID;
371 TM.protocolIdentifier = CCSDS_PROTOCOLE_ID;
372 TM.reserved = DEFAULT_RESERVED;
373 TM.userApplication = CCSDS_USER_APP;
374 // PACKET HEADER
375 TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8);
376 TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE );
377 TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8);
378 TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE );
379 TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8);
380 TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED );
381 // DATA FIELD HEADER
382 TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
383 TM.serviceType = TM_TYPE_TC_EXE;
384 TM.serviceSubType = TM_SUBTYPE_EXE_NOK;
385 TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id
386 TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
387 TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
388 TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
389 TM.time[3] = (unsigned char) (time_management_regs->coarse_time);
390 TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8);
391 TM.time[5] = (unsigned char) (time_management_regs->fine_time);
392 //
393 TM.tc_failure_code[0] = (unsigned char) (CORRUPTED >> 8);
394 TM.tc_failure_code[1] = (unsigned char) (CORRUPTED );
395 TM.telecommand_pkt_id[0] = TC->packetID[0];
396 TM.telecommand_pkt_id[1] = TC->packetID[1];
397 TM.pkt_seq_control[0] = TC->packetSequenceControl[0];
398 TM.pkt_seq_control[1] = TC->packetSequenceControl[1];
399 TM.tc_service = TC->serviceType; // type of the rejected TC
400 TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC
401 TM.pkt_len_rcv_value[0] = TC->packetLength[0];
402 TM.pkt_len_rcv_value[1] = TC->packetLength[1];
403 TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
404 TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
405 TM.rcv_crc[0] = packetDataField[ packetLength - 1 ];
406 TM.rcv_crc[1] = packetDataField[ packetLength ];
407 TM.computed_crc[0] = computed_CRC[0];
408 TM.computed_crc[1] = computed_CRC[1];
409
410 messageSize = PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
411
412 // SEND DATA
413 status = rtems_message_queue_urgent( queue_id, &TM, messageSize);
414 if (status != RTEMS_SUCCESSFUL) {
415 PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n")
416 }
417
418 return status;
419 }
General Comments 0
You need to be logged in to leave comments. Login now