@@ -1,2 +1,2 | |||
|
1 | 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 | 60 | void set_hk_lfr_mag_fields_flag( bool state ); |
|
61 | 61 | void set_hk_lfr_calib_enable( bool state ); |
|
62 | 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 | 65 | extern int sched_yield( void ); |
|
65 | 66 | extern void rtems_cpu_usage_reset(); |
@@ -44,7 +44,6 void spw_send_asm_f2( ring_node *ring_no | |||
|
44 | 44 | void spw_send_k_dump( ring_node *ring_node_to_send ); |
|
45 | 45 | |
|
46 | 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 | 48 | void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc ); |
|
50 | 49 |
@@ -12,6 +12,8 | |||
|
12 | 12 | |
|
13 | 13 | #include "lfr_cpu_usage_report.h" |
|
14 | 14 | |
|
15 | extern unsigned int lastValidTransitionDate; | |
|
16 | ||
|
15 | 17 | //**** |
|
16 | 18 | // ISR |
|
17 | 19 | rtems_isr commutation_isr1( rtems_vector_number vector ); |
@@ -33,6 +35,7 int action_update_time( ccsdsTelecommand | |||
|
33 | 35 | // mode transition |
|
34 | 36 | int check_mode_value( unsigned char requestedMode ); |
|
35 | 37 | int check_mode_transition( unsigned char requestedMode ); |
|
38 | void update_last_valid_transition_date( unsigned int transitionCoarseTime ); | |
|
36 | 39 | int check_transition_date( unsigned int transitionCoarseTime ); |
|
37 | 40 | int stop_spectral_matrices( void ); |
|
38 | 41 | int stop_current_mode( void ); |
@@ -58,6 +58,7 spectral_matrix_regs_t *spectra | |||
|
58 | 58 | // MODE PARAMETERS |
|
59 | 59 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
60 | 60 | struct param_local_str param_local; |
|
61 | unsigned int lastValidTransitionDate; | |
|
61 | 62 | |
|
62 | 63 | // HK PACKETS |
|
63 | 64 | Packet_TM_LFR_HK_t housekeeping_packet; |
@@ -139,6 +139,7 rtems_task Init( rtems_task_argument ign | |||
|
139 | 139 | init_k_coefficients_prc1(); |
|
140 | 140 | init_k_coefficients_prc2(); |
|
141 | 141 | pa_bia_status_info = 0x00; |
|
142 | update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE ); | |
|
142 | 143 | |
|
143 | 144 | // waveform picker initialization |
|
144 | 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 | 295 | spacewire_update_statistics(); |
|
296 | 296 | |
|
297 | hk_lfr_le_me_he_update(); | |
|
298 | ||
|
297 | 299 | housekeeping_packet.hk_lfr_q_sd_fifo_size_max = hk_lfr_q_sd_fifo_size_max; |
|
298 | 300 | housekeeping_packet.hk_lfr_q_rv_fifo_size_max = hk_lfr_q_rv_fifo_size_max; |
|
299 | 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 | 652 | housekeeping_packet.lfr_status_word[1] = housekeeping_packet.lfr_status_word[1] |
|
651 | 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 | 698 | void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header ) |
|
712 | 699 | { |
|
713 | 700 | header->targetLogicalAddress = CCSDS_DESTINATION_ID; |
@@ -179,6 +179,7 int action_enter_mode(ccsdsTelecommandPa | |||
|
179 | 179 | { |
|
180 | 180 | send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_MODE_LFR_SET, requestedMode ); |
|
181 | 181 | } |
|
182 | ||
|
182 | 183 | else // the mode value is valid, check the transition |
|
183 | 184 | { |
|
184 | 185 | status = check_mode_transition(requestedMode); |
@@ -205,6 +206,8 int action_enter_mode(ccsdsTelecommandPa | |||
|
205 | 206 | { |
|
206 | 207 | PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode); |
|
207 | 208 | |
|
209 | ||
|
210 | ||
|
208 | 211 | switch(requestedMode) |
|
209 | 212 | { |
|
210 | 213 | case LFR_MODE_STANDBY: |
@@ -441,6 +444,11 int check_mode_transition( unsigned char | |||
|
441 | 444 | return status; |
|
442 | 445 | } |
|
443 | 446 | |
|
447 | void update_last_valid_transition_date(unsigned int transitionCoarseTime) | |
|
448 | { | |
|
449 | lastValidTransitionDate = transitionCoarseTime; | |
|
450 | } | |
|
451 | ||
|
444 | 452 | int check_transition_date( unsigned int transitionCoarseTime ) |
|
445 | 453 | { |
|
446 | 454 | int status; |
@@ -581,6 +589,21 int stop_current_mode( void ) | |||
|
581 | 589 | |
|
582 | 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 | 607 | int status; |
|
585 | 608 | |
|
586 | 609 | status = stop_current_mode(); // STOP THE CURRENT MODE |
@@ -599,6 +622,21 int enter_mode_standby() | |||
|
599 | 622 | |
|
600 | 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 | 640 | int status; |
|
603 | 641 | |
|
604 | 642 | #ifdef PRINT_TASK_STATISTICS |
@@ -627,12 +665,12 int enter_mode_normal( unsigned int tran | |||
|
627 | 665 | } |
|
628 | 666 | break; |
|
629 | 667 | case LFR_MODE_SBM1: |
|
630 | restart_asm_activities( LFR_MODE_NORMAL ); | |
|
631 | status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action | |
|
668 | restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters | |
|
669 | status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action | |
|
632 | 670 | break; |
|
633 | 671 | case LFR_MODE_SBM2: |
|
634 | restart_asm_activities( LFR_MODE_NORMAL ); | |
|
635 | status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action | |
|
672 | restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters | |
|
673 | status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action | |
|
636 | 674 | break; |
|
637 | 675 | default: |
|
638 | 676 | break; |
@@ -649,6 +687,21 int enter_mode_normal( unsigned int tran | |||
|
649 | 687 | |
|
650 | 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 | 705 | int status; |
|
653 | 706 | |
|
654 | 707 | #ifdef PRINT_TASK_STATISTICS |
@@ -674,6 +727,22 int enter_mode_burst( unsigned int trans | |||
|
674 | 727 | |
|
675 | 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 | 746 | int status; |
|
678 | 747 | |
|
679 | 748 | #ifdef PRINT_TASK_STATISTICS |
@@ -724,6 +793,22 int enter_mode_sbm1( unsigned int transi | |||
|
724 | 793 | |
|
725 | 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 | 812 | int status; |
|
728 | 813 | |
|
729 | 814 | #ifdef PRINT_TASK_STATISTICS |
General Comments 0
You need to be logged in to leave comments.
Login now