@@ -1,2 +1,2 | |||||
1 | 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters |
|
1 | 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters | |
2 | 721463c11a484e6a3439e16c99f8bd27720b9265 header/lfr_common_headers |
|
2 | ff85ce82cd9845f180cb578272717bcb76b62cb5 header/lfr_common_headers |
@@ -60,6 +60,7 void set_hk_lfr_sc_potential_flag( bool | |||||
60 | void set_hk_lfr_mag_fields_flag( bool state ); |
|
60 | void set_hk_lfr_mag_fields_flag( bool state ); | |
61 | void set_hk_lfr_calib_enable( bool state ); |
|
61 | void set_hk_lfr_calib_enable( bool state ); | |
62 | void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause ); |
|
62 | void set_hk_lfr_reset_cause( enum lfr_reset_cause_t lfr_reset_cause ); | |
|
63 | void hk_lfr_le_me_he_update(); | |||
63 |
|
64 | |||
64 | extern int sched_yield( void ); |
|
65 | extern int sched_yield( void ); | |
65 | extern void rtems_cpu_usage_reset(); |
|
66 | extern void rtems_cpu_usage_reset(); |
@@ -44,7 +44,6 void spw_send_asm_f2( ring_node *ring_no | |||||
44 | void spw_send_k_dump( ring_node *ring_node_to_send ); |
|
44 | void spw_send_k_dump( ring_node *ring_node_to_send ); | |
45 |
|
45 | |||
46 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); |
|
46 | void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); | |
47 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ); |
|
|||
48 |
|
47 | |||
49 | void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc ); |
|
48 | void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc ); | |
50 |
|
49 |
@@ -12,6 +12,8 | |||||
12 |
|
12 | |||
13 | #include "lfr_cpu_usage_report.h" |
|
13 | #include "lfr_cpu_usage_report.h" | |
14 |
|
14 | |||
|
15 | extern unsigned int lastValidTransitionDate; | |||
|
16 | ||||
15 | //**** |
|
17 | //**** | |
16 | // ISR |
|
18 | // ISR | |
17 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
|
19 | rtems_isr commutation_isr1( rtems_vector_number vector ); | |
@@ -33,6 +35,7 int action_update_time( ccsdsTelecommand | |||||
33 | // mode transition |
|
35 | // mode transition | |
34 | int check_mode_value( unsigned char requestedMode ); |
|
36 | int check_mode_value( unsigned char requestedMode ); | |
35 | int check_mode_transition( unsigned char requestedMode ); |
|
37 | int check_mode_transition( unsigned char requestedMode ); | |
|
38 | void update_last_valid_transition_date( unsigned int transitionCoarseTime ); | |||
36 | int check_transition_date( unsigned int transitionCoarseTime ); |
|
39 | int check_transition_date( unsigned int transitionCoarseTime ); | |
37 | int stop_spectral_matrices( void ); |
|
40 | int stop_spectral_matrices( void ); | |
38 | int stop_current_mode( void ); |
|
41 | int stop_current_mode( void ); |
@@ -58,6 +58,7 spectral_matrix_regs_t *spectra | |||||
58 | // MODE PARAMETERS |
|
58 | // MODE PARAMETERS | |
59 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
59 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
60 | struct param_local_str param_local; |
|
60 | struct param_local_str param_local; | |
|
61 | unsigned int lastValidTransitionDate; | |||
61 |
|
62 | |||
62 | // HK PACKETS |
|
63 | // HK PACKETS | |
63 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
64 | Packet_TM_LFR_HK_t housekeeping_packet; |
@@ -139,6 +139,7 rtems_task Init( rtems_task_argument ign | |||||
139 | init_k_coefficients_prc1(); |
|
139 | init_k_coefficients_prc1(); | |
140 | init_k_coefficients_prc2(); |
|
140 | init_k_coefficients_prc2(); | |
141 | pa_bia_status_info = 0x00; |
|
141 | pa_bia_status_info = 0x00; | |
|
142 | update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE ); | |||
142 |
|
143 | |||
143 | // waveform picker initialization |
|
144 | // waveform picker initialization | |
144 | WFP_init_rings(); LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings |
|
145 | WFP_init_rings(); LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings |
@@ -294,6 +294,8 rtems_task hous_task(rtems_task_argument | |||||
294 |
|
294 | |||
295 | spacewire_update_statistics(); |
|
295 | spacewire_update_statistics(); | |
296 |
|
296 | |||
|
297 | hk_lfr_le_me_he_update(); | |||
|
298 | ||||
297 | housekeeping_packet.hk_lfr_q_sd_fifo_size_max = hk_lfr_q_sd_fifo_size_max; |
|
299 | housekeeping_packet.hk_lfr_q_sd_fifo_size_max = hk_lfr_q_sd_fifo_size_max; | |
298 | housekeeping_packet.hk_lfr_q_rv_fifo_size_max = hk_lfr_q_rv_fifo_size_max; |
|
300 | housekeeping_packet.hk_lfr_q_rv_fifo_size_max = hk_lfr_q_rv_fifo_size_max; | |
299 | housekeeping_packet.hk_lfr_q_p0_fifo_size_max = hk_lfr_q_p0_fifo_size_max; |
|
301 | housekeeping_packet.hk_lfr_q_p0_fifo_size_max = hk_lfr_q_p0_fifo_size_max; | |
@@ -650,3 +652,47 void set_hk_lfr_reset_cause( enum lfr_re | |||||
650 | housekeeping_packet.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1] |
|
652 | housekeeping_packet.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1] | |
651 | | (lfr_reset_cause & 0x07 ); // [0000 0111] |
|
653 | | (lfr_reset_cause & 0x07 ); // [0000 0111] | |
652 | } |
|
654 | } | |
|
655 | ||||
|
656 | void hk_lfr_le_me_he_update() | |||
|
657 | { | |||
|
658 | unsigned int hk_lfr_le_cnt; | |||
|
659 | unsigned int hk_lfr_me_cnt; | |||
|
660 | unsigned int hk_lfr_he_cnt; | |||
|
661 | ||||
|
662 | hk_lfr_le_cnt = 0; | |||
|
663 | hk_lfr_me_cnt = 0; | |||
|
664 | hk_lfr_he_cnt = 0; | |||
|
665 | ||||
|
666 | //update the low severity error counter | |||
|
667 | hk_lfr_le_cnt = | |||
|
668 | housekeeping_packet.hk_lfr_dpu_spw_parity | |||
|
669 | + housekeeping_packet.hk_lfr_dpu_spw_disconnect | |||
|
670 | + housekeeping_packet.hk_lfr_dpu_spw_escape | |||
|
671 | + housekeeping_packet.hk_lfr_dpu_spw_credit | |||
|
672 | + housekeeping_packet.hk_lfr_dpu_spw_write_sync | |||
|
673 | + housekeeping_packet.hk_lfr_dpu_spw_rx_ahb | |||
|
674 | + housekeeping_packet.hk_lfr_dpu_spw_tx_ahb | |||
|
675 | + housekeeping_packet.hk_lfr_time_timecode_ctr; | |||
|
676 | ||||
|
677 | //update the medium severity error counter | |||
|
678 | hk_lfr_me_cnt = | |||
|
679 | housekeeping_packet.hk_lfr_dpu_spw_early_eop | |||
|
680 | + housekeeping_packet.hk_lfr_dpu_spw_invalid_addr | |||
|
681 | + housekeeping_packet.hk_lfr_dpu_spw_eep | |||
|
682 | + housekeeping_packet.hk_lfr_dpu_spw_rx_too_big; | |||
|
683 | ||||
|
684 | //update the high severity error counter | |||
|
685 | hk_lfr_he_cnt = 0; | |||
|
686 | ||||
|
687 | // update housekeeping packet counters, convert unsigned int numbers in 2 bytes numbers | |||
|
688 | // LE | |||
|
689 | housekeeping_packet.hk_lfr_le_cnt[0] = (unsigned char) ((hk_lfr_le_cnt & 0xff00) >> 8); | |||
|
690 | housekeeping_packet.hk_lfr_le_cnt[1] = (unsigned char) (hk_lfr_le_cnt & 0x00ff); | |||
|
691 | // ME | |||
|
692 | housekeeping_packet.hk_lfr_me_cnt[0] = (unsigned char) ((hk_lfr_me_cnt & 0xff00) >> 8); | |||
|
693 | housekeeping_packet.hk_lfr_me_cnt[1] = (unsigned char) (hk_lfr_me_cnt & 0x00ff); | |||
|
694 | // HE | |||
|
695 | housekeeping_packet.hk_lfr_he_cnt[0] = (unsigned char) ((hk_lfr_he_cnt & 0xff00) >> 8); | |||
|
696 | housekeeping_packet.hk_lfr_he_cnt[1] = (unsigned char) (hk_lfr_he_cnt & 0x00ff); | |||
|
697 | ||||
|
698 | } |
@@ -695,19 +695,6 void timecode_irq_handler( void *pDev, v | |||||
695 | } |
|
695 | } | |
696 | } |
|
696 | } | |
697 |
|
697 | |||
698 | rtems_timer_service_routine user_routine( rtems_id timer_id, void *user_data ) |
|
|||
699 | { |
|
|||
700 | int linkStatus; |
|
|||
701 | rtems_status_code status; |
|
|||
702 |
|
||||
703 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
|||
704 |
|
||||
705 | if ( linkStatus == 5) { |
|
|||
706 | PRINTF("in spacewire_reset_link *** link is running\n") |
|
|||
707 | status = RTEMS_SUCCESSFUL; |
|
|||
708 | } |
|
|||
709 | } |
|
|||
710 |
|
||||
711 | void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header ) |
|
698 | void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header ) | |
712 | { |
|
699 | { | |
713 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
|
700 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
@@ -179,6 +179,7 int action_enter_mode(ccsdsTelecommandPa | |||||
179 | { |
|
179 | { | |
180 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); |
|
180 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); | |
181 | } |
|
181 | } | |
|
182 | ||||
182 | else // the mode value is valid, check the transition |
|
183 | else // the mode value is valid, check the transition | |
183 | { |
|
184 | { | |
184 | status = check_mode_transition(requestedMode); |
|
185 | status = check_mode_transition(requestedMode); | |
@@ -205,6 +206,8 int action_enter_mode(ccsdsTelecommandPa | |||||
205 | { |
|
206 | { | |
206 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); |
|
207 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); | |
207 |
|
208 | |||
|
209 | ||||
|
210 | ||||
208 | switch(requestedMode) |
|
211 | switch(requestedMode) | |
209 | { |
|
212 | { | |
210 | case LFR_MODE_STANDBY: |
|
213 | case LFR_MODE_STANDBY: | |
@@ -441,6 +444,11 int check_mode_transition( unsigned char | |||||
441 | return status; |
|
444 | return status; | |
442 | } |
|
445 | } | |
443 |
|
446 | |||
|
447 | void update_last_valid_transition_date(unsigned int transitionCoarseTime) | |||
|
448 | { | |||
|
449 | lastValidTransitionDate = transitionCoarseTime; | |||
|
450 | } | |||
|
451 | ||||
444 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
452 | int check_transition_date( unsigned int transitionCoarseTime ) | |
445 | { |
|
453 | { | |
446 | int status; |
|
454 | int status; | |
@@ -581,6 +589,21 int stop_current_mode( void ) | |||||
581 |
|
589 | |||
582 | int enter_mode_standby() |
|
590 | int enter_mode_standby() | |
583 | { |
|
591 | { | |
|
592 | /** This function is used to put LFR in the STANDBY mode. | |||
|
593 | * | |||
|
594 | * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE | |||
|
595 | * | |||
|
596 | * @return RTEMS directive status codes: | |||
|
597 | * - RTEMS_SUCCESSFUL - task restarted successfully | |||
|
598 | * - RTEMS_INVALID_ID - task id invalid | |||
|
599 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
600 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
601 | * | |||
|
602 | * The STANDBY mode does not depends on a specific transition date, the effect of the TC_LFR_ENTER_MODE | |||
|
603 | * is immediate. | |||
|
604 | * | |||
|
605 | */ | |||
|
606 | ||||
584 | int status; |
|
607 | int status; | |
585 |
|
608 | |||
586 | status = stop_current_mode(); // STOP THE CURRENT MODE |
|
609 | status = stop_current_mode(); // STOP THE CURRENT MODE | |
@@ -599,6 +622,21 int enter_mode_standby() | |||||
599 |
|
622 | |||
600 | int enter_mode_normal( unsigned int transitionCoarseTime ) |
|
623 | int enter_mode_normal( unsigned int transitionCoarseTime ) | |
601 | { |
|
624 | { | |
|
625 | /** This function is used to start the NORMAL mode. | |||
|
626 | * | |||
|
627 | * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE | |||
|
628 | * | |||
|
629 | * @return RTEMS directive status codes: | |||
|
630 | * - RTEMS_SUCCESSFUL - task restarted successfully | |||
|
631 | * - RTEMS_INVALID_ID - task id invalid | |||
|
632 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
633 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
634 | * | |||
|
635 | * The way the NORMAL mode is started depends on the LFR current mode. If LFR is in SBM1 or SBM2, | |||
|
636 | * the snapshots are not restarted, only ASM, BP and CWF data generation are affected. | |||
|
637 | * | |||
|
638 | */ | |||
|
639 | ||||
602 | int status; |
|
640 | int status; | |
603 |
|
641 | |||
604 | #ifdef PRINT_TASK_STATISTICS |
|
642 | #ifdef PRINT_TASK_STATISTICS | |
@@ -627,12 +665,12 int enter_mode_normal( unsigned int tran | |||||
627 | } |
|
665 | } | |
628 | break; |
|
666 | break; | |
629 | case LFR_MODE_SBM1: |
|
667 | case LFR_MODE_SBM1: | |
630 | restart_asm_activities( LFR_MODE_NORMAL ); |
|
668 | restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters | |
631 | status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action |
|
669 | status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action | |
632 | break; |
|
670 | break; | |
633 | case LFR_MODE_SBM2: |
|
671 | case LFR_MODE_SBM2: | |
634 | restart_asm_activities( LFR_MODE_NORMAL ); |
|
672 | restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters | |
635 | status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action |
|
673 | status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action | |
636 | break; |
|
674 | break; | |
637 | default: |
|
675 | default: | |
638 | break; |
|
676 | break; | |
@@ -649,6 +687,21 int enter_mode_normal( unsigned int tran | |||||
649 |
|
687 | |||
650 | int enter_mode_burst( unsigned int transitionCoarseTime ) |
|
688 | int enter_mode_burst( unsigned int transitionCoarseTime ) | |
651 | { |
|
689 | { | |
|
690 | /** This function is used to start the BURST mode. | |||
|
691 | * | |||
|
692 | * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE | |||
|
693 | * | |||
|
694 | * @return RTEMS directive status codes: | |||
|
695 | * - RTEMS_SUCCESSFUL - task restarted successfully | |||
|
696 | * - RTEMS_INVALID_ID - task id invalid | |||
|
697 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
698 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
699 | * | |||
|
700 | * The way the BURST mode is started does not depend on the LFR current mode. | |||
|
701 | * | |||
|
702 | */ | |||
|
703 | ||||
|
704 | ||||
652 | int status; |
|
705 | int status; | |
653 |
|
706 | |||
654 | #ifdef PRINT_TASK_STATISTICS |
|
707 | #ifdef PRINT_TASK_STATISTICS | |
@@ -674,6 +727,22 int enter_mode_burst( unsigned int trans | |||||
674 |
|
727 | |||
675 | int enter_mode_sbm1( unsigned int transitionCoarseTime ) |
|
728 | int enter_mode_sbm1( unsigned int transitionCoarseTime ) | |
676 | { |
|
729 | { | |
|
730 | /** This function is used to start the SBM1 mode. | |||
|
731 | * | |||
|
732 | * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE | |||
|
733 | * | |||
|
734 | * @return RTEMS directive status codes: | |||
|
735 | * - RTEMS_SUCCESSFUL - task restarted successfully | |||
|
736 | * - RTEMS_INVALID_ID - task id invalid | |||
|
737 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
738 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
739 | * | |||
|
740 | * The way the SBM1 mode is started depends on the LFR current mode. If LFR is in NORMAL or SBM2, | |||
|
741 | * the snapshots are not restarted, only ASM, BP and CWF data generation are affected. In other | |||
|
742 | * cases, the acquisition is completely restarted. | |||
|
743 | * | |||
|
744 | */ | |||
|
745 | ||||
677 | int status; |
|
746 | int status; | |
678 |
|
747 | |||
679 | #ifdef PRINT_TASK_STATISTICS |
|
748 | #ifdef PRINT_TASK_STATISTICS | |
@@ -724,6 +793,22 int enter_mode_sbm1( unsigned int transi | |||||
724 |
|
793 | |||
725 | int enter_mode_sbm2( unsigned int transitionCoarseTime ) |
|
794 | int enter_mode_sbm2( unsigned int transitionCoarseTime ) | |
726 | { |
|
795 | { | |
|
796 | /** This function is used to start the SBM2 mode. | |||
|
797 | * | |||
|
798 | * @param transitionCoarseTime is the requested transition time contained in the TC_LFR_ENTER_MODE | |||
|
799 | * | |||
|
800 | * @return RTEMS directive status codes: | |||
|
801 | * - RTEMS_SUCCESSFUL - task restarted successfully | |||
|
802 | * - RTEMS_INVALID_ID - task id invalid | |||
|
803 | * - RTEMS_INCORRECT_STATE - task never started | |||
|
804 | * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task | |||
|
805 | * | |||
|
806 | * The way the SBM2 mode is started depends on the LFR current mode. If LFR is in NORMAL or SBM1, | |||
|
807 | * the snapshots are not restarted, only ASM, BP and CWF data generation are affected. In other | |||
|
808 | * cases, the acquisition is completely restarted. | |||
|
809 | * | |||
|
810 | */ | |||
|
811 | ||||
727 | int status; |
|
812 | int status; | |
728 |
|
813 | |||
729 | #ifdef PRINT_TASK_STATISTICS |
|
814 | #ifdef PRINT_TASK_STATISTICS |
General Comments 0
You need to be logged in to leave comments.
Login now