@@ -1,6 +1,6 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3.0.1, 2014-03- |
|
3 | <!-- Written by QtCreator 3.0.1, 2014-03-31T06:56:28. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -106,13 +106,8 typedef struct ring_node | |||||
106 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
106 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
107 | #define REGS_ADDR_GRGPIO 0x80000b00 |
|
107 | #define REGS_ADDR_GRGPIO 0x80000b00 | |
108 |
|
108 | |||
109 | #ifdef VHDL_DEV |
|
|||
110 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
109 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
111 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 |
|
110 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40 | |
112 | #else |
|
|||
113 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 |
|
|||
114 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
|||
115 | #endif |
|
|||
116 |
|
111 | |||
117 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
112 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
118 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
113 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
@@ -1,8 +1,6 | |||||
1 | #ifndef TM_BYTE_POSITIONS_H |
|
1 | #ifndef TM_BYTE_POSITIONS_H | |
2 | #define TM_BYTE_POSITIONS_H |
|
2 | #define TM_BYTE_POSITIONS_H | |
3 |
|
3 | |||
4 | #define BYTE_POS_CP_LFR_MODE 11 |
|
|||
5 |
|
||||
6 | // TC_LFR_LOAD_COMMON_PAR |
|
4 | // TC_LFR_LOAD_COMMON_PAR | |
7 |
|
5 | |||
8 | // TC_LFR_LOAD_NORMAL_PAR |
|
6 | // TC_LFR_LOAD_NORMAL_PAR | |
@@ -20,10 +18,11 | |||||
20 | // TC_LFR_LOAD_SBM2_PAR |
|
18 | // TC_LFR_LOAD_SBM2_PAR | |
21 |
|
19 | |||
22 | // TC_LFR_UPDATE_INFO |
|
20 | // TC_LFR_UPDATE_INFO | |
23 |
#define BYTE_POS_ |
|
21 | #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 34 | |
24 |
#define BYTE_POS_ |
|
22 | #define BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 35 | |
25 |
|
23 | |||
26 | // TC_LFR_ENTER_MODE |
|
24 | // TC_LFR_ENTER_MODE | |
27 |
#define BYTE_POS_CP_ |
|
25 | #define BYTE_POS_CP_MODE_LFR_SET 11 | |
|
26 | #define BYTE_POS_CP_LFR_ENTER_MODE_TIME 12 | |||
28 |
|
27 | |||
29 | #endif // TM_BYTE_POSITIONS_H |
|
28 | #endif // TM_BYTE_POSITIONS_H |
@@ -12,7 +12,7 void GetCRCAsTwoBytes(unsigned char* dat | |||||
12 |
|
12 | |||
13 | //********************* |
|
13 | //********************* | |
14 | // ACCEPTANCE FUNCTIONS |
|
14 | // ACCEPTANCE FUNCTIONS | |
15 |
int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int |
|
15 | int tc_parser( ccsdsTelecommandPacket_t * TCPacket, unsigned int estimatedPacketLength, unsigned char *computed_CRC ); | |
16 | int tc_check_type( unsigned char packetType ); |
|
16 | int tc_check_type( unsigned char packetType ); | |
17 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ); |
|
17 | int tc_check_type_subtype( unsigned char packetType, unsigned char packetSubType ); | |
18 | int tc_check_sid( unsigned char sid ); |
|
18 | int tc_check_sid( unsigned char sid ); |
@@ -14,7 +14,7 int send_tm_lfr_tc_exe_inconsistent( ccs | |||||
14 | unsigned char byte_position, unsigned char rcv_value ); |
|
14 | unsigned char byte_position, unsigned char rcv_value ); | |
15 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
15 | int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
16 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
16 | int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); | |
17 |
int send_tm_lfr_tc_exe_error( |
|
17 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); | |
18 | int send_tm_lfr_tc_exe_corrupted( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, |
|
18 | int send_tm_lfr_tc_exe_corrupted( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, | |
19 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID ); |
|
19 | unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID ); | |
20 |
|
20 |
@@ -232,7 +232,7 void init_local_mode_parameters( void ) | |||||
232 |
|
232 | |||
233 | void reset_local_time( void ) |
|
233 | void reset_local_time( void ) | |
234 | { |
|
234 | { | |
235 |
|
235 | time_management_regs->coarse_time_load = 0x80000000; | ||
236 | } |
|
236 | } | |
237 |
|
237 | |||
238 | void create_names( void ) // create all names for tasks and queues |
|
238 | void create_names( void ) // create all names for tasks and queues |
@@ -116,7 +116,7 rtems_task recv_task( rtems_task_argumen | |||||
116 | unsigned char computed_CRC[ 2 ]; |
|
116 | unsigned char computed_CRC[ 2 ]; | |
117 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
117 | unsigned char currentTC_LEN_RCV[ 2 ]; | |
118 | unsigned char destinationID; |
|
118 | unsigned char destinationID; | |
119 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
119 | unsigned int estimatedPacketLength; | |
120 | unsigned int parserCode; |
|
120 | unsigned int parserCode; | |
121 | rtems_status_code status; |
|
121 | rtems_status_code status; | |
122 | rtems_id queue_recv_id; |
|
122 | rtems_id queue_recv_id; | |
@@ -149,11 +149,11 rtems_task recv_task( rtems_task_argumen | |||||
149 | PRINTF("in RECV *** packet lenght too short\n") |
|
149 | PRINTF("in RECV *** packet lenght too short\n") | |
150 | } |
|
150 | } | |
151 | else { |
|
151 | else { | |
152 |
|
|
152 | estimatedPacketLength = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes | |
153 |
currentTC_LEN_RCV[ 0 ] = (unsigned char) ( |
|
153 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (estimatedPacketLength >> 8); | |
154 |
currentTC_LEN_RCV[ 1 ] = (unsigned char) ( |
|
154 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (estimatedPacketLength ); | |
155 | // CHECK THE TC |
|
155 | // CHECK THE TC | |
156 |
parserCode = tc_parser( ¤tTC, |
|
156 | parserCode = tc_parser( ¤tTC, estimatedPacketLength, computed_CRC ) ; | |
157 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) |
|
157 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) | |
158 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) |
|
158 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) | |
159 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) |
|
159 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) | |
@@ -181,7 +181,7 rtems_task recv_task( rtems_task_argumen | |||||
181 | else |
|
181 | else | |
182 | { // send valid TC to the action launcher |
|
182 | { // send valid TC to the action launcher | |
183 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
183 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, | |
184 |
|
|
184 | estimatedPacketLength + CCSDS_TC_TM_PACKET_OFFSET + 3); | |
185 | } |
|
185 | } | |
186 | } |
|
186 | } | |
187 | } |
|
187 | } |
@@ -93,12 +93,12 void GetCRCAsTwoBytes(unsigned char* dat | |||||
93 |
|
93 | |||
94 | //********************* |
|
94 | //********************* | |
95 | // ACCEPTANCE FUNCTIONS |
|
95 | // ACCEPTANCE FUNCTIONS | |
96 |
int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int |
|
96 | int tc_parser(ccsdsTelecommandPacket_t * TCPacket, unsigned int estimatedPacketLength, unsigned char *computed_CRC) | |
97 | { |
|
97 | { | |
98 | /** This function parses TeleCommands. |
|
98 | /** This function parses TeleCommands. | |
99 | * |
|
99 | * | |
100 | * @param TC points to the TeleCommand that will be parsed. |
|
100 | * @param TC points to the TeleCommand that will be parsed. | |
101 | * @param TC_LEN_RCV is the received packet length. |
|
101 | * @param estimatedPacketLength is the PACKET_LENGTH field calculated from the effective length of the received packet. | |
102 | * |
|
102 | * | |
103 | * @return Status code of the parsing. |
|
103 | * @return Status code of the parsing. | |
104 | * |
|
104 | * | |
@@ -116,7 +116,7 int tc_parser(ccsdsTelecommandPacket_t * | |||||
116 | int status_crc; |
|
116 | int status_crc; | |
117 | unsigned char pid; |
|
117 | unsigned char pid; | |
118 | unsigned char category; |
|
118 | unsigned char category; | |
119 |
unsigned int |
|
119 | unsigned int packetLength; | |
120 | unsigned char packetType; |
|
120 | unsigned char packetType; | |
121 | unsigned char packetSubtype; |
|
121 | unsigned char packetSubtype; | |
122 | unsigned char sid; |
|
122 | unsigned char sid; | |
@@ -126,7 +126,7 int tc_parser(ccsdsTelecommandPacket_t * | |||||
126 | // APID check *** APID on 2 bytes |
|
126 | // APID check *** APID on 2 bytes | |
127 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx |
|
127 | pid = ((TCPacket->packetID[0] & 0x07)<<4) + ( (TCPacket->packetID[1]>>4) & 0x0f ); // PID = 11 *** 7 bits xxxxx210 7654xxxx | |
128 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 |
|
128 | category = (TCPacket->packetID[1] & 0x0f); // PACKET_CATEGORY = 12 *** 4 bits xxxxxxxx xxxx3210 | |
129 |
|
|
129 | packetLength = (TCPacket->packetLength[0] * 256) + TCPacket->packetLength[1]; | |
130 | packetType = TCPacket->serviceType; |
|
130 | packetType = TCPacket->serviceType; | |
131 | packetSubtype = TCPacket->serviceSubType; |
|
131 | packetSubtype = TCPacket->serviceSubType; | |
132 | sid = TCPacket->sourceID; |
|
132 | sid = TCPacket->sourceID; | |
@@ -142,15 +142,15 int tc_parser(ccsdsTelecommandPacket_t * | |||||
142 | status = ILLEGAL_APID; |
|
142 | status = ILLEGAL_APID; | |
143 | } |
|
143 | } | |
144 | } |
|
144 | } | |
145 |
if (status == CCSDS_TM_VALID) // CHECK THE PACKET |
|
145 | if (status == CCSDS_TM_VALID) // CHECK THE PACKET_LENGTH FIELD AND THE ESTIMATED PACKET_LENGTH COMPLIANCE | |
146 | { |
|
146 | { | |
147 | if (length != TC_LEN_RCV ) { |
|
147 | if (packetLength != estimatedPacketLength ) { | |
148 | status = WRONG_LEN_PKT; |
|
148 | status = WRONG_LEN_PKT; | |
149 | } |
|
149 | } | |
150 | } |
|
150 | } | |
151 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE |
|
151 | if (status == CCSDS_TM_VALID) // CHECK THAT THE PACKET DOES NOT EXCEED THE MAX SIZE | |
152 | { |
|
152 | { | |
153 |
if ( |
|
153 | if ( packetLength >= CCSDS_TC_PKT_MAX_SIZE ) { | |
154 | status = WRONG_LEN_PKT; |
|
154 | status = WRONG_LEN_PKT; | |
155 | } |
|
155 | } | |
156 | } |
|
156 | } | |
@@ -168,9 +168,9 int tc_parser(ccsdsTelecommandPacket_t * | |||||
168 | } |
|
168 | } | |
169 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE |
|
169 | if (status == CCSDS_TM_VALID) // CHECK THE SUBTYPE AND LENGTH COMPLIANCE | |
170 | { |
|
170 | { | |
171 |
status = tc_check_length( packetSubtype, |
|
171 | status = tc_check_length( packetSubtype, packetLength ); | |
172 | } |
|
172 | } | |
173 |
status_crc = tc_check_crc( TCPacket, |
|
173 | status_crc = tc_check_crc( TCPacket, estimatedPacketLength, computed_CRC ); | |
174 | if (status == CCSDS_TM_VALID ) // CHECK CRC |
|
174 | if (status == CCSDS_TM_VALID ) // CHECK CRC | |
175 | { |
|
175 | { | |
176 | status = status_crc; |
|
176 | status = status_crc; |
@@ -162,16 +162,19 int action_enter_mode(ccsdsTelecommandPa | |||||
162 | unsigned char requestedMode; |
|
162 | unsigned char requestedMode; | |
163 | unsigned int *transitionCoarseTime_ptr; |
|
163 | unsigned int *transitionCoarseTime_ptr; | |
164 | unsigned int transitionCoarseTime; |
|
164 | unsigned int transitionCoarseTime; | |
|
165 | unsigned char * bytePosPtr; | |||
165 |
|
166 | |||
166 | requestedMode = TC->dataAndCRC[1]; |
|
167 | bytePosPtr = (unsigned char *) &TC->packetID; | |
167 | transitionCoarseTime_ptr = (unsigned int *) (&TC->dataAndCRC[BYTE_POS_CP_LFR_ENTER_MODE_TIME]); |
|
168 | ||
|
169 | requestedMode = bytePosPtr[ BYTE_POS_CP_MODE_LFR_SET ]; | |||
|
170 | transitionCoarseTime_ptr = (unsigned int *) ( &bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME ] ); | |||
168 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; |
|
171 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; | |
169 |
|
172 | |||
170 | status = check_mode_value( requestedMode ); |
|
173 | status = check_mode_value( requestedMode ); | |
171 |
|
174 | |||
172 | if ( status != LFR_SUCCESSFUL ) |
|
175 | if ( status != LFR_SUCCESSFUL ) // the mode value is inconsistent | |
173 | { |
|
176 | { | |
174 |
send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_ |
|
177 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); | |
175 | } |
|
178 | } | |
176 | else // the mode value is consistent, check the transition |
|
179 | else // the mode value is consistent, check the transition | |
177 | { |
|
180 | { | |
@@ -189,7 +192,9 int action_enter_mode(ccsdsTelecommandPa | |||||
189 | if (status != LFR_SUCCESSFUL) |
|
192 | if (status != LFR_SUCCESSFUL) | |
190 | { |
|
193 | { | |
191 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") |
|
194 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") | |
192 |
send_tm_lfr_tc_exe_ |
|
195 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, | |
|
196 | BYTE_POS_CP_LFR_ENTER_MODE_TIME, | |||
|
197 | bytePosPtr[ BYTE_POS_CP_LFR_ENTER_MODE_TIME + 3 ] ); | |||
193 | } |
|
198 | } | |
194 | } |
|
199 | } | |
195 |
|
200 | |||
@@ -219,18 +224,21 int action_update_info(ccsdsTelecommandP | |||||
219 | int result; |
|
224 | int result; | |
220 | unsigned int status; |
|
225 | unsigned int status; | |
221 | unsigned char mode; |
|
226 | unsigned char mode; | |
|
227 | unsigned char * bytePosPtr; | |||
|
228 | ||||
|
229 | bytePosPtr = (unsigned char *) &TC->packetID; | |||
222 |
|
230 | |||
223 | // check LFR mode |
|
231 | // check LFR mode | |
224 |
mode = ( |
|
232 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET5 ] & 0x1e) >> 1; | |
225 | status = check_update_info_hk_lfr_mode( mode ); |
|
233 | status = check_update_info_hk_lfr_mode( mode ); | |
226 | if (status == LFR_SUCCESSFUL) // check TDS mode |
|
234 | if (status == LFR_SUCCESSFUL) // check TDS mode | |
227 | { |
|
235 | { | |
228 |
mode = ( |
|
236 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0xf0) >> 4; | |
229 | status = check_update_info_hk_tds_mode( mode ); |
|
237 | status = check_update_info_hk_tds_mode( mode ); | |
230 | } |
|
238 | } | |
231 | if (status == LFR_SUCCESSFUL) // check THR mode |
|
239 | if (status == LFR_SUCCESSFUL) // check THR mode | |
232 | { |
|
240 | { | |
233 |
mode = ( |
|
241 | mode = (bytePosPtr[ BYTE_POS_UPDATE_INFO_PARAMETERS_SET6 ] & 0x0f); | |
234 | status = check_update_info_hk_thr_mode( mode ); |
|
242 | status = check_update_info_hk_thr_mode( mode ); | |
235 | } |
|
243 | } | |
236 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful |
|
244 | if (status == LFR_SUCCESSFUL) // if the parameter check is successful | |
@@ -420,7 +428,7 int check_transition_date( unsigned int | |||||
420 | { |
|
428 | { | |
421 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; |
|
429 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
422 |
|
430 | |||
423 | if ( transitionCoarseTime < localCoarseTime ) // SSS-CP-EQS-322 |
|
431 | if ( transitionCoarseTime <= localCoarseTime ) // SSS-CP-EQS-322 | |
424 | { |
|
432 | { | |
425 | status = LFR_DEFAULT; |
|
433 | status = LFR_DEFAULT; | |
426 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) |
|
434 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) | |
@@ -840,6 +848,10 void close_action(ccsdsTelecommandPacket | |||||
840 | updateLFRCurrentMode(); |
|
848 | updateLFRCurrentMode(); | |
841 | } |
|
849 | } | |
842 | } |
|
850 | } | |
|
851 | else | |||
|
852 | { | |||
|
853 | send_tm_lfr_tc_exe_error( TC, queue_id ); | |||
|
854 | } | |||
843 | } |
|
855 | } | |
844 |
|
856 | |||
845 | //*************************** |
|
857 | //*************************** |
@@ -164,7 +164,7 int action_load_sbm1_par(ccsdsTelecomman | |||||
164 | result = LFR_DEFAULT; |
|
164 | result = LFR_DEFAULT; | |
165 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
165 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
166 |
|
166 | |||
167 |
if ( |
|
167 | if ( lfrMode == LFR_MODE_SBM1 ) { | |
168 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
168 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
169 | result = LFR_DEFAULT; |
|
169 | result = LFR_DEFAULT; | |
170 | } |
|
170 | } | |
@@ -194,7 +194,7 int action_load_sbm2_par(ccsdsTelecomman | |||||
194 | result = LFR_DEFAULT; |
|
194 | result = LFR_DEFAULT; | |
195 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; |
|
195 | lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4; | |
196 |
|
196 | |||
197 |
if ( |
|
197 | if ( lfrMode == LFR_MODE_SBM2 ) { | |
198 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
198 | status = send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
199 | result = LFR_DEFAULT; |
|
199 | result = LFR_DEFAULT; | |
200 | } |
|
200 | } |
@@ -282,7 +282,7 int send_tm_lfr_tc_exe_not_implemented( | |||||
282 | return status; |
|
282 | return status; | |
283 | } |
|
283 | } | |
284 |
|
284 | |||
285 |
int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
285 | int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
286 | { |
|
286 | { | |
287 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. |
|
287 | /** This function sends a TM_LFR_TC_EXE_ERROR packet in the dedicated RTEMS message queue. | |
288 | * |
|
288 | * |
@@ -154,33 +154,13 rtems_isr waveforms_isr( rtems_vector_nu | |||||
154 | // SBM1 |
|
154 | // SBM1 | |
155 | case(LFR_MODE_SBM1): |
|
155 | case(LFR_MODE_SBM1): | |
156 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit |
|
156 | if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit | |
157 | // (0) launch snapshot extraction if needed |
|
|||
158 | if (extractSWF == true) |
|
|||
159 | { |
|
|||
160 | ring_node_to_send_swf_f1 = current_ring_node_f1; |
|
|||
161 | // extract the snapshot |
|
|||
162 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); |
|
|||
163 | extractSWF = false; |
|
|||
164 | swf_f1_ready = true; |
|
|||
165 | } |
|
|||
166 | // (1) change the receiving buffer for the waveform picker |
|
157 | // (1) change the receiving buffer for the waveform picker | |
167 | ring_node_to_send_cwf_f1 = current_ring_node_f1; |
|
158 | ring_node_to_send_cwf_f1 = current_ring_node_f1; | |
168 | current_ring_node_f1 = current_ring_node_f1->next; |
|
159 | current_ring_node_f1 = current_ring_node_f1->next; | |
169 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; |
|
160 | waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; | |
170 | // (2) send an event for the the CWF1 task for transmission |
|
161 | // (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed) | |
171 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); |
|
162 | status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 ); | |
172 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 |
|
163 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0 | |
173 | if (swf_f0_ready == true) |
|
|||
174 | { |
|
|||
175 | extractSWF = true; |
|
|||
176 | swf_f0_ready = false; |
|
|||
177 | } |
|
|||
178 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) |
|
|||
179 | { |
|
|||
180 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); |
|
|||
181 | swf_f1_ready = false; |
|
|||
182 | swf_f2_ready = false; |
|
|||
183 | } |
|
|||
184 | } |
|
164 | } | |
185 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
165 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
186 | swf_f0_ready = true; |
|
166 | swf_f0_ready = true; | |
@@ -196,16 +176,6 rtems_isr waveforms_isr( rtems_vector_nu | |||||
196 | // SBM2 |
|
176 | // SBM2 | |
197 | case(LFR_MODE_SBM2): |
|
177 | case(LFR_MODE_SBM2): | |
198 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit |
|
178 | if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit | |
199 | // (0) launch snapshot extraction if needed |
|
|||
200 | if (extractSWF == true) |
|
|||
201 | { |
|
|||
202 | ring_node_to_send_swf_f2 = current_ring_node_f2; |
|
|||
203 | // extract the snapshot |
|
|||
204 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM2 ); |
|
|||
205 | // send the snapshot when build, SWBD priority < WFRM priority |
|
|||
206 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); |
|
|||
207 | extractSWF = false; |
|
|||
208 | } |
|
|||
209 | // (1) change the receiving buffer for the waveform picker |
|
179 | // (1) change the receiving buffer for the waveform picker | |
210 | ring_node_to_send_cwf_f2 = current_ring_node_f2; |
|
180 | ring_node_to_send_cwf_f2 = current_ring_node_f2; | |
211 | current_ring_node_f2 = current_ring_node_f2->next; |
|
181 | current_ring_node_f2 = current_ring_node_f2->next; | |
@@ -213,13 +183,6 rtems_isr waveforms_isr( rtems_vector_nu | |||||
213 | // (2) send an event for the waveforms transmission |
|
183 | // (2) send an event for the waveforms transmission | |
214 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); |
|
184 | status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 ); | |
215 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 |
|
185 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0 | |
216 | // (3) check whether swf_fo and swf_f& are ready or not |
|
|||
217 | if (swf_f0_ready && swf_f1_ready) |
|
|||
218 | { |
|
|||
219 | extractSWF = true; |
|
|||
220 | swf_f0_ready = false; |
|
|||
221 | swf_f1_ready = false; |
|
|||
222 | } |
|
|||
223 | } |
|
186 | } | |
224 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit |
|
187 | if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit | |
225 | swf_f0_ready = true; |
|
188 | swf_f0_ready = true; | |
@@ -402,6 +365,22 rtems_task cwf2_task(rtems_task_argument | |||||
402 | if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
365 | if (event_out == RTEMS_EVENT_MODE_SBM2) | |
403 | { |
|
366 | { | |
404 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); |
|
367 | send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id ); | |
|
368 | // launch snapshot extraction if needed | |||
|
369 | if (extractSWF == true) | |||
|
370 | { | |||
|
371 | ring_node_to_send_swf_f2 = ring_node_to_send_cwf_f2; | |||
|
372 | // extract the snapshot | |||
|
373 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); | |||
|
374 | // send the snapshot when built | |||
|
375 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2 ); | |||
|
376 | extractSWF = false; | |||
|
377 | } | |||
|
378 | if (swf_f0_ready && swf_f1_ready) | |||
|
379 | { | |||
|
380 | extractSWF = true; | |||
|
381 | swf_f0_ready = false; | |||
|
382 | swf_f1_ready = false; | |||
|
383 | } | |||
405 | } |
|
384 | } | |
406 | } |
|
385 | } | |
407 | } |
|
386 | } | |
@@ -436,6 +415,25 rtems_task cwf1_task(rtems_task_argument | |||||
436 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, |
|
415 | rtems_event_receive( RTEMS_EVENT_MODE_SBM1, | |
437 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
416 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
438 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); |
|
417 | send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id ); | |
|
418 | // launch snapshot extraction if needed | |||
|
419 | if (extractSWF == true) | |||
|
420 | { | |||
|
421 | ring_node_to_send_swf_f1 = ring_node_to_send_cwf_f1; | |||
|
422 | // launch the snapshot extraction | |||
|
423 | status = rtems_event_send( Task_id[TASKID_SWBD], RTEMS_EVENT_MODE_SBM1 ); | |||
|
424 | extractSWF = false; | |||
|
425 | } | |||
|
426 | if (swf_f0_ready == true) | |||
|
427 | { | |||
|
428 | extractSWF = true; | |||
|
429 | swf_f0_ready = false; // this step shall be executed only one time | |||
|
430 | } | |||
|
431 | if ((swf_f1_ready == true) && (swf_f2_ready == true)) // swf_f1 is ready after the extraction | |||
|
432 | { | |||
|
433 | status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ); | |||
|
434 | swf_f1_ready = false; | |||
|
435 | swf_f2_ready = false; | |||
|
436 | } | |||
439 | } |
|
437 | } | |
440 | } |
|
438 | } | |
441 |
|
439 | |||
@@ -458,10 +456,7 rtems_task swbd_task(rtems_task_argument | |||||
458 | if (event_out == RTEMS_EVENT_MODE_SBM1) |
|
456 | if (event_out == RTEMS_EVENT_MODE_SBM1) | |
459 | { |
|
457 | { | |
460 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); |
|
458 | build_snapshot_from_ring( ring_node_to_send_swf_f1, 1 ); | |
461 | } |
|
459 | swf_f1_ready = true; // the snapshot has been extracted and is ready to be sent | |
462 | else if (event_out == RTEMS_EVENT_MODE_SBM2) |
|
|||
463 | { |
|
|||
464 | build_snapshot_from_ring( ring_node_to_send_swf_f2, 2 ); |
|
|||
465 | } |
|
460 | } | |
466 | else |
|
461 | else | |
467 | { |
|
462 | { |
General Comments 0
You need to be logged in to leave comments.
Login now