##// END OF EJS Templates
3.0.0.19...
paul -
r271:98f943ec5c62 R3a
parent child
Show More
@@ -20,7 +20,7 SWVERSION=-1-0
20 20 DEFINES += SW_VERSION_N1=3 # major
21 21 DEFINES += SW_VERSION_N2=0 # minor
22 22 DEFINES += SW_VERSION_N3=0 # patch
23 DEFINES += SW_VERSION_N4=18 # internal
23 DEFINES += SW_VERSION_N4=19 # internal
24 24
25 25 # <GCOV>
26 26 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
@@ -16,6 +16,7
16 16 extern spw_stats grspw_stats;
17 17 extern rtems_name timecode_timer_name;
18 18 extern rtems_id timecode_timer_id;
19 extern unsigned char oneTcLfrUpdateTimeReceived;
19 20
20 21 // RTEMS TASK
21 22 rtems_task spiq_task( rtems_task_argument argument );
@@ -47,10 +48,10 void spw_send_asm_f1( ring_node *ring_no
47 48 void spw_send_asm_f2( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_ASM_t *header );
48 49 void spw_send_k_dump( ring_node *ring_node_to_send );
49 50
50 rtems_timer_service_routine timecode_timer_routine( rtems_id timer_id, void *user_data );
51 51 unsigned int check_timecode_and_previous_timecode_coherency(unsigned char currentTimecodeCtr);
52 52 unsigned int check_timecode_and_internal_time_coherency(unsigned char timecode, unsigned char internalTime);
53 53 void timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc );
54 rtems_timer_service_routine timecode_timer_routine( rtems_id timer_id, void *user_data );
54 55
55 56 void (*grspw_timecode_callback) ( void *pDev, void *regs, int minor, unsigned int tc );
56 57
@@ -13,6 +13,7
13 13 #include "lfr_cpu_usage_report.h"
14 14
15 15 extern unsigned int lastValidEnterModeTime;
16 extern unsigned char oneTcLfrUpdateTimeReceived;
16 17
17 18 //****
18 19 // ISR
@@ -33,6 +33,7 int fdUART = 0;
33 33 unsigned char lfrCurrentMode;
34 34 unsigned char pa_bia_status_info;
35 35 unsigned char thisIsAnASMRestart = 0;
36 unsigned char oneTcLfrUpdateTimeReceived = 0;
36 37
37 38 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
38 39 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
@@ -813,51 +813,6 void increase_unsigned_char_counter( uns
813 813 }
814 814 }
815 815
816 rtems_timer_service_routine timecode_timer_routine( rtems_id timer_id, void *user_data )
817 {
818 static unsigned char initStep = 1;
819
820 unsigned char currentTimecodeCtr;
821
822 currentTimecodeCtr = (unsigned char) (grspwPtr[0] & TIMECODE_MASK);
823
824 if (initStep == 1)
825 {
826 if (currentTimecodeCtr == previousTimecodeCtr)
827 {
828 //************************
829 // HK_LFR_TIMECODE_MISSING
830 // the timecode value has not changed, no valid timecode has been received, the timecode is MISSING
831 increase_unsigned_char_counter( &housekeeping_packet.hk_lfr_timecode_missing );
832 update_hk_lfr_last_er_fields( RID_LE_LFR_TIMEC, CODE_MISSING );
833 }
834 else if (currentTimecodeCtr == (previousTimecodeCtr+1))
835 {
836 // the timecode value has changed and the value is valid, this is unexpected because
837 // the timer should not have fired, the timecode_irq_handler should have been raised
838 }
839 else
840 {
841 //************************
842 // HK_LFR_TIMECODE_INVALID
843 // the timecode value has changed and the value is not valid, no tickout has been generated
844 // this is why the timer has fired
845 increase_unsigned_char_counter( &housekeeping_packet.hk_lfr_timecode_invalid );
846 update_hk_lfr_last_er_fields( RID_LE_LFR_TIMEC, CODE_INVALID );
847 }
848 }
849 else
850 {
851 initStep = 1;
852 //************************
853 // HK_LFR_TIMECODE_MISSING
854 increase_unsigned_char_counter( &housekeeping_packet.hk_lfr_timecode_missing );
855 update_hk_lfr_last_er_fields( RID_LE_LFR_TIMEC, CODE_MISSING );
856 }
857
858 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_13 );
859 }
860
861 816 unsigned int check_timecode_and_previous_timecode_coherency(unsigned char currentTimecodeCtr)
862 817 {
863 818 /** This function checks the coherency between the incoming timecode and the last valid timecode.
@@ -967,10 +922,13 void timecode_irq_handler( void *pDev, v
967 922 //********************
968 923 // HK_LFR_TIMECODE_CTR
969 924 // check the value of the timecode with respect to the last TC_LFR_UPDATE_TIME => SSS-CP-FS-370
970 if (incomingTimecode != updateTime)
925 if (oneTcLfrUpdateTimeReceived == 1)
971 926 {
972 increase_unsigned_char_counter( &housekeeping_packet.hk_lfr_time_timecode_ctr );
973 update_hk_lfr_last_er_fields( RID_LE_LFR_TIME, CODE_TIMECODE_CTR );
927 if ( incomingTimecode != updateTime )
928 {
929 increase_unsigned_char_counter( &housekeeping_packet.hk_lfr_time_timecode_ctr );
930 update_hk_lfr_last_er_fields( RID_LE_LFR_TIME, CODE_TIMECODE_CTR );
931 }
974 932 }
975 933
976 934 // launch the timecode timer to detect missing or invalid timecodes
@@ -982,6 +940,51 void timecode_irq_handler( void *pDev, v
982 940 }
983 941 }
984 942
943 rtems_timer_service_routine timecode_timer_routine( rtems_id timer_id, void *user_data )
944 {
945 static unsigned char initStep = 1;
946
947 unsigned char currentTimecodeCtr;
948
949 currentTimecodeCtr = (unsigned char) (grspwPtr[0] & TIMECODE_MASK);
950
951 if (initStep == 1)
952 {
953 if (currentTimecodeCtr == previousTimecodeCtr)
954 {
955 //************************
956 // HK_LFR_TIMECODE_MISSING
957 // the timecode value has not changed, no valid timecode has been received, the timecode is MISSING
958 increase_unsigned_char_counter( &housekeeping_packet.hk_lfr_timecode_missing );
959 update_hk_lfr_last_er_fields( RID_LE_LFR_TIMEC, CODE_MISSING );
960 }
961 else if (currentTimecodeCtr == (previousTimecodeCtr+1))
962 {
963 // the timecode value has changed and the value is valid, this is unexpected because
964 // the timer should not have fired, the timecode_irq_handler should have been raised
965 }
966 else
967 {
968 //************************
969 // HK_LFR_TIMECODE_INVALID
970 // the timecode value has changed and the value is not valid, no tickout has been generated
971 // this is why the timer has fired
972 increase_unsigned_char_counter( &housekeeping_packet.hk_lfr_timecode_invalid );
973 update_hk_lfr_last_er_fields( RID_LE_LFR_TIMEC, CODE_INVALID );
974 }
975 }
976 else
977 {
978 initStep = 1;
979 //************************
980 // HK_LFR_TIMECODE_MISSING
981 increase_unsigned_char_counter( &housekeeping_packet.hk_lfr_timecode_missing );
982 update_hk_lfr_last_er_fields( RID_LE_LFR_TIMEC, CODE_MISSING );
983 }
984
985 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_13 );
986 }
987
985 988 void init_header_cwf( Header_TM_LFR_SCIENCE_CWF_t *header )
986 989 {
987 990 header->targetLogicalAddress = CCSDS_DESTINATION_ID;
@@ -206,8 +206,6 int action_enter_mode(ccsdsTelecommandPa
206 206 {
207 207 PRINTF1("OK *** in action_enter_mode *** enter mode %d\n", requestedMode);
208 208
209 update_last_valid_transition_date( transitionCoarseTime );
210
211 209 switch(requestedMode)
212 210 {
213 211 case LFR_MODE_STANDBY:
@@ -361,6 +359,8 int action_update_time(ccsdsTelecommandP
361 359 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
362 360 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
363 361
362 oneTcLfrUpdateTimeReceived = 1;
363
364 364 return LFR_SUCCESSFUL;
365 365 }
366 366
@@ -454,7 +454,7 void update_last_valid_transition_date(
454 454 if (transitionCoarseTime == 0)
455 455 {
456 456 lastValidEnterModeTime = time_management_regs->coarse_time + 1;
457 PRINTF1("lastValidEnterModeTime = 0x%x (transitionCoarseTime = 0 => coarse_time+1)\n", transitionCoarseTime);
457 PRINTF1("lastValidEnterModeTime = 0x%x (transitionCoarseTime = 0 => coarse_time+1)\n", lastValidEnterModeTime);
458 458 }
459 459 else
460 460 {
@@ -681,12 +681,14 int enter_mode_normal( unsigned int tran
681 681 }
682 682 break;
683 683 case LFR_MODE_SBM1:
684 restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
684 status = restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
685 685 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
686 update_last_valid_transition_date( transitionCoarseTime );
686 687 break;
687 688 case LFR_MODE_SBM2:
688 restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
689 status = restart_asm_activities( LFR_MODE_NORMAL ); // this is necessary to restart ASM tasks to update the parameters
689 690 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
691 update_last_valid_transition_date( transitionCoarseTime );
690 692 break;
691 693 default:
692 694 break;
@@ -778,8 +780,9 int enter_mode_sbm1( unsigned int transi
778 780 }
779 781 break;
780 782 case LFR_MODE_NORMAL: // lfrCurrentMode will be updated after the execution of close_action
781 restart_asm_activities( LFR_MODE_SBM1 );
783 status = restart_asm_activities( LFR_MODE_SBM1 );
782 784 status = LFR_SUCCESSFUL;
785 update_last_valid_transition_date( transitionCoarseTime );
783 786 break;
784 787 case LFR_MODE_BURST:
785 788 status = stop_current_mode(); // stop the current mode
@@ -791,8 +794,9 int enter_mode_sbm1( unsigned int transi
791 794 }
792 795 break;
793 796 case LFR_MODE_SBM2:
794 restart_asm_activities( LFR_MODE_SBM1 );
797 status = restart_asm_activities( LFR_MODE_SBM1 );
795 798 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
799 update_last_valid_transition_date( transitionCoarseTime );
796 800 break;
797 801 default:
798 802 break;
@@ -844,8 +848,9 int enter_mode_sbm2( unsigned int transi
844 848 }
845 849 break;
846 850 case LFR_MODE_NORMAL:
847 restart_asm_activities( LFR_MODE_SBM2 );
851 status = restart_asm_activities( LFR_MODE_SBM2 );
848 852 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
853 update_last_valid_transition_date( transitionCoarseTime );
849 854 break;
850 855 case LFR_MODE_BURST:
851 856 status = stop_current_mode(); // stop the current mode
@@ -857,8 +862,9 int enter_mode_sbm2( unsigned int transi
857 862 }
858 863 break;
859 864 case LFR_MODE_SBM1:
860 restart_asm_activities( LFR_MODE_SBM2 );
865 status = restart_asm_activities( LFR_MODE_SBM2 );
861 866 status = LFR_SUCCESSFUL; // lfrCurrentMode will be updated after the execution of close_action
867 update_last_valid_transition_date( transitionCoarseTime );
862 868 break;
863 869 default:
864 870 break;
@@ -1273,7 +1279,7 void launch_waveform_picker( unsigned ch
1273 1279 if (transitionCoarseTime == 0)
1274 1280 {
1275 1281 // instant transition means transition on the next valid date
1276 // this is mandatory to have a good snapshot period a a good correction of the snapshot period
1282 // this is mandatory to have a good snapshot period and a good correction of the snapshot period
1277 1283 waveform_picker_regs->start_date = time_management_regs->coarse_time + 1;
1278 1284 }
1279 1285 else
@@ -964,6 +964,7 void snapshot_resynchronization( unsigne
964 964
965 965 static double correction = 0.;
966 966 static resynchro_state state = MEASURE;
967 static unsigned int nbSnapshots = 0;
967 968
968 969 int correctionInt;
969 970
@@ -974,7 +975,7 void snapshot_resynchronization( unsigne
974 975
975 976 case MEASURE:
976 977 // ********
977 PRINTF("MEASURE ===\n");
978 PRINTF1("MEASURE === %d\n", nbSnapshots);
978 979 state = CORRECTION;
979 980 correction = computeCorrection( timePtr );
980 981 PRINTF1("MEASURE === correction = %.2f\n", correction );
@@ -985,7 +986,7 void snapshot_resynchronization( unsigne
985 986
986 987 case CORRECTION:
987 988 //************
988 PRINTF("CORRECTION ===\n");
989 PRINTF1("CORRECTION === %d\n", nbSnapshots);
989 990 state = MEASURE;
990 991 computeCorrection( timePtr );
991 992 correction = -correction;
@@ -999,6 +1000,8 void snapshot_resynchronization( unsigne
999 1000 break;
1000 1001
1001 1002 }
1003
1004 nbSnapshots++;
1002 1005 }
1003 1006
1004 1007 //**************
General Comments 0
You need to be logged in to leave comments. Login now