@@ -0,0 +1,6 | |||||
|
1 | #ifndef TM_BYTE_POSITIONS_H | |||
|
2 | #define TM_BYTE_POSITIONS_H | |||
|
3 | ||||
|
4 | #define BYTE_POS_CP_LFR_MODE 11 | |||
|
5 | ||||
|
6 | #endif // TM_BYTE_POSITIONS_H |
@@ -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: Thu Oct 10 |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Oct 10 15:46:11 2013 | |
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 |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -58,5 +58,6 HEADERS += \ | |||||
58 | ../header/fsw_init.h \ |
|
58 | ../header/fsw_init.h \ | |
59 | ../header/ccsds_types.h \ |
|
59 | ../header/ccsds_types.h \ | |
60 | ../header/fsw_params_processing.h \ |
|
60 | ../header/fsw_params_processing.h \ | |
61 | ../header/fsw_spacewire.h |
|
61 | ../header/fsw_spacewire.h \ | |
|
62 | ../header/tm_byte_positions.h | |||
62 |
|
63 |
@@ -235,6 +235,131 struct Packet_TM_LFR_TC_EXE_str | |||||
235 | }; |
|
235 | }; | |
236 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; |
|
236 | typedef struct Packet_TM_LFR_TC_EXE_str Packet_TM_LFR_TC_EXE_t; | |
237 |
|
237 | |||
|
238 | struct Packet_TM_LFR_TC_EXE_SUCCESS_str | |||
|
239 | { | |||
|
240 | volatile unsigned char targetLogicalAddress; | |||
|
241 | volatile unsigned char protocolIdentifier; | |||
|
242 | volatile unsigned char reserved; | |||
|
243 | volatile unsigned char userApplication; | |||
|
244 | // PACKET HEADER | |||
|
245 | volatile unsigned char packetID[2]; | |||
|
246 | volatile unsigned char packetSequenceControl[2]; | |||
|
247 | volatile unsigned char packetLength[2]; | |||
|
248 | // DATA FIELD HEADER | |||
|
249 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
250 | volatile unsigned char serviceType; | |||
|
251 | volatile unsigned char serviceSubType; | |||
|
252 | volatile unsigned char destinationID; | |||
|
253 | volatile unsigned char time[6]; | |||
|
254 | // | |||
|
255 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
256 | volatile unsigned char pkt_seq_control[2]; | |||
|
257 | }; | |||
|
258 | typedef struct Packet_TM_LFR_TC_EXE_SUCCESS_str Packet_TM_LFR_TC_EXE_SUCCESS_t; | |||
|
259 | ||||
|
260 | struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str | |||
|
261 | { | |||
|
262 | volatile unsigned char targetLogicalAddress; | |||
|
263 | volatile unsigned char protocolIdentifier; | |||
|
264 | volatile unsigned char reserved; | |||
|
265 | volatile unsigned char userApplication; | |||
|
266 | // PACKET HEADER | |||
|
267 | volatile unsigned char packetID[2]; | |||
|
268 | volatile unsigned char packetSequenceControl[2]; | |||
|
269 | volatile unsigned char packetLength[2]; | |||
|
270 | // DATA FIELD HEADER | |||
|
271 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
272 | volatile unsigned char serviceType; | |||
|
273 | volatile unsigned char serviceSubType; | |||
|
274 | volatile unsigned char destinationID; | |||
|
275 | volatile unsigned char time[6]; | |||
|
276 | // | |||
|
277 | volatile unsigned char tc_failure_code[2]; | |||
|
278 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
279 | volatile unsigned char pkt_seq_control[2]; | |||
|
280 | volatile unsigned char tc_service; | |||
|
281 | volatile unsigned char tc_subtype; | |||
|
282 | volatile unsigned char byte_position; | |||
|
283 | volatile unsigned char rcv_value; | |||
|
284 | }; | |||
|
285 | typedef struct Packet_TM_LFR_TC_EXE_INCONSISTENT_str Packet_TM_LFR_TC_EXE_INCONSISTENT_t; | |||
|
286 | ||||
|
287 | struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str | |||
|
288 | { | |||
|
289 | volatile unsigned char targetLogicalAddress; | |||
|
290 | volatile unsigned char protocolIdentifier; | |||
|
291 | volatile unsigned char reserved; | |||
|
292 | volatile unsigned char userApplication; | |||
|
293 | // PACKET HEADER | |||
|
294 | volatile unsigned char packetID[2]; | |||
|
295 | volatile unsigned char packetSequenceControl[2]; | |||
|
296 | volatile unsigned char packetLength[2]; | |||
|
297 | // DATA FIELD HEADER | |||
|
298 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
299 | volatile unsigned char serviceType; | |||
|
300 | volatile unsigned char serviceSubType; | |||
|
301 | volatile unsigned char destinationID; | |||
|
302 | volatile unsigned char time[6]; | |||
|
303 | // | |||
|
304 | volatile unsigned char tc_failure_code[2]; | |||
|
305 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
306 | volatile unsigned char pkt_seq_control[2]; | |||
|
307 | volatile unsigned char tc_service; | |||
|
308 | volatile unsigned char tc_subtype; | |||
|
309 | volatile unsigned char lfr_status_word[2]; | |||
|
310 | }; | |||
|
311 | typedef struct Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_str Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t; | |||
|
312 | ||||
|
313 | struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str | |||
|
314 | { | |||
|
315 | volatile unsigned char targetLogicalAddress; | |||
|
316 | volatile unsigned char protocolIdentifier; | |||
|
317 | volatile unsigned char reserved; | |||
|
318 | volatile unsigned char userApplication; | |||
|
319 | // PACKET HEADER | |||
|
320 | volatile unsigned char packetID[2]; | |||
|
321 | volatile unsigned char packetSequenceControl[2]; | |||
|
322 | volatile unsigned char packetLength[2]; | |||
|
323 | // DATA FIELD HEADER | |||
|
324 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
325 | volatile unsigned char serviceType; | |||
|
326 | volatile unsigned char serviceSubType; | |||
|
327 | volatile unsigned char destinationID; | |||
|
328 | volatile unsigned char time[6]; | |||
|
329 | // | |||
|
330 | volatile unsigned char tc_failure_code[2]; | |||
|
331 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
332 | volatile unsigned char pkt_seq_control[2]; | |||
|
333 | volatile unsigned char tc_service; | |||
|
334 | volatile unsigned char tc_subtype; | |||
|
335 | }; | |||
|
336 | typedef struct Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_str Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t; | |||
|
337 | ||||
|
338 | struct Packet_TM_LFR_TC_EXE_ERROR_str | |||
|
339 | { | |||
|
340 | volatile unsigned char targetLogicalAddress; | |||
|
341 | volatile unsigned char protocolIdentifier; | |||
|
342 | volatile unsigned char reserved; | |||
|
343 | volatile unsigned char userApplication; | |||
|
344 | // PACKET HEADER | |||
|
345 | volatile unsigned char packetID[2]; | |||
|
346 | volatile unsigned char packetSequenceControl[2]; | |||
|
347 | volatile unsigned char packetLength[2]; | |||
|
348 | // DATA FIELD HEADER | |||
|
349 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
350 | volatile unsigned char serviceType; | |||
|
351 | volatile unsigned char serviceSubType; | |||
|
352 | volatile unsigned char destinationID; | |||
|
353 | volatile unsigned char time[6]; | |||
|
354 | // | |||
|
355 | volatile unsigned char tc_failure_code[2]; | |||
|
356 | volatile unsigned char telecommand_pkt_id[2]; | |||
|
357 | volatile unsigned char pkt_seq_control[2]; | |||
|
358 | volatile unsigned char tc_service; | |||
|
359 | volatile unsigned char tc_subtype; | |||
|
360 | }; | |||
|
361 | typedef struct Packet_TM_LFR_TC_EXE_ERROR_str Packet_TM_LFR_TC_EXE_ERROR_t; | |||
|
362 | ||||
238 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str |
|
363 | struct Packet_TM_LFR_TC_EXE_CORRUPTED_str | |
239 | { |
|
364 | { | |
240 | volatile unsigned char targetLogicalAddress; |
|
365 | volatile unsigned char targetLogicalAddress; |
@@ -11,6 +11,7 | |||||
11 |
|
11 | |||
12 | #include "fsw_params.h" |
|
12 | #include "fsw_params.h" | |
13 | #include "fsw_misc.h" |
|
13 | #include "fsw_misc.h" | |
|
14 | #include "tm_byte_positions.h" | |||
14 | #include "fsw_processing.h" |
|
15 | #include "fsw_processing.h" | |
15 | #include "tc_handler.h" |
|
16 | #include "tc_handler.h" | |
16 | #include "wf_handler.h" |
|
17 | #include "wf_handler.h" |
@@ -1,7 +1,8 | |||||
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED | |
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED |
|
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED | |
3 |
|
3 | |||
4 |
#include |
|
4 | #include "fsw_params_processing.h" | |
|
5 | #include "ccsds_types.h" | |||
5 |
|
6 | |||
6 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
7 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
7 | #define UART_DEVICE_NAME "/dev/console" |
|
8 | #define UART_DEVICE_NAME "/dev/console" | |
@@ -137,7 +138,8 | |||||
137 |
|
138 | |||
138 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
139 | #define ACTION_MSG_QUEUE_COUNT 10 | |
139 | #define ACTION_MSG_PKTS_COUNT 50 |
|
140 | #define ACTION_MSG_PKTS_COUNT 50 | |
140 | #define ACTION_MSG_PKTS_SIZE 24 // hlen *hdr dlen *data sent options |
|
141 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) | |
|
142 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options | |||
141 |
|
143 | |||
142 | #define QUEUE_QUEU 0 |
|
144 | #define QUEUE_QUEU 0 | |
143 | #define QUEUE_PKTS 1 |
|
145 | #define QUEUE_PKTS 1 |
@@ -36,9 +36,6 void updateLFRCurrentMode(); | |||||
36 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV, rtems_id queue_id); |
|
36 | int TC_acceptance(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV, rtems_id queue_id); | |
37 | unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV); |
|
37 | unsigned char TC_parser(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV); | |
38 |
|
38 | |||
39 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, |
|
|||
40 | TMHeader_t *TMHeader, unsigned char tc_sid); |
|
|||
41 |
|
||||
42 | //*********** |
|
39 | //*********** | |
43 | // RTEMS TASK |
|
40 | // RTEMS TASK | |
44 | rtems_task recv_task( rtems_task_argument unused ); |
|
41 | rtems_task recv_task( rtems_task_argument unused ); | |
@@ -76,7 +73,9 int suspend_science_tasks(); | |||||
76 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); |
|
73 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC); | |
77 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); |
|
74 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC); | |
78 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id); |
|
75 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id); | |
|
76 | // | |||
79 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
77 | int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
|
78 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char byte_position, unsigned char rcv_value); | |||
80 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
79 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
81 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
80 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
82 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
81 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
@@ -438,7 +438,8 rtems_status_code create_message_queues( | |||||
438 | rtems_status_code ret; |
|
438 | rtems_status_code ret; | |
439 | rtems_id queue_id; |
|
439 | rtems_id queue_id; | |
440 |
|
440 | |||
441 |
ret = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, |
|
441 | ret = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, | |
|
442 | ACTION_MSG_PKTS_MAX_SIZE, | |||
442 |
|
|
443 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
443 | if (ret != RTEMS_SUCCESSFUL) { |
|
444 | if (ret != RTEMS_SUCCESSFUL) { | |
444 | BOOT_PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", ret) |
|
445 | BOOT_PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", ret) |
@@ -222,7 +222,7 rtems_task hous_task(rtems_task_argument | |||||
222 | update_spacewire_statistics(); |
|
222 | update_spacewire_statistics(); | |
223 |
|
223 | |||
224 | // SEND PACKET |
|
224 | // SEND PACKET | |
225 |
status = rtems_message_queue_send( queue_id, &spw_ioctl_send, ACTION_MSG_ |
|
225 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
226 | if (status != RTEMS_SUCCESSFUL) { |
|
226 | if (status != RTEMS_SUCCESSFUL) { | |
227 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
227 | PRINTF1("in HOUS *** ERR %d\n", status) | |
228 | } |
|
228 | } | |
@@ -239,7 +239,8 rtems_task hous_task(rtems_task_argument | |||||
239 | rtems_task send_task( rtems_task_argument argument) |
|
239 | rtems_task send_task( rtems_task_argument argument) | |
240 | { |
|
240 | { | |
241 | rtems_status_code status; // RTEMS status code |
|
241 | rtems_status_code status; // RTEMS status code | |
242 | spw_ioctl_pkt_send spw_ioctl_send; // incoming spw_ioctl_pkt_send structure |
|
242 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer | |
|
243 | spw_ioctl_pkt_send *spw_ioctl_send; | |||
243 | size_t size; // size of the incoming TC packet |
|
244 | size_t size; // size of the incoming TC packet | |
244 | u_int32_t count; |
|
245 | u_int32_t count; | |
245 | rtems_id queue_id; |
|
246 | rtems_id queue_id; | |
@@ -254,7 +255,7 rtems_task send_task( rtems_task_argumen | |||||
254 |
|
255 | |||
255 | while(1) |
|
256 | while(1) | |
256 | { |
|
257 | { | |
257 |
status = rtems_message_queue_receive( queue_id, |
|
258 | status = rtems_message_queue_receive( queue_id, incomingData, &size, | |
258 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
259 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); | |
259 |
|
260 | |||
260 | if (status!=RTEMS_SUCCESSFUL) |
|
261 | if (status!=RTEMS_SUCCESSFUL) | |
@@ -263,19 +264,30 rtems_task send_task( rtems_task_argumen | |||||
263 | } |
|
264 | } | |
264 | else |
|
265 | else | |
265 | { |
|
266 | { | |
266 | if (spw_ioctl_send.hlen == 0) |
|
267 | if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet | |
267 | { |
|
268 | { | |
268 |
status = write( fdSPW, |
|
269 | status = write( fdSPW, incomingData, size ); | |
269 | if (status == -1){ |
|
270 | if (status == -1){ | |
270 |
PRINTF2("in SEND *** (2.a) ERR = %d, |
|
271 | PRINTF2("in SEND *** (2.a) ERR = %d, size = %d\n", status, size) | |
|
272 | } | |||
|
273 | } | |||
|
274 | else // the incoming message is a spw_ioctl_pkt_send structure | |||
|
275 | { | |||
|
276 | spw_ioctl_send = (spw_ioctl_pkt_send*) incomingData; | |||
|
277 | if (spw_ioctl_send->hlen == 0) | |||
|
278 | { | |||
|
279 | status = write( fdSPW, spw_ioctl_send->data, spw_ioctl_send->dlen ); | |||
|
280 | if (status == -1){ | |||
|
281 | PRINTF2("in SEND *** (2.b) ERR = %d, dlen = %d\n", status, spw_ioctl_send->dlen) | |||
271 | } |
|
282 | } | |
272 | } |
|
283 | } | |
273 | else |
|
284 | else | |
274 | { |
|
285 | { | |
275 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); |
|
286 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, spw_ioctl_send ); | |
276 | if (status == -1){ |
|
287 | if (status == -1){ | |
277 |
PRINTF2("in SEND *** (2. |
|
288 | PRINTF2("in SEND *** (2.c) ERR = %d, dlen = %d\n", status, spw_ioctl_send->dlen) | |
278 |
PRINTF1(" hlen = %d\n", spw_ioctl_send |
|
289 | PRINTF1(" hlen = %d\n", spw_ioctl_send->hlen) | |
|
290 | } | |||
279 | } |
|
291 | } | |
280 | } |
|
292 | } | |
281 | } |
|
293 | } |
@@ -557,7 +557,7 void send_spectral_matrix(Header_TM_LFR_ | |||||
557 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
557 | header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
558 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
558 | header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
559 | // SEND PACKET |
|
559 | // SEND PACKET | |
560 |
status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_ |
|
560 | status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
561 | if (status != RTEMS_SUCCESSFUL) { |
|
561 | if (status != RTEMS_SUCCESSFUL) { | |
562 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); |
|
562 | printf("in send_spectral_matrix *** ERR %d\n", (int) status); | |
563 | } |
|
563 | } |
@@ -302,66 +302,6 unsigned char TC_parser(ccsdsTelecommand | |||||
302 | return ret; |
|
302 | return ret; | |
303 | } |
|
303 | } | |
304 |
|
304 | |||
305 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int packetLength, |
|
|||
306 | TMHeader_t *TMHeader, unsigned char tc_sid) |
|
|||
307 | { |
|
|||
308 | TMHeader->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
|||
309 | TMHeader->protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
|||
310 | TMHeader->reserved = 0x00; |
|
|||
311 | TMHeader->userApplication = 0x00; |
|
|||
312 | TMHeader->packetID[0] = 0x0c; |
|
|||
313 | TMHeader->packetSequenceControl[0] = 0xc0; |
|
|||
314 | TMHeader->packetSequenceControl[1] = 0x00; |
|
|||
315 | TMHeader->packetLength[0] = (unsigned char) (packetLength>>8); |
|
|||
316 | TMHeader->packetLength[1] = (unsigned char) packetLength; |
|
|||
317 | TMHeader->spare1_pusVersion_spare2 = 0x10; |
|
|||
318 | TMHeader->destinationID = TM_DESTINATION_ID_GROUND; // default destination id |
|
|||
319 | switch (tm_type){ |
|
|||
320 | case(TM_LFR_TC_EXE_OK): |
|
|||
321 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_TC_EXE; |
|
|||
322 | TMHeader->serviceType = TM_TYPE_TC_EXE; // type |
|
|||
323 | TMHeader->serviceSubType = TM_SUBTYPE_EXE_OK; // subtype |
|
|||
324 | TMHeader->destinationID = tc_sid; // destination id |
|
|||
325 | break; |
|
|||
326 | case(TM_LFR_TC_EXE_ERR): |
|
|||
327 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_TC_EXE; |
|
|||
328 | TMHeader->serviceType = TM_TYPE_TC_EXE; // type |
|
|||
329 | TMHeader->serviceSubType = TM_SUBTYPE_EXE_NOK; // subtype |
|
|||
330 | TMHeader->destinationID = tc_sid; |
|
|||
331 | break; |
|
|||
332 | case(TM_LFR_HK): |
|
|||
333 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_HK; |
|
|||
334 | TMHeader->serviceType = TM_TYPE_HK; // type |
|
|||
335 | TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype |
|
|||
336 | break; |
|
|||
337 | case(TM_LFR_SCI): |
|
|||
338 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_NORMAL_BURST; |
|
|||
339 | TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type |
|
|||
340 | TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype |
|
|||
341 | break; |
|
|||
342 | case(TM_LFR_SCI_SBM): |
|
|||
343 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_SBM1_SBM2; |
|
|||
344 | TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type |
|
|||
345 | TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype |
|
|||
346 | break; |
|
|||
347 | case(TM_LFR_PAR_DUMP): |
|
|||
348 | TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; |
|
|||
349 | TMHeader->serviceType = TM_TYPE_HK; // type |
|
|||
350 | TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype |
|
|||
351 | break; |
|
|||
352 | default: |
|
|||
353 | return 0; |
|
|||
354 | } |
|
|||
355 | TMHeader->time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
|||
356 | TMHeader->time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
|||
357 | TMHeader->time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
|||
358 | TMHeader->time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
|||
359 | TMHeader->time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
|||
360 | TMHeader->time[5] = (unsigned char) (time_management_regs->fine_time); |
|
|||
361 |
|
||||
362 | return LFR_SUCCESSFUL; |
|
|||
363 | } |
|
|||
364 |
|
||||
365 | //*********** |
|
305 | //*********** | |
366 | // RTEMS TASK |
|
306 | // RTEMS TASK | |
367 | rtems_task recv_task( rtems_task_argument unused ) |
|
307 | rtems_task recv_task( rtems_task_argument unused ) | |
@@ -700,6 +640,15 int action_enter_mode(ccsdsTelecommandPa | |||||
700 |
|
640 | |||
701 | requestedMode = TC->dataAndCRC[1]; |
|
641 | requestedMode = TC->dataAndCRC[1]; | |
702 |
|
642 | |||
|
643 | if ( (requestedMode != LFR_MODE_STANDBY) | |||
|
644 | && (requestedMode != LFR_MODE_NORMAL) && (requestedMode != LFR_MODE_BURST) | |||
|
645 | && (requestedMode != LFR_MODE_SBM1) && (requestedMode != LFR_MODE_SBM2) ) | |||
|
646 | { | |||
|
647 | status = RTEMS_UNSATISFIED; | |||
|
648 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); | |||
|
649 | } | |||
|
650 | else | |||
|
651 | { | |||
703 | printf("try to enter mode %d\n", requestedMode); |
|
652 | printf("try to enter mode %d\n", requestedMode); | |
704 |
|
653 | |||
705 | #ifdef PRINT_TASK_STATISTICS |
|
654 | #ifdef PRINT_TASK_STATISTICS | |
@@ -728,6 +677,7 int action_enter_mode(ccsdsTelecommandPa | |||||
728 | PRINTF("ERR *** in action_enter *** transition rejected\n") |
|
677 | PRINTF("ERR *** in action_enter *** transition rejected\n") | |
729 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
678 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
730 | } |
|
679 | } | |
|
680 | } | |||
731 |
|
681 | |||
732 | return status; |
|
682 | return status; | |
733 | } |
|
683 | } | |
@@ -1180,74 +1130,156 int send_tm_lfr_tc_exe_success(ccsdsTele | |||||
1180 | { |
|
1130 | { | |
1181 | int ret; |
|
1131 | int ret; | |
1182 | rtems_status_code status; |
|
1132 | rtems_status_code status; | |
1183 | TMHeader_t TM_header; |
|
1133 | Packet_TM_LFR_TC_EXE_SUCCESS_t TM; | |
1184 | char data[4]; |
|
1134 | unsigned char messageSize; | |
1185 | spw_ioctl_pkt_send spw_ioctl_send; |
|
|||
1186 |
|
1135 | |||
1187 | ret = LFR_SUCCESSFUL; |
|
1136 | ret = LFR_SUCCESSFUL; | |
1188 |
|
1137 | |||
1189 | TM_build_header( TM_LFR_TC_EXE_OK, PACKET_LENGTH_TC_EXE_SUCCESS, |
|
1138 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1190 | &TM_header, |
|
1139 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1191 | TC->sourceID); // TC source ID |
|
1140 | TM.reserved = DEFAULT_RESERVED; | |
|
1141 | TM.userApplication = CCSDS_USER_APP; | |||
|
1142 | // PACKET HEADER | |||
|
1143 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |||
|
1144 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |||
|
1145 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |||
|
1146 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1147 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); | |||
|
1148 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); | |||
|
1149 | // DATA FIELD HEADER | |||
|
1150 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1151 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1152 | TM.serviceSubType = TM_SUBTYPE_EXE_OK; | |||
|
1153 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1154 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1155 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1156 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1157 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1158 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1159 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1160 | // | |||
|
1161 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1162 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1163 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1164 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
1192 |
|
1165 | |||
1193 | data[0] = TC->packetID[0]; |
|
1166 | messageSize = PACKET_LENGTH_TC_EXE_SUCCESS + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1194 | data[1] = TC->packetID[1]; |
|
|||
1195 | data[2] = TC->packetSequenceControl[0]; |
|
|||
1196 | data[3] = TC->packetSequenceControl[1]; |
|
|||
1197 |
|
||||
1198 | // filling the structure for the spacewire transmission |
|
|||
1199 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
|||
1200 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
|||
1201 | spw_ioctl_send.dlen = 4; |
|
|||
1202 | spw_ioctl_send.data = data; |
|
|||
1203 | spw_ioctl_send.options = 0; |
|
|||
1204 |
|
1167 | |||
1205 | // SEND DATA |
|
1168 | // SEND DATA | |
1206 |
status = rtems_message_queue_urgent( queue_id, & |
|
1169 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |
1207 | if (status != RTEMS_SUCCESSFUL) { |
|
1170 | if (status != RTEMS_SUCCESSFUL) { | |
1208 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
1171 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") | |
1209 | ret = LFR_DEFAULT; |
|
1172 | ret = LFR_DEFAULT; | |
1210 | } |
|
1173 | } | |
1211 |
|
1174 | |||
1212 | return ret; |
|
1175 | return LFR_SUCCESSFUL; | |
|
1176 | } | |||
|
1177 | ||||
|
1178 | int send_tm_lfr_tc_exe_inconsistent(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |||
|
1179 | unsigned char byte_position, unsigned char rcv_value) | |||
|
1180 | { | |||
|
1181 | int ret; | |||
|
1182 | rtems_status_code status; | |||
|
1183 | Packet_TM_LFR_TC_EXE_INCONSISTENT_t TM; | |||
|
1184 | unsigned char messageSize; | |||
|
1185 | ||||
|
1186 | ret = LFR_SUCCESSFUL; | |||
|
1187 | ||||
|
1188 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |||
|
1189 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |||
|
1190 | TM.reserved = DEFAULT_RESERVED; | |||
|
1191 | TM.userApplication = CCSDS_USER_APP; | |||
|
1192 | // PACKET HEADER | |||
|
1193 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |||
|
1194 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |||
|
1195 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |||
|
1196 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1197 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); | |||
|
1198 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); | |||
|
1199 | // DATA FIELD HEADER | |||
|
1200 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1201 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1202 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |||
|
1203 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1204 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1205 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1206 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1207 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1208 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1209 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1210 | // | |||
|
1211 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_INCONSISTENT >> 8); | |||
|
1212 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_INCONSISTENT ); | |||
|
1213 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1214 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1215 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1216 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
|
1217 | TM.tc_service = TC->serviceType; // type of the rejected TC | |||
|
1218 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |||
|
1219 | TM.byte_position = byte_position; | |||
|
1220 | TM.rcv_value = rcv_value; | |||
|
1221 | ||||
|
1222 | messageSize = PACKET_LENGTH_TC_EXE_INCONSISTENT + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |||
|
1223 | ||||
|
1224 | // SEND DATA | |||
|
1225 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |||
|
1226 | if (status != RTEMS_SUCCESSFUL) { | |||
|
1227 | PRINTF("in send_tm_lfr_tc_exe_inconsistent *** ERR\n") | |||
|
1228 | ret = LFR_DEFAULT; | |||
|
1229 | } | |||
|
1230 | ||||
|
1231 | return LFR_SUCCESSFUL; | |||
1213 | } |
|
1232 | } | |
1214 |
|
1233 | |||
1215 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) |
|
1234 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC, rtems_id queue_id) | |
1216 | { |
|
1235 | { | |
1217 | int ret; |
|
1236 | int ret; | |
1218 | rtems_status_code status; |
|
1237 | rtems_status_code status; | |
1219 | TMHeader_t TM_header; |
|
1238 | Packet_TM_LFR_TC_EXE_NOT_EXECUTABLE_t TM; | |
1220 | char data[10]; |
|
1239 | unsigned char messageSize; | |
1221 | spw_ioctl_pkt_send spw_ioctl_send; |
|
|||
1222 |
|
1240 | |||
1223 | ret = LFR_SUCCESSFUL; |
|
1241 | ret = LFR_SUCCESSFUL; | |
1224 |
|
1242 | |||
1225 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE, |
|
1243 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1226 | &TM_header, |
|
1244 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1227 | TC->sourceID); // TC source ID |
|
1245 | TM.reserved = DEFAULT_RESERVED; | |
|
1246 | TM.userApplication = CCSDS_USER_APP; | |||
|
1247 | // PACKET HEADER | |||
|
1248 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |||
|
1249 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |||
|
1250 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |||
|
1251 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1252 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); | |||
|
1253 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); | |||
|
1254 | // DATA FIELD HEADER | |||
|
1255 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1256 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1257 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |||
|
1258 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1259 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1260 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1261 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1262 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1263 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1264 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1265 | // | |||
|
1266 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8); | |||
|
1267 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_EXECUTABLE ); | |||
|
1268 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1269 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1270 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1271 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
|
1272 | TM.tc_service = TC->serviceType; // type of the rejected TC | |||
|
1273 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |||
|
1274 | TM.lfr_status_word[0] = housekeeping_packet.lfr_status_word[0]; | |||
|
1275 | TM.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1]; | |||
1228 |
|
1276 | |||
1229 | data[0] = (char) (FAILURE_CODE_NOT_EXECUTABLE >> 8); |
|
1277 | messageSize = PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1230 | data[1] = (char) FAILURE_CODE_NOT_EXECUTABLE; |
|
|||
1231 | data[2] = TC->packetID[0]; |
|
|||
1232 | data[3] = TC->packetID[1]; |
|
|||
1233 | data[4] = TC->packetSequenceControl[0]; |
|
|||
1234 | data[5] = TC->packetSequenceControl[1]; |
|
|||
1235 | data[6] = TC->serviceType; // type of the rejected TC |
|
|||
1236 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
|||
1237 | data[8] = housekeeping_packet.lfr_status_word[0]; |
|
|||
1238 | data[6] = housekeeping_packet.lfr_status_word[1]; |
|
|||
1239 |
|
||||
1240 | // filling the structure for the spacewire transmission |
|
|||
1241 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
|||
1242 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
|||
1243 | spw_ioctl_send.dlen = 10; |
|
|||
1244 | spw_ioctl_send.data = data; |
|
|||
1245 | spw_ioctl_send.options = 0; |
|
|||
1246 |
|
1278 | |||
1247 | // SEND DATA |
|
1279 | // SEND DATA | |
1248 |
status = rtems_message_queue_urgent( queue_id, & |
|
1280 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |
1249 | if (status != RTEMS_SUCCESSFUL) { |
|
1281 | if (status != RTEMS_SUCCESSFUL) { | |
1250 |
PRINTF("in send_tm_lfr_tc_exe_ |
|
1282 | PRINTF("in send_tm_lfr_tc_exe_not_executable *** ERR\n") | |
1251 | ret = LFR_DEFAULT; |
|
1283 | ret = LFR_DEFAULT; | |
1252 | } |
|
1284 | } | |
1253 |
|
1285 | |||
@@ -1258,34 +1290,47 int send_tm_lfr_tc_exe_not_implemented(c | |||||
1258 | { |
|
1290 | { | |
1259 | int ret; |
|
1291 | int ret; | |
1260 | rtems_status_code status; |
|
1292 | rtems_status_code status; | |
1261 | TMHeader_t TM_header; |
|
1293 | Packet_TM_LFR_TC_EXE_NOT_IMPLEMENTED_t TM; | |
1262 | char data[8]; |
|
1294 | unsigned char messageSize; | |
1263 | spw_ioctl_pkt_send spw_ioctl_send; |
|
|||
1264 |
|
1295 | |||
1265 | ret = LFR_SUCCESSFUL; |
|
1296 | ret = LFR_SUCCESSFUL; | |
1266 |
|
1297 | |||
1267 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED, |
|
1298 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1268 | &TM_header, |
|
1299 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1269 | TC->sourceID); // TC source ID |
|
1300 | TM.reserved = DEFAULT_RESERVED; | |
|
1301 | TM.userApplication = CCSDS_USER_APP; | |||
|
1302 | // PACKET HEADER | |||
|
1303 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |||
|
1304 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |||
|
1305 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |||
|
1306 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1307 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); | |||
|
1308 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); | |||
|
1309 | // DATA FIELD HEADER | |||
|
1310 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1311 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1312 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |||
|
1313 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1314 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1315 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1316 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1317 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1318 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1319 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1320 | // | |||
|
1321 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8); | |||
|
1322 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_NOT_IMPLEMENTED ); | |||
|
1323 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1324 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1325 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1326 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
|
1327 | TM.tc_service = TC->serviceType; // type of the rejected TC | |||
|
1328 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |||
1270 |
|
1329 | |||
1271 | data[0] = (char) (FAILURE_CODE_NOT_IMPLEMENTED >> 8); |
|
1330 | messageSize = PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1272 | data[1] = (char) FAILURE_CODE_NOT_IMPLEMENTED; |
|
|||
1273 | data[2] = TC->packetID[0]; |
|
|||
1274 | data[3] = TC->packetID[1]; |
|
|||
1275 | data[4] = TC->packetSequenceControl[0]; |
|
|||
1276 | data[5] = TC->packetSequenceControl[1]; |
|
|||
1277 | data[6] = TC->serviceType; // type of the rejected TC |
|
|||
1278 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
|||
1279 |
|
||||
1280 | // filling the structure for the spacewire transmission |
|
|||
1281 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
|||
1282 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
|||
1283 | spw_ioctl_send.dlen = 8; |
|
|||
1284 | spw_ioctl_send.data = data; |
|
|||
1285 | spw_ioctl_send.options = 0; |
|
|||
1286 |
|
1331 | |||
1287 | // SEND DATA |
|
1332 | // SEND DATA | |
1288 |
status = rtems_message_queue_urgent( queue_id, & |
|
1333 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |
1289 | if (status != RTEMS_SUCCESSFUL) { |
|
1334 | if (status != RTEMS_SUCCESSFUL) { | |
1290 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") |
|
1335 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") | |
1291 | ret = LFR_DEFAULT; |
|
1336 | ret = LFR_DEFAULT; | |
@@ -1298,32 +1343,47 int send_tm_lfr_tc_exe_error(ccsdsTeleco | |||||
1298 | { |
|
1343 | { | |
1299 | int ret; |
|
1344 | int ret; | |
1300 | rtems_status_code status; |
|
1345 | rtems_status_code status; | |
1301 | TMHeader_t TM_header; |
|
1346 | Packet_TM_LFR_TC_EXE_ERROR_t TM; | |
1302 | char data[8]; |
|
1347 | unsigned char messageSize; | |
1303 | spw_ioctl_pkt_send spw_ioctl_send; |
|
|||
1304 |
|
1348 | |||
1305 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_ERROR, |
|
1349 | ret = LFR_SUCCESSFUL; | |
1306 | &TM_header, |
|
|||
1307 | TC->sourceID); // TC source ID |
|
|||
1308 |
|
1350 | |||
1309 | data[0] = (char) (FAILURE_CODE_ERROR >> 8); |
|
1351 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
1310 | data[1] = (char) FAILURE_CODE_ERROR; |
|
1352 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
1311 | data[2] = TC->packetID[0]; |
|
1353 | TM.reserved = DEFAULT_RESERVED; | |
1312 | data[3] = TC->packetID[1]; |
|
1354 | TM.userApplication = CCSDS_USER_APP; | |
1313 | data[4] = TC->packetSequenceControl[0]; |
|
1355 | // PACKET HEADER | |
1314 | data[5] = TC->packetSequenceControl[1]; |
|
1356 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); | |
1315 | data[6] = TC->serviceType; // type of the rejected TC |
|
1357 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); | |
1316 | data[7] = TC->serviceSubType; // subtype of the rejected TC |
|
1358 | TM.packetSequenceControl[0] = (TM_PACKET_SEQ_CTRL_STANDALONE >> 8); | |
|
1359 | TM.packetSequenceControl[1] = (TM_PACKET_SEQ_CTRL_STANDALONE ); | |||
|
1360 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); | |||
|
1361 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); | |||
|
1362 | // DATA FIELD HEADER | |||
|
1363 | TM.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |||
|
1364 | TM.serviceType = TM_TYPE_TC_EXE; | |||
|
1365 | TM.serviceSubType = TM_SUBTYPE_EXE_NOK; | |||
|
1366 | TM.destinationID = TM_DESTINATION_ID_GROUND; // default destination id | |||
|
1367 | TM.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
1368 | TM.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
1369 | TM.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
1370 | TM.time[3] = (unsigned char) (time_management_regs->coarse_time); | |||
|
1371 | TM.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
1372 | TM.time[5] = (unsigned char) (time_management_regs->fine_time); | |||
|
1373 | // | |||
|
1374 | TM.tc_failure_code[0] = (char) (FAILURE_CODE_ERROR >> 8); | |||
|
1375 | TM.tc_failure_code[1] = (char) (FAILURE_CODE_ERROR ); | |||
|
1376 | TM.telecommand_pkt_id[0] = TC->packetID[0]; | |||
|
1377 | TM.telecommand_pkt_id[1] = TC->packetID[1]; | |||
|
1378 | TM.pkt_seq_control[0] = TC->packetSequenceControl[0]; | |||
|
1379 | TM.pkt_seq_control[1] = TC->packetSequenceControl[1]; | |||
|
1380 | TM.tc_service = TC->serviceType; // type of the rejected TC | |||
|
1381 | TM.tc_subtype = TC->serviceSubType; // subtype of the rejected TC | |||
1317 |
|
1382 | |||
1318 | // filling the structure for the spacewire transmission |
|
1383 | messageSize = PACKET_LENGTH_TC_EXE_ERROR + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
1319 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header |
|
|||
1320 | spw_ioctl_send.hdr = (char*) &TM_header; |
|
|||
1321 | spw_ioctl_send.dlen = 8; |
|
|||
1322 | spw_ioctl_send.data = data; |
|
|||
1323 | spw_ioctl_send.options = 0; |
|
|||
1324 |
|
1384 | |||
1325 | // SEND DATA |
|
1385 | // SEND DATA | |
1326 |
status = rtems_message_queue_urgent( queue_id, & |
|
1386 | status = rtems_message_queue_urgent( queue_id, &TM, messageSize); | |
1327 | if (status != RTEMS_SUCCESSFUL) { |
|
1387 | if (status != RTEMS_SUCCESSFUL) { | |
1328 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") |
|
1388 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") | |
1329 | ret = LFR_DEFAULT; |
|
1389 | ret = LFR_DEFAULT; |
@@ -315,6 +315,7 rtems_task cwf2_task(rtems_task_argument | |||||
315 | // wait for an RTEMS_EVENT |
|
315 | // wait for an RTEMS_EVENT | |
316 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, |
|
316 | rtems_event_receive( RTEMS_EVENT_MODE_BURST | RTEMS_EVENT_MODE_SBM2, | |
317 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
317 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
|
318 | ||||
318 | if (event_out == RTEMS_EVENT_MODE_BURST) |
|
319 | if (event_out == RTEMS_EVENT_MODE_BURST) | |
319 | { |
|
320 | { | |
320 | // F2 |
|
321 | // F2 | |
@@ -328,6 +329,7 rtems_task cwf2_task(rtems_task_argument | |||||
328 | } |
|
329 | } | |
329 | #endif |
|
330 | #endif | |
330 | } |
|
331 | } | |
|
332 | ||||
331 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
333 | else if (event_out == RTEMS_EVENT_MODE_SBM2) | |
332 | { |
|
334 | { | |
333 | #ifdef GSA |
|
335 | #ifdef GSA | |
@@ -494,7 +496,7 int init_header_continuous_wf_table( uns | |||||
494 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
496 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
495 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
497 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
496 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
498 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
497 | if (SID_SBM1_CWF_F1 || SID_SBM2_CWF_F2) |
|
499 | if ( (sid == SID_SBM1_CWF_F1) || (sid == SID_SBM2_CWF_F2) ) | |
498 | { |
|
500 | { | |
499 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); |
|
501 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); | |
500 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); |
|
502 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); | |
@@ -617,7 +619,7 int send_waveform_SWF( volatile int *wav | |||||
617 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
619 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
618 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); |
|
620 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
619 | // SEND PACKET |
|
621 | // SEND PACKET | |
620 |
status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_ |
|
622 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); | |
621 | if (status != RTEMS_SUCCESSFUL) { |
|
623 | if (status != RTEMS_SUCCESSFUL) { | |
622 | printf("%d-%d, ERR %d\n", sid, i, (int) status); |
|
624 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
623 | ret = LFR_DEFAULT; |
|
625 | ret = LFR_DEFAULT; |
General Comments 0
You need to be logged in to leave comments.
Login now