@@ -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: Fri Mar 28 13:24:20 2014 | |
|
4 | 4 | # Project: fsw-qt.pro |
|
5 | 5 | # Template: app |
|
6 | 6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
@@ -10,7 +10,7 | |||
|
10 | 10 | |
|
11 | 11 | CC = sparc-rtems-gcc |
|
12 | 12 | CXX = sparc-rtems-g++ |
|
13 |
DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4= |
|
|
13 | DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=5 -DVHDL_DEV -DPRINT_MESSAGES_ON_CONSOLE | |
|
14 | 14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | 15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
16 | 16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters |
@@ -11,7 +11,7 SWVERSION=-1-0 | |||
|
11 | 11 | DEFINES += SW_VERSION_N1=1 # major |
|
12 | 12 | DEFINES += SW_VERSION_N2=0 # minor |
|
13 | 13 | DEFINES += SW_VERSION_N3=0 # patch |
|
14 |
DEFINES += SW_VERSION_N4= |
|
|
14 | DEFINES += SW_VERSION_N4=5 # internal | |
|
15 | 15 | |
|
16 | 16 | contains( CONFIG, debug_tch ) { |
|
17 | 17 | DEFINES += DEBUG_TCH |
@@ -1,6 +1,6 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 3.0.1, 2014-03-28T |
|
|
3 | <!-- Written by QtCreator 3.0.1, 2014-03-28T16:51:27. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -23,4 +23,7 | |||
|
23 | 23 | #define BYTE_POS_HK_UPDATE_INFO_PAR_SET5 24 // 34 - 10 |
|
24 | 24 | #define BYTE_POS_HK_UPDATE_INFO_PAR_SET6 25 // 35 - 10 |
|
25 | 25 | |
|
26 | // TC_LFR_ENTER_MODE | |
|
27 | #define BYTE_POS_CP_LFR_ENTER_MODE_TIME 2 // 12 - 10 | |
|
28 | ||
|
26 | 29 | #endif // TM_BYTE_POSITIONS_H |
@@ -25,7 +25,7 rtems_task actn_task( rtems_task_argumen | |||
|
25 | 25 | //*********** |
|
26 | 26 | // TC ACTIONS |
|
27 | 27 | int action_reset( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
28 |
int action_enter_mode( |
|
|
28 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); | |
|
29 | 29 | int action_update_info( ccsdsTelecommandPacket_t *TC, rtems_id queue_id ); |
|
30 | 30 | int action_enable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
|
31 | 31 | int action_disable_calibration( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time ); |
@@ -34,11 +34,12 int action_update_time( ccsdsTelecommand | |||
|
34 | 34 | // mode transition |
|
35 | 35 | int check_mode_value( unsigned char requestedMode ); |
|
36 | 36 | int check_mode_transition( unsigned char requestedMode ); |
|
37 | int check_transition_date( unsigned int transitionCoarseTime ); | |
|
37 | 38 | int stop_current_mode( void ); |
|
38 | int enter_mode( unsigned char mode ); | |
|
39 | int enter_mode( unsigned char mode , unsigned int transitionCoarseTime ); | |
|
39 | 40 | int restart_science_tasks(); |
|
40 | 41 | int suspend_science_tasks(); |
|
41 |
void launch_waveform_picker( |
|
|
42 | void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime); | |
|
42 | 43 | void launch_spectral_matrix( unsigned char mode ); |
|
43 | 44 | void set_irq_on_new_ready_matrix(unsigned char value ); |
|
44 | 45 | void set_run_matrix_spectral( unsigned char value ); |
@@ -310,7 +310,7 void init_housekeeping_parameters( void | |||
|
310 | 310 | housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
311 | 311 | housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
312 | 312 | // init fpga version |
|
313 |
parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0x |
|
|
313 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
|
314 | 314 | housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
315 | 315 | housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
316 | 316 | housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
@@ -395,7 +395,7 void send_dumb_hk( void ) | |||
|
395 | 395 | dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3; |
|
396 | 396 | dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4; |
|
397 | 397 | // init fpga version |
|
398 |
parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0x |
|
|
398 | parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xb0); | |
|
399 | 399 | dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1 |
|
400 | 400 | dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2 |
|
401 | 401 | dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3 |
@@ -87,7 +87,7 rtems_task spiq_task(rtems_task_argument | |||
|
87 | 87 | if ( status != RTEMS_SUCCESSFUL ) { |
|
88 | 88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) |
|
89 | 89 | } |
|
90 | status = enter_mode( LFR_MODE_STANDBY ); | |
|
90 | status = enter_mode( LFR_MODE_STANDBY, 0 ); | |
|
91 | 91 | if ( status != RTEMS_SUCCESSFUL ) { |
|
92 | 92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
93 | 93 | } |
@@ -102,7 +102,7 rtems_task actn_task( rtems_task_argumen | |||
|
102 | 102 | break; |
|
103 | 103 | // |
|
104 | 104 | case TC_SUBTYPE_ENTER: |
|
105 |
result = action_enter_mode( &TC, queue_snd_id |
|
|
105 | result = action_enter_mode( &TC, queue_snd_id ); | |
|
106 | 106 | close_action( &TC, result, queue_snd_id ); |
|
107 | 107 | break; |
|
108 | 108 | // |
@@ -149,7 +149,7 int action_reset(ccsdsTelecommandPacket_ | |||
|
149 | 149 | return LFR_DEFAULT; |
|
150 | 150 | } |
|
151 | 151 | |
|
152 |
int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id |
|
|
152 | int action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id ) | |
|
153 | 153 | { |
|
154 | 154 | /** This function executes specific actions when a TC_LFR_ENTER_MODE TeleCommand has been received. |
|
155 | 155 | * |
@@ -160,8 +160,12 int action_enter_mode(ccsdsTelecommandPa | |||
|
160 | 160 | |
|
161 | 161 | rtems_status_code status; |
|
162 | 162 | unsigned char requestedMode; |
|
163 | unsigned int *transitionCoarseTime_ptr; | |
|
164 | unsigned int transitionCoarseTime; | |
|
163 | 165 | |
|
164 | 166 | requestedMode = TC->dataAndCRC[1]; |
|
167 | transitionCoarseTime_ptr = (unsigned int *) (&TC->dataAndCRC[BYTE_POS_CP_LFR_ENTER_MODE_TIME]); | |
|
168 | transitionCoarseTime = (*transitionCoarseTime_ptr) & 0x7fffffff; | |
|
165 | 169 | |
|
166 | 170 | status = check_mode_value( requestedMode ); |
|
167 | 171 | |
@@ -169,22 +173,32 int action_enter_mode(ccsdsTelecommandPa | |||
|
169 | 173 | { |
|
170 | 174 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode ); |
|
171 | 175 | } |
|
172 | else | |
|
176 | else // the mode value is consistent, check the transition | |
|
173 | 177 | { |
|
174 | 178 | status = check_mode_transition(requestedMode); |
|
175 | ||
|
176 | if ( status == LFR_SUCCESSFUL ) | |
|
179 | if (status != LFR_SUCCESSFUL) | |
|
177 | 180 | { |
|
178 |
PRINTF |
|
|
179 | status = enter_mode( requestedMode ); | |
|
180 | } | |
|
181 | else | |
|
182 | { | |
|
183 | PRINTF("ERR *** in action_enter_mode *** transition rejected\n") | |
|
181 | PRINTF("ERR *** in action_enter_mode *** check_mode_transition\n") | |
|
184 | 182 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); |
|
185 | 183 | } |
|
186 | 184 | } |
|
187 | 185 | |
|
186 | if ( status == LFR_SUCCESSFUL ) // the transition is valid, enter the mode | |
|
187 | { | |
|
188 | status = check_transition_date( transitionCoarseTime ); | |
|
189 | if (status != LFR_SUCCESSFUL) | |
|
190 | { | |
|
191 | PRINTF("ERR *** in action_enter_mode *** check_transition_date\n") | |
|
192 | send_tm_lfr_tc_exe_not_executable( TC, queue_id ); | |
|
193 | } | |
|
194 | } | |
|
195 | ||
|
196 | if ( status == LFR_SUCCESSFUL ) // the date is valid, enter the mode | |
|
197 | { | |
|
198 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); | |
|
199 | status = enter_mode( requestedMode, transitionCoarseTime ); | |
|
200 | } | |
|
201 | ||
|
188 | 202 | return status; |
|
189 | 203 | } |
|
190 | 204 | |
@@ -390,6 +404,42 int check_mode_transition( unsigned char | |||
|
390 | 404 | return status; |
|
391 | 405 | } |
|
392 | 406 | |
|
407 | int check_transition_date( unsigned int transitionCoarseTime ) | |
|
408 | { | |
|
409 | int status; | |
|
410 | unsigned int localCoarseTime; | |
|
411 | unsigned int deltaCoarseTime; | |
|
412 | ||
|
413 | status = LFR_SUCCESSFUL; | |
|
414 | ||
|
415 | if (transitionCoarseTime == 0) // transition time = 0 means an instant transition | |
|
416 | { | |
|
417 | status = LFR_SUCCESSFUL; | |
|
418 | } | |
|
419 | else | |
|
420 | { | |
|
421 | localCoarseTime = time_management_regs->coarse_time & 0x7fffffff; | |
|
422 | ||
|
423 | if ( transitionCoarseTime < localCoarseTime ) // SSS-CP-EQS-322 | |
|
424 | { | |
|
425 | status = LFR_DEFAULT; | |
|
426 | PRINTF2("ERR *** in check_transition_date *** transition = %x, local = %x\n", transitionCoarseTime, localCoarseTime) | |
|
427 | } | |
|
428 | ||
|
429 | if (status == LFR_SUCCESSFUL) | |
|
430 | { | |
|
431 | deltaCoarseTime = transitionCoarseTime - localCoarseTime; | |
|
432 | if ( deltaCoarseTime > 3 ) // SSS-CP-EQS-323 | |
|
433 | { | |
|
434 | status = LFR_DEFAULT; | |
|
435 | PRINTF1("ERR *** in check_transition_date *** deltaCoarseTime = %x\n", deltaCoarseTime) | |
|
436 | } | |
|
437 | } | |
|
438 | } | |
|
439 | ||
|
440 | return status; | |
|
441 | } | |
|
442 | ||
|
393 | 443 | int stop_current_mode( void ) |
|
394 | 444 | { |
|
395 | 445 | /** This function stops the current mode by masking interrupt lines and suspending science tasks. |
@@ -441,7 +491,7 int stop_current_mode( void ) | |||
|
441 | 491 | return status; |
|
442 | 492 | } |
|
443 | 493 | |
|
444 | int enter_mode( unsigned char mode ) | |
|
494 | int enter_mode( unsigned char mode, unsigned int transitionCoarseTime ) | |
|
445 | 495 | { |
|
446 | 496 | /** This function is launched after a mode transition validation. |
|
447 | 497 | * |
@@ -473,7 +523,7 int enter_mode( unsigned char mode ) | |||
|
473 | 523 | maxCount = 0; |
|
474 | 524 | #endif |
|
475 | 525 | status = restart_science_tasks(); |
|
476 | launch_waveform_picker( mode ); | |
|
526 | launch_waveform_picker( mode, transitionCoarseTime ); | |
|
477 | 527 | // launch_spectral_matrix( mode ); |
|
478 | 528 | } |
|
479 | 529 | else if ( mode == LFR_MODE_STANDBY ) |
@@ -617,10 +667,8 int suspend_science_tasks() | |||
|
617 | 667 | return status; |
|
618 | 668 | } |
|
619 | 669 | |
|
620 | void launch_waveform_picker( unsigned char mode ) | |
|
670 | void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime ) | |
|
621 | 671 | { |
|
622 | int startDate; | |
|
623 | ||
|
624 | 672 | reset_current_ring_nodes(); |
|
625 | 673 | reset_waveform_picker_regs(); |
|
626 | 674 | set_wfp_burst_enable_register( mode ); |
@@ -628,9 +676,15 void launch_waveform_picker( unsigned ch | |||
|
628 | 676 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); |
|
629 | 677 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
630 | 678 | |
|
631 | startDate = time_management_regs->coarse_time + 2; | |
|
632 | 679 | waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000] |
|
633 | waveform_picker_regs->start_date = startDate; | |
|
680 | if (transitionCoarseTime == 0) | |
|
681 | { | |
|
682 | waveform_picker_regs->start_date = time_management_regs->coarse_time; | |
|
683 | } | |
|
684 | else | |
|
685 | { | |
|
686 | waveform_picker_regs->start_date = transitionCoarseTime; | |
|
687 | } | |
|
634 | 688 | } |
|
635 | 689 | |
|
636 | 690 | void launch_spectral_matrix( unsigned char mode ) |
General Comments 0
You need to be logged in to leave comments.
Login now