@@ -1,6 +1,6 | |||
|
1 | 1 | ############################################################################# |
|
2 | 2 | # Makefile for building: bin/fsw |
|
3 |
# Generated by qmake (2.01a) (Qt 4.8.5) on: |
|
|
3 | # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Oct 24 15:59:05 2013 | |
|
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=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=16 -DPRINT_MESSAGES_ON_CONSOLE | |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=16 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS | |
|
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 |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -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 *** gsa |
|
4 | CONFIG += console verbose | |
|
4 | CONFIG += console verbose cpu_usage_report | |
|
5 | 5 | CONFIG -= qt |
|
6 | 6 | |
|
7 | 7 | include(./sparc.pri) |
@@ -1,6 +1,6 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 2.8.0, 2013-10- |
|
|
3 | <!-- Written by QtCreator 2.8.0, 2013-10-24T06:53:47. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -119,6 +119,20 | |||
|
119 | 119 | #define FAIL_DETECTED 42003 // 0xa4 0x13 |
|
120 | 120 | #define CORRUPTED 42005 // 0xa4 0x15 |
|
121 | 121 | |
|
122 | #define SID_TC_DEFAULT 0 // the default SID for TC sent to the LFR | |
|
123 | #define SID_TC_GROUND 0 | |
|
124 | #define SID_TC_MISSION_TIMELINE 110 | |
|
125 | #define SID_TC_TC_SEQUENCES 111 | |
|
126 | #define SID_TC_RECOVERY_ACTION_CMD 112 | |
|
127 | #define SID_TC_BACKUP_MISSION_TIMELINE 113 | |
|
128 | #define SID_TC_DIRECT_CMD 120 | |
|
129 | #define SID_TC_SPARE_GRD_SRC1 121 | |
|
130 | #define SID_TC_SPARE_GRD_SRC2 122 | |
|
131 | #define SID_TC_OBCP 15 | |
|
132 | #define SID_TC_SYSTEM_CONTROL 14 | |
|
133 | #define SID_TC_AOCS 11 | |
|
134 | #define SID_TC_RPW_INTERNAL 254 | |
|
135 | ||
|
122 | 136 | // TM SID |
|
123 | 137 | #define SID_HK 1 |
|
124 | 138 | #define SID_PARAMETER_DUMP 10 |
@@ -30,14 +30,13 extern unsigned short sequenceCounters[S | |||
|
30 | 30 | rtems_task Init( rtems_task_argument argument); |
|
31 | 31 | |
|
32 | 32 | // OTHER functions |
|
33 |
|
|
|
33 | void create_names( void ); | |
|
34 | rtems_status_code create_message_queues( void ); | |
|
34 | 35 | int create_all_tasks( void ); |
|
35 | 36 | int start_all_tasks( void ); |
|
36 | rtems_status_code create_message_queues( void ); | |
|
37 | int start_recv_send_tasks( void ); | |
|
37 | 38 | // |
|
38 | void init_parameter_dump( void ); | |
|
39 | 39 | void init_local_mode_parameters( void ); |
|
40 | void init_housekeeping_parameters( void ); | |
|
41 | 40 | |
|
42 | 41 | extern int rtems_cpu_usage_report( void ); |
|
43 | 42 | extern int rtems_cpu_usage_reset( void ); |
@@ -8,7 +8,7 | |||
|
8 | 8 | #include "fsw_params.h" |
|
9 | 9 | #include "fsw_spacewire.h" |
|
10 | 10 | |
|
11 |
rtems_name |
|
|
11 | rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic | |
|
12 | 12 | rtems_id HK_id; // id of the HK rate monotonic period |
|
13 | 13 | |
|
14 | 14 | extern rtems_name misc_name[5]; |
@@ -30,4 +30,6 rtems_task stat_task( rtems_task_argumen | |||
|
30 | 30 | rtems_task hous_task( rtems_task_argument argument ); |
|
31 | 31 | rtems_task dumb_task( rtems_task_argument unused ); |
|
32 | 32 | |
|
33 | void init_housekeeping_parameters( void ); | |
|
34 | ||
|
33 | 35 | #endif // FSW_MISC_H_INCLUDED |
@@ -35,11 +35,11 | |||
|
35 | 35 | #define DEFAULT_SY_LFR_COMMON0 0x00 |
|
36 | 36 | #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0 |
|
37 | 37 | // NORM |
|
38 |
#define |
|
|
39 |
#define |
|
|
40 |
#define |
|
|
41 |
#define |
|
|
42 |
#define |
|
|
38 | #define SY_LFR_N_SWF_L 2048 // nb sample | |
|
39 | #define SY_LFR_N_SWF_P 300 // sec | |
|
40 | #define SY_LFR_N_ASM_P 3600 // sec | |
|
41 | #define SY_LFR_N_BP_P0 4 // sec | |
|
42 | #define SY_LFR_N_BP_P1 20 // sec | |
|
43 | 43 | #define MIN_DELTA_SNAPSHOT 16 // sec |
|
44 | 44 | // BURST |
|
45 | 45 | #define DEFAULT_SY_LFR_B_BP_P0 1 // sec |
@@ -52,8 +52,13 | |||
|
52 | 52 | #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec |
|
53 | 53 | // ADDITIONAL PARAMETERS |
|
54 | 54 | #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms |
|
55 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
|
55 | #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s | |
|
56 | // STATUS WORD | |
|
57 | #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits | |
|
58 | #define DEFAULT_STATUS_WORD_BYTE1 0x00 | |
|
56 | 59 | // |
|
60 | #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s | |
|
61 | #define SY_LFR_DPU_CONNECT_ATTEMPT 3 | |
|
57 | 62 | //**************************** |
|
58 | 63 | |
|
59 | 64 | //***************************** |
@@ -117,11 +122,13 | |||
|
117 | 122 | #define TASKID_CWF2 13 |
|
118 | 123 | #define TASKID_CWF1 14 |
|
119 | 124 | #define TASKID_SEND 15 |
|
125 | #define TASKID_WTDG 16 | |
|
120 | 126 | |
|
121 | 127 | #define TASK_PRIORITY_SPIQ 5 |
|
122 | 128 | #define TASK_PRIORITY_SMIQ 10 |
|
123 | 129 | // |
|
124 |
#define TASK_PRIORITY_ |
|
|
130 | #define TASK_PRIORITY_WTDG 20 | |
|
131 | // | |
|
125 | 132 | #define TASK_PRIORITY_ACTN 30 |
|
126 | 133 | // |
|
127 | 134 | #define TASK_PRIORITY_HOUS 40 |
@@ -129,8 +136,9 | |||
|
129 | 136 | #define TASK_PRIORITY_CWF2 40 |
|
130 | 137 | #define TASK_PRIORITY_WFRM 40 |
|
131 | 138 | #define TASK_PRIORITY_CWF3 40 |
|
139 | #define TASK_PRIORITY_SEND 40 | |
|
132 | 140 | // |
|
133 | #define TASK_PRIORITY_SEND 40 | |
|
141 | #define TASK_PRIORITY_RECV 50 // this priority prevents the blocking of of other tasks in case of link deconnexion | |
|
134 | 142 | // |
|
135 | 143 | #define TASK_PRIORITY_AVF0 60 |
|
136 | 144 | #define TASK_PRIORITY_BPF0 60 |
@@ -140,7 +148,7 | |||
|
140 | 148 | |
|
141 | 149 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
142 | 150 | #define ACTION_MSG_PKTS_COUNT 50 |
|
143 |
#define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_ |
|
|
151 | #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES) | |
|
144 | 152 | #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options |
|
145 | 153 | |
|
146 | 154 | #define QUEUE_RECV 0 |
@@ -3,8 +3,10 | |||
|
3 | 3 | |
|
4 | 4 | #define NB_BINS_PER_SM 128 |
|
5 | 5 | #define NB_VALUES_PER_SM 25 |
|
6 | #define TOTAL_SIZE_SM (NB_BINS_PER_SM * NB_VALUES_PER_SM) | |
|
7 | #define SM_HEADER 4 | |
|
6 | //#define TOTAL_SIZE_SM (NB_BINS_PER_SM * NB_VALUES_PER_SM) | |
|
7 | //#define SM_HEADER 4 | |
|
8 | #define TOTAL_SIZE_SM 0 | |
|
9 | #define SM_HEADER 0 | |
|
8 | 10 | |
|
9 | 11 | #define NB_BINS_COMPRESSED_SM_F0 11 |
|
10 | 12 | #define NB_BINS_COMPRESSED_SM_F1 13 |
@@ -21,15 +21,19 extern rtems_id Task_id[20]; | |||
|
21 | 21 | rtems_task spiq_task( rtems_task_argument argument ); |
|
22 | 22 | rtems_task recv_task( rtems_task_argument unused ); |
|
23 | 23 | rtems_task send_task( rtems_task_argument argument ); |
|
24 | rtems_task wtdg_task( rtems_task_argument argument ); | |
|
24 | 25 | |
|
25 |
int spacewire_ |
|
|
26 |
int spacewire_ |
|
|
26 | int spacewire_open_link( void ); | |
|
27 | int spacewire_start_link( int fd ); | |
|
28 | int spacewire_configure_link(int fd ); | |
|
29 | int spacewire_reset_link( void ); | |
|
27 | 30 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ); // No Port force |
|
28 | 31 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ); // RMAP Enable |
|
29 | 32 | void spacewire_compute_stats_offsets( void ); |
|
30 | 33 | void spacewire_update_statistics( void ); |
|
31 | 34 | |
|
32 | 35 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); |
|
36 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ); | |
|
33 | 37 | |
|
34 | 38 | void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc ); |
|
35 | 39 |
@@ -15,6 +15,7 void GetCRCAsTwoBytes(unsigned char* dat | |||
|
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 | 17 | int tc_check_subtype( unsigned char packetType ); |
|
18 | int tc_check_sid( unsigned char sid ); | |
|
18 | 19 | int tc_check_length( unsigned char packetType, unsigned int length ); |
|
19 | 20 | int tc_check_crc(ccsdsTelecommandPacket_t * TCPacket, unsigned int length , unsigned char *computed_CRC); |
|
20 | 21 |
@@ -26,4 +26,6 int set_sy_lfr_n_asm_p( ccsdsTelecommand | |||
|
26 | 26 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
27 | 27 | int set_sy_lfr_n_bp_p1( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
28 | 28 | |
|
29 | void init_parameter_dump( void ); | |
|
30 | ||
|
29 | 31 | #endif // TC_LOAD_DUMP_PARAMETERS_H |
@@ -31,7 +31,9 extern Packet_TM_LFR_PARAMETER_DUMP_t pa | |||
|
31 | 31 | extern struct param_local_str param_local; |
|
32 | 32 | |
|
33 | 33 | extern rtems_name misc_name[5]; |
|
34 | extern rtems_name Task_name[20]; /* array of task ids */ | |
|
34 | 35 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
36 | ||
|
35 | 37 | extern unsigned char lfrCurrentMode; |
|
36 | 38 | |
|
37 | 39 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
@@ -72,6 +72,7 rtems_task Init( rtems_task_argument ign | |||
|
72 | 72 | |
|
73 | 73 | |
|
74 | 74 | rtems_status_code status; |
|
75 | rtems_status_code status_spw; | |
|
75 | 76 | rtems_isr_entry old_isr_handler; |
|
76 | 77 | |
|
77 | 78 | BOOT_PRINTF("\n\n\n\n\n") |
@@ -87,32 +88,67 rtems_task Init( rtems_task_argument ign | |||
|
87 | 88 | init_local_mode_parameters(); |
|
88 | 89 | init_housekeeping_parameters(); |
|
89 | 90 | |
|
90 | create_names(); // create all names | |
|
91 | create_names(); // create all names | |
|
92 | status = create_message_queues(); // create message queues | |
|
93 | if (status != RTEMS_SUCCESSFUL) | |
|
94 | { | |
|
95 | PRINTF1("in INIT *** ERR in create_message_queues, code %d", status) | |
|
96 | } | |
|
91 | 97 | |
|
92 | create_message_queues(); | |
|
93 | ||
|
94 | status = create_all_tasks(); // create all tasks | |
|
98 | status = create_all_tasks(); // create all tasks | |
|
95 | 99 | if (status != RTEMS_SUCCESSFUL) |
|
96 | 100 | { |
|
97 | 101 | PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status) |
|
98 | 102 | } |
|
99 | 103 | |
|
104 | // ************************** | |
|
105 | // <SPACEWIRE INITIALIZATION> | |
|
106 | grspw_timecode_callback = &timecode_irq_handler; | |
|
107 | ||
|
108 | status_spw = spacewire_open_link(); // (1) open the link | |
|
109 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
|
110 | { | |
|
111 | PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw ) | |
|
112 | } | |
|
113 | ||
|
114 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | |
|
115 | { | |
|
116 | status_spw = spacewire_configure_link( fdSPW ); | |
|
117 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
|
118 | { | |
|
119 | PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw ) | |
|
120 | } | |
|
121 | } | |
|
122 | ||
|
123 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | |
|
124 | { | |
|
125 | status_spw = spacewire_start_link( fdSPW ); | |
|
126 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
|
127 | { | |
|
128 | PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw ) | |
|
129 | } | |
|
130 | } | |
|
131 | // </SPACEWIRE INITIALIZATION> | |
|
132 | // *************************** | |
|
133 | ||
|
100 | 134 | status = start_all_tasks(); // start all tasks |
|
101 | 135 | if (status != RTEMS_SUCCESSFUL) |
|
102 | 136 | { |
|
103 | 137 | PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status) |
|
104 | 138 | } |
|
105 | 139 | |
|
140 | status = start_recv_send_tasks(); | |
|
141 | if ( status != RTEMS_SUCCESSFUL ) | |
|
142 | { | |
|
143 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
|
144 | } | |
|
145 | ||
|
106 | 146 | status = stop_current_mode(); // go in STANDBY mode |
|
107 | 147 | if (status != RTEMS_SUCCESSFUL) |
|
108 | 148 | { |
|
109 | 149 | PRINTF1("in INIT *** ERR in stop_current_mode, code %d", status) |
|
110 | 150 | } |
|
111 | 151 | |
|
112 | grspw_timecode_callback = &timecode_irq_handler; | |
|
113 | ||
|
114 | spacewire_configure_link(); | |
|
115 | ||
|
116 | 152 | #ifdef GSA |
|
117 | 153 | // mask IRQ lines |
|
118 | 154 | LEON_Mask_interrupt( IRQ_SM ); |
@@ -143,79 +179,30 rtems_task Init( rtems_task_argument ign | |||
|
143 | 179 | IRQ_SPARC_SM, spectral_matrices_isr_simu ); |
|
144 | 180 | #endif |
|
145 | 181 | |
|
182 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
|
183 | { | |
|
184 | status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT ); | |
|
185 | if ( status != RTEMS_SUCCESSFUL ) { | |
|
186 | PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status ) | |
|
187 | } | |
|
188 | } | |
|
189 | ||
|
146 | 190 | BOOT_PRINTF("delete INIT\n") |
|
147 | 191 | |
|
148 | 192 | status = rtems_task_delete(RTEMS_SELF); |
|
149 | 193 | |
|
150 | 194 | } |
|
151 | 195 | |
|
152 | void init_parameter_dump( void ) | |
|
153 | { | |
|
154 | /** This function initialize the parameter_dump_packet global variable with default values. | |
|
155 | * | |
|
156 | */ | |
|
157 | ||
|
158 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
|
159 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
|
160 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
|
161 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
|
162 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); | |
|
163 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; | |
|
164 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
165 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
166 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); | |
|
167 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; | |
|
168 | // DATA FIELD HEADER | |
|
169 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; | |
|
170 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; | |
|
171 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; | |
|
172 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
|
173 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
174 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
175 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
176 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
177 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
178 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
179 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; | |
|
180 | ||
|
181 | //****************** | |
|
182 | // COMMON PARAMETERS | |
|
183 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; | |
|
184 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; | |
|
185 | ||
|
186 | //****************** | |
|
187 | // NORMAL PARAMETERS | |
|
188 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L >> 8); | |
|
189 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_L ); | |
|
190 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P >> 8); | |
|
191 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_SWF_P ); | |
|
192 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P >> 8); | |
|
193 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (DEFAULT_SY_LFR_N_ASM_P ); | |
|
194 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) DEFAULT_SY_LFR_N_BP_P0; | |
|
195 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) DEFAULT_SY_LFR_N_BP_P1; | |
|
196 | ||
|
197 | //***************** | |
|
198 | // BURST PARAMETERS | |
|
199 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; | |
|
200 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; | |
|
201 | ||
|
202 | //**************** | |
|
203 | // SBM1 PARAMETERS | |
|
204 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period | |
|
205 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; | |
|
206 | ||
|
207 | //**************** | |
|
208 | // SBM2 PARAMETERS | |
|
209 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; | |
|
210 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; | |
|
211 | } | |
|
212 | ||
|
213 | 196 | void init_local_mode_parameters( void ) |
|
214 | 197 | { |
|
215 | 198 | /** This function initialize the param_local global variable with default values. |
|
216 | 199 | * |
|
217 | 200 | */ |
|
218 | 201 | |
|
202 | unsigned int i; | |
|
203 | unsigned int j; | |
|
204 | unsigned int k; | |
|
205 | ||
|
219 | 206 | // LOCAL PARAMETERS |
|
220 | 207 | set_local_sbm1_nb_cwf_max(); |
|
221 | 208 | set_local_sbm2_nb_cwf_max(); |
@@ -227,32 +214,7 void init_local_mode_parameters( void ) | |||
|
227 | 214 | |
|
228 | 215 | reset_local_sbm1_nb_cwf_sent(); |
|
229 | 216 | reset_local_sbm2_nb_cwf_sent(); |
|
230 | } | |
|
231 | 217 | |
|
232 | void init_housekeeping_parameters( void ) | |
|
233 | { | |
|
234 | /** This function initialize the housekeeping_packet global variable with default values. | |
|
235 | * | |
|
236 | */ | |
|
237 | ||
|
238 | unsigned int i = 0; | |
|
239 | unsigned int j = 0; | |
|
240 | unsigned int k = 0; | |
|
241 | char *parameters; | |
|
242 | ||
|
243 | parameters = (char*) &housekeeping_packet.lfr_status_word; | |
|
244 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
|
245 | { | |
|
246 | parameters[i] = 0x00; | |
|
247 | } | |
|
248 | // init status word | |
|
249 | housekeeping_packet.lfr_status_word[0] = 0x00; | |
|
250 | housekeeping_packet.lfr_status_word[1] = 0x00; | |
|
251 | // init software version | |
|
252 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
|
253 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
|
254 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
|
255 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
|
256 | 218 | // init sequence counters |
|
257 | 219 | for (i = 0; i<SEQ_CNT_NB_PID; i++) |
|
258 | 220 | { |
@@ -264,10 +226,9 void init_housekeeping_parameters( void | |||
|
264 | 226 | } |
|
265 | 227 | } |
|
266 | 228 | } |
|
267 | updateLFRCurrentMode(); | |
|
268 | 229 | } |
|
269 | 230 | |
|
270 |
|
|
|
231 | void create_names( void ) // create all names for tasks and queues | |
|
271 | 232 | { |
|
272 | 233 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
273 | 234 | * |
@@ -292,14 +253,13 int create_names( void ) // create all n | |||
|
292 | 253 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
293 | 254 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
294 | 255 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
295 | ||
|
296 | // rate monotonic period name | |
|
297 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
|
256 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); | |
|
298 | 257 | |
|
299 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', 'U', 'E', 'U' ); | |
|
300 |
|
|
|
258 | // rate monotonic period names | |
|
259 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
|
301 | 260 | |
|
302 | return RTEMS_SUCCESSFUL; | |
|
261 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
|
262 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
|
303 | 263 | } |
|
304 | 264 | |
|
305 | 265 | int create_all_tasks( void ) // create all tasks which run in the software |
@@ -439,11 +399,39 int create_all_tasks( void ) // create a | |||
|
439 | 399 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND] |
|
440 | 400 | ); |
|
441 | 401 | } |
|
402 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
|
403 | { | |
|
404 | status = rtems_task_create( | |
|
405 | Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE, | |
|
406 | RTEMS_DEFAULT_MODES, | |
|
407 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] | |
|
408 | ); | |
|
409 | } | |
|
442 | 410 | |
|
443 | 411 | return status; |
|
444 | 412 | } |
|
445 | 413 | |
|
446 |
int start_ |
|
|
414 | int start_recv_send_tasks( void ) | |
|
415 | { | |
|
416 | rtems_status_code status; | |
|
417 | ||
|
418 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
|
419 | if (status!=RTEMS_SUCCESSFUL) { | |
|
420 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
|
421 | } | |
|
422 | ||
|
423 | if (status == RTEMS_SUCCESSFUL) // SEND | |
|
424 | { | |
|
425 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
|
426 | if (status!=RTEMS_SUCCESSFUL) { | |
|
427 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
|
428 | } | |
|
429 | } | |
|
430 | ||
|
431 | return status; | |
|
432 | } | |
|
433 | ||
|
434 | int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS | |
|
447 | 435 | { |
|
448 | 436 | /** This function starts all RTEMS tasks used in the software. |
|
449 | 437 | * |
@@ -464,6 +452,14 int start_all_tasks( void ) | |||
|
464 | 452 | BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n") |
|
465 | 453 | } |
|
466 | 454 | |
|
455 | if (status == RTEMS_SUCCESSFUL) // WTDG | |
|
456 | { | |
|
457 | status = rtems_task_start( Task_id[TASKID_WTDG], wtdg_task, 1 ); | |
|
458 | if (status!=RTEMS_SUCCESSFUL) { | |
|
459 | BOOT_PRINTF("in INIT *** Error starting TASK_WTDG\n") | |
|
460 | } | |
|
461 | } | |
|
462 | ||
|
467 | 463 | if (status == RTEMS_SUCCESSFUL) // SMIQ |
|
468 | 464 | { |
|
469 | 465 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); |
@@ -472,22 +468,6 int start_all_tasks( void ) | |||
|
472 | 468 | } |
|
473 | 469 | } |
|
474 | 470 | |
|
475 | if (status == RTEMS_SUCCESSFUL) // RECV | |
|
476 | { | |
|
477 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
|
478 | if (status!=RTEMS_SUCCESSFUL) { | |
|
479 | BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n") | |
|
480 | } | |
|
481 | } | |
|
482 | ||
|
483 | if (status == RTEMS_SUCCESSFUL) // SEND | |
|
484 | { | |
|
485 | status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 ); | |
|
486 | if (status!=RTEMS_SUCCESSFUL) { | |
|
487 | BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n") | |
|
488 | } | |
|
489 | } | |
|
490 | ||
|
491 | 471 | if (status == RTEMS_SUCCESSFUL) // ACTN |
|
492 | 472 | { |
|
493 | 473 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); |
@@ -575,31 +555,41 int start_all_tasks( void ) | |||
|
575 | 555 | BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n") |
|
576 | 556 | } |
|
577 | 557 | } |
|
578 | ||
|
579 | 558 | return status; |
|
580 | 559 | } |
|
581 | 560 | |
|
582 | 561 | rtems_status_code create_message_queues( void ) // create the two message queues used in the software |
|
583 | 562 | { |
|
584 | rtems_status_code status; | |
|
563 | rtems_status_code status_recv; | |
|
564 | rtems_status_code status_send; | |
|
585 | 565 | rtems_status_code ret; |
|
586 | 566 | rtems_id queue_id; |
|
587 | 567 | |
|
588 | 568 | // create the queue for handling valid TCs |
|
589 |
status = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
|
569 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], | |
|
570 | ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, | |
|
590 | 571 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
591 | if (status != RTEMS_SUCCESSFUL) { | |
|
592 | ret = status; | |
|
593 | BOOT_PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", ret) | |
|
572 | if ( status_recv != RTEMS_SUCCESSFUL ) { | |
|
573 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) | |
|
594 | 574 | } |
|
595 | 575 | |
|
596 | 576 | // create the queue for handling TM packet sending |
|
597 |
|
|
|
598 | ACTION_MSG_PKTS_MAX_SIZE, | |
|
577 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], | |
|
578 | ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_MAX_SIZE, | |
|
599 | 579 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
600 |
if ( |
|
|
601 |
|
|
|
580 | if ( status_send != RTEMS_SUCCESSFUL ) { | |
|
581 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) | |
|
582 | } | |
|
583 | ||
|
584 | if ( status_recv != RTEMS_SUCCESSFUL ) | |
|
585 | { | |
|
586 | ret = status_recv; | |
|
587 | } | |
|
588 | else | |
|
589 | { | |
|
590 | ret = status_send; | |
|
602 | 591 | } |
|
603 | 592 | |
|
604 | 593 | return ret; |
|
605 | 594 | } |
|
595 |
@@ -156,15 +156,8 rtems_task stat_task(rtems_task_argument | |||
|
156 | 156 | rtems_task hous_task(rtems_task_argument argument) |
|
157 | 157 | { |
|
158 | 158 | rtems_status_code status; |
|
159 | spw_ioctl_pkt_send spw_ioctl_send; | |
|
160 | 159 | rtems_id queue_id; |
|
161 | 160 | |
|
162 | spw_ioctl_send.hlen = 0; | |
|
163 | spw_ioctl_send.hdr = NULL; | |
|
164 | spw_ioctl_send.dlen = PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES; | |
|
165 | spw_ioctl_send.data = (char*) &housekeeping_packet; | |
|
166 | spw_ioctl_send.options = 0; | |
|
167 | ||
|
168 | 161 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); |
|
169 | 162 | if (status != RTEMS_SUCCESSFUL) |
|
170 | 163 | { |
@@ -173,8 +166,8 rtems_task hous_task(rtems_task_argument | |||
|
173 | 166 | |
|
174 | 167 | BOOT_PRINTF("in HOUS ***\n") |
|
175 | 168 | |
|
176 |
if (rtems_rate_monotonic_ident( |
|
|
177 |
status = rtems_rate_monotonic_create( |
|
|
169 | if (rtems_rate_monotonic_ident( name_hk_rate_monotonic, &HK_id) != RTEMS_SUCCESSFUL) { | |
|
170 | status = rtems_rate_monotonic_create( name_hk_rate_monotonic, &HK_id ); | |
|
178 | 171 | if( status != RTEMS_SUCCESSFUL ) { |
|
179 | 172 | PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status ) |
|
180 | 173 | } |
@@ -220,7 +213,8 rtems_task hous_task(rtems_task_argument | |||
|
220 | 213 | spacewire_update_statistics(); |
|
221 | 214 | |
|
222 | 215 | // SEND PACKET |
|
223 |
status = rtems_message_queue_send( queue_id, & |
|
|
216 | status = rtems_message_queue_send( queue_id, &housekeeping_packet, | |
|
217 | PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); | |
|
224 | 218 | if (status != RTEMS_SUCCESSFUL) { |
|
225 | 219 | PRINTF1("in HOUS *** ERR %d\n", status) |
|
226 | 220 | } |
@@ -268,7 +262,32 rtems_task dumb_task( rtems_task_argumen | |||
|
268 | 262 | } |
|
269 | 263 | } |
|
270 | 264 | |
|
265 | //***************************** | |
|
266 | // init housekeeping parameters | |
|
271 | 267 | |
|
268 | void init_housekeeping_parameters( void ) | |
|
269 | { | |
|
270 | /** This function initialize the housekeeping_packet global variable with default values. | |
|
271 | * | |
|
272 | */ | |
|
273 | ||
|
274 | unsigned int i = 0; | |
|
275 | char *parameters; | |
|
272 | 276 | |
|
277 | parameters = (char*) &housekeeping_packet.lfr_status_word; | |
|
278 | for(i = 0; i< SIZE_HK_PARAMETERS; i++) | |
|
279 | { | |
|
280 | parameters[i] = 0x00; | |
|
281 | } | |
|
282 | // init status word | |
|
283 | housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0; | |
|
284 | housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1; | |
|
285 | // init software version | |
|
286 | housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1; | |
|
287 | housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2; | |
|
288 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; | |
|
289 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; | |
|
273 | 290 | |
|
291 | updateLFRCurrentMode(); | |
|
292 | } | |
|
274 | 293 |
@@ -25,7 +25,7 char *lstates[6] = {"Error-reset", | |||
|
25 | 25 | // RTEMS TASK |
|
26 | 26 | rtems_task spiq_task(rtems_task_argument unused) |
|
27 | 27 | { |
|
28 |
/** This RTEMS task is |
|
|
28 | /** This RTEMS task is awaken by an rtems_event sent by the interruption subroutine of the SpaceWire driver. | |
|
29 | 29 | * |
|
30 | 30 | * @param unused is the starting argument of the RTEMS task |
|
31 | 31 | * |
@@ -33,45 +33,58 rtems_task spiq_task(rtems_task_argument | |||
|
33 | 33 | |
|
34 | 34 | rtems_event_set event_out; |
|
35 | 35 | rtems_status_code status; |
|
36 | unsigned char lfrMode; | |
|
36 | int linkStatus; | |
|
37 | ||
|
38 | BOOT_PRINTF("in SPIQ *** \n") | |
|
37 | 39 | |
|
38 | 40 | while(true){ |
|
39 | BOOT_PRINTF("in SPIQ *** Waiting for SPW_LINKERR_EVENT\n") | |
|
40 | 41 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
41 | 42 | |
|
42 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; // get the current mode | |
|
43 | ||
|
44 | status = spacewire_wait_for_link(); | |
|
45 | ||
|
46 | if (status != RTEMS_SUCCESSFUL) | |
|
47 | { | |
|
48 | //**************** | |
|
49 | // STOP THE SYSTEM | |
|
50 | spacewire_compute_stats_offsets(); | |
|
51 | stop_current_mode(); | |
|
52 | if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) { // suspend RECV task | |
|
53 | PRINTF("in SPIQ *** Error suspending RECV Task\n") | |
|
54 | } | |
|
55 | if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) { // suspend HOUS task | |
|
56 | PRINTF("in SPIQ *** Error suspending HOUS Task\n") | |
|
57 | } | |
|
43 | // CHECK THE LINK | |
|
44 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (1) | |
|
45 | if ( linkStatus != 5) { | |
|
46 | rtems_task_suspend( Task_id[ TASKID_RECV ] ); | |
|
47 | rtems_task_suspend( Task_id[ TASKID_SEND ] ); | |
|
48 | PRINTF1("in SPIQ *** linkStatus %d, wait...\n", linkStatus) | |
|
49 | rtems_task_wake_after( SY_LFR_DPU_CONNECT_TIMEOUT ); // wait SY_LFR_DPU_CONNECT_TIMEOUT 1000 ms | |
|
50 | } | |
|
58 | 51 | |
|
59 | //*************************** | |
|
60 | // RESTART THE SPACEWIRE LINK | |
|
61 | spacewire_configure_link(); | |
|
52 | // RECHECK THE LINK AFTER SY_LFR_DPU_CONNECT_TIMEOUT | |
|
53 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status (2) | |
|
54 | if ( linkStatus != 5 ) // not in run state, reset the link | |
|
55 | { | |
|
56 | spacewire_compute_stats_offsets(); | |
|
57 | status = spacewire_reset_link( ); | |
|
58 | } | |
|
59 | else | |
|
60 | { // in run state, restart the link | |
|
61 | status = spacewire_start_link( fdSPW ); // restart the link | |
|
62 | if ( status != RTEMS_SUCCESSFUL) | |
|
63 | { | |
|
64 | PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status) | |
|
65 | } | |
|
66 | } | |
|
62 | 67 | |
|
63 | //******************* | |
|
64 | // RESTART THE SYSTEM | |
|
65 | //ioctl(fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS); // clear statistics | |
|
66 | status = rtems_task_restart( Task_id[TASKID_HOUS], 1 ); | |
|
67 | if (status != RTEMS_SUCCESSFUL) { | |
|
68 | PRINTF1("in SPIQ *** Error restarting HOUS Task *** code %d\n", status) | |
|
68 | if ( status == RTEMS_SUCCESSFUL ) // the link is in run state and has been started successfully | |
|
69 | { | |
|
70 | status = rtems_task_resume( Task_id[ TASKID_SEND ] ); | |
|
71 | if ( status != RTEMS_SUCCESSFUL ) { | |
|
72 | PRINTF("in SPIQ *** ERR resuming SEND Task\n") | |
|
73 | } | |
|
74 | status = rtems_task_resume( Task_id[ TASKID_RECV ] ); | |
|
75 | if ( status != RTEMS_SUCCESSFUL ) { | |
|
76 | PRINTF("in SPIQ *** ERR resuming RECV Task\n") | |
|
69 | 77 | } |
|
70 | status = rtems_task_restart(Task_id[TASKID_RECV], 1); | |
|
71 | if ( status != RTEMS_SUCCESSFUL) { | |
|
72 | PRINTF("in SPIQ *** Error restarting RECV Task\n") | |
|
78 | } | |
|
79 | else // if the link is not up after SY_LFR_DPU_CONNECT_ATTEMPT tries, go in STANDBY mode | |
|
80 | { | |
|
81 | status = enter_mode( LFR_MODE_STANDBY, NULL ); // enter the STANDBY mode | |
|
82 | if ( status != RTEMS_SUCCESSFUL ) { | |
|
83 | PRINTF1("in SPIQ *** ERR enter_mode *** code %d\n", status) | |
|
73 | 84 | } |
|
74 | enter_mode(lfrMode, NULL); // enter the mode that was running before the SpaceWire interruption | |
|
85 | // wake the WTDG task | |
|
86 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); | |
|
87 | rtems_task_suspend( RTEMS_SELF ); | |
|
75 | 88 | } |
|
76 | 89 | } |
|
77 | 90 | } |
@@ -117,13 +130,13 rtems_task recv_task( rtems_task_argumen | |||
|
117 | 130 | |
|
118 | 131 | while(1) |
|
119 | 132 | { |
|
120 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking | |
|
133 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking | |
|
121 | 134 | if (len == -1){ // error during the read call |
|
122 |
PRINTF(" |
|
|
135 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) | |
|
123 | 136 | } |
|
124 | 137 | else { |
|
125 | 138 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
126 |
PRINTF(" |
|
|
139 | PRINTF("in RECV *** packet lenght too short\n") | |
|
127 | 140 | } |
|
128 | 141 | else { |
|
129 | 142 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
@@ -229,9 +242,80 rtems_task send_task( rtems_task_argumen | |||
|
229 | 242 | } |
|
230 | 243 | } |
|
231 | 244 | |
|
245 | rtems_task wtdg_task( rtems_task_argument argument ) | |
|
246 | { | |
|
247 | rtems_event_set event_out; | |
|
248 | rtems_status_code status; | |
|
249 | int linkStatus; | |
|
250 | ||
|
251 | BOOT_PRINTF("in WTDG ***\n") | |
|
252 | ||
|
253 | while(1){ | |
|
254 | // wait for an RTEMS_EVENT | |
|
255 | rtems_event_receive( RTEMS_EVENT_0, | |
|
256 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
|
257 | PRINTF("in WTDG *** wait for the link\n") | |
|
258 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
|
259 | while( linkStatus != 5) // wait for the link | |
|
260 | { | |
|
261 | rtems_task_wake_after( 10 ); | |
|
262 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
|
263 | } | |
|
264 | ||
|
265 | // if START is not called, subsequent call to read and write will fail | |
|
266 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is in run state | |
|
267 | if ( status == RTEMS_SUCCESSFUL ) | |
|
268 | { | |
|
269 | PRINTF("in WTDG *** link started\n") | |
|
270 | } | |
|
271 | else | |
|
272 | { | |
|
273 | PRINTF1("in WTDG *** ERR start, code %d\n", status) | |
|
274 | } | |
|
275 | ||
|
276 | rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); | |
|
277 | ||
|
278 | rtems_task_resume( Task_id[TASKID_RECV] ); | |
|
279 | ||
|
280 | rtems_task_resume( Task_id[TASKID_SEND] ); | |
|
281 | } | |
|
282 | } | |
|
283 | ||
|
232 | 284 | //**************** |
|
233 | 285 | // OTHER FUNCTIONS |
|
234 |
int spacewire_ |
|
|
286 | int spacewire_open_link( void ) | |
|
287 | { | |
|
288 | /** This function opens the SpaceWire link. | |
|
289 | * | |
|
290 | * @return a valid file descriptor in case of success, -1 in case of a failure | |
|
291 | * | |
|
292 | */ | |
|
293 | rtems_status_code status; | |
|
294 | ||
|
295 | close( fdSPW ); // close the device if it is already open | |
|
296 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware | |
|
297 | if ( fdSPW < 0 ) { | |
|
298 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) | |
|
299 | } | |
|
300 | else | |
|
301 | { | |
|
302 | status = RTEMS_SUCCESSFUL; | |
|
303 | } | |
|
304 | ||
|
305 | return status; | |
|
306 | } | |
|
307 | ||
|
308 | int spacewire_start_link( int fd ) | |
|
309 | { | |
|
310 | rtems_status_code status; | |
|
311 | ||
|
312 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is in run state | |
|
313 | // -1 default hardcoded driver timeout | |
|
314 | ||
|
315 | return status; | |
|
316 | } | |
|
317 | ||
|
318 | int spacewire_configure_link( int fd ) | |
|
235 | 319 | { |
|
236 | 320 | /** This function configures the SpaceWire link. |
|
237 | 321 | * |
@@ -247,58 +331,36 int spacewire_configure_link( void ) | |||
|
247 | 331 | |
|
248 | 332 | rtems_status_code status; |
|
249 | 333 | |
|
250 | close(fdSPW); // close the device if it is already open | |
|
251 | BOOT_PRINTF("OK *** in configure_spw_link *** try to open "GRSPW_DEVICE_NAME"\n") | |
|
252 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware | |
|
253 | if ( fdSPW<0 ) { | |
|
254 | PRINTF1("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME" with ERR %d\n", errno) | |
|
255 | } | |
|
256 | ||
|
257 | while(ioctl(fdSPW, SPACEWIRE_IOCTRL_START, -1) != RTEMS_SUCCESSFUL){ | |
|
258 | PRINTF(".") | |
|
259 | fflush( stdout ); | |
|
260 | close( fdSPW ); // close the device | |
|
261 | fdSPW = open( GRSPW_DEVICE_NAME, O_RDWR ); // open the device. the open call reset the hardware | |
|
262 | if (fdSPW<0) { | |
|
263 | PRINTF1("ERR *** in configure_spw_link *** Error opening"GRSPW_DEVICE_NAME" with ERR %d\n", errno) | |
|
264 | } | |
|
265 | rtems_task_wake_after(100); | |
|
266 | } | |
|
267 | ||
|
268 | BOOT_PRINTF("OK *** In configure_spw_link *** "GRSPW_DEVICE_NAME" opened and started successfully\n") | |
|
269 | ||
|
270 | 334 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
271 | 335 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
272 | 336 | |
|
273 |
status = ioctl(fd |
|
|
337 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception | |
|
274 | 338 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
275 | 339 | // |
|
276 |
status = ioctl(fd |
|
|
340 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a | |
|
277 | 341 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
278 | 342 | // |
|
279 |
status = ioctl(fd |
|
|
343 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts | |
|
280 | 344 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
281 | 345 | // |
|
282 |
status = ioctl(fd |
|
|
346 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit | |
|
283 | 347 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
284 | 348 | // |
|
285 |
status = ioctl(fd |
|
|
349 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks | |
|
286 | 350 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
287 | 351 | // |
|
288 |
status = ioctl(fd |
|
|
352 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 0); // transmission blocks on full | |
|
289 | 353 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
290 | 354 | // |
|
291 |
status = ioctl(fd |
|
|
355 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] | |
|
292 | 356 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL,\n") |
|
293 | 357 | |
|
294 | BOOT_PRINTF("OK *** in configure_spw_link *** "GRSPW_DEVICE_NAME" configured successfully\n") | |
|
295 | ||
|
296 | return RTEMS_SUCCESSFUL; | |
|
358 | return status; | |
|
297 | 359 | } |
|
298 | 360 | |
|
299 |
int spacewire_ |
|
|
361 | int spacewire_reset_link( void ) | |
|
300 | 362 | { |
|
301 |
/** This function is executed when an interruption |
|
|
363 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. | |
|
302 | 364 | * |
|
303 | 365 | * @return RTEMS directive status code: |
|
304 | 366 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
@@ -306,24 +368,43 int spacewire_wait_for_link( void ) | |||
|
306 | 368 | * |
|
307 | 369 | */ |
|
308 | 370 | |
|
309 | unsigned int i; | |
|
310 |
int |
|
|
311 | rtems_status_code status = RTEMS_UNSATISFIED; | |
|
371 | rtems_status_code status_spw; | |
|
372 | int i; | |
|
373 | ||
|
374 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) | |
|
375 | { | |
|
376 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); | |
|
377 | status_spw = spacewire_open_link(); // (1) open the link | |
|
378 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
|
379 | { | |
|
380 | PRINTF1("in spacewire_reset_link *** ERR spacewire_open_link code %d\n", status_spw) | |
|
381 | } | |
|
312 | 382 | |
|
313 | for(i = 0; i< 10; i++){ | |
|
314 | PRINTF(".") | |
|
315 | fflush( stdout ); | |
|
316 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
|
317 | PRINTF1("in spacewire_wait_for_link *** link status is: %s\n", lstates[linkStatus]) | |
|
318 | if ( linkStatus == 5) { | |
|
319 | PRINTF("in spacewire_wait_for_link *** link is running\n") | |
|
320 | status = RTEMS_SUCCESSFUL; | |
|
383 | if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link | |
|
384 | { | |
|
385 | status_spw = spacewire_configure_link( fdSPW ); | |
|
386 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
|
387 | { | |
|
388 | PRINTF1("in spacewire_reset_link *** ERR spacewire_configure_link code %d\n", status_spw) | |
|
389 | } | |
|
390 | } | |
|
391 | ||
|
392 | if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link | |
|
393 | { | |
|
394 | status_spw = spacewire_start_link( fdSPW ); | |
|
395 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
|
396 | { | |
|
397 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) | |
|
398 | } | |
|
399 | } | |
|
400 | ||
|
401 | if ( status_spw == RTEMS_SUCCESSFUL) | |
|
402 | { | |
|
321 | 403 | break; |
|
322 | 404 | } |
|
323 | rtems_task_wake_after(100); | |
|
324 | 405 | } |
|
325 | 406 | |
|
326 | return status; | |
|
407 | return status_spw; | |
|
327 | 408 | } |
|
328 | 409 | |
|
329 | 410 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
@@ -484,3 +565,16 void timecode_irq_handler( void *pDev, v | |||
|
484 | 565 | // printf("In timecode_irq_handler *** Error sending event to DUMB\n"); |
|
485 | 566 | //} |
|
486 | 567 | } |
|
568 | ||
|
569 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) | |
|
570 | { | |
|
571 | int linkStatus; | |
|
572 | rtems_status_code status; | |
|
573 | ||
|
574 | ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status | |
|
575 | ||
|
576 | if ( linkStatus == 5) { | |
|
577 | PRINTF("in spacewire_reset_link *** link is running\n") | |
|
578 | status = RTEMS_SUCCESSFUL; | |
|
579 | } | |
|
580 | } |
@@ -98,6 +98,7 int tc_parser(ccsdsTelecommandPacket_t * | |||
|
98 | 98 | * |
|
99 | 99 | * @param TC points to the TeleCommand that will be parsed. |
|
100 | 100 | * @param TC_LEN_RCV is the received packet length. |
|
101 | * | |
|
101 | 102 | * @return Status code of the parsing. |
|
102 | 103 | * |
|
103 | 104 | * The parsing checks: |
@@ -116,6 +117,7 int tc_parser(ccsdsTelecommandPacket_t * | |||
|
116 | 117 | unsigned int length; |
|
117 | 118 | unsigned char packetType; |
|
118 | 119 | unsigned char packetSubtype; |
|
120 | unsigned char sid; | |
|
119 | 121 | |
|
120 | 122 | status = CCSDS_TM_VALID; |
|
121 | 123 | |
@@ -125,6 +127,7 int tc_parser(ccsdsTelecommandPacket_t * | |||
|
125 | 127 | length = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; |
|
126 | 128 | packetType = TCPacket->serviceType; |
|
127 | 129 | packetSubtype = TCPacket->serviceSubType; |
|
130 | sid = TCPacket->sourceID; | |
|
128 | 131 | |
|
129 | 132 | if ( pid != CCSDS_PROCESS_ID ) // CHECK THE PROCESS ID |
|
130 | 133 | { |
@@ -157,6 +160,10 int tc_parser(ccsdsTelecommandPacket_t * | |||
|
157 | 160 | { |
|
158 | 161 | status = tc_check_subtype( packetSubtype ); |
|
159 | 162 | } |
|
163 | if (status == CCSDS_TM_VALID) // CHECK THE SID | |
|
164 | { | |
|
165 | status = tc_check_sid( sid ); | |
|
166 | } | |
|
160 | 167 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE |
|
161 | 168 | { |
|
162 | 169 | status = tc_check_length( packetSubtype, length ); |
@@ -174,6 +181,7 int tc_check_type( unsigned char packetT | |||
|
174 | 181 | /** This function checks that the type of a TeleCommand is valid. |
|
175 | 182 | * |
|
176 | 183 | * @param packetType is the type to check. |
|
184 | * | |
|
177 | 185 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
178 | 186 | * |
|
179 | 187 | */ |
@@ -197,6 +205,7 int tc_check_subtype( unsigned char pack | |||
|
197 | 205 | /** This function checks that the subtype of a TeleCommand is valid. |
|
198 | 206 | * |
|
199 | 207 | * @param packetSubType is the subtype to check. |
|
208 | * | |
|
200 | 209 | * @return Status code CCSDS_TM_VALID or ILL_SUBTYPE. |
|
201 | 210 | * |
|
202 | 211 | */ |
@@ -222,12 +231,42 int tc_check_subtype( unsigned char pack | |||
|
222 | 231 | return status; |
|
223 | 232 | } |
|
224 | 233 | |
|
234 | int tc_check_sid( unsigned char sid ) | |
|
235 | { | |
|
236 | /** This function checks that the sid of a TeleCommand is valid. | |
|
237 | * | |
|
238 | * @param sid is the sid to check. | |
|
239 | * | |
|
240 | * @return Status code CCSDS_TM_VALID or CORRUPTED. | |
|
241 | * | |
|
242 | */ | |
|
243 | ||
|
244 | int status; | |
|
245 | ||
|
246 | if ( (sid == SID_TC_GROUND) | |
|
247 | || (sid == SID_TC_MISSION_TIMELINE) || (sid == SID_TC_TC_SEQUENCES) || (sid == SID_TC_RECOVERY_ACTION_CMD) | |
|
248 | || (sid == SID_TC_BACKUP_MISSION_TIMELINE) | |
|
249 | || (sid == SID_TC_DIRECT_CMD) || (sid == SID_TC_SPARE_GRD_SRC1) || (sid == SID_TC_SPARE_GRD_SRC2) | |
|
250 | || (sid == SID_TC_OBCP) || (sid == SID_TC_SYSTEM_CONTROL) || (sid == SID_TC_AOCS) | |
|
251 | || (sid == SID_TC_RPW_INTERNAL)) | |
|
252 | { | |
|
253 | status = CCSDS_TM_VALID; | |
|
254 | } | |
|
255 | else | |
|
256 | { | |
|
257 | status = CORRUPTED; | |
|
258 | } | |
|
259 | ||
|
260 | return status; | |
|
261 | } | |
|
262 | ||
|
225 | 263 | int tc_check_length( unsigned char packetSubType, unsigned int length ) |
|
226 | 264 | { |
|
227 | 265 | /** This function checks that the subtype and the length are compliant. |
|
228 | 266 | * |
|
229 | 267 | * @param packetSubType is the subtype to check. |
|
230 | 268 | * @param length is the length to check. |
|
269 | * | |
|
231 | 270 | * @return Status code CCSDS_TM_VALID or ILL_TYPE. |
|
232 | 271 | * |
|
233 | 272 | */ |
@@ -348,6 +387,7 int tc_check_crc( ccsdsTelecommandPacket | |||
|
348 | 387 | * |
|
349 | 388 | * @param TCPacket points to the TeleCommand packet to check. |
|
350 | 389 | * @param length is the length of the TC packet. |
|
390 | * | |
|
351 | 391 | * @return Status code CCSDS_TM_VALID or INCOR_CHECKSUM. |
|
352 | 392 | * |
|
353 | 393 | */ |
@@ -207,27 +207,22 int action_update_info(ccsdsTelecommandP | |||
|
207 | 207 | * @param TC points to the TeleCommand packet that is being processed |
|
208 | 208 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
209 | 209 | * |
|
210 | * @return LFR directive status code: | |
|
211 | * - LFR_DEFAULT | |
|
212 | * - LFR_SUCCESSFUL | |
|
213 | * | |
|
210 | 214 | */ |
|
211 | 215 | |
|
212 | 216 | unsigned int val; |
|
213 | 217 | int result; |
|
214 | unsigned char lfrMode; | |
|
215 | 218 | |
|
216 | 219 | result = LFR_DEFAULT; |
|
217 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
|
218 | 220 | |
|
219 | if ( (lfrMode == LFR_MODE_STANDBY) ) { | |
|
220 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id ); | |
|
221 | result = LFR_DEFAULT; | |
|
222 | } | |
|
223 | else { | |
|
224 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
|
225 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
|
226 | val++; | |
|
227 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
|
228 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
|
229 | result = LFR_SUCCESSFUL; | |
|
230 | } | |
|
221 | val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256 | |
|
222 | + housekeeping_packet.hk_lfr_update_info_tc_cnt[1]; | |
|
223 | val++; | |
|
224 | housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8); | |
|
225 | housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val); | |
|
231 | 226 | |
|
232 | 227 | return result; |
|
233 | 228 | } |
@@ -291,6 +286,8 int action_update_time(ccsdsTelecommandP | |||
|
291 | 286 | * @param TC points to the TeleCommand packet that is being processed |
|
292 | 287 | * @param queue_id is the id of the queue which handles TM transmission by the SpaceWire driver |
|
293 | 288 | * |
|
289 | * @return LFR_SUCCESSFUL | |
|
290 | * | |
|
294 | 291 | */ |
|
295 | 292 | |
|
296 | 293 | unsigned int val; |
@@ -729,7 +726,10 void close_action(ccsdsTelecommandPacket | |||
|
729 | 726 | unsigned int val = 0; |
|
730 | 727 | if (result == LFR_SUCCESSFUL) |
|
731 | 728 | { |
|
732 |
if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
|
729 | if ( !( (TC->serviceType==TC_TYPE_TIME) && (TC->serviceSubType==TC_SUBTYPE_UPDT_TIME) ) | |
|
730 | && | |
|
731 | !( (TC->serviceType==TC_TYPE_GEN) && (TC->serviceSubType==TC_SUBTYPE_UPDT_INFO)) | |
|
732 | ) | |
|
733 | 733 | { |
|
734 | 734 | send_tm_lfr_tc_exe_success( TC, queue_id ); |
|
735 | 735 | } |
@@ -72,7 +72,7 int action_load_normal_par(ccsdsTelecomm | |||
|
72 | 72 | } |
|
73 | 73 | |
|
74 | 74 | //*************** |
|
75 | // sy_lfr_n_asm_p | |
|
75 | // SY_LFR_N_ASM_P | |
|
76 | 76 | if (flag == LFR_SUCCESSFUL) |
|
77 | 77 | { |
|
78 | 78 | result = set_sy_lfr_n_asm_p( TC, queue_id ); |
@@ -83,7 +83,7 int action_load_normal_par(ccsdsTelecomm | |||
|
83 | 83 | } |
|
84 | 84 | |
|
85 | 85 | //*************** |
|
86 | // sy_lfr_n_bp_p0 | |
|
86 | // SY_LFR_N_BP_P0 | |
|
87 | 87 | if (flag == LFR_SUCCESSFUL) |
|
88 | 88 | { |
|
89 | 89 | result = set_sy_lfr_n_bp_p0( TC, queue_id ); |
@@ -211,6 +211,13 int action_dump_par( rtems_id queue_id ) | |||
|
211 | 211 | |
|
212 | 212 | int status; |
|
213 | 213 | |
|
214 | // UPDATE TIME | |
|
215 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
216 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
217 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
218 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
219 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
220 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
214 | 221 | // SEND DATA |
|
215 | 222 | status = rtems_message_queue_send( queue_id, ¶meter_dump_packet, |
|
216 | 223 | PACKET_LENGTH_PARAMETER_DUMP + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES); |
@@ -303,7 +310,7 int set_sy_lfr_n_swf_p( ccsdsTelecommand | |||
|
303 | 310 | |
|
304 | 311 | int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
305 | 312 | { |
|
306 |
/** This function sets the time between two full spectral matrices transmission, in s ( |
|
|
313 | /** This function sets the time between two full spectral matrices transmission, in s (SY_LFR_N_ASM_P). | |
|
307 | 314 | * |
|
308 | 315 | * @param TC points to the TeleCommand packet that is being processed |
|
309 | 316 | * @param queue_id is the id of the queue which handles TM related to this execution step |
@@ -326,7 +333,7 int set_sy_lfr_n_asm_p( ccsdsTelecommand | |||
|
326 | 333 | |
|
327 | 334 | int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) |
|
328 | 335 | { |
|
329 |
/** This function sets the time between two basic parameter sets, in s ( |
|
|
336 | /** This function sets the time between two basic parameter sets, in s (SY_LFR_N_BP_P0). | |
|
330 | 337 | * |
|
331 | 338 | * @param TC points to the TeleCommand packet that is being processed |
|
332 | 339 | * @param queue_id is the id of the queue which handles TM related to this execution step |
@@ -369,6 +376,69 int set_sy_lfr_n_bp_p1(ccsdsTelecommandP | |||
|
369 | 376 | //********************* |
|
370 | 377 | // SBM2 MODE PARAMETERS |
|
371 | 378 | |
|
379 | //********** | |
|
380 | // init dump | |
|
381 | ||
|
382 | void init_parameter_dump( void ) | |
|
383 | { | |
|
384 | /** This function initialize the parameter_dump_packet global variable with default values. | |
|
385 | * | |
|
386 | */ | |
|
387 | ||
|
388 | parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID; | |
|
389 | parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
|
390 | parameter_dump_packet.reserved = CCSDS_RESERVED; | |
|
391 | parameter_dump_packet.userApplication = CCSDS_USER_APP; | |
|
392 | parameter_dump_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_PARAMETER_DUMP >> 8); | |
|
393 | parameter_dump_packet.packetID[1] = (unsigned char) TM_PACKET_ID_PARAMETER_DUMP; | |
|
394 | parameter_dump_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
395 | parameter_dump_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
396 | parameter_dump_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_PARAMETER_DUMP >> 8); | |
|
397 | parameter_dump_packet.packetLength[1] = (unsigned char) PACKET_LENGTH_PARAMETER_DUMP; | |
|
398 | // DATA FIELD HEADER | |
|
399 | parameter_dump_packet.spare1_pusVersion_spare2 = SPARE1_PUSVERSION_SPARE2; | |
|
400 | parameter_dump_packet.serviceType = TM_TYPE_PARAMETER_DUMP; | |
|
401 | parameter_dump_packet.serviceSubType = TM_SUBTYPE_PARAMETER_DUMP; | |
|
402 | parameter_dump_packet.destinationID = TM_DESTINATION_ID_GROUND; | |
|
403 | parameter_dump_packet.time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
404 | parameter_dump_packet.time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
405 | parameter_dump_packet.time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
406 | parameter_dump_packet.time[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
407 | parameter_dump_packet.time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
408 | parameter_dump_packet.time[5] = (unsigned char) (time_management_regs->fine_time); | |
|
409 | parameter_dump_packet.sid = SID_PARAMETER_DUMP; | |
|
410 | ||
|
411 | //****************** | |
|
412 | // COMMON PARAMETERS | |
|
413 | parameter_dump_packet.unused0 = DEFAULT_SY_LFR_COMMON0; | |
|
414 | parameter_dump_packet.bw_sp0_sp1_r0_r1 = DEFAULT_SY_LFR_COMMON1; | |
|
415 | ||
|
416 | //****************** | |
|
417 | // NORMAL PARAMETERS | |
|
418 | parameter_dump_packet.sy_lfr_n_swf_l[0] = (unsigned char) (SY_LFR_N_SWF_L >> 8); | |
|
419 | parameter_dump_packet.sy_lfr_n_swf_l[1] = (unsigned char) (SY_LFR_N_SWF_L ); | |
|
420 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (SY_LFR_N_SWF_P >> 8); | |
|
421 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (SY_LFR_N_SWF_P ); | |
|
422 | parameter_dump_packet.sy_lfr_n_asm_p[0] = (unsigned char) (SY_LFR_N_ASM_P >> 8); | |
|
423 | parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P ); | |
|
424 | parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0; | |
|
425 | parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1; | |
|
426 | ||
|
427 | //***************** | |
|
428 | // BURST PARAMETERS | |
|
429 | parameter_dump_packet.sy_lfr_b_bp_p0 = (unsigned char) DEFAULT_SY_LFR_B_BP_P0; | |
|
430 | parameter_dump_packet.sy_lfr_b_bp_p1 = (unsigned char) DEFAULT_SY_LFR_B_BP_P1; | |
|
431 | ||
|
432 | //**************** | |
|
433 | // SBM1 PARAMETERS | |
|
434 | parameter_dump_packet.sy_lfr_s1_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P0; // min value is 0.25 s for the period | |
|
435 | parameter_dump_packet.sy_lfr_s1_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S1_BP_P1; | |
|
436 | ||
|
437 | //**************** | |
|
438 | // SBM2 PARAMETERS | |
|
439 | parameter_dump_packet.sy_lfr_s2_bp_p0 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P0; | |
|
440 | parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1; | |
|
441 | } | |
|
372 | 442 | |
|
373 | 443 | |
|
374 | 444 | |
@@ -376,5 +446,3 int set_sy_lfr_n_bp_p1(ccsdsTelecommandP | |||
|
376 | 446 | |
|
377 | 447 | |
|
378 | 448 | |
|
379 | ||
|
380 |
@@ -28,7 +28,7 int send_tm_lfr_tc_exe_success( ccsdsTel | |||
|
28 | 28 | * - RTEMS_INVALID_SIZE - invalid message size |
|
29 | 29 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
30 | 30 | * - RTEMS_UNSATISFIED - out of message buffers |
|
31 |
* - RTEMS_TOO_MANY - queue |
|
|
31 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
|
32 | 32 | * |
|
33 | 33 | */ |
|
34 | 34 | |
@@ -43,8 +43,8 int send_tm_lfr_tc_exe_success( ccsdsTel | |||
|
43 | 43 | // PACKET HEADER |
|
44 | 44 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
45 | 45 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
46 |
TM.packetSequenceControl[0] = |
|
|
47 |
TM.packetSequenceControl[1] = |
|
|
46 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
47 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
48 | 48 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS >> 8); |
|
49 | 49 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_SUCCESS ); |
|
50 | 50 | // DATA FIELD HEADER |
@@ -91,7 +91,7 int send_tm_lfr_tc_exe_inconsistent( ccs | |||
|
91 | 91 | * - RTEMS_INVALID_SIZE - invalid message size |
|
92 | 92 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
93 | 93 | * - RTEMS_UNSATISFIED - out of message buffers |
|
94 |
* - RTEMS_TOO_MANY - queue |
|
|
94 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
|
95 | 95 | * |
|
96 | 96 | */ |
|
97 | 97 | |
@@ -106,8 +106,8 int send_tm_lfr_tc_exe_inconsistent( ccs | |||
|
106 | 106 | // PACKET HEADER |
|
107 | 107 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
108 | 108 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
109 |
TM.packetSequenceControl[0] = |
|
|
110 |
TM.packetSequenceControl[1] = |
|
|
109 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
110 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
111 | 111 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT >> 8); |
|
112 | 112 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_INCONSISTENT ); |
|
113 | 113 | // DATA FIELD HEADER |
@@ -157,7 +157,7 int send_tm_lfr_tc_exe_not_executable( c | |||
|
157 | 157 | * - RTEMS_INVALID_SIZE - invalid message size |
|
158 | 158 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
159 | 159 | * - RTEMS_UNSATISFIED - out of message buffers |
|
160 |
* - RTEMS_TOO_MANY - queue |
|
|
160 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
|
161 | 161 | * |
|
162 | 162 | */ |
|
163 | 163 | |
@@ -172,8 +172,8 int send_tm_lfr_tc_exe_not_executable( c | |||
|
172 | 172 | // PACKET HEADER |
|
173 | 173 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
174 | 174 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
175 |
TM.packetSequenceControl[0] = |
|
|
176 |
TM.packetSequenceControl[1] = |
|
|
175 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
176 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
177 | 177 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE >> 8); |
|
178 | 178 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE ); |
|
179 | 179 | // DATA FIELD HEADER |
@@ -223,7 +223,7 int send_tm_lfr_tc_exe_not_implemented( | |||
|
223 | 223 | * - RTEMS_INVALID_SIZE - invalid message size |
|
224 | 224 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
225 | 225 | * - RTEMS_UNSATISFIED - out of message buffers |
|
226 |
* - RTEMS_TOO_MANY - queue |
|
|
226 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
|
227 | 227 | * |
|
228 | 228 | */ |
|
229 | 229 | |
@@ -238,8 +238,8 int send_tm_lfr_tc_exe_not_implemented( | |||
|
238 | 238 | // PACKET HEADER |
|
239 | 239 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
240 | 240 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
241 |
TM.packetSequenceControl[0] = |
|
|
242 |
TM.packetSequenceControl[1] = |
|
|
241 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
242 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
243 | 243 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED >> 8); |
|
244 | 244 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED ); |
|
245 | 245 | // DATA FIELD HEADER |
@@ -287,7 +287,7 int send_tm_lfr_tc_exe_error( ccsdsTelec | |||
|
287 | 287 | * - RTEMS_INVALID_SIZE - invalid message size |
|
288 | 288 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
289 | 289 | * - RTEMS_UNSATISFIED - out of message buffers |
|
290 |
* - RTEMS_TOO_MANY - queue |
|
|
290 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
|
291 | 291 | * |
|
292 | 292 | */ |
|
293 | 293 | |
@@ -302,8 +302,8 int send_tm_lfr_tc_exe_error( ccsdsTelec | |||
|
302 | 302 | // PACKET HEADER |
|
303 | 303 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
304 | 304 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
305 |
TM.packetSequenceControl[0] = |
|
|
306 |
TM.packetSequenceControl[1] = |
|
|
305 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
306 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
307 | 307 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR >> 8); |
|
308 | 308 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_ERROR ); |
|
309 | 309 | // DATA FIELD HEADER |
@@ -354,7 +354,7 int send_tm_lfr_tc_exe_corrupted(ccsdsTe | |||
|
354 | 354 | * - RTEMS_INVALID_SIZE - invalid message size |
|
355 | 355 | * - RTEMS_INVALID_ADDRESS - buffer is NULL |
|
356 | 356 | * - RTEMS_UNSATISFIED - out of message buffers |
|
357 |
* - RTEMS_TOO_MANY - queue |
|
|
357 | * - RTEMS_TOO_MANY - queue s limit has been reached | |
|
358 | 358 | * |
|
359 | 359 | */ |
|
360 | 360 | |
@@ -364,8 +364,8 int send_tm_lfr_tc_exe_corrupted(ccsdsTe | |||
|
364 | 364 | unsigned int packetLength; |
|
365 | 365 | unsigned char *packetDataField; |
|
366 | 366 | |
|
367 |
packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; |
|
|
368 |
packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; |
|
|
367 | packetLength = (TC->packetLength[0] * 256) + TC->packetLength[1]; // compute the packet length parameter | |
|
368 | packetDataField = (unsigned char *) &TC->headerFlag_pusVersion_Ack; // get the beginning of the data field | |
|
369 | 369 | |
|
370 | 370 | TM.targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
371 | 371 | TM.protocolIdentifier = CCSDS_PROTOCOLE_ID; |
@@ -374,8 +374,8 int send_tm_lfr_tc_exe_corrupted(ccsdsTe | |||
|
374 | 374 | // PACKET HEADER |
|
375 | 375 | TM.packetID[0] = (unsigned char) (TM_PACKET_ID_TC_EXE >> 8); |
|
376 | 376 | TM.packetID[1] = (unsigned char) (TM_PACKET_ID_TC_EXE ); |
|
377 |
TM.packetSequenceControl[0] = |
|
|
378 |
TM.packetSequenceControl[1] = |
|
|
377 | TM.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE; | |
|
378 | TM.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
|
379 | 379 | TM.packetLength[0] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED >> 8); |
|
380 | 380 | TM.packetLength[1] = (unsigned char) (PACKET_LENGTH_TC_EXE_CORRUPTED ); |
|
381 | 381 | // DATA FIELD HEADER |
@@ -238,7 +238,6 rtems_task wfrm_task(rtems_task_argument | |||
|
238 | 238 | |
|
239 | 239 | rtems_event_set event_out; |
|
240 | 240 | rtems_id queue_id; |
|
241 | rtems_status_code status; | |
|
242 | 241 | |
|
243 | 242 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
244 | 243 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
@@ -246,11 +245,7 rtems_task wfrm_task(rtems_task_argument | |||
|
246 | 245 | |
|
247 | 246 | init_waveforms(); |
|
248 | 247 | |
|
249 | status = rtems_message_queue_ident( misc_name[QUEUE_SEND], 0, &queue_id ); | |
|
250 | if (status != RTEMS_SUCCESSFUL) | |
|
251 | { | |
|
252 | PRINTF1("in WFRM *** ERR getting queue id, %d\n", status) | |
|
253 | } | |
|
248 | queue_id = get_pkts_queue_id(); | |
|
254 | 249 | |
|
255 | 250 | BOOT_PRINTF("in WFRM ***\n") |
|
256 | 251 | |
@@ -737,18 +732,18 int send_waveform_SWF( volatile int *wav | |||
|
737 | 732 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
738 | 733 | } |
|
739 | 734 | // SET PACKET TIME |
|
735 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
736 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
737 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
738 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
739 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
740 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
|
740 | 741 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
741 | 742 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
742 | 743 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); |
|
743 | 744 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); |
|
744 | 745 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); |
|
745 | 746 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); |
|
746 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
|
747 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
|
748 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
|
749 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
|
750 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
|
751 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
|
752 | 747 | // SEND PACKET |
|
753 | 748 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_SWF, ACTION_MSG_SPW_IOCTL_SEND_SIZE); |
|
754 | 749 | if (status != RTEMS_SUCCESSFUL) { |
@@ -802,18 +797,18 int send_waveform_CWF(volatile int *wave | |||
|
802 | 797 | // SET PACKET TIME |
|
803 | 798 | coarseTime = time_management_regs->coarse_time; |
|
804 | 799 | fineTime = time_management_regs->fine_time; |
|
800 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
|
801 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
|
802 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
|
803 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
|
804 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
|
805 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
|
805 | 806 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
806 | 807 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
807 | 808 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
808 | 809 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
809 | 810 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
810 | 811 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
811 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
|
812 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
|
813 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
|
814 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
|
815 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
|
816 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
|
817 | 812 | // SEND PACKET |
|
818 | 813 | if (sid == SID_NORM_CWF_F3) |
|
819 | 814 | { |
@@ -894,18 +889,18 int send_waveform_CWF3_light(volatile in | |||
|
894 | 889 | // SET PACKET TIME |
|
895 | 890 | coarseTime = time_management_regs->coarse_time; |
|
896 | 891 | fineTime = time_management_regs->fine_time; |
|
892 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
|
893 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
|
894 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
|
895 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
|
896 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
|
897 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
|
897 | 898 | headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24); |
|
898 | 899 | headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16); |
|
899 | 900 | headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8); |
|
900 | 901 | headerCWF[ i ].time[3] = (unsigned char) (coarseTime); |
|
901 | 902 | headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8); |
|
902 | 903 | headerCWF[ i ].time[5] = (unsigned char) (fineTime); |
|
903 | headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24); | |
|
904 | headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16); | |
|
905 | headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8); | |
|
906 | headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime); | |
|
907 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
|
908 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
|
909 | 904 | // SEND PACKET |
|
910 | 905 | status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
911 | 906 | if (status != RTEMS_SUCCESSFUL) { |
General Comments 0
You need to be logged in to leave comments.
Login now